Repository navigation
refactor(gateway): schedule Incognito expiry - #158690
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 26, 2026, 2:12 AM ET / 06:12 UTC. ClawSweeper reviewWhat this changesMoves Incognito expiry wakeups into the Gateway kernel scheduler and updates the lifetime sidecar wiring and clock-driven tests. Merge readiness✅ Ready for maintainer review Keep open. Current main still uses a private Incognito expiry timer, so this remains a distinct scheduler migration. Source review found no blocking defect in the expiry, retry, identity, or shutdown paths. Priority: P3 Review scores
Verification
How this fits togetherThe Gateway observes Incognito sessions held in process memory and schedules their expiry. When a deadline arrives, the existing session deletion owner removes the session and transcript. flowchart LR
A[Session changes] --> B[Incognito lifetime]
B --> C[Gateway scheduler]
C --> D{Deadline due?}
D -->|Yes| E[Session deletion]
E --> F[Session and transcript removed]
G[Gateway shutdown] --> C
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +2, Tests +35. Total +37 across 5 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep the kernel scheduler responsible for wakeups while the Incognito lifetime and deletion owners retain the 24-hour policy, identity checks, and cleanup. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR reorganizes an existing expiry path rather than reporting a current-main failure. Source inspection confirms main still uses the private timer. Is this the best way to solve the issue? Yes: the existing kernel scheduler is the appropriate wakeup owner, and the patch retains the established Incognito deletion and identity checks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 65e3eecabd84. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
b6ee89a to
0508acc
Compare
|
Merged via squash.
|
What Problem This Solves
Incognito session expiry owns private timeouts outside the Gateway scheduler.
User Impact
No retention-policy change. Existing installs need no migration or operator action; Incognito still expires 24 hours after creation, and failed cleanup retries after 60 seconds. State, configuration, ports, RPC and SDK contracts are unchanged.
Why This Change Was Made
Require the kernel scheduler through the request runtime and lifetime sidecar owner, and replace each expiry timeout with a named absolute deadline. Preserve physical-database identity fences, row revalidation, the existing deletion owner and shutdown joins. Delete private timer arming/cancellation and the unused deadline storePath field.
One scheduler instance per Gateway process, enforced by types. This slice introduces no standalone scheduler constructor. Database access, schemas, transactions and ephemeral hydration stay unchanged. Per-operation timeouts and independent worker-thread liveness timers remain outside this migration.
Production +17/-15/net +2; tests/support +66/-31/net +35; docs +0/-0/net 0. Required dependency plumbing accounts for the production growth.
Evidence
Current head
0508acc264e7fbd37d6adee6c51dc39f1e222c76is rebased onto fixed main837fad120fbab0c0df0dd7bc7009dd90decfbd38with an identical reviewed patch. All 18 cases in 2 focused suites passed on blacksmith-testbox leasetbx_01m3e2nta4ngefyyk0dsf55cr4, run 36220641511. Commands:pnpm install --frozen-lockfile, thenpnpm test <file> --maxWorkers=1; exact commit and clean source verified before and after.src/gateway/server.incognito-lifetime.test.tssrc/gateway/server-lifetime-sidecars.test.tsThe earlier CI failure came from an unrelated chained assertion in server-chat-progress-snapshot.ts. The exact lint command reproduced on clean old main (exit1,22.357s) and passed on clean current main (exit0,24.004s), which contains the owning fix
66b812f26e725cd709e08860d2cb46ba496cd308. No unrelated fix was added here. The refreshed head must pass its own enforced CI gate.Earlier focused and review evidence
Baseline and candidate passed all 18 cases in two files on blacksmith-testbox lease
tbx_01m3dw9bb5s5ny2768rmbt84y8, run 36215071858. Commands:pnpm install --frozen-lockfile, thenpnpm test <file> --maxWorkers=1. Exact candidate tree/patch and unchanged source were verified. This lease is verified completed.src/gateway/server.incognito-lifetime.test.tssrc/gateway/server-lifetime-sidecars.test.tsThe existing Incognito suite uses shared Gateway/state fixtures to verify real session deletion and database-generation isolation; no new per-test Gateway boot, sleep or polling was added. Clock-driven cases cover expiry, retries and stop. No performance improvement is claimed from sequential cold/warm measurements.
Deslop and one independent Codex review are clean through P2. Fresh-main rebase is patch-identical, and the full cross-shard caller census is complete. Refreshed exact-head proof on
b6ee89a5fa69a3cc4ac888ad4aacc15e1e258599also passed all 18 cases on blacksmith-testbox leasetbx_01m3e2nta4ngefyyk0dsf55cr4, run 36220641511: Incognito 40.102s, lifetime sidecars 12.152s command wall. Its source was clean before and after the frozen install/tests. GitHub's enforced CI gate supplies changed-file validation. Full merged-main maintenance/cron/suspend/restart/shutdown proof follows the final slice.Stack