Repository navigation
Description
Describe the feature or problem you'd like to solve
In Autopilot, when a detached shell finishes after the agent has called task_complete, its shell_detached_completed notification is held until the user's next message, so the agent can't launch a long job, end its turn, and wake itself when the job is done, as it can in interactive mode or VS Code's Local harness.
Proposed solution
Add an option (session setting, CLI flag, and a VS Code setting for the Copilot harness) to deliver background completions actively after task_complete: a shell_detached_completed notification for work started in the session starts a new Autopilot turn instead of waiting for the next user message.
Benefit: unattended Autopilot sessions can supervise long-running jobs without polling and without keeping the session "Working" for hours. The user can keep chatting meanwhile, and results are reported as soon as the job ends. This also matches what interactive mode and VS Code's Local harness already do.
Example prompts or workflows
- "Run the full simulation regression detached, then call task_complete. When it finishes, summarise pass/fail counts and the first error of each failing test." (Runs take 10 min to several hours.)
- "Start the FPGA build in the background. When it completes, check timing and utilisation and flag any failures."
- "Launch these 5 parameter-sweep jobs detached, one call each. Record each result as it completes, then compare them."
- "Kick off the long integration test suite, then help me with something else. Report back when it finishes."
Additional context
Behaviour today
| Harness | Mode | Detached shell completes after the turn ends | Agent wakes? |
|---|---|---|---|
| Copilot (SDK) | Interactive | Notification starts a new turn | Yes |
| VS Code Local | Autopilot / Allow all | isSystemInitiated steering request |
Yes |
| Copilot (SDK) | Autopilot, no task_complete | Session never goes idle (hidden isAutopilotContinuation messages) |
n/a |
| Copilot (SDK) | Autopilot, after task_complete | Held until next user message | No |
Repro
- Start a session in Autopilot.
- Ask: "Use bash with mode async and detach true to run
sleep 60; echo DONE. Then call task_complete." - Don't send a message. Nothing happens until you type.
Observed (events.jsonl, UTC)
- 22:32:44 bash
detach: truelaunched → 22:33:21session.task_complete→ ~22:35:46 process exits → 22:36:50shell_detached_completeddelivered only with the next user message. - The same flow in interactive mode: launched 22:13:47, notification at 22:14:48 started a new turn on its own.
Environment: runtime 1.0.108-0, @github/copilot-sdk 1.0.30-preview.0, VS Code 1.146.0 Copilot harness (Agent Host), Copilot Chat 0.73.0, Remote-SSH to Linux.
Related: 1.0.106-5 ("background task completions that arrive after a run stops are delivered with your next message instead of being dropped") fixed dropped notifications. This request asks for them to wake the session. It may relate to setStayInAutopilot defaulting to true (seen in an SDK schema snapshot, not confirmed).
Workarounds today: interactive mode (loses Autopilot's keep-going behaviour), VS Code's Local harness, or attached async shells (keeps the session "Working" for the whole job).
Activity