Repository navigation
fix(gateway): keep same-sequence history rows reachable - #124145
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 6:20 AM ET / 10:20 UTC. ClawSweeper reviewWhat this changesThe PR makes REST and SSE session-history pages include all visible projected rows connected to an included transcript sequence, even when those rows are interleaved. Merge readinessKeep this maintainer-owned PR open for the explicit public-pagination compatibility decision and normal exact-head merge checks. Current main still splits interleaved same-sequence rows, and the branch’s owner and HTTP/SSE tests cover the intended repair without a concrete implementation defect found. Priority: P2 Review scores
Verification
How this fits togetherGateway session-history endpoints project SQLite transcript records into display rows and paginate them with a transcript-sequence cursor. REST and SSE consumers use that cursor to retrieve older history, so each cursor page must leave no included sequence group unreachable. flowchart LR
A[SQLite transcript] --> B[Display projection]
B --> C[Rows with transcript sequences]
C --> D[Sequence cursor paginator]
D --> E[REST history page]
D --> F[SSE history event]
Decision needed
Why: The existing cursor identifies transcript sequences rather than projected rows, so a strict row cap and complete group reachability cannot both be guaranteed without a new cursor contract. Before merge
Agent review detailsSecurityNone. PR surfaceSource +19, Tests +184. Total +203 across 3 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain sequence-group closure and explicitly establish that history Do we have a high-confidence way to reproduce the issue? Yes, from source: current main’s strict trailing-row slice in Is this the best way to solve the issue? Unclear pending the public contract choice: sequence-group closure is the narrowest repair under the existing sequence cursor, but allowing a page to exceed AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against dec4d44618c3. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Maintainer decision (now explicitly confirmed): adopt indivisible sequence pages. For this endpoint, The +19 production LOC is accepted. The smaller contiguous-run implementation was proven incomplete for valid interleaving ( This supersedes the earlier automation correction. No protocol shape, HTTP/SSE schema, SQLite schema, migration, config, security, release, or deployment changed. |
|
Merged via squash.
|
Related: #121386
Related: #124120
What Problem This Solves
Fixes an issue where HTTP/SSE session-history clients could permanently miss a visible row when display projection produced several rows with the same transcript sequence and a page limit split that sequence group.
Why This Change Was Made
The existing public cursor addresses transcript sequences, not individual projected rows. The shared REST/SSE paginator now closes each tentative page over every included sequence group, including interleaved message-tool result/mirror rows, while preserving display order and the existing cursor and response shape.
This is a focused continuation of the hidden-tail repair in #124120. Issue #121386 remains broader embedded-history context and is not closed or claimed fully resolved here.
Production LOC: +20/-1 (net +19). Tests: +202/-18. The original contiguous-run repair was +9 production LOC, but independent review found a valid two-send projection shaped as seq 3 result, seq 4 result, seq 3 mirror, seq 4 mirror; the extra closure logic is required to satisfy the full sequence-group invariant rather than only adjacent siblings.
No protocol, HTTP/SSE schema, SQLite schema, migration, retention, config, security, release, or deployment surface changes.
CHANGELOG.mdand docs are intentionally unchanged; this body carries release-note context and the public API contract is unchanged.AI-assisted; maintainer-reviewed.
User Impact
External session-history clients can follow the existing sequence cursor without duplicate, skipped, looping, or hidden rows. A page may exceed its requested row limit only when needed to keep an indivisible sequence group reachable.
Evidence
b37b048: the strengthened owner regression failed 1/26 because the newestlimit=1page returned only the seq-4 mirror and stranded the interleaved seq-3/seq-4 siblings.NO_REPLYremains hidden.git diff --check: clean.