Skip to content

fix(update): failed-update records hide the triggering error behind the excerpt tail - #144729

Merged
steipete merged 2 commits into
openclaw:mainfrom
Richard355168:fix/update-failure-record-excerpt
Sep 11, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
Richard355168:fix/update-failure-record-excerpt

Conversation

@Richard355168

@Richard355168 Richard355168 commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Related: #144712 (the failure-record observability half; the rollback-verification design and docs asks there remain open)

What Problem This Solves

Fixes an issue where operators diagnosing a failed openclaw update would lose the triggering error whenever a failed step's stderr exceeded the excerpt budget: the update-failure record caps each step's stderr excerpt to a tail-only 160-byte slice, so a multi-part diagnostic (leading error, then recovery verdict) reaches openclaw-update-failure-*.json as a mid-word fragment with no root cause. Observed on a 2026.9.3 → 2026.9.4 npm user-global update (#144712): two deterministic global install swap failures were recorded as …etained package tree changed …, and the swap error that started the rollback was unrecoverable from any artifact — diagnosing it required reading the updater source.

Why This Change Was Made

Failed-step stderr leads with the triggering error and ends with the outcome, so the stderr excerpt keeps both ends: the sanitizer's existing ends mode at a 384-byte cap. The tail half stays wider than the previous tail-only window, so every excerpt that was visible before remains visible; the head now carries the triggering error. stdout excerpts keep their tail-only outcome form. Excerpt caps elsewhere, the 4 KiB prompt-fit loop, and the run-record summary's final-lines-only contract are unchanged — that summary and the live console line are deliberately left as they are (their behavior is pinned by update-run-report.test.ts), and both are noted in #144712 for a separate discussion.

User Impact

Operators and support agents reading openclaw-update-failure-*.json or the update triage prompt now see the start of the triggering error (for example, the swap failure reason) next to the final recovery verdict instead of a truncated mid-word fragment, so failed-update diagnosis no longer requires source access. Previously visible excerpts remain visible.

Evidence

  • src/commands/triage-update.test.ts gains a case whose stderr leads with the triggering error and spans multiple rollback detail lines: under the new excerpt the record contains the leading diagnostic, the outcome tail, and the ellipsis; the file's suite passes.
  • The head assertion is unsatisfiable under the previous tail-only excerpt: the fixture's leading diagnostic lies outside its 160-byte tail window, so the case discriminates the previous behavior.
  • Previously visible content stays visible: the new tail window is strictly wider than the previous one, which is what triage-recovery.test.ts relies on via StringContaining diagnostics.
  • oxfmt --check clean on the touched files; typecheck and lint run in CI.

Real-behavior proof (after fix)

A real openclaw update run (2026.9.3 → 2026.9.4, npm global install inside an isolated global prefix with a fresh state dir, --no-restart) reproduced the #144712 swap failure end to end — staging, migration rehearsal, doctor lint, config validation, plugin resolution, and the gateway canary all passed, then global install swap exited 1, matching the deterministic failure reported from two machines. The failure record written by this patch retains both ends of the failed step's stderr:

{"name": "global install swap", "exitCode": 1, "stderrTail": "Package rollback verification timed out Package rollback verification failed: retained package tree changed Installation recovery is unverified; inspect the installation and backups in <globalRoot> before restarting."}

The leading sentence — Package rollback verification timed out — is the triggering error that every pre-fix record erased: the two records in #144712 and the reporter's diagnostics all begin mid-word with …etained package tree changed. Under the previous 160-byte tail-only excerpt this head was unrecoverable; with the 384-byte ends excerpt the whole excerpt fits under the cap and is preserved verbatim. The same run also surfaced the likely mechanism behind the deterministic failures: the swap's package integrity scan hits its time budget on real installation trees, which aborts the swap and starts the rollback whose re-verification then reports the tree as changed.

@clawsweeper

clawsweeper Bot commented Sep 11, 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 commands Command implementations size: S labels Sep 11, 2026
A failed update step's stderr leads with the triggering error and ends
with the outcome, but the failure record capped each step's stderr
excerpt to a tail-only 160-byte slice, so the leading swap or install
error reached the failure JSON and the triage prompt as a mid-word
fragment with no root cause.

Keep both ends for stderr with the sanitizer's existing ends mode at a
384-byte cap: the tail half stays wider than the previous tail-only
window, so every excerpt that was visible before remains visible, and
the head now carries the triggering error. stdout excerpts keep their
tail-only outcome form, and the run-record summary keeps its
final-lines-only contract; both boundaries are noted in openclaw#144712.

Related: openclaw#144712
@Richard355168
Richard355168 force-pushed the fix/update-failure-record-excerpt branch from 04112e2 to 5e98327 Compare September 11, 2026 07:10
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 11, 2026, 4:32 AM ET / 08:32 UTC (Revision 3).

ClawSweeper review

What this changes

Preserve both ends of failed-update stderr in saved diagnostics and triage prompts, with regression coverage.

Merge readiness

✅ Ready for maintainer review

The fix remains necessary: current main and v2026.9.4 still discard the leading diagnostic. The supplied real-update evidence supports the change, and this review found no blocking defect.

Priority: P2
Reviewed head: 3303362eeff4f3a0fefd9dc9400fd1bc34c309c1

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with relevant real-update output, meaningful regression coverage, and no blocking findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The captured PR body shows a real isolated npm update producing a failure record that retains the leading timeout and final recovery verdict through the changed sanitizer; the reviewed code is unchanged since that proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured PR body shows a real isolated npm update producing a failure record that retains the leading timeout and final recovery verdict through the changed sanitizer; the reviewed code is unchanged since that proof.
Evidence reviewed 8 items Current main still needs the fix: Current main retains the 160-byte tail-only stderr excerpt; comparison against the reviewed head shows only the introduced sanitizer change and regression test in these files.
Latest release has the same limitation: The supplied latest release, v2026.9.4, also uses the 160-byte tail-only stderr excerpt.
Shared sanitizer preserves existing safeguards: The changed field uses the existing ends mode. Redaction precedes truncation, JSON-encoded byte accounting remains active, the whole-record limit remains 4 KiB, and writes retain private file permissions. No schema, authorization, or dependency change is introduced.
Findings None None.
Security None None.

How this fits together

The updater passes failed-step output through a shared sanitizer before saving support records or preparing repair prompts. This change improves the diagnostic excerpt without changing update execution or rollback decisions.

flowchart LR
  A[Failed update step] --> B[Captured error output]
  B --> C[Redact private information]
  C --> D[Keep bounded beginning and end]
  D --> E[Saved failure record]
  D --> F[Repair prompt]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +3, Tests +36. Total +39 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 4 1 +3
Tests 1 36 0 +36
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 40 1 +39

Review metrics

Metric Value Why it matters
Diagnostic budget stderr: 160 → 384 bytes; record: unchanged at 4 KiB The larger field preserves the leading error while retaining the existing total diagnostic bound.

Technical review

Best possible solution:

Keep diagnostic excerpt selection in the shared sanitizer while leaving rollback verification and recovery guidance to the broader linked issue.

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

Yes, source establishes that sufficiently long stderr loses its leading error under current main's tail-only excerpt; the linked report supplies real examples. This review did not execute an update.

Is this the best way to solve the issue?

Yes, reusing the existing bounded excerpt mode in the shared sanitizer is a focused repair, supported by a saved-artifact regression and real after-fix output.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against f6b64c3915ee.

Labels

Label justifications:

  • P2: This repairs diagnostic loss during failed updates without changing installation or recovery execution.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The captured PR body shows a real isolated npm update producing a failure record that retains the leading timeout and final recovery verdict through the changed sanitizer; the reviewed code is unchanged since that proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured PR body shows a real isolated npm update producing a failure record that retains the leading timeout and final recovery verdict through the changed sanitizer; the reviewed code is unchanged since that proof.

Evidence

What I checked:

  • Current main still needs the fix: Current main retains the 160-byte tail-only stderr excerpt; comparison against the reviewed head shows only the introduced sanitizer change and regression test in these files. (src/commands/triage-update.ts:298, f6b64c3915ee)
  • Latest release has the same limitation: The supplied latest release, v2026.9.4, also uses the 160-byte tail-only stderr excerpt. (src/commands/triage-update.ts:298, 3a9d69db306c)
  • Shared sanitizer preserves existing safeguards: The changed field uses the existing ends mode. Redaction precedes truncation, JSON-encoded byte accounting remains active, the whole-record limit remains 4 KiB, and writes retain private file permissions. No schema, authorization, or dependency change is introduced. (src/commands/triage-update.ts:301, 3303362eeff4)
  • After-fix production-path evidence: The captured PR body, sourceRevision af86055b618baf91322293be257fe198219418a23dd625356db731e763f7f960, describes an isolated npm-global 2026.9.3-to-2026.9.4 update with --no-restart. Its copied failure record retains both the leading rollback-verification timeout and final recovery verdict. This directly exercises the changed failure-record behavior. (5e98327a8a06)
  • Review continuity: The production file and test are unchanged since the previously reviewed head. The prior completed review had no findings; its earlier proof request is addressed by the captured after-fix record. (src/commands/triage-update.ts:301, 3303362eeff4)
  • Related issue remains broader: [Bug]: npm update fails at "global install swap"; intact rollback reported as "recovery is unverified" #144712 is the same author's open report covering diagnostic loss, rollback verification, and recovery guidance. This PR addresses only diagnostic loss and does not resolve the whole report.

Likely related people:

  • Peter Steinberger: 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)

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.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-11T07:34:13.831Z sha 5e98327 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-11T08:00:19.650Z sha 5e98327 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 11, 2026
@steipete
steipete merged commit b590774 into openclaw:main Sep 11, 2026
208 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 11, 2026
Preserve the reviewed harness while incorporating the landed benchmark prerequisite.

Punchcard-Session: coral-orchard-orchard-d4

* commit '4407ed19ac63b1c1c84a0cfe6eb4bbeca9c2322c': (1196 commits)
  fix(perf): isolate benchmark subprocess transport (#144159)
  refactor(auth): await Copilot cache persistence (#144810)
  refactor(web-fetch): exercise URL normalization through the public tool (#144887)
  fix(ollama): preserve hosted subdomain model context (#144891)
  fix(doctor): explain Codex plugin health failures (#144813)
  fix(channels): honor pinned accounts in Mattermost model menus (#144880)
  fix(update): failed-update records hide the triggering error behind the excerpt tail (#144729)
  fix(logging): preserve OpenClaw package references in diagnostics (#144808)
  fix: retain plugin detail tab selections while inspection loads (#144647)
  fix: keep discovered models when sign-in tokens renew (#144861)
  fix(update): preserve local package overrides (#89985)
  fix(update): resolve compatibility bridges within the runtime graph (#144831)
  chore(i18n): refresh native locales (#144856)
  fix: preserve child signal termination during CLI respawn (#144838)
  fix(text): hide encoded MiniMax tool envelopes (#126307)
  fix(subagents): deliver child replies that match the empty placeholder (#130647)
  fix(cli): reject blank message channel selectors (#144802)
  fix(telegram): preserve mixed text order and pending stop (#144839)
  fix(memory): restore FTS fallback for same-name view collisions (#144783)
  chore(release): close out 2026.9.4 on main (#144708)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 12, 2026
…he excerpt tail (openclaw#144729)

Preserve the triggering error in failed-update diagnostic records and triage prompts by using the shared sanitizer's existing 384-byte head-and-tail stderr excerpt. The previous 160-byte tail-only excerpt could erase the initiating error behind rollback details. The saved-artifact regression covers both the leading diagnostic and final recovery verdict.

Redaction still precedes truncation, and the diagnostic JSON and triage prompt retain their existing 4 KiB and 8 KiB bounds. Update execution, rollback decisions, and ledger summaries are unchanged.

Related: openclaw#144712. This repairs its diagnostic-loss symptom; openclaw#144758 addresses the triggering update failure.

Validation: exact-head CI run 34579194228 succeeded, including build, lint, types, and test shards. ClawSweeper found no blocking defect; independent maintainer review was clean at P0/P1. Contributor-recorded isolated update output retains the leading timeout and final recovery verdict. Contributor code was not executed locally during landing.

Thanks @Richard355168.

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

Labels

commands Command implementations P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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.

2 participants