Blank stdout tool call at end of turn triggers false 'no visible output' retry loop
Summary
When a response ends with a Bash tool call that produces no stdout (e.g. afplay /System/Library/Sounds/Hero.aiff -v 0.7 &), Claude Code's rendering system incorrectly detects 'no visible output' for the turn and auto-injects a retry prompt: [Your previous response had no visible output. Please continue and produce a user-visible response.]
This causes the model to regenerate the same response, resulting in the user seeing identical responses 2-3 times in a row.
Steps to Reproduce
- In any Claude Code session, end a response with a Bash tool call that produces no stdout output
- Example: last action is
afplay /System/Library/Sounds/Hero.aiff -v 0.7 &(background process, no stdout) - Observe: the system injects a 'no visible output' retry prompt
- The model regenerates, producing a duplicate response
- If the regenerated response also ends with the same no-stdout Bash call, it loops again (confirmed up to 3 duplicates)
Expected Behavior
A turn that contains substantive text output followed by a tool call with no stdout should be considered to have visible output. The 'no visible output' detection should check whether the turn contained any text content, not just whether the last tool call produced stdout.
Actual Behavior
The turn is flagged as having no visible output, triggering a retry. The user sees the same response 2-3 times.
Context
- Platform: macOS (darwin 25.3.0)
- Shell: zsh
- The text content of the response IS visible to the user — only the final tool call produces no stdout
- The issue is specifically triggered by tool calls with empty stdout, not by missing text output
Workaround
None available when the CLAUDE.md rules require a specific command as the last action of every response.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