Skip to content

refactor(workboard): read board snapshots and widget documents through the board worker - #164448

Merged
steipete merged 3 commits into
mainfrom
dbasync/boardread
Oct 3, 2026
Merged

steipete merged 3 commits into
mainfrom
dbasync/boardread

Conversation

@steipete

@steipete steipete commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Session dashboard snapshots and widget-document reads still execute board SQLite on the Gateway thread. Direct snapshot and MCP-document getters can also overtake an earlier accepted board write.

Why This Change Was Made

Add typed snapshot/document commands to the existing board worker on the canonical agent broker. Capture the physical store before yielding, read one synchronous snapshot, and retain the shared read/write FIFO through current-authority checks and synchronous consumption. Release the reservation before awaiting external consumer promises, and join publication cleanup through the existing request/database lifetimes.

Gateway grants now check the captured logical routing configuration without repeating physical-store discovery. The executor retains physical identity and database-owner validation. This also prevents cold custom/shared-store discovery from entering SQL inside a worker grant.

User Impact

Final-head released-SDK comparison completed successfully on Testbox; report details are recorded below.

Durable board.get, widget HTTP GET/HEAD, and MCP view/interaction reads use the worker. Existing incognito reads retain their process-held owner; write preflight and schema admission are outside this cutover. No new worker service, schema, persistent cache, retention, durability, permission, protocol, or update migration is introduced. Board APIs were already asynchronous in v2026.9.8; no synchronous Plugin SDK contract is removed.

Production: +215 / -62 / net +153 (277 changed lines, five files). Native inventory: T1 1,233 → 1,232 against merge base 4ab382220e2cca1deedb2c2549982f91c0fb5c64. Shared kernels remain classified T1 because incognito still uses them; this count is not a latency measurement. No new OPENCLAW_* names.

Evidence

Baseline regressions observed caller-thread board SQL in board.get (4 observations), HTTP disclosure (2), and MCP view/interaction reads (7). All three direct getters returned revision 1 while an earlier queued write committed revision 2. The migrated paths now observe zero caller-thread board SQL and the committed revision.

Coverage includes transaction/commit refusal, transported BoardValidationError identity, unknown write outcomes without replay, captured state roots, external-consumer FIFO release, and the real Gateway close prelude. Shared-store RPC proof invalidates the registry memo inside grants, observes no registry/schema-owner discovery there, and refuses store-path changes without creating a successor database.

The HTTP ordering fixture now checks that the response has ended before a removal is queued. Its former socket-finish/microtask ordering assertion changed under worker continuation scheduling; the actual synchronous disclosure contract is preserved.

Validation uses pnpm test <paths> --maxWorkers=1 on the shared host:

Run Result Wall time
Initial outcome/RPC/HTTP/close group Outcome (5), RPC (12), and close (1) passed; the HTTP flush-order fixture failed and was repaired as described above 206.58 s
Repaired HTTP + board store + parity + worker 69 passed 175.70 s
Final shared-store RPC + worker + real close 25 passed 344.97 s
Explicit runtime-process build graph + get-reply + shared-state worker import tests 12 passed 88.70 s

This covers 92 distinct focused cases plus 12 import/build-graph cases. Behavioral/import proof ran on 23840886b7586; later mechanical corrections type missing read results as undefined and use a separate local binding for the captured target; read behavior is unchanged. Final core typecheck passes. Final P2 Codex autoreview is scoped-clean against the pinned merge base. Madge reports 0 cycles, and the database-worker ratchet passes.

Per-file test cost (measured test bodies; grouped process wall times above)
File Cases Test seconds
src/boards/board-store.test.ts 12 14.767
src/boards/board-store.parity.test.ts 21 40.648
src/boards/sqlite-board-store.outcomes.test.ts 5 1.696
src/boards/sqlite-board-store.worker.test.ts 19 45.171
src/gateway/board-http.test.ts 17 4.717
src/gateway/board-store.test.ts 5 27.901
src/gateway/server-methods/board.test.ts 12 16.837
src/gateway/server-close.board.test.ts 1 60.353
test/scripts/runtime-process-build-graph.test.ts 9 2.229
src/auto-reply/reply/get-reply.imports.test.ts 1 11.005
src/state/openclaw-state.worker.imports.test.ts 2 3.378

The real-close case must exercise actual Gateway startup, close-prelude admission fencing, accepted worker settlement, and database teardown; a direct store-disposal test does not cover that order. Existing parity tests include migrations and reopen behavior. Host load caused substantial timing variation; no sleeps, timeouts, retries, or worker pins were added to the suites. CI seconds are pending.

