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.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
fix(super-tabs): a message one agent received no longer says Not sent because another agent's copy was cancelled (#2405)
0xken15c8aa7fca3657
diff --git a/desktop/lib/super_tabs/model.dart b/desktop/lib/super_tabs/model.dartindex 80d941c82..c4adfc93b 100644--- a/desktop/lib/super_tabs/model.dart+++ b/desktop/lib/super_tabs/model.dart@@ -942,13 +942,15 @@ class SuperTabDelivery {bool get pending => status == 'queued' || status == 'claimed';bool get delivered => status == 'delivered' || status == 'confirmed';- // One line cannot promise arrival while another recipient still waits.+ // One line cannot promise arrival while another recipient still waits, and+ // one agent's cancelled copy is no Not sent while another got the message+ // (10-30): Not sent only when no recipient got it.int get receiptOrder => switch (status) {'uncertain' => 0,'queued' || 'claimed' => 1,- 'cancelled' => 2,- 'delivered' || 'confirmed' => 3,- 'answered' => 4,+ 'delivered' || 'confirmed' => 2,+ 'answered' => 3,+ 'cancelled' => 4,_ => 5,};}diff --git a/desktop/test/super_tab_receipt_test.dart b/desktop/test/super_tab_receipt_test.dartindex 8b477ae3c..9adc9b993 100644--- a/desktop/test/super_tab_receipt_test.dart+++ b/desktop/test/super_tab_receipt_test.dart@@ -6,6 +6,7 @@ import 'package:flutter_test/flutter_test.dart';import 'package:harness/shared/theme/app_theme.dart' as grid;import 'package:harness/state/app_state.dart';import 'package:harness/super_tabs/controller.dart';+import 'package:harness/super_tabs/model.dart';import 'package:harness/super_tabs/view.dart';import 'support/super_tab_fixture.dart';@@ -544,4 +545,85 @@ void main() {await f.close();},);++ // A message tagging several agents: one agent's cancelled copy said Not sent+ // under it though the Lead's copy arrived, and people sent it again (10-30).+ // Not sent shows only when no recipient got it; one still waiting keeps its+ // own line, so the receipt never promises arrival while another waits.+ group('receipt: several recipients', () {+ Map<String, dynamic> row(String agentId, String status) => {+ 'id': 'delivery-$agentId',+ 'agentId': agentId,+ 'status': status,+ };+ String? receipt(List<Map<String, dynamic>> deliveries) =>+ SuperTabMessage.fromJson({+ 'id': 'm1',+ 'conversationId': 'lead',+ 'text': '@Lead @Builder please start',+ 'sequence': 1,+ 'author': {'kind': 'person', 'id': 'owner', 'name': 'Owner'},+ 'deliveries': deliveries,+ }).receiptDelivery?.status;++ test('one copy cancelled while another arrived is not the receipt', () {+ for (final arrived in ['delivered', 'confirmed', 'answered']) {+ final rows = [row('lead-agent', arrived), row('builder', 'cancelled')];+ expect(receipt(rows), arrived);+ expect(receipt(rows.reversed.toList()), arrived);+ }+ expect(receipt([row('builder', 'cancelled')]), 'cancelled');+ expect(+ receipt([row('lead-agent', 'queued'), row('builder', 'cancelled')]),+ 'queued',+ );+ expect(+ receipt([row('builder', 'cancelled'), row('lead-agent', 'claimed')]),+ 'claimed',+ );+ expect(+ receipt([row('lead-agent', 'answered'), row('builder', 'uncertain')]),+ 'uncertain',+ );+ });++ testWidgets(+ 'the Lead got it and the Builder\'s copy was cancelled: no Not sent',+ (tester) async {+ final f = ReceiptFixture(tester, status: null);+ await f.show(+ prepare: () => f.message['deliveries'] = [+ row('builder', 'cancelled'),+ row('lead-agent', 'delivered'),+ ],+ );+ f.expectQuiet();+ await f.close();+ },+ );++ testWidgets('every copy cancelled still reads Not sent', (tester) async {+ final f = ReceiptFixture(tester, status: null);+ await f.show(+ prepare: () => f.message['deliveries'] = [row('builder', 'cancelled')],+ );+ expect(find.text('Not sent'), findsOneWidget);+ await f.close();+ });++ testWidgets('the Lead\'s copy still waiting keeps its line, not Not sent', (+ tester,+ ) async {+ final f = ReceiptFixture(tester, status: null);+ await f.show(+ prepare: () => f.message['deliveries'] = [+ row('builder', 'cancelled'),+ row('lead-agent', 'queued'),+ ],+ );+ expect(find.text('Not sent'), findsNothing);+ expect(find.text('Not delivered yet'), findsOneWidget);+ await f.close();+ });+ });}diff --git a/mobile/lib/swarm/model.dart b/mobile/lib/swarm/model.dartindex 943c1064b..afbc298fc 100644--- a/mobile/lib/swarm/model.dart+++ b/mobile/lib/swarm/model.dart@@ -1003,13 +1003,15 @@ class SuperTabDelivery {bool get pending => status == 'queued' || status == 'claimed';bool get delivered => status == 'delivered' || status == 'confirmed';- // One line cannot promise arrival while another recipient still waits.+ // One line cannot promise arrival while another recipient still waits, and+ // one agent's cancelled copy is no Not sent while another got the message+ // (10-30): Not sent only when no recipient got it.int get receiptOrder => switch (status) {'uncertain' => 0,'queued' || 'claimed' => 1,- 'cancelled' => 2,- 'delivered' || 'confirmed' => 3,- 'answered' => 4,+ 'delivered' || 'confirmed' => 2,+ 'answered' => 3,+ 'cancelled' => 4,_ => 5,};}diff --git a/mobile/test/swarm/swarm_receipt_model_test.dart b/mobile/test/swarm/swarm_receipt_model_test.dartnew file mode 100644index 000000000..77a724c21--- /dev/null+++ b/mobile/test/swarm/swarm_receipt_model_test.dart@@ -0,0 +1,59 @@+import 'package:flutter_test/flutter_test.dart';+import 'package:harness_mobile/swarm/model.dart';++/// Which recipient's copy a message's receipt speaks of, read as the desktop's+/// model reads it (super_tab_receipt_test): one agent's cancelled copy is not+/// the receipt while another recipient got the message (10-30), and one still+/// waiting keeps the receipt waiting.+void main() {+ Map<String, dynamic> row(String agentId, String status) => {+ 'id': 'delivery-$agentId',+ 'agentId': agentId,+ 'status': status,+ };+ String? receipt(List<Map<String, dynamic>> deliveries) =>+ SuperTabMessage.fromJson({+ 'id': 'm1',+ 'conversationId': 'g1',+ 'text': '@Lead @Builder please start',+ 'sequence': 1,+ 'author': {'kind': 'person', 'id': 'me', 'name': 'tony'},+ 'deliveries': deliveries,+ }).receiptDelivery?.status;++ test('one copy cancelled while another arrived is not the receipt', () {+ for (final arrived in ['delivered', 'confirmed', 'answered']) {+ final rows = [+ row('agent-lead', arrived),+ row('agent-builder', 'cancelled'),+ ];+ expect(receipt(rows), arrived);+ expect(receipt(rows.reversed.toList()), arrived);+ }+ });++ test('every copy cancelled is still the receipt', () {+ expect(receipt([row('agent-builder', 'cancelled')]), 'cancelled');+ });++ test('a copy still waiting keeps the receipt waiting', () {+ expect(+ receipt([row('agent-lead', 'queued'), row('agent-builder', 'cancelled')]),+ 'queued',+ );+ expect(+ receipt([+ row('agent-builder', 'cancelled'),+ row('agent-lead', 'claimed'),+ ]),+ 'claimed',+ );+ expect(+ receipt([+ row('agent-lead', 'answered'),+ row('agent-builder', 'uncertain'),+ ]),+ 'uncertain',+ );+ });+}