Repository navigation
refactor(sqlite): share bounded worker error diagnostics - #138520
Conversation
Reuse the existing SQLite error-code suffix helper in the snapshot worker while preserving its base message and every worker envelope, exit, classification, and cleanup contract. Remove the duplicated bounded extraction policy without adding API or test seams. Related: snapshot diagnostics #137999 and verifier diagnostics #138095. Production +4/-27; tests unchanged. Focused boundary suites, byte-equivalent synthetic process captures, changed checks, full build, and Codex autoreview passed.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
|
Codex review: blocked before merge. Reviewed September 4, 2026, 3:36 PM ET / 19:36 UTC. ClawSweeper reviewWhat this changesThe PR replaces the read-only SQLite snapshot worker’s duplicate bounded error-code formatter with the shared SQLite diagnostic suffix helper. Warning SQLite table change This PR modifies persisted SQLite tables in Merge readiness⛔ Blocked before merge - 3 items remain Keep open for final maintainer handling: the behavior-neutral consolidation is not on current main, preserves the established bounded diagnostic contract, and has no actionable correctness finding. Priority: P3 Review scores
Verification
How this fits togetherThe read-only SQLite worker prepares database snapshots in a child process and returns a compact JSON result to the parent snapshot flow. Its error formatter determines which bounded native error codes operators can see when preparation fails. flowchart LR
A[Snapshot request] --> B[Read-only SQLite worker]
B --> C[SQLite preparation]
C --> D{Success or error}
D -->|success| E[Snapshot location]
D -->|error| F[Bounded error suffix]
F --> G[JSON error result]
G --> H[Parent snapshot flow]
Decision needed
Why: Repository policy keeps member-authored and maintainer-labeled items out of automated cleanup, even where the patch review is clean. Before merge
Agent review detailsSecurityNone. PR surfaceSource -23. Total -23 across 1 file. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Merge the consolidation as the single shared bounded diagnostic-policy path while retaining the worker’s distinct base-message contract. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a behavior-preserving refactor, and the existing source tests plus documented synthetic subprocess captures cover the retained worker output contract. Is this the best way to solve the issue? Yes. Reusing the existing helper removes the duplicate policy while preserving the worker-specific base message and its strict JSON result boundary. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e3fdec7df66e. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Land-ready review for The maintainer explicitly requested this consolidation and has now requested landing. The latest ClawSweeper review has no actionable correctness/security finding and recommends merge. Its migration-proof flag is not applicable: this one-file diff consolidates transient diagnostic formatting, not persisted SQLite tables or schema. No store/configuration/protocol/retention/concurrency/dependency behavior changes. The PR body now records this disposition. Local proof passed before and after: 122 tests, with the existing Linux-only POSIX-lock probe skipped on macOS. Seven synthetic real-process captures were byte-identical across snapshot JSON, sync/async parent reconstruction, and verifier IPC; source hashes were unchanged and private staging cleanup completed. Existing coverage includes native corruption11, constrained-write778 through a cause, ENOENT, verifier native codes/classification, failure precedence and cleanup. No operator Gateway/state was accessed. Exact local commands: node scripts/run-vitest.mjs src/infra/sqlite-readonly-location.test.ts src/infra/sqlite-readonly-location.worker.test.ts src/state/openclaw-database-verify.process.test.ts src/state/openclaw-database-verify.test.ts src/infra/sqlite-integrity.test.tsnode scripts/check-changed.mjs -- src/infra/sqlite-readonly-location.worker.tspnpm buildgit diff --checkAll passed. Codex autoreview is scoped-clean with no P0 findings; the reviewed worker bytes still match this head. Exact-head CI run 33909422678, attempt 1, is successful (32 successful jobs, 16 intentionally skipped); the required Production +4/-27 (net -23); tests +0/-0. Proceeding through the repository-native prepare/merge gates. |
|
Merged via squash.
|
…8520) Reuse the existing SQLite error-code suffix helper in the snapshot worker while preserving its base message and every worker envelope, exit, classification, and cleanup contract. Remove the duplicated bounded extraction policy without adding API or test seams. Related: snapshot diagnostics openclaw#137999 and verifier diagnostics openclaw#138095. Production +4/-27; tests unchanged. Focused boundary suites, byte-equivalent synthetic process captures, changed checks, full build, and Codex autoreview passed.
Require a persistence owner or same-hunk durable boundary before treating JSON conversion as stored state. Distinguish SQLite diagnostic helpers from real schema, store, codec, and compatibility owners without changing approval or migration-proof gates. Reproduce the exact full and normalized patch from openclaw/openclaw#138520 and preserve twenty real-persistence controls in the offline detector-to-render proof.
Require a persistence owner or same-hunk durable boundary before treating JSON conversion as stored state. Distinguish SQLite diagnostic helpers from real schema, store, codec, and compatibility owners without changing approval or migration-proof gates. Reproduce the exact full and normalized patch from openclaw/openclaw#138520 and preserve twenty real-persistence controls in the offline detector-to-render proof.
Related: snapshot-worker diagnostic preservation and verifier diagnostic preservation.
Additional instructions
This is a same-repository maintainer-requested PR; maintainers can update the branch.
What Problem This Solves
SQLite snapshot and background-verifier diagnostics currently carry identical bounded suffix policies in two places. This maintainer-requested consolidation prevents those policies from drifting after the two diagnostic-preservation fixes above, without changing operator-visible behavior.
Why This Change Was Made
The snapshot worker now uses the existing
formatSqliteErrorCodeSuffixhelper and deletes its private formatter and copied extraction loop. It retainscoerceErrorMessage(error)for its base text; the verifier keeps its existingname: message/String(error)base text. No helper or API is added.The suffix still preserves traversal/insertion order, exact deduplication, at most eight cause nodes, code tokens matching
/^[A-Z0-9_]{1,64}$/u, and numeric integererrcodevalues in0..0x7fffffff. It adds no errstr, stack, cause prose, aggregate-member traversal, SQL, or arbitrary metadata. Both JSON/IPC envelopes, exit behavior, parent reconstruction, raw-error terminal classification, failure precedence, and cleanup remain unchanged.Production LOC: +4/-27 (net -23). Tests: +0/-0; existing boundary coverage is retained rather than duplicated.
User Impact
None: diagnostic bytes and verdicts remain the same. There are no snapshot/storage/schema/configuration/retention/concurrency/Node/dependency changes. A generic disk I/O error still does not establish disk exhaustion.
Evidence
11, constrained-write778through a cause, sync/asyncENOENT, bounded projections, verifier IPC26, raw-error classification, failure precedence, and cleanup.76fddc1cb652116bbd94fe57c0fab8a587ed95c2f0c615c89d037a3273ed81f9. Synthetic source-file hashes were unchanged and private staging cleanup completed. No operator state or Gateway was accessed.pnpm buildpassed. Codex autoreview returned scoped-clean with no P0 findings.src/node_sqlite.cc:173-225and614-638. Installed@types/nodedoes not exportSQLiteError; no dependency/type change is needed.Focused test command:
Changed checks:
Final maintainer review
Exact-head CI run 33909422678, attempt 1, completed successfully for
e87dc59f30bfb77dad91d8f9229839a350fad3f7: 32 successful and 16 intentionally skipped jobs; the requiredopenclaw/ci-gateis successful. The earlier draft-triggered run was skipped.The ClawSweeper review has no correctness or security finding and recommends merging. Its final maintainer decision is satisfied by the explicit request to land this consolidation. Its requested migration/upgrade compatibility proof is not applicable: the sole changed file formats transient worker stdout; this diff changes no persisted table, schema version, stored representation, migration, or IPC envelope. The before/after boundary captures prove identical serialized diagnostics. No schema modification is being authorized or introduced.