Skip to content

improve: move Board writes off the Gateway thread - #153159

Merged
steipete merged 1 commit into
mainfrom
codex/boards-worker-mutations-20260919
Sep 20, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/boards-worker-mutations-20260919

Conversation

@steipete

@steipete steipete commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Related: #153150, #153286, #153351, #153296.

Foundation #153150 and shared fixture repairs #153286, #153296, and #153351 are merged. This candidate is a single focused consumer commit on actual main 44b012703080. Its catalog union preserves main’s workspaceMemory and workspaceSkills registrations alongside the original boardStore registration. Main’s database-worker routes are retained in full, with Board parity registered once and the other seven original Board/Canvas routes added.

What Problem This Solves

Board updates return promises but still execute ordinary SQLite writes on the caller thread.

User Impact

Board mutations execute off the Gateway thread while preserving revisions, grants, persistence, and notifications. Protected results also respect earlier queued mutations. Schema/bootstrap work, source admission, protected reads, cold hasBoard, and incognito remain native; this does not move all SQLite activity off-thread.

Why This Change Was Made

The existing synchronous Board kernels borrow the canonical agent worker connection. Inputs and physical targets stay captured across the writer queue, MCP source policy and live authority are revalidated, and committed changes reach the host publisher before results are exposed. Unknown outcomes invalidate the original session without replay; known completed results survive cleanup failures.

Protected read turns join the same queue, then release it before awaiting external consumer work. Consumers retain their original caller context rather than inheriting temporary reentrant queue ownership. Host environment capture preserves Windows case-insensitive lookup. No additional physical actor, schema, protocol, or configuration surface is introduced.

Evidence

  • Causal regressions cover queued revocation, consumer-started writes, the two-microtask nested-read race, mixed-case environment capture, and committed writes followed by refused cleanup. Original failures and corrected controls are retained; the reviewed Board production changes are unchanged in the current-main composition.
  • The recorded frozen composition passed the canonical production build. Its ordinary compiled store and signed loopback Gateway cells preserve grants, exact publications, durable bytes, and reopen behavior, with zero host Board data writes and clean natural exit. All host SQLite calls remain counted: 9,035 for the store cell and 11,090 for Gateway. No all-host-SQL-zero or latency improvement is claimed.
  • The prior frozen composition passed all 442 selected tests across 26 files and the full selected static gate, including production/test types, lint, and architecture checks. Its compiled store/Gateway evidence remains tied to that recorded source/build tree. The current-main rebase preserves the Board production edits; the preceding composition additionally passed 94 runtime tests covering Board outcomes, protected HTTP/MCP reads, shared-state lifecycle, both worker registrations, transcript readiness, and the canonical ACK ownership controls. Earlier compositions also passed both targeted routing guards. Previous-head CI 35486096929 is green on f394c2837044 (157 jobs completed, no failures). The preceding catalog composition 96c38c3ef8c7 passed 57 runtime tests, both routing guards, a real build-entry mapping probe for all three registrations, and a fresh P2 review. The current routing-union candidate e548bf795c9a passed all 189 selected tests (93 routing-owner and 96 runtime/parity/reclamation tests), with a fresh P2 review. The catalog and its mapping owner are unchanged from the qualified probe. Current-head CI is pending. An earlier run’s final extension shard was still running when the qualified successor superseded it; that shard is not claimed as a pass.
  • The inherited cleanup fixture failure was reproduced in its original shared shard and repaired centrally in fix: cleanup lifecycle test fails after shared worker reuse #153286 by routing the unchanged mocked fixture to the existing isolated lane.
  • Windows cases exercise the real environment helper's Windows branch with native SQLite on macOS; they are not a native Windows run.
  • The inherited transcript startup failure reproduced unchanged on main and is repaired separately in fix: routed transcript tests fail during valid startup #153351 by awaiting the existing provider-start event, preserving the assertions and deadlines.
  • An earlier CI run exposed an inherited ACK fixture cleanup failure after the claimless-ACK contract changed. This candidate uses canonical main’s repair from fix: keep PR identity checks working when GraphQL quota is exhausted #153296, preserving its added post-deletion ownership assertions.

@clawsweeper

clawsweeper Bot commented Sep 19, 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 gateway Gateway runtime labels Sep 19, 2026
@steipete
steipete marked this pull request as ready for review September 19, 2026 20:34
@openclaw-barnacle openclaw-barnacle Bot added size: L maintainer Maintainer-authored PR labels Sep 19, 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: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 19, 2026
@clawsweeper

