Repository navigation
fix(sqlite): explain read-only inspection failures during writes - #147476
Conversation
…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)
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
landpr-approve-admin-merge |
|
Codex review: needs changes before merge. Reviewed September 13, 2026, 6:19 PM ET / 22:19 UTC. ClawSweeper reviewWhat this changesAdds 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 Review scores
Verification
How this fits togetherOpenClaw’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]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +6, Tests +42. Total +48 across 2 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest 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. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
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.
|
…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]>
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:Contributor
5c76eff645e8, with the same redaction:The corrected tests fail on main
e0cf191e2557for the three missing guidance fields and pass on this branch. The cause and privacy assertions pass on both.Fresh merge
95650108b296off7faef2077e1with mainf6f241952b0epassed 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
AI-assisted.