Repository navigation
improve(gateway): load session history faster without duplicate readers - #129114
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 4:09 AM ET / 08:09 UTC. ClawSweeper reviewWhat this changesThis PR unifies Gateway REST and SSE session-history loading behind one raw-snapshot path and removes duplicate SQLite history-reader exports. Merge readinessKeep open for normal maintainer review. The previous changelog finding was addressed, and the current source centralizes the history snapshot boundary without a concrete correctness finding; current-main and live GitHub rechecks were blocked by unavailable repository objects/network access. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherGateway history reads indexed session transcripts and returns paginated chat history over HTTP or live SSE updates. The shared snapshot feeds display projection, cursors, reset-archive fallback, and stream refreshes. flowchart LR
A[Indexed transcript events] --> B[History event reader]
B --> C[Gateway raw snapshot]
C --> D[HTTP history response]
C --> E[SSE history state]
D --> F[Chat clients]
E --> F
Before merge
Agent review detailsSecurityNone. PR surfaceSource -204, Tests -84. Total -288 across 11 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the single Gateway-owned snapshot boundary, then confirm it against current main and exact-head CI before merge. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a consolidation/performance PR, not a standalone bug report with a new failing reproduction to establish here. Is this the best way to solve the issue? Yes: source inspection shows the snapshot owner is the narrowest place to unify complete and bounded history reads while preserving the existing reader seam and fallback behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 84dfcf27a3ce. 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
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
…rs (openclaw#129114) * perf(gateway): consolidate session history readers * chore: leave changelog to release generation
What Problem This Solves
Resolves a problem where long conversations did unnecessary work every time users opened or paged session history, while duplicate HTTP, SSE, and SQLite reader implementations made reset handling, sparse histories, and future changes harder to keep consistent.
Why This Change Was Made
History now has one Gateway-owned raw-snapshot path for REST and SSE, one canonical transcript reader for array/source reads, and one supported SQLite history lookup/anchor implementation. Ordinary conversations reuse the existing authoritative event/message counters to skip impossible compaction/reset scans. No SQLite tables, indexes, schema versions, persisted projections, or transcript copies are added.
The change removes 204 production lines and 84 test lines. Existing reset archives, cursor pagination, compaction markers, heartbeat boundaries, hidden-message backfill, SSE streaming, authorization, and complete-history requests keep their current contracts.
User Impact
Session history opens and pages faster without storing duplicate messages. On the existing 816 MiB database containing 1,361,203 transcript events, a 50-message page from a million-message session improved from 0.436 ms to 0.235 ms, approximately 1.9 times faster, and remains effectively constant across 1,000 to 1,000,000 messages.
Evidence
Related: #128844 #128964 #129047