Skip to content

fix(sqlite): preserve worker error identity for each caller - #146741

Merged
steipete merged 1 commit into
mainfrom
codex/shared-worker-caller-errors
Sep 13, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/shared-worker-caller-errors

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #144592

What Problem This Solves

Shared SQLite worker failures could lose their typed identity when a caller loaded a fresh module graph while reusing the broker.

User Impact

Callers reliably recognize schema, maintenance, and ownership refusals. Error causes and unknown-write-outcome markers retain their existing meaning.

Why This Change Was Made

The broker retains the existing closed error payload, and the current caller hydrates it using its own constructors. This covers shared opens, operations, and cleanup while preserving actor coalescing, cached rejection objects, and aliases and cycles in error graphs. Ordinary errors remain unchanged; no schema or wire format changes are needed.

Evidence

All 32 focused codec and real shared-worker cases pass, including reloaded caller open/execute failures and concurrent lower-level open refusals. Both unchanged-main controls fail at the intended constructor-identity assertion. Fresh P2 review, the full canonical changed gate (including core and core-test types), and the normal build pass.

The actual compiled shared worker preserves typed open and execute refusals on Node 24.21.0 and Bun 1.4.2, with matching recorded artifact hashes. Distinct reloaded module graphs are covered by the source regressions. Proof is pinned to commit 085e561 on base 5606d86. Two initial gate findings were corrected: the synthetic coordinator fixture now supplies its required directory, and retained execute/close methods bind explicitly to their original caller store.

@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.

@steipete
steipete marked this pull request as ready for review September 13, 2026 04:33
@openclaw-barnacle openclaw-barnacle Bot added size: L maintainer Maintainer-authored PR labels Sep 13, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 13, 2026, 12:45 AM ET / 04:45 UTC.

ClawSweeper review

What this changes

Preserves SQLite worker error types for callers that reload modules, while retaining shared causes, cycles, and unknown-write-outcome markers.

Warning

SQLite table change

This PR modifies persisted SQLite tables in src/infra/sqlite-worker-store.ts. Prefer a design that avoids changing persisted SQLite tables. If the change is necessary, verify migration and upgrade compatibility against an existing database before merge.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep open: current main still has the caller-constructor mismatch, and this PR provides a focused repair. No blocking correctness or security findings were identified.

Priority: P2
Reviewed head: 085e56124787ab79662de5644d31c243a2f88f4b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Recorded reviewer rating: A focused, source-supported repair with meaningful regression coverage and no blocking findings. Real behavior proof remains required by host policy.
Proof confidence 🌊 off-meta tidepool Recorded reviewer rating; Required by policy: the recorded not-applicable assessment does not satisfy the current PR proof policy. Put relevant after-change evidence in the main PR body, then request a fresh review with @clawsweeper re-review. Recorded reviewer context: The author is a verified repository admin, so the external-contributor gate does not apply. The body reports compiled shared-worker refusal checks on Node and Bun, with module-reload coverage in regression tests; runtime traces were not independently inspected.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Required by policy Required by policy: the recorded not-applicable assessment does not satisfy the current PR proof policy. Put relevant after-change evidence in the main PR body, then request a fresh review with @clawsweeper re-review. Recorded reviewer context: The author is a verified repository admin, so the external-contributor gate does not apply. The body reports compiled shared-worker refusal checks on Node and Bun, with module-reload coverage in regression tests; runtime traces were not independently inspected.
Evidence reviewed 8 items Current main still needs the repair: At fetched main, reply decoding constructs typed errors inside the broker. The caller-facing store and codec files have no changes from the pinned merge base, so the proposed caller-local reconstruction is not already present.
Caller boundary and lifecycle preservation: The store API reconstructs rejected errors using caller-local constructors while retaining the broker's store identity and binding original methods. Broker operation tracking still drains dispatched commands before releasing the operation.
Meaningful regression coverage: Read both complete test files. Added cases exercise real shared-worker open and execute refusals after module reload, separate caller constructors, cached rejection immutability, graph aliases and cycles, and outcome-unknown preservation. Tests were not executed during this read-only review.
Findings None None.
Security None None.

How this fits together

OpenClaw runs shared-state SQLite operations through a process-wide worker broker. Worker failures pass back through caller-facing APIs so application code can recognize maintenance, schema, and ownership refusals.

flowchart LR
  A[Storage caller] --> B[Shared worker broker]
  B --> C[SQLite worker]
  C --> D[Error payload]
  D --> E[Caller error reconstruction]
  E --> F[Typed refusal or unknown outcome]
Loading