Released-SDK merge precondition satisfied on final head 320af4cfb9fb8d585793a136b441d7fa0ef2150a by the Testbox report below. The local v2026.9.8 comparison against f96f823820b76 installed both revisions and began declaration rendering, then exited 1 after 284.70 s with Managed command exited while its process group remained active. No JSON or Markdown comparison was produced. This is a tooling failure, not successful compatibility proof; the required Testbox comparison subsequently completed, as recorded below. No blind retry was made.

node scripts/check-changed.mjs --base 4ab382220e2cca1deedb2c2549982f91c0fb5c64 completed successfully on the final head, including all core/test type graphs, lint, dead-export scans, storage/import guards, and ratchets. git diff --check passes.

Recent overlap review found no competing board SQLite migration. #164269 and #164320 are incidental cleanup; #135889/#135890 are adjacent task-lane features without board SQLite changes. #162433 is the acknowledged inactive umbrella design and is not adopted by this change.

Maintainer landing review

The final-head source review confirms that the exported BoardStore methods in v2026.9.8 already return promises. The renamed kernel helper is internal: no src/plugin-sdk export, api.runtime surface, or documented SDK subpath exposes it. No released signature is removed or changed, so no compatibility record is required for this cutover. The full released-SDK report has now been produced successfully, as recorded below.

The generic ClawSweeper data-model warning is not supported by the patch: schema definitions and persisted board representations are unchanged, and read-only worker publications skip schema creation. ClawSweeper's detailed exact-head review independently reaches the same conclusion and reports no code findings. Existing parity proof covers migrations and reopening. The final-head worker test includes explicit queued-write/read ordering for snapshot, metadata, and MCP document getters.

The earlier PR-context job evaluated the initial body; the current authored problem/evidence body passes evaluatePullRequestContext. Its stale failure does not describe the current PR text.

CI failure attribution

CI run 37144084669 tested merge 67b3a6febf59c793abc21ddbea01dbda72b4866c with main parent f79dac86bd4a9bb97bf99a5a69a04c603c0eeac6 and the approved PR head. Its five reclamation worker-count failures are independently reproduced on that main parent and exact merge. The same cases fail in scheduled main CI. Main's #164236 adds a schema-lease heartbeat worker; the unchanged reclamation test counts every process worker and therefore sees 2/3 workers instead of 1/2. Constructor tracing identifies that heartbeat before the intended archive worker. The PR's board reads occur after the failing assertion. All 15 test/schema/worker attribution paths are unchanged between the main parent and tested merge.

On Linux/Node 24.19.0 Testbox, pnpm test src/config/sessions/session-accessor.sqlite-reclamation.test.ts --maxWorkers=1 passed five times at the approved head and five times at the merge base (16 tests each, about 30–32 seconds/run). Exact main and tested-merge replays reproduced all five failures. Initial baseline setup attempts lacked workspace dependency links and failed before tests; separate frozen installs repaired that proof fixture before the five valid baseline runs. Testbox run.

The cancelled UI job also had a real earlier failure: the mocked-Gateway widget sandbox test exhausted its 30-second native iframe pointer/layout readiness budget while collapsing an expanded frame (elementHandle.hover: Timeout 1ms exceeded). It serves board data and HTML from its own fixtures and does not execute the changed board SQLite path. Its test/helper bytes are unchanged. The entire failing file passed five times on the approved head and five times on the merge base, singly with --maxWorkers=1 (10 tests, 200.261 seconds total); current scheduled-main UI shards also passed. The original timeout is not reproduced, and its deeper timing cause remains uncertain. The one authorized single-job rerun passed (attempt 2 UI job); that success is not claimed as a fix. Other cancelled coverage remains unrun.

Released-SDK report and final-head FIFO

plugin-sdk:api:diff completed with exit 0 for v2026.9.8 (release commit fc23bc864e4553c2d215e479eeec47b67a0bf943) against exact final head 320af4cfb9fb8d585793a136b441d7fa0ef2150a on Blacksmith Testbox run 37146068216. Both declaration renders succeeded: 106.152 seconds for the release and 116.633 seconds for the candidate. The provenance record is openclaw.plugin-sdk-api-release-evidence/v1, status checked, with both head/workflow SHA bound to the approved head.

