Repository navigation
fix(gateway): keep session history pageable after hidden tails - #124120
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 5:03 AM ET / 09:03 UTC. ClawSweeper reviewWhat this changesRepairs Gateway session-history pagination so an all-hidden bounded transcript tail still returns a cursor to older visible SQLite history for HTTP and SSE clients. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open. Current main still suppresses the continuation cursor when a bounded raw tail projects to no visible rows; this focused shared-projector repair corrects REST and SSE without changing response shape. Priority: P2 Review scores
Verification
How this fits togetherGateway session-history reads a bounded SQLite transcript tail, projects displayable messages, and returns a REST or SSE page. Clients use the returned cursor to request older conversation rows. flowchart LR
A[SQLite transcript] --> B[Bounded raw tail]
B --> C[History projection]
C --> D{Visible rows?}
D --> E[REST history page]
D --> F[SSE history event]
B --> G[Continuation cursor]
G --> E
G --> F
Before merge
Agent review detailsSecurityNone. PR surfaceSource -1, Tests +46. Total +45 across 2 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 HTTP/SSE projector repair after exact-head CI; retain the separate embedded-history duplication under #121386. Do we have a high-confidence way to reproduce the issue? Yes—high-confidence source reproduction is encoded by the added real Gateway/SQLite harness scenario: current main leaves the empty bounded page without a continuation cursor. Is this the best way to solve the issue? Yes—the shared snapshot projector is the narrow owner for both HTTP and SSE; altering the embedded duplicate would address a separate remaining surface tracked in the linked issue. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 11bcc0eb4985. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
ClawSweeper next step is satisfied: exact-head CI is green at The stored-data-model warning is not applicable here: this PR changes no SQLite schema, migration, retention, serialized field, or HTTP/SSE response shape. It only supplies the existing |
|
Merged via squash.
|
Related: #121386
What Problem This Solves
Fixes an issue where HTTP/SSE session-history clients could be told that no older conversation existed when a bounded raw transcript tail contained only hidden rows, even though visible SQLite history remained earlier in the session.
Why This Change Was Made
The raw bounded tail owns the pagination boundary even when display projection removes every row. The shared session-history projector now keeps
hasMoretrue and derives the existingnextCursorfrom the first raw sequence, without exposing hidden rows or changing the HTTP/SSE response shape.The existing ClawSweeper review recommends also consolidating the separate embedded-history path. Maintainer scope for this PR explicitly preserves the two-file HTTP/SSE repair; the embedded path is not claimed fixed here and should remain tracked separately rather than being silently bundled.
Production LOC: +3/-4 (net -1). Tests: +46/-0.
CHANGELOG.mdis intentionally unchanged; release generation owns changelog updates.User Impact
External HTTP/SSE history clients can page past an all-hidden tail and recover older visible conversation rows. Visible-row behavior, hidden-row filtering, retention, storage, configuration, and protocol shape are unchanged.
Evidence
NO_REPLYrows returnedmessages: [],hasMore: false, and no cursor for?limit=1.hasMore: trueandnextCursor: "2"; requesting that cursor returns the older visible row.src/gateway/session-history-state.test.ts: 26/26 passed.src/gateway/sessions-history-http.test.ts: 84/84 passed, including invalid cursor/limit bounds, archive rollover, pagination, SSE refresh, and cleanup siblings.git diff --check: clean.