Repository navigation
fix(chat): faster, reliable older history and live updates - #128964
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 24, 2026, 9:59 PM ET / August 25, 2026, 01:59 UTC. ClawSweeper reviewWhat this changesThe PR bounds paginated HTTP and SSE chat-history reads, carries the shared display projection forward, and removes superseded projection wrappers. Merge readinessThis PR remains necessary: current main still sends every limited cursor request through a full transcript read. The proposed shared bounded scanner covers that gap across HTTP and SSE; no blocking patch defect was found in the reviewed paths. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherGateway history reads transcript events from the agent SQLite store, projects visible chat turns, and returns pages through HTTP, SSE, WebSocket, and embedded-chat paths. The changed shared scanner supplies the bounded raw window and display projection used by HTTP snapshots and SSE refreshes. flowchart LR
A[SQLite transcript events] --> B[Transcript reader]
B --> C[Bounded history scanner]
C --> D[Display projection]
D --> E[HTTP history page]
D --> F[SSE refresh]
D --> G[Other chat transports]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -44, Tests +37. Total -7 across 10 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Land the shared bounded cursor path after exact-head Gateway regressions and required CI are green, preserving the existing unbounded response only when no limit is requested. Do we have a high-confidence way to reproduce the issue? Yes, from source: the focused HTTP regression creates an older cursor, corrupts an unrelated newer transcript row, and verifies the older page remains readable; it has not been executed in this read-only review. Is this the best way to solve the issue? Yes. Reusing the existing indexed transcript reader and one bounded display-projection flow is the narrowest owner-boundary repair; retaining the current full read for limited cursor pages would leave the reported scale and malformed-newer-row failure path intact. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3c7143d65040. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Related: #128844, #128810
What Problem This Solves
Fixes an issue where users paging backward through chat history could receive a 500 error, unnecessary transcript-wide reads, or inconsistent turn boundaries when newer unrelated transcript events were malformed or filtered. Long sessions containing many silent entries also performed repeated projection work across HTTP, server-sent events, WebSocket chat, and embedded history.
Why This Change Was Made
Read explicitly limited older pages through the existing indexed transcript scanner, using the authoritative logical display-sequence count to derive the bounded offset. Carry the already prepared display projection across the shared history boundary, grow sparse scans adaptively, and remove superseded projection and transcript-reader wrappers. Reset archives and events sharing a display sequence keep their existing semantics.
This is a follow-up to #128844 and #128810: the transcript remains the single source of truth. There are no transcript copies, new SQLite tables, schema-version changes, protocol changes, or configuration changes. Production code shrinks by 44 lines while regression coverage grows.
User Impact
Older chat pages load without traversing unrelated newer transcript content, HTTP and live event streams consistently preserve turn boundaries, and silent-entry-heavy history is substantially faster. A 4,040-entry representative sparse transcript drops from 41 projection passes and 83,640 projected rows to 13 passes and 25,620 rows, improving approximately 94 ms to 25 ms (about 3.7x faster).
Evidence