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

未关闭
#3,314 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
go

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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

主要语言
Go
星标
4.2k
派生
890
平均合并
1 天 6 小时
30 天内合并 PR
189

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

kagent-dev/kagent 的其他 Issue

查看 kagent-dev/kagent 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。