[BUG] CancelTask fails after an ask-user answer resumed the task ("deferred continuation cannot be resumed")

Abierto
#3,314 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

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

Línea de trabajo

Start with go/harness/runtime/runtime.go, which defines runtime.ErrSessionAbandoned, and trace how CancelTask handles a turn resumed after an ask_user_response. Reproduce the listed sequence with the Claude harness, then follow the cancellation and deferred continuation code paths. Done means cancellation stops the live turn, marks the task TASK_STATE_CANCELED, and does not require deleting the session.

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

Descripción

Bug description

CancelTask fails on a task that was resumed by answering an ask-user question and is now working again:

-32603 failed to cancel: cancelation failed: restore runtime pending turn: deferred continuation cannot be resumed; start a new session

The task keeps running and there is no way to stop it short of deleting the whole session. That matters when the resumed work has side effects (here the agent went on to clone a repository and was heading towards git push).

deferred continuation cannot be resumed; start a new session is runtime.ErrSessionAbandoned (go/harness/runtime/runtime.go). It looks like cancellation tries to restore the deferred continuation, which has already been consumed by the answer, instead of cancelling the live turn the answer started.

Steps to reproduce
  1. A Claude harness agent calls AskUserQuestion and the task goes input-required.
  2. Answer it with a valid ask_user_response. The agent resumes and the task is TASK_STATE_WORKING.
  3. While it works, CancelTask the task.
Expected

The running turn is stopped and the task becomes TASK_STATE_CANCELED, as it does for a task that never paused.

Actual

The error above. The task stays TASK_STATE_WORKING and the agent keeps going. Deleting the session from the UI did stop it.

Environment

kagent v1.0.0-alpha17, Substrate v0.6.0-alpha3, Claude harness (Claude Code 2.1.285).

Lenguaje dominante
Go
Estrellas
4.2k
Forks
890
Merge medio
1 d 6 h
PR fusionados (30 d)
189

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

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 kagent-dev/kagent

Todos los issues de kagent-dev/kagent

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.