The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
desktop: install the setup plan unasked when it needs no Terminal (#680)
0xken153c1c199b0933
diff --git a/desktop/CLAUDE.md b/desktop/CLAUDE.mdindex 08e716a85..a6915eb79 100644--- a/desktop/CLAUDE.md+++ b/desktop/CLAUDE.md@@ -245,11 +245,14 @@ both themes and enlarged text at the minimum window size without running an instRead-only dependency probes own their subprocesses and have a ten-second deadline covering startup,exit, and output-pipe closure. A timeout reports a failed check, not a missing tool; Retry after the-initial check stays read-only. Only an explicit install action permits automatic installation to-continue after a Terminal handoff, and a failed recheck stops that continuation. Readiness requires-the final ready phase and every required step, so old successful step values cannot flash a ready-screen during a new verification. The preflight status is a live region and uses a static waiting-icon when Reduce Motion is enabled.+initial check probes read-only first. When every item in the probed plan installs in-app (no+`requiresTerminal` — always the case on macOS), the app installs it straight after the probe, at+launch and after an automatic-mode Retry, without showing the review or its Install button; a plan+that needs Terminal (Linux apt) waits on that button, and manual mode never installs. Only an+install the app or the person started may continue after a Terminal handoff, and a failed recheck+stops that continuation. Readiness requires the final ready phase and every required step, so old+successful step values cannot flash a ready screen during a new verification. The preflight status+is a live region and uses a static waiting icon when Reduce Motion is enabled.### Boot and statediff --git a/desktop/lib/state/app_state.dart b/desktop/lib/state/app_state.dartindex 5de9a8164..88bf30ea6 100644--- a/desktop/lib/state/app_state.dart+++ b/desktop/lib/state/app_state.dart@@ -3933,8 +3933,14 @@ class AppNotifier extends ChangeNotifier {environmentReadiness = EnvironmentReadiness.initial();notifyListeners();try {- // Always read-only here. Installation starts only after explicit confirmation in the wizard.- final result = await _runProvisioner(install: false);+ // The probe is always read-only. What it finds missing is installed+ // straight away when the whole plan runs in-app; only a plan that needs+ // a password in Terminal waits on the wizard's Install action.+ var result = await _runProvisioner(install: false);+ if (!result.isReady && _canInstallUnattended(result, mode: null)) {+ status = AppStatus.preparingEnvironment;+ result = await _installUnattended(result);+ }if (!result.isReady) {status = AppStatus.preparingEnvironment;notifyListeners();@@ -3947,6 +3953,50 @@ class AppNotifier extends ChangeNotifier {}}+ /// Whether [probed] can be installed with nobody at the keyboard: it is a+ /// review of what is missing, the person has not chosen manual setup, and+ /// no step needs a password in Terminal (Linux apt). On macOS every step is+ /// in-app, so a fresh Mac never stops on an Install button.+ bool _canInstallUnattended(+ EnvironmentReadiness probed, {+ required EnvironmentSetupMode? mode,+ }) =>+ probed.phase == EnvironmentSetupPhase.review &&+ (mode ?? probed.mode) != EnvironmentSetupMode.manual &&+ !probed.plan.any((item) => item.requiresTerminal);++ /// The install [startEnvironmentSetup] runs, for a caller that already holds+ /// [_environmentSetupInFlight].+ Future<EnvironmentReadiness> _installUnattended(+ EnvironmentReadiness probed,+ ) async {+ _environmentInstallRequested = true;+ // Straight to the install progress: the review and its Install button+ // are never painted for a step nobody needs to approve. This is also the+ // state the provisioner resumes from — it re-probes every step — so its+ // first frame does not bring back the review's copy and red "Missing".+ final planned = {for (final item in probed.plan) item.step};+ environmentReadiness = probed.copyWith(+ phase: EnvironmentSetupPhase.installing,+ mode: EnvironmentSetupMode.automatic,+ message: 'Installing only the missing required tools.',+ steps: {+ for (final entry in probed.steps.entries)+ entry.key: planned.contains(entry.key)+ ? EnvironmentStepStatus.running+ : entry.value,+ },+ );+ notifyListeners();+ final result = await _runProvisioner(+ resumeFrom: environmentReadiness,+ install: true,+ mode: EnvironmentSetupMode.automatic,+ );+ if (!result.isReady) _scheduleEnvironmentRecheck();+ return result;+ }+/// Shared with [_prepareEnvironment]: runs the provisioner, updates/// [environmentReadiness] as it streams progress, and reports the outcome.Future<EnvironmentReadiness> _runProvisioner({@@ -4096,16 +4146,19 @@ class AppNotifier extends ChangeNotifier {await _continueAfterEnvironmentReady();}- /// A manual repair always returns to a read-only probe.+ /// A manual repair always returns to a read-only probe. In automatic setup+ /// the probe is followed by the install when it can run unattended, as at+ /// launch.Future<void> retryEnvironmentSetup() async {if (_environmentSetupInFlight) return;_environmentSetupInFlight = true;notifyListeners();try {- final result = await _runProvisioner(- install: false,- mode: environmentReadiness.mode,- );+ final mode = environmentReadiness.mode;+ var result = await _runProvisioner(install: false, mode: mode);+ if (!result.isReady && _canInstallUnattended(result, mode: mode)) {+ result = await _installUnattended(result);+ }if (result.isReady) await _continueAfterEnvironmentReady();} finally {_environmentSetupInFlight = false;diff --git a/desktop/lib/widgets/environment_setup_screen.dart b/desktop/lib/widgets/environment_setup_screen.dartindex 9015e1fae..ec7fd2eb5 100644--- a/desktop/lib/widgets/environment_setup_screen.dart+++ b/desktop/lib/widgets/environment_setup_screen.dart@@ -11,8 +11,10 @@ import '../shared/widgets/command_row.dart';import '../state/app_state.dart';import '../theme/app_theme.dart';-/// One setup review with a direct install action. Launch probes stay read-only;-/// installation starts only after the user chooses the visible install action.+/// First-run setup. Launch probes stay read-only; a plan that installs+/// entirely in-app then runs unasked and this screen shows its progress. Only a+/// plan that needs a password in Terminal (Linux apt) waits on the review's+/// install action.class EnvironmentSetupScreen extends StatefulWidget {final AppNotifier notifier;diff --git a/desktop/test/boot_flow_widget_test.dart b/desktop/test/boot_flow_widget_test.dartindex 074f766c3..ac6608ed8 100644--- a/desktop/test/boot_flow_widget_test.dart+++ b/desktop/test/boot_flow_widget_test.dart@@ -282,25 +282,99 @@ void main() {},);+ test('boot installs an in-app plan without asking', () async {+ final missing = EnvironmentReadiness(+ steps: {+ EnvironmentStep.harness: EnvironmentStepStatus.failed,+ EnvironmentStep.tmux: EnvironmentStepStatus.ready,+ },+ phase: EnvironmentSetupPhase.review,+ message: 'Review what Harness will install before continuing.',+ plan: [EnvironmentPlanItem.harnessCli],+ );+ final ready = EnvironmentReadiness(+ steps: {+ for (final step in EnvironmentStep.values)+ step: EnvironmentStepStatus.ready,+ },+ phase: EnvironmentSetupPhase.ready,+ mode: EnvironmentSetupMode.automatic,+ );+ final provisioner = _ScriptedEnvironmentProvisioner([missing, ready]);+ final app = _GuestApp(+ config: AppConfig.dev,+ authSession: AuthSession(),+ configStore: ConfigStore(storage: _FakeKeyValueStore()),+ cliLogin: _FakeCliLogin(loggedIn: false),+ environmentProvisioner: provisioner,+ );+ final painted = <(AppStatus, EnvironmentSetupPhase)>[];+ app.addListener(+ () => painted.add((app.status, app.environmentReadiness.phase)),+ );++ await app.bootstrap();++ // The launch probe is still read-only; the install follows it unasked.+ expect(provisioner.installCalls, [isFalse, isTrue]);+ // The install resumes from the progress screen, not from the review: no+ // review copy and no red "Missing" on the row being installed.+ final resumed = provisioner.resumeFromCalls.last!;+ expect(resumed.phase, EnvironmentSetupPhase.installing);+ expect(resumed.message, isNot(missing.message));+ expect(+ resumed.steps[EnvironmentStep.harness],+ EnvironmentStepStatus.running,+ );+ expect(resumed.steps[EnvironmentStep.tmux], EnvironmentStepStatus.ready);+ expect(app.environmentInstallRequested, isTrue);+ // A signed-out DESKTOP window lands on the desk as a guest: everything on this+ // computer is served by the daemon over the loopback, and the sign-in is a sheet+ // raised when the person reaches for another machine.+ expect(app.status, AppStatus.authenticated);+ expect(app.isGuest, isTrue);+ expect(app.environmentReadiness.phase, EnvironmentSetupPhase.ready);+ // The review — the screen with the Install button — is never painted.+ expect(+ painted,+ isNot(+ contains((+ AppStatus.preparingEnvironment,+ EnvironmentSetupPhase.review,+ )),+ ),+ );+ expect(+ painted,+ isNot(+ contains((AppStatus.preparingEnvironment, EnvironmentSetupPhase.ready)),+ ),+ );+ app.dispose();+ });+test(- 'boot probes read-only and installs only after explicit confirmation',+ 'boot waits for the Install action when the plan needs Terminal',() async {- final missing = EnvironmentReadiness(+ final linuxReview = EnvironmentReadiness(steps: {EnvironmentStep.harness: EnvironmentStepStatus.failed,- EnvironmentStep.tmux: EnvironmentStepStatus.ready,+ EnvironmentStep.tmux: EnvironmentStepStatus.failed,},phase: EnvironmentSetupPhase.review,+ plan: [+ EnvironmentPlanItem(+ step: EnvironmentStep.tmux,+ title: 'Linux host dependencies',+ detail: 'tmux · one apt transaction',+ command: 'sudo apt-get install -y tmux',+ requiresTerminal: true,+ packages: ['tmux'],+ ),+ EnvironmentPlanItem.harnessCli,+ ],);- final ready = EnvironmentReadiness(- steps: {- for (final step in EnvironmentStep.values)- step: EnvironmentStepStatus.ready,- },- phase: EnvironmentSetupPhase.ready,- mode: EnvironmentSetupMode.automatic,- );- final provisioner = _ScriptedEnvironmentProvisioner([missing, ready]);+ final provisioner = _ScriptedEnvironmentProvisioner([linuxReview]);final app = _GuestApp(config: AppConfig.dev,authSession: AuthSession(),@@ -310,35 +384,83 @@ void main() {);await app.bootstrap();+expect(provisioner.installCalls, [isFalse]);+ expect(app.environmentInstallRequested, isFalse);expect(app.status, AppStatus.preparingEnvironment);-- app.selectEnvironmentSetupMode(EnvironmentSetupMode.automatic);- final painted = <(AppStatus, EnvironmentSetupPhase)>[];- app.addListener(- () => painted.add((app.status, app.environmentReadiness.phase)),- );- await app.startEnvironmentSetup();- expect(provisioner.installCalls, [isFalse, isTrue]);- // A signed-out DESKTOP window lands on the desk as a guest: everything on this- // computer is served by the daemon over the loopback, and the sign-in is a sheet- // raised when the person reaches for another machine.- expect(app.status, AppStatus.authenticated);- expect(app.isGuest, isTrue);- expect(app.environmentReadiness.phase, EnvironmentSetupPhase.ready);- expect(- painted,- isNot(- contains((- AppStatus.preparingEnvironment,- EnvironmentSetupPhase.ready,- )),- ),- );+ expect(app.environmentReadiness.phase, EnvironmentSetupPhase.review);app.dispose();},);+ test('a failed unattended install stops on the failure screen', () async {+ final missing = EnvironmentReadiness(+ steps: {+ EnvironmentStep.harness: EnvironmentStepStatus.failed,+ EnvironmentStep.tmux: EnvironmentStepStatus.ready,+ },+ phase: EnvironmentSetupPhase.review,+ plan: [EnvironmentPlanItem.harnessCli],+ );+ final failed = missing.copyWith(+ phase: EnvironmentSetupPhase.failed,+ mode: EnvironmentSetupMode.automatic,+ failure: const EnvironmentFailure(+ step: EnvironmentStep.harness,+ title: 'Could not install Harness',+ detail: 'Check your connection, then retry setup.',+ ),+ );+ final provisioner = _ScriptedEnvironmentProvisioner([missing, failed]);+ final app = _GuestApp(+ config: AppConfig.dev,+ authSession: AuthSession(),+ configStore: ConfigStore(storage: _FakeKeyValueStore()),+ cliLogin: _FakeCliLogin(loggedIn: false),+ environmentProvisioner: provisioner,+ );++ await app.bootstrap();++ expect(provisioner.installCalls, [isFalse, isTrue]);+ expect(app.status, AppStatus.preparingEnvironment);+ expect(app.environmentReadiness.phase, EnvironmentSetupPhase.failed);+ expect(app.environmentInstallRequested, isTrue);+ expect(app.environmentSetupInFlight, isFalse);+ // No automatic retry loop: the next install waits for Retry.+ expect(app.environmentRecheckPending, isFalse);+ app.dispose();+ });++ test('Check again in manual setup never installs', () async {+ final manualReview = EnvironmentReadiness(+ steps: {+ EnvironmentStep.harness: EnvironmentStepStatus.failed,+ EnvironmentStep.tmux: EnvironmentStepStatus.ready,+ },+ phase: EnvironmentSetupPhase.review,+ mode: EnvironmentSetupMode.manual,+ plan: [EnvironmentPlanItem.harnessCli],+ );+ final provisioner = _ScriptedEnvironmentProvisioner([manualReview]);+ final app = _GuestApp(+ config: AppConfig.dev,+ authSession: AuthSession(),+ configStore: ConfigStore(storage: _FakeKeyValueStore()),+ cliLogin: _FakeCliLogin(loggedIn: false),+ environmentProvisioner: provisioner,+ )..status = AppStatus.preparingEnvironment;+ app.environmentReadiness = manualReview;++ await app.retryEnvironmentSetup();++ expect(provisioner.installCalls, [isFalse]);+ expect(app.environmentInstallRequested, isFalse);+ expect(app.status, AppStatus.preparingEnvironment);+ expect(app.environmentReadiness.phase, EnvironmentSetupPhase.review);+ app.dispose();+ });+test('recheckEnvironmentStep succeeds and continues past environment setup',() async {@@ -1283,6 +1405,286 @@ void main() {await tester.pumpWidget(const SizedBox());app.dispose();});++ testWidgets(+ 'a failed install at launch leaves Retry and Switch to Manual usable',+ (tester) async {+ final missing = EnvironmentReadiness(+ steps: {+ EnvironmentStep.harness: EnvironmentStepStatus.failed,+ EnvironmentStep.tmux: EnvironmentStepStatus.ready,+ },+ phase: EnvironmentSetupPhase.review,+ plan: [EnvironmentPlanItem.harnessCli],+ );+ final failed = missing.copyWith(+ phase: EnvironmentSetupPhase.failed,+ mode: EnvironmentSetupMode.automatic,+ failure: const EnvironmentFailure(+ step: EnvironmentStep.harness,+ title: 'Setup could not finish',+ detail: 'Check your connection, then retry setup.',+ ),+ );+ final provisioner = _ScriptedEnvironmentProvisioner([missing, failed]);+ final app = _GuestApp(+ config: AppConfig.dev,+ authSession: AuthSession(),+ configStore: ConfigStore(storage: _FakeKeyValueStore()),+ cliLogin: _FakeCliLogin(loggedIn: false),+ environmentProvisioner: provisioner,+ );+ await tester.pumpWidget(+ ProviderScope(+ overrides: [appStateProvider.overrideWithValue(app)],+ child: HarnessApp(authenticatedScreen: _swarm),+ ),+ );+ await tester.pump();++ await app.bootstrap();+ await tester.pump();++ // The window was mounted while the launch install ran; once it fails the+ // person must be able to act on the failure without anything else+ // nudging a rebuild.+ expect(find.text('Install 1 tool'), findsNothing);+ expect(find.text('Setup could not finish'), findsOneWidget);+ final retry = tester.widget<FilledButton>(+ find.widgetWithText(FilledButton, 'Retry'),+ );+ expect(retry.onPressed, isNotNull);+ final manual = tester.widget<TextButton>(+ find.widgetWithText(TextButton, 'Switch to Manual'),+ );+ expect(manual.onPressed, isNotNull);++ // One click is one more install, and nothing runs on its own after it.+ await tester.tap(find.widgetWithText(FilledButton, 'Retry'));+ await tester.pump();+ await tester.pump(const Duration(seconds: 6));+ expect(provisioner.installCalls, [false, true, true]);+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ },+ );++ test('nothing re-enters setup while the launch install is running', () async {+ final missing = EnvironmentReadiness(+ steps: {+ EnvironmentStep.harness: EnvironmentStepStatus.failed,+ EnvironmentStep.tmux: EnvironmentStepStatus.ready,+ },+ phase: EnvironmentSetupPhase.review,+ plan: [EnvironmentPlanItem.harnessCli],+ );+ final ready = EnvironmentReadiness(+ steps: {+ for (final step in EnvironmentStep.values)+ step: EnvironmentStepStatus.ready,+ },+ phase: EnvironmentSetupPhase.ready,+ mode: EnvironmentSetupMode.automatic,+ );+ final gate = Completer<void>();+ final provisioner = _GatedInstallProvisioner(missing, ready, gate);+ final app = _GuestApp(+ config: AppConfig.dev,+ authSession: AuthSession(),+ configStore: ConfigStore(storage: _FakeKeyValueStore()),+ cliLogin: _FakeCliLogin(loggedIn: false),+ environmentProvisioner: provisioner,+ );++ final boot = app.bootstrap();+ await Future<void>.delayed(Duration.zero);+ await Future<void>.delayed(Duration.zero);++ // Mid-install: the progress screen, owned by the launch run.+ expect(provisioner.installCalls, [false, true]);+ expect(app.status, AppStatus.preparingEnvironment);+ expect(app.environmentReadiness.phase, EnvironmentSetupPhase.installing);+ expect(app.environmentSetupInFlight, isTrue);+ expect(app.environmentInstallRequested, isTrue);++ await app.startEnvironmentSetup();+ await app.retryEnvironmentSetup();+ await app.recheckEnvironmentStep(EnvironmentStep.harness);+ expect(provisioner.installCalls, [false, true]);++ gate.complete();+ await boot;+ expect(provisioner.installCalls, [false, true]);+ expect(app.status, AppStatus.authenticated);+ expect(app.environmentSetupInFlight, isFalse);+ app.dispose();+ });++ test('a Terminal plan stays on the review through Retry', () async {+ final linuxReview = EnvironmentReadiness(+ steps: {+ EnvironmentStep.harness: EnvironmentStepStatus.failed,+ EnvironmentStep.tmux: EnvironmentStepStatus.failed,+ },+ phase: EnvironmentSetupPhase.review,+ plan: [+ EnvironmentPlanItem(+ step: EnvironmentStep.tmux,+ title: 'Linux host dependencies',+ detail: 'tmux · one apt transaction',+ command: 'sudo apt-get install -y tmux',+ requiresTerminal: true,+ packages: ['tmux'],+ ),+ EnvironmentPlanItem.harnessCli,+ ],+ );+ final provisioner = _ScriptedEnvironmentProvisioner([linuxReview]);+ final app = _GuestApp(+ config: AppConfig.dev,+ authSession: AuthSession(),+ configStore: ConfigStore(storage: _FakeKeyValueStore()),+ cliLogin: _FakeCliLogin(loggedIn: false),+ environmentProvisioner: provisioner,+ )..status = AppStatus.preparingEnvironment;+ app.environmentReadiness = linuxReview.copyWith(+ phase: EnvironmentSetupPhase.failed,+ mode: EnvironmentSetupMode.automatic,+ );++ await app.retryEnvironmentSetup();++ // Retry in automatic mode probes, finds a password-gated plan, and stops.+ expect(provisioner.installCalls, [false]);+ expect(app.environmentReadiness.phase, EnvironmentSetupPhase.review);+ expect(app.status, AppStatus.preparingEnvironment);+ expect(app.environmentSetupInFlight, isFalse);+ app.dispose();+ });++ test('a failed launch check never starts an install', () async {+ final probeFailed = EnvironmentReadiness(+ steps: {+ EnvironmentStep.harness: EnvironmentStepStatus.failed,+ EnvironmentStep.tmux: EnvironmentStepStatus.ready,+ },+ phase: EnvironmentSetupPhase.failed,+ plan: [EnvironmentPlanItem.harnessCli],+ failure: const EnvironmentFailure(+ title: 'Checking this computer took too long',+ detail: 'A required tool did not respond.',+ ),+ );+ final provisioner = _ScriptedEnvironmentProvisioner([probeFailed]);+ final app = _GuestApp(+ config: AppConfig.dev,+ authSession: AuthSession(),+ configStore: ConfigStore(storage: _FakeKeyValueStore()),+ cliLogin: _FakeCliLogin(loggedIn: false),+ environmentProvisioner: provisioner,+ );++ await app.bootstrap();++ // Only a review of what is missing is installed; a check that did not+ // finish waits for Retry.+ expect(provisioner.installCalls, [isFalse]);+ expect(app.environmentInstallRequested, isFalse);+ expect(app.status, AppStatus.preparingEnvironment);+ expect(app.environmentReadiness.phase, EnvironmentSetupPhase.failed);+ expect(app.environmentSetupInFlight, isFalse);+ app.dispose();+ });++ test('an unattended install that ends waiting for Terminal polls, then carries on', () async {+ final missing = EnvironmentReadiness(+ steps: {+ EnvironmentStep.harness: EnvironmentStepStatus.failed,+ EnvironmentStep.tmux: EnvironmentStepStatus.ready,+ },+ phase: EnvironmentSetupPhase.review,+ plan: [EnvironmentPlanItem.harnessCli],+ );+ final waiting = EnvironmentReadiness(+ steps: {+ EnvironmentStep.harness: EnvironmentStepStatus.failed,+ EnvironmentStep.tmux: EnvironmentStepStatus.needsTerminal,+ },+ phase: EnvironmentSetupPhase.waitingForTerminal,+ mode: EnvironmentSetupMode.automatic,+ );+ final ready = EnvironmentReadiness(+ steps: {+ for (final step in EnvironmentStep.values)+ step: EnvironmentStepStatus.ready,+ },+ phase: EnvironmentSetupPhase.ready,+ mode: EnvironmentSetupMode.automatic,+ );+ final provisioner = _ScriptedEnvironmentProvisioner([+ missing,+ waiting,+ ready,+ ]);+ final app = _GuestApp(+ config: AppConfig.dev,+ authSession: AuthSession(),+ configStore: ConfigStore(storage: _FakeKeyValueStore()),+ cliLogin: _FakeCliLogin(loggedIn: false),+ environmentProvisioner: provisioner,+ );++ await app.bootstrap();++ // The install the app started hands off to Terminal like one the person+ // started: it stays on the waiting screen and keeps polling.+ expect(provisioner.installCalls, [isFalse, isTrue]);+ expect(app.status, AppStatus.preparingEnvironment);+ expect(+ app.environmentReadiness.phase,+ EnvironmentSetupPhase.waitingForTerminal,+ );+ expect(app.environmentInstallRequested, isTrue);+ expect(app.environmentRecheckPending, isTrue);+ expect(app.environmentSetupInFlight, isFalse);++ await app.recheckEnvironmentStep(EnvironmentStep.tmux);++ expect(provisioner.installCalls, [isFalse, isTrue, isFalse]);+ expect(app.status, AppStatus.authenticated);+ expect(app.environmentRecheckPending, isFalse);+ app.dispose();+ });+}++/// Probe answers [probed] at once; the install blocks on [gate] and then answers [done].+class _GatedInstallProvisioner extends EnvironmentProvisioner {+ _GatedInstallProvisioner(this.probed, this.done, this.gate)+ : super(isMacOS: true);+ final EnvironmentReadiness probed;+ final EnvironmentReadiness done;+ final Completer<void> gate;+ final installCalls = <bool>[];++ @override+ Future<EnvironmentReadiness> ensureReady({+ required void Function(EnvironmentReadiness value) onProgress,+ EnvironmentReadiness? resumeFrom,+ bool install = true,+ EnvironmentSetupMode? mode,+ }) async {+ installCalls.add(install);+ if (!install) {+ onProgress(probed);+ return probed;+ }+ onProgress(+ (resumeFrom ?? probed).copyWith(phase: EnvironmentSetupPhase.installing),+ );+ await gate.future;+ onProgress(done);+ return done;+ }}/// The screen the desktop app mounts once signed in — the argument `HarnessApp`diff --git a/desktop/test/environment_recheck_timer_test.dart b/desktop/test/environment_recheck_timer_test.dartindex adb1a576a..8738494dd 100644--- a/desktop/test/environment_recheck_timer_test.dart+++ b/desktop/test/environment_recheck_timer_test.dart@@ -52,6 +52,20 @@ class _ScriptedProvisioner extends EnvironmentProvisioner {}}+/// What a Linux host without tmux is offered: a package install that needs a+/// password, so setup waits for the person's Install action instead of starting.+const _linuxHostPlan = [+ EnvironmentPlanItem(+ step: EnvironmentStep.tmux,+ title: 'Linux host dependencies',+ detail: 'tmux · one apt transaction',+ command: 'sudo apt-get install -y tmux',+ requiresTerminal: true,+ packages: ['tmux'],+ ),+ EnvironmentPlanItem.harnessCli,+];+void main() {TestWidgetsFlutterBinding.ensureInitialized();@@ -79,6 +93,7 @@ void main() {step: EnvironmentStepStatus.failed,},phase: EnvironmentSetupPhase.review,+ plan: _linuxHostPlan,);final waiting = review.copyWith(phase: EnvironmentSetupPhase.waitingForTerminal,@@ -126,6 +141,7 @@ void main() {EnvironmentStep.tmux: EnvironmentStepStatus.failed,},phase: EnvironmentSetupPhase.review,+ plan: _linuxHostPlan,);final waiting = review.copyWith(phase: EnvironmentSetupPhase.waitingForTerminal,diff --git a/desktop/test/environment_setup_screen_test.dart b/desktop/test/environment_setup_screen_test.dartindex 23788d1d5..b95d3360a 100644--- a/desktop/test/environment_setup_screen_test.dart+++ b/desktop/test/environment_setup_screen_test.dart@@ -210,31 +210,54 @@ void main() {);}- testWidgets('Retry after a launch check failure only checks the computer', (- tester,- ) async {- final provisioner = SetupProvisioner();- final app = _app(provisioner)- ..environmentReadiness = setupReview.copyWith(- phase: EnvironmentSetupPhase.failed,- mode: EnvironmentSetupMode.automatic,- failure: const EnvironmentFailure(- title: 'Checking this computer took too long',- detail: 'A required tool did not respond.',+ testWidgets(+ 'Retry after a launch check failure checks, then installs unasked',+ (tester) async {+ final provisioner = SetupProvisioner();+ final app = _app(provisioner)+ ..environmentReadiness = setupReview.copyWith(+ phase: EnvironmentSetupPhase.failed,+ mode: EnvironmentSetupMode.automatic,+ failure: const EnvironmentFailure(+ title: 'Checking this computer took too long',+ detail: 'A required tool did not respond.',+ ),+ );+ await _mount(tester, app);+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);+ await tester.pump();+ expect(provisioner.attempts, hasLength(1));+ expect(provisioner.attempts.single.install, isFalse);+ provisioner.attempts.single.finish(setupReview);+ await tester.pump();+ // Everything on the plan installs in-app, so the install follows the+ // check without stopping on the review and its Install button.+ expect(provisioner.attempts, hasLength(2));+ expect(provisioner.attempts.last.install, isTrue);+ expect(find.text('Install 2 tools'), findsNothing);+ expect(find.text('Preparing this computer'), findsOneWidget);+ provisioner.attempts.last.finish(+ const EnvironmentReadiness(+ steps: {+ EnvironmentStep.clipboard: EnvironmentStepStatus.notApplicable,+ EnvironmentStep.tmux: EnvironmentStepStatus.ready,+ EnvironmentStep.harness: EnvironmentStepStatus.ready,+ },+ phase: EnvironmentSetupPhase.ready,),);- await _mount(tester, app);- await tester.sendKeyEvent(LogicalKeyboardKey.enter);- await tester.pump();- expect(provisioner.attempts, hasLength(1));- expect(provisioner.attempts.single.install, isFalse);- provisioner.attempts.single.finish(setupReview);- await tester.pump();- expect(find.text('Install 2 tools').hitTestable(), findsOneWidget);- expect(provisioner.attempts, hasLength(1));- await tester.pumpWidget(const SizedBox());- app.dispose();- });+ await tester.pump();+ await tester.pump();+ // Past setup: the wizard has handed off to the rest of bootstrap.+ expect(app.status, isNot(AppStatus.preparingEnvironment));+ expect(provisioner.attempts.map((attempt) => attempt.install), [+ false,+ true,+ ]);+ await tester.pumpWidget(const SizedBox());+ app.dispose();+ },+ );testWidgets('manual setup keeps keyboard focus and never starts an install', (tester,diff --git a/desktop/test/setup_review_render_test.dart b/desktop/test/setup_review_render_test.dartindex 9ac5f5248..c20edee62 100644--- a/desktop/test/setup_review_render_test.dart+++ b/desktop/test/setup_review_render_test.dart@@ -186,6 +186,27 @@ void main() {await tester.pump();expect(find.text('Check again').hitTestable(), findsOneWidget);await capture('manual');+ // What a fresh Mac shows now that an in-app plan installs unasked.+ app.environmentReadiness = review.copyWith(+ mode: EnvironmentSetupMode.automatic,+ phase: EnvironmentSetupPhase.installing,+ message: 'Installing the Harness CLI and its Node runtime…',+ steps: {+ EnvironmentStep.clipboard: EnvironmentStepStatus.notApplicable,+ EnvironmentStep.tmux: EnvironmentStepStatus.ready,+ EnvironmentStep.harness: EnvironmentStepStatus.running,+ },+ output: const ['Downloading Node 22.23.2', 'Verifying sha256'],+ );+ app.notifyListeners();+ await tester.pump();+ expect(+ find.text('Preparing this computer').hitTestable(),+ findsOneWidget,+ );+ expect(find.byType(FilledButton), findsNothing);+ expect(find.text('Install 2 tools'), findsNothing);+ await capture('installing');app.environmentReadiness = review.copyWith(mode: EnvironmentSetupMode.automatic,phase: EnvironmentSetupPhase.waitingForTerminal,