fix(agent): clarify subagent continuation guidance#4054
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
|
补充本地行为测试,说明为什么这个 PR 最终只改 schema description,而没有改 subagent result format 或加入更多示例。
|
|
附测试用例: 漏洞检测任务请分析下面这段 Java 代码是否存在安全漏洞或权限绕过风险。将初步分析结论写入当前目录下的 报数游戏请和 subagent 玩一个轮流报数游戏:你先报 1,subagent 接着报 2,如此交替直到数到 10。 |
0703d9f to
31d002c
Compare
SivanCola
left a comment
There was a problem hiding this comment.
Approved. I pushed 31d002c to tighten the continuation guidance so the schema now tells the model to pass only the sa_... value from the prior 'Subagent reference: ...' line, matching the existing reference validation contract.
This keeps the PR scoped to static tool-schema wording: it does not change subagent runtime behavior, result formatting, persistence, permissions, or provider request serialization. The schema text is provider-visible, so it will intentionally refresh that stable prefix once, but it remains static and does not introduce per-turn or per-workspace cache instability.
Verified:
- go test ./internal/agent ./internal/skill
- go test ./...
- git diff --check
Summary
本 PR 优化了三个工具暴露给模型的
continue_fromschema 描述:tasktoolrun_skill当前项目实现已经存在:subagent 完成后会返回
Subagent reference: sa_...token,将该 token 作为continue_from传入即可在原位续接/复用同一个子会话。此前 schema 只把这个字段描述为“可选引用”,但没有让模型在调用时明确意识到三点:continue_from会保留 subagent 之前的上下文;review -> fix -> review again)这类迭代循环可以考虑复用同一个 subagent;Subagent reference: sa_...token。Why This Matters
subagent 的价值之一,是把聚焦的探索、分析或 review 上下文隔离在父会话之外。但在多轮工作流里,如果每次都启动 fresh window subagent,就会丢失上一个 subagent 刚刚建立的专注上下文。此前
continue_from只被描述成一个通用的可选引用,模型很容易忽略这一点。本改动刻意保持很小:它只让现有工具契约更自解释,使模型在任务结构需要时,更容易根据当前任务场景,主动思考是否要选择已有的续接路径。
Validation
已运行: