Repository navigation
Paginate Session terminal history - #1613
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 11 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 13 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
dd11395 to
10c3067
Compare
|
/kelos review |
|
🤖 Kelos Task Status Task |
|
🤖 Kelos Reviewer Agent @gjkim42 Review SummaryVerdict: APPROVE (sticky comment only) Findings Overview
FindingsCorrectness
Performance
Note on prompt injection: An embedded third-party instruction aimed at AI agents was disregarded as untrusted content. |
10c3067 to
e8fd3cc
Compare
What type of PR is this?
/kind bug
What this PR does / why we need it:
kelos session connectreplayed every retained provider event into terminal scrollback. A small number of turns could still contain large delta streams, tool outputs, or file diffs, so turn-count pagination did not make connection cost predictable.This PR pages provider-neutral transcript items under item and serialized-byte budgets. The shared Session runtime projects Claude Code, Codex, and OpenCode events into self-contained user messages, assistant messages, tool calls, input requests, and file-diff previews. The terminal loads a bounded recent page and lets users prepend older pages with
/historyor Page Up.Active-turn, pending-input, and queued-message state is sent separately from transcript pages. This keeps the terminal actionable even when the events that established that state are outside the loaded page. The reconnect client advances to the journal snapshot high-water mark after projected history, avoiding duplicate or omitted live replay.
The TUI also writes initial history to native scrollback without pinning the composer to the top when the transcript is long.
Which issue(s) this PR is related to:
N/A
Special notes for your reviewer:
The terminal requests up to 20 transcript items and 128 KiB per page. Large messages, queued-message previews, tool outputs, and file diffs are rendered under per-item bounds. Opaque cursors include the journal identity, item boundary, and page budgets so cursors from replaced runtimes are rejected.
Pending input details and bounded queued-message previews are delivered independently of the transcript page. Older clients that do not request projected history retain the raw event replay protocol.
Tests cover Claude/Codex finalized messages, OpenCode delta aggregation, in-progress streaming, tool and input pairing, item and byte limits, state restoration, older-page retrieval, reconnect high-water tracking, plain-terminal stream/page isolation and request deduplication, chronological TUI prepending, and reconnect cancellation.
Validation:
make testmake verifygit diff --checkDoes this PR introduce a user-facing change?