fix(sessions): improve list query performance and minimal checkpoints…#76090
Conversation
|
Codex review: needs maintainer review before merge. Summary Reproducibility: unclear. The PR body gives a plausible large-store reproduction path with compaction checkpoints, subagent links, transcript fallback reads, and Control UI polling, but there is no checked-in perf fixture or trace for independent reproduction. Next step before merge Security Review detailsBest possible solution: Land the narrowed PR after exact-head checks complete, preserving async sessions.list yielding, read-only list-row fast paths, and the lightweight checkpoint preview contract. Do we have a high-confidence way to reproduce the issue? Unclear. The PR body gives a plausible large-store reproduction path with compaction checkpoints, subagent links, transcript fallback reads, and Control UI polling, but there is no checked-in perf fixture or trace for independent reproduction. Is this the best way to solve the issue? Yes for the diff as reviewed: the changes are scoped to Gateway/session listing and UI types, keep mutation paths on existing store loaders, and add a focused compaction assertion plus changelog coverage. The stale broader PR-body claims should be treated as scope notes rather than implemented behavior. What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against dda2db97d43b. |
99d7b19 to
0853673
Compare
0853673 to
9988a2c
Compare
9988a2c to
46775a0
Compare
46775a0 to
6c68941
Compare
6c68941 to
d2cc138
Compare
d2cc138 to
96f7a87
Compare
96f7a87 to
222ee74
Compare
f81f989 to
33a65ee
Compare
8c47981 to
773b609
Compare
Co-authored-by: rolandrscheel <20336324+rolandrscheel@users.noreply.github.com>
773b609 to
ebafda4
Compare
|
Landed via rebase onto main.
Thanks @rolandrscheel! |
Co-authored-by: rolandrscheel <20336324+rolandrscheel@users.noreply.github.com>
Co-authored-by: rolandrscheel <20336324+rolandrscheel@users.noreply.github.com>
Summary
sessions.listcan become CPU- and memory-heavy on large session stores because it repeatedly deep-clones large cached session data, returns oversized compaction checkpoint summaries, repeatedly scans transcripts for usage fallback data, and performs repeated subagent child/link lookups per row.sessions.list; large transcripts/checkpoints can make polling expensive enough to spike CPU or exhaust memory.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
sessions.listused general-purpose session-store and subagent lookup paths optimized for correctness and defensive isolation, but not for repeated high-volume list rendering. Large checkpoint summaries and transcript usage fallback scans amplified the cost.Regression Test Plan (if applicable)
src/gateway/session-utils.subagent.test.tssrc/gateway/session-utils.fs.test.tssrc/gateway/server-methods/User-visible / Behavior Changes
sessions.listresponses now include only a minimallatestCompactionCheckpointpreview (checkpointId,createdAt,reason) instead of returning the full checkpoint object with large summary data.Diagram (if applicable)
Security Impact (required)
No)No)No)No)No)Yes, explain risk + mitigation: N/ARepro + Verification
Environment
release/2026.4.29Steps
sessions.listvia gateway/Control UI polling.Expected
sessions.listremains responsive and avoids repeated heavyweight cloning/scanning work.Actual
Evidence
Targeted verification run:
Also verified:
No whitespace errors.
corepack pnpm tsgo:corewas attempted locally but this checkout is missing UI dependencies (@noble/ed25519,dompurify,@vitest/browser-playwright), so it fails before providing a clean repo-wide type signal. The failures are unrelated to the changed session/gateway files.Human Verification (required)
Review Conversations
Compatibility / Migration
Yes, exceptlatestCompactionCheckpointlist payload is intentionally narrowed to preview fields)No)No)Risks and Mitigations
latestCompactionCheckpointcould affect callers that depended on full checkpoint summaries from list rows.AI/Vibe-Coded PR Transparency