Background command completion notifications force unnecessary model responses at end of task
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 Claude Code finishes a task that includes background commands (like "Restart server"), the harness sends all completed background command notifications to the model at the end of the task and forces it to respond. This is unnecessary because:
- The task is already complete
- The background command completion notification is purely informational (e.g., "Background command 'Restart server' completed (exit code 0)")
- Forcing a model response consumes additional tokens/costs for no user benefit
- The user already sees the completion message in the terminal UI
This appears to be a design issue in how the harness handles background command completion events at task boundaries.
<img width="749" height="99" alt="Image" src="https://github.com/user-attachments/assets/671e5563-5949-4ad7-ad43-a54213ab7d7d" />
What Should Happen?
When a task completes and there are pending background command completion notifications, the harness should either:
- Display the completion message in the terminal without forcing a model response, OR
- Batch background command completions and only surface them if the user continues the conversation
The model should not be forced to generate a response just because a background command finished after the main task was already complete.
Error Messages/Logs
Steps to Reproduce
- Start Claude Code and give it a task that involves running a background command (e.g., "Start a dev server and make some changes to the frontend")
- Claude launches a background command like "Restart server"
- Complete the main task (make the requested changes)
- When Claude finishes responding about the completed task, wait for the background command to complete
- Observe that when the background command completes, Claude is forced to generate another response even though the task is already done
The terminal will show messages like:
- "Background command 'Restart server' completed (exit code 0)"
- "Old server stopped cleanly. The new server is running - go ahead and test in the browser."
After this, the model is forced to respond again unnecessarily.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.4
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