Repository navigation
refactor(boards): move session admission and presentation reads to workers - #165799
Conversation
Prepare durable session existence and sharing authority through the existing readers, then reread the captured session and source predicates at Board transaction and commit. Preserve source preparation through GitHub identity selection and carry worker-prepared Board membership into presentation. Retain synchronous opaque SDK and cross-store guards and the incognito owner. Join accepted source cleanup, preserve publication and unknown-outcome behavior, and add worker-grant and Gateway-close coverage. No schema, permission-policy, retention, or update migration changes.
|
🦞👀 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. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: blocked before merge. Reviewed October 5, 2026, 5:46 PM ET / 21:46 UTC (Revision 2). ClawSweeper reviewWhat this changesMoves durable Board session admission and session-list Board facts into existing database workers while preserving authorization, write ordering, and committed publication. Warning SQLite table change This PR modifies persisted SQLite tables in Merge readiness⛔ Blocked before merge - 3 items remain This remains useful work beyond current main. The fixture repairs preserve the relevant invariants, and no actionable correctness or security finding remains; the previously required package/update qualification is still outstanding. Priority: P2 Review scores
Verification
How this fits togetherBoards store session dashboards and widgets. Gateway requests enter the Board store, which checks session and caller authority before committing changes; prepared database facts then feed session presentation. flowchart TD
A[Gateway Board request] --> B[Existing write queue]
B --> C[Session reader prepares facts]
C --> D[Board worker checks session and membership]
E[Live caller authority] --> D
D --> F[Commit Board changes]
F --> G[Publish changes and session rows]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +227, Tests +213, Docs +11. Total +451 across 26 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the existing worker and publication owners, preserve released synchronous guards, and qualify the packaged candidate against existing operator state before landing. Do we have a high-confidence way to reproduce the issue? Not applicable as a refactor; current main source confirms the caller-thread reads being moved. This read-only review did not execute the reported measurements or tests. Is this the best way to solve the issue? Yes: extending the existing readers, Board worker, and source-authority composition preserves a single owner for each responsibility; the remaining uncertainty is packaged upgrade behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 89792e5aeb98. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
Dispatch the synthetic Board WebSocket's registered client and use the existing prepared-row boundaries in projection fixtures. Preserve immediate membership and lifecycle revocation assertions; replace the obsolete native cache mock with a committed replacement observed through sessions.describe. The five affected files failed in five runs each on the prior PR head and passed in five runs each on its merge base. All 65 repaired tests, affected test typechecks, lint, formatting, and a fresh P2 review pass.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…rkers (openclaw#165799) * refactor(boards): prepare session admission and authority in workers Prepare durable session existence and sharing authority through the existing readers, then reread the captured session and source predicates at Board transaction and commit. Preserve source preparation through GitHub identity selection and carry worker-prepared Board membership into presentation. Retain synchronous opaque SDK and cross-store guards and the incognito owner. Join accepted source cleanup, preserve publication and unknown-outcome behavior, and add worker-grant and Gateway-close coverage. No schema, permission-policy, retention, or update migration changes. * test(boards): align admission fixtures with worker owners * test(boards): prepare worker-backed runtime fixtures Dispatch the synthetic Board WebSocket's registered client and use the existing prepared-row boundaries in projection fixtures. Preserve immediate membership and lifecycle revocation assertions; replace the obsolete native cache mock with a committed replacement observed through sessions.describe. The five affected files failed in five runs each on the prior PR head and passed in five runs each on its merge base. All 65 repaired tests, affected test typechecks, lint, formatting, and a fresh P2 review pass.
What Problem This Solves
Durable Board writes repeatedly read session existence on the Gateway thread, and session presentation could fall back to a native Board-membership query. Board work also needs to reject a replaced session or revoked membership after asynchronous preparation.
Why This Change Was Made
The existing exact-session reader prepares the durable session identity inside the existing write FIFO. The existing Board worker compares that identity and prepared source predicates in its synchronous transaction and again at commit; host grants retain current runtime authority. The existing owner publishes acknowledged changes once and joins cleanup without replaying unknown outcomes. Session rows reuse prepared Board facts and leave missing facts dirty for their reader owner.
Opaque and cross-store callbacks retain native atomicity for the shipped synchronous Gateway request guard contract (
v2026.9.8,gateway-runtime.ts:46andshared-types.ts:477). Bundled Board and GitHub adapters preserve preparation through the existing source-authority composition. The real server-close regression joins accepted Board work before closing database transports.Production scope: +316 / −89, net +227; 405 changed lines. This is the separate Board owner half of the wave-5 Goal/Board work.
User Impact
Ordinary Board writes and prepared session presentation move those reads off the caller thread while preserving write ordering, current authorization, and acknowledged results. The change preserves schema, durability, retention, dependencies, environment names, and public method signatures. Incognito remains with its existing owner.
Evidence
The real durable write fixture reduces caller-thread session-existence SQL from 12 calls / 0.243249 ms to 0 calls / 0 ms. The physical-target presentation fixture reduces Board-membership SQL from 1 call to 0 (single-call presentation duration 1.737167 ms → 0.621500 ms, not an end-to-end latency benchmark). The baseline was
2a6621faf75c0a5914e5f5e24ce6f2b692d5b85e; the durable admission expressions and membership reader are unchanged at the original basea33accd27f3dand the fresh rebase base0e54386a46344884e0317c21b81d21b29ccdb615.The database-worker ratchet passes: T1 848 → 848, Board 12 → 12. The static expressions still serve excluded incognito/native compatibility consumers; no metadata reclassification claims a static reduction. Runtime boundary tests assert zero caller SQL for the moved reads and zero same-owner session/member reads inside ordinary Board worker grants.
Pre-rebase validation covers 241 tests across 21 Board, projection, lifecycle, and configuration files with
--maxWorkers=1, plus the import/GitHub/close evidence below. Each initially failing fixture listed below was repaired and its affected suite or cases passed. The existing host-owned/fork projects already supply the necessary owners, so no routing change was needed.The fixture repairs preserve behavior rather than accept absent/stale output: keyed reads now use the same
withReadySessionRowsboundary assessions.describe, still checking the newest label, source entry, and unchanged generation; they record a second worker read instead of a hidden native reread. The transcript-only case now creates a valid retained placeholder through the real deletion lifecycle and still requires the Boardnot_foundrejection. The outcome fixture supplies prepared process authority so it continues exercising committed worker delivery and cleanup failure. All repaired cases failed before the corresponding fixture update. CI elapsed seconds are not yet available; these are local measured times.The earlier
check-changedrun completed production/core-test type graphs, formatting, storage/source guards, and the remaining selected commands, with three inherited Knip findings. Fresh main removes those stale browser/media exports inb2750b2346051; the post-rebase dead-export guard now passes all three scans with zero entries in 85.84s.Rebased cleanly onto
0e54386a4634, yielding4cf3d33053ec.git range-diffconfirms both commits are patch-identical to the reviewed versions, and all 11 production files have identical blobs. Main added the worker job observation hook to the outcome-test fixture and updated documentation. The prior clean P2 review remains applicable; focused suites are rerun after rebase. The post-rebase focused command passed 139 tests across 11 files, with 1 existing skip, in 337.52s wall time (--maxWorkers=1). It covers outcome delivery, worker/native/incognito/parity behavior, Board/progress admission, MCP authority, row facts, accepted/prepared presentation, and the real server-close order. The refreshed worker ratchet and SDK source-budget check also passed.The post-rebase SDK source budget passes (151 public entrypoints / 3,648 exports / 2,110 callable exports). The full API diff from
a33accd27f3d3331d0d42d8915038d3aa47b2421to the reviewed pre-rebase head36f4917caf684faaf9d5598ecc306b9303e98d7chas no entrypoint or direct-export change; digest75ac1559reports 128 reachable-export hashes from two internal namespace changes: exporting the shared source-refusal predicate helper and removing the superseded materializerreadEntrycallback. Existing public method signatures are unchanged. The removed callback is a required input to an internal factory, with its sole construction path migrated; returned callable APIs are unchanged. The landing audit also checkedv2026.10.1-beta.1(latest tag) andv2026.9.8(latest stable): both expose the synchronous Gateway request guard, which this change preserves. The changed Board backend/kernel and materializer inputs are internal; none is exported through a released SDK subpath orapi.runtime. No other-owner host SQL was identified in the bundled Board grant chain; opaque/cross-store callbacks retain the native compatibility route.Sibling Goal PR: #165785. Potential overlapping work: #165370, #165552, #165205 (session-authority/storage documentation) and #162433 (standing umbrella ownership work). The base already contains #165028, #165454, and #165601; their changes are preserved. Incognito expressions remain outside this PR's scope.
Package and update qualification
Passed: canonical package build/validation and the published
2026.9.8driver × candidate update cell. The package embeds reviewed commit4cf3d33053ec82afa1ca1f6a94c6b5ef98c91d50, version2026.9.8, build ID2026.9.8-4cf3d33053ec-2026-10-05T21-28-55.262Z; tarball SHA-256 isa12a8015552b673bd48b6e384264ad33733f9afb440082eb81b0e6de961eb491. The final head differs only in the five test files described below: production, package/dependency, schema, and build inputs are unchanged, so this is reused unchanged-input qualification, not a claim that the package embeds the later test-only commit.AWS run
run_67c8f8d8226162c25814cba6f949787ccompleted package integrity/import validation and the canonical update cell. The cell recordsphase: finished,/readyz: 200, running version2026.9.8, updater exit code0, and a terminated updater process tree. Update time was 400.280s; complete cell 492.83s; package phase 673.587s. Durable sessions across two agents survived and incognito state did not survive restart. This canonical cell does not explicitly seed a Board row; separate real durable Board parity/persistence tests cover that owner, and no Board schema or serialized-data change was introduced.Testbox timed out without a runner after 15 minutes and was stopped. The initial AWS attempt failed at broker event attribution before payload; its outcome was reconciled before reusing the healthy lease. Both product gates then exited
0. The outer proof command exited1only afterward because its evidence archive was created inside the directory being archived (tar: .: file changed as we read it); collection was repaired outside that directory without rerunning either gate. Verified evidence archive SHA-256:3db1632c2d98d1cfa42bc32d91492a6f92c3a3999936becaa8901ca536e5f641.Landing validation
Repair commit
2b638d373d499b484a8ed0ee8c7be7355c73a836updates only five tests. Exact-head CI run 37373560142 found seven failing assertions across those files. Every file failed in five single-file runs on4cf3d33053ecand passed in five runs on merge base0e54386a4634: these were deterministic fixture failures introduced by the cutover, not inherited failures or flakes.The synthetic Board WebSocket registered an admin client but dispatched with
client: null. It now dispatches that registered client while preserving stale-root denial, zero writes/events, and fresh-root success. Projection fixtures use the existing prepared-row boundary; all synchronous membership/revocation assertions remain before the await. The worker-race fixture replaces an obsolete native-cache mock with a real committed replacement, immediate old-generation revocation, and asessions.describeresponse check. Production files are identical to the reviewed4cf3d33053echead.pnpm test <file> --maxWorkers=1)The two affected test-type graphs pass (Gateway root 17.2 s, Gateway methods 16.5 s). Type-aware lint, formatting, diff checks, and a fresh isolated Codex P2 review pass. The review specifically retained the synchronous membership assertions and confirmed real replacement/describe coverage.
The initial PR-context check failed because its required heading was named
Problem; the body now uses the repository template headings and passes the local policy evaluator. One UI job was cancelled without a runner or any executed step during the GitHub Actions incident; its coverage was not run. The repaired head passed CI run 37377312855, with no failed jobs.ClawSweeper completed review of the final head
2b638d373d499b484a8ed0ee8c7be7355c73a836at 2026-10-05 21:46:09 UTC, with no actionable code or security findings. Its outstanding package/update qualification is supplied above, including exact artifact identity and applicability to the test-only repair.