Agent sessions killed by an interruption should be resumable from their on-disk transcript (explicit revive opt-in)

Ouverte
#5,612 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
42/100
Type d'issue
Fonctionnalité
Clarté
Clairement spécifiée
Activité
Active
Stack technique
python
Domaine
ai-infra-agents, cli

Piste de recherche

Start by locating the session state-transition logic and the existing idle-session rehydration path used when continuing from an on-disk transcript. Identify the message/continue API where an explicit revive opt-in and machine-readable stop reason would fit, then add focused tests for failed, cancelled, running, and normal-completion sessions. Done means opt-in revival retains prior context, non-opt-in behavior remains unchanged, and callers can distinguish active sessions from dead sessions after a restart.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

area:agents

Summary

A background agent session that is interrupted — because the agent host restarts, the editor crashes, the model endpoint restarts mid-response, or the operator accidentally sends a destructive interrupt — lands in a terminal state (failed / cancelled) that cannot be revived, even though the conversation transcript for that session is still on disk and the session is still listed. A session in idle state can be sent a message and continues with its full context intact, which shows the rehydration machinery already exists; it just isn't reachable for the states that actually need it.

The result is that a single interruption converts in-flight work into a from-scratch re-dispatch, and anything the agent knew that wasn't written to disk is gone.

Observed behavior

Background sub-agent sessions tracked by the host survive a restart in the agent list with their titles and history visible. Attempting to continue one, however, is refused based on its status:

  • A session in idle accepts a follow-up message and resumes with full prior context. Repeatedly verified, including after three interruptions in one incident.
  • A session reported as failed refuses:
    Agent <id> is failed and cannot receive messages.
  • A session that was started in synchronous mode refuses, even when it is otherwise continuing normally:
    Agent <id> is in sync mode. A new background task must be started with a self-contained prompt.

The two refusals are correct as statements of the current design, but they mean there is no path back for the case that matters: the agent was doing good work, the transport underneath it died through no fault of the agent or the operator, and the transcript needed to continue is sitting right there.

Why this matters

The cost is asymmetric. Re-dispatching means the new agent has to rediscover everything the dead agent had already read — for a research or code-modification task that is often the majority of the work — and if the dead agent had acquired any exclusive resource (a lock file, a scratch directory, a reservation on a file it was about to write), the successor has to reason about state the dead agent left behind without being able to ask it what it had done.

Meanwhile the recovery signal is unreliable at exactly the moment it is needed. During the incident that prompted this report, the session list returned an incomplete set, then zero sessions, then a partial set again, while the host itself stayed responsive. So an operator cannot reliably tell "this agent is still working" from "this agent died and I need to restart it," and a naive re-dispatch risks two agents doing the same write at once.

What I'd expect

  1. A session whose turn ended due to a transport/host/endpoint interruption should remain resumable, not terminal. If the distinction is hard to make reliably, an explicit force path is perfectly acceptable.
  2. An explicit opt-in parameter on the message/continue path — something like revive: true — so that resuming a failed or cancelled session is a deliberate act by the caller, not an accident, and not a change in behavior for callers who don't ask for it. I'd find a parameter that says "I understand I am reviving this session and it may need to recover" entirely satisfactory.
  3. A machine-readable reason for why the session stopped, distinguishable at least between: operator cancellation, an interruption caused by a host or endpoint failure, a timeout, and a normal completion. That single field would let orchestration logic decide between "revive it" and "re-dispatch it" instead of guessing.

Acceptance criteria

  • Given a background agent session in failed or cancelled state whose transcript exists on disk, a caller can resume it with an explicit opt-in and the agent retains its prior context.
  • Resuming without the opt-in keeps today's refusal, so nothing that currently fails silently starts working by accident.
  • The session record exposes why it stopped, in a form a program can branch on rather than a display string.
  • A caller can distinguish "still running" from "dead and awaiting revival" after a host restart, from a source other than timing out.

Environment

Editor-integrated Copilot on Windows, agent sessions driven from an interactive chat as background sub-agents. Reproduced across several sessions in one incident on 2026-11-28.

I have not included repository, project, or infrastructure details; they aren't needed to reproduce the status-transition behavior described above.

Langage dominant
Python
Étoiles
11.5k
Forks
2k
Merge moyen
6 h 34 min
PR mergées (30 j)
3

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de github/copilot-cli

Toutes les issues de github/copilot-cli

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.