Repository navigation
Conversation
A follow-up used to call delegate_to_agent again and open a fresh session, dropping the child's context. continue_delegation loads the recorded ACP session, assigns a new task id, and leaves the previous round's result frozen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
协作模式里,父智能体想在子智能体已经做完的结果上改个方向,只能再调一次
delegate_to_agent。这个工具每次都session/new,子会话的上下文就丢了。现有的
resume_delegation不能拿来做这件事:它只复活被打断的同一次任务,不接受新的任务正文,而且沿用原来的 task id。做法
新增
continue_delegation(task_id, task),和原来的两把工具并列:delegate_to_agent仍是冷启动,开新会话。工具描述写明:跟进、改方向、在已有结果上返工,必须用continue_delegation。continue_delegation只收上一轮的task_id和新的任务正文。agent、工作目录、ACP session id 都从任务账本恢复,不接受调用方再填一遍。resume_delegation不变。已经有后继的旧任务不能再 resume。一条子会话对应多条不可变的
delegation_task账本。续作与上一轮共用同一个 child conversation 和 ACP session,但有自己的 task id、父工具调用 id、状态和卡片。conversation 行上的delegation_call_id保持指向第一轮,避免覆盖旧结果。续作只接受
completed/failed/canceled。还在跑返回task_running;没有活连接的残留running返回source_not_terminal。同一轮相同正文幂等返回已有后继,不同正文返回continuation_conflict,并且只能从最新一轮接着续。session/load失败直接报错,不会退回session/new。这条严格加载只用于续作,普通用户会话恢复原样。回合结束按当前子连接路由到正在跑的那一轮。否则续作的
TurnComplete会落到第一轮已经结束的 task id 上,新任务一直停在运行中,父智能体收不到结果。前端把
continue_delegation渲染成新的一轮卡片,task id 旁标「新一轮」。新 task id 只从返回结果里取,不用输入里的上一轮 id。旧卡片在终态后,不会因为同一子会话上的新等待变成「等待中」。resume_delegation仍走原来的恢复卡片。文案补了 10 种语言。测试
pnpm test通过。continue_delegation加载同一 ACP session 再查磁盘,父会话能收到完成结果。