Agent response remains in Working after the final answer while background tasks run
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
- Copilot Chat Extension Version: Integrated
- VS Code Version: Reproduced in current Code OSS Dev 1.139.0 and Code - Insiders
- OS Version: macOS arm64
- Feature: Agent Host / Agents window
- Selected models: GPT-5.6 Sol and GPT-5.6 Sol Fast
- Logs: Confirmed in Agent Host, AHP, and Copilot SDK event logs
Steps to Reproduce:
1. Ask an agent to start a long-running server using an attached asynchronous shell.
2. Let the model finish and produce its final answer.
3. Observe that the response remains in Working/Analyzing and does not show Copy or response details until the shell stops.
4. The same problem occurs when an attached shell from an earlier turn survives cancellation or checkpoint restore and a later turn finishes without launching any shell.
Expected:
The response completes when the top-level agent finishes. Background tasks continue running and report their completion separately.
Actual:
Agent Host waits for SDK `session.idle`, which is deferred until attached shells and background agents finish. The completed answer therefore remains visually and protocol-level in progress indefinitely.
Controlled verification:
Stopping the outstanding shells immediately produced `shell_completed`, `session.idle`, `chat/turnComplete`, and the response footer/Copy action.
Technical diagnosis:
The SDK already exposes root `assistant.idle` for the foreground agent loop. Agent Host should use that guarded signal for response completion while retaining `session.idle` as a compatibility fallback and preserving background-task lifetime across release/restart.
Related: #321273 reports a similar symptom caused by broken PowerShell shell-integration markers; this report has a different confirmed cause.
## Screenshot

Contributor guide
Assessment
This issue has not been assessed yet.