Repository navigation
fix(wizard): health-check failures no longer kill the configure/onboard/doctor flow - #126758
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
…xiting mid-flow healthCommand's reachable-gateway auth diagnostic paths call runtime.exit(1), which with defaultRuntime hard-kills the hosting configure wizard, onboarding finalize, or doctor daemon flow mid-render — dropping the failure framing, docs guidance, and outro. Add healthCommandNonExiting, which traps that CLI-style exit into ExitError so the host flow owns the outcome, and use it at every embedded call site. Also fix the doctor e2e harness createConfigIO mock missing configPath, which broke doctor.runs-legacy-state-migrations on current main.
d8ffa21 to
946c649
Compare
|
Codex review: needs changes before merge. Reviewed August 20, 2026, 1:54 PM ET / 17:54 UTC. ClawSweeper reviewWhat this changesThe PR converts embedded health-command exits into caught failures for configure, interactive onboarding, and doctor flows, while preserving standalone Merge readiness⛔ Blocked by patch quality or review findings - 6 items remain Keep open: the wrapper correctly prevents a CLI exit from killing host flows, but onboarding finalization still treats the earlier reachability probe as success after a trapped health exit and can finish with a success outro. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherGateway health first checks whether a configured Gateway is reachable, then performs an authenticated health command. Configure, onboarding, and doctor consume those results to decide whether to show recovery guidance, continue setup, or finish successfully. flowchart LR
A[Gateway readiness probe] --> B[Authenticated health command]
B --> C{Standalone or embedded}
C -->|Standalone| D[Diagnostic and process exit]
C -->|Embedded| E[Trapped exit failure]
E --> F[Host records health outcome]
F --> G[Recovery note or successful outro]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +37, Tests +37. Total +74 across 12 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Make onboarding own an explicit health-validation outcome distinct from transport reachability, preserve the already-printed diagnostic, and route that outcome through recovery guidance, UI gating, and the final outro. Do we have a high-confidence way to reproduce the issue? Yes, from source: make the new embedded health wrapper throw ExitError after the initial readiness probe returns ok; onboarding keeps that probe result and reaches its success-controlled UI and outro paths. Is this the best way to solve the issue? No. Trapping the exit is the right owner-boundary direction, but onboarding must record health validation separately from simple reachability before it can choose a successful completion path. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 64b0e865df95. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
A reachable gateway whose health check failed still ended onboarding with the plain success outro because completion gating only read the earlier reachability probe. Record the health outcome as its own fact and end with a dedicated outro pointing at openclaw health. (ClawSweeper P1 on #126758.)
|
Merged via squash.
|
…rd/doctor flow (openclaw#126758) * fix(wizard): keep embedded health-check failures visible instead of exiting mid-flow healthCommand's reachable-gateway auth diagnostic paths call runtime.exit(1), which with defaultRuntime hard-kills the hosting configure wizard, onboarding finalize, or doctor daemon flow mid-render — dropping the failure framing, docs guidance, and outro. Add healthCommandNonExiting, which traps that CLI-style exit into ExitError so the host flow owns the outcome, and use it at every embedded call site. Also fix the doctor e2e harness createConfigIO mock missing configPath, which broke doctor.runs-legacy-state-migrations on current main. * fix(onboard): reflect a failed health check in the finalize outro A reachable gateway whose health check failed still ended onboarding with the plain success outro because completion gating only read the earlier reachability probe. Record the health outcome as its own fact and end with a dedicated outro pointing at openclaw health. (ClawSweeper P1 on openclaw#126758.)
What Problem This Solves
Fixes an issue where operators running the configure wizard's health section, onboarding finalize, or the doctor daemon flow would see the whole CLI die mid-flow when the gateway health check hit a reachable-gateway auth failure (credentials required or rate limited). The process exited with code 1 in the middle of the clack UI — no "health check failed" framing, no docs guidance, no outro, and every remaining wizard step silently dropped. Silent failure on a default onboarding path is the worst bug class per the product doctrine; this was flagged by ClawSweeper on PR #124773 and adjudicated as a separate fix.
Why This Change Was Made
healthCommandhas a dual contract: as a standalone CLI command, printing a diagnostic and callingruntime.exit(1)is correct; embedded inside a host flow (wizard/onboard/doctor), the host owns failure reporting. The embedded callers wrappedhealthCommandin try/catch, but the exit paths inemitReachableGatewayAuthDiagnosticbypass any catch. The fix addshealthCommandNonExitinginsrc/commands/health.ts, which runshealthCommandwith the host's runtime but withexittrapped into the existingExitError, so every failure mode funnels through the host's catch. All four embedded call sites (configure wizard, onboarding finalize, doctor daemon flow x2) now use it; each catch skips re-formatting a trappedExitError(the diagnostic already printed) but still shows the docs note and maps to the failed outcome/outro. Standaloneopenclaw healthbehavior is unchanged.Also fixes a red test on current
main: the doctor e2e harnesscreateConfigIOmock lackedconfigPath, sologConfigUpdatedcrashed indoctor.runs-legacy-state-migrations-yes-mode-without.e2e.test.ts("Cannot read properties of undefined (reading 'startsWith')"). Verified failing onorigin/main(793669c) before the fix.User Impact
Operators whose gateway is reachable but rejects health credentials now see the printed diagnostic, a "Health check failed" line where applicable, the health docs note, and a proper wizard outro ("…health check failed") instead of an abrupt process death mid-wizard. Healthy-path behavior is unchanged.
Evidence
src/commands/health.test.tsproves the credentials-required path throughhealthCommandNonExitingthrowsExitError, never invokes the host runtime'sexit, and still prints the diagnostic lines.src/commands/configure.wizard.test.tstable-drives the failure outro across unreachable/request-failure/trapped-exit and asserts no duplicate failure formatting; verified failing with the guard reverted.node scripts/run-vitest.mjsgreen forhealth.test.ts,configure.wizard.test.ts,doctor-gateway-daemon-flow.test.ts(96 tests),setup.finalize.test.ts+setup.test.ts(108 tests), and the doctor e2e files using the harness.node scripts/check-changed.mjsgreen (format, tsgo, lint, guards).OPENCLAW_STATE_DIR, port 19917, token auth), droveopenclaw configure --section healththrough a real PTY viaexpect. Failure case renders "Health check failed", the docs note, and the outro with a clean exit; healthy case renders full health output and completes. Gap: the exact credentials-required trigger is not live-inducible on this loopback gateway (loopback trust accepts the probe), so that path rests on the owner unit test above.Update: finalize outro records the health outcome (ClawSweeper P1)
ClawSweeper correctly flagged that onboarding finalize still gated its completion outro on the earlier reachability probe, so a reachable gateway with a failed health check could end with the plain success outro. The second commit records the health outcome as its own fact (
gatewayHealthCheckFailed) and ends with a dedicated outro ("Onboarding complete, but the gateway health check failed. Fix the issue above, then verify withopenclaw health."), with en/zh-CN/zh-TW strings and a regression test asserting the outro after a trapped health exit. Reachability-driven behavior that remains correct (Control UI links, "Gateway: reachable" status, TUI binding) is unchanged.