# B3 — Wizard completion ordering ## Problem The wizard printed the success summary / `Mosaic is ready.` during `finalizeStage`, before the gateway configuration stage had completed its daemon health check. If the gateway health gate later failed, the user could see a success claim followed by a gateway failure. ## Diagnosis `finalizeStage` handled both mutation work and terminal success messaging. Wizard paths then ran `gatewayConfigStage` and `gatewayBootstrapStage` afterward: 1. finalize writes config, links runtime assets, syncs skills, runs doctor; 2. finalize prints `Installation Summary` + `Mosaic is ready.`; 3. gateway config starts/waits for daemon health; 4. gateway bootstrap runs. The summary needed to be deferred until after the gateway readiness gates. ## Fix - `finalizeStage` now returns a `showSummary()` callback and supports `deferSummary`. - Wizard/quick-start paths call finalize with `deferSummary: true`. - `showSummary()` is called only after gateway config reports ready and bootstrap completes, or immediately when the caller explicitly skips gateway setup. - If gateway health/config reports not ready, the wizard returns/aborts without printing the success summary. - Folded in adjacent runtime install hint fix for Pi: `curl -fsSL https://pi.dev/install.sh | sh`. ## Verification - Added unified-wizard coverage for summary-after-health and no-summary-on-health-failure. - Targeted: `pnpm --filter @mosaicstack/mosaic test -- unified-wizard finalize-skills` - `pnpm format:check` - `pnpm typecheck` - `pnpm lint` - `pnpm build` - `pnpm test` - Codex code review: approve. - Codex security review: one low finding on the requested Pi `curl | sh` install hint; no security finding in the wizard completion-ordering change.