Repository navigation
refactor(boards): move cross-store dashboard writes off the main thread - #170541
Conversation
Run durable Board writes in the target worker with source authority checked once at admission. Access revocation denies new writes while already admitted writes may complete. Preserve target lifecycle and disclosure checks, and retain the legacy incognito escape hatch.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. What this changesThis PR moves durable cross-store dashboard mutations into the existing database worker and checks source access once before dispatch. Example: The board-member caller saves an in-flight widget in agent:target:board while source membership is revoked.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 2 items remain Keep open: this maintainer-directed worker cutover remains useful and distinct from current main; the follow-up fixes the prior test-registration finding, and no new discrete code defect was found. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherGateway dashboard handlers pass mutations and retained source authority to the Board store, which dispatches durable writes to the existing agent database worker and publishes committed invalidations. flowchart TD
A[Gateway dashboard request] --> B[Retained sharing authority]
B --> C[Board admission]
C --> D[Agent database worker]
D --> E[Dashboard rows]
D --> F[Committed invalidation]
F --> G[Current disclosure check]
Technical reviewBest possible solution: Complete the existing worker cutover while preserving current authorization at private disclosure and widget capability effects. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the synchronous cross-store target fallback; no target code or tests were executed during this read-only review. Is this the best way to solve the issue? Reusing the existing worker and sharing-facts owner is a focused solution, with an explicitly accepted revocation tradeoff and the legacy incognito owner retained. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 992724e0fd1f. Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: No concrete exploit was established, but the changed authority boundary still needs final-effect proof. EvidenceWhat I checked:
PR surfaceSource -95, Tests +63, Docs +13. Total -19 across 11 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 12, 2026, 11:03 PM ET / October 13, 2026, 03:03 UTC (Revision 2). |
Use the authenticated profile ID for shared-session membership and revocation, and register the boundary tests in the existing database-worker core lane.
|
Reviewed the additional final-effect proof request. The new production-owner regression covers allowed writes, revoked-source denial, pending/unknown denial, and the explicitly accepted completion of an already-admitted write. The RPC mutation handlers still call Follow-up: add a combined RPC-level scenario that demonstrates admitted persistence alongside denied private response delivery and denied widget capability execution after revocation. The review identifies no concrete exploit or new code defect; this broader proof request is non-blocking under the maintainer's relaxed landing policy. No further review round is requested. |
…ad (openclaw#170541) Check retained source authority once at admission and dispatch durable Board mutations through the existing target worker. Source revocation denies new admissions while already-admitted writes may finish. Remove duplicate source preparation and worker revalidation; preserve target identity, lifecycle, and private-content disclosure checks. Add boundary regressions and document revocation behavior. Legacy process-held incognito retains its native path pending the session-storage owner cutover. Warmed causal SQL is unchanged at 170.2 statements and 41.3 requests per turn, with zero MAIN statements; the shared harness contains no Board writes. Production diff: +14/-109 lines.
What Problem This Solves
Cross-database Board writes fell back to a synchronous target transaction, blocking the Gateway while rereading source permission that the request owner already retains.
User Impact
Durable dashboard writes run in the existing target worker. Revoking source access denies new writes; a write admitted before revocation may still finish saving its widget or layout. This is the explicitly accepted, bounded exception: only writes already in flight at revocation. Target identity/lifecycle checks and private-content disclosure checks remain current.
Why This Change Was Made
Board checks the caller's source authority once, after asynchronous preparation and queue admission, immediately before dispatching the mutation. Ordinary Gateway callers read the sharing owner's retained facts: its pending publications block admission, committed receipts install facts before releasing the denial, and unknown outcomes remain denied. Board no longer prepares a second source snapshot, sends source predicates to the target, rereads them at transaction/commit, or chooses a native target transaction for a cross-store source. Existing synchronous callbacks remain callable at admission; no SDK exports or schema change.
Removed checks and accepted edge cases:
The legacy process-held incognito database remains native under the scoped escape hatch. It is a live configuration contract, demonstrated by
src/gateway/board-store.test.tsusing the production singleton without an actor. Moving it requires the separate session-storage owner cutover; reopening its sentinel in a worker would lose data. Thus the assigned write-site inventory remains 8 → 8 T1 sites, all still reachable from that legacy path; durable cross-database Board target calls move off main. The shared mutation kernel cannot honestly be classified as worker-only yet.Evidence
pnpm test src/boards/sqlite-board-source-authority.test.ts --maxWorkers=1passed all three tests; command wall time 927.17 s on the loaded host. Measured-head CI run 38343772697 passed in 770 s (45 successful jobs, 25 skipped; 8,929 aggregate successful job-seconds).git diff --check: passed.0e0e87d465c9b, so main was merged without changing the reviewed Board patch. Refreshed-head CI run 38343772697 passed in 770 s (45 successful jobs, 25 skipped; 8,929 aggregate successful job-seconds). The separate Knip scan on measured headb2d7d083264creported onlyui/src/components/board/board-widget-cell-render.ts: renderBoardWidgetError. The identical production-unused-export finding was reproduced on clean main basef7d7425192bdusing pinned Knip 6.32.2; that UI file is untouched here. The candidate script-export scan passed. The finding was assigned to the main-repair inbox. Final main integration removed that UI file, so the earlier inherited-static exception is no longer needed.e65c0bd16568was merged as217844199512. The Board production diff is byte-identical to measured/reviewed headb2d7d083264c; changed-file formatting and lint passed again. Integration-head CI run 38349905389 passed: 45 successful jobs, 25 skipped, 734 s wall time and 8,405 aggregate successful job-seconds. The existing pair is retained as evidence for the unchanged Board patch; no additional local suites or harness runs were started.The shared v2.1 workload contains no Board writes. Its baseline/candidate pair is a shared-read regression check; Board boundary tests establish the mutation behavior and zero host SQL for retained source admission. No per-Board total-statement saving is claimed from this workload.
One alternating pair, base
f7d7425192bdthen candidateb2d7d083264c, with ten warmed turns each. Both complete runs passed all 13 top-level turns, the child turn, 39 RPCs, cron, compaction, graceful shutdown, and child-process cleanup. A task-local harness copy corrects its obsolete synthetictool_callalias todispatch_actionand places fixtures on external storage; observer and workload are unchanged. An earlier uncorrected baseline stopped at that alias mismatch and is excluded.Every warmed SELECT fingerprint has the same execution count. The legacy warmed increase is background work in longer windows (24.485 s versus 31.010 s); the turn-caused statement and request deltas are zero. First-turn causal SQL is 375 → 380: one extra six-statement canonical-validation load and one exact-entry cohort read, offset by two fewer schema/quarantine checks, all in unchanged session admission owners. No changed Board mutation runs in this workload. The whole-workload difference is +8 statements / +26 requests from unchanged admission/background activity, accepted under attribution-over-raw. Host load was 90.14 → 76.50 for base and 78.31 → 46.71 for candidate on 32 CPUs; latency is unmeasured.