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.

fix(desktop): a directly connected computer is not shown offline in a message receipt for lack of a Swarm reading (#1550)

0xken159ed7ad7365e1
diff --git a/desktop/lib/super_tabs/message_receipt.dart b/desktop/lib/super_tabs/message_receipt.dart
index a93bbda0c..006c648dc 100644
--- a/desktop/lib/super_tabs/message_receipt.dart
+++ b/desktop/lib/super_tabs/message_receipt.dart
@@ -122,17 +122,19 @@ class _SuperTabMessageReceiptState extends State<SuperTabMessageReceipt>
: null;
final native = agent == null ? null : widget.app?.stateOf(agent.machineId);
final direct = native?.isLocalMachine == true;
+ // A computer this Desktop reads itself is known by its own connection, not by a Swarm reading it may not have.
final offline =
!c.backendUnreachable &&
- (machine != null || direct) &&
- superTabMachineStatus(
- age: readingAt == null ? null : now.difference(readingAt),
- connected: direct
- ? native!.connectionStatus == ConnectionStatus.connected &&
- !native.isOffline
- : null,
- ) ==
- SuperTabMachineStatus.offline;
+ (direct
+ ? native!.connectionStatus != ConnectionStatus.connected ||
+ native.isOffline
+ : machine != null &&
+ superTabMachineStatus(
+ age: readingAt == null
+ ? null
+ : now.difference(readingAt),
+ ) ==
+ SuperTabMachineStatus.offline);
final working =
delivery?.delivered == true &&
agent != null &&
diff --git a/desktop/test/super_tab_receipt_test.dart b/desktop/test/super_tab_receipt_test.dart
index 23a465aef..f893b0116 100644
--- a/desktop/test/super_tab_receipt_test.dart
+++ b/desktop/test/super_tab_receipt_test.dart
@@ -231,6 +231,35 @@ void main() {
},
);
+ for (final (direct, shown) in [
+ (true, "Lead is busy"),
+ (false, "Lead's computer is offline"),
+ ]) {
+ testWidgets(
+ 'receipt: a held message to a computer with no Swarm reading ${direct ? 'connected directly shows why' : 'read through the Swarm says offline'}',
+ (tester) async {
+ final app = createApp(connected: true);
+ addTearDown(app.dispose);
+ app.stateOf('m')!.localOnly = direct;
+ final f = ReceiptFixture(tester);
+ await f.show(
+ app: app,
+ prepare: () {
+ final machines = f.server.state['machines'] as List;
+ direct ? machines.clear() : machines.first.remove('observation');
+ f.delivery['holdReason'] = 'team_waiting_idle';
+ },
+ );
+ expect(find.textContaining(shown), findsOneWidget);
+ expect(
+ find.textContaining('offline'),
+ direct ? findsNothing : findsWidgets,
+ );
+ await f.close();
+ },
+ );
+ }
+
for (final (label, resolution) in [
('Open terminal', null),
('Send again', 'resend'),