Skip to content

refactor(gateway): schedule Incognito expiry - #158690

Merged
steipete merged 1 commit into
mainfrom
hostneutral/scheduler-incognito-0925
Sep 26, 2026
Merged

steipete merged 1 commit into
mainfrom
hostneutral/scheduler-incognito-0925

Conversation

@steipete

@steipete steipete commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

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 0508acc264e7fbd37d6adee6c51dc39f1e222c76 is rebased onto fixed main 837fad120fbab0c0df0dd7bc7009dd90decfbd38 with an identical reviewed patch. All 18 cases in 2 focused suites passed on blacksmith-testbox lease tbx_01m3e2nta4ngefyyk0dsf55cr4, run 36220641511. Commands: pnpm install --frozen-lockfile, then pnpm test <file> --maxWorkers=1; exact commit and clean source verified before and after.

File Current-head command wall
src/gateway/server.incognito-lifetime.test.ts 45.913s
src/gateway/server-lifetime-sidecars.test.ts 13.899s

The 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, then pnpm test <file> --maxWorkers=1. Exact candidate tree/patch and unchanged source were verified. This lease is verified completed.

Test file Baseline wall Candidate wall
src/gateway/server.incognito-lifetime.test.ts 40.258s 29.392s
src/gateway/server-lifetime-sidecars.test.ts 11.577s 12.236s

The 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 b6ee89a5fa69a3cc4ac888ad4aacc15e1e258599 also passed all 18 cases on blacksmith-testbox lease tbx_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

  1. #157517 — diagnostic liveness preparation; merged.
  2. #158275 — internal auth factory naming; merged.
  3. #158423 — kernel scheduler and companion sweep; merged.
  4. #158531 — event-loop health; merged.
  5. #158537 — channel health; merged.
  6. #158614 — mention expiry; merged.
  7. #158617 — upstream monitoring; merged.
  8. #158662 — worker-placement maintenance; merged.
  9. #158666 — idle work and prewarm; pending.
  10. Incognito expiry — this slice.
  11. Remaining reviewed owner migrations and final documentation/live proof — pending.

@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S labels Sep 26, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 26, 2026
@clawsweeper

clawsweeper Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 26, 2026, 2:12 AM ET / 06:12 UTC.

ClawSweeper review

What this changes

Moves 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
Reviewed head: b6ee89a5fa69a3cc4ac888ad4aacc15e1e258599

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused migration preserves the existing safety checks and has relevant exact-head integration-test evidence.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The Repository State identifies a member-authored PR, so contributor live proof is not required. The reported exact-head Testbox suites exercise the production lifetime sidecar and deletion owner against in-memory session state with an injected clock; no stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The Repository State identifies a member-authored PR, so contributor live proof is not required. The reported exact-head Testbox suites exercise the production lifetime sidecar and deletion owner against in-memory session state with an injected clock; no stored-data contract changes.
Evidence reviewed 7 items Current-main necessity: Fetched main retains the private setTimeout and clearTimeout expiry path; the scheduler migration is not already present.
Introduced scheduling: The PR schedules an absolute expiry deadline or a 60-second retry through the supplied scheduler, while retaining the existing current-owner check and deletion call.
Deletion boundary: The existing deletion owner rechecks the caller and session identity after asynchronous preparation and before deletion.
Findings None None.
Security None None.

How this fits together

The 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
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +2, Tests +35. Total +37 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 3 17 15 +2
Tests 2 66 31 +35
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 83 46 +37

Review metrics

None.

Technical review

Best 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.

Labels

Label changes:

  • add P3: This is a focused internal scheduling refactor with no stated user-facing behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The Repository State identifies a member-authored PR, so contributor live proof is not required. The reported exact-head Testbox suites exercise the production lifetime sidecar and deletion owner against in-memory session state with an injected clock; no stored-data contract changes.

Label justifications:

  • P3: This is a focused internal scheduling refactor with no stated user-facing behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The Repository State identifies a member-authored PR, so contributor live proof is not required. The reported exact-head Testbox suites exercise the production lifetime sidecar and deletion owner against in-memory session state with an injected clock; no stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit c357d82 adds src/gateway/session-incognito-lifetime.ts:45 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c357d827bab5; files: src/gateway/session-incognito-lifetime.ts)
  • Peter Steinberger: Raw commit 362cee1 adds src/infra/gateway-scheduler.ts:83 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 362cee12114d; files: src/infra/gateway-scheduler.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete force-pushed the hostneutral/scheduler-incognito-0925 branch from b6ee89a to 0508acc Compare September 26, 2026 06:20
@steipete
steipete merged commit edfa5df into main Sep 26, 2026
198 checks passed
@steipete
steipete deleted the hostneutral/scheduler-incognito-0925 branch September 26, 2026 06:50
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant