Repository navigation
fix: avoid slow incognito key checks in large session stores - #139528
Conversation
|
🦞👀 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 maintainer review before merge. Reviewed September 5, 2026, 8:33 PM ET / September 6, 2026, 00:33 UTC. ClawSweeper reviewWhat this changesUse existing session metadata to check explicit incognito keys without decoding unrelated saved prompts, and extend the session lifecycle regression test. Merge readiness✅ Ready for maintainer review The optimization remains useful on current main, and no actionable correctness or security defect was found. The maintainer-authored PR has a focused implementation and relevant reported validation. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway creates incognito conversations in process memory. Before creating an explicitly named conversation, it checks durable and process-local sessions to prevent key reuse. flowchart TD
A[Session creation request] --> B[Normalize and validate key]
B --> C[Read durable session metadata]
C --> D[Check durable and process-local collisions]
D --> E[Reject existing key]
D --> F[Continue authorized incognito creation]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +2, Tests +14. Total +16 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep collision detection on the existing metadata reader while preserving canonical validation, process-local checks, and saved prompt contents. Do we have a high-confidence way to reproduce the issue? Yes, from source: explicit incognito creation on current main requests full durable entries, causing unrelated saved prompts to be decoded. This review did not execute the reported probes. Is this the best way to solve the issue? Yes. Reusing the existing metadata projection is a narrow repair; the simpler keys-only reader would bypass validation behavior retained by this approach. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 652738ca86cc. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
* origin/main: (302 commits) test(gateway): preserve held-work close failures (#139593) refactor(exec): share package argument scanning (#139560) fix(audit): preserve sequence range validation before numeric decoding (#139587) fix(transcripts): retain capture ownership through failed cleanup (#139572) refactor(models): share selector reference traversal (#139571) perf(agents): classify allowlists without intermediate sets (#138392) chore(release): update appcast for 2026.9.2 (#139575) fix(ci): synchronize cloud retries and board widget input (#139506) fix(plugins): explain SDK incompatibilities after core updates (#139458) fix(voice-call): retain installed WebSocket behavior under Bun (#139567) test(text): consolidate literal sanitizer cases (#139579) test(gateway): observe native drain without a lint exception (#139576) test(memory): consolidate visibility fixtures without policy defaults (#139569) fix(ui): show shimmer skeletons while loading Control UI (#139525) test(qa): make cleanup child logging deterministic (#139566) test(cli): keep Unix socket fixtures within path limits (#139565) fix: avoid slow incognito key checks in large session stores (#139528) feat(macos): open Gateway windows from the Gateways menu (#139522) test(workshop): isolate marker casing fixture identities (#139554) fix(process): require cleanup evidence before releasing owned work (#139517) ... # Conflicts: # scripts/release-check.ts
What Problem This Solves
Fixes an issue where checking an explicit incognito session key performs unnecessary synchronous work as the durable session store grows.
Why This Change Was Made
Use the existing metadata listing for the durable collision check and consume its keys synchronously without cloning entries. Keep the same durable-store scope, canonical validation, malformed-row handling, and separate process-local existence check.
User Impact
Incognito key checks avoid decoding unrelated saved prompts. Collision rejection and incognito session lifecycle behavior stay unchanged. Listing still visits session metadata; this change adds no cache, schema, configuration, or public API.
Evidence
A synthetic source-service probe with 100 and 1,000 unrelated saved prompts reduced prompt decodes from 100/1,000 to zero. All eight actual service response cases, including normalized aliases and durable/process-local collisions, matched the baseline. Both readers retained the same fresh-handle malformed-row error.
The existing incognito create/list/spawn/reset/delete test now also checks that collision detection does not parse an unrelated saved prompt. It failed for that assertion on the baseline and passes with this change. All 162 tests in the complete creation suite passed. Exact-head CI succeeded, and the supplemental deprecated-API, database-first, media-helper, and runtime-sidecar audits passed. Independent review found no actionable issues.
A compiled Linux Node 26.7 Gateway using the reviewed source tree passed nine real RPC operations: normalized explicit creation, three process-local reuse aliases, another creation, listing, reset, deletion, and confirmation that the sessions were gone. All 1,000 unrelated durable prompts remained intact; no incognito session nodes or windows were written to disk. Source/build/process bindings, unchanged file hashes, and graceful process closure were independently verified.
The reader probe is not a whole-Gateway latency benchmark and does not use a live model provider. Warm legacy durable-collision and malformed-row cases are covered separately by the source-service proof. A duplicate local changed-check run was cancelled after exact-head CI coverage was verified; it is not reported as a passing local full run.