Skip to content

Commit 7d34c1d

Browse files
committed
test(ci): cover non-waiting subagent completion
1 parent 7587e4c commit 7d34c1d

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

src/agents/subagent-registry-lifecycle.test.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,44 @@ describe("subagent registry lifecycle hardening", () => {
222222
);
223223
});
224224

225+
it("does not wait for a completion reply when the run does not expect one", async () => {
226+
const entry = createRunEntry({
227+
expectsCompletionMessage: false,
228+
});
229+
const captureSubagentCompletionReply = vi.fn(async () => undefined);
230+
231+
const controller = mod.createSubagentRegistryLifecycleController({
232+
runs: new Map([[entry.runId, entry]]),
233+
resumedRuns: new Set(),
234+
subagentAnnounceTimeoutMs: 1_000,
235+
persist: vi.fn(),
236+
clearPendingLifecycleError: vi.fn(),
237+
countPendingDescendantRuns: () => 0,
238+
suppressAnnounceForSteerRestart: () => false,
239+
shouldEmitEndedHookForRun: () => false,
240+
emitSubagentEndedHookForRun: vi.fn(async () => {}),
241+
notifyContextEngineSubagentEnded: vi.fn(async () => {}),
242+
resumeSubagentRun: vi.fn(),
243+
captureSubagentCompletionReply,
244+
runSubagentAnnounceFlow: vi.fn(async () => false),
245+
warn: vi.fn(),
246+
});
247+
248+
await expect(
249+
controller.completeSubagentRun({
250+
runId: entry.runId,
251+
endedAt: 4_000,
252+
outcome: { status: "ok" },
253+
reason: SUBAGENT_ENDED_REASON_COMPLETE,
254+
triggerCleanup: false,
255+
}),
256+
).resolves.toBeUndefined();
257+
258+
expect(captureSubagentCompletionReply).toHaveBeenCalledWith(entry.childSessionKey, {
259+
waitForReply: false,
260+
});
261+
});
262+
225263
it("skips browser cleanup when steer restart suppresses cleanup flow", async () => {
226264
const entry = createRunEntry({
227265
expectsCompletionMessage: false,

0 commit comments

Comments
 (0)