File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff 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 ( / s t i l l l i v e a f t e r 2 0 0 0 m s r e a p / ) ;
88+ } ) ;
89+
7590 test ( "spawn registry tracks in-flight plugin tool calls" , async ( ) => {
7691 const { plugin, snapshot } = createSubAgentSpawnRegistryPlugin ( ) ;
7792 expect ( plugin . middleware ) . toBeDefined ( ) ;
Original file line number Diff line number Diff 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 ) {
You can’t perform that action at this time.
0 commit comments