Skip to content

feat(chat): open Claude transcripts from the tail - #693

Merged
moreih29 merged 6 commits into
developfrom
feat/chat-transcript-tail
Nov 19, 2026
Merged

moreih29 merged 6 commits into
developfrom
feat/chat-transcript-tail

Conversation

@moreih29

@moreih29 moreih29 commented Nov 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

Opening a saved Claude chat sent the last 32 MiB of its transcript as one agent RPC response. Over SSH that took 3.1 s at 100 Mbps, 14 s at 20 Mbps and 56 s at 5 Mbps; at 5 Mbps every run exceeded the 30 s RPC deadline, so the chat could not open at all. Sending only the last ~512 KiB measured 0.07 s, 0.28 s and 1.0 s on the same links.

The desktop now loads the recent tail first and reads earlier history on demand.

  • Go (chat.transcriptPage): an internal agent RPC that reads the transcript backwards with ReadAt, up to 20 recent turns within a ~512 KiB serialized budget. A cursor is bound to session, profile, file generation and position; truncation, file replacement, profile change and agent replacement invalidate it, while appends keep the snapshot. The 32 MiB retention window is unchanged. A row larger than the budget is sent as base64 fragments.
  • Main: ChatHost and a desktop IPC call expose pages. Only an unsupported-method reply on the first request falls back to the old full chat.transcript (older agents); I/O and connection errors are passed through rather than retried with the large read.
  • Renderer: the tail is shown first; "Show earlier messages" reads one batch at a time and prepends it when the snapshot and tab generation still match, keeping the scroll anchor and the live log. Fragmented rows are completed within the same open or click, so a large final row (for example an image) never leaves the view empty. Tool calls and results are joined by ID across pages; a past call whose result is not loaded is not shown as running. Earlier pages do not overwrite the current title or goal. Fork and rewind before the first loaded message are blocked until its real predecessor is known.
  • Public chat.read / chat.watch and remote-protocol are unchanged: they still build the full projection, so mobile keeps its current item keys and indices. A cold mobile open still pays the full transfer; improving that needs a protocol change and is out of scope.

Tests

  • Go TestTranscriptPages (one table): UTF-8, CRLF, partial and complete final lines, oversized-row fragments, retention limit, inclusive/exclusive cuts, append vs truncate/replace/profile/agent cursor invalidation, response frame size.
  • Main: fallback table for old agents vs cursor reads.
  • Renderer: tail plus all earlier pages reconstruct the same items, order, tools and goal as a full read, with live output interleaved; stale snapshot rejection; fragment reassembly at a UTF-8 boundary; large final row visible after one open; one earlier-page click completes a large row.

Combined with current develop: go vet, GOOS={windows,linux,darwin} go build, go test ./..., bun run typecheck, bun run check:ci, bun test 4,464 pass / 17 skip / 0 fail.

Follow-ups from the app check

  • "Show earlier messages" now reads through a turn boundary in one click. A turn whose rows exceed the page budget no longer shows its answer before its question.
  • After the agent changes (app restart, agent respawn, SSH reconnect) or a stale cursor, the button stays. The next click starts a new snapshot right before the shown boundary (beforeAnchor, verified against the session file), with no duplicated or missing rows. If the anchor does not match, it falls back to the full read.
  • Checked in a dev build on a local workspace with a synthetic 150-turn, 3.1 MB transcript: open, load to the start, and the same after killing the agent mid-way; 150/150 questions, no duplicates or gaps. An agent without chat.transcriptPage falls back to the full read.

Manual checks before release

  1. Open a large Claude chat in an SSH workspace over a slow link: recent messages appear quickly; "Show earlier messages" keeps the reading position while live output arrives.
  2. A chat whose last message holds a large image or tool result opens with that message visible.
  3. Tool calls spanning pages show their name and result after loading earlier pages; none is shown as running.
  4. Fork/rewind from the earliest loaded user message is blocked until earlier history is loaded, then works.
  5. An older SSH agent still opens chats via the full read; mobile chat.read can still page back past the desktop's loaded tail.

🤖 Generated with Claude Code

@moreih29
moreih29 merged commit 1d67c9a into develop Nov 19, 2026
9 checks passed
@moreih29
moreih29 deleted the feat/chat-transcript-tail branch November 19, 2026 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant