fix: treat aborted subagent lifecycle events as killed

This commit is contained in:
Peter Steinberger
2026-05-24 03:01:19 +01:00
parent 4d502b3d1e
commit 8df01a8683
2 changed files with 11 additions and 7 deletions
+4
View File
@@ -1008,6 +1008,7 @@ describe("subagent registry seam flow", () => {
phase: "end",
startedAt: 10,
endedAt: 20,
aborted: true,
stopReason: "aborted",
},
});
@@ -1037,6 +1038,9 @@ describe("subagent registry seam flow", () => {
.find((entry) => entry.runId === "run-aborted-end");
expect(run?.endedReason).toBe("subagent-killed");
expect(run?.outcome?.status).toBe("error");
await vi.advanceTimersByTimeAsync(20_000);
expect(mocks.runSubagentAnnounceFlow).toHaveBeenCalledTimes(1);
});
it("preserves run-mode keep entries past SESSION_RUN_TTL_MS sweep", async () => {
+7 -7
View File
@@ -1016,13 +1016,6 @@ function ensureListener() {
});
return;
}
if (evt.data?.aborted) {
schedulePendingLifecycleTimeout({
runId: evt.runId,
endedAt,
});
return;
}
if (isAbortedAgentStopReason(stopReason)) {
clearPendingLifecycleError(evt.runId);
clearPendingLifecycleTimeout(evt.runId);
@@ -1040,6 +1033,13 @@ function ensureListener() {
});
return;
}
if (evt.data?.aborted) {
schedulePendingLifecycleTimeout({
runId: evt.runId,
endedAt,
});
return;
}
if (evt.data?.yielded === true) {
if (
markSubagentRunPausedAfterYield({