Repository navigation
fix(subagents): say when a background report comes from a resumed run - #991
Conversation
resume reruns a child under the same session ID, and the completion notification was built from the same template as the first run's: "Subagent <id> completed." followed by the result. A parent that already handled the first report had no way to tell the resumed run's report apart from a repeat of it, and could redo the work (agegr#985). Mark runs started by resume with an in-memory resumed flag and add one line to their notification saying it comes from a resumed run and supersedes any earlier report from that subagent. First runs, tool results, and the notification details are unchanged. Refs agegr#985
|
Reviewed. The ambiguity in #985 is real: The fix is minimal. The new tests fail against Generated by Claude Code |
…agegr#991) resume reruns a child under the same session ID, and the completion notification was built from the same template as the first run's: "Subagent <id> completed." followed by the result. A parent that already handled the first report had no way to tell the resumed run's report apart from a repeat of it, and could redo the work (agegr#985). Mark runs started by resume with an in-memory resumed flag and add one line to their notification saying it comes from a resumed run and supersedes any earlier report from that subagent. First runs, tool results, and the notification details are unchanged. Refs agegr#985 Co-authored-by: CLAY777 <[email protected]>
…agegr#991) resume reruns a child under the same session ID, and the completion notification was built from the same template as the first run's: "Subagent <id> completed." followed by the result. A parent that already handled the first report had no way to tell the resumed run's report apart from a repeat of it, and could redo the work (agegr#985). Mark runs started by resume with an in-memory resumed flag and add one line to their notification saying it comes from a resumed run and supersedes any earlier report from that subagent. First runs, tool results, and the notification details are unchanged. Refs agegr#985 Co-authored-by: CLAY777 <[email protected]>
Refs #985.
Problem
resumereruns a child under the same session id, and its completion notification uses the same template as the first run's:Subagent <id> completed.followed by the result. A parent that already handled the first report cannot tell the resumed run's report from a repeat of it, and may redo the work. This is the "framed identically both times" part of #985.Change
lib/subagent-runtime.ts: a run started byresumecarries an in-memoryresumed: trueflag. It is not persisted.lib/subagent-extension.ts:subagentNotificationText()adds one line for such runs, after the 在 subagent 的结果前拼接一句说明,防止污染 compaction #875 prefix:This report is from a resumed run of subagent <id>; it supersedes any earlier report from the same subagent.First-run notifications,
Agent/get_subagent_resulttool results, and the notificationdetailsare unchanged. There is no UI change.This does not claim to close #985. That issue also asks whether a single run can be emitted twice, and this PR does not change delivery.
Tests
resumesets the flag end to end.tscand lint are clean.npm test: the only failures are the existing Windows-host ones, and they fail onmaintoo.