Skip to content

fix(cli): preserve the reason when an update fails - #163901

Merged
steipete merged 3 commits into
mainfrom
ci/fix2-worker-ack-cli
Oct 3, 2026
Merged

steipete merged 3 commits into
mainfrom
ci/fix2-worker-ack-cli

Conversation

@steipete

@steipete steipete commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Early openclaw update failures 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 update through 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-state must name that flag; peer 71b857a75b52 already preserves it with ExpectedCliError. Invalid-config output keeps the config path, first validation line, and next step; peer eb978fd65e31 already 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.

Consumer Decision Resolution
channels.status.command-flow (a) Peer-covered connection guidance.
gateway-backed-exit-health.process (a) Peer-covered human guidance; JSON transport diagnostics retained.
state-dir-gateway-check.process (b) Peer preserves config path, validation detail, remedy, and no-write behavior.
update-dry-run-state.process (b) Peer preserves blank-flag diagnostic; no remaining diff here.
entry.memory-json (a) Peer retains original cleanup diagnostics in the JSON envelope.
entry.update-failure.process (b) This PR preserves markerless update reasons and tests installed-file replacement.
register.backup.product-path (a) Peer retains discovery/database reason in JSON and archive refusal.
models-dispatch.catalog.integration (a) Peer-covered curated model guidance.
server.codex-failure-recovery (a) Peer-covered public guidance plus log command and per-run lifecycle diagnostics.
server.chat-adopted-failure (a) Peer-covered concise guidance; lifecycle checks retained.
chat-display-projection.recovery (a) Peer-covered projection contract; privacy and settlement assertions retained.
server-methods/server-methods (a) Peer-covered concise guidance.
dispatch-from-config.delivery (a) Peer-covered copy; deferred delivery assertions retained.
run-orchestrator.projection (a) Peer-covered copy/projection contract.
Browser extension-install.native-host (b) Peer restores invalid-config diagnostics and no-write checks.
model-fallback.run-embedded (a) This PR pins current rate-limit guidance; fallback assertions retained.
embedded-agent-runner.run-embedded-agent.fault-sequences (a) This PR checks billing recovery guidance; profile/state/duration checks retained.
model-fallback.reply-entry (a) Peer 97eb729b2503 covers it; own duplicate dropped.
paired-node-worker-lifecycle-wire (b) Peer 3c5010ebfacd owns offline copy; this PR restores the exact wire assertion.
embedded-agent-runner.guard orphan result Separate cause #163379, not #163381; peer 62650e4c771b handles the stale wording. No change here.
run.harness-auth-failover Separate fixture break The received error was a missing createNativeModelOwnedRuntimeModel mock export, not a generic replacement for the revoked-key error. Peer aa906dbd5f8d fixes it. Exact original-error identity assertions remain and pass 12/12.

Evidence

