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.

Merge batch 11-04 b0035: #2829 (#2850)

0xken15557fa55d0f31
diff --git a/desktop/lib/super_tabs/activity.dart b/desktop/lib/super_tabs/activity.dart
index 1c3d93f91..f3f1d80f5 100644
--- a/desktop/lib/super_tabs/activity.dart
+++ b/desktop/lib/super_tabs/activity.dart
@@ -127,18 +127,10 @@ class SuperTabActivity extends ChangeNotifier {
static const _unknown = 9007199254740991;
/// The tags that need the reader: not read past (the number clears by
- /// reading). One in a thread that New replies lists is shown there instead;
- /// a tag in a thread the reader does not follow still needs them.
+ /// reading). A tagged thread may also be in New replies; its mention remains
+ /// a separate Needs you item so the conversation badge represents it.
Iterable<SuperTabMention> get _tags {
- final listed = {
- for (final t in newReplies) '${t.conversationId}/${t.rootId}',
- };
- return mentions.waiting.where(
- (m) =>
- mentionUnread(m) &&
- (m.threadId == null ||
- !listed.contains('${m.conversationId}/${m.threadId}')),
- );
+ return mentions.waiting.where(mentionUnread);
}
/// A task whose agent waits on the reader (it needs a decision, or is
diff --git a/desktop/lib/super_tabs/attention.dart b/desktop/lib/super_tabs/attention.dart
index b1a2a9ff2..91b84d745 100644
--- a/desktop/lib/super_tabs/attention.dart
+++ b/desktop/lib/super_tabs/attention.dart
@@ -126,33 +126,64 @@ class SuperTabAttention extends ChangeNotifier {
String get _path =>
'/api/super-tabs/${Uri.encodeComponent(controller.tabId)}';
- /// The red number of [conversationId]: tags of the reader in its main
- /// stream, and decisions asked of them there (an agent asking a person to
- /// decide tags them). A tag in a reply that lives only in its thread counts
- /// on Threads instead.
- ///
- /// As in Slack, a tag stops counting once the reader has read past it,
- /// answered or not; a decision once its chat is read (its row does not say
- /// which message asked). Nothing counts once access is gone.
- int mentionsIn(String conversationId) {
+ /// Unread tags Activity shows under Needs you for [conversationId]. A tag
+ /// in a followed thread can also appear under New replies; it remains a
+ /// separate item that needs the reader and counts on its conversation row.
+ int tagsIn(String conversationId) {
if (controller.accessRevoked) return 0;
// A muted chat never counts (Slack); its tags stay listed in Activity.
if (controller.notifyOf(conversationId) == SuperTabNotify.muted) return 0;
- final tags = mentions.waiting
- .where(
- (m) =>
- m.conversationId == conversationId &&
- m.threadId == null &&
- (m.messageSequence ?? _unknown) >
- controller.readMark(conversationId),
- )
- .length;
- final asked = decisions.open
- .where((d) => d.conversationId == conversationId)
+ return mentions.waiting.where((m) {
+ if (m.conversationId != conversationId) return false;
+ final mark = m.threadId == null
+ ? controller.readMark(conversationId)
+ : controller.threadReadMark(m.threadId!);
+ return (m.messageSequence ?? _unknown) > mark;
+ }).length;
+ }
+
+ /// Open decisions Activity shows as Needs you for [conversationId].
+ int decisionsIn(String conversationId) {
+ if (controller.accessRevoked ||
+ controller.notifyOf(conversationId) == SuperTabNotify.muted) {
+ return 0;
+ }
+ return decisions.open
+ .where((decision) => decision.conversationId == conversationId)
.length;
- if (asked == 0) return tags;
- final group = controller.snapshot?.conversation(conversationId);
- return tags + (group != null && controller.unreadShown(group) ? asked : 0);
+ }
+
+ /// The red number of [conversationId]: tags and decisions Activity shows
+ /// under Needs you for this conversation. Nothing counts once access is
+ /// gone.
+ int mentionsIn(String conversationId) =>
+ tagsIn(conversationId) + decisionsIn(conversationId);
+
+ /// What a conversation's red number counts, for its hover label.
+ String? badgeTooltipIn(String conversationId) {
+ final tags = tagsIn(conversationId);
+ final asked = decisionsIn(conversationId);
+ if (tags == 0 && asked == 0) return null;
+ return [
+ if (tags > 0) '$tags ${tags == 1 ? 'tag' : 'tags'}',
+ if (asked > 0)
+ '$asked ${asked == 1 ? 'decision' : 'decisions'} waiting for you',
+ ].join(', ');
+ }
+
+ /// Whether [threadId] contains an unread tag of the reader.
+ bool hasUnreadTagInThread(String conversationId, String threadId) {
+ if (controller.accessRevoked ||
+ controller.notifyOf(conversationId) == SuperTabNotify.muted) {
+ return false;
+ }
+ final mark = controller.threadReadMark(threadId);
+ return mentions.waiting.any(
+ (mention) =>
+ mention.conversationId == conversationId &&
+ mention.threadId == threadId &&
+ (mention.messageSequence ?? _unknown) > mark,
+ );
}
/// A tag from a server that does not say where it is: it counts until
diff --git a/desktop/lib/super_tabs/buddy_rows.dart b/desktop/lib/super_tabs/buddy_rows.dart
index bae78eee8..233d26021 100644
--- a/desktop/lib/super_tabs/buddy_rows.dart
+++ b/desktop/lib/super_tabs/buddy_rows.dart
@@ -10,13 +10,14 @@ import 'section_heading.dart';
/// Notifications or in a conversation: Slack's red number, white on the
/// danger fill (5.4:1 or more in both themes, app_theme.dart dangerFill).
class SuperTabCountBadge extends StatelessWidget {
- const SuperTabCountBadge(this.count, {super.key});
+ const SuperTabCountBadge(this.count, {super.key, this.tooltip});
final int count;
+ final String? tooltip;
@override
Widget build(BuildContext context) {
grid.AppTheme.watch(context);
- return Container(
+ final badge = Container(
constraints: const BoxConstraints(minWidth: 18),
padding: const EdgeInsets.symmetric(
horizontal: grid.AppDesktop.badgeInset,
@@ -32,6 +33,7 @@ class SuperTabCountBadge extends StatelessWidget {
.copyWith(fontWeight: grid.AppFont.semibold),
),
);
+ return tooltip == null ? badge : Tooltip(message: tooltip!, child: badge);
}
}
@@ -51,6 +53,7 @@ class SuperTabBuddyRow extends StatelessWidget {
this.selected = false,
this.unread = false,
this.badge = 0,
+ this.badgeTooltip,
this.note,
this.detail,
this.status,
@@ -66,6 +69,7 @@ class SuperTabBuddyRow extends StatelessWidget {
/// Tags of the reader in this chat: the red number.
final int badge;
+ final String? badgeTooltip;
final VoidCallback? onTap;
/// What hovering says: "Your Buddy · openharness".
@@ -203,7 +207,7 @@ class SuperTabBuddyRow extends StatelessWidget {
child: Semantics(
label: badge == 1 ? '1 mention' : '$badge mentions',
excludeSemantics: true,
- child: SuperTabCountBadge(badge),
+ child: SuperTabCountBadge(badge, tooltip: badgeTooltip),
),
),
SizedBox(
diff --git a/desktop/lib/super_tabs/message_row.dart b/desktop/lib/super_tabs/message_row.dart
index 5d1e212c1..5a2e3e97f 100644
--- a/desktop/lib/super_tabs/message_row.dart
+++ b/desktop/lib/super_tabs/message_row.dart
@@ -52,6 +52,7 @@ class SuperTabMessageRow extends StatefulWidget {
this.dimmed = false,
this.thread,
this.threadUnread = false,
+ this.threadTagged = false,
this.onOpenThread,
this.threadTrailing,
this.threadEnd,
@@ -71,6 +72,9 @@ class SuperTabMessageRow extends StatefulWidget {
final SuperTabThread? thread;
final bool threadUnread;
+ /// Whether an unread reply in [thread] tags the reader.
+ final bool threadTagged;
+
/// Opens [message]'s thread: from its reply line, or from an also-sent
/// reply's mark.
final VoidCallback? onOpenThread;
@@ -583,6 +587,7 @@ class _SuperTabMessageRowState extends State<SuperTabMessageRow> {
),
thread: thread,
unread: widget.threadUnread,
+ tagged: widget.threadTagged,
onOpen: open,
member: widget.member,
trailing: widget.threadTrailing,
@@ -821,6 +826,7 @@ class SuperTabThreadLine extends StatelessWidget {
required this.thread,
required this.unread,
required this.onOpen,
+ this.tagged = false,
this.member,
this.trailing,
this.end,
@@ -833,7 +839,7 @@ class SuperTabThreadLine extends StatelessWidget {
/// Drawn last, outside the line's link: End session.
final Widget? end;
- final bool unread;
+ final bool unread, tagged;
final VoidCallback onOpen;
/// Dresses each reply author as their own messages are: a person's
@@ -886,7 +892,7 @@ class SuperTabThreadLine extends StatelessWidget {
: 'Last reply ${superTabAgo(DateTime.now().difference(last))}';
final link = _SuperTabThreadBar(
key: ValueKey('super-thread-bar-${thread.id}'),
- label: unread ? '$count, unread' : count,
+ label: [count, if (unread) 'unread', if (tagged) '@ you'].join(', '),
onTap: onOpen,
builder: (active) => Row(
children: [
@@ -912,6 +918,14 @@ class SuperTabThreadLine extends StatelessWidget {
),
),
),
+ if (tagged) ...[
+ const SizedBox(width: grid.AppDesktop.controlGap),
+ Text(
+ '@ you',
+ key: ValueKey('super-thread-tagged-${thread.id}'),
+ style: DesktopChrome.metadata(color: DesktopChrome.accent),
+ ),
+ ],
const SizedBox(width: grid.AppDesktop.controlGap),
Flexible(
child: Text(
diff --git a/desktop/lib/super_tabs/project_sidebar.dart b/desktop/lib/super_tabs/project_sidebar.dart
index 6ce65ffea..f8b89b667 100644
--- a/desktop/lib/super_tabs/project_sidebar.dart
+++ b/desktop/lib/super_tabs/project_sidebar.dart
@@ -252,6 +252,7 @@ class ProjectSidebar extends StatelessWidget {
// Slack's way). Tags in the task conversations it hides make it bold, and
// are on their own rows and in Activity.
final badge = attention?.mentionsIn(group.id) ?? 0;
+ final badgeTooltip = attention?.badgeTooltipIn(group.id);
return _drawRow(
group,
project: project,
@@ -260,6 +261,7 @@ class ProjectSidebar extends StatelessWidget {
waiting: waiting,
unread: unread,
badge: badge,
+ badgeTooltip: badgeTooltip,
buddyChat: reading?.buddyChat,
selectedProjectId: reading?.sidebar.selectedProjectId,
);
@@ -295,6 +297,7 @@ class ProjectSidebar extends StatelessWidget {
waiting: reading.waiting.contains(group.id),
unread: reading.unread.contains(group.id),
badge: attention?.mentionsIn(group.id) ?? 0,
+ badgeTooltip: attention?.badgeTooltipIn(group.id),
);
Widget _drawRow(
@@ -307,6 +310,7 @@ class ProjectSidebar extends StatelessWidget {
required bool waiting,
required bool unread,
int badge = 0,
+ String? badgeTooltip,
SuperTabConversation? buddyChat,
String? selectedProjectId,
Widget? trailing,
@@ -480,15 +484,18 @@ class ProjectSidebar extends StatelessWidget {
if (badge > 0) ...[
const SizedBox(width: 8),
Semantics(
- label: badge == 1
- ? '1 mention'
- : '$badge mentions',
+ label:
+ badgeTooltip ??
+ (badge == 1
+ ? '1 mention'
+ : '$badge mentions'),
excludeSemantics: true,
child: SuperTabCountBadge(
badge,
key: ValueKey(
'super-mentions-${group.id}',
),
+ tooltip: badgeTooltip,
),
),
],
@@ -738,6 +745,7 @@ class ProjectSidebar extends StatelessWidget {
chat != null && !_paneCovered && controller.selectedId == chat.id,
unread: chat != null && controller.unreadShown(chat),
badge: chat == null ? 0 : attention?.mentionsIn(chat.id) ?? 0,
+ badgeTooltip: chat == null ? null : attention?.badgeTooltipIn(chat.id),
onTap: chat != null
? () => onSelect(chat.id)
: controller.saving || controller.hasPendingAction
diff --git a/desktop/lib/super_tabs/view.dart b/desktop/lib/super_tabs/view.dart
index 289b80d99..f63dfa76c 100644
--- a/desktop/lib/super_tabs/view.dart
+++ b/desktop/lib/super_tabs/view.dart
@@ -3161,6 +3161,9 @@ class _SuperTabViewState extends State<SuperTabView>
},
thread: thread,
threadUnread: thread != null && c.threadUnread(thread),
+ threadTagged:
+ thread != null &&
+ SuperTabAttention.of(c).hasUnreadTagInThread(c.selectedId, thread.id),
// A thread its own Buddy session answers says so on its line.
threadTrailing: switch (thread == null || inThread
? null
diff --git a/desktop/test/super_tab_activity_lists_test.dart b/desktop/test/super_tab_activity_lists_test.dart
index 535f0fedc..4388f18a9 100644
--- a/desktop/test/super_tab_activity_lists_test.dart
+++ b/desktop/test/super_tab_activity_lists_test.dart
@@ -327,7 +327,7 @@ void main() {
});
test(
- 'a tag in a thread-only reply is a new reply, not Needs you',
+ 'a tag in a thread-only reply is Needs you and a new reply',
() async {
final server = swarm();
server.tag(
@@ -342,8 +342,10 @@ void main() {
'more': false,
};
final activity = await load(server);
- expect(activity.needsYou, isEmpty);
- expect(activity.count, 0);
+ expect(activity.needsYou, hasLength(1));
+ expect(activity.needsYou.single.kind, SuperTabNeedKind.mention);
+ expect(activity.needsYou.single.conversationId, 'offline');
+ expect(activity.count, 1);
expect(activity.newReplies.map((t) => t.rootId), ['message-1']);
},
);
diff --git a/desktop/test/super_tab_attention_shots_test.dart b/desktop/test/super_tab_attention_shots_test.dart
index 07c436770..a262d5858 100644
--- a/desktop/test/super_tab_attention_shots_test.dart
+++ b/desktop/test/super_tab_attention_shots_test.dart
@@ -5,6 +5,7 @@ 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/activity.dart';
import 'package:harness/super_tabs/attention.dart';
import 'package:harness/super_tabs/view.dart';
@@ -78,18 +79,17 @@ ConversationServer _swarm() {
conversationId: 'web-lead',
projectId: 'web',
);
- server.tag('message-1', threadId: 'message-1');
_fromLead(server, 'Weekly plan', 'lead');
+ final threadRoot = server.messages.last['id'] as String;
_fromLead(server, 'Looks right to me.', 'lead');
- server.messages.last['thread'] =
- server.messages[server.messages.length - 2]['id'];
+ server.messages.last['thread'] = threadRoot;
server.followedThreads = {
'unread': [
{
'conversationId': 'lead',
- 'rootId': server.messages[server.messages.length - 2]['id'],
+ 'rootId': threadRoot,
'root': _root(
- server.messages[server.messages.length - 2]['id'] as String,
+ threadRoot,
'Weekly plan: badges first, then the Threads view.',
'2026-10-31T01:00:00Z',
),
@@ -118,6 +118,14 @@ ConversationServer _swarm() {
],
'more': false,
};
+ server.tag(
+ threadRoot,
+ threadId: threadRoot,
+ messageSequence: server.revision + 1,
+ );
+ server.mentions.last
+ ..['leadName'] = 'River'
+ ..['projectName'] = 'openharness';
return server;
}
@@ -149,6 +157,12 @@ void main() {
await attention.mentions.load();
await attention.decisions.load();
await attention.load();
+ final activity = SuperTabActivity.of(c);
+ expect(attention.mentionsIn('lead'), 1);
+ expect(
+ activity.needsYou.where((need) => need.conversationId == 'lead'),
+ hasLength(1),
+ );
c.select('roster');
if (!c.expandedProjects.contains('lead')) c.toggleProject('lead');
final picture = GlobalKey();
@@ -174,7 +188,8 @@ void main() {
);
await tester.pumpAndSettle();
if (scene.startsWith('threads')) {
- await tester.tap(find.byKey(const ValueKey('super-threads')));
+ // New replies are in Activity, not a separate Threads control.
+ await tester.tap(find.byKey(const ValueKey('super-activity')));
await tester.pumpAndSettle();
await tester.pumpAndSettle();
}
@@ -185,9 +200,7 @@ void main() {
await mouse.addPointer(location: Offset.zero);
await mouse.moveTo(
tester.getCenter(
- find.text(
- 'Should heavy CI wait while the account is at its job limit?',
- ),
+ find.text('Weekly plan: badges first, then the Threads view.'),
),
);
await tester.pumpAndSettle();
@@ -200,10 +213,11 @@ void main() {
await mouse.addPointer(location: Offset.zero);
await mouse.moveTo(
tester.getCenter(
- find.byKey(const ValueKey('super-group-web-lead')),
+ find.byKey(const ValueKey('super-mentions-web-lead')),
),
);
await tester.pumpAndSettle();
+ await tester.pump(const Duration(seconds: 1));
addTearDown(mouse.removePointer);
}
await captureBoundary(
diff --git a/desktop/test/super_tab_attention_test.dart b/desktop/test/super_tab_attention_test.dart
index 54b01e0f8..c10db2da7 100644
--- a/desktop/test/super_tab_attention_test.dart
+++ b/desktop/test/super_tab_attention_test.dart
@@ -8,6 +8,7 @@ import 'package:fake_async/fake_async.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:harness/shared/theme/app_theme.dart' as grid;
import 'package:harness/super_tabs/attention.dart';
+import 'package:harness/super_tabs/activity.dart';
import 'package:harness/super_tabs/buddy_rows.dart';
import 'package:harness/super_tabs/controller.dart';
import 'package:harness/super_tabs/model.dart';
@@ -223,18 +224,86 @@ void main() {
await close(tester, c);
});
- testWidgets('a tag in a reply that lives only in a thread counts on '
- 'its thread, not on the project row', (tester) async {
+ testWidgets('a tag in an unread New replies thread also counts on the '
+ 'project row and in Needs you', (tester) async {
final server = projectServer();
server.followedThreads = {
'unread': [unreadThread('message-1', 2, conversationId: 'lead')],
'read': [],
'more': false,
};
- server.tag('message-1', threadId: 'message-1');
+ server.tag('message-1', threadId: 'message-1', messageSequence: 2);
final (c, attention) = await opened(server);
+ final activity = SuperTabActivity.of(c);
+ await activity.mentions.load();
+ await pumpSidebar(tester, c, attention);
+ expect(attention.mentionsIn('lead'), 1);
+ expect(attention.mentionsIn('offline'), 0);
+ expect(activity.newReplies, hasLength(1));
+ expect(
+ activity.needsYou.where((need) => need.conversationId == 'lead'),
+ hasLength(1),
+ );
+ expect(inRow('super-group-lead', find.text('1')), findsOneWidget);
+ await close(tester, c);
+ });
+
+ testWidgets('the project badge explains its count and clears with '
+ 'Needs you', (tester) async {
+ final server = projectServer();
+ server.followedThreads = {
+ 'unread': [],
+ 'read': [readThread('message-1', 2, conversationId: 'lead')],
+ 'more': false,
+ };
+ server.tag('message-1', threadId: 'message-1', messageSequence: 2);
+ server.ask(['Ship it?'], conversationId: 'lead');
+ final (c, attention) = await opened(server);
+ final activity = SuperTabActivity.of(c);
+ await activity.mentions.load();
+ await pumpSidebar(tester, c, attention);
+ final projectBadge = find.byKey(const ValueKey('super-mentions-lead'));
+ expect(
+ find.descendant(of: projectBadge, matching: find.text('2')),
+ findsOneWidget,
+ );
+ expect(attention.mentionsIn('lead'), activity.needsYou.length);
+ final mouse = await tester.createGesture(kind: PointerDeviceKind.mouse);
+ await mouse.addPointer(location: tester.getCenter(projectBadge));
+ await mouse.moveTo(tester.getCenter(projectBadge));
+ await tester.pump(const Duration(seconds: 1));
+ expect(find.text('1 tag, 1 decision waiting for you'), findsOneWidget);
+ c.markThreadRead('lead', 'message-1', 2);
+ await attention.decisions.answer(attention.decisions.open.single, 0);
+ await tester.pumpAndSettle();
+ expect(attention.mentionsIn('lead'), 0);
+ expect(activity.needsYou, isEmpty);
+ expect(find.byType(SuperTabCountBadge), findsNothing);
+ await c.flush();
+ await close(tester, c);
+ });
+
+ testWidgets('a tag in a reply that lives only in an unread thread '
+ 'counts on its thread and on the project row', (tester) async {
+ final server = projectServer();
+ server.followedThreads = {
+ 'unread': [unreadThread('message-1', 2, conversationId: 'lead')],
+ 'read': [],
+ 'more': false,
+ };
+ server.tag('message-1', threadId: 'message-1', messageSequence: 2);
+ final (c, attention) = await opened(server);
+ final activity = SuperTabActivity.of(c);
+ await activity.mentions.load();
await pumpSidebar(tester, c, attention);
expect(attention.threadMentions, 1);
+ expect(attention.mentionsIn('lead'), 1);
+ expect(activity.needsYou, hasLength(1));
+ expect(inRow('super-group-lead', find.text('1')), findsOneWidget);
+ c.markThreadRead('lead', 'message-1', 2);
+ await tester.pumpAndSettle();
+ expect(attention.mentionsIn('lead'), 0);
+ expect(activity.needsYou, isEmpty);
expect(
inRow('super-group-lead', find.byType(SuperTabCountBadge)),
findsNothing,
@@ -276,8 +345,8 @@ void main() {
});
});
- testWidgets('a tag in the chat counts on its row; a tag in a thread on '
- 'Threads; a decision on its row; plain unread is bold with no '
+ testWidgets('a tag in the chat and thread counts on its row; a decision '
+ 'on its row; plain unread is bold with no '
'number', (tester) async {
final server = projectServer();
server.followedThreads = {
@@ -297,14 +366,13 @@ void main() {
await attention.load();
c.toggleProject('lead');
await pumpSidebar(tester, c, attention);
- // The workgroup: one tag in its chat and one decision, not the tag in
- // its thread.
+ // The workgroup: one tag in its chat, one in its thread, and one decision.
expect(
inRow('super-group-offline', find.byType(SuperTabCountBadge)),
findsOneWidget,
);
- expect(inRow('super-group-offline', find.text('2')), findsOneWidget);
- // The tag inside a thread is counted apart from the row.
+ expect(inRow('super-group-offline', find.text('3')), findsOneWidget);
+ // The unread thread is still available in Activity's New replies.
expect(attention.threadMentions, 1);
// The project chat: unread, nothing for the reader, so no number.
expect(
@@ -576,8 +644,32 @@ void main() {
expect(attention.mentionsIn('offline'), 0);
});
- test('a tag stops counting once the reader has read past it, answered '
- 'or not; a decision once its chat is read', () async {
+ test(
+ 'an open decision stays on the sidebar count until answered',
+ () async {
+ final server = projectServer();
+ server.ask(['Ship it?'], conversationId: 'lead');
+ final c = await open(server);
+ final attention = SuperTabAttention.of(c);
+ final activity = SuperTabActivity.of(c);
+ await attention.decisions.load();
+ expect(activity.needsYou, hasLength(1));
+ // Reading the chat does not answer the question.
+ c.markRead('lead');
+ expect(attention.mentionsIn('lead'), 1);
+ expect(attention.decisionsIn('lead'), 1);
+ expect(
+ await attention.decisions.answer(attention.decisions.open.single, 0),
+ isTrue,
+ );
+ await attention.decisions.load();
+ expect(attention.mentionsIn('lead'), 0);
+ expect(activity.needsYou, isEmpty);
+ },
+ );
+
+ test('a tag stops counting after reading, but a decision waits for an '
+ 'answer', () async {
final server = projectServer();
server.followedThreads = {
'unread': [],
@@ -601,6 +693,12 @@ void main() {
server.markReadElsewhere('offline', server.revision);
await c.refresh();
expect(attention.mentions.waiting, hasLength(1));
+ expect(attention.mentionsIn('offline'), 1);
+ expect(
+ await attention.decisions.answer(attention.decisions.open.single, 0),
+ isTrue,
+ );
+ await attention.decisions.load();
expect(attention.mentionsIn('offline'), 0);
// A tag in a thread clears once the thread is read past it.
server.tag(
diff --git a/desktop/test/super_tab_threads_shots_test.dart b/desktop/test/super_tab_threads_shots_test.dart
index 4f59288d4..45151a16c 100644
--- a/desktop/test/super_tab_threads_shots_test.dart
+++ b/desktop/test/super_tab_threads_shots_test.dart
@@ -112,6 +112,7 @@ void main() {
minutesAgo: 2,
);
say('Morning digest is up for review.', ken, minutesAgo: 1);
+ server.tag('message-2', threadId: 'message-1', messageSequence: 2);
// A chat with a Lead, so messages read as sent.
((server.state['conversations'] as List)[0] as Map)['leadId'] = 'pm';
final c = server.controller(account: 'dee');
diff --git a/desktop/test/super_tab_threads_test.dart b/desktop/test/super_tab_threads_test.dart
index a238d47b2..b50815cb6 100644
--- a/desktop/test/super_tab_threads_test.dart
+++ b/desktop/test/super_tab_threads_test.dart
@@ -101,6 +101,27 @@ void main() {
expect(line('message-4'), findsNothing);
});
+ testWidgets('a thread line says @ you when an unread reply tags the reader', (
+ tester,
+ ) async {
+ final server = threaded();
+ server.tag(
+ 'message-2',
+ threadId: 'message-1',
+ messageSequence: server.revision,
+ );
+ final c = await show(tester, server);
+ final tag = find.descendant(
+ of: line('message-1'),
+ matching: find.text('@ you'),
+ );
+ expect(tag, findsOneWidget);
+ c.markThreadRead('lead', 'message-1', server.revision);
+ await tester.pumpAndSettle();
+ expect(tag, findsNothing);
+ await c.flush();
+ });
+
testWidgets('a reply also sent to the chat shows in both, marked as a '
'thread reply', (tester) async {
await show(tester, threaded(alsoSend: true));
diff --git a/docs/plans/2026-11-03-thread-tag-attention-plan.md b/docs/plans/2026-11-03-thread-tag-attention-plan.md
new file mode 100644
index 000000000..2544637b1
--- /dev/null
+++ b/docs/plans/2026-11-03-thread-tag-attention-plan.md
@@ -0,0 +1,101 @@
+# Thread tags in the sidebar and replies line: Implementation Plan
+
+> **For agentic workers:** Follow the Harness Engineer workflow in the project's instructions. This plan is implemented by the assigned Engineer; it does not use subagent-driven development.
+
+**Goal:** Make an unread tag inside a project-chat thread visible in Activity and the relevant sidebar count, show `@ you` on that thread's reply line, and explain sidebar badge counts on hover.
+
+**Architecture:** Desktop already loads unread tags and decisions centrally in `SuperTabAttention`; the sidebar currently calls `mentionsIn`, which excludes thread-scoped tags, while Activity has the unread/read rules for thread mentions. Expose per-conversation waiting tag and decision counts using the same read, muted and visibility rules as Activity; use that count for the sidebar badge and tooltip, and a per-thread unread-tag query for the replies line. Build the read/clear behavior on Diego's #2721 after it lands on main.
+
+**Tech Stack:** Dart, Flutter, existing Super Tab attention and widget tests.
+
+**Spec:** Task #2358 conversation `21754bfc76109e10c03d72db`; existing `desktop/lib/super_tabs/activity.dart` and `attention.dart` attention rules; #2721 read/answer clearing behavior.
+
+**Agreed interaction sketch:**
+
+```text
+Project chat [2]
+ Proposal 2 replies · @ you
+
+Hover badge: 1 tag, 1 decision waiting for you
+```
+
+## Global Constraints
+
+- Do not change how tags or decisions are created, and do not add push notifications.
+- Read the project's existing attention and Activity rules; the sidebar and Activity must agree on which tags are still waiting.
+- A tag clears when its thread is opened or the reader replies, following #2721; an answered decision no longer counts.
+- Use the existing Desktop memory store and fake sign-in in tests. Never run a test that signs the Mac out of the real CLI.
+- Keep the implementation in Desktop attention, sidebar and message-row presentation unless the root-cause test proves a backend change is needed.
+- Before Ready, add a failing test for each named behavior, record red/green evidence in a PR comment, and capture widget-test screenshots. The Super Tab integration suite is supplied by PR CI; do not run the full suite locally.
+- Pull request body starts with `Requested by [email protected] through Harness.`
+
+## Review Focus
+
+- **Thread scope:** An unread tag in a reply is counted for the correct conversation and thread; tags in a different thread do not leak into the badge.
+- **Read and answer clearing:** Opening the thread or replying removes the tag from the reply marker, sidebar badge and Activity count; a stale mention does not remain visible.
+- **Activity parity:** Thread tags represented by Activity's New replies are not double-counted as Needs you; tags shown as Needs you match the sidebar's tag count.
+- **Mixed counts:** Tags and open decisions produce the correct combined badge number and distinct tooltip labels, including singular and plural forms.
+- **Project scope:** A collapsed project row and its workgroup rows count only the tags and decisions in the conversations each row represents; muted or inaccessible conversations do not add counts.
+
+---
+
+### Task 1: Count unread thread tags with the same rules as Activity
+
+**Files:**
+- Modify: `desktop/lib/super_tabs/attention.dart`
+- Test: `desktop/test/super_tab_attention_test.dart`
+- Test: `desktop/test/super_tab_activity_test.dart`
+
+**Interfaces:**
+- Consumes: `SuperTabMentions.waiting`, `SuperTabDecisions.open`, `SuperTabController.readMark`, `threadReadMark`, and the thread list Activity uses to distinguish New replies from Needs you.
+- Produces: `tagsIn(String conversationId)`, `decisionsIn(String conversationId)`, and `mentionsIn(String conversationId)` whose total matches the tags and decisions Activity shows as Needs you for that conversation; `hasUnreadTagInThread(String conversationId, String threadId)` for the reply-line marker.
+
+- [x] **Step 1: Add a failing attention test** named `counts_an_unread_tag_in_a_project_chat_thread_as_needs_you`. Use a waiting mention with a thread id and sequence after the thread read mark, on a thread not currently listed as New replies; expect one tag in the conversation and one Needs you item, while a different conversation remains at zero.
+- [x] **Step 2: Run the focused test and confirm it fails** because `mentionsIn` currently filters for `threadId == null`.
+- [x] **Step 3: Commit the failing test** as `test(desktop): cover unread thread tags in sidebar attention`.
+- [x] **Step 4: Implement per-conversation tag and decision counts** in `attention.dart`, sharing the Activity unread and New replies exclusion rules so a thread mention is counted once.
+- [x] **Step 5: Verify read clearing** with a test that advancing the thread read mark removes the tag from the conversation count and Activity; after #2721 is merged, also verify its reply action clears the mention.
+- [x] **Step 6: Run the focused attention and Activity tests and commit the passing implementation** as `fix(desktop): count unread thread tags in sidebar attention`.
+
+### Task 2: Mark a tagged thread on its replies line
+
+**Files:**
+- Modify: `desktop/lib/super_tabs/view.dart` to pass thread mention state from attention.
+- Modify: `desktop/lib/super_tabs/message_row.dart` to render the marker.
+- Test: `desktop/test/super_tab_thread_tags_test.dart` or the existing message-row widget test that owns thread lines.
+
+**Interfaces:**
+- Consumes: `SuperTabAttention.hasUnreadTagInThread(conversationId, threadId)` from Task 1.
+- Produces: a `tagged` state on `SuperTabThreadLine`; when true, the line shows `@ you` beside its reply count and includes it in the accessible label.
+
+- [x] **Step 1: Add a failing widget test** named `shows_you_on_a_thread_line_with_an_unread_tag` using a real thread line and unread mention; also prove the marker is absent after its read mark advances.
+- [x] **Step 2: Run the focused widget test and confirm the marker is missing.**
+- [x] **Step 3: Commit the failing test** as `test(desktop): specify tagged thread reply line`.
+- [x] **Step 4: Pass the unread-tag state from `view.dart` to `SuperTabThreadLine` and render `@ you` in `message_row.dart`.**
+- [x] **Step 5: Run the focused thread-tag widget test and commit the implementation** as `feat(desktop): mark tagged thread replies in the chat`.
+
+### Task 3: Explain badge counts and verify the collapsed project view
+
+**Files:**
+- Modify: `desktop/lib/super_tabs/project_sidebar.dart`
+- Test: `desktop/test/super_tab_sidebar_test.dart` and `desktop/test/super_tab_sidebar_shots_test.dart`.
+
+**Interfaces:**
+- Consumes: Task 1's per-conversation tag and decision counts.
+- Produces: A tooltip for each sidebar attention badge that names its tag and decision counts, for example `1 tag, 1 decision waiting for you`; the badge number remains the sum of those waiting rows.
+
+- [x] **Step 1: Add failing widget tests** for a collapsed project badge that includes a thread tag, the exact mixed tag/decision tooltip, singular/plural labels, and zero after all relevant rows clear.
+- [x] **Step 2: Run the focused sidebar tests and confirm the thread-tag count and tooltip are missing.**
+- [x] **Step 3: Commit the failing tests** as `test(desktop): specify sidebar attention badge details`.
+- [x] **Step 4: Add the tooltip to each attention count badge and keep the row count equal to its visible Activity Needs you tags and decisions.**
+- [x] **Step 5: Capture the updated screenshot, run the focused sidebar widget tests, and commit** as `feat(desktop): explain project attention badge counts`.
+
+### Task 4: Validate and prepare review
+
+**Files:**
+- Update: this PR's validation comment and screenshots; no other product files unless a focused check fails.
+
+- [x] Wait for #2721 to merge; merge the new `origin/main` into this branch before implementing clearing behavior.
+- [x] Run affected Desktop tests and analyzer checks on macOS; use PR CI for the four Super Tab integration shards and other required Linux component checks (PR CI remains pending until Ready).
+- [ ] Record red/green evidence for the attention count, read/reply clearing, reply-line marker, and tooltip/count parity tests in a PR comment.
+- [ ] Attach screenshots from the widget tests, keep the head stable, and request the required review and Desktop test steps.
diff --git a/docs/plans/2026-11-03-thread-tag-attention/activity-dark.png b/docs/plans/2026-11-03-thread-tag-attention/activity-dark.png
new file mode 100644
index 000000000..da7540dc5
Binary files /dev/null and b/docs/plans/2026-11-03-thread-tag-attention/activity-dark.png differ
diff --git a/docs/plans/2026-11-03-thread-tag-attention/activity-light.png b/docs/plans/2026-11-03-thread-tag-attention/activity-light.png
new file mode 100644
index 000000000..c2c980730
Binary files /dev/null and b/docs/plans/2026-11-03-thread-tag-attention/activity-light.png differ
diff --git a/docs/plans/2026-11-03-thread-tag-attention/chat-dark.png b/docs/plans/2026-11-03-thread-tag-attention/chat-dark.png
new file mode 100644
index 000000000..22bd39e7e
Binary files /dev/null and b/docs/plans/2026-11-03-thread-tag-attention/chat-dark.png differ
diff --git a/docs/plans/2026-11-03-thread-tag-attention/chat-light.png b/docs/plans/2026-11-03-thread-tag-attention/chat-light.png
new file mode 100644
index 000000000..90c263305
Binary files /dev/null and b/docs/plans/2026-11-03-thread-tag-attention/chat-light.png differ