Skip to content

Commit 9889fec

Browse files
fix(subagent): preserve steered task text on restart redispatch
1 parent f47ef9c commit 9889fec

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/gateway/session-subagent-reactivation.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ describe("reactivateCompletedSubagentSession", () => {
6363
});
6464
});
6565

66-
it("threads the follow-up task into the replacement so restart redispatch rewraps the new prompt instead of the stale original", async () => {
66+
it("threads the exact follow-up task into the replacement so restart redispatch rewraps the new prompt instead of the stale original", async () => {
6767
// Regression for the ClawSweeper P2 finding on #77539: the helper-level
6868
// task override reaches active steer, descendant wake, and orphan
6969
// recovery, but the completed-session reactivation sibling path used by
@@ -100,7 +100,7 @@ describe("reactivateCompletedSubagentSession", () => {
100100
nextRunId: "run-next",
101101
fallback: latestEndedRun,
102102
runTimeoutSeconds: 0,
103-
task: "follow-up prompt text",
103+
task: " follow-up prompt text ",
104104
});
105105
});
106106

src/gateway/session-subagent-reactivation.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ export async function reactivateCompletedSubagentSession(params: {
3333
return false;
3434
}
3535
const { replaceSubagentRunAfterSteer } = await loadSessionSubagentReactivationRuntime();
36-
const trimmedTask = params.task?.trim();
36+
const task = params.task;
37+
const hasTask = typeof task === "string" && task.trim().length > 0;
3738
return replaceSubagentRunAfterSteer({
3839
previousRunId: existing.runId,
3940
nextRunId: runId,
4041
fallback: existing,
4142
runTimeoutSeconds: existing.runTimeoutSeconds ?? 0,
42-
...(trimmedTask ? { task: trimmedTask } : {}),
43+
...(hasTask ? { task } : {}),
4344
});
4445
}

0 commit comments

Comments
 (0)