[BUG] Statusline doesn't refresh after `!` (bash mode) commands complete
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?
When using a custom statusline that displays git state, the statusline doesn't refresh after ! commands complete. The statusline continues showing stale git information until the user interacts with the input field.
What Should Happen?
The statusline should refresh after ! command output completes, the same way it refreshes when the user types in the input field.
Steps to Reproduce
- Save this minimal statusline script as
~/.claude/statusline.shandchmod +xit:
```bash
#!/bin/bash
input=$(cat)
cwd=$(echo "$input" | jq -r '.workspace.current_dir')
printf '%s' "${cwd/#$HOME/~}"
if git -C "$cwd" rev-parse --git-dir > /dev/null 2>&1; then
branch=$(git -C "$cwd" rev-parse --abbrev-ref HEAD 2>/dev/null)
if [ "$branch" = "HEAD" ]; then
commit=$(git -C "$cwd" rev-parse --short HEAD 2>/dev/null)
printf ' (detached: %s)' "$commit"
else
printf ' (%s)' "$branch"
fi
fi
echo
```
- Configure in
~/.claude/settings.json:
``json``
{
"statusLine": {
"type": "command",
"command": "/Users/you/.claude/statusline.sh"
}
}
- Open Claude Code in a git repo on a branch (e.g.,
main) - Run
!git checkout -b test-branch - Observe: statusline still shows
(main)instead of(test-branch) - Type ! in the input field, and then clear the input → statusline updates correctly
Is this a regression?
I don't know
Claude Code Version
2.1.19 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