Repository navigation
fix(gateway): reduce worker overhead with large session stores - #149700
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 18, 2026, 4:21 AM ET / 08:21 UTC (Revision 16). ClawSweeper reviewWhat this changesThe PR avoids loading unrelated saved prompts during worker session lookup, adds a transcript-commit benchmark, and updates supporting Gateway and browser test fixtures. Merge readiness✅ Ready for maintainer review The optimization remains absent from current main and the latest release. The introduced changes have no actionable correctness findings, and the preserved measurements support the scoped performance claim. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway resolves worker session identities before committing transcript messages or preparing inference. This change retains metadata-based selection while loading the full saved payload only for the selected session. flowchart TD
A[Worker request] --> B[Session metadata discovery]
B --> C[Resolve identity and freshness]
C --> D[Read selected full session]
D --> E[Transcript commit]
D --> F[Inference preparation]
E --> G[Durable history and updates]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +1, Tests +460, Config +1, Other +387. Total +849 across 13 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep metadata-only discovery and use the existing exact reader for the selected full session, preserving selection and durability contracts. Do we have a high-confidence way to reproduce the issue? Yes, from source: worker resolution on current main reaches the full-entry store loader after metadata selection, decoding unrelated saved prompts. The supplied benchmark and regression results corroborate this; this review did not execute them. Is this the best way to solve the issue? Yes. Reusing the established exact-entry reader removes unnecessary hydration without adding a cache, changing selection policy, or migrating stored state. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ea6ad975a511. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (15 earlier review cycles; latest 8 shown)
|
Punchcard-Session: brisk-summit-brook-mr
Punchcard-Session: brisk-summit-brook-mr
Use current-main list discovery and register the real worker commit benchmark through the supported source runner. Punchcard-Session: clear-workshop-brook-w2
a71e4b7 to
3a273a9
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Punchcard-Session: clear-workshop-brook-w2
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Punchcard-Session: ember-river-harbor-t4
Keep the seeded session-count assertion outside measured commit work after the runtime count API retirement. Punchcard-Session: ember-river-harbor-t4
Punchcard-Session: ember-river-harbor-t4
Punchcard-Session: ember-river-harbor-t4
Punchcard-Session: ember-river-harbor-t4
Punchcard-Session: ember-river-harbor-t4
Punchcard-Session: ember-river-harbor-t4
Punchcard-Session: ember-river-harbor-t4
Punchcard-Session: ember-river-harbor-t4
Punchcard-Session: ember-river-harbor-t4
Punchcard-Session: ember-river-harbor-t4
|
Merged via squash.
|
Punchcard-Session: ember-river-harbor-t4 * commit 'fdbb2455ac991202051904501438f690d22a0701': (21 commits) fix(qa): restore Telegram skill integration checks (#151632) test(e2e): follow published plugin convergence restarts (#151607) perf(tasks): skip unnecessary maintenance record copies (#151578) refactor: simplify Gateway session-name precedence (#147984) fix(ui): keep suggested task launches in the background (#151611) fix(agents): preserve subagent progress across repeated restarts (#151450) fix(diagnostics): scale memory growth pressure to the heap limit (#151355) fix(ui): release reply previews when connections retire (#145907) fix(ui): disable skeleton shimmers when motion is reduced (#151314) fix(gateway): reduce worker overhead with large session stores (#149700) improve: defer unused work during Gateway startup (#151547) improve: reduce transcript freshness-check overhead (#151606) fix(ui): keep Home from appearing twice in the sidebar (#151401) improve(gateway): reduce allocations during large session refreshes (#151565) improve: reduce temporary allocations for long provider requests (#151603) fix: keep Gateway responsive and preserve completions during SQLite contention (#151594) fix(models): renew successful empty provider catalogs (#151580) fix: reveal preserved chat branches after rewind and resend (#151598) perf(outbound): skip inert plain-text preparation scans (#149829) improve(ui): make toast feedback compact and recovery readable (#151575) ...
…law#149700) * fix(gateway): avoid full-store hydration for worker session lookup Punchcard-Session: brisk-summit-brook-mr * improve(bench): measure worker transcript commit scaling Punchcard-Session: brisk-summit-brook-mr * fix(gateway): avoid unrelated prompt reads in worker target lookup Use current-main list discovery and register the real worker commit benchmark through the supported source runner. Punchcard-Session: clear-workshop-brook-w2 * test(gateway): verify worker lookups skip unrelated prompts Punchcard-Session: clear-workshop-brook-w2 * fix(bench): use retained session key reader for fixture counts Keep the seeded session-count assertion outside measured commit work after the runtime count API retirement. Punchcard-Session: ember-river-harbor-t4 * fix(ci): settle streaming fixtures and update native test expectations Punchcard-Session: ember-river-harbor-t4 * fix(test): keep child pagination and dashboard state coherent Punchcard-Session: ember-river-harbor-t4 * test(ui): split session fixtures and child-query cases Punchcard-Session: ember-river-harbor-t4 * test(ui): reuse serialized record predicate Punchcard-Session: ember-river-harbor-t4 * test(ui): report stalled inactive-agent outbox stage Punchcard-Session: ember-river-harbor-t4
What Problem This Solves
Worker transcript commits spend CPU reading unrelated saved prompts when resolving a session in a large inventory.
User Impact
Worker commits use less CPU with large session stores. Session selection, full selected prompt/auth fields, and transcript durability are preserved. No operator action is required.
Why This Change Was Made
Use the existing exact lookup for the selected full session entry. Global candidate discovery retains its list projection;
exactRead: truepreserves cross-store alias checks and duplicate/freshness selection without adding a cache, schema, or configuration surface. The benchmark exercises the real queue, ledger, target resolution, transaction, and publication, with replay and durability assertions outside the measured batch.The integrated CI fixtures follow current planner and session-lineage contracts, join canonical startup metadata before measuring streaming, and use the existing serialized session-patching owner. Streaming assertions still exercise 240 deltas against the original render ceilings. These test repairs do not change production UI behavior.
Evidence
Current head:
3b7e9bae6a6d99c949adbf68d3d53df1003937ea. Fresh exact-head hosted CI and native landing qualification remain required.Preserved matched committer measurement: one Blacksmith Testbox, Node 24.19.0/pnpm 12.3.4, four guest-visible AMD EPYC CPUs, three interleaved pairs A/B/B/A/A/B. Each sample used 1,000 session rows with 16 KiB saved prompts, 1,000 active transcript messages, and 12 fresh commits. Every sample completed 12 commits, appended 48 messages and emitted 48 updates; deterministic seed/batch hashes matched. Seeding and replay checks were outside timing.
Median paired wall-time reduction: 54.2% (42.9–55.9%). Median paired process-CPU reduction: 52.3% (42.4–54.7%). Source, tracked blobs, frozen install inputs and harness bytes were verified; original source was restored and the one-shot Testbox stopped.
This scoped measurement does not establish cloud transport, normal embedded Gateway throughput, or deployment speedup. Matched Hetzner/AWS shared-vCPU, dedicated-vCPU and bare-metal stack measurements remain unrun. Benchmark qualification merged separately in #149702.
Punchcard-Session: ember-river-harbor-t4