[BUG] Terminal scrollback cleared mid-session without compaction (v2.1.74, iTerm2)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Terminal scrollback is being cleared mid-session. The top of the scrollback buffer starts mid-diff output — everything above that point is gone. This is NOT triggered by autocompaction, /clear, terminal resize, or any explicit user action.
iTerm2 is configured with unlimited scrollback. The scrollback content simply disappears during normal tool execution (Edit tool diffs being rendered).
What Should Happen?
Terminal scrollback should never be cleared during normal operation. All session output should remain in the scrollback buffer.
Steps to Reproduce
- Open Claude Code in iTerm2 with unlimited scrollback
- Run a session with many Edit tool calls (10+ file edits)
- Scroll to top — beginning of session is missing, scrollback starts mid-diff output
<img width="2068" height="888" alt="Image" src="https://github.com/user-attachments/assets/0531824a-7c0c-41bf-9ce5-061d4f622948" />
Is this a regression?
Yes, this worked in a previous version. Started happening today (2026-03-12).
Claude Code Version
v2.1.74
Platform
Anthropic API (Claude Team)
Operating System
macOS (Darwin 24.6.0)
Terminal/Shell
iTerm2 / zsh
Additional Information
- iTerm2 scrollback set to unlimited
- "Save lines to scrollback in alternate screen mode" is enabled
- Not related to autocompaction (#32807) — no compaction occurred during the session
- Possibly related to #2479 (general scrollback clearing) but that issue covers resize/clear/transcript switches, not mid-session tool output rendering
- Session involved ~30 Edit tool calls rendering diffs
This issue has 9 comments on GitHub. Read the full discussion on GitHub ↗