Skip to content

fix(tui): keep low verbosity summaries in place when toggled - #52357

Merged
jlongster merged 3 commits into
v2from
verbosity-expand-anchor
Oct 8, 2026
Merged

jlongster merged 3 commits into
v2from
verbosity-expand-anchor

Conversation

@jlongster

@jlongster jlongster commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Issue for this PR

No issue.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

With session.verbosity: "low", clicking an activity summary (for example + 4 commands, 1 edit, 4 thoughts) moved it. At the bottom of the transcript the scrollbox follows the bottom, so the new details pushed the summary up, often off screen. When scrolled up, collapsing near the bottom clamped the scroll position and the summary jumped down.

Now the summary stays on the row that was clicked when expanding and collapsing. Details still open below it, as before.

OpenTUI has no scroll anchoring, so the click passes the summary row to setGroupExpanded, which records its viewport row. The session listens for the scrollbox content resize event and corrects scrollTop from the row's computed layout. That event fires inside the layout pass before rows get screen positions, so the correction lands in the same frame with no visible jump. The hold is released after layout settles. At the bottom, the correction leaves the bottom, so the transcript stops following it and "Jump to latest" appears. The exception is a summary that ends the transcript (ignoring the message footer and turn usage) while the reader is at the bottom, such as a running turn. There the hold is skipped so the details stay visible and new output keeps following, as before.

Other disclosures (Thought, Explored, Instructions) are unchanged.

Known limit: if collapsing leaves too little content below the summary to keep it on its row, the scroll position is clamped and the summary moves down.

How did you verify your code works?

  • Added packages/tui/test/session-activity-anchor.test.tsx. It records every rendered frame after each click and checks that the summary stays on the same row for expand and collapse, at the bottom and 1 and 3 wheel steps up. Another case checks that the summary ending the transcript opens like before at the bottom. Without the resize correction, these cases fail.
  • bun run check passes. bun test in packages/tui passes except dialog-shell-output.test.tsx, which times out on v2 without this change too.
  • Checked by hand in bun run dev:live on a real session, at the bottom and scrolled up, and recorded an OpenCode Drive video of both.

Screenshots / recordings

Recorded with OpenCode Drive; I'll attach the video in a comment.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@jlongster
jlongster force-pushed the verbosity-expand-anchor branch from 70a78cc to da95f3d Compare October 8, 2026 17:20
@jlongster
jlongster merged commit 38c955e into v2 Oct 8, 2026
11 checks passed
@jlongster
jlongster deleted the verbosity-expand-anchor branch October 8, 2026 18:15
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