Skip to content

fix(update): record terminal failures before offering reports - #158354

Merged
steipete merged 1 commit into
mainfrom
upd/closed-report-terminal-recording
Sep 25, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/closed-report-terminal-recording

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes failed CLI updates reaching the interactive report with no recorded phase or reason when executor admission, settlement, or terminal publication throws outside the inner update callback.

Refs #158187.

User Impact

The failure menu receives a recorded outcome with the reached phase, sanitized cause, and explicit rollback disposition. Pending recovery keeps its original diagnostic and owning history; a wrapped pending outcome cannot start an empty-report or automatic-repair flow.

Why This Change Was Made

The terminal-result owner now handles unclassified exceptions before triage, after checking that diagnostic writes are safe. Errors that already carry an owner's structured result retain it instead of rebuilding it from a bounded aggregate message. Triage recognizes the existing pending/finalized markers through their error graph, keeping command-cleanup protection first.

Reporting observers receive only confirmed publication results, once. Observer failures warn without replacing the committed outcome. Previously finalized history remains unchanged. This fixes the installed updater; older discarded diagnostics cannot be reconstructed from a report or supplied retroactively by candidate code.

Evidence

The final ten-case terminal-to-triage regression failed on the original implementation and passed three times on a Blacksmith Testbox using pnpm test src/cli/update-cli/update-command-terminal-unreported.test.ts --maxWorkers=1. Measured wall times were 17.305, 17.178, and 17.427 seconds, with 1.557, 2.061, and 1.710 seconds of test time. Shared preparation dominated wall time.

All 25 importing/sibling files passed: 450 tests across five routed projects, 171.176 seconds total. This includes the existing inspection-failure cases that caught a draft implementation truncating the original SQLite error; those original assertions now pass unchanged.

Exact-source independent Codex autoreview is scoped-clean at P0–P2. node scripts/check-changed.mjs -- <four changed paths> passed all 25 test-type graphs, lint (zero warnings/errors), and guards in 1838.312 seconds. The complete remote command finished successfully in 38m37.832s on lease tbx_01m3d53sy16nh01g9q5cz5nhsr (Testbox run). CI timing is pending the PR run. Proof uses isolated Linux state and does not establish the original reporter's missing exception.

Change size: production +101/−16 lines; tests +300/−0; docs +7/−0.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes size: M labels Sep 25, 2026
@steipete
steipete marked this pull request as ready for review September 25, 2026 21:28
@clawsweeper

clawsweeper Bot commented Sep 25, 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.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 25, 2026
@clawsweeper

clawsweeper Bot commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 25, 2026, 5:54 PM ET / 21:54 UTC.

ClawSweeper review

What this changes

The branch records unexpected CLI update failures in existing run history before failure triage, preserves wrapped recovery outcomes, adds regression tests, and documents the behavior.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 5 items remain

Current main still has the reported terminal-reporting gap, so this PR remains useful. One new fallback path reports recovery as pending even when update history records success, and the required installed-update proof is not shown.

Priority: P2
Reviewed head: 11583451236b22d3fd17533d240cb36a0f93a9de

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) PR readiness rating was derived from proof quality, review findings, security review, and reviewer confidence.
Proof confidence 🌊 off-meta tidepool Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 9 items Introduced fallback: The new catch wraps failures after terminal publication in a pending-recovery result when it cannot record another failure.
Finalized publication case: The added test models a publisher that finishes the run as succeeded and then throws. It checks that history is preserved and triage is skipped, but does not check the pending-recovery message printed by the fallback.
User-facing consequence: Triage recognizes the new pending marker and calls the reporter, which prints “Update recovery remains pending.”.
Findings 1 actionable finding [P2] Preserve a finalized outcome when publication fails
Security None None.

How this fits together

The openclaw update CLI runs an installation attempt, settles its executor, and records the outcome in update history. Its terminal-result layer then supplies the result to failure reporting and recovery triage.

flowchart LR
 A[CLI update request] --> B[Update executor]
 B --> C[Terminal result owner]
 C --> D{Safe history outcome?}
 D -->|Recorded| E[Update history]
 D -->|Recovery pending| F[Pending recovery message]
 E --> G[Result or failure triage]
Loading

