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
Desktop: one offline line over whatever the middle holds; the Tasks pane marks its rows (#4250 finding 7) (#3541)
0xken150dd01c9799a8
diff --git a/desktop/lib/super_tabs/tasks/personal_tasks_pane.dart b/desktop/lib/super_tabs/tasks/personal_tasks_pane.dartindex 54d43125c..7633e16e0 100644--- a/desktop/lib/super_tabs/tasks/personal_tasks_pane.dart+++ b/desktop/lib/super_tabs/tasks/personal_tasks_pane.dart@@ -280,6 +280,20 @@ class _TasksPaneState extends State<SuperTabPersonalTasksPane> {],),),+ // Offline, the rows are what was last read: said once, quietly, until the Swarm answers again.+ if (supported && c.backendUnreachable && snapshot != null)+ Padding(+ padding: const EdgeInsets.symmetric(+ horizontal: AppDesktop.groupGap,+ ),+ child: Text(+ 'May be out of date',+ key: const ValueKey('tasks-stale'),+ style: Theme.of(context).textTheme.bodySmall?.copyWith(+ color: Theme.of(context).colorScheme.onSurfaceVariant,+ ),+ ),+ ),if (_error != null)Padding(padding: const EdgeInsets.symmetric(diff --git a/desktop/lib/super_tabs/view.dart b/desktop/lib/super_tabs/view.dartindex 40f059c51..46545158a 100644--- a/desktop/lib/super_tabs/view.dart+++ b/desktop/lib/super_tabs/view.dart@@ -5113,6 +5113,36 @@ class _SuperTabViewState extends State<SuperTabView>);}+ /// What the Swarm cannot read, with Retry, over whatever the middle holds: a chat, a Board or a page (audit finding 7+ /// of task #4211; it was drawn in the chat column only, so the Board and the pages looked live while offline).+ Widget _connectionLine(SuperTabController c) {+ if (c.error == null) return const SizedBox.shrink();+ return Padding(+ padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 8),+ child: Row(+ children: [+ // A Swarm that was read and now cannot be (a backend or this+ // computer's Harness restarting) keeps what it shows and says+ // so quietly; it reads again by itself (task #2647).+ Expanded(+ child: c.backendUnreachable && c.snapshot != null+ ? Text(+ 'Reconnecting…',+ key: const ValueKey('super-reconnecting'),+ style: DesktopChrome.metadata(),+ )+ : Text(c.error!, style: DesktopChrome.control()),+ ),+ if (!c.accessRevoked)+ TextButton(+ onPressed: () => unawaited(c.retryRead()),+ child: const Text('Retry'),+ ),+ ],+ ),+ );+ }+/// On the web a conversation is read before anything else is drawn/// ([WorkspaceChrome.superTabRecovers]); Desktop keeps "Loading" meanwhile.bool get _readsFirst => WorkspaceChrome.of(context).superTabRecovers;@@ -5542,31 +5572,7 @@ class _SuperTabViewState extends State<SuperTabView>focus: _findFocus,onClose: _closeFind,),- if (c.error != null && !unread)- Padding(- padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 8),- child: Row(- children: [- // A Swarm that was read and now cannot be (a backend or this- // computer's Harness restarting) keeps what it shows and says- // so quietly; it reads again by itself (task #2647).- Expanded(- child: c.backendUnreachable && c.snapshot != null- ? Text(- 'Reconnecting…',- key: const ValueKey('super-reconnecting'),- style: DesktopChrome.metadata(),- )- : Text(c.error!, style: DesktopChrome.control()),- ),- if (!c.accessRevoked)- TextButton(- onPressed: () => unawaited(c.retryRead()),- child: const Text('Retry'),- ),- ],- ),- ),+ if (!unread) _connectionLine(c),if (group != null && decisions != null && !c.isEarlierBuddyChat(group))// The list stops at an edge under the Buddy's line, as it does under// the header: without one, a message scrolled up to the line read as@@ -6482,6 +6488,23 @@ class _SuperTabViewState extends State<SuperTabView>},onClose: _closeRoster,);+ final pagesIndex = boardProject != null+ ? 5+ : _devicesVisible+ ? 1+ : _manageVisible+ ? 4+ : _notificationsVisible+ ? 3+ : c.snapshot?.projects.isEmpty == true+ ? 0+ : _terminalsVisible+ ? 1+ : _showPullRequests+ ? 2+ : _showTasks+ ? 5+ : 0;final view = Focus(canRequestFocus: false,skipTraversal: true,@@ -6550,25 +6573,15 @@ class _SuperTabViewState extends State<SuperTabView>onChoose: _chooseManageTab,),),+ // The chat draws the line itself, and a terminal's chat beside it answers for the terminal's own+ // connection; every other surface in the middle gets it here.+ if (pagesIndex != 0 &&+ !_terminalsVisible &&+ !(_readsFirst && c.snapshot == null))+ _connectionLine(c),Expanded(child: SuperTabPages(- index: boardProject != null- ? 5- : _devicesVisible- ? 1- : _manageVisible- ? 4- : _notificationsVisible- ? 3- : c.snapshot?.projects.isEmpty == true- ? 0- : _terminalsVisible- ? 1- : _showPullRequests- ? 2- : _showTasks- ? 5- : 0,+ index: pagesIndex,children: [chatBeside || boardProject != null? const SizedBox.shrink()diff --git a/desktop/test/super_tab_offline_line_test.dart b/desktop/test/super_tab_offline_line_test.dartnew file mode 100644index 000000000..ca33a7ecf--- /dev/null+++ b/desktop/test/super_tab_offline_line_test.dart@@ -0,0 +1,116 @@+import 'dart:io';++import 'package:flutter/material.dart';+import 'package:flutter_test/flutter_test.dart';+import 'package:harness/shared/theme/app_theme.dart' as grid;+import 'package:harness/super_tabs/view.dart';++import 'super_tab_personal_tasks_pane_test.dart' show TasksFixture;+import 'support/capture.dart';+import 'swarm_state_test.dart' show createApp;++/// Audit finding 7 of task #4211 (task #4250): losing the connection was invisible on the Board, Decisions and the+/// Leaderboard. The app knew ("Could not refresh this conversation") but only a chat showed "Reconnecting… Retry", and+/// the Tasks pane kept its rows as if live. One line, whatever the middle holds; the Tasks pane marks its rows.+final shots = Platform.environment['SUPER_TAB_OFFLINE_SHOTS'];++void main() {+ setUpAll(() => loadCaptureFonts(shots));+ Finder key(String k) => find.byKey(ValueKey(k));++ Future<TasksFixture> mount(WidgetTester tester, Brightness brightness) async {+ await tester.binding.setSurfaceSize(const Size(1500, 800));+ addTearDown(() => tester.binding.setSurfaceSize(null));+ final before = grid.AppTheme.brightness.value;+ grid.AppTheme.brightness.value = brightness;+ addTearDown(() => grid.AppTheme.brightness.value = before);+ final f = TasksFixture();+ addTearDown(f.controller.dispose);+ await f.controller.refresh();+ final app = createApp();+ addTearDown(app.dispose);+ await tester.pumpWidget(+ MaterialApp(+ debugShowCheckedModeBanner: false,+ theme: grid.buildAppTheme(brightness: brightness),+ home: Scaffold(+ body: SuperTabView(+ controller: f.controller,+ app: app,+ onNewSwarm: () {},+ onInvite: () {},+ onAddAgent: (_) {},+ onOpenTerminal: (_) {},+ machineName: (_) => 'Mac Studio',+ board: true,+ ),+ ),+ ),+ );+ await tester.pumpAndSettle();+ return f;+ }++ /// The connection is lost: the next read of the Swarm fails and what was read stays.+ Future<void> goOffline(WidgetTester tester, TasksFixture f) async {+ f.offline = true;+ await tester.runAsync(f.controller.refresh);+ await tester.pump();+ }++ for (final brightness in Brightness.values) {+ for (final page in ['super-decisions', 'super-leaderboard']) {+ testWidgets('${brightness.name}: $page says it is reconnecting, once, '+ 'and Retry reads again', (tester) async {+ final f = await mount(tester, brightness);+ await tester.tap(key(page));+ await tester.pumpAndSettle();+ expect(key('super-reconnecting'), findsNothing);+ await goOffline(tester, f);+ expect(key('super-reconnecting'), findsOneWidget);+ await captureWindow(tester, shots, 'offline-$page-${brightness.name}');+ f.offline = false;+ // The line's own Retry, in the row of the words.+ await tester.tap(+ find.descendant(+ of: find+ .ancestor(+ of: key('super-reconnecting'),+ matching: find.byType(Row),+ )+ .first,+ matching: find.text('Retry'),+ ),+ );+ await tester.runAsync(+ () => Future<void>.delayed(const Duration(milliseconds: 50)),+ );+ await tester.pumpAndSettle();+ expect(key('super-reconnecting'), findsNothing);+ });+ }++ testWidgets('${brightness.name}: a Board and a chat have the line once, '+ 'not twice', (tester) async {+ final f = await mount(tester, brightness);+ await goOffline(tester, f);+ expect(key('super-reconnecting'), findsOneWidget);+ await tester.tap(key('super-board-tab-chat'));+ await tester.pumpAndSettle();+ expect(key('super-reconnecting'), findsOneWidget);+ });++ testWidgets('${brightness.name}: the Tasks pane marks its rows as '+ 'possibly out of date, only while offline', (tester) async {+ final f = await mount(tester, brightness);+ expect(key('tasks-stale'), findsNothing);+ await goOffline(tester, f);+ expect(key('tasks-stale'), findsOneWidget);+ expect(find.text('Task new'), findsOneWidget);+ f.offline = false;+ await tester.runAsync(f.controller.refresh);+ await tester.pump();+ expect(key('tasks-stale'), findsNothing);+ });+ }+}diff --git a/desktop/test/super_tab_personal_tasks_pane_test.dart b/desktop/test/super_tab_personal_tasks_pane_test.dartindex 33481e67b..cd680c4ce 100644--- a/desktop/test/super_tab_personal_tasks_pane_test.dart+++ b/desktop/test/super_tab_personal_tasks_pane_test.dart@@ -25,6 +25,9 @@ class TasksFixture {final store = MemoryKeyValueStore();bool supported = true, fail = false;+ /// Every read of the Swarm fails, as when the backend or this computer's Harness is gone.+ bool offline = false;+/// The server's answer to the next command: refused, as a 4xx.SuperTabFailure? refuse;@@ -51,6 +54,13 @@ class TasksFixture {pollInterval: Duration.zero,save: (value) => store.write('controller', value.toString()),request: (method, path, {body}) async {+ if (offline) {+ throw const SuperTabFailure(+ 'BACKEND_UNREACHABLE',+ 'Could not reach the Harness backend.',+ statusCode: 502,+ );+ }if (path.contains('/messages')) {return {'messages': <dynamic>[], 'next': null};}