Autopilot background-task timeout exits active parent after subagent completes
Personne n'a encore pris cette issue.
- Langage dominant
- Shell
- Étoiles
- 11.2k
- Forks
- 1.9k
- Merge moyen
- 14 h 16 min
- PR mergées (30 j)
- 6
Description
Describe the bug
In autopilot mode, the 600-second background-task wait timeout terminates the
entire Copilot CLI process even after the background subagent has completed and
the parent agent has resumed work.
The timeout appears to start from when the parent first becomes idle.
It is not cancelled or reset when the background task completes.
The process exits with code 0, causing automation to treat the interrupted run
as successful.
Affected version
1.0.80
Steps to reproduce the behavior
- Start Copilot CLI in autopilot mode.
- Launch a background subagent that remains active for several minutes.
- Allow the parent agent to become idle while awaiting that subagent.
- Let the subagent complete before the configured COPILOT_TASK_WAIT_TIMEOUT_SECONDS deadline.
- Allow the parent to resume work.
- Original timer still fires and exits the entire process, even though the parent is active and the subagent has finished.
Observed timeline from one run:
06:07:40 - background subagent started
06:10:52 - parent became idle while waiting
06:19:12 - subagent completed; parent resumed
06:20:48 - parent was actively streaming an edit tool call
06:20:52 - exactly 600 seconds after the parent became idle, Copilot emitted:
"Timed out after 600s waiting for background tasks to finish; exiting.
Set COPILOT_TASK_WAIT_TIMEOUT_SECONDS to change the limit."
The process then returned exitCode: 0.
The in-progress edit was never executed.
Expected behavior
When a background-task timeout is reached, Copilot CLI should:
- Cancel only background tasks that are still running.
- Return control to the parent with a timeout notification.
- Cancel the wait timer when all background tasks complete.
- Not terminate an active parent because of a stale background-task timer.
If a session-level deadline intentionally terminates the process, it should be reported as a timeout with a nonzero exit status rather than successful completion.
Additional context
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par suivre le traitement de COPILOT_TASK_WAIT_TIMEOUT_SECONDS et le cycle de vie de l’achèvement des tâches en arrière-plan en autopilot mode. Reproduisez le scénario en six étapes, vérifiez si le minuteur d’attente est annulé lorsque le sous-agent se termine et que le parent reprend, et vérifiez que tout délai d’expiration de session intentionnel signale un état de sortie différent de zéro.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- shell
- Domaine
- cli
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- Active
- Clarté
- Plutôt claire
- Accessibilité débutants
- 48/100