Before merge

  • Preserve a finalized outcome when publication fails (P2) - When a publisher commits a succeeded run and then throws, as the new completed-publication test models, this catch finds no running row and wraps a synthetic update-failed result as pending recovery. Outer triage then prints “Update recovery remains pending” although history says succeeded. Report the publication failure without relabeling the completed update, and assert the visible message in the regression.
  • Resolve merge risk (P1) - A publication error after a durable success currently produces a false pending-recovery message, which could mislead an operator about the completed update.
  • Resolve merge risk (P1) - The cited Testbox tests exercise synthetic runs and a mocked interactive action; the root update policy's published-driver × candidate proof remains unshown.
  • Complete next step (P2) - Correct the finalized-publication message and add published-driver × candidate update proof before merge; redact private paths, endpoints, and credentials from the evidence.
  • Improve patch quality - Address the highest-priority review finding and re-run the changed-surface validation.

Findings

  • [P2] Preserve a finalized outcome when publication fails — src/cli/update-cli/update-command-terminal.ts:259-269
Agent review details

Security

None.

PR surface

Source +85, Tests +300, Docs +7. Total +392 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 101 16 +85
Tests 1 300 0 +300
Docs 1 7 0 +7
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 408 16 +392

Review metrics

Metric Value Why it matters
Production and test growth production +101/−16, tests +300/−0 The production fallback is substantial; the new tests cover history and triage, but omit the finalized-success message.

Merge-risk options

Maintainer options:

  1. Preserve finalized reporting (recommended)
    Handle a publication failure after ledger finalization as a presentation error, preserve the recorded outcome, and assert the operator-facing message.

Technical review

Best possible solution:

Keep failure recording with the terminal-result owner, while reporting post-commit presentation failures without recasting a finalized run as pending recovery.

Do we have a high-confidence way to reproduce the issue?

Yes for the source-level reporting gap: inject a terminal publisher exception around a recorded CLI run and inspect the history and failure report. The original reporter's exception remains unknown, and this review did not execute the path.

Is this the best way to solve the issue?

Mostly yes: the terminal-result owner is the right place to record failures before triage. The branch must distinguish finalized publication failures from genuinely pending recovery.

Full review comments:

  • [P2] Preserve a finalized outcome when publication fails — src/cli/update-cli/update-command-terminal.ts:259-269
    When a publisher commits a succeeded run and then throws, as the new completed-publication test models, this catch finds no running row and wraps a synthetic update-failed result as pending recovery. Outer triage then prints “Update recovery remains pending” although history says succeeded. Report the publication failure without relabeling the completed update, and assert the visible message in the regression.
    Confidence: 0.91

Overall correctness: patch is incorrect
Overall confidence: 0.89

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 800bf8e10e7c.

Labels

Label changes:

  • add P2: This repairs update-failure diagnostics with limited blast radius, while a misleading terminal edge case still needs correction.
  • add merge-risk: 🚨 other: The added fallback can tell users recovery is pending after a successful update was already committed.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Label justifications:

  • P2: This repairs update-failure diagnostics with limited blast radius, while a misleading terminal edge case still needs correction.
  • merge-risk: 🚨 other: The added fallback can tell users recovery is pending after a successful update was already committed.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Jason (Json): Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • RoboClaw: 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 enabled auto-merge (squash) September 25, 2026 22:37
@steipete
steipete merged commit b31c0ac into main Sep 25, 2026
268 of 269 checks passed
@steipete
steipete deleted the upd/closed-report-terminal-recording branch September 25, 2026 22:38
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 26, 2026
roboclaw-bot added a commit that referenced this pull request Sep 27, 2026
Backport #158354 from b31c0ac.
Backport #158455 from 31cd888.
Source author: Peter Steinberger.

Record otherwise-unreported settled failures before interactive reporting;
keep nested primary failures, pending recovery and committed outcomes intact.
Observer failures cannot replace or redeliver terminal results.

Distinguish config-read-failed from invalid-config at the target's existing
owners. Keep local rejected-field detail while masking operator keys and values
in public reports. Do not import main-only candidate admission or alter no-op
ordering. Preserve unavailable-source write fencing.

Move all three legacy result assertions to a complete typed snapshot fixture.
Repair the preexisting settlement test's incomplete ChildProcess cast with an
unspawned real ChildProcess, retaining the seven original assertions.

Proof: terminal 10 red then 77 green; installed config 8, classification 20,
public reporting 106, triage 66, migrated assertions 3, config siblings 79,
settlement fixture 7. These are distinct scoped receipts, not a full-suite claim.
Production and owning CLI/config/services types, lint, frozen ratchets and
independent review pass. Unchanged linked-plugin/real-npm baseline failures
remain recorded. Database composition proof and publication remain pending.

Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vyctorbrzezowski <[email protected]>
Co-authored-by: steipete <[email protected]>
Co-authored-by: jalehman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant