Skip to content

fix(update): keep SQLite contention frames in bounded failure reports - #200322

Merged
roboclaw-bot merged 1 commit into
mainfrom
roboclaw/ur-200289-contention-frames
Nov 17, 2026
Merged

roboclaw-bot merged 1 commit into
mainfrom
roboclaw/ur-200289-contention-frames

Conversation

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Related #200289

What Problem This Solves

Failed-update diagnostics can discard the SQLite call site when a Doctor failure's stack appears in the middle of long stderr.

User Impact

Operators can inspect the contention error and up to 12 leading stack frames in the saved failure JSON linked from the update report and in repair prompts. This is a diagnostic improvement, not a root-cause fix for the SQLite lock or prolonged update reported in #200289.

Why This Change Was Made

The existing triage owner retains an optional sqliteContentionCallSite excerpt with the same secret/path redaction and a separate 1 KiB JSON-encoded UTF-8 cap. It survives artifact writing, reading, and prompt sanitization. Ordinary stderr retains its 384-byte head/tail limit, and the 8 KiB artifact and 4 KiB prompt-record limits still apply. Existing whole-record pruning can still omit older failed steps, and the byte cap can shorten long stacks.

The Markdown report already links this support JSON; its existing layout is unchanged. The failure-report documentation now describes the retained excerpt and bounds.

Evidence

  • Loss on the pinned base: src/infra/update-run-step.ts:105-110 drops ordinary exit-1 Doctor stderr from the ledger projection; src/infra/update-run-report.ts:433-440 bounds the summary to 300 characters and only emits stderr for signals or candidate snapshots. src/infra/update-failure-report-artifact.ts:33-35 likewise restricts its stderr appendix to signal failures and links support JSON at line 246. That JSON loses the middle stack at src/commands/triage-update.ts:371-374 (384-byte head/tail excerpt).
  • Red on base d29fad4e3e687dedf683e38ec35b12cb85510637: the middle-block regression failed; 12 existing tests passed. Fixed: 33 passed across four named files, including realistic multi-KB stderr, first-frame retention, the 12-frame limit, oversized UTF-8/JSON-escaped frames, redaction, repeated sanitization, rollback readers, prompt composition, and artifact writing.
  • Focused command: OPENCLAW_VITEST_RUNTIME=node timeout 120s pnpm test src/commands/triage-update.test.ts src/commands/triage-update-rollback.test.ts src/commands/triage-prompt.test.ts src/infra/update-failure-report-artifact.test.ts --maxWorkers=1. Runner wall time: 6.66 seconds; the changed-file command shard took 1.19 seconds. CI seconds are not yet available.
  • Touched-file type-aware lint and --type-check passed through scripts/run-oxlint.mjs; formatting and git diff --check passed. Broad validation is left to PR CI under the host's limits. The original production update incident was not reproduced.
  • Test-audit and pr-simplify completed: extraction stays in the existing sanitizer with one optional schema field. Against the base: production +12 lines, tests +85 net lines, docs +2 lines.
  • Independent local autoreview (Codex, P0-P2) reviewed the complete local candidate over the pinned base, including the full sanitizer and its artifact/prompt/redaction consumers: scoped-clean, no actionable findings. The reviewed candidate was committed unchanged as 7eceae3b44f3461db4e241af0f2de58e070b49fa. Local ClawSweeper was unavailable; hosted review follows the repository fallback.

Reported by @pestelence2k

Work sessions

Linked for team reference; these sessions aren’t public.

@clawsweeper

clawsweeper Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper review

Local ClawSweeper was unavailable; local autoreview completed without actionable P0-P2 findings. Please review the diagnostic-only change at 7eceae3, especially redaction, excerpt bounds, and preservation across repeated sanitization.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation commands Command implementations size: S labels Nov 17, 2026
@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 17, 2026
@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Preserves a separately bounded, redacted SQLite contention stack excerpt in update-failure JSON and repair prompts.

Example: An openclaw doctor failure contains Error: database is locked and DatabaseSync.exec (node:sqlite:367:10) midway through long stderr.

  • Before: The 384-byte head/tail excerpt can omit the error and its leading frames.
  • After: sqliteContentionCallSite retains the error and up to 12 leading frames within a separate 1024-byte JSON-encoded limit.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch is focused and source-reviewed without actionable findings, but supplied validation remains test-only.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: Saved update diagnostics can omit the SQLite frames needed to identify the failing operation.
Reason: The maintainer-authored direction addresses confirmed evidence loss with a narrow change and correctly uses Related for the broader incident.

Merge readiness

✅ Ready for maintainer review

This PR addresses a confirmed diagnostic-loss problem using the existing sanitizer; source review found no introduced correctness or security defect.

Priority: P2
Reviewed head: 7eceae3b44f3461db4e241af0f2de58e070b49fa

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Provide redacted terminal output or logs from an isolated shipped update/triage flow showing a middle contention stack retained in the saved JSON and generated prompt.
Agent review details

How this fits together

The triage sanitizer projects failed updater results into saved support artifacts and repair-agent context, applying shared redaction and whole-record byte limits.

flowchart LR
  A[Failed update stderr] --> B[Triage sanitizer]
  B --> C[Shared support redaction]
  C --> D[Bounded failure JSON]
  D --> E[Artifact reader]
  E --> F[Repair prompt]
Loading

Technical review

Best possible solution:

Keep the focused excerpt in the existing sanitizer while leaving the underlying contention and prolonged-update investigation with the linked issue.

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

Source inspection establishes that a stack in the middle of long stderr is omitted by current main; the PR reports a failing base regression, but this review ran no target code.

Is this the best way to solve the issue?

The smallest complete fix is the proposed optional excerpt in the existing sanitizer, preserving ordinary stderr, shared redaction, and aggregate bounds without adding another diagnostic owner.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +12, Tests +85, Docs +2. Total +99 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 12 0 +12
Tests 1 86 1 +85
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 100 1 +99

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Production versus test growth Production +12 lines; tests +85 net lines The small production addition reuses existing ownership; the tests cover distinct retention, redaction, and encoded-byte boundaries.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This improves diagnosis of failed updates without changing update execution or repairing the underlying outage.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach the shipped-flow diagnostic evidence described above, redacting IPs, API keys, phone numbers, and non-public endpoints.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 16, 2026, 7:30 PM ET / November 17, 2026, 00:30 UTC.

@roboclaw-bot
roboclaw-bot merged commit 1139903 into main Nov 17, 2026
138 checks passed
@roboclaw-bot
roboclaw-bot deleted the roboclaw/ur-200289-contention-frames branch November 17, 2026 00:43
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 17, 2026
…openclaw#200322)

Update failure JSON and repair prompts now also keep any "SQLite contention call site:" block from a failed step's stderr: the error line and its first 12 stack frames, redacted the same way as stderr and capped at 1 KiB. The 384-byte stderr excerpt can cut those frames, which is why the 2026.11.4 predecessor-stop receipt "database is locked" failure could not be traced to a specific SQLite operation. The existing stderr and overall record limits are unchanged.

Related openclaw#200289
Reported-by: @pestelence2k

Co-authored-by: steipete <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 18, 2026
#198968)

* fix(update): keep the failure that started recovery in failure reports

After any update failure, the recovery steps that follow also fail
(gateway migration recovery, package-backup-retention, gateway recovery
verification). The failure-report sanitizer kept only the latest three
failed steps and pruned oldest first, so the step that started recovery
was always dropped, and users could not report what went wrong.

Keep the first failed step alongside the latest two, and when the byte
budget forces pruning, drop middle records before it. The latest failure
still wins when only two remain.

Refs #197083

* test(update): expect the triggering failure in recovery triage prompts

The recovery triage prompt fixture has five failed steps. Failure reports now keep the first failed step with the latest two, so the oldest failure replaces the second-latest one in the expected prompt details.

Refs #197083

* fix(update): protect the latest failure when pruning failure reports

Pruning removed the second record when the trigger came first, so a retained lint inventory record after the latest failure made the latest failure the one dropped. Protect the trigger and the latest failure by identity, drop other records first, and drop the trigger before the latest failure.

Refs #197083

(cherry picked from commit 5df28e7)

Backport review: source applies unchanged. #200322 is orthogonal SQLite diagnostic enrichment; #200742 repairs a separate lease owner. Both are outside this report-retention fix.

Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 23, 2026
…#200322)

Update failure JSON and repair prompts now also keep any "SQLite contention call site:" block from a failed step's stderr: the error line and its first 12 stack frames, redacted the same way as stderr and capped at 1 KiB. The 384-byte stderr excerpt can cut those frames, which is why the 2026.11.4 predecessor-stop receipt "database is locked" failure could not be traced to a specific SQLite operation. The existing stderr and overall record limits are unchanged.

Related #200289
Reported-by: @pestelence2k

Co-authored-by: steipete <[email protected]>

(cherry picked from commit 1139903)
Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 4f16b8ec15a4c57de6bd8bdf67f96b2bca8f191b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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