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.

Clarify Swarm agents with consistent project labels and live status (#1476)

Dee970704c8a2c5
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 8d8b69267..10afe0f64 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -35,6 +35,9 @@ env:
# Supersede individual PR jobs, not the whole workflow: an always-running final
# gate on an obsolete revision must not hold the next revision's scheduling lock.
+# Keep PR event actions separate: synchronize and ready_for_review can arrive
+# together for the same head, and must each complete their own required checks.
+# New synchronize events still supersede older synchronize jobs.
# Every matrix row has its own group. Explicit runs and merge candidates use run
# IDs, so their requested validation is preserved. Summaries and the final gate
# have no lock: an older aggregate can finish after newer work without cancelling it.
@@ -42,7 +45,7 @@ env:
jobs:
plan:
concurrency:
- group: ci-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}-plan
+ group: ci-${{ github.event_name }}-${{ github.event.action || 'run' }}-${{ github.event.pull_request.number || github.run_id }}-plan
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
timeout-minutes: 5
@@ -103,7 +106,7 @@ jobs:
process-checks:
concurrency:
- group: ci-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}-process-checks
+ group: ci-${{ github.event_name }}-${{ github.event.action || 'run' }}-${{ github.event.pull_request.number || github.run_id }}-process-checks
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
needs: plan
runs-on: ubuntu-latest
@@ -146,7 +149,7 @@ jobs:
desktop-tests:
concurrency:
- group: ci-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}-desktop-tests-${{ strategy.job-index }}
+ group: ci-${{ github.event_name }}-${{ github.event.action || 'run' }}-${{ github.event.pull_request.number || github.run_id }}-desktop-tests-${{ strategy.job-index }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
needs: plan
if: needs.plan.outputs.ready == 'true' && needs.plan.outputs.desktop == 'true'
@@ -214,7 +217,7 @@ jobs:
# deliberately checks core without installing or building this package.
companion-subsystems:
concurrency:
- group: ci-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}-companion-subsystems
+ group: ci-${{ github.event_name }}-${{ github.event.action || 'run' }}-${{ github.event.pull_request.number || github.run_id }}-companion-subsystems
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
needs: plan
if: needs.plan.outputs.ready == 'true' && needs.plan.outputs.companions == 'true'
@@ -246,7 +249,7 @@ jobs:
cli-typecheck:
concurrency:
- group: ci-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}-cli-typecheck
+ group: ci-${{ github.event_name }}-${{ github.event.action || 'run' }}-${{ github.event.pull_request.number || github.run_id }}-cli-typecheck
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
needs: plan
if: needs.plan.outputs.ready == 'true' && needs.plan.outputs.cli == 'true'
@@ -269,7 +272,7 @@ jobs:
cli-tests:
concurrency:
- group: ci-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}-cli-tests-${{ strategy.job-index }}
+ group: ci-${{ github.event_name }}-${{ github.event.action || 'run' }}-${{ github.event.pull_request.number || github.run_id }}-cli-tests-${{ strategy.job-index }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
needs: plan
if: needs.plan.outputs.ready == 'true' && needs.plan.outputs.cli == 'true'
@@ -314,7 +317,7 @@ jobs:
# Unit tests only. Native fixtures and connected-shell checks run in the release workflow.
tui-test:
concurrency:
- group: ci-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}-tui-test
+ group: ci-${{ github.event_name }}-${{ github.event.action || 'run' }}-${{ github.event.pull_request.number || github.run_id }}-tui-test
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
needs: plan
if: needs.plan.outputs.ready == 'true' && needs.plan.outputs.tui == 'true'
@@ -342,7 +345,7 @@ jobs:
backend-desk:
concurrency:
- group: ci-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}-backend-desk
+ group: ci-${{ github.event_name }}-${{ github.event.action || 'run' }}-${{ github.event.pull_request.number || github.run_id }}-backend-desk
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
needs: plan
if: needs.plan.outputs.ready == 'true' && needs.plan.outputs.backend == 'true'
@@ -366,7 +369,7 @@ jobs:
website-checks:
concurrency:
- group: ci-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}-website-checks
+ group: ci-${{ github.event_name }}-${{ github.event.action || 'run' }}-${{ github.event.pull_request.number || github.run_id }}-website-checks
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
needs: plan
if: needs.plan.outputs.ready == 'true' && needs.plan.outputs.website == 'true'
@@ -374,7 +377,7 @@ jobs:
os-checks:
concurrency:
- group: ci-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}-os-checks
+ group: ci-${{ github.event_name }}-${{ github.event.action || 'run' }}-${{ github.event.pull_request.number || github.run_id }}-os-checks
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
needs: plan
if: needs.plan.outputs.ready == 'true' && needs.plan.outputs.os == 'true'
@@ -389,7 +392,7 @@ jobs:
provider-checks:
concurrency:
- group: ci-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}-provider-checks-${{ strategy.job-index }}
+ group: ci-${{ github.event_name }}-${{ github.event.action || 'run' }}-${{ github.event.pull_request.number || github.run_id }}-provider-checks-${{ strategy.job-index }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
needs: plan
if: needs.plan.outputs.ready == 'true' && needs.plan.outputs.provider == 'true'
@@ -417,7 +420,7 @@ jobs:
firmware-checks:
concurrency:
- group: ci-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}-firmware-checks
+ group: ci-${{ github.event_name }}-${{ github.event.action || 'run' }}-${{ github.event.pull_request.number || github.run_id }}-firmware-checks
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
needs: plan
if: needs.plan.outputs.ready == 'true' && needs.plan.outputs.firmware == 'true'
@@ -474,7 +477,7 @@ jobs:
pro-firmware-build:
concurrency:
- group: ci-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}-pro-firmware-build
+ group: ci-${{ github.event_name }}-${{ github.event.action || 'run' }}-${{ github.event.pull_request.number || github.run_id }}-pro-firmware-build
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
needs: plan
if: needs.plan.outputs.ready == 'true' && needs.plan.outputs.pro == 'true'
@@ -511,7 +514,7 @@ jobs:
pro-golden:
concurrency:
- group: ci-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}-pro-golden
+ group: ci-${{ github.event_name }}-${{ github.event.action || 'run' }}-${{ github.event.pull_request.number || github.run_id }}-pro-golden
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
needs: plan
if: needs.plan.outputs.ready == 'true' && needs.plan.outputs.pro == 'true'
@@ -533,7 +536,7 @@ jobs:
mobile-checks:
concurrency:
- group: ci-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}-mobile-checks
+ group: ci-${{ github.event_name }}-${{ github.event.action || 'run' }}-${{ github.event.pull_request.number || github.run_id }}-mobile-checks
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
needs: plan
if: needs.plan.outputs.ready == 'true' && needs.plan.outputs.mobile == 'true'
@@ -560,7 +563,7 @@ jobs:
daemons-checks:
concurrency:
- group: ci-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}-daemons-checks
+ group: ci-${{ github.event_name }}-${{ github.event.action || 'run' }}-${{ github.event.pull_request.number || github.run_id }}-daemons-checks
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
needs: plan
if: needs.plan.outputs.ready == 'true' && needs.plan.outputs.daemons == 'true'
@@ -581,7 +584,7 @@ jobs:
# model and steps (harness-install.exe) are plain Rust that tests here.
pty-checks:
concurrency:
- group: ci-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}-pty-checks
+ group: ci-${{ github.event_name }}-${{ github.event.action || 'run' }}-${{ github.event.pull_request.number || github.run_id }}-pty-checks
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
needs: plan
if: needs.plan.outputs.ready == 'true' && needs.plan.outputs.pty == 'true'
diff --git a/desktop/lib/super_tabs/roster.dart b/desktop/lib/super_tabs/roster.dart
index 4e49a8bd3..a5c0b0d90 100644
--- a/desktop/lib/super_tabs/roster.dart
+++ b/desktop/lib/super_tabs/roster.dart
@@ -2,12 +2,16 @@ import 'dart:async';
import 'package:flutter/material.dart';
-import '../core/models.dart' show Agent;
import '../shared/theme/app_theme.dart' as grid;
+import '../shared/theme/appearance_prefs_store.dart';
import '../shared/widgets/app_dialog.dart';
import '../state/app_state.dart';
+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 'controller.dart';
import 'identity.dart';
import 'machines.dart';
@@ -37,35 +41,30 @@ class SuperTabRoster extends StatefulWidget {
class _SuperTabRosterState extends State<SuperTabRoster> {
SuperTabController get c => widget.controller;
- Agent? _native(SuperTabAgent agent) => widget.app
- ?.stateOf(agent.machineId)
- ?.agents
- .where((a) => a.id == agent.harnessId)
- .firstOrNull;
-
- String _activity(SuperTabAgent agent) {
- if (widget.app?.questionFor(agent.machineId, agent.harnessId) != null) {
- return 'Needs you';
- }
- final work = c.snapshot?.conversations
- .where(
- (g) =>
- !g.archived &&
- g.assignment?['agentId'] == agent.id &&
- !const ['done', 'stopped'].contains(g.assignment?['status']),
- )
- .firstOrNull;
- if (work?.assignment?['status'] == 'needs_human') return 'Needs you';
- final native = _native(agent);
- if (native?.isStopped == true) return 'Stopped';
- if (widget.app?.stateOf(agent.machineId)?.nodeOnline == false) {
- return 'Offline';
+ HarnessActivity _activity(SuperTabAgent agent) {
+ final app = widget.app;
+ final native = app == null
+ ? null
+ : harnessActivity(app, agent.machineId, agent.harnessId);
+ // Keep the shared lifecycle precedence. A retained workgroup question must
+ // not make a stopped or disconnected harness look available for input.
+ if (native == HarnessActivity.offline ||
+ native == HarnessActivity.paused ||
+ native == HarnessActivity.starting ||
+ native == HarnessActivity.failed ||
+ native == HarnessActivity.needsInput) {
+ return native!;
}
- if (native?.title case final title? when title.trim().isNotEmpty) {
- return title;
+ if (c.snapshot?.conversations.any(
+ (group) =>
+ !group.archived &&
+ group.assignment?['agentId'] == agent.id &&
+ group.assignment?['status'] == 'needs_human',
+ ) ==
+ true) {
+ return HarnessActivity.needsInput;
}
- if (work != null) return work.title;
- return native == null ? 'Status unavailable' : 'Ready';
+ return native ?? HarnessActivity.unknown;
}
Future<void> _details(SuperTabAgent agent) => showAppDialog<void>(
@@ -121,9 +120,10 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
final project = c.snapshot!.projects
.where((p) => p.id == agent.projectId)
.firstOrNull;
- final waiting = activity == 'Needs you';
- final otherProject = project != null && project.id != c.selected?.projectId;
- final subtitle = otherProject ? '$activity ${project.name}' : activity;
+ final theme = terminalThemeFor(
+ grid.AppTheme.surfacePalette,
+ terminalThemeStore.value,
+ );
return GestureDetector(
onSecondaryTapUp: (event) async {
final choice = await showMenu<String>(
@@ -144,11 +144,14 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
key: ValueKey('super-member-${agent.id}'),
dense: true,
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 1),
- horizontalTitleGap: 10,
- leading: SuperTabAvatar(identity: 'agent:${agent.id}', name: name),
title: Row(
children: [
- Flexible(
+ Tooltip(
+ message: engineIdentity(agent.engine).label,
+ child: EngineMark(engine: agent.engine, size: 20),
+ ),
+ const SizedBox(width: 10),
+ Expanded(
child: Tooltip(
message: name,
child: Text(
@@ -159,24 +162,31 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
),
),
),
- const SizedBox(width: 6),
- Tooltip(
- message: engineIdentity(agent.engine).label,
- child: EngineMark(engine: agent.engine, size: 14),
+ const SizedBox(width: 8),
+ ActivityMark(
+ activity: activity,
+ color: activityColor(
+ activity,
+ theme,
+ color: appearancePrefsStore.value.prompt.color,
+ ),
),
],
),
- subtitle: Tooltip(
- message: [if (project != null) project.name, activity].join('\n'),
- child: Text(
- subtitle,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: DesktopChrome.metadata(
- color: waiting ? grid.AppPalette.warn : null,
- ),
- ),
- ),
+ subtitle: project == null
+ ? null
+ : Padding(
+ padding: const EdgeInsets.only(left: 30),
+ child: Tooltip(
+ message: project.name,
+ child: Text(
+ project.name,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.metadata(),
+ ),
+ ),
+ ),
onTap: () => widget.onOpenAgent(agent),
onLongPress: () => unawaited(_details(agent)),
),
@@ -249,24 +259,32 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
}
@override
- Widget build(BuildContext context) => Material(
- color: DesktopChrome.surface,
- child: ListenableBuilder(
- listenable: Listenable.merge([c, if (widget.app != null) widget.app!]),
- builder: (context, _) => ListView(
- key: PageStorageKey('super-tab-resources-${c.tabId}'),
- padding: const EdgeInsets.symmetric(vertical: 12),
- children: [
- ..._members(),
- const SizedBox(height: 20),
- SuperTabMachines(
- controller: c,
- app: widget.app,
- onAddAgent: widget.onAddAgent,
- embedded: true,
- ),
- ],
+ Widget build(BuildContext context) {
+ grid.AppTheme.watch(context);
+ return Material(
+ color: DesktopChrome.surface,
+ child: ListenableBuilder(
+ listenable: Listenable.merge([
+ c,
+ if (widget.app != null) ...[widget.app!, widget.app!.agentUnread],
+ terminalThemeStore,
+ appearancePrefsStore,
+ ]),
+ builder: (context, _) => ListView(
+ key: PageStorageKey('super-tab-resources-${c.tabId}'),
+ padding: const EdgeInsets.symmetric(vertical: 12),
+ children: [
+ ..._members(),
+ const SizedBox(height: 20),
+ SuperTabMachines(
+ controller: c,
+ app: widget.app,
+ onAddAgent: widget.onAddAgent,
+ embedded: true,
+ ),
+ ],
+ ),
),
- ),
- );
+ );
+ }
}
diff --git a/desktop/test/super_tab_roster_test.dart b/desktop/test/super_tab_roster_test.dart
new file mode 100644
index 000000000..e5d9c89c6
--- /dev/null
+++ b/desktop/test/super_tab_roster_test.dart
@@ -0,0 +1,299 @@
+import 'dart:io';
+
+import 'package:flutter/material.dart';
+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/notify/alert_sounds.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/state/harness_activity.dart';
+import 'package:harness/super_tabs/model.dart';
+import 'package:harness/super_tabs/roster.dart';
+import 'package:harness/widgets/engine_identity.dart';
+import 'package:harness/widgets/harness_activity_mark.dart';
+
+import 'harness_activity_test.dart' show activityQuestion;
+import 'support/capture.dart';
+import 'support/super_tab_fixture.dart';
+import 'swarm_state_test.dart' show createApp;
+
+class RosterFixture {
+ final app = createApp(connected: true);
+ final server = ConversationServer();
+ late final controller = server.controller();
+ SuperTabAgent? opened;
+ final boundary = GlobalKey();
+ bool disposed = false;
+
+ Future<void> initialize() async {
+ server.state['projects'] = [
+ projectFixture('lead', 'openharness', 'lead'),
+ projectFixture('os', 'autonomous-os', 'os-lead'),
+ ];
+ server.state['agents'] = [
+ for (var i = 0; i < 4; i++)
+ {
+ 'id': 'agent-$i',
+ 'projectId': i == 2 ? 'os' : 'lead',
+ 'name': ['Lead', 'Multiply', 'Lead', 'Divide'][i],
+ 'machineId': 'm',
+ 'harnessId': 'a$i',
+ 'contributorId': 'owner',
+ 'configuration': {'engine': i == 1 ? 'claude' : 'codex'},
+ },
+ ];
+ (server.state['conversations'] as List)[0]['leadId'] = 'agent-0';
+ (server.state['conversations'] as List).add({
+ ...conversationFixture('os-lead', 'Lead'),
+ 'projectId': 'os',
+ 'leadId': 'agent-2',
+ });
+ await controller.refresh();
+ }
+
+ Future<void> show(
+ WidgetTester tester, {
+ bool nativeState = true,
+ Brightness brightness = Brightness.dark,
+ double scale = 1,
+ }) async {
+ await tester.pumpWidget(
+ RepaintBoundary(
+ key: boundary,
+ child: MaterialApp(
+ debugShowCheckedModeBanner: false,
+ theme: grid.buildAppTheme(brightness: brightness),
+ builder: (context, child) => MediaQuery(
+ data: MediaQuery.of(context).copyWith(
+ textScaler: TextScaler.linear(scale),
+ highContrast: scale > 1,
+ disableAnimations: true,
+ ),
+ child: child!,
+ ),
+ home: Scaffold(
+ body: SuperTabRoster(
+ controller: controller,
+ app: nativeState ? app : null,
+ onInvite: () {},
+ onAddAgent: (_) {},
+ onOpenAgent: (agent) => opened = agent,
+ ),
+ ),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+ }
+
+ Finder row(int i) => find.byKey(ValueKey('super-member-agent-$i'));
+ Finder inRow(int i, Finder child) =>
+ find.descendant(of: row(i), matching: child);
+ HarnessActivity activity(WidgetTester tester, int i) =>
+ tester.widget<ActivityMark>(inRow(i, find.byType(ActivityMark))).activity;
+
+ void dispose() {
+ if (disposed) return;
+ disposed = true;
+ controller.dispose();
+ app.dispose();
+ }
+
+ Future<void> close(WidgetTester tester) async {
+ await tester.pumpWidget(const SizedBox());
+ await controller.flush();
+ dispose();
+ }
+}
+
+void main() {
+ final captureDir = Platform.environment['HARNESS_ROSTER_CAPTURE_DIR'];
+ setUpAll(() async {
+ await loadCaptureFonts(captureDir);
+ if (captureDir != null && Platform.isMacOS) {
+ for (final font in [
+ ('.AppleSystemUIFontMonospaced', '/System/Library/Fonts/SFNSMono.ttf'),
+ ('Menlo', '/System/Library/Fonts/Menlo.ttc'),
+ ('Apple Symbols', '/System/Library/Fonts/Apple Symbols.ttf'),
+ ]) {
+ final bytes = ByteData.sublistView(await File(font.$2).readAsBytes());
+ await (FontLoader(font.$1)..addFont(Future.value(bytes))).load();
+ }
+ }
+ });
+
+ Future<RosterFixture> fixture(WidgetTester tester) async {
+ await tester.binding.setSurfaceSize(const Size(280, 700));
+ addTearDown(() => tester.binding.setSurfaceSize(null));
+ final f = RosterFixture();
+ await f.initialize();
+ addTearDown(f.dispose);
+ return f;
+ }
+
+ testWidgets('agent and project keep their meaning across project selection', (
+ tester,
+ ) async {
+ final f = await fixture(tester);
+ f.app.stateOf('m')!.agents = const [
+ Agent(
+ id: 'a0',
+ name: 'native',
+ engine: 'codex',
+ title: 'Join Super Tab roster',
+ ),
+ ];
+ await f.show(tester);
+ for (var i = 0; i < 4; i++) {
+ expect(f.inRow(i, find.byType(EngineMark)), findsOneWidget);
+ expect(
+ f.inRow(i, find.text(i == 2 ? 'autonomous-os' : 'openharness')),
+ findsOneWidget,
+ );
+ }
+ expect(find.text('Join Super Tab roster'), findsNothing);
+ expect(find.text('Ready'), findsNothing);
+ final nameX = tester.getTopLeft(f.inRow(0, find.text('Lead'))).dx;
+ final projectX = tester.getTopLeft(f.inRow(0, find.text('openharness'))).dx;
+ expect(projectX, nameX);
+ f.controller.select('os-lead');
+ await tester.pumpAndSettle();
+ expect(f.inRow(0, find.text('openharness')), findsOneWidget);
+ expect(f.inRow(2, find.text('autonomous-os')), findsOneWidget);
+ await tester.tap(f.row(1));
+ expect(f.opened?.harnessId, 'a1');
+ expect(f.controller.selectedId, 'os-lead');
+ expect(f.server.posts, isEmpty);
+ await f.close(tester);
+ });
+
+ testWidgets('live turns and unread changes update the same status cell', (
+ tester,
+ ) async {
+ final f = await fixture(tester);
+ await f.show(tester);
+ expect(f.activity(tester, 0), HarnessActivity.idle);
+ final mark = f.inRow(0, find.byType(ActivityMark));
+ final position = tester.getTopLeft(mark);
+ await f.app.handleEventForTest('m', {
+ 'type': 'turn_started',
+ 'agentId': 'a0',
+ });
+ await tester.pump();
+ expect(f.activity(tester, 0), HarnessActivity.working);
+ f.app.agentUnread.mark('m', 'a0', AlertKind.done);
+ await tester.pump();
+ expect(f.activity(tester, 0), HarnessActivity.working);
+ await f.app.handleEventForTest('m', {
+ 'type': 'turn_ended',
+ 'agentId': 'a0',
+ });
+ await tester.pump();
+ expect(f.activity(tester, 0), HarnessActivity.done);
+ expect(
+ f.inRow(0, find.byTooltip(HarnessActivity.done.label)),
+ findsOneWidget,
+ );
+ f.app.markAgentSeen('m', 'a0');
+ await tester.pump();
+ expect(f.activity(tester, 0), HarnessActivity.idle);
+ expect(tester.getTopLeft(mark), position);
+ f.app.agentUnread.mark('m', 'a0', AlertKind.done);
+ await tester.pump();
+ expect(f.activity(tester, 0), HarnessActivity.done);
+ await f.close(tester);
+ });
+
+ testWidgets(
+ 'workgroup questions survive missing native data without stale working claims',
+ (tester) async {
+ final f = await fixture(tester);
+ (f.server.state['conversations'] as List)[1]['assignment'] = {
+ 'agentId': 'agent-1',
+ 'status': 'working',
+ };
+ (f.server.state['conversations'] as List).add({
+ ...conversationFixture('question', 'Review'),
+ 'assignment': {'agentId': 'agent-1', 'status': 'needs_human'},
+ });
+ await f.controller.refresh();
+ await f.show(tester, nativeState: false);
+ expect(f.activity(tester, 0), HarnessActivity.unknown);
+ expect(f.activity(tester, 1), HarnessActivity.needsInput);
+ f.app.stateOf('m')!.connectionStatus = ConnectionStatus.disconnected;
+ await f.show(tester);
+ expect(f.activity(tester, 1), HarnessActivity.offline);
+ f.app.stateOf('m')!
+ ..connectionStatus = ConnectionStatus.connected
+ ..agents = const [
+ Agent(
+ id: 'a1',
+ name: 'Multiply',
+ engine: 'claude',
+ status: 'stopped',
+ ),
+ ];
+ await f.show(tester);
+ expect(f.activity(tester, 1), HarnessActivity.paused);
+ await f.close(tester);
+ },
+ );
+
+ for (final brightness in Brightness.values) {
+ for (final scale in [1.0, 2.0]) {
+ testWidgets(
+ 'roster marks remain legible in ${brightness.name} at ${scale}x',
+ (tester) async {
+ final f = await fixture(tester);
+ final previous = grid.AppTheme.brightness.value;
+ grid.AppTheme.brightness.value = brightness;
+ addTearDown(() => grid.AppTheme.brightness.value = previous);
+ f.app.stateOf('m')!
+ ..processingAgentIds.add('a0')
+ ..blockedAgents['a2'] = activityQuestion('a2')
+ ..agents = const [
+ Agent(id: 'a0', name: 'Lead', engine: 'codex'),
+ Agent(id: 'a1', name: 'Multiply', engine: 'claude'),
+ Agent(id: 'a2', name: 'Lead', engine: 'codex'),
+ Agent(
+ id: 'a3',
+ name: 'Divide',
+ engine: 'codex',
+ status: 'stopped',
+ ),
+ ];
+ f.app.agentUnread.mark('m', 'a1', AlertKind.done);
+ await f.show(tester, brightness: brightness, scale: scale);
+ expect(f.activity(tester, 0), HarnessActivity.working);
+ expect(f.activity(tester, 1), HarnessActivity.done);
+ expect(f.activity(tester, 2), HarnessActivity.needsInput);
+ expect(f.activity(tester, 3), HarnessActivity.paused);
+ final semantics = tester.ensureSemantics();
+ await tester.pump();
+ expect(
+ find.bySemanticsLabel(RegExp('Needs your input')),
+ findsWidgets,
+ );
+ semantics.dispose();
+ for (var i = 0; i < 4; i++) {
+ final bounds = tester.getRect(f.row(i));
+ final status = tester.getRect(
+ f.inRow(i, find.byType(ActivityMark)),
+ );
+ expect(bounds.contains(status.center), isTrue);
+ }
+ expect(tester.takeException(), isNull);
+ await captureBoundary(
+ tester,
+ f.boundary.currentContext!.findRenderObject()!
+ as RenderRepaintBoundary,
+ captureDir,
+ 'roster-${brightness.name}-${scale}x',
+ );
+ await f.close(tester);
+ },
+ );
+ }
+ }
+}