Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

feat(super-tabs): show agent status and work details in roster (#1545)

0xken15635d343e942f
diff --git a/desktop/lib/super_tabs/agent_details.dart b/desktop/lib/super_tabs/agent_details.dart
new file mode 100644
index 000000000..beae8b6fd
--- /dev/null
+++ b/desktop/lib/super_tabs/agent_details.dart
@@ -0,0 +1,325 @@
+import 'dart:async';
+
+import 'package:flutter/material.dart';
+import 'package:url_launcher/url_launcher.dart';
+
+import '../core/models.dart';
+import '../core/permission_modes.dart';
+import '../core/relative_time.dart';
+import '../shared/widgets/app_dialog.dart';
+import '../state/app_state.dart';
+import '../state/harness_activity.dart';
+import '../widgets/desktop_chrome.dart';
+import '../widgets/engine_identity.dart';
+import 'controller.dart';
+import 'identity.dart';
+import 'model.dart';
+import 'pull_requests.dart';
+
+/// Facts already observed by the Swarm or the agent's machine. Unknown facts
+/// stay absent; an idle or working claim needs actual work or native activity.
+class SuperTabAgentInfo {
+ SuperTabAgentInfo(
+ SuperTabController controller,
+ AppNotifier? app,
+ SuperTabAgent agent, {
+ HarnessActivity? activity,
+ }) : this._(
+ controller,
+ app,
+ agent,
+ activity,
+ app
+ ?.stateOf(agent.machineId)
+ ?.agents
+ .where((a) => a.id == agent.harnessId)
+ .firstOrNull,
+ controller.snapshot?.conversations
+ .where(
+ (g) =>
+ !g.archived &&
+ g.assignment?['agentId'] == agent.id &&
+ !const {'done', 'stopped'}.contains(g.assignment?['status']),
+ )
+ .firstOrNull,
+ );
+
+ SuperTabAgentInfo._(
+ this.controller,
+ this.app,
+ this.agent,
+ this.activity,
+ this.native,
+ this.taskGroup,
+ );
+
+ final SuperTabController controller;
+ final AppNotifier? app;
+ final SuperTabAgent agent;
+ final HarnessActivity? activity;
+ final Agent? native;
+ final SuperTabConversation? taskGroup;
+
+ String? get model =>
+ _known(native?.modelName) ??
+ _known(agent.configuration['model'] as String?);
+ String? get engine =>
+ _known(agent.engine) == null ? null : engineIdentity(agent.engine).label;
+ String? get machine =>
+ _known(app?.stateOf(agent.machineId)?.machine.displayName) ??
+ _known(
+ controller.snapshot?.machines
+ .where((m) => m['machineId'] == agent.machineId)
+ .firstOrNull?['name']
+ as String?,
+ );
+ String? get folder => _known(native?.project?.cwd);
+ DateTime? get started => native?.createdAt;
+ DateTime? get lastActive => native?.lastActivityAt;
+ bool get hasQuestion =>
+ app?.questionFor(agent.machineId, agent.harnessId) != null;
+
+ String? get questionOwner {
+ if (!hasQuestion) return null;
+ final execution = taskGroup?.assignment?['execution'];
+ final ownerId = execution is Map ? execution['machineOwnerId'] : null;
+ final person = controller.snapshot?.people
+ .where((p) => p.id == ownerId)
+ .firstOrNull;
+ return _known(person == null ? null : superTabPersonName(person.email)) ??
+ _known(app?.stateOf(agent.machineId)?.machine.machineShare?.owner) ??
+ _known(app?.stateOf(agent.machineId)?.machine.ownerName);
+ }
+
+ String? get permission {
+ final mode = _known(native?.permissionMode);
+ if (mode == null) return null;
+ return permissionModesOf(agent.engine)
+ .where((choice) => choice.id == mode)
+ .firstOrNull
+ ?.label ??
+ 'Unrecognized setting';
+ }
+
+ String? get status {
+ if (activity
+ case HarnessActivity.offline ||
+ HarnessActivity.paused ||
+ HarnessActivity.failed ||
+ HarnessActivity.starting) {
+ return activity!.label;
+ }
+ final workStatus = taskGroup?.assignment?['status'];
+ if (hasQuestion || workStatus == 'needs_human') {
+ return 'Waiting for a person to answer';
+ }
+ if (activity == HarnessActivity.needsInput) return 'Needs input';
+ if (taskGroup case final group?) {
+ return switch (workStatus) {
+ 'planned' => 'Assigned to "${group.title}"',
+ 'blocked' => 'Stuck on "${group.title}"',
+ 'review' => 'Waiting for review on "${group.title}"',
+ 'reconciling' => 'Checking "${group.title}"',
+ _ => 'Working on "${group.title}"',
+ };
+ }
+ return switch (activity) {
+ HarnessActivity.working => 'Working',
+ HarnessActivity.idle => 'Idle',
+ HarnessActivity.done => 'Finished',
+ HarnessActivity.needsInput => 'Needs input',
+ _ => null,
+ };
+ }
+
+ String get tooltip => [
+ if (engine case final value?) [value, ?model].join(' '),
+ ?machine,
+ if (status case final value?)
+ taskGroup == null
+ ? value
+ : value.replaceFirst(
+ taskGroup!.title,
+ _compactTitle(taskGroup!.title),
+ ),
+ if (lastActive case final value?)
+ 'Last active ${relativeAgo(value, DateTime.now())}',
+ ].join(' · ');
+
+ Uri? get latestGroupPr {
+ final group = taskGroup;
+ if (group == null) return null;
+ final result = group.assignment?['result'];
+ if (result is String) {
+ final links = superTabPullRequestLinks(result);
+ if (links.isNotEmpty) return links.last;
+ }
+ return _agentMessagePr(controller, group.id, agent.id);
+ }
+}
+
+String? _known(String? text) =>
+ text?.trim().isNotEmpty == true ? text!.trim() : null;
+
+String _compactTitle(String title) =>
+ title.length <= 52 ? title : '${title.substring(0, 52).trimRight()}…';
+
+Uri? _agentMessagePr(
+ SuperTabController controller,
+ String groupId,
+ String agentId,
+) {
+ for (final message in controller.messages(groupId).reversed) {
+ if (!message.fromAgent ||
+ message.authorId != agentId ||
+ message.fromTerminal) {
+ continue;
+ }
+ final links = superTabPullRequestLinks(message.text);
+ if (links.isNotEmpty) return links.last;
+ }
+ return null;
+}
+
+Future<void> _loadTaskPr(
+ SuperTabController controller,
+ String groupId,
+ String agentId,
+) async {
+ await controller.loadMessages(groupId);
+ // A details dialog must not walk an entire conversation when no PR exists.
+ for (var page = 1; page < 3 && controller.hasOlder(groupId); page++) {
+ final group = controller.snapshot?.conversation(groupId);
+ if (group == null) return;
+ final result = group.assignment?['result'];
+ if (result is String && superTabPullRequestLinks(result).isNotEmpty) return;
+ if (_agentMessagePr(controller, groupId, agentId) != null) return;
+ final count = controller.messages(groupId).length;
+ await controller.loadMessages(groupId, older: true);
+ if (controller.messages(groupId).length == count) return;
+ }
+}
+
+Future<void> showSuperTabAgentDetails(
+ BuildContext context,
+ SuperTabController controller,
+ AppNotifier? app,
+ SuperTabAgent agent,
+ ValueChanged<SuperTabAgent> onOpenAgent,
+) {
+ final taskGroup = SuperTabAgentInfo(controller, app, agent).taskGroup;
+ if (taskGroup != null) {
+ unawaited(_loadTaskPr(controller, taskGroup.id, agent.id));
+ }
+ return showAppDialog<void>(
+ context: context,
+ builder: (context) => ListenableBuilder(
+ listenable: Listenable.merge([controller, ?app]),
+ builder: (context, _) {
+ final current = controller.snapshot?.agent(agent.id) ?? agent;
+ final info = SuperTabAgentInfo(controller, app, current);
+ final group = info.taskGroup;
+ final pr = info.latestGroupPr;
+ final name = controller.snapshot?.agentName(agent.id) ?? agent.name;
+ return AlertDialog(
+ title: Text(name),
+ content: SizedBox(
+ width: 440,
+ child: SingleChildScrollView(
+ child: SelectionArea(
+ child: Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ _fact(
+ 'Role',
+ controller.snapshot?.isLead(agent.id) == true
+ ? 'Product Manager'
+ : current.isReviewer
+ ? 'Reviewer'
+ : 'Engineer',
+ ),
+ if (info.engine case final value?) _fact('Engine', value),
+ if (current.name != name) _fact('Agent name', current.name),
+ if (info.model case final value?) _fact('Model', value),
+ if (group != null)
+ _link(
+ 'Task',
+ group.title,
+ onPressed: () {
+ Navigator.pop(context);
+ controller.select(group.id);
+ },
+ ),
+ if (pr != null)
+ _link(
+ 'Latest PR',
+ 'PR #${pr.pathSegments[3]}',
+ tooltip: pr.toString(),
+ onPressed: () => unawaited(
+ launchUrl(pr, mode: LaunchMode.externalApplication),
+ ),
+ ),
+ if (info.machine case final value?) _fact('Machine', value),
+ if (info.folder case final value?)
+ _fact('Working folder', value),
+ if (info.permission case final value?)
+ _fact('Permission mode', value),
+ if (info.started case final value?)
+ _fact('Started', fullDateTime(value)),
+ if (info.questionOwner case final value?)
+ _fact('Who can answer', value),
+ ],
+ ),
+ ),
+ ),
+ ),
+ actions: [
+ TextButton(
+ onPressed: () => Navigator.pop(context),
+ child: const Text('Close'),
+ ),
+ FilledButton(
+ onPressed: () {
+ Navigator.pop(context);
+ onOpenAgent(current);
+ },
+ child: const Text('Open terminal'),
+ ),
+ ],
+ );
+ },
+ ),
+ );
+}
+
+Widget _fact(String label, String value) => Padding(
+ padding: const EdgeInsets.only(bottom: 10),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(label, style: DesktopChrome.metadata()),
+ const SizedBox(height: 2),
+ Text(value, style: DesktopChrome.control()),
+ ],
+ ),
+);
+
+Widget _link(
+ String label,
+ String text, {
+ String? tooltip,
+ required VoidCallback onPressed,
+}) => Padding(
+ padding: const EdgeInsets.only(bottom: 10),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(label, style: DesktopChrome.metadata()),
+ Tooltip(
+ message: tooltip ?? text,
+ child: TextButton(onPressed: onPressed, child: Text(text)),
+ ),
+ ],
+ ),
+);
diff --git a/desktop/lib/super_tabs/roster.dart b/desktop/lib/super_tabs/roster.dart
index 33fa0ff11..5a2d17071 100644
--- a/desktop/lib/super_tabs/roster.dart
+++ b/desktop/lib/super_tabs/roster.dart
@@ -10,8 +10,8 @@ import '../state/harness_activity.dart';
import '../terminal/terminal_theme.dart';
import '../terminal/terminal_theme_store.dart';
import '../widgets/desktop_chrome.dart';
-import '../widgets/engine_identity.dart';
import '../widgets/harness_activity_mark.dart';
+import 'agent_details.dart';
import 'controller.dart';
import 'dialog_scope.dart';
import 'identity.dart';
@@ -50,12 +50,6 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
.firstOrNull
?.projectId;
- String _role(SuperTabAgent agent) => c.snapshot!.isLead(agent.id)
- ? 'Product Manager'
- : agent.isReviewer
- ? 'Reviewer'
- : 'Engineer';
-
bool _canRemove(SuperTabAgent agent) =>
c.canWrite && (c.isOwner || agent.contributorId == c.accountId);
@@ -188,62 +182,17 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
return native ?? HarnessActivity.unknown;
}
- Future<void> _details(SuperTabAgent agent) => showAppDialog<void>(
- context: context,
- builder: (context) => AlertDialog(
- title: Text(c.snapshot!.agentName(agent.id)),
- content: SizedBox(
- width: 320,
- child: Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(_role(agent)),
- Text(engineIdentity(agent.engine).label),
- if (agent.name != c.snapshot!.agentName(agent.id))
- Padding(
- padding: const EdgeInsets.only(top: 8),
- child: Text('Harness: ${agent.name}'),
- ),
- for (final field in [
- ('Model', 'model'),
- ('Effort', 'effort'),
- ('Context', 'contextWindow'),
- ('Version', 'engineVersion'),
- ])
- if (agent.configuration[field.$2] case final value?)
- Padding(
- padding: const EdgeInsets.only(top: 8),
- child: Text('${field.$1}: $value'),
- ),
- Padding(
- padding: const EdgeInsets.only(top: 8),
- child: Text(
- widget.app?.stateOf(agent.machineId)?.machine.displayName ??
- 'Machine unavailable',
- ),
- ),
- ],
- ),
- ),
- actions: [
- TextButton(
- onPressed: () => Navigator.pop(context),
- child: const Text('Close'),
- ),
- FilledButton(
- onPressed: () {
- Navigator.pop(context);
- widget.onOpenAgent(agent);
- },
- child: const Text('Open terminal'),
- ),
- ],
- ),
+ Future<void> _details(SuperTabAgent agent) => showSuperTabAgentDetails(
+ context,
+ c,
+ widget.app,
+ agent,
+ widget.onOpenAgent,
);
Widget _agent(SuperTabAgent agent) {
final name = c.snapshot!.agentName(agent.id), activity = _activity(agent);
+ final info = SuperTabAgentInfo(c, widget.app, agent, activity: activity);
final project = c.snapshot!.projects
.where((p) => p.id == _agentProjectId(agent))
.firstOrNull;
@@ -251,54 +200,52 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
grid.AppTheme.surfacePalette,
terminalThemeStore.value,
);
- return GestureDetector(
- onSecondaryTapUp: (event) async {
- final choice = await showMenu<String>(
- context: context,
- position: RelativeRect.fromLTRB(
- event.globalPosition.dx,
- event.globalPosition.dy,
- event.globalPosition.dx,
- event.globalPosition.dy,
- ),
- items: [
- const PopupMenuItem(value: 'details', child: Text('Details')),
- if (_canRemove(c.snapshot?.agent(agent.id) ?? agent))
- const PopupMenuItem(
- value: 'remove',
- child: Text('Remove from Swarm'),
- ),
- ],
- );
- if (choice == 'details' && mounted) await _details(agent);
- if (choice == 'remove' && mounted) {
- final current = c.snapshot?.agent(agent.id);
- if (current != null && _canRemove(current)) await _remove(current);
- }
- },
- child: ListTile(
- key: ValueKey('super-member-${agent.id}'),
- dense: true,
- minTileHeight: 48,
- minVerticalPadding: 6,
- contentPadding: const EdgeInsets.symmetric(horizontal: 16),
- title: Row(
- children: [
- Tooltip(
- message: engineIdentity(agent.engine).label,
- child: SuperTabAvatar(
+ return Tooltip(
+ message: info.tooltip,
+ constraints: const BoxConstraints(maxWidth: 820),
+ child: GestureDetector(
+ onSecondaryTapUp: (event) async {
+ final choice = await showMenu<String>(
+ context: context,
+ position: RelativeRect.fromLTRB(
+ event.globalPosition.dx,
+ event.globalPosition.dy,
+ event.globalPosition.dx,
+ event.globalPosition.dy,
+ ),
+ items: [
+ const PopupMenuItem(value: 'details', child: Text('Details')),
+ if (_canRemove(c.snapshot?.agent(agent.id) ?? agent))
+ const PopupMenuItem(
+ value: 'remove',
+ child: Text('Remove from Swarm'),
+ ),
+ ],
+ );
+ if (choice == 'details' && mounted) await _details(agent);
+ if (choice == 'remove' && mounted) {
+ final current = c.snapshot?.agent(agent.id);
+ if (current != null && _canRemove(current)) await _remove(current);
+ }
+ },
+ child: ListTile(
+ key: ValueKey('super-member-${agent.id}'),
+ dense: true,
+ minTileHeight: 48,
+ minVerticalPadding: 6,
+ contentPadding: const EdgeInsets.symmetric(horizontal: 16),
+ title: Row(
+ children: [
+ SuperTabAvatar(
identity: 'agent:${agent.id}',
name: name,
size: 24,
),
- ),
- const SizedBox(width: 8),
- Expanded(
- child: Row(
- children: [
- Flexible(
- child: Tooltip(
- message: name,
+ const SizedBox(width: 8),
+ Expanded(
+ child: Row(
+ children: [
+ Flexible(
child: Text(
name,
maxLines: 1,
@@ -306,12 +253,13 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
style: DesktopChrome.control(),
),
),
- ),
- const SizedBox(width: 6),
- Tooltip(
- message: _role(agent),
- child: Semantics(
- label: _role(agent),
+ const SizedBox(width: 6),
+ Semantics(
+ label: c.snapshot!.isLead(agent.id)
+ ? 'Product Manager'
+ : agent.isReviewer
+ ? 'Reviewer'
+ : 'Engineer',
excludeSemantics: true,
child: Container(
padding: const EdgeInsets.symmetric(
@@ -332,27 +280,25 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
),
),
),
- ),
- ],
+ ],
+ ),
),
- ),
- const SizedBox(width: 8),
- ActivityMark(
- activity: activity,
- color: activityColor(
- activity,
- theme,
- color: appearancePrefsStore.value.prompt.color,
+ const SizedBox(width: 8),
+ ActivityMark(
+ activity: activity,
+ tooltip: false,
+ color: activityColor(
+ activity,
+ theme,
+ color: appearancePrefsStore.value.prompt.color,
+ ),
),
- ),
- ],
- ),
- subtitle: project == null
- ? null
- : Padding(
- padding: const EdgeInsets.only(left: 32),
- child: Tooltip(
- message: project.name,
+ ],
+ ),
+ subtitle: project == null
+ ? null
+ : Padding(
+ padding: const EdgeInsets.only(left: 32),
child: Text(
project.name,
maxLines: 1,
@@ -360,9 +306,9 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
style: DesktopChrome.metadata(),
),
),
- ),
- onTap: () => widget.onOpenAgent(agent),
- onLongPress: () => unawaited(_details(agent)),
+ onTap: () => unawaited(_details(agent)),
+ onLongPress: () => unawaited(_details(agent)),
+ ),
),
);
}
diff --git a/desktop/test/super_tab_roster_test.dart b/desktop/test/super_tab_roster_test.dart
index e6dd391ca..c900c046d 100644
--- a/desktop/test/super_tab_roster_test.dart
+++ b/desktop/test/super_tab_roster_test.dart
@@ -6,6 +6,7 @@ import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/core/models.dart';
+import 'package:harness/core/relative_time.dart';
import 'package:harness/notify/alert_sounds.dart';
import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/state/harness_activity.dart';
@@ -158,6 +159,384 @@ void main() {
await tester.pumpAndSettle();
}
+ String rowTooltip(WidgetTester tester, RosterFixture f, int agent) => tester
+ .widgetList<Tooltip>(
+ find.ancestor(of: f.row(agent), matching: find.byType(Tooltip)),
+ )
+ .single
+ .message!;
+
+ testWidgets(
+ 'agent tooltip combines known model, machine, task and activity',
+ (tester) async {
+ final f = await fixture(tester);
+ final lastActive = DateTime.now().subtract(const Duration(hours: 2));
+ (f.server.state['agents'] as List)[1]['configuration'] = {
+ 'engine': 'claude',
+ 'model': 'opus',
+ };
+ (f.server.state['conversations'] as List)[1]['assignment'] = {
+ 'agentId': 'agent-1',
+ 'status': 'working',
+ };
+ f.app.stateOf('m')!.agents = [
+ Agent(
+ id: 'a1',
+ name: 'Multiply',
+ engine: 'claude',
+ lastActivityAt: lastActive,
+ ),
+ ];
+ await f.controller.refresh();
+ await f.show(tester);
+ expect(
+ rowTooltip(tester, f, 1),
+ 'Claude opus · Test host · Working on "Offline editing" · Last active 2 hours ago',
+ );
+ final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
+ await mouse.addPointer(location: Offset.zero);
+ await mouse.moveTo(tester.getCenter(f.row(1)));
+ await tester.pumpAndSettle(const Duration(milliseconds: 800));
+ expect(find.text(rowTooltip(tester, f, 1)), findsOneWidget);
+ await mouse.removePointer();
+ await f.close(tester);
+ },
+ );
+
+ testWidgets('agent tooltip omits data that neither state nor host knows', (
+ tester,
+ ) async {
+ final f = await fixture(tester);
+ await f.show(tester, nativeState: false);
+ expect(rowTooltip(tester, f, 0), 'Codex');
+ await tester.tap(f.row(0));
+ await tester.pumpAndSettle();
+ for (final absent in [
+ 'Model',
+ 'Task',
+ 'Latest PR',
+ 'Machine',
+ 'Working folder',
+ 'Permission mode',
+ 'Started',
+ 'Who can answer',
+ ]) {
+ expect(find.text(absent), findsNothing);
+ }
+ await f.close(tester);
+ });
+
+ testWidgets('agent tooltip keeps native input need above active work', (
+ tester,
+ ) async {
+ final f = await fixture(tester);
+ (f.server.state['conversations'] as List)[1]['assignment'] = {
+ 'agentId': 'agent-1',
+ 'status': 'working',
+ };
+ f.app.stateOf('m')!.agents = const [
+ Agent(
+ id: 'a1',
+ name: 'Multiply',
+ engine: 'claude',
+ launchState: 'failed',
+ launchError: 'RESUME_UNCONFIRMED',
+ ),
+ ];
+ await f.controller.refresh();
+ await f.show(tester);
+ expect(f.activity(tester, 1), HarnessActivity.needsInput);
+ expect(rowTooltip(tester, f, 1), contains('Needs input'));
+ expect(rowTooltip(tester, f, 1), isNot(contains('Working on')));
+ await f.close(tester);
+ });
+
+ testWidgets('agent tooltip shortens a long task title to one line', (
+ tester,
+ ) async {
+ final f = await fixture(tester);
+ await tester.binding.setSurfaceSize(const Size(1000, 700));
+ final title = 'A long task title ' * 12;
+ (f.server.state['conversations'] as List)[1]
+ ..['title'] = title
+ ..['assignment'] = {'agentId': 'agent-1', 'status': 'working'};
+ await f.controller.refresh();
+ await f.show(tester);
+ final tooltip = rowTooltip(tester, f, 1);
+ expect(tooltip, contains('…'));
+ expect(tooltip, isNot(contains(title)));
+ final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
+ await mouse.addPointer(location: Offset.zero);
+ await mouse.moveTo(tester.getCenter(f.row(1)));
+ await tester.pumpAndSettle(const Duration(milliseconds: 800));
+ final text = find.text(tooltip);
+ expect(text, findsOneWidget);
+ expect(tester.getSize(text).height, lessThan(30));
+ await mouse.removePointer();
+ await f.close(tester);
+ });
+
+ testWidgets('agent details link the held task and latest group PR', (
+ tester,
+ ) async {
+ final f = await fixture(tester);
+ final started = DateTime.utc(2026, 10, 21, 9, 15);
+ (f.server.state['conversations'] as List)[1]['assignment'] = {
+ 'agentId': 'agent-1',
+ 'status': 'working',
+ };
+ f.server.append(
+ 'Earlier PR https://github.com/acme/project/pull/41',
+ conversationId: 'offline',
+ );
+ f.server.messages.last['author'] = {
+ 'kind': 'agent',
+ 'id': 'agent-1',
+ 'name': 'Multiply',
+ };
+ f.server.append(
+ 'Current PR https://github.com/acme/project/pull/42',
+ conversationId: 'offline',
+ );
+ f.server.messages.last['author'] = {
+ 'kind': 'agent',
+ 'id': 'agent-1',
+ 'name': 'Multiply',
+ };
+ f.app.stateOf('m')!.agents = [
+ Agent(
+ id: 'a1',
+ name: 'Multiply',
+ engine: 'claude',
+ project: const AgentProject(name: 'project', cwd: '/work/project'),
+ permissionMode: 'auto',
+ createdAt: started,
+ ),
+ ];
+ await f.controller.refresh();
+ await f.show(tester);
+ await tester.tap(f.row(1));
+ await tester.pumpAndSettle();
+ expect(find.byType(AlertDialog), findsOneWidget);
+ expect(find.widgetWithText(TextButton, 'Offline editing'), findsOneWidget);
+ expect(
+ find.byTooltip('https://github.com/acme/project/pull/42'),
+ findsOneWidget,
+ );
+ expect(
+ find.byTooltip('https://github.com/acme/project/pull/41'),
+ findsNothing,
+ );
+ expect(
+ find.descendant(
+ of: find.byType(AlertDialog),
+ matching: find.text('Test host'),
+ ),
+ findsOneWidget,
+ );
+ expect(find.text('/work/project'), findsOneWidget);
+ expect(find.text('Auto-approve'), findsOneWidget);
+ expect(find.text(fullDateTime(started)), findsOneWidget);
+ await tester.tap(find.widgetWithText(TextButton, 'Offline editing'));
+ await tester.pumpAndSettle();
+ expect(f.controller.selectedId, 'offline');
+ expect(find.byType(AlertDialog), findsNothing);
+ await f.close(tester);
+ });
+
+ testWidgets('current task result PR beats older group messages', (
+ tester,
+ ) async {
+ final f = await fixture(tester);
+ (f.server.state['conversations'] as List)[1]['assignment'] = {
+ 'agentId': 'agent-1',
+ 'status': 'working',
+ 'result': 'https://github.com/acme/project/pull/42',
+ };
+ f.server.append(
+ 'Old PR https://github.com/acme/project/pull/41',
+ conversationId: 'offline',
+ );
+ await f.controller.refresh();
+ await f.show(tester);
+ await tester.tap(f.row(1));
+ await tester.pumpAndSettle();
+ expect(
+ find.byTooltip('https://github.com/acme/project/pull/42'),
+ findsOneWidget,
+ );
+ expect(
+ find.byTooltip('https://github.com/acme/project/pull/41'),
+ findsNothing,
+ );
+ await f.close(tester);
+ });
+
+ testWidgets('details find a PR in older group message pages', (tester) async {
+ final f = await fixture(tester);
+ (f.server.state['conversations'] as List)[1]['assignment'] = {
+ 'agentId': 'agent-1',
+ 'status': 'working',
+ };
+ f.server.append(
+ 'PR https://github.com/acme/project/pull/42',
+ conversationId: 'offline',
+ );
+ f.server.messages.last['author'] = {
+ 'kind': 'agent',
+ 'id': 'agent-1',
+ 'name': 'Multiply',
+ };
+ for (var i = 0; i < 105; i++) {
+ f.server.append('Update $i', conversationId: 'offline');
+ }
+ await f.controller.refresh();
+ await f.show(tester);
+ await tester.tap(f.row(1));
+ await tester.pumpAndSettle();
+ expect(
+ find.byTooltip('https://github.com/acme/project/pull/42'),
+ findsOneWidget,
+ );
+ await f.close(tester);
+ });
+
+ testWidgets('details ignore another agent’s later PR in the same group', (
+ tester,
+ ) async {
+ final f = await fixture(tester);
+ (f.server.state['conversations'] as List)[1]['assignment'] = {
+ 'agentId': 'agent-1',
+ 'status': 'working',
+ };
+ f.server.append(
+ 'My PR https://github.com/acme/project/pull/42',
+ conversationId: 'offline',
+ );
+ f.server.messages.last['author'] = {
+ 'kind': 'agent',
+ 'id': 'agent-1',
+ 'name': 'Multiply',
+ };
+ f.server.append(
+ 'Other PR https://github.com/acme/project/pull/43',
+ conversationId: 'offline',
+ );
+ f.server.messages.last['author'] = {
+ 'kind': 'agent',
+ 'id': 'agent-3',
+ 'name': 'Divide',
+ };
+ await f.controller.refresh();
+ await f.show(tester);
+ await tester.tap(f.row(1));
+ await tester.pumpAndSettle();
+ expect(
+ find.byTooltip('https://github.com/acme/project/pull/42'),
+ findsOneWidget,
+ );
+ expect(
+ find.byTooltip('https://github.com/acme/project/pull/43'),
+ findsNothing,
+ );
+ await f.close(tester);
+ });
+
+ testWidgets('details stop paging when no PR belongs to this agent', (
+ tester,
+ ) async {
+ final f = await fixture(tester);
+ (f.server.state['conversations'] as List)[1]['assignment'] = {
+ 'agentId': 'agent-1',
+ 'status': 'working',
+ };
+ f.server.append(
+ 'Other PR https://github.com/acme/project/pull/43',
+ conversationId: 'offline',
+ );
+ f.server.messages.last['author'] = {
+ 'kind': 'agent',
+ 'id': 'agent-3',
+ 'name': 'Divide',
+ };
+ for (var i = 0; i < 350; i++) {
+ f.server.append('Update $i', conversationId: 'offline');
+ }
+ await f.controller.refresh();
+ await f.show(tester);
+ await tester.tap(f.row(1));
+ await tester.pumpAndSettle();
+ expect(find.text('Latest PR'), findsNothing);
+ expect(f.controller.messages('offline').length, 300);
+ expect(f.controller.hasOlder('offline'), isTrue);
+ await f.close(tester);
+ });
+
+ testWidgets('unknown permission mode gets plain wording', (tester) async {
+ final f = await fixture(tester);
+ f.app.stateOf('m')!.agents = const [
+ Agent(
+ id: 'a1',
+ name: 'Multiply',
+ engine: 'claude',
+ permissionMode: 'unmapped-mode-id',
+ ),
+ ];
+ (f.server.state['agents'] as List)[1]['configuration'] = {
+ 'engine': 'claude',
+ 'contextWindow': 200000,
+ 'engineVersion': '1.0',
+ };
+ await f.controller.refresh();
+ await f.show(tester);
+ await tester.tap(f.row(1));
+ await tester.pumpAndSettle();
+ expect(find.text('Unrecognized setting'), findsOneWidget);
+ expect(find.text('unmapped-mode-id'), findsNothing);
+ expect(find.text('Agent name'), findsOneWidget);
+ expect(find.text('Harness'), findsNothing);
+ expect(find.text('Context'), findsNothing);
+ expect(find.text('Version'), findsNothing);
+ await f.close(tester);
+ });
+
+ testWidgets(
+ 'question details name the machine owner only for an on-screen question',
+ (tester) async {
+ final f = await fixture(tester);
+ (f.server.state['conversations'] as List)[1]['assignment'] = {
+ 'agentId': 'agent-1',
+ 'status': 'needs_human',
+ 'execution': {'machineOwnerId': 'owner'},
+ };
+ f.app.stateOf('m')!.blockedAgents['a1'] = activityQuestion('a1');
+ await f.controller.refresh();
+ await f.show(tester);
+ expect(
+ rowTooltip(tester, f, 1),
+ contains('Waiting for a person to answer'),
+ );
+ await tester.tap(f.row(1));
+ await tester.pumpAndSettle();
+ expect(find.text('Who can answer'), findsOneWidget);
+ expect(
+ find.descendant(
+ of: find.byType(AlertDialog),
+ matching: find.text('owner'),
+ ),
+ findsOneWidget,
+ );
+ await tester.tap(find.widgetWithText(TextButton, 'Close'));
+ await tester.pumpAndSettle();
+ f.app.stateOf('m')!.blockedAgents.clear();
+ await f.show(tester);
+ await tester.tap(f.row(1));
+ await tester.pumpAndSettle();
+ expect(find.text('Who can answer'), findsNothing);
+ await f.close(tester);
+ },
+ );
+
testWidgets(
'owner confirms Remove from Swarm without stopping the native session',
(tester) async {
@@ -298,7 +677,15 @@ void main() {
await f.controller.refresh();
await f.show(tester);
expect(f.inRow(1, find.text('Rev')), findsOneWidget);
- expect(f.inRow(1, find.byTooltip('Reviewer')), findsOneWidget);
+ expect(
+ f.inRow(
+ 1,
+ find.byWidgetPredicate(
+ (w) => w is Semantics && w.properties.label == 'Reviewer',
+ ),
+ ),
+ findsOneWidget,
+ );
expect(f.inRow(1, find.text('Dev')), findsNothing);
expect(f.inRow(3, find.text('Dev')), findsOneWidget);
expect(f.inRow(0, find.text('PM')), findsOneWidget);
@@ -358,6 +745,10 @@ void main() {
lessThan(tester.getTopLeft(f.row(3)).dy),
);
await tester.tap(f.row(1));
+ await tester.pumpAndSettle();
+ expect(find.byType(AlertDialog), findsOneWidget);
+ await tester.tap(find.widgetWithText(FilledButton, 'Open terminal'));
+ await tester.pumpAndSettle();
expect(f.opened?.harnessId, 'a1');
expect(f.controller.selectedId, 'offline');
expect(f.server.posts, isEmpty);
@@ -449,10 +840,8 @@ void main() {
});
await tester.pump();
expect(f.activity(tester, 0), HarnessActivity.done);
- expect(
- f.inRow(0, find.byTooltip(HarnessActivity.done.label)),
- findsOneWidget,
- );
+ expect(rowTooltip(tester, f, 0), contains('Finished'));
+ expect(f.inRow(0, find.byType(Tooltip)), findsNothing);
f.app.markAgentSeen('m', 'a0');
await tester.pump();
expect(f.activity(tester, 0), HarnessActivity.idle);
diff --git a/desktop/test/super_tab_view_test.dart b/desktop/test/super_tab_view_test.dart
index 6f17bdada..1f37eb010 100644
--- a/desktop/test/super_tab_view_test.dart
+++ b/desktop/test/super_tab_view_test.dart
@@ -304,7 +304,7 @@ void main() {
}
testWidgets(
- 'global roster stays scrollable with 20 people and opens an agent directly',
+ 'global roster stays scrollable with 20 people and opens agent details',
(tester) async {
await tester.binding.setSurfaceSize(const Size(1100, 700));
addTearDown(() => tester.binding.setSurfaceSize(null));
@@ -370,6 +370,9 @@ void main() {
await tester.pumpAndSettle();
await tester.tap(member);
await tester.pumpAndSettle();
+ expect(find.byType(AlertDialog), findsOneWidget);
+ await tester.tap(find.widgetWithText(FilledButton, 'Open terminal'));
+ await tester.pumpAndSettle();
expect(target?.id, 'agent-0');
expect(find.byType(Dialog), findsNothing);
expect(controller.snapshot!.conversations, hasLength(2));
diff --git a/docs/plans/2026-10-22-swarm-agent-tooltip-details.md b/docs/plans/2026-10-22-swarm-agent-tooltip-details.md
new file mode 100644
index 000000000..2735cf1ac
--- /dev/null
+++ b/docs/plans/2026-10-22-swarm-agent-tooltip-details.md
@@ -0,0 +1,24 @@
+# Swarm agent tooltip and details plan
+
+**Goal:** A roster hover states what an agent is doing. A click opens useful agent details and links to its current work and latest group PR.
+
+**Scope:** Desktop roster, a small agent details view, and roster widget tests. Keep the existing Remove from Swarm action. No backend, CLI, dependency, or unrelated navigation changes.
+
+**Base:** The Remove from Swarm change is merged on main. Base this Desktop-only follow-up on that commit and preserve its row action.
+
+## Data and behavior
+
+- Match a Swarm agent to the native observation using machine ID and harness ID. Use the observed model, folder, timestamps, permission mode, and on-screen question when present; fall back to the Swarm configuration for engine/model.
+- Find the agent's open assignment in the visible Swarm state. Use its group title for tooltip status and a detail link that selects that group. A pending on-screen question or `needs_human` assignment reads as waiting for a person to answer.
+- Resolve the machine name from native state or the Swarm machine list. Resolve who may answer an on-screen question from the assignment execution's machine owner ID or observed machine owner name; omit the line when neither identifies a person.
+- Load at most three pages of the assigned group's messages when details open. Reuse the existing PR-link parser; prefer the current assignment result, then the latest link posted by this agent in that group. Do not infer an agent's PR from another group member or an unrelated native checkout.
+- Omit unknown data, including unknown status, timestamps, folders, model, PR, or question owner. A stopped/offline session must not read as idle or actively working.
+
+## Implementation and verification
+
+1. Add widget tests for a complete tooltip, an unknown-data tooltip, task and PR links, machine/folder/permission/start time, and question owner. Update the existing row-click test to expect details, then Open terminal.
+2. Add a shared agent-information helper and details view. Put one composed Tooltip around each agent row, replace nested row tooltips, and keep the existing context menu and removal dialog.
+3. Run roster tests, affected navigation/dialog tests, and changed-file Flutter analysis. Inspect the rendered tooltip and details in dark and light themes. Review the diff for stale state, incorrect owner claims, and layout overflow.
+4. Rebase on main, rerun checks affected by that integration, push a branch, open a draft PR, and report exact commands, results, head, and any unverified behavior.
+
+**Acceptance:** Tooltip includes engine/model, machine, task status and relative last activity when known, with unknown fields omitted. Details link to the held group and latest group PR, show machine and folder, permission mode, started time, and the machine owner for an on-screen question. Analyze and tests pass; the PR remains a draft.