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

Abierto
#5,612 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
42/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Python
Estrellas
11.5k
Forks
2k
Merge medio
6 h 34 min
PR fusionados (30 d)
3

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de github/copilot-cli

Todos los issues de github/copilot-cli

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.