tui: vendor vt100 with a scroll-region scrollback fix#373
Merged
Conversation
Codex pins its input box with a top-anchored DECSTBM scroll region (ESC[1;Nr). Upstream vt100 0.16.2's Grid::scroll_up only pushes scrolled-off lines to scrollback when no region is active, so codex's entire conversation was dropped from scrollback and PTY scroll-up showed nothing/garbled. xterm and xterm.js (the web client) save whenever the region's top margin is row 0. Vendor vt100 under vendor/vt100 and patch scroll_up to match (scroll_top == 0) via [patch.crates-io]. No agentd code changes -- the TUI's existing scrollback now fills correctly. Verified codex scrollback goes from empty to populated; 220 tests pass. See specs/0017-pty-scrollback-is-real-terminal-history.md.
edwin-zvs
force-pushed
the
fix-tui-scrollback-vt100-region
branch
from
June 6, 2026 17:14
6a2fe5b to
5dda545
Compare
This was referenced Jun 6, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Scrolling back a codex session in the TUI showed an empty/garbled history. Codex pins its input box with a top-anchored DECSTBM scroll region (
ESC[1;Nr), and upstreamvt1000.16.2'sGrid::scroll_uponly saves scrolled-off lines to scrollback when no scroll region is active — so codex's entire conversation scrolled off into nothing (maxsb == 0). xterm / xterm.js (the web client) save whenever the region's top margin is row 0, which is why the webui never had this bug.Fix
Vendor
vt100undervendor/vt100(wired via[patch.crates-io]) with a one-line change toGrid::scroll_up: save the scrolled-off line wheneverscroll_top == 0, matching xterm/xterm.js. No agentd code changes — the TUI's existing scrollback path now fills correctly.Design rationale:
specs/0017-pty-scrollback-is-real-terminal-history.md.Why this, not the message log
An earlier attempt (#328, closed) rendered scroll-up from the structured
Messagestream. That dropped the tool calls / command output / diffs that make up most of a coding session — a net regression (mainwas better). This keeps the full, faithful terminal history.Verification
maxsb0 → populated, clean and in order (was completely empty before).Binary
The patch affects the TUI's terminal emulation, so the relevant binary is
agent.agentd/agentd-mcp/ adapters rebuild against the patched crate but are behavior-unchanged.The fork change is isolated to
Grid::scroll_upand marked in-source as anagentd fork patch; worth upstreaming so the vendoring can eventually be dropped.🤖 Generated with Claude Code