The complete JSON report is 14,179,952 bytes, SHA-256 6859a6583e6858229e3d541ff62fdcd73ec5385edbf1a47b26f6ecf58f3a5217; comparison digest c7d46b0bc9f01609c049a2947042b5040635ea76dedff6b557ca56f0108c195f. It reports 8 removed entrypoints, 1 added entrypoint, and 2,219 export changes across the broad release-to-head history. This is not a zero-difference release report. Source reachability and report inspection find no changed board-read signature in the released Plugin SDK surface; the renamed kernel helper remains internal. No new compatibility shim or acknowledgement of unrelated release changes was introduced.

On the same exact-head Testbox, pnpm test src/boards/sqlite-board-store.worker.test.ts -t 'reads the committed Board' --maxWorkers=1 passed all three selected read-after-write regressions (snapshot, metadata, MCP); 16 unrelated cases were skipped by the explicit filter. Vitest wall time was 7.14 seconds; the repository wrapper took 23.53 seconds. Both task-owned Testbox leases were stopped after proof.

Move durable dashboard snapshot and widget-document reads through the existing board worker and canonical agent broker. Preserve FIFO consumption, live routing authority, domain errors, and accepted-work close settlement; retain the excluded incognito owner.
@clawsweeper

clawsweeper Bot commented Oct 3, 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 size: L labels Oct 3, 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 Oct 3, 2026
@clawsweeper

clawsweeper Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 3, 2026, 3:24 PM ET / 19:24 UTC (Revision 5).

ClawSweeper review

What this changes

Move durable dashboard snapshots and widget-document reads into the existing board database worker while preserving read/write ordering and synchronous authorized consumption.

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 these board reads on the host. No actionable introduced defect was found, and the updated evidence addresses the previous SDK-comparison blocker.

Priority: P2
Reviewed head: 320af4cfb9fb8d585793a136b441d7fa0ef2150a

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused implementation with meaningful boundary regressions and no actionable correctness findings; the previous SDK-report follow-up is addressed.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies a MEMBER author, so ordinary external-contributor proof is exempt. Submitted boundary evidence exercises the real board worker, HTTP delivery, FIFO ordering, and Gateway close; source review found no material authority expansion requiring an exceptional proof gate. Stored-data contracts are unchanged. The successful final-head SDK report is recorded in the updated body, though its linked log download was blocked in this environment.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies a MEMBER author, so ordinary external-contributor proof is exempt. Submitted boundary evidence exercises the real board worker, HTTP delivery, FIFO ordering, and Gateway close; source review found no material authority expansion requiring an exceptional proof gate. Stored-data contracts are unchanged. The successful final-head SDK report is recorded in the updated body, though its linked log download was blocked in this environment.
Evidence reviewed 9 items Pinned introduction and merge ownership: Reviewed the merge-base-to-head introduction. The raw test-merge record contains the pinned main parent followed by the exact PR head; its reported resulting surface matches the introduced board changes.
Worker ownership and FIFO consumption: Durable reads capture physical identity before yielding, reserve the existing admission queue, execute through the canonical publication owner, recheck authority after the read, and consume synchronously before releasing the reservation. External consumer promises are awaited afterward; incognito retains its existing process-held owner.
Authorization and disclosure boundary: Gateway routing checks compare the captured logical agent, store path, and canonical session without rediscovering the physical store. The executor retains physical ownership validation. Widget HTTP consumption still checks live ticket authority, expiry, revision, generation, and grant state before ending the response.
Findings None None.
Security None None.

How this fits together

Boards store session dashboards and widget content in agent SQLite databases. Gateway requests read that content for dashboard responses, widget HTTP delivery, and MCP App views.

flowchart TD
  A[Dashboard and widget requests] --> B[Capture session and physical store]
  B --> C[Shared read and write queue]
  C --> D[Existing board database worker]
  D --> E[Coherent SQLite read]
  E --> F[Recheck current authority]
  F --> G[Consume response or widget content]
  G --> H[Release publication and execution]
Loading

Before merge

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

Security

None.

PR surface

Source +153, Tests +321, Docs +5. Total +479 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 5 215 62 +153
Tests 6 346 25 +321
Docs 1 14 9 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 575 96 +479

Review metrics

Metric Value Why it matters
Production versus regression coverage production net +153 LOC; tests net +321 LOC Production growth has a stated purpose: typed worker reads, captured ownership, authority checks, and lifecycle cleanup.

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:

Keep one board database owner serving durable reads and writes, with current-authority checks, coherent snapshots, and joined shutdown cleanup.

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

