Skip to content

fix: support large SQLite worker commands with bounded transport - #146019

Merged
steipete merged 2 commits into
mainfrom
codex/managed-input-transfer-current
Sep 12, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/managed-input-transfer-current

Conversation

@steipete

@steipete steipete commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolves a problem where plugins using worker-backed SQLite could not write valid commands larger than 32 MiB. Managed-flow state and wait data have no corresponding domain size limit, so moving those writes to workers otherwise rejects values accepted by the existing storage contract.

Why This Change Was Made

The existing worker broker now stages large execute commands through the same bounded transfer primitive used for large results. The original job retains its actor and lifecycle until the complete command is validated and executed once. Small requests retain the existing path; cancellation, failure, and close release staging ownership without partially executing or replaying a command.

The 32 MiB message and 64 MiB aggregate transport budgets remain unchanged. Queued commands charge their full serialized size. Commands larger than the aggregate budget require an idle slot and reserve a 32 MiB transport window; otherwise they receive the existing overload error. The budget bounds admitted transport queues and windows, while the complete active command or result remains operation memory. This distinction is documented explicitly.

User Impact

Plugins can write large valid SQLite values through workers while retaining bounded transport messages and backpressure. This is the transport prerequisite for the separate managed-flow mutation migration; it does not add a database schema, public size limit, or PostgreSQL backend.

Evidence

  • Seven actual-worker regression cases cover queued-byte charging, active oversized admission, competing work, cancellation, incomplete-input failure, exactly-once writes, close drainage, and reopening persisted state.
  • Source and compiled worker runs on Node 24.20.0 and Bun 1.4.2 each wrote 40 MiB and 72 MiB commands, then read back 112 MiB before and after reopening with matching SHA-256 digests. Actual message frames had independently bounded backing buffers. Compiled 72 MiB writes took approximately 581 ms on Node and 1.37 s on Bun during concurrent local verification; these are observations, not benchmark guarantees.
  • An isolated composition with the managed-flow caller and common state owner verified registered asynchronous create, waiting, and resume with 36 MiB state plus 36 MiB wait data, exact persisted values, and reopen. A separate canonical schema-error case verifies typed failure at staged execution and no partial write. That composition is proof of compatibility, not additional source in this PR.
  • All 54 focused input and existing transport/framing tests and a fresh scoped Codex review pass on the current broker split. The current-base full build also passes, and its compiled Node/Bun workers passed the same large-command/reopen proof. The complete current-base changed-file gate passes. CI exposed a static type-import cycle; moving the transfer handle into the existing leaf contract fixes it. The complete architecture suite, correction gate, framing tests, and fresh correction review pass; emitted runtime code is equivalent to the verified build.

@clawsweeper

clawsweeper Bot commented Sep 12, 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 docs Improvements or additions to documentation size: L maintainer Maintainer-authored PR labels Sep 12, 2026
@steipete
steipete marked this pull request as ready for review September 12, 2026 14:21
@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: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 12, 2026
@clawsweeper

clawsweeper Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 12, 2026, 10:46 AM ET / 14:46 UTC (Revision 2).

ClawSweeper review

What this changes

The PR transfers large SQLite worker commands in bounded chunks, preserves admission and cleanup behavior, and adds regression coverage and documentation.

Warning

SQLite table change

This PR modifies persisted SQLite tables in src/infra/sqlite-store.worker.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 - 1 item remains

This PR remains useful: current main still rejects commands above 32 MiB. No blocking defect was found. The previous migration-proof blocker does not apply because this patch changes transport without changing the persisted data model.

Priority: P2
Reviewed head: c36fce36f50a08354deff404c532a5ee6287273e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with relevant runtime observations, meaningful worker-boundary coverage, and no blocking findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied body reports real source and compiled Node/Bun worker runs through the changed broker, with large writes, bounded backing buffers, matching readback digests, and reopen success. These observations cover the changed transport path; this reviewer did not rerun them, and the latest correction changes only types.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied body reports real source and compiled Node/Bun worker runs through the changed broker, with large writes, bounded backing buffers, matching readback digests, and reopen success. These observations cover the changed transport path; this reviewer did not rerun them, and the latest correction changes only types.
Evidence reviewed 9 items Current main still has the input limit: The fetched main broker rejects any non-close request whose serialized input exceeds SQLITE_WORKER_MAX_MESSAGE_BYTES, including execute commands. The requested input behavior is therefore still missing.
Bounded admission and retained ownership: Commands within the aggregate budget retain their full byte charge; larger commands require an idle slot and reserve 32 MiB. Continuations retain the current job, and settlement or worker failure releases transfer ownership.
Complete input precedes execution: The worker checks the request and actor identity, validates frame sequence and completion through the shared receiver, and invokes the existing backend only after exactly one complete command has arrived.
Findings None None.
Security None None.

