Skip to content

fix(sqlite): explain read-only inspection failures during writes - #147476

Merged
obviyus merged 2 commits into
mainfrom
bugloop/sqlite-readonly-error-guidance
Sep 13, 2026
Merged

obviyus merged 2 commits into
mainfrom
bugloop/sqlite-readonly-error-guidance

Conversation

@obviyus

@obviyus obviyus commented Sep 13, 2026 •

Copy link
Copy Markdown
Collaborator

Supersedes #146725 by @SunnyShu0925.

What Problem This Solves

Plugin inspection can fail during database writes without explaining the bounded failure or what to do next.

User Impact

The error names ten attempts, identifies concurrent writes as a possible cause, and tells the operator to wait for writes to settle and retry. It does not promise success during continuous writes. Risk is low and limited to diagnostic text.

Why This Change Was Made

The existing snapshot owner supplies the message for both strategies. The contributor's production change is unchanged; retries, source checks, canonical path, retained cause, and safe error propagation stay intact.

Each corrected test now captures one error per mode and checks the exact count, qualified explanation, complete guidance, source path, and source-change cause. Cause prose must stay out of the top-level message.

Evidence

Retained real CLI proof for the unchanged production patch: pnpm openclaw plugins info canvas --json, with an isolated Gateway, synthetic SQLite state, and a sustained writer. Both versions exit 1 during writes and pass before writes and after the writer stops. The failure occurs during config readiness, before plugin inspection dispatch.

Main 8cba5e03ddb45, stderr with the source path redacted:

[openclaw] Reason: SQLite read-only worker SQLite source did not stabilize for read-only inspection: <source>

Contributor 5c76eff645e8, with the same redaction:

[openclaw] Reason: SQLite read-only worker SQLite source did not stabilize after 10 read-only inspection attempts (the database may be under concurrent write activity): <source>. Wait a moment for write activity to settle, then retry the inspection

The corrected tests fail on main e0cf191e2557 for the three missing guidance fields and pass on this branch. The cause and privacy assertions pass on both.

Fresh merge 95650108b296 of f7faef2077e1 with main f6f241952b0e passed 1,088 tests across 13 selected files, including both corrected cases, CLI inspection, snapshot readers, cleanup, error formatting, and routing assertions. One existing Linux-only case was skipped on macOS. The consistent no-color environment preserves the earlier stderr-fixture diagnosis; no assertion or skip was weakened. Changed-file lint, formatting, line limits, and assertion checks passed. Typechecks were not run locally.

Consumers

  • CLI startup and plugin inspection, ownership admission, shared-state reads, Doctor/schema checks, update inspection and recovery, task recovery, cron, legacy auth inspection, memory diagnostics, and public snapshot helpers retain their existing control flow.
  • Backup discovery and config revalidation use the shared online snapshot scope introduced by fix(backup): preserve discovery under concurrent state writes #146912. Verified backup/checkpoint creation can also use journal-aware snapshot preparation. Failure still stops publication and carries the underlying diagnostic; no consumer parses the old exhaustion text.
  • Worker output, CLI JSON/stderr, and startup diagnostic logs consume the owner-generated message. Existing wrappers may add their own operation context.
  • Best-effort config-health reads and driving-updater inspection retain their existing suppression rules. Not every consumer displays the message.
  • No persisted state, cache invalidation, public function signature, schema, migration, config key, protocol, or retry-policy change is included.

AI-assisted.

SunnyShu0925 and others added 2 commits September 14, 2026 03:36
…y guidance

The stabilization error message was generic ("did not stabilize for
read-only inspection") with no retry count, contention context, or
actionable next step. When the Gateway is actively writing to the state
database, plugin inspection can exhaust all snapshot retries; the
generic message implied corruption rather than transient contention.

Include the retry count, name the cause (continuous writes), and advise
waiting for write activity to settle before retrying, matching the
actionable pattern already used by the SQLite inspection timeout error.

Closes #145995

(cherry picked from commit 5c76eff)
@clawsweeper

clawsweeper Bot commented Sep 13, 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 size: S maintainer Maintainer-authored PR labels Sep 13, 2026
@obviyus

obviyus commented Sep 13, 2026

Copy link
Copy Markdown
Collaborator Author

landpr-approve-admin-merge
pr: 147476
head: f7faef2
scope: owner-review

@obviyus
obviyus marked this pull request as ready for review September 13, 2026 22:19
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. labels Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed September 13, 2026, 6:19 PM ET / 22:19 UTC.

ClawSweeper review

What this changes

Adds retry counts, possible write-contention context, and recovery guidance to SQLite inspection failures, with regression coverage for synchronous and asynchronous inspection.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: current main and v2026.9.4 still emit the generic diagnostic. The retained CLI evidence supports this focused improvement, and no actionable correctness or security defect was found.

Priority: P3
Reviewed head: f7faef2077e14e34e71e6aaadbdae8c67e16fced

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused diagnostic repair with relevant real CLI evidence, meaningful regression assertions, and no actionable findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): Retained before/after CLI output exercises the snapshot owner through plugin-command config readiness against synthetic SQLite state under sustained writes and shows the new retry guidance. Success before contention and after writer shutdown is recorded; the two exhaustion tests provide supplemental coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): Retained before/after CLI output exercises the snapshot owner through plugin-command config readiness against synthetic SQLite state under sustained writes and shows the new retry guidance. Success before contention and after writer shutdown is recorded; the two exhaustion tests provide supplemental coverage.
Evidence reviewed 8 items Verified introduced change: The merge-base-to-head diff changes only the two terminal diagnostic messages and adds a table-driven regression test. Retry limits, source checks, snapshot strategies, and retained causes are unchanged.
Current main still lacks the guidance: Both exhaustion paths retain the generic 'did not stabilize for read-only inspection' message on fetched main.
Latest release retains the old diagnostic: GitHub’s contents API confirms v2026.9.4 has ten-attempt loops and the generic error at both exhaustion sites. This API read supplied the release source after its local blob could not be retrieved.
Findings None None.
Security None None.

