-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Git diff chip flickers between tracked-only and all-files count when untracked files are present #9228
Copy link
Copy link
Closed
Labels
area:shell-terminalTerminal input/output, shell integration, prompt behavior, and block rendering.Terminal input/output, shell integration, prompt behavior, and block rendering.bugSomething isn't working.Something isn't working.os:macmacOS-specific behavior, regressions, or requests.macOS-specific behavior, regressions, or requests.ready-to-implementThe issue is ready for implementation work.The issue is ready for implementation work.repro:highThe report includes enough evidence that the issue appears highly reproducible.The report includes enough evidence that the issue appears highly reproducible.triagedIssue has received an initial automated triage pass.Issue has received an initial automated triage pass.
Milestone
Metadata
Metadata
Assignees
Labels
area:shell-terminalTerminal input/output, shell integration, prompt behavior, and block rendering.Terminal input/output, shell integration, prompt behavior, and block rendering.bugSomething isn't working.Something isn't working.os:macmacOS-specific behavior, regressions, or requests.macOS-specific behavior, regressions, or requests.ready-to-implementThe issue is ready for implementation work.The issue is ready for implementation work.repro:highThe report includes enough evidence that the issue appears highly reproducible.The report includes enough evidence that the issue appears highly reproducible.triagedIssue has received an initial automated triage pass.Issue has received an initial automated triage pass.
Summary
When running a terminal command in a repo that has both modified tracked files and untracked files, the git diff chip flickers between two values: the correct one that counts all changes (2 files | 8 edits) and an incorrect one that omits untracked files (1 file | 4 edits). The flicker is consistent and reproducible on every command run.
Problem
The
GitDiffStatschip has two update paths that compute the file/edit counts differently:GitRepoStatusModel(filesystem watcher): callsDiffStateModel::diff_metadata_against_head(), which runsgit status --untracked-files=alland reads line counts from untracked files directly. Includes untracked files.shell_git_line_changes()(shell fallback): runsGIT_OPTIONAL_LOCKS=0 git -c diff.autoRefreshIndex=false diff --shortstat HEAD. Excludes untracked files.When a command completes, the shell-command fallback fires and briefly overwrites the filesystem-watcher value with a count that omits untracked files. The filesystem watcher then fires again and restores the correct value, producing the visible flicker.
Expected behavior
The chip consistently shows the correct count that includes both modified tracked files and untracked files (2 | 8 in this reproduction case).
Actual behavior
Every time a command is run, the chip briefly flickers to the incorrect value (1 | 4), which excludes untracked files, before snapping back to the correct value (2 | 8).
Reproduction steps
touch scripts/repro.shand add 4 lines).2 | 8).echo hello,ls,git status).1 | 4) then corrects to2 | 8.Specific repo state used during reproduction:
.mcp.json(+4 lines, 0 deletions)scripts/repro-mcp.sh(4 lines)2 | 81 | 4Artifacts
Video with a repro: https://www.loom.com/share/b0f148fe1c004eb591ec82e4149fcace.
Warp version
Unknown (please fill in from Warp → About Warp)
Operating system
macOS
Possible source references
app/src/context_chips/builtins.rs (162-180):shell_git_line_changes()runsgit diff --shortstat HEAD, which only counts tracked file changes and excludes untracked files — this is the source of the incorrect lower value.app/src/code_review/diff_state.rs (1624-1665):diff_metadata_against_head()usesgit status --untracked-files=alland reads line counts from untracked files — this produces the correct higher value.app/src/context_chips/current_prompt.rs (1428-1472): filesystem-watcher update path that callsGitLineChanges::from_diff_stats(&metadata.stats_against_head)— correct path, but races with the shell command path on block completion.app/src/context_chips/current_prompt.rs (1480-1492):is_updated_externally()guard that should suppress the periodic 30-second timer whenGitRepoStatusModelis live — but does not appear to suppress the block-completion shell command trigger.