How this fits together

SQLite worker stores move plugin database operations off the application thread. The broker admits serialized commands, transfers them to the database-owning worker, and returns complete results while retaining operation ownership.

flowchart TD
  A[Plugin database command] --> B[Snapshot and admission]
  B --> C{Capacity available?}
  C -->|No| D[Overload error]
  C -->|Yes| E[Inline or chunked transfer]
  E --> F[Validate complete command]
  F --> G[Execute database operation once]
  G --> H[Return result and release credits]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +168, Tests +292, Docs +19. Total +479 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 6 252 84 +168
Tests 1 292 0 +292
Docs 2 21 2 +19
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 565 86 +479

Review metrics

Metric Value Why it matters
Production and test growth Production net +168 lines; tests +292 lines Production growth implements command staging while reusing the existing framing and database owners; tests exercise the actual worker boundary.
Oversized command admission Above 64 MiB: idle worker required, 32 MiB reserved The documented budget bounds transport admission rather than total memory occupied by an active command.

Stored data model

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

Technical review

Best possible solution:

Preserve complete domain values through the existing worker owner without introducing a storage size limit or a second persistence path.

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

Yes, from source: executing a serialized command above 32 MiB reaches current main's unconditional input-size rejection. This review did not execute the failure.

Is this the best way to solve the issue?

Yes. Reusing the existing framing primitive preserves the store interface, exactly-once execution boundary, and lifecycle ownership without changing durable formats.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This repairs a bounded SQLite transport limitation affecting large plugin commands without evidence of an urgent shipped outage.
  • 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 (live_output): The supplied body reports real source and compiled Node/Bun worker runs through the changed broker, with large writes, bounded backing buffers, matching readback digests, and reopen success. These observations cover the changed transport path; this reviewer did not rerun them, and the latest correction changes only types.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied body reports real source and compiled Node/Bun worker runs through the changed broker, with large writes, bounded backing buffers, matching readback digests, and reopen success. These observations cover the changed transport path; this reviewer did not rerun them, and the latest correction changes only types.

Evidence

What I checked:

  • Current main still has the input limit: The fetched main broker rejects any non-close request whose serialized input exceeds SQLITE_WORKER_MAX_MESSAGE_BYTES, including execute commands. The requested input behavior is therefore still missing. (src/infra/sqlite-worker-broker.ts, fd9e782dc27e)
  • Bounded admission and retained ownership: Commands within the aggregate budget retain their full byte charge; larger commands require an idle slot and reserve 32 MiB. Continuations retain the current job, and settlement or worker failure releases transfer ownership. (src/infra/sqlite-worker-broker.ts:408, c36fce36f50a)
  • Complete input precedes execution: The worker checks the request and actor identity, validates frame sequence and completion through the shared receiver, and invokes the existing backend only after exactly one complete command has arrived. (src/infra/sqlite-store.worker.ts:100, c36fce36f50a)
  • Prior upgrade concern reassessed: The introduced changes contain no schema, stored-format, migration, configuration, or database-owner change. The existing public store interface remains intact; the previous review's generic migration-proof request is not a remaining blocker. Documentation explicitly distinguishes bounded transport credits from complete active-value memory. Public docs: docs/reference/database-schemas/storage-changes.md. (docs/reference/database-schemas/storage-changes.md:50, c36fce36f50a)
  • Supplied runtime observations and regression coverage: The captured PR body, sourceRevision ec388f2973fdb5792c05ee987e8bdb78e661575dee6a3cd46758d65d4c675739, reports source and compiled Node 24.20.0/Bun 1.4.2 workers writing 40 MiB and 72 MiB commands and reading 112 MiB with matching digests before and after reopen. It also reports managed-flow composition and typed schema-error checks. The seven added actual-worker cases cover persistence, byte credits, cancellation, failed staging, and close drainage. Runtime checks were not rerun during this read-only review. (src/infra/sqlite-worker-input.test.ts:89, c36fce36f50a)
  • Re-review correction is type-only: GitHub's exact-head commit patch moves the transfer-handle type into the leaf contract and updates its type imports. It introduces no runtime algorithm change relative to the previously reviewed head. (src/infra/sqlite-worker-contract.ts:1, c36fce36f50a)

Likely related people:

  • Peter Steinberger: Raw commit ecfbddb adds src/infra/sqlite-worker-transfer.ts:138 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ecfbddbbcc81; files: src/infra/sqlite-worker-transfer.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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-12T14:26:57.839Z sha 2e68c61 :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 12, 2026
@steipete
steipete merged commit a02a33d into main Sep 12, 2026
189 checks passed
@steipete
steipete deleted the codex/managed-input-transfer-current branch September 12, 2026 15:02
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

* fix: support large SQLite worker commands with bounded transport

* refactor: keep SQLite transfer handles in the leaf contract
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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