How this fits together

OpenClaw’s SQLite snapshot layer prepares consistent private database copies for diagnostic callers. When the source cannot stabilize, its error travels through the read-only worker to the requesting CLI command.

flowchart TD
 A[Diagnostic command] --> B[SQLite snapshot owner]
 C[Database and journal files] --> B
 B --> D{Stable within ten attempts?}
 D -->|Yes| E[Private snapshot]
 D -->|No| F[Failure with retry guidance]
 F --> G[Worker and CLI output]
Loading

Before merge

  • Complete next step (P2) - Mark the draft ready for review before landing.
Agent review details

Security

None.

PR surface

Source +6, Tests +42. Total +48 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 12 6 +6
Tests 1 42 0 +42
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 54 6 +48

Review metrics

None.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #145995
Summary: This PR implements the report’s actionable-failure alternative and adopts the earlier contributor patch; neither implementation is established as merged.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep actionable failure guidance in the existing snapshot owner while preserving bounded retries, source integrity, and safe error propagation.

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

Yes, for the diagnostic gap: current source emits the generic error after ten exhausted attempts, and the supplied CLI trace exercises that failure under sustained writes. This review did not execute a current-main reproduction.

Is this the best way to solve the issue?

Yes. Updating the existing owner’s two messages satisfies the reported actionable-failure alternative without changing snapshot strategy or adding another recovery mechanism.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This improves operator-facing diagnostic guidance without changing inspection or storage behavior.
  • add proof: sufficient: Contributor real behavior proof is sufficient. Retained before/after CLI output exercises the snapshot owner through plugin-command config readiness against synthetic SQLite state under sustained writes and shows the new retry guidance. Success before contention and after writer shutdown is recorded; the two exhaustion tests provide supplemental coverage.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): Retained before/after CLI output exercises the snapshot owner through plugin-command config readiness against synthetic SQLite state under sustained writes and shows the new retry guidance. Success before contention and after writer shutdown is recorded; the two exhaustion tests provide supplemental coverage.

Label justifications:

  • P3: This improves operator-facing diagnostic guidance without changing inspection or storage behavior.
  • 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 (terminal): Retained before/after CLI output exercises the snapshot owner through plugin-command config readiness against synthetic SQLite state under sustained writes and shows the new retry guidance. Success before contention and after writer shutdown is recorded; the two exhaustion tests provide supplemental coverage.
  • proof: sufficient: Contributor real behavior proof is sufficient. Retained before/after CLI output exercises the snapshot owner through plugin-command config readiness against synthetic SQLite state under sustained writes and shows the new retry guidance. Success before contention and after writer shutdown is recorded; the two exhaustion tests provide supplemental coverage.

Evidence