Yes, from source: current-main direct getters bypass the write reservation and can read before an earlier queued write commits. The PR supplies focused failing-before/passing-after evidence; this review did not execute it.

Is this the best way to solve the issue?

Yes. Extending the existing board worker and shared admission queue is a focused repair that preserves released asynchronous interfaces and persisted formats.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded board-read ordering and runtime-thread 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 supplied repository state identifies a MEMBER author, so ordinary external-contributor proof is exempt. Submitted boundary evidence exercises the real board worker, HTTP delivery, FIFO ordering, and Gateway close; source review found no material authority expansion requiring an exceptional proof gate. Stored-data contracts are unchanged. The successful final-head SDK report is recorded in the updated body, though its linked log download was blocked in this environment.

Evidence

What I checked:

  • Pinned introduction and merge ownership: Reviewed the merge-base-to-head introduction. The raw test-merge record contains the pinned main parent followed by the exact PR head; its reported resulting surface matches the introduced board changes. (67b3a6febf59)
  • Worker ownership and FIFO consumption: Durable reads capture physical identity before yielding, reserve the existing admission queue, execute through the canonical publication owner, recheck authority after the read, and consume synchronously before releasing the reservation. External consumer promises are awaited afterward; incognito retains its existing process-held owner. (src/boards/sqlite-board-store.ts:329, 320af4cfb9fb)
  • Authorization and disclosure boundary: Gateway routing checks compare the captured logical agent, store path, and canonical session without rediscovering the physical store. The executor retains physical ownership validation. Widget HTTP consumption still checks live ticket authority, expiry, revision, generation, and grant state before ending the response. (src/gateway/board-store.ts:47, 320af4cfb9fb)
  • Schema and released interface compatibility: The introduced read publication skips schema creation and uses existing read kernels; table definitions, codecs, and persisted representations are unchanged. Inspection of v2026.9.8 confirms the same promise-returning BoardStore methods. No plugin-sdk reference to the renamed internal kernel helper was found. (src/boards/sqlite-board-store.worker.ts:25, fc23bc864e45)
  • Previous blocker addressed: The captured updated body records a successful v2026.9.8-to-final-head SDK comparison on https://github.com/openclaw/openclaw/actions/runs/37146068216, with report SHA-256 6859a6583e6858229e3d541ff62fdcd73ec5385edbf1a47b26f6ecf58f3a5217 and comparison digest c7d46b0bc9f01609c049a2947042b5040635ea76dedff6b557ca56f0108c195f. It explicitly distinguishes broad release-history differences from this PR's unchanged board signatures. GitHub confirms a Testbox job that was subsequently cancelled; the workflow SHA is distinct from the candidate SHA. Direct log inspection was blocked at productionresultssa16.blob.core.windows.net, so report bytes were not independently inspected. This reviewer limitation does not invalidate the submitted evidence. (320af4cfb9fb)
  • Focused regression and lifecycle coverage: Read the changed tests: three direct getters wait behind accepted writes; transaction and commit target changes reject without invoking consumption; shared-store routing changes return an error without creating replacement storage; real Gateway close fences new requests and joins accepted worker reads. The body reports three final-head FIFO cases passing on Testbox and records measured focused-suite costs. Tests were not executed during this read-only review. (src/boards/sqlite-board-store.worker.test.ts:324, 320af4cfb9fb)

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 (4 earlier review cycles)
  • reviewed 2026-10-03T18:29:00.611Z sha 320af4c :: blocked before merge. :: none
  • reviewed 2026-10-03T18:37:59.543Z sha 320af4c :: blocked before merge. :: none
  • reviewed 2026-10-03T18:55:59.148Z sha 320af4c :: blocked before merge. :: none
  • reviewed 2026-10-03T19:13:42.647Z sha 320af4c :: blocked before merge. :: none

@steipete
steipete merged commit 9e32882 into main Oct 3, 2026
163 of 231 checks passed
@steipete
steipete deleted the dbasync/boardread branch October 3, 2026 20:16
@steipete

steipete commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 4, 2026
…h the board worker (openclaw#164448)

* refactor(workboard): read snapshots and widget documents in worker

Move durable dashboard snapshot and widget-document reads through the existing board worker and canonical agent broker. Preserve FIFO consumption, live routing authority, domain errors, and accepted-work close settlement; retain the excluded incognito owner.

* fix(workboard): type missing board read results

* style(workboard): keep the captured read target in a local binding
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 P2 Normal backlog priority with limited blast radius. 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