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.

Needs-you bar only when asked, opens the question; count on the icon (#3064)

harness-for-autonomous[bot]81c8c280be74
diff --git a/desktop/lib/super_tabs/view.dart b/desktop/lib/super_tabs/view.dart
index 40901b53e..9f95da7b9 100644
--- a/desktop/lib/super_tabs/view.dart
+++ b/desktop/lib/super_tabs/view.dart
@@ -2567,6 +2567,10 @@ class _SuperTabViewState extends State<SuperTabView>
});
}
+ /// The agents of [group] waiting on the reader: one with a question in its
+ /// terminal, or one the task's work waits on for an answer from them
+ /// ([_asksReader]). A task blocked on CI, a review or another person is not
+ /// here; its status line already says why (Leo, #3017).
List<SuperTabAgent> _needsHuman(SuperTabConversation group) =>
c.snapshot?.agents
.where(
@@ -2574,12 +2578,102 @@ class _SuperTabViewState extends State<SuperTabView>
group.agentIds.contains(agent.id) &&
(widget.app?.questionFor(agent.machineId, agent.harnessId) !=
null ||
- (superTabWorkWaits(group.assignment?['status']) &&
- group.assignment?['agentId'] == agent.id)),
+ _asksReader(group, agent)),
)
.toList() ??
const [];
+ /// The open decisions of the reader that [group]'s work asked.
+ List<SuperTabDecision> _decisionsOf(SuperTabConversation group) => [
+ for (final d in SuperTabDecisions.of(c).open)
+ if (d.conversationId == group.id) d,
+ ];
+
+ /// Whether [group]'s work, done by [agent], waits on the reader's answer: a
+ /// decision asked of them, or `needs_human` asked of them by name, else of
+ /// whom the server says it waits on, else (a backend that names nobody)
+ /// of whoever reads. `blocked` is never a question.
+ bool _asksReader(SuperTabConversation group, SuperTabAgent agent) {
+ final work = group.assignment;
+ if (work == null || work['agentId'] != agent.id) return false;
+ if (_decisionsOf(group).isNotEmpty) return true;
+ if (work['status'] != 'needs_human') return false;
+ final liveness = group.liveness;
+ final waited = liveness != null && liveness['why'] == 'person';
+ final Object? person =
+ work['askedOf'] ?? (waited ? liveness['personId'] : null);
+ return person == null || person == c.accountId;
+ }
+
+ /// The bar's click: the question where it is, so it visibly does something
+ /// (Leo, #3017). A decision opens where decisions are answered; a question
+ /// in the chat comes into view, lit; a prompt in the terminal opens it, or
+ /// says it is already open.
+ void _openQuestion(SuperTabConversation group, SuperTabAgent agent) {
+ final asks = widget.app?.questionFor(agent.machineId, agent.harnessId);
+ if (_decisionsOf(group).isNotEmpty) {
+ _openPage(SwarmPage.decisions);
+ return;
+ }
+ final message = asks != null ? null : _askedIn(group, agent);
+ if (message != null) {
+ _showMessage(group.id, message);
+ return;
+ }
+ if (_terminalsVisible) {
+ ScaffoldMessenger.maybeOf(context)?.showSnackBar(
+ SnackBar(
+ content: Text(
+ "${_agentName(agent)}'s question is in its terminal, open beside this chat.",
+ ),
+ ),
+ );
+ return;
+ }
+ _openAgent(agent);
+ }
+
+ /// The message where [agent] asked [group]'s question: the one that says
+ /// what the assignment's result says, else the agent's latest in the chat
+ /// (a line of the task itself is never it).
+ SuperTabMessage? _askedIn(SuperTabConversation group, SuperTabAgent agent) {
+ final said = [
+ for (final m in _ownShown(group.id))
+ if (m.author['kind'] == 'agent' &&
+ m.author['id'] == agent.id &&
+ !m.isTaskLine)
+ m,
+ ];
+ final ask = (group.assignment?['result'] as String?)?.trim();
+ if (ask != null && ask.isNotEmpty) {
+ for (final m in said.reversed) {
+ if (m.text.contains(ask)) return m;
+ }
+ }
+ return said.lastOrNull;
+ }
+
+ /// Brings [message] of chat [id] into view, lit, from the chat's own view.
+ void _showMessage(String id, SuperTabMessage message) {
+ widget.onCloseTerminal?.call();
+ setState(() {
+ _showPullRequests = _showTasks = false;
+ _target = message.id;
+ // Stop following the end: the question is what to see.
+ _scrollRequest++;
+ _jumpingToEnd = false;
+ _follow(id, false);
+ });
+ _revealTarget(
+ id,
+ 0,
+ arrived: (row) {
+ unawaited(Scrollable.ensureVisible(row, alignment: .3));
+ _light(message.id);
+ },
+ );
+ }
+
/// What the card over [message]'s name or avatar shows, worked out as it
/// opens (Huy, 11-04): a person's status and zone; an agent's engine and
/// model, machine and task, as its details dialog reads them.
@@ -3119,27 +3213,49 @@ class _SuperTabViewState extends State<SuperTabView>
final project = c.snapshot!.projectById(group.projectId)!;
final selected = task || (_showTasks && !_terminalsVisible);
final count = _tasksNeedingYou(project);
- return Row(
- mainAxisSize: MainAxisSize.min,
+ return _withCountBadge(
+ fingerTarget(
+ enabled: _phone,
+ AppIconButton(
+ key: const ValueKey('super-tasks'),
+ icon: AppIcons.squareKanban,
+ size: AppIcons.inlineSize,
+ tooltip: 'Tasks',
+ selected: selected,
+ color: selected ? DesktopChrome.foreground : DesktopChrome.muted,
+ onPressed: () => _openTasks(group),
+ ),
+ ),
+ count,
+ key: const ValueKey('super-tasks-badge'),
+ tooltip: count == 1 ? '1 task needs you' : '$count tasks need you',
+ onTap: () => _openTasks(group),
+ );
+ }
+
+ /// A header icon's count, the one badge style (Dee, #3017): the red number
+ /// on the icon's top-right corner, like a notification badge, none at 0.
+ Widget _withCountBadge(
+ Widget icon,
+ int count, {
+ required Key key,
+ required String tooltip,
+ required VoidCallback onTap,
+ }) {
+ if (count <= 0) return icon;
+ return Stack(
+ clipBehavior: Clip.none,
children: [
- fingerTarget(
- enabled: _phone,
- AppIconButton(
- key: const ValueKey('super-tasks'),
- icon: AppIcons.squareKanban,
- size: AppIcons.inlineSize,
- tooltip: 'Tasks',
- selected: selected,
- color: selected ? DesktopChrome.foreground : DesktopChrome.muted,
- onPressed: () => _openTasks(group),
+ icon,
+ Positioned(
+ top: -2,
+ right: -2,
+ child: GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: onTap,
+ child: SuperTabCountBadge(count, key: key, tooltip: tooltip),
),
),
- if (count > 0)
- SuperTabCountBadge(
- count,
- key: const ValueKey('super-tasks-badge'),
- tooltip: count == 1 ? '1 task needs you' : '$count tasks need you',
- ),
],
);
}
@@ -4818,29 +4934,36 @@ class _SuperTabViewState extends State<SuperTabView>
),
),
if (group != null)
- for (final agent in _needsHuman(group))
- Padding(
- padding: const EdgeInsets.fromLTRB(24, 6, 24, 0),
- child: ListTile(
- key: ValueKey('super-needs-human-${agent.id}'),
- dense: true,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(12),
- ),
- tileColor: grid.AppPalette.warn.withValues(alpha: .08),
- leading: Icon(
- AppIcons.messageCircleQuestionMark,
- color: grid.AppPalette.warn,
- size: 18,
- ),
- title: Text(
- '${_agentName(agent)} needs you',
- style: DesktopChrome.control(medium: true),
- ),
- trailing: const Icon(AppIcons.arrowRight, size: 16),
- onTap: () => _openAgent(agent),
- ),
+ ListenableBuilder(
+ listenable: SuperTabDecisions.of(c),
+ builder: (context, _) => Column(
+ children: [
+ for (final agent in _needsHuman(group))
+ Padding(
+ padding: const EdgeInsets.fromLTRB(24, 6, 24, 0),
+ child: ListTile(
+ key: ValueKey('super-needs-human-${agent.id}'),
+ dense: true,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(12),
+ ),
+ tileColor: grid.AppPalette.warn.withValues(alpha: .08),
+ leading: Icon(
+ AppIcons.messageCircleQuestionMark,
+ color: grid.AppPalette.warn,
+ size: 18,
+ ),
+ title: Text(
+ '${_agentName(agent)} needs you',
+ style: DesktopChrome.control(medium: true),
+ ),
+ trailing: const Icon(AppIcons.arrowRight, size: 16),
+ onTap: () => _openQuestion(group, agent),
+ ),
+ ),
+ ],
),
+ ),
ListenableBuilder(
listenable: completing,
builder: (context, _) {
diff --git a/desktop/test/super_tab_chat_test.dart b/desktop/test/super_tab_chat_test.dart
index aa1cab099..24a488025 100644
--- a/desktop/test/super_tab_chat_test.dart
+++ b/desktop/test/super_tab_chat_test.dart
@@ -788,14 +788,15 @@ void main() {
await c.refresh();
await tester.pumpAndSettle();
expect(find.text('Builder needs you'), findsNothing);
- // Stuck waits on a person as a decision does.
+ // Stuck is a wait on CI, a review or a machine, not a question to the
+ // reader: no bar (#3017).
group['assignment']
..['status'] = 'blocked'
..['result'] = 'The staging key is missing.';
server.revision++;
await c.refresh();
await tester.pumpAndSettle();
- expect(find.text('Builder needs you'), findsOneWidget);
+ expect(find.text('Builder needs you'), findsNothing);
},
);
diff --git a/desktop/test/super_tab_needs_you_bar_test.dart b/desktop/test/super_tab_needs_you_bar_test.dart
new file mode 100644
index 000000000..19d0efe75
--- /dev/null
+++ b/desktop/test/super_tab_needs_you_bar_test.dart
@@ -0,0 +1,321 @@
+import 'dart:io';
+import 'dart:ui' as ui;
+
+import 'package:flutter/material.dart';
+import 'package:flutter/rendering.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/super_tabs/buddy_rows.dart';
+import 'package:harness/super_tabs/controller.dart';
+import 'package:harness/super_tabs/decisions_page.dart';
+import 'package:harness/super_tabs/message_row.dart'
+ show SuperTabMessageHighlight;
+import 'package:harness/super_tabs/model.dart';
+import 'package:harness/super_tabs/view.dart';
+
+import 'box_render_preview_test.dart' show loadPreviewFonts;
+import 'support/super_tab_fixture.dart';
+import 'super_tab_tasks_view_test.dart' show tasksServer;
+
+/// Set to a folder to write the PR's screenshots there.
+final shots = Platform.environment['SUPER_TAB_NEEDS_YOU_SHOTS'];
+final _picture = GlobalKey();
+
+Future<void> shot(WidgetTester tester, String name) async {
+ if (shots == null) return;
+ await tester.runAsync(() async {
+ final boundary =
+ _picture.currentContext!.findRenderObject()! as RenderRepaintBoundary;
+ final image = await boundary.toImage();
+ final bytes = await image.toByteData(format: ui.ImageByteFormat.png);
+ await Directory(shots!).create(recursive: true);
+ await File('$shots/$name.png').writeAsBytes(bytes!.buffer.asUint8List());
+ image.dispose();
+ });
+}
+
+/// The "needs you" bar under a chat and the Tasks count in its header
+/// (task #3017: Leo's "can't be clicked", Dee's badge on the icon's corner).
+/// The reader is `owner`; the task is the fixture's `offline` group.
+Finder bar() => find.byKey(const ValueKey('super-needs-human-builder'));
+Finder row(String id) => find.byKey(ValueKey('super-message-$id'));
+
+ConversationServer server({
+ String status = 'needs_human',
+ String? askedOf,
+ Map<String, dynamic>? liveness,
+}) {
+ final server = ConversationServer();
+ server.state['agents'] = [
+ {
+ 'id': 'builder',
+ 'name': 'Builder',
+ 'machineId': 'host',
+ 'harnessId': 'session',
+ 'contributorId': 'owner',
+ 'configuration': {'engine': 'codex'},
+ },
+ ];
+ final group = (server.state['conversations'] as List)[1] as Map;
+ group['agentIds'] = ['builder'];
+ group['assignment'] = {
+ 'id': 'attempt',
+ 'agentId': 'builder',
+ 'status': status,
+ 'result': 'Which device should I test?',
+ 'askedOf': ?askedOf,
+ };
+ if (liveness != null) group['liveness'] = liveness;
+ return server;
+}
+
+/// The agent's own question as a message, then enough chat after it that
+/// opening it has to scroll.
+void asked(ConversationServer server, {int notes = 60}) {
+ server.append('Which device should I test?', conversationId: 'offline');
+ server.messages.last['author'] = {
+ 'kind': 'agent',
+ 'id': 'builder',
+ 'name': 'Builder',
+ };
+ for (var i = 0; i < notes; i++) {
+ server.append('Note $i', conversationId: 'offline');
+ }
+}
+
+Future<SuperTabController> show(
+ WidgetTester tester,
+ ConversationServer server, {
+ ValueChanged<SuperTabAgent>? onOpenTerminal,
+ Brightness brightness = Brightness.light,
+ bool terminalsVisible = false,
+}) async {
+ await tester.binding.setSurfaceSize(const Size(1200, 900));
+ addTearDown(() => tester.binding.setSurfaceSize(null));
+ final c = server.controller();
+ addTearDown(c.dispose);
+ final before = grid.AppTheme.brightness.value;
+ grid.AppTheme.brightness.value = brightness;
+ addTearDown(() => grid.AppTheme.brightness.value = before);
+ await c.refresh();
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: grid.buildAppTheme(brightness: brightness),
+ builder: (context, child) => RepaintBoundary(key: _picture, child: child),
+ home: Scaffold(
+ body: SuperTabView(
+ controller: c,
+ onInvite: () {},
+ onAddAgent: (_) {},
+ onOpenTerminal: onOpenTerminal ?? (_) {},
+ terminalsVisible: terminalsVisible,
+ terminal: terminalsVisible
+ ? const ColoredBox(color: Colors.black, child: SizedBox.expand())
+ : null,
+ machineName: (_) => 'Team Mac',
+ ),
+ ),
+ ),
+ );
+ await tester.pumpAndSettle();
+ if (c.snapshot?.conversation('offline') != null) {
+ c.select('offline');
+ await tester.pumpAndSettle();
+ }
+ return c;
+}
+
+void main() {
+ setUpAll(() async {
+ if (shots != null) await loadPreviewFonts();
+ });
+
+ group('who the bar shows for', () {
+ testWidgets('a task blocked on CI shows no bar', (tester) async {
+ await show(tester, server(status: 'blocked'));
+ expect(bar(), findsNothing);
+ });
+
+ testWidgets('a task blocked on the reader by name shows no bar either', (
+ tester,
+ ) async {
+ // Blocked is a wait on CI, a review or a machine, never a question.
+ await show(tester, server(status: 'blocked', askedOf: 'owner'));
+ expect(bar(), findsNothing);
+ });
+
+ testWidgets('a question to another person shows no bar', (tester) async {
+ await show(tester, server(askedOf: 'peer'));
+ expect(bar(), findsNothing);
+ await tester.pumpWidget(const SizedBox());
+ await show(
+ tester,
+ server(
+ liveness: {'state': 'waiting', 'why': 'person', 'personId': 'peer'},
+ ),
+ );
+ expect(bar(), findsNothing);
+ });
+
+ testWidgets('a question to the reader shows the bar', (tester) async {
+ await show(tester, server(askedOf: 'owner'));
+ expect(find.text('Builder needs you'), findsOneWidget);
+ });
+
+ for (final brightness in Brightness.values) {
+ testWidgets('looks right in ${brightness.name}', (tester) async {
+ await show(tester, server(askedOf: 'owner'), brightness: brightness);
+ await shot(tester, 'needs-you-bar-${brightness.name}');
+ });
+ }
+
+ testWidgets('a question nobody is named for, from an older backend, '
+ 'still shows it', (tester) async {
+ await show(tester, server());
+ expect(find.text('Builder needs you'), findsOneWidget);
+ });
+
+ testWidgets('a decision asked of the reader shows it while the agent '
+ 'keeps working', (tester) async {
+ final s = server(status: 'working');
+ s.ask(['Ship how?'], conversationId: 'offline');
+ await show(tester, s);
+ expect(find.text('Builder needs you'), findsOneWidget);
+ });
+ });
+
+ group('the click', () {
+ testWidgets('opens the question in the chat, lit', (tester) async {
+ final s = server(askedOf: 'owner');
+ asked(s);
+ final opened = <String>[];
+ await show(tester, s, onOpenTerminal: (a) => opened.add(a.id));
+ expect(row('message-1').hitTestable(), findsNothing);
+ await tester.tap(bar());
+ await tester.pumpAndSettle();
+ expect(row('message-1').hitTestable(), findsOneWidget);
+ expect(
+ tester
+ .widget<SuperTabMessageHighlight>(
+ find.ancestor(
+ of: row('message-1'),
+ matching: find.byType(SuperTabMessageHighlight),
+ ),
+ )
+ .on,
+ isTrue,
+ );
+ expect(opened, isEmpty);
+ });
+
+ testWidgets('lights the message that says the question, not the agent’s '
+ 'later ones', (tester) async {
+ final s = server(askedOf: 'owner');
+ asked(s, notes: 30);
+ // The agent goes on talking after it asked.
+ s.append('Still working on the build.', conversationId: 'offline');
+ s.messages.last['author'] = {
+ 'kind': 'agent',
+ 'id': 'builder',
+ 'name': 'Builder',
+ };
+ for (var i = 0; i < 25; i++) {
+ s.append('More $i', conversationId: 'offline');
+ }
+ await show(tester, s);
+ await tester.tap(bar());
+ await tester.pumpAndSettle();
+ expect(row('message-1').hitTestable(), findsOneWidget);
+ expect(
+ tester
+ .widget<SuperTabMessageHighlight>(
+ find.ancestor(
+ of: row('message-1'),
+ matching: find.byType(SuperTabMessageHighlight),
+ ),
+ )
+ .on,
+ isTrue,
+ );
+ });
+
+ testWidgets('a terminal already open says where the question is', (
+ tester,
+ ) async {
+ final opened = <String>[];
+ await show(
+ tester,
+ server(askedOf: 'owner'),
+ onOpenTerminal: (a) => opened.add(a.id),
+ terminalsVisible: true,
+ );
+ await tester.tap(bar());
+ await tester.pumpAndSettle();
+ expect(opened, isEmpty);
+ expect(
+ find.descendant(
+ of: find.byType(SnackBar),
+ matching: find.textContaining('question is in its terminal'),
+ ),
+ findsOneWidget,
+ );
+ });
+
+ testWidgets('a decision opens where decisions are answered', (
+ tester,
+ ) async {
+ final s = server(status: 'working');
+ s.ask(['Ship how?'], conversationId: 'offline');
+ await show(tester, s);
+ await tester.tap(bar());
+ await tester.pumpAndSettle();
+ expect(find.byType(SuperTabDecisionsPage), findsOneWidget);
+ expect(find.text('Ship how?'), findsWidgets);
+ });
+
+ testWidgets('with only a terminal to go to, it opens that terminal', (
+ tester,
+ ) async {
+ final opened = <String>[];
+ await show(
+ tester,
+ server(askedOf: 'owner'),
+ onOpenTerminal: (a) => opened.add(a.id),
+ );
+ await tester.tap(bar());
+ await tester.pumpAndSettle();
+ expect(opened, ['builder']);
+ });
+ });
+
+ group('the Tasks count', () {
+ Future<void> tasks(WidgetTester tester, Brightness brightness) async {
+ await show(tester, tasksServer(), brightness: brightness);
+ }
+
+ for (final brightness in Brightness.values) {
+ testWidgets('sits on the icon’s top-right corner in ${brightness.name}, '
+ 'with its tooltip', (tester) async {
+ await tasks(tester, brightness);
+ final icon = tester.getRect(find.byKey(const ValueKey('super-tasks')));
+ final badge = tester.getRect(
+ find.byKey(const ValueKey('super-tasks-badge')),
+ );
+ expect(badge.center.dx, greaterThan(icon.center.dx));
+ expect(badge.center.dy, lessThan(icon.center.dy));
+ expect(badge.left, lessThan(icon.right));
+ expect(badge.right, greaterThan(icon.right - 4));
+ expect(badge.top, lessThan(icon.top + 6));
+ await shot(tester, 'tasks-badge-${brightness.name}');
+ expect(
+ tester
+ .widget<SuperTabCountBadge>(
+ find.byKey(const ValueKey('super-tasks-badge')),
+ )
+ .tooltip,
+ '1 task needs you',
+ );
+ });
+ }
+ });
+}
diff --git a/docs/plans/2026-11-05-needs-you-bar-plan.md b/docs/plans/2026-11-05-needs-you-bar-plan.md
new file mode 100644
index 000000000..40dc47c68
--- /dev/null
+++ b/docs/plans/2026-11-05-needs-you-bar-plan.md
@@ -0,0 +1,36 @@
+# "Needs you" bar and header count badge Implementation Plan
+
+**Goal:** The "<agent> needs you" bar under a chat shows only when the agent waits on the reader, and a click opens
+that question where it is. The Tasks count in a chat's header sits on the icon's top-right corner (Leo and Dee, #3017).
+
+**Architecture:** `desktop/lib/super_tabs/view.dart` only. `_needsHuman` decides who waits on the reader; a new
+`_openQuestion` replaces `_openAgent` as the bar's tap; a private `_withCountBadge` places the shared
+`SuperTabCountBadge` on a header icon's corner.
+
+**Tech Stack:** Flutter widget tests with the `ConversationServer` fixture. **Spec:** the task brief in #3017
+(positioning: Tell the PM what you want, and your crew ships it, by showing the reader only what waits on them).
+
+## Global Constraints
+- Stay out of the sidebar and Activity files (#2996). No new setting, no new files in `lib/`.
+- Follow `desktop/design/desktop-design-system.md`; the badge keeps its tooltip and `super-tasks-badge` key.
+
+## Review Focus
+- A `blocked` task and a `needs_human` asked of someone else show no bar; the sidebar's Tasks count follows.
+- The click never lands on a terminal that is already open without saying something.
+
+## Task 1: Who the bar shows for
+**Files:** `desktop/lib/super_tabs/view.dart` (`_needsHuman`), `desktop/test/super_tab_needs_you_bar_test.dart`.
+- [ ] Failing tests: blocked shows no bar; needs_human asked of another person shows none; asked of the reader
+ shows it; an open decision of the reader shows it.
+- [ ] Implement `_needsHuman` by `askedOf` (else the liveness person), open decisions and terminal questions.
+
+## Task 2: The click opens the question
+**Files:** same.
+- [ ] Failing tests: the click scrolls to the agent's latest message in the chat and lights it; an open decision
+ opens Notifications; with only a terminal, the click opens it or says why it cannot.
+- [ ] Implement `_openQuestion`.
+
+## Task 3: Count badge on the icon's corner
+**Files:** same.
+- [ ] Failing test: `super-tasks-badge` sits on the Tasks icon's top-right corner and keeps its tooltip.
+- [ ] Implement `_withCountBadge` and use it for the Tasks button.