Skip to content

fix(agents): keep Claude Code off the alternate screen so session logs scroll - #465

Merged
artempartos merged 1 commit into
developfrom
artempartos/fix-session-28686-log
Oct 11, 2026
Merged

artempartos merged 1 commit into
developfrom
artempartos/fix-session-28686-log

Conversation

@artempartos

Copy link
Copy Markdown
Contributor

Summary

A finished Claude Code session's terminal log (for example prod session 28686) replays as one frozen frame, stuck on the spinner, with nothing to scroll back to. The stored log is not truncated. It holds the full raw stream, but Claude Code drew that stream on the alternate screen.

  • Claude Code picks its fullscreen renderer on a fresh install, and every agent container is a fresh install. That renderer enters the alternate screen (\e[?1049h) inside the 80x24 detached tmux pane and repaints a single frame with cursor moves. Nothing reaches the scrollback, so:
    • the xterm.js replay on the session page shows only the last 24 rows (the alternate screen has no scrollback);
    • the live tail and the quota scan (tmux capture-pane) see 24 rows;
    • get_session_log strips ANSI, which turns the cursor moves into glued words.
  • CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1 selects the classic renderer, which prints the conversation into the scrollback. In the CLI's renderer choice, this env check (env_off) comes before the fresh-install branch. I checked this in the 2.1.294 linux binary the image pins, and in 2.1.296.
  • Same class of problem as Codex in fix(agents): cap Gemini at 0.60.0, keep Codex in the scrollback, count Gemini usage once #444 (tui.fullscreen_transcript=false).

This is not a regression from the #443 CLI bump: sessions from 2026-10-07 on CLI 2.1.281 paint the same way.

Verification

On a local worktree stack with the agent image built at CLI 2.1.294, I ran a non-interactive haiku session with 12 separate shell calls and a 40-line answer:

  • the stored terminal_output.log has no \e[?1049h and has 1721 newlines (the prod log for 28686 had 1). The banner reads v2.1.294, so the classic renderer is in use;
  • the replay on the session page scrolls from the banner and prompt through every tool call to the end;
  • claude_code_adapter_test.rb and changelog_test.rb pass (164 runs), and rubocop is clean on the changed files.

Logs that are already stored stay single-frame. The fix applies to sessions launched after deploy.

🤖 Generated with Claude Code

…s scroll

Claude Code picks its fullscreen renderer on a fresh install, and every
agent container is one. That renderer enters the alternate screen inside
the 80x24 detached tmux pane and repaints a single frame with cursor
moves, so nothing reaches the scrollback: the stored log replays as one
frozen frame, the live tail and quota scan see 24 rows, and the ANSI-
stripped MCP log reads as glued words.

CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1 is checked before the fresh-install
branch in the CLI's renderer choice (verified in the 2.1.294 binary the
image pins) and selects the classic renderer, which prints the
conversation into the scrollback. Codex had the same problem, fixed in
#444 via tui.fullscreen_transcript=false.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
@artempartos
artempartos merged commit 7e393e9 into develop Oct 11, 2026
16 checks passed
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