Skip to content

Commit ed15287

Browse files
committed
Surface subagent posix dispose failures
1 parent 8e81fb9 commit ed15287

3 files changed

Lines changed: 16 additions & 10 deletions

File tree

src/subagent/dispose.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,5 @@ export async function disposeSubAgentSession(input: SubAgentSessionDisposeInput)
120120
} catch {
121121
// ignore
122122
}
123-
try {
124-
await input.posixTools.dispose();
125-
} catch {
126-
// LSP shutdown can fail when several sub-agents exit together.
127-
}
123+
await input.posixTools.dispose();
128124
}

src/subagent/index.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,21 @@ describe("sub-agent teardown", () => {
7272
expect(disposeCount).toBe(2);
7373
});
7474

75+
test("disposeSubAgentSession does not treat a throwing posix dispose as success", async () => {
76+
const posixTools = {
77+
dispose: async () => {
78+
throw new Error("1 shell child process still live after 2000ms reap");
79+
},
80+
};
81+
82+
await expect(
83+
disposeSubAgentSession({
84+
agent: { close: async () => undefined },
85+
posixTools,
86+
}),
87+
).rejects.toThrow(/still live after 2000ms reap/);
88+
});
89+
7590
test("spawn registry tracks in-flight plugin tool calls", async () => {
7691
const { plugin, snapshot } = createSubAgentSpawnRegistryPlugin();
7792
expect(plugin.middleware).toBeDefined();

src/subagent/run.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,11 +1078,6 @@ async function runSubAgentInner(
10781078
} catch {
10791079
// close is idempotent; ignore races with disposeSubAgentSession.
10801080
}
1081-
try {
1082-
await posixTools.dispose();
1083-
} catch {
1084-
// ignore
1085-
}
10861081
})();
10871082
};
10881083
if (runController.signal.aborted) {

0 commit comments

Comments
 (0)