Repository navigation
fix(cli): preserve the reason when an update fails - #163901
Conversation
Check the current rate-limit and balance guidance while retaining provider selection, retry, persisted-state, and billing duration assertions.
Update failures can happen before the updater marker is present. Recognize the command through the existing root-option parser and keep the public reason and original failure line on stderr in human and JSON modes. Preserve concise leads, manual recovery guidance, config diagnostic deduplication, and debug-only causes. Cover markerless failures through the formatter and installation-replacement entry path, and document the update stderr contract.
Keep the paired-worker lifecycle assertion for the public offline explanation and reconnect choices, alongside placement, failed-launch and local-run checks. The reply owner already supplies this guidance; the wire boundary must retain it.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 2, 2026, 8:49 PM ET / October 3, 2026, 00:49 UTC. ClawSweeper reviewWhat this changesThe PR preserves early update failure reasons on stderr, documents that behavior, and updates agent and device-runner error assertions. Merge readiness✅ Ready for maintainer review Keep open: current main still loses markerless update failure reasons, and this focused repair remains useful. No actionable introduced defect was found. Likely related people: steipete and vincentkoc, with medium-confidence routing. Priority: P2 Review scores
Verification
How this fits togetherThe shared CLI failure formatter receives errors from command execution and startup, then produces operator-facing stderr. Update diagnostics must survive failures before updater initialization and after installation files are replaced. flowchart TD
A[CLI arguments] --> B[Root command parser]
C[Startup or command failure] --> D[Shared failure formatter]
B --> D
E[Updater marker and debug settings] --> D
D --> F[Reason and recovery guidance on stderr]
C --> G[JSON failure envelope]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +12, Tests +38, Docs +1. Total +51 across 7 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep one shared formatter that preserves actionable update reasons without exposing nested causes or stacks unless debug output is requested. Do we have a high-confidence way to reproduce the issue? Yes, source provides a high-confidence path: an ordinary update error without debug output or an updater marker loses its reason on current main. Execution was not performed in this read-only review. Is this the best way to solve the issue? Yes, extending the existing formatter through the canonical root-option parser is a narrow repair that preserves config deduplication, manual recovery guidance, and debug gating. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d9ded6247e77. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
* test(agents): align fallback assertions with concise error guidance Check the current rate-limit and balance guidance while retaining provider selection, retry, persisted-state, and billing duration assertions. * fix(cli): retain early update failure diagnostics Update failures can happen before the updater marker is present. Recognize the command through the existing root-option parser and keep the public reason and original failure line on stderr in human and JSON modes. Preserve concise leads, manual recovery guidance, config diagnostic deduplication, and debug-only causes. Cover markerless failures through the formatter and installation-replacement entry path, and document the update stderr contract. * test(gateway): require offline runner recovery guidance Keep the paired-worker lifecycle assertion for the public offline explanation and reconnect choices, alongside placement, failed-launch and local-run checks. The reply owner already supplies this guidance; the wire boundary must retain it.
What Problem This Solves
Early
openclaw updatefailures can hide the public reason code and original installer error behind “The CLI command failed” before the updater marker exists. The concise-error change also left several consumer assertions stale.User Impact
Update failures retain their specific reason on stderr, including JSON mode, while keeping the short lead, redaction, and debug-only causes/stacks. The worker-wire test again requires an explicit offline/reconnect explanation for disconnected device runners. There are no new flags, dependencies, schema changes, retries, timeout increases, or skipped assertions.
Why This Change Was Made
The CLI formatter identifies
updatethrough the existing root-option parser, including--profile, independently of the updater marker. Manual schema-recovery messages and the peer's invalid-config diagnostic deduplication remain intact. Two agent E2Es follow the current rate-limit/billing guidance; the worker-wire E2E requires the public offline explanation again.Update contract: an update failure keeps its public reason code and original failure line. A blank
--snapshot-statemust name that flag; peer71b857a75b52already preserves it withExpectedCliError. Invalid-config output keeps the config path, first validation line, and next step; peereb978fd65e31already owns that repair.Current main already contains the CLI/config, native-harness, browser, and reply-entry repairs listed below.
Consumer decisions
(a) follows the intentional concise contract with actionable guidance or retained diagnostics; (b) requires the lost detail at its owner.
channels.status.command-flowgateway-backed-exit-health.processstate-dir-gateway-check.processupdate-dry-run-state.processentry.memory-jsonentry.update-failure.processregister.backup.product-pathmodels-dispatch.catalog.integrationserver.codex-failure-recoveryserver.chat-adopted-failurechat-display-projection.recoveryserver-methods/server-methodsdispatch-from-config.deliveryrun-orchestrator.projectionextension-install.native-hostmodel-fallback.run-embeddedembedded-agent-runner.run-embedded-agent.fault-sequencesmodel-fallback.reply-entry97eb729b2503covers it; own duplicate dropped.paired-node-worker-lifecycle-wire3c5010ebfacdowns offline copy; this PR restores the exact wire assertion.embedded-agent-runner.guardorphan result#163379, not#163381; peer62650e4c771bhandles the stale wording. No change here.run.harness-auth-failovercreateNativeModelOwnedRuntimeModelmock export, not a generic replacement for the revoked-key error. Peeraa906dbd5f8dfixes it. Exact original-error identity assertions remain and pass 12/12.Evidence
Original copy cluster: hourly 36990668433, head
0614328f729e, introduced byd0b48d63efb8(#163381). Failing jobs:110786136257,110786136658,110786143155,110786143177,110786143214,110786136484,110786136412.110786136530,110786143326,110786136574,110786136293,110786136321,110786136624,110786136586.110786132613.Additional evidence: offline runner job 110812631787; orphan-result hourly job 110859977151; auth-mock hourly job 111056682704. The last job's seven annotations identify the missing mock export; the revoked-key and preflight errors were expected values.
Final focused proof ran once per file locally on macOS / Node 26.10.0, using
CI=1 node scripts/run-vitest.mjs <file> --maxWorkers=1: 120 passed, 7 failed, 1 skipped. No completed file was repeated.src/cli/failure-output.test.tssrc/entry.update-failure.process.test.tssrc/cli/state-dir-gateway-check.process.test.tssrc/cli/gateway-backed-exit.process.test.tssrc/agents/model-fallback.run-embedded.e2e.test.tssrc/agents/model-fallback.reply-entry.e2e.test.tssrc/agents/embedded-agent-runner.run-embedded-agent.fault-sequences.e2e.test.tstest/e2e/qa-lab/runtime/paired-node-worker-lifecycle-wire.e2e.test.tssrc/agents/embedded-agent-runner/run.harness-auth-failover.test.tsThe first agent E2E wall time includes the cold canonical runtime build (38m33s in tsdown); its Vitest phase was 112.63s. These are local timings, not newly measured CI seconds.
Current validation gaps: the wire file returned
status: "timeout"at unchanged checks on lines 293 and 525, before the new offline-message assertion at line 605. The stronger wire assertion previously passed three Linux runs on the earlier base; this local run does not verify it on the rebased runtime. The extra, unchanged Gateway CLI file had five reachable-RPC cases exit 1 instead of 0, with empty stderr; its old copy-mismatch cases passed. The same five cases passed earlier Linux proof, relevant owners are unchanged, and a bounded TCP probe succeeded, but omitted child JSON stdout leaves the exact local RPC/auth cause unresolved. No assertions, deadlines, or fixture behavior were changed to conceal either gap.Retained proof for the unchanged patch: negative controls reproduced both markerless update failures; formatter 27/27 and entry replacement 6/6 passed three times afterward. Changed E2Es also passed three times. Before rebase, Linux boundary lint, types/lint/dead-export checks, whole architecture, and all 36 selected
check-changedcommands passed on basec1b973aec107. Independent P2 review found no actionable findings. The seven retained file hashes are unchanged across rebase; the peer-covered reply-entry delta was removed.Focused local proof is the final validation for this ready PR; the remaining broad remote runs were stopped before completion. Earlier whole-config runs are not an all-green claim: commands had 81 storage-fixture/custody failures, CLI-process had five now-peer-covered copy failures, and the whole E2E run had unrelated fixture failures. Infra remained incomplete and included peer-covered database fixtures plus two unresolved 64-agent catalog timeouts. A DNS mode failure caused by the proof bootstrap's umask passed 21/21 after restoring canonical
022; the original failed receipt was retained. No failing test was suppressed or retried to claim a fix.PR selection
The exact aggressive PR planner for
54e68a833c07..af67d270e982selects all five changed consumer tests: the two agent E2Es, formatter test, entry replacement test, and paired-node wire test. It selects 43 files in 12 rows with source-default Blacksmith packing. These are explicit-target rows (OPENCLAW_NODE_TEST_TARGETS_JSON); hosted preflight remains authoritative for actual row names and the merge-ref plan. No workflow was dispatched or rerun for proof.