clawsweeper Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 20, 2026, 1:36 AM ET / 05:36 UTC (Revision 10).

ClawSweeper review

What this changes

Moves disk-backed dashboard Board mutations to the shared database worker while preserving ordered reads, authorization, and committed-change notifications.

Warning

SQLite table change

This PR modifies persisted SQLite tables in src/boards/sqlite-board-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 - 1 item remains

The PR remains useful: current main still performs Board mutations on the caller thread. No actionable introduced defect was found. The previous migration-proof blocker is unsupported by the actual diff.

Priority: P2
Reviewed head: e548bf795c9aba892a2807cb1103fec98ec95a94

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused worker migration with meaningful regression coverage and no supported blocking finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR is exempt from ordinary contributor proof requirements. Its captured body reports compiled-store and loopback-Gateway persistence results; inspected source and boundary coverage establish no unresolved authority-chain proof requirement.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from ordinary contributor proof requirements. Its captured body reports compiled-store and loopback-Gateway persistence results; inspected source and boundary coverage establish no unresolved authority-chain proof requirement.
Evidence reviewed 10 items Current main still needs the change: Fetched main invokes runOpenClawAgentWriteTransaction directly from the Board store; the worker-backed mutation path is absent.
Preserved storage contract: The introduced delta leaves the schema owner, serialization owner, Board API, and protocol unchanged. The existing kernel changes only its database-handle parameter type. This does not establish a new stored data model requiring migration proof.
Storage review checkpoint: The documented checkpoint distinguishes persistent-contract changes from internal admission, transaction, and lifecycle mechanics that preserve those contracts.
Findings None None.
Security None None.

How this fits together

Boards store dashboard widgets and layouts for each session. Gateway requests enter the Board store, which persists mutations and publishes changes consumed by session projections and clients.

flowchart TD
  A[Gateway Board requests] --> B[Capture inputs and session target]
  B --> C[Per-agent writer queue]
  C --> D{Disk or incognito}
  D -->|Disk| E[Shared database worker]
  D -->|Incognito| F[Process-held database]
  E --> G[Existing transaction kernels and authority checks]
  F --> G
  G --> H[Committed notifications and response]
Loading

Before merge

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

Security

None.

PR surface

Source +286, Tests +834, Docs +22. Total +1142 across 26 files.

View PR surface stats
Area Files Added Removed Net
Source 5 334 48 +286
Tests 19 879 45 +834
Docs 2 27 5 +22
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 26 1240 98 +1142

Review metrics

Metric Value Why it matters
Production versus regression coverage Net production +286 lines; tests and test support +825 lines Production growth supplies worker transport and outcome handling while reusing existing mutation kernels; coverage targets ordering, revocation, and settlement.

Stored data model

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

Technical review

Best possible solution:

Retain the shared worker implementation with the existing schema, transaction kernels, live-authority checks, and exact-session publication owner.

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

Not applicable as a defect reproduction: this is an execution-boundary improvement, and current-main source confirms ordinary Board mutations still run synchronously on the caller thread.

Is this the best way to solve the issue?

Yes. Reusing the canonical worker and existing kernels avoids competing storage owners; the unchanged persisted contract does not justify retaining the previous migration-proof blocker.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded Board persistence improvement 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.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR is exempt from ordinary contributor proof requirements. Its captured body reports compiled-store and loopback-Gateway persistence results; inspected source and boundary coverage establish no unresolved authority-chain proof requirement.

Evidence

What I checked:

  • Current main still needs the change: Fetched main invokes runOpenClawAgentWriteTransaction directly from the Board store; the worker-backed mutation path is absent. (src/boards/sqlite-board-store.ts:137, 9343ea4099ba)
  • Preserved storage contract: The introduced delta leaves the schema owner, serialization owner, Board API, and protocol unchanged. The existing kernel changes only its database-handle parameter type. This does not establish a new stored data model requiring migration proof. (src/boards/sqlite-board-store.kernel.ts:72, e548bf795c9a)
  • Storage review checkpoint: The documented checkpoint distinguishes persistent-contract changes from internal admission, transaction, and lifecycle mechanics that preserve those contracts. Public docs: docs/reference/database-schemas/storage-changes.md. (docs/reference/database-schemas/storage-changes.md:1304, e548bf795c9a)
  • Authority and outcome handling: The worker requests transaction and commit admission around existing kernels. The host supplies current caller and target checks, publishes committed changes for the original session, invalidates unknown outcomes without replay, and preserves successful results through cleanup failure. (src/boards/sqlite-board-store.worker.ts:44, e548bf795c9a)
  • Protected reads retain caller context: Protected consumption joins the same writer queue, restores the original caller context, and releases the reservation before awaiting external consumer work. Existing widget-ticket checks remain immediately before consumption. (src/boards/sqlite-board-store.ts:273, e548bf795c9a)
  • Behavioral coverage and reported execution: Inspected coverage checks committed publications, incognito isolation, queued revocation, cleanup refusal, nested consumer ordering, and captured Windows environment semantics. Existing MCP boundary coverage asserts forbidden calls never reach the transport. The captured PR body reports compiled-store and signed loopback-Gateway runs with zero host Board data writes, preserved durable data, and successful reopen, plus 189 selected tests on the current head. These execution results were not rerun during this read-only review. (src/boards/sqlite-board-store.worker.test.ts:106, e548bf795c9a)