Original copy cluster: hourly 36990668433, head 0614328f729e, introduced by d0b48d63efb8 (#163381). Failing jobs:

  • CLI/entry: 110786136257, 110786136658, 110786143155, 110786143177, 110786143214, 110786136484, 110786136412.
  • Gateway/reply: 110786136530, 110786143326, 110786136574, 110786136293, 110786136321, 110786136624, 110786136586.
  • Browser build artifacts: 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.

File Result Wall seconds
src/cli/failure-output.test.ts 27 passed (27) 51.57
src/entry.update-failure.process.test.ts 6 passed (6) 21.77
src/cli/state-dir-gateway-check.process.test.ts 1 passed (1) 79.24
src/cli/gateway-backed-exit.process.test.ts 5 failed; 28 passed; 1 skipped (34) 178.27
src/agents/model-fallback.run-embedded.e2e.test.ts 27 passed (27) 2626.73
src/agents/model-fallback.reply-entry.e2e.test.ts 9 passed (9) 181.01
src/agents/embedded-agent-runner.run-embedded-agent.fault-sequences.e2e.test.ts 10 passed (10) 245.11
test/e2e/qa-lab/runtime/paired-node-worker-lifecycle-wire.e2e.test.ts 2 failed (2) 651.62
src/agents/embedded-agent-runner/run.harness-auth-failover.test.ts 12 passed (12) 122.09

The 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-changed commands passed on base c1b973aec107. 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..af67d270e982 selects 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.

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.
@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes agents Agent runtime and tooling size: S labels Oct 3, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 3, 2026
@clawsweeper

clawsweeper Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 2, 2026, 8:49 PM ET / October 3, 2026, 00:49 UTC.

ClawSweeper review

What this changes

The 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
Reviewed head: af67d270e982b0a6ab501c952dae324c5b4c4401

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-supported repair with meaningful regression coverage and transparently recorded validation limitations.
Proof confidence 🌊 off-meta tidepool Not applicable: The verified repository-admin author qualifies for the maintainer exemption. Reported entry-process tests exercise the shared formatter after installation replacement in human and JSON modes; they are supplemental validation, and unrelated prior UI screenshots do not prove this CLI change. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The verified repository-admin author qualifies for the maintainer exemption. Reported entry-process tests exercise the shared formatter after installation replacement in human and JSON modes; they are supplemental validation, and unrelated prior UI screenshots do not prove this CLI change. No stored-data contract changes.
Evidence reviewed 9 items Introduced change: The pinned merge-base-to-head patch adds command-aware update diagnostics and focused assertions; it contains no dependency, workflow, configuration, or stored-data changes.
Repair remains necessary on main: Main's ordinary non-debug, markerless failure branch emits a reason only for an unreported invalid-config diagnostic. Ordinary update errors therefore still receive the generic lead and Doctor hint.
Production entry boundary: The CLI entry retains the failure handler before command execution and passes the invocation argv into the formatter. Added process cases remove installation files before throwing, covering both human and JSON markerless failures.
Findings None None.
Security None None.

How this fits together

The 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]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +12, Tests +38, Docs +1. Total +51 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 1 15 3 +12
Tests 5 50 12 +38
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 66 15 +51

Review metrics

Metric Value Why it matters
Production versus test growth production +12, tests +38 Production growth is justified by recognizing update invocations before the updater marker exists; tests cover formatting and installation-replacement boundaries.

Technical review

Best 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.

Labels

Label changes:

  • add P2: This repairs actionable update diagnostics with a limited presentation-only blast radius.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The verified repository-admin author qualifies for the maintainer exemption. Reported entry-process tests exercise the shared formatter after installation replacement in human and JSON modes; they are supplemental validation, and unrelated prior UI screenshots do not prove this CLI change. No stored-data contract changes.

Label justifications:

  • P2: This repairs actionable update diagnostics with a limited presentation-only blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The verified repository-admin author qualifies for the maintainer exemption. Reported entry-process tests exercise the shared formatter after installation replacement in human and JSON modes; they are supplemental validation, and unrelated prior UI screenshots do not prove this CLI change. No stored-data contract changes.

Evidence

What I checked:

  • Introduced change: The pinned merge-base-to-head patch adds command-aware update diagnostics and focused assertions; it contains no dependency, workflow, configuration, or stored-data changes. (src/cli/failure-output.ts:201, af67d270e982)
  • Repair remains necessary on main: Main's ordinary non-debug, markerless failure branch emits a reason only for an unreported invalid-config diagnostic. Ordinary update errors therefore still receive the generic lead and Doctor hint. (src/cli/failure-output.ts:237, d9ded6247e77)
  • Production entry boundary: The CLI entry retains the failure handler before command execution and passes the invocation argv into the formatter. Added process cases remove installation files before throwing, covering both human and JSON markerless failures. (src/entry.update-failure.process.test.ts:16, af67d270e982)
  • Verified merge result: The test merge records the pinned main parent followed by the exact PR head. Comparing its formatter against main yields the intended repair, preserving main's config-diagnostic work. (src/cli/failure-output.ts:247, dc5e7b5297ac)
  • Published behavior: The latest release, v2026.9.7, prints ordinary failure reasons by default. The missing-reason behavior is in subsequent main changes; this branch's repair is not already shipped. (src/cli/failure-output.ts, c074824a27c9)
  • Related concise-error implementation: fix: make common error messages short and helpful #163381 is merged and establishes the intentional concise-error contract. This PR preserves that contract while restoring update-specific detail; it is not superseded by that broader change. (src/cli/failure-output.ts, d0b48d63efb8)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 688f68e into main Oct 3, 2026
125 of 127 checks passed
@steipete
steipete deleted the ci/fix2-worker-ack-cli branch October 3, 2026 00:57
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 3, 2026
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant