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.

Show a Swarm group's reviewer and latest verdict in Desktop (#1575)

0xken1505d45472d2b1
diff --git a/desktop/lib/super_tabs/controller.dart b/desktop/lib/super_tabs/controller.dart
index d4bec52a2..494af83e1 100644
--- a/desktop/lib/super_tabs/controller.dart
+++ b/desktop/lib/super_tabs/controller.dart
@@ -8,6 +8,7 @@ import '../logging/app_log.dart';
import '../state/harness_attachments.dart';
import 'attachment_upload.dart';
import 'model.dart';
+import 'review_verdict.dart';
typedef SuperTabRequest = Future<Map<String, dynamic>> Function(
String method,
@@ -275,6 +276,24 @@ class SuperTabController extends ChangeNotifier {
(m) => m.source['kind'] != 'update-request',
),
);
+
+ /// "Reviewer: Ada · Ready: yes on 1a2b3c4d5", from the newest `Ready:` message a
+ /// reviewer of [group] posted in the loaded history. Null without a reviewer.
+ String? reviewLine(SuperTabConversation? group) {
+ final state = snapshot;
+ if (group == null) return null;
+ final reviewers = state?.reviewers(group) ?? const <SuperTabAgent>[];
+ if (reviewers.isEmpty) return null;
+ final ids = {for (final r in reviewers) r.id};
+ final verdict = messages(group.id).reversed
+ .where((m) => m.fromAgent && ids.contains(m.authorId))
+ .map((m) => parseSuperTabVerdict(m.text))
+ .nonNulls
+ .firstOrNull;
+ final names = reviewers.map((r) => state!.agentName(r.id)).join(', ');
+ return 'Reviewer: $names · ${verdict?.label ?? 'No verdict yet'}';
+ }
+
bool hasOlder(String id) => _before[id] != null;
int _loadedMessageSequence(String id) =>
_messages[id]?.reversed
diff --git a/desktop/lib/super_tabs/model.dart b/desktop/lib/super_tabs/model.dart
index f5a084cd3..3b1c77c2f 100644
--- a/desktop/lib/super_tabs/model.dart
+++ b/desktop/lib/super_tabs/model.dart
@@ -41,11 +41,15 @@ class SuperTabAgent {
machineId = _text(row, 'machineId'),
harnessId = _text(row, 'harnessId'),
contributorId = _text(row, 'contributorId'),
+ role = row['role'] as String?,
configuration = Map.unmodifiable(superTabMap(row['configuration']));
final String id, projectId, name, machineId, harnessId, contributorId;
// Keep the legacy default for callers while allowing group-based roster ownership.
final bool hasProjectId;
final String? displayName;
+ // Absent until the backend sends one; an agent without a role is a Builder.
+ final String? role;
+ bool get isReviewer => role == 'reviewer';
final Map<String, dynamic> configuration;
String get engine => configuration['engine'] as String? ?? '';
}
@@ -185,6 +189,12 @@ class SuperTabSnapshot {
(p) => conversation(p.leadConversationId)?.leadId == agentId,
);
+ /// The agents of a workgroup whose role is Reviewer.
+ List<SuperTabAgent> reviewers(SuperTabConversation group) => [
+ for (final id in group.agentIds)
+ if (agent(id) case final a? when a.isReviewer) a,
+ ];
+
String agentName(String id, {String fallback = 'Agent'}) =>
agent(id)?.displayName ?? agent(id)?.name ?? fallback;
diff --git a/desktop/lib/super_tabs/review_verdict.dart b/desktop/lib/super_tabs/review_verdict.dart
new file mode 100644
index 000000000..7063ab821
--- /dev/null
+++ b/desktop/lib/super_tabs/review_verdict.dart
@@ -0,0 +1,36 @@
+import 'dart:math';
+
+/// The last review verdict a group's reviewer posted: `Ready: yes|no|with fixes`,
+/// with the revision it covers when the message names one.
+class SuperTabVerdict {
+ const SuperTabVerdict(this.ready, this.revision);
+ final String ready;
+ final String? revision;
+
+ String get label =>
+ revision == null ? 'Ready: $ready' : 'Ready: $ready on $revision';
+}
+
+final _ready = RegExp(
+ r'^\W*Ready:\s*(yes|no|with fixes)\b',
+ caseSensitive: false,
+ multiLine: true,
+);
+final _labeledRevision = RegExp(
+ r'\b(?:revision|head|commit|sha)\b\W{0,3}([0-9a-f]{7,40})\b',
+ caseSensitive: false,
+);
+final _bareRevision = RegExp(r'\b(?=[0-9a-f]*\d)[0-9a-f]{7,40}\b');
+
+/// Null when the text carries no `Ready:` line.
+SuperTabVerdict? parseSuperTabVerdict(String text) {
+ final ready = _ready.firstMatch(text)?.group(1);
+ if (ready == null) return null;
+ final revision =
+ _labeledRevision.firstMatch(text)?.group(1) ??
+ _bareRevision.firstMatch(text)?.group(0);
+ return SuperTabVerdict(
+ ready.toLowerCase(),
+ revision?.substring(0, min(revision.length, 9)),
+ );
+}
diff --git a/desktop/lib/super_tabs/roster.dart b/desktop/lib/super_tabs/roster.dart
index c7e394916..33fa0ff11 100644
--- a/desktop/lib/super_tabs/roster.dart
+++ b/desktop/lib/super_tabs/roster.dart
@@ -50,8 +50,11 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
.firstOrNull
?.projectId;
- String _role(SuperTabAgent agent) =>
- c.snapshot!.isLead(agent.id) ? 'Product Manager' : 'Engineer';
+ 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);
@@ -320,7 +323,11 @@ class _SuperTabRosterState extends State<SuperTabRoster> {
borderRadius: BorderRadius.circular(4),
),
child: Text(
- c.snapshot!.isLead(agent.id) ? 'PM' : 'Dev',
+ c.snapshot!.isLead(agent.id)
+ ? 'PM'
+ : agent.isReviewer
+ ? 'Rev'
+ : 'Dev',
style: DesktopChrome.metadata(),
),
),
diff --git a/desktop/lib/super_tabs/view.dart b/desktop/lib/super_tabs/view.dart
index 9a2cc7b69..c73b9f46e 100644
--- a/desktop/lib/super_tabs/view.dart
+++ b/desktop/lib/super_tabs/view.dart
@@ -754,17 +754,31 @@ class _SuperTabViewState extends State<SuperTabView>
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 8),
- child: Text(
- group == null
- ? c.snapshot?.projects.isEmpty == true
- ? c.snapshot!.name
- : 'Choose a project'
- : c.snapshot!.isProjectLead(group.id)
- ? c.snapshot!.projectFor(group.id)!.name
- : group.label,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: DesktopChrome.text(medium: true),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Text(
+ group == null
+ ? c.snapshot?.projects.isEmpty == true
+ ? c.snapshot!.name
+ : 'Choose a project'
+ : c.snapshot!.isProjectLead(group.id)
+ ? c.snapshot!.projectFor(group.id)!.name
+ : group.label,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.text(medium: true),
+ ),
+ if (c.reviewLine(group) case final line?)
+ Text(
+ line,
+ key: const ValueKey('super-review-line'),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.metadata(),
+ ),
+ ],
),
),
),
diff --git a/desktop/lib/super_tabs/work_details.dart b/desktop/lib/super_tabs/work_details.dart
index 127d9726a..9eb166d00 100644
--- a/desktop/lib/super_tabs/work_details.dart
+++ b/desktop/lib/super_tabs/work_details.dart
@@ -48,6 +48,10 @@ Future<void> showSuperTabWork(
const Text(
'The product manager hasn’t defined an assignment in this conversation yet.',
),
+ if (c.reviewLine(group) case final line?) ...[
+ const SizedBox(height: 16),
+ Text(line),
+ ],
if (assignment != null) ...[
const SizedBox(height: 16),
Text(
diff --git a/desktop/test/super_tab_review_test.dart b/desktop/test/super_tab_review_test.dart
new file mode 100644
index 000000000..d18c8fd2d
--- /dev/null
+++ b/desktop/test/super_tab_review_test.dart
@@ -0,0 +1,156 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/super_tabs/model.dart';
+import 'package:harness/super_tabs/review_verdict.dart';
+import 'package:harness/super_tabs/view.dart';
+import 'package:harness/super_tabs/work_details.dart';
+
+import 'support/super_tab_fixture.dart';
+
+Map<String, dynamic> agent(String id, String name, {String? role}) => {
+ 'id': id,
+ 'name': name,
+ 'displayName': name,
+ 'machineId': 'm',
+ 'harnessId': 'h-$id',
+ 'contributorId': 'owner',
+ 'configuration': {'engine': 'claude'},
+ 'role': ?role,
+};
+
+/// A workgroup with a Builder, a Reviewer and (optionally) their messages.
+ConversationServer groupServer({
+ bool reviewer = true,
+ List<(String, String)> messages = const [],
+}) {
+ final server = ConversationServer();
+ server.state['agents'] = [
+ agent('builder', 'Atlas'),
+ if (reviewer) agent('reviewer', 'Nova', role: 'reviewer'),
+ ];
+ (server.state['conversations'] as List)[1]['agentIds'] = [
+ 'builder',
+ if (reviewer) 'reviewer',
+ ];
+ for (final (author, text) in messages) {
+ server.append(text, conversationId: 'offline');
+ server.messages.last['author'] = {
+ 'kind': 'agent',
+ 'id': author,
+ 'name': author,
+ };
+ }
+ return server;
+}
+
+Future<void> showView(WidgetTester tester, ConversationServer server) async {
+ final controller = server.controller();
+ addTearDown(controller.dispose);
+ await controller.refresh();
+ controller.select('offline');
+ await controller.loadMessages('offline');
+ await tester.pumpWidget(
+ MaterialApp(
+ home: Scaffold(
+ body: SuperTabView(
+ controller: controller,
+ onInvite: () {},
+ onAddAgent: (_) {},
+ onOpenTerminal: (_) {},
+ machineName: (_) => 'Mac',
+ ),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+}
+
+void main() {
+ test('a Ready line reads as yes, no or with fixes, with its revision', () {
+ expect(
+ parseSuperTabVerdict('Review done.\nReady: yes\nRevision: 1a2b3c4d5e6f')
+ ?.label,
+ 'Ready: yes on 1a2b3c4d5',
+ );
+ expect(
+ parseSuperTabVerdict('ready: NO (head abc1234)')?.label,
+ 'Ready: no on abc1234',
+ );
+ expect(
+ parseSuperTabVerdict('Ready: with fixes')?.label,
+ 'Ready: with fixes',
+ );
+ expect(parseSuperTabVerdict('Ready: maybe'), isNull);
+ expect(parseSuperTabVerdict('Looks ready to me, revision 1234567'), isNull);
+ expect(parseSuperTabVerdict('Not Ready: yes'), isNull);
+ });
+
+ test('an agent without a role is a Builder', () {
+ expect(SuperTabAgent.fromJson(agent('a', 'A')).isReviewer, isFalse);
+ expect(
+ SuperTabAgent.fromJson(agent('a', 'A', role: 'reviewer')).isReviewer,
+ isTrue,
+ );
+ });
+
+ testWidgets('the header shows the reviewer and the latest verdict', (
+ tester,
+ ) async {
+ await showView(
+ tester,
+ groupServer(
+ messages: [
+ ('reviewer', 'Ready: no\nRevision: aaaaaaa1'),
+ ('builder', 'Fixed. Ready: yes at bbbbbbb2'),
+ ('reviewer', 'Ready: with fixes\nRevision: ccccccc3'),
+ ],
+ ),
+ );
+ expect(
+ find.text('Reviewer: Nova · Ready: with fixes on ccccccc3'),
+ findsOneWidget,
+ );
+ });
+
+ testWidgets('a reviewer who has not answered shows no verdict yet', (
+ tester,
+ ) async {
+ await showView(tester, groupServer(messages: [('builder', 'Ready: yes')]));
+ expect(find.text('Reviewer: Nova · No verdict yet'), findsOneWidget);
+ });
+
+ testWidgets('nothing is shown without a reviewer', (tester) async {
+ await showView(
+ tester,
+ groupServer(reviewer: false, messages: [('builder', 'Ready: yes')]),
+ );
+ expect(find.byKey(const ValueKey('super-review-line')), findsNothing);
+ expect(find.textContaining('Reviewer'), findsNothing);
+ });
+
+ testWidgets('work details repeat the reviewer line', (tester) async {
+ final server = groupServer(
+ messages: [('reviewer', 'Ready: yes\nRevision: abcdef123')],
+ );
+ final controller = server.controller();
+ addTearDown(controller.dispose);
+ await controller.refresh();
+ await controller.loadMessages('offline');
+ await tester.pumpWidget(
+ MaterialApp(
+ home: Builder(
+ builder: (context) => TextButton(
+ onPressed: () => showSuperTabWork(context, controller, 'offline'),
+ child: const Text('Open'),
+ ),
+ ),
+ ),
+ );
+ await tester.tap(find.text('Open'));
+ await tester.pumpAndSettle();
+ expect(
+ find.text('Reviewer: Nova · Ready: yes on abcdef123'),
+ findsOneWidget,
+ );
+ });
+}
diff --git a/desktop/test/super_tab_roster_test.dart b/desktop/test/super_tab_roster_test.dart
index 2740f0183..e6dd391ca 100644
--- a/desktop/test/super_tab_roster_test.dart
+++ b/desktop/test/super_tab_roster_test.dart
@@ -290,6 +290,21 @@ void main() {
await f.close(tester);
});
+ testWidgets('a reviewer reads Rev; an agent without a role stays Dev', (
+ tester,
+ ) async {
+ final f = await fixture(tester);
+ (f.server.state['agents'] as List)[1]['role'] = 'reviewer';
+ 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.text('Dev')), findsNothing);
+ expect(f.inRow(3, find.text('Dev')), findsOneWidget);
+ expect(f.inRow(0, find.text('PM')), findsOneWidget);
+ await f.close(tester);
+ });
+
testWidgets('agents follow project selection', (tester) async {
final f = await fixture(tester);
f.app.stateOf('m')!.agents = const [
diff --git a/docs/naming-system.md b/docs/naming-system.md
index ef82e5606..107992eb2 100644
--- a/docs/naming-system.md
+++ b/docs/naming-system.md
@@ -101,7 +101,7 @@ Its project names open their product manager chats; a separate chevron reveals e
An expanded project without workgroups says **No workgroups yet**. **Your devices** opens the
existing Devices tab. The navigation, conversation and people panes have draggable dividers.
Agents have individual display names and the same avatar treatment as people. Their role badges
-are **PM** and **Dev**; project context appears underneath. Engine names belong in details.
+are **PM**, **Dev** and **Rev**; project context appears underneath. Engine names belong in details.
Chat headings and quoted replies use the same current agent identity as the roster, including
older messages. When an agent has left, its recorded author name remains available in history.
Machine rows are one line: a status dot, the name, a chip for each known model allowance