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.

Desktop: activation hill-climb on the new onboarding (#1077)

Dee9581a9767984
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index 5ce8bb345..d8c877408 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -555,7 +555,7 @@ class _SwarmScreenState extends State<SwarmScreen> {
try {
if (!_canShowWelcomeComposer || app.activeSwarmId != tab) return;
// A computer new to Harness opens on agents, not on an empty box.
- if (app.firstArrival.pending) {
+ if (app.firstArrival.pending || app.firstArrival.running) {
final arriving = app.firstArrival.run(
app,
// The person has not taken over meanwhile: no box, search or command bar opened.
diff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dart
index 55e87ce81..b2c718620 100644
--- a/desktop/lib/state/app_state.dart
+++ b/desktop/lib/state/app_state.dart
@@ -1070,6 +1070,27 @@ class AppNotifier extends ChangeNotifier {
readiness.needsTerminal ||
readiness.plan.any((item) => item.requiresTerminal);
+ /// A computer new to Harness builds its first workspace behind the welcome tour, as soon as the app
+ /// is ready, so the agents have started and OpenCode's task is typed by the time the tour hands
+ /// over: OpenCode's own first start took about 12 s after the tour had ended (fresh macOS VM,
+ /// 2026-10-09). The workspace joins this run when it appears ([FirstArrival.run]).
+ ///
+ /// Off under test unless a test turns it on: its wait for the machine is a timer a widget test would
+ /// find still pending.
+ @visibleForTesting
+ bool firstArrivalBehindTour = !kUnderTest;
+
+ void _firstArrivalBehindTour() {
+ if (!firstArrivalBehindTour ||
+ viewer != null ||
+ !_setupTour ||
+ status != AppStatus.authenticated ||
+ !firstArrival.pending) {
+ return;
+ }
+ unawaited(firstArrival.run(this));
+ }
+
/// The tour has shown its last slide with everything done: show the app.
void finishSetupTour() {
if (!_setupTour) return;
@@ -3154,6 +3175,7 @@ class AppNotifier extends ChangeNotifier {
this.agentUnread.addListener(_announceUnreadToDial);
experimentalFeatures.addListener(_devicesExperimentChanged);
addListener(_syncDeviceHosts);
+ addListener(_firstArrivalBehindTour);
_autoRenameTabs = appearancePrefsStore.value.autoRenameTabs;
appearancePrefsStore.addListener(_autoRenameChanged);
}
diff --git a/desktop/lib/state/first_arrival.dart b/desktop/lib/state/first_arrival.dart
index 3c736f3b0..222c2418e 100644
--- a/desktop/lib/state/first_arrival.dart
+++ b/desktop/lib/state/first_arrival.dart
@@ -146,25 +146,59 @@ class FirstArrival {
/// [stillCurrent] says the person has not taken over meanwhile (opened the New Harness box,
/// search, the command bar); it is asked before each pane, and so is whether they are still on a
/// tab this is filling.
+ ///
+ /// A second call while one is under way joins it: the app starts it behind the welcome tour, and
+ /// the workspace waits for that one when it appears.
Future<bool> run(
AppNotifier app, {
bool Function()? stillCurrent,
Duration machineWait = const Duration(seconds: 30),
Duration indexWait = const Duration(seconds: 15),
Duration starterWait = const Duration(minutes: 3),
+ }) {
+ if (_inFlight case final inFlight?) return inFlight;
+ if (!pending) return Future.value(false);
+ final run = _run(
+ app,
+ stillCurrent: stillCurrent,
+ machineWait: machineWait,
+ indexWait: indexWait,
+ starterWait: starterWait,
+ );
+ _inFlight = run;
+ return run.whenComplete(() => _inFlight = null);
+ }
+
+ Future<bool>? _inFlight;
+
+ Future<bool> _run(
+ AppNotifier app, {
+ bool Function()? stillCurrent,
+ required Duration machineWait,
+ required Duration indexWait,
+ required Duration starterWait,
}) async {
- if (!pending) return false;
_running = true;
final started = _now();
- final tabs = <String>{app.activeSwarmId};
+ // The tabs this fills, fixed once the first pane is about to open: behind the welcome tour the
+ // desk is still being read and its tab can be replaced before then (a run that pinned it at the
+ // start gave up on an existing user's sessions, fresh macOS VM, 2026-10-09).
+ final tabs = <String>{};
bool current() =>
- (stillCurrent?.call() ?? true) && tabs.contains(app.activeSwarmId);
+ (stillCurrent?.call() ?? true) &&
+ (tabs.isEmpty || tabs.contains(app.activeSwarmId));
var opened = false;
+ bool stop(String why) {
+ _log('first arrival: stopped, $why');
+ return false;
+ }
+
try {
// Someone whose account already has a desk elsewhere keeps it.
- if (app.allPanes.isNotEmpty) return false;
+ if (app.allPanes.isNotEmpty) return stop('the desk already has panes');
final machine = await _localMachine(app, machineWait);
- if (machine == null || !current()) return false;
+ if (machine == null) return stop('this computer never answered');
+ if (!current()) return stop('the person took over');
final machineId = machine.machine.machineId;
final sessions = await recentSessions(app, machineId, budget: indexWait);
await app.probeEngines(machineId);
@@ -176,12 +210,19 @@ class FirstArrival {
newUser: _state == 'new',
sessions: sessions,
installed: installed,
+ signedOut: {
+ for (final engine in const ['claude', 'codex'])
+ if (machine.engines[engine]?.signedIn == false) engine,
+ },
);
_log(
'first arrival: $plan after ${_now().difference(started).inMilliseconds} ms '
'(${sessions.length} recent, installed $installed)',
);
- if (plan.isEmpty || app.allPanes.isNotEmpty || !current()) return false;
+ if (plan.isEmpty) return stop('nothing to open');
+ if (app.allPanes.isNotEmpty) return stop('the desk already has panes');
+ if (!current()) return stop('the person took over');
+ tabs.add(app.activeSwarmId);
opened = plan.fresh.isNotEmpty
? await _openFresh(app, machineId, plan, starterWait, current)
: await _openSessions(app, machineId, plan.tabs, tabs, current);
@@ -532,10 +573,16 @@ List<List<ArrivalSession>> oneOfEachEngine(List<ArrivalSession> sessions) {
/// with both agents in it when both have one left. Without conversations, someone setup gave the
/// three agents gets them in one tab, OpenCode first; someone with agents gets a fresh pane on each
/// of Claude Code and Codex they have, or on OpenCode when that is all they have.
+///
+/// Claude Code or Codex installed but none of them signed in ([signedOut]) is someone who has not
+/// used them yet: OpenCode leads with the starter task, their agents beside it on their sign-in, so a
+/// first result never waits on an account (a fresh Mac with Codex from npm, 2026-10-09: the only pane
+/// was Codex's sign-in, which sent the person to a browser).
FirstArrivalPlan planFirstArrival({
required bool newUser,
required List<ArrivalSession> sessions,
required Set<String> installed,
+ Set<String> signedOut = const {},
}) {
if (sessions.isNotEmpty) return FirstArrivalPlan(tabs: recentTabs(sessions));
if (newUser) {
@@ -545,6 +592,9 @@ FirstArrivalPlan planFirstArrival({
for (final engine in const ['claude', 'codex'])
if (installed.contains(engine)) engine,
];
+ if (fresh.isNotEmpty && fresh.every(signedOut.contains)) {
+ return FirstArrivalPlan(fresh: ['opencode', ...fresh.reversed]);
+ }
if (fresh.isNotEmpty) return FirstArrivalPlan(fresh: fresh);
if (installed.contains('opencode')) {
return const FirstArrivalPlan(fresh: ['opencode']);
diff --git a/desktop/test/first_arrival_test.dart b/desktop/test/first_arrival_test.dart
index 50d23322c..1d306d09c 100644
--- a/desktop/test/first_arrival_test.dart
+++ b/desktop/test/first_arrival_test.dart
@@ -216,6 +216,49 @@ void main() {
expect(claude.typesStarterTask, isFalse);
});
+ test(
+ 'agents nobody has signed in to: OpenCode leads, they sit beside it',
+ () {
+ final codex = planFirstArrival(
+ newUser: false,
+ sessions: const [],
+ installed: const {'codex'},
+ signedOut: const {'codex'},
+ );
+ expect(codex.fresh, ['opencode', 'codex']);
+ expect(codex.typesStarterTask, isTrue);
+ expect(
+ planFirstArrival(
+ newUser: false,
+ sessions: const [],
+ installed: const {'claude', 'codex'},
+ signedOut: const {'claude', 'codex'},
+ ).fresh,
+ ['opencode', 'codex', 'claude'],
+ );
+ // One signed in is enough to start on: no OpenCode.
+ expect(
+ planFirstArrival(
+ newUser: false,
+ sessions: const [],
+ installed: const {'claude', 'codex'},
+ signedOut: const {'codex'},
+ ).fresh,
+ ['claude', 'codex'],
+ );
+ // Their conversations still come first.
+ expect(
+ planFirstArrival(
+ newUser: false,
+ sessions: [_s('codex', 'x1', 1)],
+ installed: const {'codex'},
+ signedOut: const {'codex'},
+ ).fresh,
+ isEmpty,
+ );
+ },
+ );
+
test('OpenCode alone gets OpenCode with the starter task', () {
final plan = planFirstArrival(
newUser: false,
@@ -307,6 +350,28 @@ void main() {
expect(await arrival.run(app, machineWait: Duration.zero), isFalse);
});
+ test('a second call joins the run under way', () async {
+ final arrival = FirstArrival(_MemoryStore())..begin(downloads: true);
+ await arrival.restore();
+ final app = AppNotifier(
+ config: AppConfig.dev,
+ authSession: AuthSession(),
+ configStore: null,
+ );
+ addTearDown(app.dispose);
+ final first = arrival.run(
+ app,
+ machineWait: const Duration(milliseconds: 300),
+ );
+ expect(arrival.running, isTrue);
+ expect(arrival.pending, isFalse);
+ // The workspace's call, with none of its own settings: it waits for the same run.
+ final joined = arrival.run(app);
+ expect(await Future.wait([first, joined]), [false, false]);
+ expect(arrival.running, isFalse);
+ expect(await arrival.run(app), isFalse, reason: 'spent');
+ });
+
test('the person taking over first stops it and spends the mark', () async {
final arrival = FirstArrival(_MemoryStore())..begin(downloads: true);
await arrival.restore();
diff --git a/docs/research/2026-10-08-activation-sim.md b/docs/research/2026-10-08-activation-sim.md
index 0ba8b2451..43537143e 100644
--- a/docs/research/2026-10-08-activation-sim.md
+++ b/docs/research/2026-10-08-activation-sim.md
@@ -313,6 +313,45 @@ Found and fixed on the way:
the host's Node works), so its pane shows "Unable to connect" there. The VM's network, not the
product.
+## Hill-climb on the merged onboarding (2026-10-09)
+
+Full journeys on a fresh macOS VM per persona (`vm/journey` in the session scratchpad): install and open
+Harness (the tour), the first task (Enter on OpenCode's typed task, or a task typed into the first
+pane), its result, a second session (a new tab, a task, Enter), and for some the next day (quit,
+reopen, a follow-up in the pane that came back). Scored with the rubric above. "Real" Claude Code and
+Codex are the npm packages on a Node of the person's own, never signed in; the others are the fake
+engines.
+
+| Persona | Opens | First result | Second session | Next day | Score |
+|---|---|---|---|---|---|
+| nothing installed | OpenCode + Codex + Claude Code | 61–66 s | 15–21 s | follow-up in 4–7 s, no prompt | 100 |
+| Claude Code signed in | Claude Code | 46 s | 2 s | — | 100 |
+| Claude Code signed in, 3 sessions | 2 + 1 sessions | 46 s | 2 s | — | 100 |
+| Codex signed in | Codex | 45 s | 3 s | — | 100 |
+| both signed in | Claude Code + Codex | 46 s | 3 s | — | 100 |
+| both signed in, 5 sessions, 1 running | 2 + 2 sessions | 46 s | 2 s | follow-up at once, no prompt | 100 |
+| OpenCode only | OpenCode | 55–56 s | 20 s | — | 100 |
+| real Codex, not signed in, **before** | Codex's sign-in alone (sends you to a browser) | none | — | — | ~25 |
+| real Codex, not signed in, after | OpenCode + Codex | 53–61 s | 16–27 s | follow-up in 7 s | 100 |
+| real Claude Code and Codex, not signed in | OpenCode + Codex + Claude Code | 55–74 s | 16–38 s | — | 100 |
+
+Changes (PR #1077):
+
+- **Agents nobody signed in to:** OpenCode leads with the starter task; their agents sit beside it on
+ their sign-in. Before, the only pane was Codex's sign-in, which opens a browser: no first result
+ without an account.
+- **The first workspace is built behind the tour:** OpenCode has started and its task is typed when
+ the tour hands over (it took ~12 s after the tour before). The new user's first result went from
+ 66 s to 61 s. The run fixes its tabs only when the first pane opens, because the desk is still being
+ read behind the tour (the first attempt pinned the tab at the start and gave up on an existing
+ user's sessions).
+
+Existing users, checked by upgrading: a Mac that installed and used the released desktop 1.2.59 (CLI
+0.3.67), then got this build: no tour, no first workspace, no agent downloads; its harness came back
+and answered a follow-up. The new desktop accepts any CLI from 0.2.48, so updating the desktop before
+the CLI asks for nothing. The released 1.2.59 still shows a new user "OpenCode is unavailable. Choose
+an agent." and Apple's developer-tools dialog; both are fixed on main.
+
## Next
- #1061 merged. #1047, #1052, #1067 and #1069 are carried by the onboarding PR (branch