Repository navigation
refactor(sessions): finish suggestion list worker reads - #163546
Conversation
Move durable listing through the existing read worker and recheck current caller, sharing policy, and retained session facts before responding. Preserve the existing claim and accepted-input settlement protocol and native incognito owner. Integrate the pinned main snapshot for the session worker contract.
|
🦞👀 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. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed October 2, 2026, 9:31 AM ET / 13:31 UTC (Revision 3). ClawSweeper reviewWhat this changesMoves disk-backed session suggestion listing into the existing read worker and rechecks access before returning results, while preserving native incognito reads. Merge readiness✅ Ready for maintainer review This PR remains necessary: current main and the latest release still list suggestions synchronously. No actionable introduced defect or additional merge blocker was found. Priority: P2 Review scores
Verification
How this fits togetherSession suggestions let people propose input to shared conversations. The Gateway reads their stored suggestions, applies current sharing permissions, and returns the visible rows to the requesting client. flowchart TD
A[Client list request] --> B[Retain session and store facts]
B --> C{Storage owner}
C --> D[Disk read worker]
C --> E[Native incognito reader]
D --> F[Recheck current access]
E --> F
F --> G[Filtered response or refusal]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +127, Tests +158. Total +285 across 16 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep one worker-backed disk listing owner with current-access filtering at response time and the existing incognito lifecycle owner. Do we have a high-confidence way to reproduce the issue? Not applicable to a functional bug reproduction: this is an execution-boundary refactor, and current-main source directly confirms synchronous listing. No tests were executed in this read-only review. Is this the best way to solve the issue? Yes: extending the existing read worker and shared query kernel is a focused cutover, and the final response uses current access facts rather than pre-await authorization. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 155613d6dd6e. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via squash.
|
Related: #148951, #163030
What Problem This Solves
Suggestion listing still queried SQLite on the Gateway thread after suggestion writes moved to the collaboration worker.
Why This Change Was Made
Route listing through the existing read-only session worker and retain the original store and session facts through the asynchronous read. Normalize bare session keys after the reader discovers the store owner. Recheck the caller, committed sharing policy, membership, and session lifetime before returning rows. A member downgraded to viewer receives only their own suggestions. Remove the synchronous list API and the unused native-write re-exports from the sessions barrel.
The existing add, claim, release, and finalization worker operations retain their transaction/commit authority checks and the distinction between revocable requests and accepted-input settlement.
User Impact
Listing preserves ordering and visibility while its database work executes in a worker. No configuration or migration is needed.
session-suggestion-store.ts: 4; kernel: 9). These shared implementations still serve the process-held incognito owner; no inventory classification was changed.Evidence
Initial base:
37ae73947bf07fc562ba935c4581283b4b80ecb2. Main was integrated at pinned basecee0906f3877c436725a079d4e41537fc204f75cwithout changing the suggestion write protocol. The complete final selection passed 76 tests in 178.65 s after the bare-key correction (OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=1800000 pnpm testwith all seven files below and--maxWorkers=1).OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=1800000 pnpm test <file> --maxWorkers=1individual-file cost measurements are below (the storage and visibility measurements include the final read correction):src/config/sessions/session-suggestion-store.test.tssrc/gateway/server-methods/sessions-suggestions.visibility.test.tssrc/gateway/server-methods/sessions-suggestions.test.tssrc/gateway/server-methods/session-metadata.admission.test.tssrc/gateway/server-methods/sessions-suggestions.provider-review.test.tssrc/gateway/server-methods/sessions-suggestions.store-binding.test.tssrc/gateway/server-methods/sessions-suggestions.custody.test.tsThe existing fixture-heavy suites protect transaction admission, exactly-once dispatch, real chat custody, provider refusal, and alias/incognito ownership; only their list assertions now await the read. New visibility cases use deferred worker replies, without timers or new production test seams. Wall times include compilation on the loaded development host; hosted CI seconds are not yet available.
The negative boundary proof restored the list owner, barrel, and registered handler to the pinned base and failed on 4 prepares, 5 gets, and 2 alls. Candidate source bytes were restored before the passing tests.
node --import ./scripts/tsx.mjs scripts/build-all.mts qaRuntime: passed before integration; integrated tests compile the current worker sources.node scripts/check-changed.mjs --base 37ae73947bf07fc562ba935c4581283b4b80ecb2: passed before integration, including all 27 test typecheck graphs and touched-file lint.node scripts/check-changed.mjs --base cee0906f3877c436725a079d4e41537fc204f75c -- <16 changed paths>stops at an inherited environment-name budget failure from improve(agents): explain unknown tool outcomes and assert append-only request history #163379: 477 names versus budget 476. Using the repository collector on that exact base and this candidate proves both contain the identical 477 names, with no added or removed names in this PR. The budget is unchanged; this unrelated failure is reported rather than suppressed.pnpm tsgo:core, targetednode scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.jsonon the changed read/type files, and the line-cap ratchet: passed.pnpm check:madge-import-cycles: 0 cycles.pnpm check:database-worker-ratchet --base cee0906f3877c436725a079d4e41537fc204f75c: passed; unchanged owner counts were also measured directly on this base and the candidate.node scripts/database-worker-inventory.mjs --json, plus itsinventory(root, pinnedBase)API for the base: owner counts above.Local validation recovered from a test-fixture measurement error and an artifact snapshot collision by moving client setup outside the observer and serializing build/test compilation. The missing-table test now expects the existing worker admission error and still proves the table is not recreated. A new bare-key assertion caught eager owner resolution during implementation; it passes with normalization deferred until worker discovery.
Compatibility Retained
Process-held incognito databases keep their existing native owner. The synchronous add/claim/release/finalize helpers remain internal worker/incognito implementations; no public plugin SDK contract changed. Disk listing has one asynchronous path, with no synchronous fallback.
Update Behavior
No schema, stored-format, durability, retention, configuration, or permission changes. Existing installed state remains valid; no migration or Doctor/updater changes are required.