Continue subagent transcripts#3586
Conversation
|
我对 reasonix 的 subagent 做了会话复用能力的支持!subagent 可以继续延续上一次的会话记录(不再是仅支持 fresh window),可以用在主 agent 需要与 subagent 多轮对话的场景!例如:主 agent 完成开发 -> subagent review -> fix -> 再次 review -> 再次 fix -> ... -> 直到 review 通过! |
SivanCola
left a comment
There was a problem hiding this comment.
Thanks for the transcript continuation work. I found one blocking issue around failed foreground runs.
In the foreground task path, RunSubAgentWithSession errors return immediately without saving the mutated session or marking the transcript failed (internal/agent/task.go). Subagent skills have the same pattern in internal/boot/boot.go. Since Agent.Run has already appended the new user prompt and any tool results before returning errors, a failed continue_from can leave the on-disk transcript/meta at the previous completed state. A later continue_from then reloads stale history and may repeat side-effecting work.
Could you persist the updated session and mark the run failed, or otherwise make the in-place continuation non-reusable after a failed mutation, for both foreground task and subagent skill paths?
Validation I ran:
go test ./internal/agent ./internal/skill ./internal/boot ./internal/clipassedgo test ./...still fails ininternal/controlonTestRemoveMCPServerRemovesUnconnectedLazyPlaceholder, but that reproduces on currentorigin/main-v2, so I treated it as existing/environment-related.
|
@SivanCola What changed:
Validation:
I also merged latest |
|
改说中文好了,哈哈。 更新一下本轮补充内容: 这次在 subagent 会话复用能力之外,补齐了对应的 lifecycle 管理,避免主会话删除后遗留 subagent transcript。 具体做了两部分: 1)为 subagent transcript 写入可靠的父会话归属
2)主会话 trash / restore / purge / delete 时级联处理 subagent artifacts
测试方面,我做了三层验证:
另外,我也检查了当前分支与最新 |
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Ensure persisted subagent transcripts record the active parent session and prevent in-place continuation from a different parent, keeping fork_from as the explicit copy path. Co-authored-by: Cursor <cursoragent@cursor.com>
Move owned subagent artifacts with desktop trash/restore and delete them from hard-delete paths so parent session cleanup no longer leaves reusable child transcripts behind. Co-authored-by: Cursor <cursoragent@cursor.com>
Persisted sub-agent transcripts made a parent session mandatory, so `reasonix run` (headless, which never mints a session path) failed every task/subagent-skill call with "subagent transcript parent session is required". Fall back to a non-persisted run when no parent session is active — restoring pre-transcript behaviour — and reserve continue_from/ fork_from for sessions that actually have a persisted owner. Adds a headless-run regression guard plus task-level ephemeral coverage.
825fa6d to
cf4a3d2
Compare
|
/e2e |
|
🤖 e2e bot failed — see the run log. |
|
/e2e |
🤖 Reasonix e2e benchmarkAccuracy: 4/5 (80%) · Cache hit: 78% · Tokens: 254,258 (prompt 251,307 / completion 2,951) · Compactions: 3 · Cost: ¥ 0.0647
Real provider run. Cache-hit % is cached prompt tokens / total prompt tokens. |
我看了这次 compaction e2e 失败的 run log。 日志里 compaction 任务没有调用 task / subagent;它正确走完了章节线索,也得到了正确答案内容:Aldermoor-Verrin;但最后尝试写入 story/answer.txt(其实应该写入 answer.txt),所以这是输出路径放错导致的 fail。 本 PR 没有改 因此,我倾向于认为这条 compaction fail 不是本 PR 引入的问题,而是任务提示在输出路径上不够明确,导致模型把正确答案写到了错误目录。 |
* feat(agent): add subagent transcript store Co-authored-by: Cursor <cursoragent@cursor.com> * feat(agent): continue task subagent transcripts Co-authored-by: Cursor <cursoragent@cursor.com> * feat(skill): continue subagent skill transcripts Co-authored-by: Cursor <cursoragent@cursor.com> * refactor(agent): require subagent transcript store Co-authored-by: Cursor <cursoragent@cursor.com> * fix(boot): record effective subagent identity Co-authored-by: Cursor <cursoragent@cursor.com> * fix(agent): release source lock after fork copy Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cli): run review with explicit subagent session Co-authored-by: Cursor <cursoragent@cursor.com> * fix(agent): persist failed subagent transcripts Co-authored-by: Cursor <cursoragent@cursor.com> * fix(agent): mark failed foreground continuations Co-authored-by: Cursor <cursoragent@cursor.com> * fix(agent): bind subagents to parent sessions Ensure persisted subagent transcripts record the active parent session and prevent in-place continuation from a different parent, keeping fork_from as the explicit copy path. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(session): cascade subagent lifecycle cleanup Move owned subagent artifacts with desktop trash/restore and delete them from hard-delete paths so parent session cleanup no longer leaves reusable child transcripts behind. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(agent): run sub-agents ephemerally without a parent session Persisted sub-agent transcripts made a parent session mandatory, so `reasonix run` (headless, which never mints a session path) failed every task/subagent-skill call with "subagent transcript parent session is required". Fall back to a non-persisted run when no parent session is active — restoring pre-transcript behaviour — and reserve continue_from/ fork_from for sessions that actually have a persisted owner. Adds a headless-run regression guard plus task-level ephemeral coverage. --------- Co-authored-by: lifu963 <lifu963@lifu963deMacBook-Air-2.local> Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: esengine <359807859@qq.com>


Summary
Test plan