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

Aperta
#3,314 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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).

Lingua principale
Go
Stelle
4.2k
Fork
890
Merge medio
1g 6h
PR unite (30g)
189

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di kagent-dev/kagent

Tutte le issue di kagent-dev/kagent

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.