Likely related people:

  • steipete: 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.

History

Review history (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-19T22:42:10.961Z sha 1685273 :: blocked before merge. :: none
  • reviewed 2026-09-20T00:15:55.611Z sha 1685273 :: blocked before merge. :: none
  • reviewed 2026-09-20T01:21:29.561Z sha 415d247 :: blocked before merge. :: none
  • reviewed 2026-09-20T01:52:36.355Z sha 415d247 :: blocked before merge. :: none
  • reviewed 2026-09-20T02:50:53.694Z sha f1b386f1339d4aa951a7cdb04a00f6e2671ef7e2 :: blocked before merge. :: none
  • reviewed 2026-09-20T03:24:24.764Z sha f394c28 :: blocked before merge. :: none
  • reviewed 2026-09-20T03:58:10.739Z sha f394c28 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-20T05:11:45.444Z sha 96c38c3ef8c794fb46d177bc34752fdccddcfc71 :: blocked before merge. :: none

@steipete
steipete force-pushed the codex/boards-worker-mutations-20260919 branch from ff61ae3 to 1685273 Compare September 19, 2026 22:21
Base automatically changed from codex/agent-foundation-protocol-policy-20260919 to main September 20, 2026 00:08
@openclaw-barnacle openclaw-barnacle Bot added extensions: memory-core Extension: memory-core scripts Repository scripts plugin: file-transfer labels Sep 20, 2026
@steipete
steipete force-pushed the codex/boards-worker-mutations-20260919 branch from 1685273 to 415d247 Compare September 20, 2026 01:14
steipete added a commit that referenced this pull request Sep 20, 2026
Move ordinary persistent Board mutations onto the canonical agent worker while preserving revisions, grants, physical targets, and host notifications. Keep protected reads in the same FIFO and retain the caller's async context when invoking consumers.

Preserve known committed results through cleanup failures, invalidate unknown outcomes without replay, and retain Windows environment lookup semantics. Bootstrap, admission, reads, and incognito remain native.

Related: #153159, #153150, #153286
@openclaw-barnacle openclaw-barnacle Bot removed extensions: memory-core Extension: memory-core scripts Repository scripts plugin: file-transfer labels Sep 20, 2026
@steipete
steipete force-pushed the codex/boards-worker-mutations-20260919 branch from 415d247 to f1b386f Compare September 20, 2026 02:43
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Sep 20, 2026
@steipete
steipete force-pushed the codex/boards-worker-mutations-20260919 branch from f1b386f to f394c28 Compare September 20, 2026 03:15
steipete added a commit that referenced this pull request Sep 20, 2026
Move ordinary persistent Board mutations onto the canonical agent worker while preserving revisions, grants, physical targets, and host notifications. Keep protected reads in the same FIFO and retain the caller's async context when invoking consumers.

Preserve known committed results through cleanup failures, invalidate unknown outcomes without replay, and retain Windows environment lookup semantics. Bootstrap, admission, reads, and incognito remain native.

Related: #153159, #153150, #153286
@steipete
steipete force-pushed the codex/boards-worker-mutations-20260919 branch from f394c28 to 96c38c3 Compare September 20, 2026 05:04
@openclaw-barnacle openclaw-barnacle Bot removed the agents Agent runtime and tooling label Sep 20, 2026
@steipete
steipete force-pushed the codex/boards-worker-mutations-20260919 branch from 96c38c3 to e548bf7 Compare September 20, 2026 05:29
@steipete
steipete merged commit d1a550d into main Sep 20, 2026
215 checks passed
@steipete
steipete deleted the codex/boards-worker-mutations-20260919 branch September 20, 2026 06:23
@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

docs Improvements or additions to documentation gateway Gateway runtime 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: XL 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