What I checked:

  • Verified introduced change: The merge-base-to-head diff changes only the two terminal diagnostic messages and adds a table-driven regression test. Retry limits, source checks, snapshot strategies, and retained causes are unchanged. (src/infra/sqlite-readonly-location.ts:543, f7faef2077e1)
  • Current main still lacks the guidance: Both exhaustion paths retain the generic 'did not stabilize for read-only inspection' message on fetched main. (src/infra/sqlite-readonly-location.ts:542, 8dad5c545754)
  • Latest release retains the old diagnostic: GitHub’s contents API confirms v2026.9.4 has ten-attempt loops and the generic error at both exhaustion sites. This API read supplied the release source after its local blob could not be retrieved. (src/infra/sqlite-readonly-location.ts:573, 3a9d69db306c)
  • Retained real CLI evidence: The fully supplied body at sourceRevision 33dd428a4f7f95579d79576499f13538d2a45dffc369811b98e4c4c070904f57 records before/after pnpm openclaw plugins info canvas --json output using isolated synthetic state and a sustained writer. The unchanged production patch emits the new guidance during config readiness; both versions fail during writes and succeed before writes and after the writer stops. The body separately reports corrected regression tests failing before the fix and passing afterward. These are supplied observations, not executions performed by this review. (f7faef2077e1)
  • Error propagation preserves the privacy boundary: The worker invokes the changed snapshot owner and serializes its top-level message plus bounded safe error codes. Existing worker tests exclude arbitrary cause prose, SQL, stacks, and metadata; the patch does not alter this contract. (src/infra/sqlite-readonly-location.worker.ts:53, f7faef2077e1)
  • Related report and contributor implementation: Plugin inspection intermittently fails: SQLite state source did not stabilize #145995 explicitly accepts a bounded actionable retry result while preserving source integrity. The supplied context identifies fix(sqlite): explain exhausted read-only inspection retries with retry guidance #146725 as the open contributor implementation adopted by this PR, with its production change and real contention evidence retained.

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • SunnyShu0925: 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.

@obviyus
obviyus merged commit 4bdf3ca into main Sep 13, 2026
263 checks passed
@obviyus
obviyus deleted the bugloop/sqlite-readonly-error-guidance branch September 13, 2026 22:43
@obviyus

obviyus commented Sep 13, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks @SunnyShu0925!

Proof: Plugin inspection against synthetic SQLite state reported the actionable error during sustained writes and succeeded before writes and after the writer stopped.

  • Bug: Read-only inspection could fail without explaining the exhausted attempts or the next action.
  • Fix: The snapshot owner reports ten attempts, possible write contention, and wait-and-retry guidance while preserving the cause.
Before After
Unexplained stabilization failure Attempt count, possible cause, and a useful retry step

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
…nclaw#147476)

Supersedes openclaw#146725 by @SunnyShu0925.

## What Problem This Solves

Plugin inspection can fail during database writes without explaining the bounded failure or what to do next.

## User Impact

The error names ten attempts, identifies concurrent writes as a possible cause, and tells the operator to wait for writes to settle and retry. It does not promise success during continuous writes. Risk is low and limited to diagnostic text.

## Why This Change Was Made

The existing snapshot owner supplies the message for both strategies. The contributor's production change is unchanged; retries, source checks, canonical path, retained cause, and safe error propagation stay intact.

Each corrected test now captures one error per mode and checks the exact count, qualified explanation, complete guidance, source path, and source-change cause. Cause prose must stay out of the top-level message.

## Evidence

Retained real CLI proof for the unchanged production patch: `pnpm openclaw plugins info canvas --json`, with an isolated Gateway, synthetic SQLite state, and a sustained writer. Both versions exit 1 during writes and pass before writes and after the writer stops. The failure occurs during config readiness, before plugin inspection dispatch.

Main `9977306fec733`, stderr with the source path redacted:

```text
[openclaw] Reason: SQLite read-only worker SQLite source did not stabilize for read-only inspection: <source>
```

Contributor `5c76eff645e8`, with the same redaction:

```text
[openclaw] Reason: SQLite read-only worker SQLite source did not stabilize after 10 read-only inspection attempts (the database may be under concurrent write activity): <source>. Wait a moment for write activity to settle, then retry the inspection
```

The corrected tests fail on main `56bde7c0bcd4` for the three missing guidance fields and pass on this branch. The cause and privacy assertions pass on both.

Fresh merge `95650108b296` of `f7faef2077e1` with main `fcf8cfbaba0b` passed 1,088 tests across 13 selected files, including both corrected cases, CLI inspection, snapshot readers, cleanup, error formatting, and routing assertions. One existing Linux-only case was skipped on macOS. The consistent no-color environment preserves the earlier stderr-fixture diagnosis; no assertion or skip was weakened. Changed-file lint, formatting, line limits, and assertion checks passed. Typechecks were not run locally.

## Consumers

- CLI startup and plugin inspection, ownership admission, shared-state reads, Doctor/schema checks, update inspection and recovery, task recovery, cron, legacy auth inspection, memory diagnostics, and public snapshot helpers retain their existing control flow.
- Backup discovery and config revalidation use the shared online snapshot scope introduced by openclaw#146912. Verified backup/checkpoint creation can also use journal-aware snapshot preparation. Failure still stops publication and carries the underlying diagnostic; no consumer parses the old exhaustion text.
- Worker output, CLI JSON/stderr, and startup diagnostic logs consume the owner-generated message. Existing wrappers may add their own operation context.
- Best-effort config-health reads and driving-updater inspection retain their existing suppression rules. Not every consumer displays the message.
- No persisted state, cache invalidation, public function signature, schema, migration, config key, protocol, or retry-policy change is included.

AI-assisted.

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

Labels

maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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.

2 participants