Repository navigation
Conversation
Prepare and filter each admitted transcript candidate batch once, retaining physical global ownership and session-tool visibility. Avoid rebuilding selection and recipient presentation for every matching key.
|
🦞👀 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 Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesPrepare session-list selection and visibility once per transcript candidate batch instead of once per matching key. Example: The reported search regression authorizes 28 matching keys across 14 candidate batches.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR removes demonstrated repeated preparation using the existing selection owner, and no introduced correctness or security defect was found; CI still has a failed gate requiring disposition. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway and embedded session-search callers send recall queries to the transcript worker, whose matching-key batches are authorized through session-list sharing and agent-tool visibility owners before bounded results return. flowchart LR
A[Session search caller] --> B[Recall owner]
B --> C[Transcript worker]
C --> D[Candidate key batch]
D --> E[Existing list selection and sharing]
E --> F[Agent tool visibility checks]
F --> B
B --> G[Bounded search results]
Technical reviewBest possible solution: Retain the batch-scoped reuse of the existing list owner and its separate physical-global authorization. Do we have a high-confidence way to reproduce the issue? Fetched main visibly rebuilds selection and presentation inside the candidate-key loop; the PR reports a base-failing work-count regression and supplies a reproducible owner benchmark, neither of which was executed during this read-only review. Is this the best way to solve the issue? This is a small, complete optimization using the existing candidate selector, with no cross-request cache, competing policy owner, or unnecessary production machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3eee09d9b462. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -3, Tests +159, Other +204. Total +360 across 4 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
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 Reviewed November 18, 2026, 6:01 PM ET / 23:01 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
Integrate main 949e51d to resolve the conflict with #201490. Keep its shared candidate-batch preparation in the existing worker/final-publication authorization owner. Retain current sharing-data checks, synchronous response publication, bounded retries and admitted-role policy. Co-authored-by: vincentkoc <[email protected]>
…law#201490) Prepare and filter each admitted transcript candidate batch once, retaining physical global ownership and session-tool visibility. Avoid rebuilding selection and recipient presentation for every matching key.
What Problem This Solves
Searching session transcripts repeatedly builds the same session-list selection and recipient presentation for every matching key. On larger rosters, that creates unnecessary main-thread work and allocation during recall.
User Impact
Session recall uses less CPU and memory while returning the same visibility decisions. Global transcript ownership, sharing, federation, cron and phantom exclusions, Incognito, spawned-session restrictions, and pinned visibility remain enforced.
Why This Change Was Made
Expose the list owner's existing candidate-key selection through its preparation API, prepare/filter each admitted candidate batch once, and use set membership for individual keys. Global keys retain their separate physical-owner authorization. Nothing is retained across worker yields or requests, and transcript indexing is unchanged.
This preserves the request-scoped runtime reuse from #189322 within the indexed recall path introduced by #200355. Production code is net −3 lines. Runtime-resolution composite keys remain unchanged: replacing their complete nine-field encoding would add separate cache machinery without addressing the repeated preparation.
Evidence
The real search regression fails before the fix: 28 preparations for 14 candidate batches. It passes after the fix. All 54 focused tests pass, including the list selector, filters, retained partitions, search RPC handler, and agent-tool visibility. A mixed-roster differential compares batched verdict bytes with the original exact-key preparation and independently asserts the expected exclusions. The corrected malformed phantom fixture also passed its focused rerun.
Synthetic benchmark: 600 resident rows, 130 indexed matching keys, real recall owner and transcript worker. Five samples per process; serial ABBA fresh processes, 200 recalls per timing sample, separate allocation sampling with collected objects included. The worker limits batches to 26 keys; this removes per-key preparation, not the fresh authorization boundary after each worker yield. The fixture intentionally does not reproduce multi-gigabyte transcript storage or workspace traversal, which are outside this owner path.
Sampled allocation fell from 9.43 MB to 1.53 MB per recall (84%), with same-code process medians within 1%. Both timing pairs improved: 42–55% lower main-thread CPU and 15–33% lower elapsed time. The busy shared host produced substantial A/A timing variation, so these ranges are paired observations, not production latency guarantees. Cold worker initialization is reported separately by the script.
Each cell has 10 samples across two fresh processes. Timing sample ranges were CPU 3.00–5.00 → 1.34–2.82 ms and elapsed 5.08–13.97 → 3.36–12.20 ms. Cold first-call ranges were 2.66–10.30 → 2.88–5.65 s, dominated by worker admission and unsuitable for attributing this warm-path improvement. The full five-file test run took 230.64 s including compilation; the changed search-scope tests took about 26 s in the first complete run.
Reproduce with
node --expose-gc --import ./scripts/tsx.mjs scripts/perf/session-recall-measure.ts --state-dir <synthetic-directory> --sessions 600 --keys 130 --iterations 200 --samples 5. Reuse serially with--reuse; use--owner-ref a4be1ae09e3ebe021f55fb65dd3663aa2a152504for the exact baseline recall owner and--allocationin separate processes.pnpm check:changedcompleted. Its line-cap and two proof-code typing findings were corrected and their gates rerun successfully. The remaining unused UI export reproduces on exact basea4be1ae09e3ebe021f55fb65dd3663aa2a152504: the same full-tree Knip command exits 1 with onlyui/src/e2e/new-session-page.test-support.ts: expectPendingNewSessionPresentation (e2e). #198967 (a90c5419b779d) introduced this main regression by removing every caller while leaving its export. This PR does not change that UI path. All change-caused local failures are resolved; CI remains pending.Codex autoreview: scoped-clean through P2 on the complete change against
a4be1ae09e3ebe021f55fb65dd3663aa2a152504; no actionable findings. Subsequent edits only corrected proof-code types. No Control UI imports of the changed production modules were found. No schema/configuration change or live Gateway modification.CI run 44411579287 has one investigated failure so far:
checks-node-changed-1,sessions-list-privacy.test.ts, “rechecks named role enrichment after a role change during chat.history”. The identical focused test fails on exact CI main parent777fc99a8993b55fab66e3cb17faf4ef520cd40fand on this head: the admitted request returns two rows instead of rejecting. #201334 (04cb8179ccd66) deliberately changed authority to remain fixed for admitted requests and apply role changes at the next request, leaving this test's old mid-request rejection expectation behind. This is a main test regression, not a passing CI claim; the test and authority owners are unchanged here. Remaining jobs and final-head ClawSweeper review are pending.