diff: the pane opens by itself with no file to list
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?
TLDR: in the fullscreen layout the diff pane opens by itself on the first edit, or on resuming a session that edited, even when the diff has no file to list, and docks beside the transcript under "No changes this session".
The auto-open does not ask whether the diff lists anything. With nothing else changed in the working tree this session:
| When | The pane docks with |
| --- | --- |
| The first edit is to a file git ignores | no rows, "No changes this session" |
| The first edit is to a path outside the repository | no rows, "No changes this session" |
| A resumed or continued session whose edits have since been committed | no rows, "No changes this session", before any prompt |
| Git cannot read the diff | "Diff unavailable" |
On main (3deb873; mods/diff is unchanged since 2301018), openOnFirstEdit checks the kept preference, the fullscreen layout, the column floor, file checkpointing and that a repository is found, and then opens:
The fetch openPane makes first (since #95488) fills the pane but does not decide whether it opens:
openOnRestore takes the same path whenever the restored transcript holds an edit:
The built-in diff mod in the 2.1.294 and 2.1.296 binaries carries the same open path.
The README and the merged #95476, #95488 and #95587 present the first-edit open as parity with the older built-in panel, which "opens on its first checkpoint", and #95488 lists "No changes" and "Diff unavailable" among the states a first-edit pane lands on. #94847 treats the empty open as the bug, and this issue is for that case: a pane that opens by itself with nothing to show takes the transcript's columns for nothing.
What Should Happen?
The pane opens by itself only when the fetch it makes before opening lists at least one file changed this session. An edit the diff does not list, an unreadable diff, or a resumed session whose edits are no longer listed opens nothing, and the next edit the diff lists opens it. /diff is unchanged.
Error Messages/Logs
No error. The pane opens with no file rows under "No changes this session" (or "Diff unavailable").
Steps to Reproduce
The pane opens by itself only in the fullscreen renderer, with file checkpointing on (the default), in a terminal at least 144 columns wide (110 once you have kept it open with /diff), and only while your last choice was to keep it open. Closing it in any way is remembered, and Claude Code also carries over a close made in the older built-in panel (diffSidebarOpen: false in ~/.claude.json). So use a terminal at least 144 columns wide throughout, keep the pane open with /diff first (step 2), and quit every session with the pane still open.
git init demo && cd demo && echo notes.txt > .gitignore && git add .gitignore && git commit -m initCLAUDE_CODE_NO_FLICKER=1 claude, type/diff(the pane opens: "Diff panel shown"), and quit.CLAUDE_CODE_NO_FLICKER=1 claude- Ask
Use the Write tool to create notes.txt containing hello, and approve the write. - The pane docks beside the transcript with no file rows, under "No changes this session". Quit.
A path outside the repository: repeat steps 3-5 in a new session, asking Use the Write tool to write hello to /tmp/outside.txt and answering the permission prompt with plain Yes.
A resumed session whose edits were committed:
CLAUDE_CODE_NO_FLICKER=1 claude, askUse the Write tool to create app.txt containing hello, and approve. The pane opens listingapp.txt, as it should. Quit.git add app.txt && git commit -m appCLAUDE_CODE_NO_FLICKER=1 claude --continue- Before any prompt, the pane docks with no file rows, under "No changes this session".
Not run live: these outcomes are traced through main's hooks and the 2.1.296 binary, and #94847's tests below fail on main for each case.
Claude Model
_No response_
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.296 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
- #94847 ("diff: the first edit opens the pane only when it has a file to list") fixes this: the fetch before the open decides it, on the first-edit and restore paths alike, and an edit outside the working tree opens nothing. It is open, conflicts with main in
mods/diff/hooks/register.tsandmods/diff/tests/register.test.ts, and its CI last ran on base 7974a70. - #94847's tests for these cases fail when run against main's hooks, each opening the pane (
[{ id: "diff", title: "Diff" }]) where it expects nothing ([]): an edit outside the repository opens nothing, the next one inside doesan edit the diff lists no row for opens nothing, a later one it lists doesa diff git could not read, or no tracked row with the untracked withheld, opens nothinga resumed session whose edits the diff no longer lists opens nothing, the next edit it lists does- A merge of #94847 with main 2301018 is at konsta95/claude-code@83d80c0 (branch
fix/diff-recovery-races-01a0e7e9), with the/clearand/resumerace fixes and the other lifecycle fixes posted on #94847; its checks pass in konsta95/claude-code#3. - Related: #93160 (the first-edit auto-open itself, on a pane that had files to list) and #97935 (a panel that stays up when empty).
---
Co-authored by Claude Code