Skip to content

Window long transcripts behind a Show-earlier pill - #207

Merged
milind-soni merged 1 commit into
mainfrom
feat/windowed-transcript
Aug 17, 2026
Merged

Window long transcripts behind a Show-earlier pill#207
milind-soni merged 1 commit into
mainfrom
feat/windowed-transcript

Conversation

@milind-soni

Copy link
Copy Markdown
Owner

In plain terms

Long threads (especially computer-use ones full of inline screenshots) no longer mount every message ever: the transcript renders the last 120, with a quiet "Show earlier messages (X more)" pill that expands by 120 per click. Applies to both 1:1 chats and rooms.

Notes

  • Pure client-side windowing (src/lib/transcript-window.ts) — the boundary is anchored: appends grow the window (rows you're reading never slide out), and a boundary stranded past the end by a branch switch/edit rewind falls back to a fresh tail instead of blanking.
  • Expanding never yanks the viewport: scrollHeight is captured on click and scrollTop shifts by the growth in a useLayoutEffect before paint (browser anchoring is off on this container). The restore also updates the follow heuristic's memory so it isn't read as a user scroll, and expanding breaks bottom-follow (reading scrollback shouldn't get re-pinned by a mid-expand stream event).
  • The bottom-follow effect stays keyed on the FULL list length, so expansion can't re-trigger it. Everything semantic — lastBotTextId, regenerate, working dots — still computes from the full list.
  • Window resets per bot+task via a render-phase key check (no flash of the old thread's boundary on switch).

Test plan

  • src/lib/transcript-window.test.ts — 15 tests: under/exact/over the window size, append anchoring, stepwise expansion to zero, clamp past start, shrink-under-boundary reset, empty thread, custom size
  • Mutation check: inverting the clamp branch fails 4 tests
  • pnpm typecheck clean; full pnpm vitest run green (751 passed); touched files add zero oxlint findings over base
  • Reviewer eyeball: open a long thread → only recent messages render with the pill on top; click it → older rows appear ABOVE with no viewport jump; switch tasks → window resets

🤖 Generated with Claude Code

Long computer-use threads mount hundreds of rows — inline base64
screenshots included — so the DOM stays heavy even though the memoized
list bails out of re-renders. ChatView and GroupView now mount only the
last 120 messages; a quiet "Show earlier messages (X more)" pill at the
top of the transcript pulls the boundary back by another 120 per click.

The boundary is a pure decision in src/lib/transcript-window.ts: it is
anchored per bot+task (render-phase reset on bot.id/threadId switch), so
appends grow the window instead of sliding rows out from under the
reader, and a thread that shrinks beneath a stale boundary — branch
switch, edit rewind — falls back to a fresh tail window rather than
blanking the transcript.

Expanding must not yank the viewport: the click captures scrollHeight,
then a layout effect shifts scrollTop by the growth before paint
(browser scroll anchoring is disabled on these containers). The
bottom-follow scrollTo keys on the FULL list's length, so expansion
never re-triggers it, and expanding breaks follow the way any
scrollback reading does. Tail-derived logic — working dots,
lastBotTextId, regenerate — still computes from the full list.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@milind-soni, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 32 minutes

Limit details: You’ve used all 3 included reviews currently available under your plan.

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3e2652bb-f958-4339-aa12-14a12c5bd02f

📥 Commits

Reviewing files that changed from the base of the PR and between 8b95206 and 4bc515a.

📒 Files selected for processing (4)
  • src/components/ChatView.tsx
  • src/components/GroupView.tsx
  • src/lib/transcript-window.test.ts
  • src/lib/transcript-window.ts

Comment @coderabbitai help to get the list of available commands.

@milind-soni
milind-soni merged commit ee21f40 into main Aug 17, 2026
5 checks passed
@milind-soni
milind-soni deleted the feat/windowed-transcript branch August 17, 2026 20:35
kargnas added a commit to kargnas/OpenMausBot that referenced this pull request Aug 17, 2026
main의 milind-soni#207(긴 대화 Show-earlier), milind-soni#206(Cmd+K 팔레트), milind-soni#204(iOS
컴패니언), milind-soni#203(스트리밍 코드 하이라이트) 병합. 충돌은 테스트 파일의
node:fs import union뿐이었다.

Tested: pnpm typecheck, pnpm vitest run (94 files, 905 passed, 8 skipped)

Confidence: high
Scope-risk: narrow
Reversibility: clean
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