Before merge

  • Add real behavior proof - Required by policy: the recorded not-applicable assessment does not satisfy the current PR proof policy. Put relevant after-change evidence in the main PR body, then request a fresh review with @clawsweeper re-review. Recorded reviewer context: The author is a verified repository admin, so the external-contributor gate does not apply. The body reports compiled shared-worker refusal checks on Node and Bun, with module-reload coverage in regression tests; runtime traces were not independently inspected.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +206, Tests +238. Total +444 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 4 248 42 +206
Tests 2 243 5 +238
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 491 47 +444

Review metrics

Metric Value Why it matters
Production versus regression coverage production +206 net lines; tests +238 net lines Production growth supports caller-local reconstruction of shared error graphs; regression coverage checks constructor identity and graph preservation.

Stored data model

Persistent data-model change detected: unknown-data-model-change: src/infra/sqlite-worker-store.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep one shared broker and reconstruct transported failures at caller boundaries without changing cached errors, durable state, or outcome classification.

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

Yes, from source: reuse the broker after reloading caller modules, then trigger a newer-schema refusal; the old decoder returns an instance of the broker's constructor. The added worker regressions cover this path, but were not run here.

Is this the best way to solve the issue?

Yes: caller-boundary reconstruction addresses constructor identity while preserving the existing broker, transport format, and immutable cached failures.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This repairs a bounded storage error-classification defect without evidence of an urgent user-facing outage.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit. This is the recorded reviewer rating; real behavior proof remains required by host policy.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Required by policy: the recorded not-applicable assessment does not satisfy the current PR proof policy. Put relevant after-change evidence in the main PR body, then request a fresh review with @clawsweeper re-review. Recorded reviewer context: The author is a verified repository admin, so the external-contributor gate does not apply. The body reports compiled shared-worker refusal checks on Node and Bun, with module-reload coverage in regression tests; runtime traces were not independently inspected.

Label justifications:

  • P2: This repairs a bounded storage error-classification defect without evidence of an urgent user-facing outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit. This is the recorded reviewer rating; real behavior proof remains required by host policy.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Required by policy: the recorded not-applicable assessment does not satisfy the current PR proof policy. Put relevant after-change evidence in the main PR body, then request a fresh review with @clawsweeper re-review. Recorded reviewer context: The author is a verified repository admin, so the external-contributor gate does not apply. The body reports compiled shared-worker refusal checks on Node and Bun, with module-reload coverage in regression tests; runtime traces were not independently inspected.

Evidence

What I checked:

  • Current main still needs the repair: At fetched main, reply decoding constructs typed errors inside the broker. The caller-facing store and codec files have no changes from the pinned merge base, so the proposed caller-local reconstruction is not already present. (src/infra/sqlite-worker-broker-reply.ts:123, 2716950abf05)
  • Caller boundary and lifecycle preservation: The store API reconstructs rejected errors using caller-local constructors while retaining the broker's store identity and binding original methods. Broker operation tracking still drains dispatched commands before releasing the operation. (src/infra/sqlite-worker-store.ts:12, 085e56124787)
  • Meaningful regression coverage: Read both complete test files. Added cases exercise real shared-worker open and execute refusals after module reload, separate caller constructors, cached rejection immutability, graph aliases and cycles, and outcome-unknown preservation. Tests were not executed during this read-only review. (src/infra/sqlite-worker-shared-state.test.ts:45, 085e56124787)
  • Security and transport boundary: The worker retains its existing closed error payload and excludes unknown execution outcomes from typed refusal transport. The patch changes error reconstruction, not authorization, database schemas, worker dispatch authority, dependencies, or executable downloads. (src/infra/sqlite-store.worker.ts:257, 085e56124787)
  • Merged area history and routing: GitHub verifies refactor: move shared database admission into its worker #146172 as merged at this commit and authored by steipete. Blame and comparison against raw recorded parent 63bafe6 locate the existing codec there; recent broker and store history also repeatedly names Peter Steinberger. (src/state/openclaw-state-worker-error.ts:59, 7b87a492ab5d)
  • Release boundary: The v2026.9.4 tree has no shared-state worker error codec at this path. The reviewed repair remains absent from fetched main; no shipped fix is established. (src/state/openclaw-state-worker-error.ts, 3a9d69db306c)

Likely related people:

  • Peter Steinberger: Raw commit 7b87a49 adds src/state/openclaw-state-worker-error.ts:59 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7b87a492ab5d; files: src/state/openclaw-state-worker-error.ts)

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.

@steipete
steipete merged commit 3ec01ce into main Sep 13, 2026
253 of 254 checks passed
@steipete
steipete deleted the codex/shared-worker-caller-errors branch September 13, 2026 05:27
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant