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-05 i1710: #3073 #3133 (#3145)

0xken15d908300eaf1e
diff --git a/desktop/lib/super_tabs/personal_machine_rows.dart b/desktop/lib/super_tabs/personal_machine_rows.dart
index fc1ddb876..8d2f77dc1 100644
--- a/desktop/lib/super_tabs/personal_machine_rows.dart
+++ b/desktop/lib/super_tabs/personal_machine_rows.dart
@@ -1,3 +1,5 @@
+import 'dart:async';
+
import 'package:flutter/material.dart';
import '../shared/theme/app_icons.dart';
@@ -7,8 +9,9 @@ import '../widgets/desktop_chrome.dart';
import 'controller.dart';
import 'personal_machines.dart';
-/// The person's own machines still to join their Personal Swarm, each with one
-/// word, and a failure's reason on hover. The list only: the sync is
+/// The person's own machines still to join their Personal Swarm, each saying
+/// why in a few words ("Couldn't join: machine is off"), with Try again and a
+/// failure's whole reason on hover (task #3042). The list only: the sync is
/// [PersonalMachines]', so this can move with the machines' section.
class PersonalMachineRows extends StatelessWidget {
const PersonalMachineRows({
@@ -36,6 +39,13 @@ class PersonalMachineRows extends StatelessWidget {
Widget _row(PersonalMachineRow row) {
final failed = row.reason != null;
+ final machines = PersonalMachines.of(app);
+ final status = Text(
+ row.status,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.metadata(),
+ );
final line = Padding(
padding: const EdgeInsets.symmetric(
horizontal: grid.AppDesktop.panelPadding,
@@ -49,22 +59,44 @@ class PersonalMachineRows extends StatelessWidget {
color: DesktopChrome.muted,
),
const SizedBox(width: grid.AppDesktop.controlGap),
+ // Name and reason as one line, Try again at the row's end.
Expanded(
- child: Text(
- row.name,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: DesktopChrome.text(color: DesktopChrome.muted),
+ child: Row(
+ children: [
+ Flexible(
+ child: Text(
+ row.name,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.text(color: DesktopChrome.muted),
+ ),
+ ),
+ Text(' · ', style: DesktopChrome.metadata()),
+ Flexible(
+ child: failed
+ ? Tooltip(message: row.reason, child: status)
+ : status,
+ ),
+ ],
),
),
- const SizedBox(width: grid.AppDesktop.controlGap),
- Text(row.status, style: DesktopChrome.metadata()),
+ if (row.canRetry) ...[
+ const SizedBox(width: grid.AppDesktop.controlGap),
+ DesktopPill(
+ key: ValueKey('super-personal-machine-retry-${row.machineId}'),
+ label: 'Try again',
+ quiet: true,
+ compact: true,
+ onPressed: () =>
+ unawaited(machines.retry(controller, row.machineId)),
+ ),
+ ],
],
),
);
return KeyedSubtree(
key: ValueKey('super-personal-machine-${row.machineId}'),
- child: failed ? Tooltip(message: row.reason, child: line) : line,
+ child: line,
);
}
}
diff --git a/desktop/lib/super_tabs/personal_machines.dart b/desktop/lib/super_tabs/personal_machines.dart
index 737f637e8..6494c8c5d 100644
--- a/desktop/lib/super_tabs/personal_machines.dart
+++ b/desktop/lib/super_tabs/personal_machines.dart
@@ -5,17 +5,21 @@ import 'package:flutter/foundation.dart';
import '../core/models.dart' show sameMachineId;
import '../state/app_state.dart';
+import '../ws/ws_conn.dart' show WsRequestTimeout;
import 'controller.dart';
import 'machines.dart' show contributeComputer;
import 'personal_projects.dart' show PersonalProjects;
-/// A machine of the person's own not yet in their Personal Swarm: why, in one
-/// word, and the [reason] behind a failure, for its hover.
+/// A machine of the person's own not yet in their Personal Swarm: why, in a
+/// few words ("Couldn't join: machine is off"), the whole [reason] behind a
+/// failure for its hover, and whether Try again can ask it now ([canRetry]:
+/// not while it is being asked).
typedef PersonalMachineRow = ({
String machineId,
String name,
String status,
String? reason,
+ bool canRetry,
});
/// The person's own machines in their Personal Swarm, per app (Dee,
@@ -35,6 +39,11 @@ class PersonalMachines extends ChangeNotifier {
final AppNotifier app;
+ /// What Try again on a machine that is off runs first: the machine list read
+ /// again and their connections retried, so one just woken is seen on.
+ @visibleForTesting
+ late Future<void> Function() reconnect = app.retryMachines;
+
/// The longest wait before a failed machine is asked again.
static const maxRetryWait = Duration(minutes: 5);
@@ -43,6 +52,8 @@ class PersonalMachines extends ChangeNotifier {
final _failures = <String, int>{};
final _retryAt = <String, DateTime>{};
final _reasons = <String, String>{};
+ final _words = <String, String?>{};
+ final _asking = <String>{};
bool _inSwarm(SuperTabController c, String machineId) =>
(c.snapshot?.machines ?? const <Map<String, dynamic>>[]).any(
@@ -74,19 +85,86 @@ class PersonalMachines extends ChangeNotifier {
return [
for (final m in _own)
if (!_inSwarm(c, m.machine.machineId) && !_left(c, m.machine.machineId))
- (
- machineId: m.machine.machineId,
- name: m.machine.displayName,
- status: m.isOffline
- ? 'Offline'
- : _reasons.containsKey(_key(c, m.machine.machineId))
- ? "Couldn't add"
- : 'Adding',
- reason: m.isOffline ? null : _reasons[_key(c, m.machine.machineId)],
- ),
+ _row(c, m),
];
}
+ PersonalMachineRow _row(SuperTabController c, MachineState m) {
+ final key = _key(c, m.machine.machineId);
+ final failure = _reasons[key];
+ final asking = _asking.contains(key);
+ final words = m.isOffline
+ ? 'machine is off'
+ : failure == null
+ ? null
+ : _words[key];
+ return (
+ machineId: m.machine.machineId,
+ name: m.machine.displayName,
+ status: asking || (!m.isOffline && failure == null)
+ ? 'Adding'
+ : words == null
+ ? "Couldn't join"
+ : "Couldn't join: $words",
+ reason: asking || m.isOffline ? null : failure,
+ canRetry: !asking && (m.isOffline || failure != null),
+ );
+ }
+
+ /// Why [failure] kept a machine out, in a few words, as its row says it
+ /// after "Couldn't join:"; null when no few words say it better than its
+ /// whole message.
+ @visibleForTesting
+ static String? fewWords(Object failure) {
+ if (failure is TimeoutException || failure is WsRequestTimeout) {
+ return 'not answering';
+ }
+ if (failure is! SuperTabFailure) return null;
+ final message = failure.message.toLowerCase();
+ return switch (failure.code) {
+ _
+ when failure.code == 'SIGNED_OUT' ||
+ failure.statusCode == 401 ||
+ message.contains('not signed in') =>
+ 'not signed in to Harness',
+ _ when failure.code == 'UPDATE_REQUIRED' || failure.statusCode == 426 =>
+ 'needs a Harness update',
+ 'NO_SWARM_ENGINE' => 'no Claude Code or Codex',
+ 'MACHINE_SLOW' => 'not answering',
+ 'SETUP_PENDING' => 'still setting up',
+ 'MACHINE_UNAVAILABLE' when message.contains('offline') =>
+ 'machine is off',
+ _ => null,
+ };
+ }
+
+ /// Try again on [machineId]'s row: asks it again now, whatever its wait,
+ /// once however often it is pressed. One that is off has the machines
+ /// reconnected first. Never one the person took out, or one already in.
+ Future<void> retry(SuperTabController c, String machineId) async {
+ if (!_mayAdd(c) || _inSwarm(c, machineId) || _left(c, machineId)) return;
+ final key = _key(c, machineId);
+ if (_asking.contains(key)) return;
+ final m = _own
+ .where((m) => sameMachineId(m.machine.machineId, machineId))
+ .firstOrNull;
+ if (m == null) return;
+ _retryAt.remove(key);
+ if (m.isOffline) {
+ _asking.add(key);
+ notifyListeners();
+ try {
+ await reconnect();
+ } catch (_) {
+ // Still off: its row says so again.
+ } finally {
+ _asking.remove(key);
+ notifyListeners();
+ }
+ }
+ await sync(c);
+ }
+
String _key(SuperTabController c, String machineId) =>
'${c.accountId}/${c.tabId}/$machineId';
@@ -142,6 +220,8 @@ class PersonalMachines extends ChangeNotifier {
bool Function() alive,
) async {
final key = _key(c, machineId);
+ _asking.add(key);
+ notifyListeners();
try {
final added = await contributeComputer(
c,
@@ -162,6 +242,7 @@ class PersonalMachines extends ChangeNotifier {
_failures.remove(key);
_retryAt.remove(key);
_reasons.remove(key);
+ _words.remove(key);
} catch (failure) {
if (!alive()) return;
final count = _failures[key] = (_failures[key] ?? 0) + 1;
@@ -172,6 +253,9 @@ class PersonalMachines extends ChangeNotifier {
_reasons[key] = failure is SuperTabFailure
? failure.message
: 'Could not add this machine.';
+ _words[key] = fewWords(failure);
+ } finally {
+ _asking.remove(key);
}
}
}
diff --git a/desktop/lib/super_tabs/personal_projects.dart b/desktop/lib/super_tabs/personal_projects.dart
index ac4b82e32..c97bb420c 100644
--- a/desktop/lib/super_tabs/personal_projects.dart
+++ b/desktop/lib/super_tabs/personal_projects.dart
@@ -243,6 +243,57 @@ class PersonalProjects extends ChangeNotifier {
];
}
+ /// Whether project [projectId] of [c] leaves the project list (Huy, 11-05,
+ /// task #3042): one made for the person's panes, with none of them open
+ /// now. Nothing about it changes on the server, so its chat is there when a
+ /// pane of it opens again. Never while a machine holding one of their panes
+ /// has not said what runs there yet: that pane may be this project's.
+ bool hidden(SuperTabController c, String projectId) =>
+ hiddenIn(c).contains(projectId);
+
+ /// Every project of [c] that leaves the project list now ([hidden]), in
+ /// one walk of the person's panes, so the list asks once per draw, not once
+ /// per row (ENGINEERING §4, review of #3073): a project made for panes
+ /// whose repos have none of them open, the same answer as [panesFor] being
+ /// empty for it.
+ Set<String> hiddenIn(SuperTabController c) {
+ if (!eligible(c)) return const {};
+ final known = _known[c.accountId]?[c.tabId];
+ if (known == null || known.isEmpty || _unresolvedPanes(app)) {
+ return const {};
+ }
+ final shown = {for (final entry in personalPanes(app)) ?known[entry.repo]};
+ final snapshot = c.snapshot!;
+ return {
+ for (final id in known.values)
+ if (id != null &&
+ !shown.contains(id) &&
+ snapshot.projectById(id) != null)
+ id,
+ };
+ }
+
+ /// A pane of the person's on a machine that has not listed its agents yet.
+ static bool _unresolvedPanes(AppNotifier app) {
+ for (final tab in app.swarms) {
+ if (tab.isSuperTab || tab.isUtility) continue;
+ for (final pane in tab.panes) {
+ if (pane.agentId == null || pane.isViewer) continue;
+ final machine = app.stateOf(pane.machineId);
+ if (machine == null ||
+ machine.belongsToOtherAccount ||
+ machine.machine.isTeamAccount) {
+ continue;
+ }
+ if (!machine.agentsListedOnce &&
+ machine.agentLoadStatus != AgentLoadStatus.loaded) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
/// The tab all of [panes] come from, when they are exactly its panes: its
/// split sizes are theirs.
Swarm? soleTab(List<TerminalPane> panes) {
diff --git a/desktop/lib/super_tabs/project_options.dart b/desktop/lib/super_tabs/project_options.dart
index ffcb7c09d..cf23f0685 100644
--- a/desktop/lib/super_tabs/project_options.dart
+++ b/desktop/lib/super_tabs/project_options.dart
@@ -79,13 +79,25 @@ Future<void> _showProjectDetails(
),
);
+/// One row of Project settings: its [label], its current [value] when known
+/// (task #3194), what it does, and whether it is the destructive one.
+typedef ProjectSettingsRow = ({
+ String label,
+ String? value,
+ VoidCallback action,
+ bool danger,
+});
+
/// The project menu's Project settings… (Quiet Swarm, screen 9): the rows the
-/// reader may use, each closing the dialog and then doing its work.
+/// reader may use, each closing the dialog and then doing its work. Under the
+/// title, the project and its Swarm; each row's current value on the right in
+/// the quieter metadata role; a destructive row in the theme's error ink,
+/// below a rule, as a menu sets one apart (task #3194).
Future<void> showProjectSettings(
BuildContext context,
SuperTabController c,
SuperTabProject project,
- List<(String, VoidCallback)> rows, {
+ List<ProjectSettingsRow> rows, {
double rowHeight = 32,
}) => showAppDialog<void>(
context: context,
@@ -95,21 +107,54 @@ Future<void> showProjectSettings(
requireWrite: false,
child: SuperTabDetailDialog(
title: 'Project settings',
+ detail: [project.name, ?c.snapshot?.name].join(' · '),
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
- for (final (label, action) in rows)
+ for (final (i, row) in rows.indexed) ...[
+ if (row.danger && i > 0)
+ Divider(
+ key: const ValueKey('super-project-setting-danger-rule'),
+ height: _gap,
+ thickness: 1,
+ color: grid.AppPalette.divider,
+ ),
InkWell(
+ key: ValueKey('super-project-setting-${row.label}'),
onTap: () {
Navigator.of(context).pop();
- action();
+ row.action();
},
child: Container(
constraints: BoxConstraints(minHeight: rowHeight),
alignment: Alignment.centerLeft,
- child: Text(label, style: DesktopChrome.control()),
+ child: Row(
+ children: [
+ Text(
+ row.label,
+ style: DesktopChrome.control(
+ color: row.danger
+ ? Theme.of(context).colorScheme.error
+ : null,
+ ),
+ ),
+ if (row.value case final value?) ...[
+ const SizedBox(width: _gap),
+ Expanded(
+ child: Text(
+ value,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ textAlign: TextAlign.end,
+ style: DesktopChrome.metadata(),
+ ),
+ ),
+ ],
+ ],
+ ),
),
),
+ ],
],
),
),
diff --git a/desktop/lib/super_tabs/project_sidebar.dart b/desktop/lib/super_tabs/project_sidebar.dart
index 80ed59e32..54cec3aff 100644
--- a/desktop/lib/super_tabs/project_sidebar.dart
+++ b/desktop/lib/super_tabs/project_sidebar.dart
@@ -17,6 +17,7 @@ import 'attention.dart';
import 'controller.dart';
import 'buddies.dart';
import 'model.dart';
+import 'personal_projects.dart' show PersonalProjects;
import 'places.dart';
import 'buddy_rows.dart';
import 'section_heading.dart';
@@ -631,26 +632,43 @@ class ProjectSidebar extends StatelessWidget {
controller.unreadShown(group) ||
(attention?.mentionsIn(group.id) ?? 0) > 0;
+ /// A Personal project whose panes are all closed (personal_projects.dart
+ /// `hidden`, task #3042), unless its chat is the one open now, as the
+ /// unread filter keeps it.
+ /// [hidden] is worked out once per draw (`superTabHiddenProjects`).
+ bool _paneless(
+ SuperTabProject project,
+ SuperTabConversation chat,
+ Set<String> hidden,
+ ) =>
+ (_paneCovered || controller.selectedId != chat.id) &&
+ hidden.contains(project.id);
+
/// Every project with its workgroups, by name from A to Z. The round dial
- /// swipes projects in this order (cli superTabs/cards.ts `leadsOf`): the
- /// two must match.
+ /// swipes projects in this order (cli superTabs/cards.ts `leadsOf`); a
+ /// Personal project whose panes are all closed leaves this list but stays
+ /// on the dial (task #3042: the brief is the project list).
List<(String, Widget)> _channels(
SuperTabSnapshot? snapshot,
_SidebarReading reading,
- ) => [
- for (final project in snapshot?.projects ?? const <SuperTabProject>[])
- if (reading.of(project) case final read
- when read.lead != null &&
- (!controller.unreadOnly || _hasUnread(read)))
- (
- project.name,
- Column(
- key: ValueKey('super-project-${project.id}'),
- mainAxisSize: MainAxisSize.min,
- children: [_row(read.lead!, reading: read)],
+ ) {
+ final hidden = superTabHiddenProjects(controller, app: app);
+ return [
+ for (final project in snapshot?.projects ?? const <SuperTabProject>[])
+ if (reading.of(project) case final read
+ when read.lead != null &&
+ (!controller.unreadOnly || _hasUnread(read)) &&
+ !_paneless(project, read.lead!, hidden))
+ (
+ project.name,
+ Column(
+ key: ValueKey('super-project-${project.id}'),
+ mainAxisSize: MainAxisSize.min,
+ children: [_row(read.lead!, reading: read)],
+ ),
),
- ),
- ]..sort((a, b) => a.$1.toLowerCase().compareTo(b.$1.toLowerCase()));
+ ]..sort((a, b) => a.$1.toLowerCase().compareTo(b.$1.toLowerCase()));
+ }
// The sidebar's ink scope (#3006): a theme's own sidebar ink reaches the
// shared rows drawn in it.
@@ -933,21 +951,36 @@ class _ProjectReading {
/// under Projects), each project's chat from A to Z, then the reader's
/// project Buddy chats. Tasks are in each project's Tasks view, not here
/// (task #2569). The round dial swipes projects in this A to Z order too (cli
-/// superTabs/cards.ts `leadsOf`): the two must match.
-List<String> superTabSidebarOrder(SuperTabController controller) {
+/// superTabs/cards.ts `leadsOf`), less the Personal projects this list hides
+/// (task #3042).
+List<String> superTabSidebarOrder(
+ SuperTabController controller, {
+ AppNotifier? app,
+}) {
final snapshot = controller.snapshot;
if (snapshot == null) return const [];
final projects = [...snapshot.projects]
..sort((a, b) => a.name.toLowerCase().compareTo(b.name.toLowerCase()));
+ final hidden = superTabHiddenProjects(controller, app: app);
return [
if (controller.oneBuddy)
if (controller.buddyChat(SuperTabController.kSwarmBuddyKey)
case final chat?)
chat.id,
for (final project in projects)
- if (snapshot.conversation(project.leadConversationId) != null)
+ if (snapshot.conversation(project.leadConversationId) != null &&
+ (controller.selectedId == project.leadConversationId ||
+ !hidden.contains(project.id)))
project.leadConversationId,
for (final project in projects)
if (controller.buddyChat(project.id) case final chat?) chat.id,
];
}
+
+/// The projects the list leaves out: Personal projects of the person's whose
+/// panes are all closed (personal_projects.dart, task #3042), worked out in
+/// one pass. None without the app, which holds the panes.
+Set<String> superTabHiddenProjects(
+ SuperTabController controller, {
+ AppNotifier? app,
+}) => app == null ? const {} : PersonalProjects.of(app).hiddenIn(controller);
diff --git a/desktop/lib/super_tabs/view.dart b/desktop/lib/super_tabs/view.dart
index 0c4d10429..62c9f0cae 100644
--- a/desktop/lib/super_tabs/view.dart
+++ b/desktop/lib/super_tabs/view.dart
@@ -919,7 +919,7 @@ class _SuperTabViewState extends State<SuperTabView>
bool _jumpUnread(int step) {
final snapshot = c.snapshot;
if (snapshot == null || c.accessRevoked) return false;
- final order = superTabSidebarOrder(c);
+ final order = superTabSidebarOrder(c, app: widget.app);
var at = order.indexOf(c.selectedId);
if (at < 0) at = step > 0 ? -1 : order.length;
for (var i = at + step; i >= 0 && i < order.length; i += step) {
@@ -3826,17 +3826,55 @@ class _SuperTabViewState extends State<SuperTabView>
final editable = c.canWrite && !c.saving && !c.hasPendingAction;
final owner = project.ownerId == c.accountId;
void act(String action) => unawaited(_groupAction(action, group));
+ ProjectSettingsRow row(
+ String label,
+ String action, {
+ String? value,
+ bool danger = false,
+ }) =>
+ (label: label, value: value, action: () => act(action), danger: danger);
+ // Each value from what is held already, in Project details' own words
+ // (task #3194); Archived only once its list is read to the end, so the
+ // dialog starts no read.
+ final repository = project.repository;
+ final leadId = c.snapshot?.conversation(project.leadConversationId)?.leadId;
+ final archived =
+ c.dormantLoaded(project.id) && !c.hasEarlierDormant(project.id)
+ ? c.snapshot?.conversations
+ .where((g) => g.archived && g.projectId == project.id)
+ .length
+ : null;
return showProjectSettings(context, c, project, [
- if (editable && owner) ('Rename project', () => act('rename')),
- ('Project details', () => act('details')),
+ if (editable && owner)
+ row('Rename project', 'rename', value: project.name),
+ row(
+ 'Project details',
+ 'details',
+ value:
+ repository?['repositoryUrl'] as String? ??
+ repository?['cwd'] as String? ??
+ 'Not set',
+ ),
// While the PM has a switch under way, there is nothing to ask for.
if (editable &&
c.snapshot?.maySwitchLead(project.id, c.accountId) == true &&
c.snapshot?.leadOf(project.id)?.switchRequest == null)
- ('Switch PM…', () => act('switch-pm')),
+ row(
+ 'Switch PM…',
+ 'switch-pm',
+ value: leadId == null ? 'Starting…' : c.snapshot!.agentName(leadId),
+ ),
if (_mayHaveArchived(group.projectId))
- ('Archived conversations', () => act('archived')),
- if (editable && owner) ('Delete Project', () => act('delete')),
+ row(
+ 'Archived conversations',
+ 'archived',
+ value: switch (archived) {
+ null || 0 => null,
+ 1 => '1 conversation',
+ final n => '$n conversations',
+ },
+ ),
+ if (editable && owner) row('Delete Project', 'delete', danger: true),
], rowHeight: _phone ? kFingerTarget : 32);
}
diff --git a/desktop/test/screenshots/project-settings/project-settings-dark.png b/desktop/test/screenshots/project-settings/project-settings-dark.png
new file mode 100644
index 000000000..1c9d80c80
Binary files /dev/null and b/desktop/test/screenshots/project-settings/project-settings-dark.png differ
diff --git a/desktop/test/screenshots/project-settings/project-settings-light.png b/desktop/test/screenshots/project-settings/project-settings-light.png
new file mode 100644
index 000000000..0bc390d13
Binary files /dev/null and b/desktop/test/screenshots/project-settings/project-settings-light.png differ
diff --git a/desktop/test/super_tab_personal_projects_test.dart b/desktop/test/super_tab_personal_projects_test.dart
index f6784b6bd..547a3dabd 100644
--- a/desktop/test/super_tab_personal_projects_test.dart
+++ b/desktop/test/super_tab_personal_projects_test.dart
@@ -11,7 +11,9 @@ import 'package:harness/state/app_state.dart';
import 'package:harness/state/swarm.dart';
import 'package:harness/state/terminal_pane.dart';
import 'package:harness/super_tabs/controller.dart';
+import 'package:harness/super_tabs/model.dart';
import 'package:harness/super_tabs/personal_projects.dart';
+import 'package:harness/super_tabs/project_sidebar.dart';
import 'package:harness/super_tabs/swarm_switcher.dart';
import 'package:harness/super_tabs/workspace.dart';
import 'package:harness/widgets/pane_grid.dart';
@@ -227,6 +229,69 @@ void main() {
}, variant: TargetPlatformVariant.only(TargetPlatform.macOS));
}
+ for (final brightness in Brightness.values) {
+ testWidgets('pictures of a Personal project leaving the list once its '
+ 'panes close (task #3042), in ${brightness.name}', (tester) async {
+ if (_shots == null) return;
+ final previous = grid.AppTheme.brightness.value;
+ grid.AppTheme.brightness.value = brightness;
+ addTearDown(() => grid.AppTheme.brightness.value = previous);
+ tester.view.devicePixelRatio = 2;
+ tester.view.physicalSize = const Size(2560, 1440);
+ addTearDown(tester.view.reset);
+ final f = SuperTabLaunchFixture();
+ final p = _desk(f);
+ final c = await _personal(f);
+ await PersonalProjects.of(f.app).sync(c);
+ c.select(
+ c.snapshot!.projects
+ .firstWhere((p) => p.name == 'web')
+ .leadConversationId,
+ );
+ await tester.pumpWidget(
+ MaterialApp(
+ debugShowCheckedModeBanner: false,
+ theme: grid.buildAppTheme(brightness: brightness),
+ home: Scaffold(
+ body: ListenableBuilder(
+ listenable: f.app,
+ builder: (_, _) => SuperTabWorkspace(
+ app: f.app,
+ canvas: PaneGrid(notifier: f.app, swarmMode: true),
+ onAddAgent: (_) {},
+ onNewProject: () {},
+ onNewSwarm: () {},
+ ),
+ ),
+ ),
+ ),
+ );
+ for (var i = 0; i < 10; i++) {
+ await tester.pump(const Duration(milliseconds: 20));
+ }
+ await captureWindow(
+ tester,
+ _shots,
+ 'personal-panes-open-${brightness.name}',
+ );
+ f.app.swarms.firstWhere((s) => s.id == 'one').panes.remove(p.api);
+ f.app.swarms.firstWhere((s) => s.id == 'two').panes.remove(p.api2);
+ f.app.notifyListeners();
+ for (var i = 0; i < 10; i++) {
+ await tester.pump(const Duration(milliseconds: 20));
+ }
+ await captureWindow(
+ tester,
+ _shots,
+ 'personal-panes-closed-${brightness.name}',
+ );
+ await tester.pumpWidget(const SizedBox());
+ await c.flush();
+ f.app.superTabs.dispose();
+ await tester.pump();
+ }, variant: TargetPlatformVariant.only(TargetPlatform.macOS));
+ }
+
group('a repo is one string on every computer', () {
test('ssh, https, case, user, port and .git are the same repo', () {
const forms = [
@@ -1168,6 +1233,204 @@ void main() {
});
});
+ // Huy, 11-05 (task #3042): every pane of a repo or tab closed, its project
+ // leaves the list; its chat stays; a pane of it opening brings it back.
+ group('a project with no panes leaves the list', () {
+ SuperTabProject named(SuperTabController c, String name) =>
+ c.snapshot!.projects.firstWhere((p) => p.name == name);
+
+ List<Map<String, dynamic>> removals(SuperTabLaunchFixture f) => [
+ for (final post in f.connection.server.posts)
+ if ((post['command'] as Map?)?['type'] case final String type
+ when type.contains('delete') || type.contains('archive'))
+ Map<String, dynamic>.from(post),
+ ];
+
+ test('closing every pane of a repo hides its project, and a pane of it '
+ 'opening shows it again with its chat', () async {
+ final f = SuperTabLaunchFixture();
+ final p = _desk(f);
+ final c = await _personal(f);
+ final projects = PersonalProjects.of(f.app);
+ await projects.sync(c);
+ final api = named(c, 'api'), web = named(c, 'web');
+ expect(projects.hidden(c, api.id), isFalse);
+
+ final one = f.app.swarms.firstWhere((s) => s.id == 'one');
+ final two = f.app.swarms.firstWhere((s) => s.id == 'two');
+ one.panes.remove(p.api);
+ // One of its panes is still open, on the laptop.
+ expect(projects.hidden(c, api.id), isFalse);
+ two.panes.remove(p.api2);
+ expect(projects.hidden(c, api.id), isTrue);
+ expect(projects.hidden(c, web.id), isFalse);
+ expect(projects.hidden(c, named(c, 'one').id), isFalse);
+
+ // Its chat is kept: nothing was deleted or archived on the server.
+ expect(removals(f), isEmpty);
+ expect(c.snapshot!.conversation(api.leadConversationId), isNotNull);
+
+ two.panes.add(p.api2);
+ expect(projects.hidden(c, api.id), isFalse);
+ expect(projects.panesFor(c, api.leadConversationId), [p.api2]);
+ });
+
+ test('the list works out every hidden project in one pass, with the same '
+ 'answer as asking each (review of #3073)', () async {
+ final f = SuperTabLaunchFixture();
+ final p = _desk(f);
+ final c = await _personal(f);
+ final projects = PersonalProjects.of(f.app);
+ await projects.sync(c);
+ final api = named(c, 'api');
+ expect(projects.hiddenIn(c), isEmpty);
+ f.app.swarms.firstWhere((s) => s.id == 'one').panes.remove(p.api);
+ f.app.swarms.firstWhere((s) => s.id == 'two').panes.remove(p.api2);
+ expect(projects.hiddenIn(c), {api.id});
+ for (final project in c.snapshot!.projects) {
+ expect(
+ projects.hidden(c, project.id),
+ projects.hiddenIn(c).contains(project.id),
+ reason: project.name,
+ );
+ }
+ // A machine with one of the panes not listed yet: nothing hides.
+ f.app.machineStates['m']!
+ ..agentsListedOnce = false
+ ..agentLoadStatus = AgentLoadStatus.loading;
+ expect(projects.hiddenIn(c), isEmpty);
+ });
+
+ test(
+ 'a tab\'s project hides once its panes with no repo are closed',
+ () async {
+ final f = SuperTabLaunchFixture();
+ final p = _huyDesk(f);
+ final c = await _personal(f);
+ final projects = PersonalProjects.of(f.app);
+ await projects.sync(c);
+ final code = named(c, 'code');
+ f.app.swarms.firstWhere((s) => s.id == 'desk-code').panes
+ ..remove(p.a1)
+ ..remove(p.a2);
+ expect(projects.hidden(c, code.id), isTrue);
+ expect(projects.hidden(c, named(c, 'Harness Monitor').id), isFalse);
+ },
+ );
+
+ test('nothing hides while a machine with one of the panes has not listed '
+ 'its agents yet', () async {
+ final f = SuperTabLaunchFixture();
+ final p = _desk(f);
+ final c = await _personal(f);
+ final projects = PersonalProjects.of(f.app);
+ await projects.sync(c);
+ final api = named(c, 'api');
+ f.app.swarms.firstWhere((s) => s.id == 'one').panes.remove(p.api);
+ // The laptop just came back and has not said what runs there: its
+ // pane may well be the api's.
+ f.app.machineStates['laptop']!
+ ..agents = const []
+ ..agentsListedOnce = false
+ ..agentLoadStatus = AgentLoadStatus.loading;
+ expect(projects.hidden(c, api.id), isFalse);
+ f.app.machineStates['laptop']!
+ ..agents = [_agent('n1', remote: 'https://github.com/acme/api')]
+ ..agentsListedOnce = true
+ ..agentLoadStatus = AgentLoadStatus.loaded;
+ expect(projects.hidden(c, api.id), isFalse);
+ f.app.swarms.firstWhere((s) => s.id == 'two').panes.remove(p.api2);
+ expect(projects.hidden(c, api.id), isTrue);
+ });
+
+ test('a project made by hand, and any project of a Team Swarm, never '
+ 'hides', () async {
+ final f = SuperTabLaunchFixture();
+ _desk(f);
+ final c = await _personal(f);
+ final projects = PersonalProjects.of(f.app);
+ await projects.sync(c);
+ f.app.swarms.removeWhere((s) => s.id == 'one' || s.id == 'two');
+ expect(projects.hidden(c, named(c, 'api').id), isTrue);
+ final byHand = c.snapshot!.projects
+ .firstWhere((p) => p.leadConversationId == 'lead')
+ .id;
+ expect(projects.hidden(c, byHand), isFalse);
+
+ final team = SuperTabLaunchFixture();
+ _desk(team);
+ final tc = await _personal(team, people: const ['owner', 'kim']);
+ expect(PersonalProjects.of(team.app).hidden(tc, byHand), isFalse);
+ });
+
+ testWidgets('the list leaves it out, but keeps it while its chat is open', (
+ tester,
+ ) async {
+ await tester.binding.setSurfaceSize(const Size(1280, 800));
+ addTearDown(() => tester.binding.setSurfaceSize(null));
+ final f = SuperTabLaunchFixture();
+ final p = _desk(f);
+ final c = await _personal(f);
+ await PersonalProjects.of(f.app).sync(c);
+ final api = named(c, 'api'), web = named(c, 'web');
+ final redraw = ValueNotifier(0);
+ addTearDown(redraw.dispose);
+ await tester.pumpWidget(
+ MaterialApp(
+ home: Scaffold(
+ body: ListenableBuilder(
+ listenable: Listenable.merge([f.app, c, redraw]),
+ builder: (_, _) => SizedBox(
+ width: 260,
+ child: ProjectSidebar(
+ controller: c,
+ app: f.app,
+ onSelect: c.select,
+ ),
+ ),
+ ),
+ ),
+ ),
+ );
+ await tester.pump();
+ Finder row(SuperTabProject project) =>
+ find.byKey(ValueKey('super-project-${project.id}'));
+ expect(row(api), findsOneWidget);
+
+ c.select(api.leadConversationId);
+ f.app.swarms.firstWhere((s) => s.id == 'one').panes.remove(p.api);
+ f.app.swarms.firstWhere((s) => s.id == 'two').panes.remove(p.api2);
+ redraw.value++;
+ await tester.pump();
+ // Open now: it stays until the person goes elsewhere.
+ expect(row(api), findsOneWidget);
+
+ c.select(web.leadConversationId);
+ redraw.value++;
+ await tester.pump();
+ expect(row(api), findsNothing);
+ expect(row(web), findsOneWidget);
+ expect(
+ superTabSidebarOrder(c, app: f.app),
+ isNot(contains(api.leadConversationId)),
+ );
+
+ f.app.swarms.firstWhere((s) => s.id == 'two').panes.add(p.api2);
+ redraw.value++;
+ await tester.pump();
+ expect(row(api), findsOneWidget);
+ expect(
+ superTabSidebarOrder(c, app: f.app),
+ contains(api.leadConversationId),
+ );
+
+ await tester.pumpWidget(const SizedBox());
+ await c.flush();
+ f.app.superTabs.dispose();
+ await tester.pump();
+ });
+ });
+
group('[term]', () {
testWidgets(
'shows the very panes the tabs hold, and the tabs stay as they are',
diff --git a/desktop/test/super_tab_personal_sidebar_bench_test.dart b/desktop/test/super_tab_personal_sidebar_bench_test.dart
new file mode 100644
index 000000000..d8bd4dec1
--- /dev/null
+++ b/desktop/test/super_tab_personal_sidebar_bench_test.dart
@@ -0,0 +1,187 @@
+import 'dart:io';
+
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/core/models.dart';
+import 'package:harness/state/app_state.dart';
+import 'package:harness/state/swarm.dart';
+import 'package:harness/state/terminal_pane.dart';
+import 'package:harness/super_tabs/personal_projects.dart';
+import 'package:harness/super_tabs/project_sidebar.dart';
+import 'package:harness/super_tabs/swarm_switcher.dart';
+
+import 'super_tab_launch_test.dart' show SuperTabLaunchFixture, tabId;
+
+/// The project list's draw time on a big desk of the person's (ENGINEERING
+/// §4, review of #3073): [_repos] repos with [_panesPerRepo] panes each across
+/// two Macs, every pane open, so the list shows the same rows before and
+/// after and the hidden check does its whole walk. Runs only with
+/// PERSONAL_SIDEBAR_BENCH set; prints the median and p95 of [_draws] draws.
+const _repos = 60, _panesPerRepo = 4, _draws = 400;
+final _bench = Platform.environment['PERSONAL_SIDEBAR_BENCH'] != null;
+
+void main() {
+ testWidgets('the project list draws as fast with hiding as without', (
+ tester,
+ ) async {
+ if (!_bench) return;
+ await tester.binding.setSurfaceSize(const Size(1280, 4000));
+ addTearDown(() => tester.binding.setSurfaceSize(null));
+ final f = SuperTabLaunchFixture();
+ final laptop = Machine(
+ machineId: 'laptop',
+ authMode: MachineAuthMode.remote,
+ name: 'Mac laptop',
+ );
+ f.app.machines = [...f.app.machines, laptop];
+ f.app.machineStates['laptop'] = MachineState(laptop)
+ ..nodeOnline = true
+ ..agentLoadStatus = AgentLoadStatus.loaded;
+ var paneId = 20000;
+ for (final machine in ['m', 'laptop']) {
+ f.app.machineStates[machine]!.agents = [
+ for (var r = 0; r < _repos; r++)
+ for (var i = 0; i < _panesPerRepo ~/ 2; i++)
+ Agent(
+ id: '$machine-$r-$i',
+ name: 'Agent $r $i',
+ engine: 'codex',
+ terminalAvailable: true,
+ project: AgentProject(
+ name: 'repo$r',
+ cwd: '/w/repo$r',
+ root: '/w/repo$r',
+ remote: 'https://github.com/acme/repo$r',
+ ),
+ ),
+ ];
+ }
+ for (var r = 0; r < _repos; r++) {
+ f.app.swarms.add(
+ Swarm(id: 'tab$r', name: 'tab$r')
+ ..panes.addAll([
+ for (final machine in ['m', 'laptop'])
+ for (var i = 0; i < _panesPerRepo ~/ 2; i++)
+ TerminalPane(
+ id: paneId++,
+ machineId: machine,
+ agentId: '$machine-$r-$i',
+ ),
+ ]),
+ );
+ }
+ for (final state in f.app.machineStates.values) {
+ state.localOnly = true;
+ }
+ f.connection.server.state
+ ..['name'] = 'Personal'
+ ..['ownerId'] = 'owner'
+ ..['people'] = [
+ {'id': 'owner', 'email': '[email protected]', 'role': 'owner'},
+ ];
+ late final List<int> times;
+ await tester.runAsync(() async {
+ await f.app.superTabs.storage.write('super_tab.personal.owner', tabId);
+ f.app.bindSuperTab(f.app.activeSwarmId, tabId, 'Personal');
+ PersonalSwarm.of(f.app).id;
+ for (var i = 0; i < 20; i++) {
+ await Future<void>.microtask(() {});
+ }
+ });
+ final c = (await tester.runAsync(() async {
+ final c = await f.app.superTabs.open(tabId);
+ await c.refresh();
+ await PersonalProjects.of(f.app).sync(c);
+ await c.refresh();
+ return c;
+ }))!;
+ final redraw = ValueNotifier(0);
+ addTearDown(redraw.dispose);
+ await tester.pumpWidget(
+ MaterialApp(
+ home: Scaffold(
+ body: ListenableBuilder(
+ listenable: redraw,
+ builder: (_, _) => SizedBox(
+ width: 260,
+ child: ProjectSidebar(
+ controller: c,
+ app: f.app,
+ onSelect: (_) {},
+ ),
+ ),
+ ),
+ ),
+ ),
+ );
+ await tester.pump();
+ final rows = find.byWidgetPredicate(
+ (w) =>
+ w.key is ValueKey<String> &&
+ (w.key! as ValueKey<String>).value.startsWith('super-project-'),
+ );
+ final listed = rows.evaluate().length;
+ times = [];
+ final watch = Stopwatch();
+ for (var i = 0; i < _draws; i++) {
+ redraw.value++;
+ watch
+ ..reset()
+ ..start();
+ await tester.pump();
+ watch.stop();
+ times.add(watch.elapsedMicroseconds);
+ }
+ times.sort();
+ final median = times[times.length ~/ 2];
+ // What hiding adds to each draw, timed apart from the draw so a loaded
+ // machine moves both alike: the per-row walk the first version did (each
+ // project asks for its panes) against the one pass the list makes now.
+ final projects = PersonalProjects.of(f.app);
+ final leads = [
+ for (final project in c.snapshot!.projects) project.leadConversationId,
+ ];
+ int perRow() {
+ var hidden = 0;
+ for (final lead in leads) {
+ if (projects.panesFor(c, lead).isEmpty) hidden++;
+ }
+ return hidden;
+ }
+
+ final rowTimes = <int>[], passTimes = <int>[];
+ for (var i = 0; i < _draws; i++) {
+ watch
+ ..reset()
+ ..start();
+ perRow();
+ watch.stop();
+ rowTimes.add(watch.elapsedMicroseconds);
+ watch
+ ..reset()
+ ..start();
+ projects.hiddenIn(c);
+ watch.stop();
+ passTimes.add(watch.elapsedMicroseconds);
+ }
+ rowTimes.sort();
+ passTimes.sort();
+ // ignore: avoid_print
+ print(
+ 'PERSONAL_SIDEBAR_BENCH hidden_check per_row_median_us='
+ '${rowTimes[rowTimes.length ~/ 2]} one_pass_median_us='
+ '${passTimes[passTimes.length ~/ 2]}',
+ );
+ final p95 = times[(times.length * 95) ~/ 100];
+ // ignore: avoid_print
+ print(
+ 'PERSONAL_SIDEBAR_BENCH projects=${c.snapshot!.projects.length} '
+ 'listed=$listed panes=${_repos * _panesPerRepo} draws=$_draws '
+ 'median_us=$median p95_us=$p95',
+ );
+ await tester.pumpWidget(const SizedBox());
+ await tester.runAsync(c.flush);
+ f.app.superTabs.dispose();
+ await tester.pump();
+ });
+}
diff --git a/desktop/test/super_tab_project_menu_test.dart b/desktop/test/super_tab_project_menu_test.dart
index 5c499e0d6..8acbf2943 100644
--- a/desktop/test/super_tab_project_menu_test.dart
+++ b/desktop/test/super_tab_project_menu_test.dart
@@ -192,6 +192,140 @@ void main() {
}
});
+ // Task #3194 (Diego, 11-05): the same dialog and rows, each with its value,
+ // the project and Swarm under the title, and Delete set apart.
+ group('Project settings shows each row\'s current value', () {
+ Finder row(String label) =>
+ find.byKey(ValueKey('super-project-setting-$label'));
+ Finder valueOf(String label, String value) =>
+ find.descendant(of: row(label), matching: find.text(value));
+
+ testWidgets('the title names the project and its Swarm; Rename shows the '
+ 'name and Project details Not set', (tester) async {
+ final c = await showView(tester, swarm());
+ await openSettings(tester);
+ expect(find.text('openharness · ${c.snapshot!.name}'), findsOneWidget);
+ expect(valueOf('Rename project', 'openharness'), findsOneWidget);
+ expect(valueOf('Project details', 'Not set'), findsOneWidget);
+ });
+
+ testWidgets('Project details shows the repository, else the folder', (
+ tester,
+ ) async {
+ final server = swarm();
+ final project = (server.state['projects'] as List).first as Map;
+ project['repository'] = {
+ 'repositoryUrl': 'https://github.com/acme/openharness',
+ 'cwd': '/w/openharness',
+ };
+ await showView(tester, server);
+ await openSettings(tester);
+ expect(
+ valueOf('Project details', 'https://github.com/acme/openharness'),
+ findsOneWidget,
+ );
+ await tester.tap(find.byTooltip('Close'));
+ await tester.pumpAndSettle();
+
+ project['repository'] = {'cwd': '/w/openharness'};
+ final folder = swarm();
+ ((folder.state['projects'] as List).first as Map)['repository'] = {
+ 'cwd': '/w/openharness',
+ };
+ await showView(tester, folder);
+ await openSettings(tester);
+ expect(valueOf('Project details', '/w/openharness'), findsOneWidget);
+ });
+
+ testWidgets('Archived counts its conversations only once they are read to '
+ 'the end, and starts no read', (tester) async {
+ final server = swarm();
+ (server.state['conversations'] as List).addAll(<Map<String, dynamic>>[
+ {
+ ...conversationFixture('old', 'Old work'),
+ 'archived': true,
+ 'projectId': 'lead',
+ },
+ {
+ ...conversationFixture('older', 'Older work'),
+ 'archived': true,
+ 'projectId': 'lead',
+ },
+ ]);
+ final c = await showView(tester, server);
+ await openSettings(tester);
+ expect(row('Archived conversations'), findsOneWidget);
+ expect(
+ find.descendant(
+ of: row('Archived conversations'),
+ matching: find.textContaining('conversation'),
+ ),
+ findsOneWidget, // the label alone
+ );
+ expect(c.dormantLoaded('lead'), isFalse);
+ await tester.tap(find.byTooltip('Close'));
+ await tester.pumpAndSettle();
+
+ await c.loadDormant('lead');
+ await tester.pumpAndSettle();
+ await openSettings(tester);
+ expect(
+ valueOf('Archived conversations', '2 conversations'),
+ findsOneWidget,
+ );
+ });
+
+ testWidgets('a row not offered shows no value', (tester) async {
+ await showView(tester, swarm(owner: 'someone-else'));
+ await openSettings(tester);
+ expect(row('Rename project'), findsNothing);
+ expect(row('Delete Project'), findsNothing);
+ expect(valueOf('Project details', 'Not set'), findsOneWidget);
+ });
+
+ testWidgets(
+ 'Delete Project is drawn in the destructive ink, below a rule',
+ (tester) async {
+ await showView(tester, swarm());
+ await openSettings(tester);
+ final context = tester.element(row('Delete Project'));
+ final label = tester.widget<Text>(
+ find.descendant(
+ of: row('Delete Project'),
+ matching: find.text('Delete Project'),
+ ),
+ );
+ expect(label.style?.color, Theme.of(context).colorScheme.error);
+ for (final other in ['Rename project', 'Project details']) {
+ final text = tester.widget<Text>(
+ find.descendant(of: row(other), matching: find.text(other)),
+ );
+ expect(
+ text.style?.color,
+ isNot(Theme.of(context).colorScheme.error),
+ reason: other,
+ );
+ }
+ final rule = find.byKey(
+ const ValueKey('super-project-setting-danger-rule'),
+ );
+ expect(rule, findsOneWidget);
+ expect(
+ tester.getTopLeft(rule).dy,
+ lessThan(tester.getTopLeft(row('Delete Project')).dy),
+ );
+ expect(
+ tester.getTopLeft(rule).dy,
+ greaterThan(tester.getTopLeft(row('Project details')).dy),
+ );
+ // Still a plain row: it closes the dialog and does its work.
+ await tester.tap(row('Delete Project'));
+ await tester.pumpAndSettle();
+ expect(find.text('Project settings'), findsNothing);
+ },
+ );
+ });
+
testWidgets('a settings row closes the dialog and does its work', (
tester,
) async {
diff --git a/desktop/test/super_tab_project_settings_shots_test.dart b/desktop/test/super_tab_project_settings_shots_test.dart
new file mode 100644
index 000000000..54f0c43c6
--- /dev/null
+++ b/desktop/test/super_tab_project_settings_shots_test.dart
@@ -0,0 +1,56 @@
+import 'dart:io';
+
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/shared/widgets/app_menu.dart';
+
+import 'super_tab_mentions_test.dart' show showView;
+import 'support/capture.dart';
+import 'support/super_tab_fixture.dart';
+
+/// Set to a folder to write the PR's pictures of Project settings (task
+/// #3194) there, in light and dark.
+final _shots = Platform.environment['PROJECT_SETTINGS_SHOTS'];
+
+void main() {
+ setUpAll(() => loadCaptureFonts(_shots));
+
+ for (final brightness in Brightness.values) {
+ testWidgets('pictures of Project settings with each row\'s value, in '
+ '${brightness.name}', (tester) async {
+ if (_shots == null) return;
+ tester.view.devicePixelRatio = 2;
+ addTearDown(tester.view.reset);
+ final server = ConversationServer();
+ server.state['projects'] = [
+ {
+ ...projectFixture('lead', 'openharness', 'lead'),
+ 'repository': {
+ 'repositoryUrl': 'https://github.com/autonomous-ai/openharness',
+ },
+ },
+ ];
+ (server.state['conversations'] as List).addAll(<Map<String, dynamic>>[
+ for (var i = 0; i < 3; i++)
+ {
+ ...conversationFixture('old-$i', 'Old work $i'),
+ 'archived': true,
+ 'projectId': 'lead',
+ },
+ ]);
+ final c = await showView(tester, server, brightness: brightness);
+ await tester.runAsync(() => c.loadDormant('lead'));
+ await tester.pumpAndSettle();
+ await tester.tap(find.byTooltip('Project options'));
+ await tester.pumpAndSettle();
+ await tester.tap(find.widgetWithText(AppMenuItem, 'Project settings…'));
+ await tester.pumpAndSettle();
+ await captureWindow(
+ tester,
+ _shots,
+ 'project-settings-${brightness.name}',
+ );
+ await c.flush();
+ }, variant: TargetPlatformVariant.only(TargetPlatform.macOS));
+ }
+}
diff --git a/desktop/test/super_tab_swarm_switcher_test.dart b/desktop/test/super_tab_swarm_switcher_test.dart
index ed378c548..5213d095d 100644
--- a/desktop/test/super_tab_swarm_switcher_test.dart
+++ b/desktop/test/super_tab_swarm_switcher_test.dart
@@ -41,6 +41,12 @@ class _Backend {
/// The machine whose preparing fails.
String? failPrepareOn;
+ /// How [failPrepareOn]'s preparing fails.
+ Object prepareFailure = const SuperTabFailure(
+ 'SETUP_FAILED',
+ 'Setup failed there.',
+ );
+
/// Machines answer preparing with this state ('ready' sets them up).
String prepareState = 'ready';
@@ -183,9 +189,7 @@ class _Connection extends WsConn {
backend.machineCalls.add((machineId, action ?? ''));
if (action == 'prepareContribution') {
if (backend.holdPrepare case final hold?) await hold.future;
- if (backend.failPrepareOn == machineId) {
- throw const SuperTabFailure('SETUP_FAILED', 'Setup failed there.');
- }
+ if (backend.failPrepareOn == machineId) throw backend.prepareFailure;
return {
'state': backend.prepareState,
'scope': 'swarm',
@@ -206,11 +210,12 @@ void _ownMachine(
bool team = false,
bool shared = false,
bool linked = true,
+ String? name,
}) {
final machine = Machine(
machineId: id,
authMode: MachineAuthMode.remote,
- name: 'Machine $id',
+ name: name ?? 'Machine $id',
sessionKind: team ? 'team' : null,
machineShare: shared
? MachineShare(
@@ -1342,7 +1347,8 @@ void main() {
expect(added(backend, c.tabId), ['m']);
final row = PersonalMachines.of(app).waiting(c).single;
expect(row.machineId, 'lamp');
- expect(row.status, 'Offline');
+ expect(row.status, "Couldn't join: machine is off");
+ expect(row.canRetry, isTrue);
app.machineStates['lamp']!
..nodeOnline = true
..connectionStatus = ConnectionStatus.connected;
@@ -1388,8 +1394,9 @@ void main() {
expect(added(backend, c.tabId), contains('lamp'));
final row = PersonalMachines.of(app).waiting(c).single;
expect(row.machineId, 'rig');
- expect(row.status, "Couldn't add");
- expect(row.reason, isNotEmpty);
+ expect(row.status, "Couldn't join");
+ expect(row.reason, 'Setup failed there.');
+ expect(row.canRetry, isTrue);
// Within its wait it is not asked again.
final asked = backend.machineCalls
.where((call) => call.$1 == 'rig')
@@ -1505,6 +1512,192 @@ void main() {
expect(added(backend, c.tabId), contains('buddy-only'));
});
+ group('a machine that has not joined says why in a few words, with '
+ 'Try again (task #3042)', () {
+ Future<(AppNotifier, _Backend, SuperTabController)> failing(
+ Object failure,
+ ) async {
+ final (app, backend) = await _twoTabs();
+ await PersonalSwarm.of(app).show(app.activeSwarmId);
+ await _settle();
+ final c = await app.superTabs.open(PersonalSwarm.of(app).id!);
+ _ownMachine(app, 'rig');
+ backend
+ ..failPrepareOn = 'rig'
+ ..prepareFailure = failure;
+ await PersonalMachines.of(app).sync(c);
+ await _settle();
+ return (app, backend, c);
+ }
+
+ for (final (failure, words) in [
+ (
+ const SuperTabFailure('SIGNED_OUT', 'Sign in to use Swarm.'),
+ 'not signed in to Harness',
+ ),
+ (
+ const SuperTabFailure(
+ 'MACHINE_UNAVAILABLE',
+ 'This machine is not signed in.',
+ ),
+ 'not signed in to Harness',
+ ),
+ (
+ const SuperTabFailure('X', 'Unauthorized', statusCode: 401),
+ 'not signed in to Harness',
+ ),
+ (
+ const SuperTabFailure(
+ 'UPDATE_REQUIRED',
+ 'Update Harness on this machine, then try again.',
+ ),
+ 'needs a Harness update',
+ ),
+ (
+ const SuperTabFailure(
+ 'NO_SWARM_ENGINE',
+ 'Install Claude Code or Codex on this machine, then try again.',
+ ),
+ 'no Claude Code or Codex',
+ ),
+ (
+ const SuperTabFailure(
+ 'MACHINE_SLOW',
+ 'Machine rig is taking too long to answer.',
+ ),
+ 'not answering',
+ ),
+ (
+ const SuperTabFailure(
+ 'MACHINE_UNAVAILABLE',
+ 'Machine rig is offline. Open Harness on it, then try again.',
+ ),
+ 'machine is off',
+ ),
+ (
+ const SuperTabFailure(
+ 'SETUP_PENDING',
+ 'Project setup is still running. Try again to check its progress.',
+ ),
+ 'still setting up',
+ ),
+ ]) {
+ test('${failure.code} reads "$words", the '
+ 'whole reason on hover', () async {
+ final (app, _, c) = await failing(failure);
+ final row = PersonalMachines.of(app).waiting(c).single;
+ expect(row.status, "Couldn't join: $words");
+ expect(row.reason, failure.message);
+ expect(row.canRetry, isTrue);
+ });
+ }
+
+ test('Try again asks again at once, inside its wait, and the row goes '
+ 'once it joined', () async {
+ final (app, backend, c) = await failing(
+ const SuperTabFailure('SIGNED_OUT', 'Sign in to use Swarm.'),
+ );
+ final asked = backend.machineCalls
+ .where((call) => call.$1 == 'rig')
+ .length;
+ backend.failPrepareOn = null;
+ await PersonalMachines.of(app).retry(c, 'rig');
+ await _settle();
+ await c.refresh();
+ expect(
+ backend.machineCalls.where((call) => call.$1 == 'rig').length,
+ greaterThan(asked),
+ );
+ expect(
+ backend.contributions(c.tabId).map((m) => m['machineId']),
+ contains('rig'),
+ );
+ expect(PersonalMachines.of(app).waiting(c), isEmpty);
+ });
+
+ test('Try again asks once: a second press while it is asked adds no '
+ 'second ask, and the row reads Adding with no Try again', () async {
+ final (app, backend, c) = await failing(
+ const SuperTabFailure('MACHINE_SLOW', 'Slow.'),
+ );
+ backend.failPrepareOn = null;
+ final hold = backend.holdPrepare = Completer<void>();
+ final before = backend.machineCalls
+ .where(
+ (call) => call.$1 == 'rig' && call.$2 == 'prepareContribution',
+ )
+ .length;
+ final first = PersonalMachines.of(app).retry(c, 'rig');
+ await _settle();
+ final row = PersonalMachines.of(app).waiting(c).single;
+ expect(row.status, 'Adding');
+ expect(row.canRetry, isFalse);
+ final second = PersonalMachines.of(app).retry(c, 'rig');
+ await _settle();
+ hold.complete();
+ backend.holdPrepare = null;
+ await Future.wait([first, second]);
+ await _settle();
+ expect(
+ backend.machineCalls
+ .where(
+ (call) => call.$1 == 'rig' && call.$2 == 'prepareContribution',
+ )
+ .length,
+ before + 1,
+ );
+ });
+
+ test('Try again never adds one its person took out since', () async {
+ final (app, backend, c) = await failing(
+ const SuperTabFailure('MACHINE_SLOW', 'Slow.'),
+ );
+ backend.failPrepareOn = null;
+ backend.servers[c.tabId]!.state['removedMachines'] = ['rig'];
+ await c.refresh();
+ final asked = backend.machineCalls
+ .where((call) => call.$1 == 'rig')
+ .length;
+ await PersonalMachines.of(app).retry(c, 'rig');
+ await _settle();
+ expect(
+ backend.machineCalls.where((call) => call.$1 == 'rig'),
+ hasLength(asked),
+ );
+ expect(
+ backend.contributions(c.tabId).map((m) => m['machineId']),
+ isNot(contains('rig')),
+ );
+ });
+
+ test('Try again on a machine that is off asks the machines to '
+ 'reconnect first, then joins it once it is on', () async {
+ final (app, backend) = await _twoTabs();
+ _ownMachine(app, 'lamp', online: false);
+ await PersonalSwarm.of(app).show(app.activeSwarmId);
+ await _settle();
+ final c = await app.superTabs.open(PersonalSwarm.of(app).id!);
+ await PersonalMachines.of(app).sync(c);
+ await _settle();
+ var reconnects = 0;
+ PersonalMachines.of(app).reconnect = () async {
+ reconnects++;
+ app.machineStates['lamp']!
+ ..nodeOnline = true
+ ..connectionStatus = ConnectionStatus.connected;
+ };
+ await PersonalMachines.of(app).retry(c, 'lamp');
+ await _settle();
+ await c.refresh();
+ expect(reconnects, 1);
+ expect(
+ backend.contributions(c.tabId).map((m) => m['machineId']),
+ contains('lamp'),
+ );
+ expect(PersonalMachines.of(app).waiting(c), isEmpty);
+ });
+ });
+
group('their rows', () {
Finder row(String id) =>
find.byKey(ValueKey('super-personal-machine-$id'));
@@ -1531,7 +1724,8 @@ void main() {
}
testWidgets(
- 'an offline machine reads one word, and the row goes once it joined',
+ 'an offline machine reads why, with Try again, and the row goes once '
+ 'it joined',
(tester) async {
late AppNotifier app;
late SuperTabController c;
@@ -1551,7 +1745,14 @@ void main() {
findsOneWidget,
);
expect(
- find.descendant(of: row('lamp'), matching: find.text('Offline')),
+ find.descendant(
+ of: row('lamp'),
+ matching: find.text("Couldn't join: machine is off"),
+ ),
+ findsOneWidget,
+ );
+ expect(
+ find.descendant(of: row('lamp'), matching: find.text('Try again')),
findsOneWidget,
);
await tester.runAsync(() async {
@@ -1567,9 +1768,8 @@ void main() {
},
);
- testWidgets('a failure reads one word, with its reason on hover', (
- tester,
- ) async {
+ testWidgets('a failure reads why in a few words, with its whole reason '
+ 'on hover', (tester) async {
late AppNotifier app;
late SuperTabController c;
await tester.runAsync(() async {
@@ -1583,7 +1783,11 @@ void main() {
});
await pump(tester, app, c);
expect(
- find.descendant(of: row('rig'), matching: find.text("Couldn't add")),
+ find.descendant(of: row('rig'), matching: find.text("Couldn't join")),
+ findsOneWidget,
+ );
+ expect(
+ find.descendant(of: row('rig'), matching: find.text('Try again')),
findsOneWidget,
);
expect(
@@ -1602,6 +1806,107 @@ void main() {
);
});
+ testWidgets('Try again on a row joins it, and the row goes', (
+ tester,
+ ) async {
+ late AppNotifier app;
+ late _Backend backend;
+ late SuperTabController c;
+ await tester.runAsync(() async {
+ final (a, b, opened) = await personal();
+ app = a;
+ backend = b;
+ c = opened;
+ b
+ ..failPrepareOn = 'rig'
+ ..prepareFailure = const SuperTabFailure(
+ 'SIGNED_OUT',
+ 'Sign in to use Swarm.',
+ );
+ _ownMachine(a, 'rig');
+ await PersonalMachines.of(a).sync(c);
+ await _settle();
+ });
+ await pump(tester, app, c);
+ expect(
+ find.descendant(
+ of: row('rig'),
+ matching: find.text("Couldn't join: not signed in to Harness"),
+ ),
+ findsOneWidget,
+ );
+ backend.failPrepareOn = null;
+ await tester.tap(
+ find.descendant(of: row('rig'), matching: find.text('Try again')),
+ );
+ await tester.runAsync(() async {
+ await _settle();
+ await c.refresh();
+ });
+ await tester.pump();
+ expect(row('rig'), findsNothing);
+ expect(
+ backend.contributions(c.tabId).map((m) => m['machineId']),
+ contains('rig'),
+ );
+ });
+
+ for (final brightness in Brightness.values) {
+ testWidgets('pictures of the rows saying why, with Try again (task '
+ '#3042), in ${brightness.name}', (tester) async {
+ if (_shots == null) return;
+ final previous = grid.AppTheme.brightness.value;
+ grid.AppTheme.brightness.value = brightness;
+ addTearDown(() => grid.AppTheme.brightness.value = previous);
+ tester.view.devicePixelRatio = 2;
+ tester.view.physicalSize = const Size(1400, 700);
+ addTearDown(tester.view.reset);
+ late AppNotifier app;
+ late SuperTabController c;
+ await tester.runAsync(() async {
+ final (a, backend, opened) = await personal(
+ before: (a) =>
+ _ownMachine(a, 'studio', name: 'Studio', online: false),
+ );
+ app = a;
+ c = opened;
+ backend
+ ..failPrepareOn = 'mini'
+ ..prepareFailure = const SuperTabFailure(
+ 'MACHINE_UNAVAILABLE',
+ 'This machine is not signed in.',
+ );
+ _ownMachine(a, 'mini', name: 'Mac mini');
+ await PersonalMachines.of(a).sync(c);
+ await _settle();
+ });
+ await tester.pumpWidget(
+ MaterialApp(
+ debugShowCheckedModeBanner: false,
+ theme: grid.buildAppTheme(brightness: brightness),
+ home: Scaffold(
+ body: SingleChildScrollView(
+ child: SuperTabMachines(
+ controller: c,
+ app: app,
+ embedded: true,
+ onAddAgent: (_) {},
+ ),
+ ),
+ ),
+ ),
+ );
+ await tester.pump();
+ await tester.pump();
+ await captureWindow(
+ tester,
+ _shots,
+ 'personal-machine-rows-${brightness.name}',
+ );
+ await _releaseAll(tester, app);
+ });
+ }
+
testWidgets('another Swarm lists none', (tester) async {
late AppNotifier app;
late SuperTabController other;
diff --git a/desktop/test/super_tab_switch_pm_test.dart b/desktop/test/super_tab_switch_pm_test.dart
index 554a2b19a..371add48b 100644
--- a/desktop/test/super_tab_switch_pm_test.dart
+++ b/desktop/test/super_tab_switch_pm_test.dart
@@ -122,6 +122,19 @@ void main() {
final item = find.text('Switch PM…');
+ // Task #3194: Project settings shows each row's value.
+ testWidgets('Switch PM… shows the PM\'s name', (tester) async {
+ await mount(tester, swarm(), 'owner');
+ await openMenu(tester);
+ expect(
+ find.descendant(
+ of: find.byKey(const ValueKey('super-project-setting-Switch PM…')),
+ matching: find.text('Wren'),
+ ),
+ findsOneWidget,
+ );
+ });
+
// Screenshots for the pull request, written only when asked: rasterized
// text differs between machines, so they are not compared here.
final renderDir = Platform.environment['SWITCH_PM_RENDER_DIR'];
diff --git a/docs/plans/2026-11-05-personal-three-improvements-plan.md b/docs/plans/2026-11-05-personal-three-improvements-plan.md
new file mode 100644
index 000000000..c899dbedc
--- /dev/null
+++ b/docs/plans/2026-11-05-personal-three-improvements-plan.md
@@ -0,0 +1,119 @@
+# Three Personal improvements Implementation Plan
+
+> This plan follows the project's own way of working (project instructions, Engineer): each plan task commits its
+> failing test before its code, and the pull request's one review step is the independent review. There is no
+> execution handoff; the Engineer implements it.
+
+**Goal:** Huy's three Personal asks (11-05, task #3042, mockup okayed in the main chat): (1) on Desktop, a Personal
+project whose panes are all closed leaves the project list, its chat kept, and comes back when a pane of it opens;
+(2) the phone's Start Lead picks what Desktop's Start Lead card picks, the picker still there to change it, and with
+none of the person's computers online its button reads "Open Harness on your Mac to start"; (3) on Desktop, a machine
+of theirs that hasn't joined Personal says why on its own row, in a few words, with Try again.
+
+**Architecture:** All three are client-side; no backend change and no new stored data.
+(1) `PersonalProjects` (desktop `super_tabs/personal_projects.dart`) already works out which of the person's panes
+belong to which Personal project (`panesFor`). A new `hidden(c, projectId)` says a pane project with none of their
+panes now is hidden; `ProjectSidebar` leaves it out (unless it is the chat open now, as the unread filter keeps it).
+Nothing is deleted on the server, so its chat is there when the project shows again. While a machine holding one of
+their panes has not listed its agents yet (just launched, reconnecting), no project hides: which project such a pane
+belongs to isn't known yet.
+(2) River ruled (11-05) to keep the phone's direct start (#3029): it needs only the computer on, not Harness open.
+`swarmLeadPlan` (mobile `swarm/swarm_lead_start.dart`) picks as Desktop's `planFor` does: a computer holding the
+project's repo, else the person's computer; engine Claude Code, else Codex; Claude at Opus xhigh (already the same).
+Where Desktop prefers "this computer", the phone prefers the computer the person used last (its most recently opened
+agent), the closest it can know. A repo is read as Desktop reads it: `repository` (an SSH alias's real repo, #2476)
+before `remote`. With no computer online the card shows the disabled button "Open Harness on your Mac to start".
+(3) `PersonalMachines.waiting` (desktop `super_tabs/personal_machines.dart`) gives each row a short reason ("machine
+is off", "not signed in to Harness", "needs a Harness update", "no Claude Code or Codex", "not answering", "still
+setting up"; a failure none of these fits reads just "Couldn't join") and `retry(c, machineId)` drops the machine's
+wait and syncs again (an offline one has the machines reconnected first). `PersonalMachineRows` draws
+"name · Couldn't join: reason [Try again]", the full reason on hover; a machine being asked reads "Adding", with no
+Try again.
+
+**Tech Stack:** Flutter (desktop/ and mobile/), widget tests with the existing fixtures
+(`desktop/test/super_tab_personal_projects_test.dart`, `desktop/test/super_tab_swarm_switcher_test.dart`,
+`mobile/test/swarm/swarm_lead_start_*`), screenshots through each suite's capture helpers in light and dark.
+
+**Spec:** Swarm task #3042's brief and River's ruling on part 2 (11-05), quoted in the pull request.
+
+## Design
+
+- growth: nothing new is stored. Hiding is worked out from the panes on each read; the phone's pick from what it reads.
+- concurrency: N/A because nothing new is written; Try again runs through the existing one-at-a-time sync.
+- read cost: `hidden` walks the person's panes once per project row, as `panesFor` already does for the terminals
+ count. No new request.
+- scale: 10x panes or projects is 10x a walk over in-memory lists; the sidebar's build time warns first.
+- compatibility: client-only; old and new clients read the same Swarm. Another client still lists a hidden project.
+- migration + rollback: none; reverting the change shows every project again.
+- audience: N/A because nothing is exposed; the server's rules are unchanged.
+- identity: N/A because no machine or login changes hands.
+- failure: a machine that can't join says why on its row; a project is never hidden while its panes' machine hasn't
+ answered; the phone with no computer online says to open Harness.
+- platforms: Desktop macOS/Linux/Windows and web share the sidebar and rows; the phone on iOS/Android.
+
+## Global Constraints
+
+- Not view-only panes, not team-project linking (brief). Only the person's own Personal Swarm (`eligible`).
+- A hidden project keeps its chat: nothing is archived or deleted; only Desktop's list leaves it out.
+- Few words (Naming System, design docs); the app's tokens only, no new numeric colours or radii.
+- Never run a test that signs the Mac out of the real CLI; Desktop tests use a memory store and a fake sign-in.
+- Temp files only in `mktemp -d` folders.
+
+## Review Focus
+
+- A project never hides because its panes' machine is still loading, and never while it is the open chat.
+- Hiding is per Personal pane project only: a project the person made by hand (no panes ever) stays listed.
+- Try again on a waiting machine asks again at once, once, whatever its back-off wait; it never adds a machine the
+ person took out.
+- The phone's default computer and folder match Desktop's for the same desk; a pick still overrides.
+
+---
+
+### Task 1: A Personal project with no panes leaves the list
+
+**Files:**
+- Modify: `desktop/lib/super_tabs/personal_projects.dart`, `desktop/lib/super_tabs/project_sidebar.dart`
+- Test: `desktop/test/super_tab_personal_projects_test.dart`
+
+**Interfaces:**
+- Produces: `bool PersonalProjects.hidden(SuperTabController c, String projectId)`.
+
+- [x] Failing test: closing every pane of a repo hides its project from the sidebar; reopening a pane shows it with
+ its chat's messages; a project shows while its machine hasn't listed agents; the open chat stays listed; a project
+ made by hand stays listed.
+- [x] Implement `hidden` and the sidebar filter; run the file's tests.
+
+### Task 2: The phone's Start Lead picks what Desktop's card picks
+
+**Files:**
+- Modify: `mobile/lib/swarm/swarm_lead_start.dart`, `mobile/lib/swarm/swarm_computers.dart`,
+ `mobile/lib/swarm/swarm_lead_start_card.dart`, `mobile/lib/core/models.dart` (`AgentProject.repository`)
+- Test: `mobile/test/swarm/swarm_lead_start_test.dart`, `swarm_lead_start_card_test.dart`,
+ `swarm_lead_computers_test.dart`
+
+**Interfaces:**
+- Changes: `SwarmLeadComputer` gains `DateTime? lastUsed`.
+
+- [ ] Failing tests: the default computer holds the repo, the last used first among several; with no repo, the last
+ used computer; a folder found through `repository`; no computer online shows "Open Harness on your Mac to start",
+ disabled.
+- [ ] Implement; run the three files.
+
+### Task 3: A machine that hasn't joined says why, with Try again
+
+**Files:**
+- Modify: `desktop/lib/super_tabs/personal_machines.dart`, `desktop/lib/super_tabs/personal_machine_rows.dart`
+- Test: `desktop/test/super_tab_swarm_switcher_test.dart`
+
+**Interfaces:**
+- Changes: `PersonalMachineRow.status` becomes the few-word reason and gains `canRetry`;
+ `Future<void> PersonalMachines.retry(c, machineId)`.
+
+- [ ] Failing tests: an offline row reads "Couldn't join: machine is off" with Try again; a refusal reads its short
+ reason with the full one on hover; Try again asks again at once inside the wait and the row goes once it joined.
+- [ ] Implement; run the file's tests.
+
+### Task 4: Pictures
+
+- [ ] Light and dark screenshots of the sidebar before and after closing panes, the phone card's offline state, and
+ the machine rows, sent to Huy in the task.
diff --git a/docs/plans/2026-11-05-project-settings-values-plan.md b/docs/plans/2026-11-05-project-settings-values-plan.md
new file mode 100644
index 000000000..aa965828c
--- /dev/null
+++ b/docs/plans/2026-11-05-project-settings-values-plan.md
@@ -0,0 +1,62 @@
+# Project settings: each row's value, and Delete set apart: Implementation Plan
+
+> This plan follows the project's own way of working (project instructions, Engineer): each plan task commits its
+> failing test before its code, and the pull request's one review step is the independent review. There is no
+> execution handoff; the Engineer implements it.
+
+**Goal:** Task #3194 (Diego, 11-05, reshaped by the PM under anh Dee's 10-29 rule: improve a working screen in place).
+Desktop's Project settings dialog keeps its rows, order, actions and conditions, and adds:
+- the project's name and its Swarm under the title;
+- each row's current value on the right, in the quieter metadata role;
+- Delete Project in the destructive ink, set apart by a rule.
+
+**Architecture:** `showProjectSettings` (desktop `super_tabs/project_options.dart`) takes rows of
+`({String label, String? value, VoidCallback action, bool danger})` instead of `(String, VoidCallback)`, and puts
+`'<project> · <Swarm>'` in `SuperTabDetailDialog.detail`. `_projectSettings` (`super_tabs/view.dart`) gives each row its
+value from what the controller already holds:
+- Rename: the name.
+- Project details: `repository.repositoryUrl`, else `repository.cwd`, else `Not set` (as Project details shows).
+- Switch PM: the PM's name, else `Starting…` (as Project details shows).
+- Archived: `N conversation(s)` only when the archived list is read to its end (`dormantLoaded && !hasEarlierDormant`),
+ otherwise no value, so it never starts a read.
+- Delete: no value; `danger: true` draws it in `colorScheme.error`, below a hairline (as `AppMenuItem.danger` and
+ `AppMenuDivider` set a destructive menu row apart).
+
+**Tech Stack:** Flutter desktop, widget tests in `desktop/test/super_tab_project_menu_test.dart` and
+`desktop/test/super_tab_switch_pm_test.dart`; light/dark pictures with the suite's capture helper.
+
+**Spec:** Swarm task #3194's brief.
+
+## Design
+
+- growth, concurrency, read cost: nothing new is stored, written or read; values come from the snapshot already held.
+- compatibility, migration, audience, identity: N/A because this is a client-only change to one dialog.
+- failure: no value is shown when one isn't known; the row still works.
+- platforms: Desktop macOS/Linux/Windows and web share this dialog; the phone's row height (`kFingerTarget`) stays.
+
+## Global Constraints
+
+- Same dialog, rows, order, actions and conditions. No new controls, no editing in place, no backend change.
+- Desktop design system only; `scripts/check-ui-style.py --only desktop/lib/super_tabs` passes. Light and dark, text
+ scaling, keyboard order unchanged.
+
+## Review Focus
+
+- A value appears only on a row offered today; Archived never triggers a read.
+- Delete's ink is the theme's destructive role in both themes, and it is still a plain row (same tap, same keyboard).
+
+---
+
+### Task 1: Each row shows its value, the title names the project and Swarm, Delete is set apart
+
+**Files:** Modify `desktop/lib/super_tabs/project_options.dart`, `desktop/lib/super_tabs/view.dart`. Test
+`desktop/test/super_tab_project_menu_test.dart`, `desktop/test/super_tab_switch_pm_test.dart`.
+
+- [ ] Failing tests: the detail line; Rename's value; Project details' value with and without a repository; Archived's
+ count only once read to its end; Switch PM's value; no values for rows not offered; Delete in the error ink below
+ a rule.
+- [ ] Implement; run those two files and `check-ui-style.py`.
+
+### Task 2: Pictures
+
+- [ ] Light and dark screenshots of the dialog in the PR.
diff --git a/mobile/lib/core/models.dart b/mobile/lib/core/models.dart
index a1bee0473..fa07d7ab0 100644
--- a/mobile/lib/core/models.dart
+++ b/mobile/lib/core/models.dart
@@ -589,6 +589,7 @@ class AgentProject {
required this.cwd,
this.root,
this.remote,
+ this.repository,
this.branch,
this.worktree = false,
this.branchPending = false,
@@ -597,6 +598,11 @@ class AgentProject {
final String cwd;
final String? root;
final String? remote;
+
+ /// The repository [remote] stands for when its host is an SSH alias
+ /// (`gh-work/acme/games` for `github.com/acme/games`), as the daemon reports
+ /// it (desktop `AgentProject.repository`, #2476); null when [remote] is it.
+ final String? repository;
final String? branch;
final bool worktree;
@@ -690,6 +696,7 @@ class AgentProject {
cwd: cwd,
root: field('root'),
remote: field('remote'),
+ repository: field('repository'),
branch: field('branch', 256),
worktree: raw['worktree'] == true,
branchPending: raw['branchPending'] == true,
diff --git a/mobile/lib/swarm/swarm_computers.dart b/mobile/lib/swarm/swarm_computers.dart
index 912fba816..44614e53c 100644
--- a/mobile/lib/swarm/swarm_computers.dart
+++ b/mobile/lib/swarm/swarm_computers.dart
@@ -116,12 +116,28 @@ class AppSwarmComputers extends ChangeNotifier
folders: {
for (final agent in machine.agents)
if (agent.project case final project?)
- ?swarmNormalizedRemote(project.remote):
+ ?(swarmNormalizedRemote(project.repository) ??
+ swarmNormalizedRemote(project.remote)):
project.root ?? project.cwd,
},
+ lastUsed: _lastOpened(machine),
),
];
+ /// When the person last opened one of [machine]'s agents, from any app:
+ /// the phone's nearest word for the computer they are at, which Desktop's
+ /// card prefers (task #3042).
+ static DateTime? _lastOpened(MachineState machine) {
+ DateTime? last;
+ for (final agent in machine.agents) {
+ final opened = agent.lastOpenedAt;
+ if (opened != null && (last == null || opened.isAfter(last))) {
+ last = opened;
+ }
+ }
+ return last;
+ }
+
/// The computers whose engines the card asked for: once each, as a computer
/// that cannot answer stays unread and would be asked at every draw.
final _probed = <String>{};
diff --git a/mobile/lib/swarm/swarm_lead_start.dart b/mobile/lib/swarm/swarm_lead_start.dart
index 153610bce..102118a1b 100644
--- a/mobile/lib/swarm/swarm_lead_start.dart
+++ b/mobile/lib/swarm/swarm_lead_start.dart
@@ -17,13 +17,15 @@ const swarmPersonalName = 'Personal';
const swarmLeadStartWindow = Duration(minutes: 10);
/// One of the person's own computers a Lead can start on: its name, the
-/// engines signed in there (Claude Code first), and the folder of each repo
-/// its agents work in, by remote ([swarmNormalizedRemote]).
+/// engines signed in there (Claude Code first), the folder of each repo its
+/// agents work in, by remote ([swarmNormalizedRemote]), and when the person
+/// last opened one of its agents, from any app ([lastUsed]; null if never).
typedef SwarmLeadComputer = ({
String id,
String name,
List<String> engines,
Map<String, String> folders,
+ DateTime? lastUsed,
});
/// What the computer is asked to start: the Lead's engine, the repo's folder
@@ -81,9 +83,12 @@ bool swarmWantsLeadStart(SwarmReader reader, String chatId) {
snapshot.agent(leadId) == null;
}
-/// Where [chatId]'s Lead starts, or throws why it cannot (Desktop's
-/// `planFor`): the computer picked, else the first that holds the project's
-/// repo, else the first; the engine picked, else its first signed in.
+/// Where [chatId]'s Lead starts, or throws why it cannot, picking what
+/// Desktop's card picks (`planFor`, task #3042): the computer picked, else
+/// the repo's folder on the computer the person used last of those that hold
+/// it (Desktop prefers its own, the one the person is at), else the computer
+/// used last; the engine picked, else its first signed in (Claude Code, then
+/// Codex). Claude runs at the Lead's model on the computer, as on Desktop.
SwarmLeadPlan swarmLeadPlan(
SwarmReader reader,
SwarmLeadComputers computers,
@@ -105,10 +110,21 @@ SwarmLeadPlan swarmLeadPlan(
if (machineId != null && picked == null) {
throw const SuperTabFailure('NO_MACHINE', 'that computer isn’t online');
}
+ // The last used first; ties and never used in the list's order (a sort
+ // alone may not keep it).
+ final order = {for (final (i, c) in all.indexed) c.id: i};
+ final byUse = [...all]
+ ..sort((a, b) {
+ final x = a.lastUsed, y = b.lastUsed;
+ final byTime = x == null || y == null
+ ? (x == y ? 0 : (x == null ? 1 : -1))
+ : y.compareTo(x);
+ return byTime != 0 ? byTime : order[a.id]!.compareTo(order[b.id]!);
+ });
final chosen =
picked ??
- all.where((c) => folderOn(c) != null).firstOrNull ??
- all.firstOrNull;
+ byUse.where((c) => folderOn(c) != null).firstOrNull ??
+ byUse.firstOrNull;
if (chosen == null) {
throw const SuperTabFailure(
'NO_MACHINE',
diff --git a/mobile/lib/swarm/swarm_lead_start_card.dart b/mobile/lib/swarm/swarm_lead_start_card.dart
index c2b8c24c2..de1ff7b22 100644
--- a/mobile/lib/swarm/swarm_lead_start_card.dart
+++ b/mobile/lib/swarm/swarm_lead_start_card.dart
@@ -72,6 +72,8 @@ class _SwarmLeadStartCardState extends State<SwarmLeadStartCard> {
final picked = kept?.machineId ?? _machine;
SwarmLeadPlan? plan;
String? unavailable;
+ // None of the person's computers is online: Harness must be open on one.
+ final offline = widget.computers.leadComputers.isEmpty;
try {
plan = swarmLeadPlan(
widget.reader,
@@ -200,6 +202,16 @@ class _SwarmLeadStartCardState extends State<SwarmLeadStartCard> {
),
),
),
+ ] else if (offline) ...[
+ const SizedBox(height: AppSpace.m),
+ // A state, not an action: quiet, and it starts nothing.
+ const SwarmButton(
+ key: ValueKey('swarm-lead-start-offline'),
+ label: 'Open Harness on your Mac to start',
+ style: SwarmButtonStyle.plain,
+ wide: true,
+ onPressed: null,
+ ),
] else ...[
const SizedBox(height: AppSpace.xs),
Text(
@@ -208,7 +220,8 @@ class _SwarmLeadStartCardState extends State<SwarmLeadStartCard> {
style: AppType.body(color: AppPalette.textPrimary),
),
],
- if (status?.reason case final reason?) ...[
+ // An old failure says nothing while no computer is on.
+ if (status?.reason case final reason? when !offline) ...[
const SizedBox(height: AppSpace.s),
Text(
'Couldn’t start a Lead: $reason',
diff --git a/mobile/test/swarm/swarm_lead_computers_test.dart b/mobile/test/swarm/swarm_lead_computers_test.dart
index 3dd597037..f4edd1503 100644
--- a/mobile/test/swarm/swarm_lead_computers_test.dart
+++ b/mobile/test/swarm/swarm_lead_computers_test.dart
@@ -65,6 +65,37 @@ void main() {
expect(listed['n']!.folders, isEmpty);
});
+ test('a repo behind an SSH alias is found by its real repository, as '
+ 'Desktop reads it, and each computer says when the person last opened '
+ 'one of its agents (task #3042)', () async {
+ final rig = await signedInWith({'m': [], 'n': []});
+ addTearDown(rig.app.dispose);
+ rig.conn('m').answers['agents_list'] = (_) => {
+ 'agents': [
+ agentJson(
+ 'a1',
+ extra: {
+ 'lastOpenedAt': '2026-11-05T08:00:00.000Z',
+ 'project': {
+ 'name': 'games',
+ 'cwd': '/Users/me/games',
+ 'remote': 'gh-work/acme/games',
+ 'repository': 'github.com/acme/games',
+ },
+ },
+ ),
+ agentJson('a2', extra: {'lastOpenedAt': '2026-11-05T09:30:00.000Z'}),
+ ],
+ };
+ await rig.app.syncAgentsForTest('m');
+ final computers = AppSwarmComputers(rig.app);
+ addTearDown(computers.dispose);
+ final listed = {for (final c in computers.leadComputers) c.id: c};
+ expect(listed['m']!.folders, {'github.com/acme/games': '/Users/me/games'});
+ expect(listed['m']!.lastUsed, DateTime.utc(2026, 11, 5, 9, 30));
+ expect(listed['n']!.lastUsed, isNull);
+ });
+
test(
'a computer not connected, shared, or a Team account is left out',
() async {
diff --git a/mobile/test/swarm/swarm_lead_start_card_test.dart b/mobile/test/swarm/swarm_lead_start_card_test.dart
index d25c934aa..77ece7dab 100644
--- a/mobile/test/swarm/swarm_lead_start_card_test.dart
+++ b/mobile/test/swarm/swarm_lead_start_card_test.dart
@@ -17,6 +17,7 @@ import 'package:harness_mobile/swarm/swarm_lead_start.dart';
import 'package:harness_mobile/swarm/swarm_project_page.dart';
import 'package:harness_mobile/swarm/swarm_request.dart';
import 'package:harness_mobile/swarm/swarm_session.dart';
+import 'package:harness_mobile/swarm/swarm_style.dart';
import '../voice_fakes.dart';
import 'swarm_computers_fake.dart';
@@ -275,6 +276,23 @@ void main() {
expect(sent(), ['lead.claim', 'lead.claim', 'agent.add']);
});
+ testWidgets('an earlier failure is not shown while no computer is online '
+ '(task #3042)', (tester) async {
+ await pump(tester);
+ lead.failure = const SuperTabFailure(
+ 'CREATE_FAILED',
+ 'Codex isn’t signed in.',
+ );
+ await tester.tap(key('swarm-lead-start-button'));
+ await tester.pumpAndSettle();
+ expect(key('swarm-lead-start-error'), findsOneWidget);
+ lead.leadComputers = [];
+ (host.computers! as ChangeNotifier).notifyListeners();
+ await tester.pumpAndSettle();
+ expect(key('swarm-lead-start-offline'), findsOneWidget);
+ expect(key('swarm-lead-start-error'), findsNothing);
+ });
+
testWidgets('after a failed join the card keeps the computer the agent '
'started on', (tester) async {
await pump(tester);
@@ -298,19 +316,46 @@ void main() {
expect(find.text('Air'), findsNothing);
});
- testWidgets('no computer online says why and offers no Start', (
- tester,
- ) async {
+ testWidgets('no computer online: the button says to open Harness on '
+ 'their Mac, and starts nothing (task #3042)', (tester) async {
await pump(tester);
lead.leadComputers = [];
// The card reads the computers as it draws.
(host.computers! as ChangeNotifier).notifyListeners();
await tester.pumpAndSettle();
+ expect(key('swarm-lead-start-button'), findsNothing);
+ final offline = key('swarm-lead-start-offline');
expect(
- find.text('Can’t start a Lead: none of your computers is online'),
+ find.descendant(
+ of: offline,
+ matching: find.text('Open Harness on your Mac to start'),
+ ),
findsOneWidget,
);
- expect(key('swarm-lead-start-button'), findsNothing);
+ expect(
+ find.textContaining('none of your computers is online'),
+ findsNothing,
+ );
+ expect(
+ tester
+ .widget<SwarmButton>(
+ find.byKey(const ValueKey('swarm-lead-start-offline')),
+ )
+ .onPressed,
+ isNull,
+ );
+ await tester.tap(offline);
+ await tester.pumpAndSettle();
+ expect(sent(), isEmpty);
+ expect(lead.starts, isEmpty);
+ // Once a computer is on, the card offers its start again.
+ lead.leadComputers = [
+ computer('mac-1', 'Studio', folders: {repo: '/Users/me/games'}),
+ ];
+ (host.computers! as ChangeNotifier).notifyListeners();
+ await tester.pumpAndSettle();
+ expect(key('swarm-lead-start-button'), findsOneWidget);
+ expect(offline, findsNothing);
});
testWidgets('a Team Swarm\'s project chat shows no card', (tester) async {
@@ -351,6 +396,13 @@ void main() {
lead.held!.complete();
await tester.pumpAndSettle();
await capture(tester, 'failed-${brightness.name}');
+ // None of the person's computers online (task #3042).
+ final online = lead.leadComputers;
+ lead.leadComputers = [];
+ (host.computers! as ChangeNotifier).notifyListeners();
+ await tester.pumpAndSettle();
+ await capture(tester, 'offline-${brightness.name}');
+ lead.leadComputers = online;
await tester.pumpWidget(const SizedBox.shrink());
}
});
diff --git a/mobile/test/swarm/swarm_lead_start_fixture.dart b/mobile/test/swarm/swarm_lead_start_fixture.dart
index 442e08866..20afeb1cc 100644
--- a/mobile/test/swarm/swarm_lead_start_fixture.dart
+++ b/mobile/test/swarm/swarm_lead_start_fixture.dart
@@ -51,7 +51,14 @@ SwarmLeadComputer computer(
String name, {
List<String> engines = const ['claude', 'codex'],
Map<String, String> folders = const {},
-}) => (id: id, name: name, engines: engines, folders: folders);
+ DateTime? lastUsed,
+}) => (
+ id: id,
+ name: name,
+ engines: engines,
+ folders: folders,
+ lastUsed: lastUsed,
+);
/// A Swarm read with one project whose chat has [leadId] as its Lead, or none.
Map<String, dynamic> personalLoad({
diff --git a/mobile/test/swarm/swarm_lead_start_test.dart b/mobile/test/swarm/swarm_lead_start_test.dart
index e3d015daa..5c3a17fae 100644
--- a/mobile/test/swarm/swarm_lead_start_test.dart
+++ b/mobile/test/swarm/swarm_lead_start_test.dart
@@ -101,6 +101,71 @@ void main() {
);
});
+ group('with nothing picked, the plan picks what Desktop\'s card picks '
+ '(task #3042)', () {
+ final earlier = DateTime.utc(2026, 11, 5, 8);
+ final later = DateTime.utc(2026, 11, 5, 9);
+ final latest = DateTime.utc(2026, 11, 5, 10);
+
+ test('the repo\'s folder on the computer used last among those that '
+ 'hold it, as Desktop prefers this computer\'s', () async {
+ await open();
+ computers.leadComputers = [
+ computer(
+ 'mac-1',
+ 'Studio',
+ folders: {repo: '/Users/me/games'},
+ lastUsed: earlier,
+ ),
+ computer('mac-2', 'Air', lastUsed: latest),
+ computer(
+ 'mac-3',
+ 'Mini',
+ folders: {repo: '/Users/me/src/games'},
+ lastUsed: later,
+ ),
+ ];
+ expect(swarmLeadPlan(reader, computers, personalChat), (
+ machineId: 'mac-3',
+ engine: 'claude',
+ folder: '/Users/me/src/games',
+ ));
+ });
+
+ test('with the repo on none, the computer used last, in a new '
+ 'folder', () async {
+ await open();
+ computers.leadComputers = [
+ computer('mac-1', 'Studio', lastUsed: earlier),
+ computer('mac-2', 'Air', lastUsed: later),
+ computer('mac-3', 'Mini'),
+ ];
+ expect(swarmLeadPlan(reader, computers, personalChat), (
+ machineId: 'mac-2',
+ engine: 'claude',
+ folder: null,
+ ));
+ });
+
+ test('a pick still overrides it', () async {
+ await open();
+ computers.leadComputers = [
+ computer('mac-1', 'Studio', lastUsed: earlier),
+ computer('mac-2', 'Air', lastUsed: later),
+ ];
+ expect(
+ swarmLeadPlan(
+ reader,
+ computers,
+ personalChat,
+ machineId: 'mac-1',
+ engine: 'codex',
+ ),
+ (machineId: 'mac-1', engine: 'codex', folder: null),
+ );
+ });
+ });
+
test('the plan says why there is nothing to start on', () async {
await open();
computers.leadComputers = [];