You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A hung agent.close used to run before process-group reap, so teardown
could report success while detached run_shell children were still live.
Dispose first, fail a close deadline instead of succeeding, and clear
the two-second host timer when dispose wins.
"Per sub-agent session Corbits Code runs agent.close(), drains in-flight tool middleware (best-effort), then posixTools.dispose() (LSP and plugin dispose callbacks). "+
48
+
"Per sub-agent session Corbits Code runs posixTools.dispose() (LSP and plugin dispose callbacks, including in-flight tool drain), then agent.close() and stream drain. "+
49
49
"run_shell children are tracked in the shell-guard plugin and killed on posixTools.dispose; ripgrep detached spawns are not tracked in a global registry.";
50
50
51
+
/** Fail a hung close instead of resolving as successful teardown. */
52
+
exportasyncfunctionawaitBoundedTeardown(
53
+
teardown: Promise<void>,
54
+
deadlineMs: number,
55
+
): Promise<void>{
56
+
letteardownError: unknown;
57
+
lettimedOut=false;
58
+
lettimer: ReturnType<typeofsetTimeout>|undefined;
59
+
try{
60
+
awaitPromise.race([
61
+
teardown.then(
62
+
()=>undefined,
63
+
(err: unknown)=>{
64
+
teardownError=err;
65
+
},
66
+
),
67
+
newPromise<void>((resolve)=>{
68
+
timer=setTimeout(()=>{
69
+
timedOut=true;
70
+
resolve();
71
+
},deadlineMs);
72
+
}),
73
+
]);
74
+
}finally{
75
+
if(timer!==undefined)clearTimeout(timer);
76
+
}
77
+
if(teardownError!==undefined)throwteardownError;
78
+
if(timedOut)thrownewError(`session close exceeded ${deadlineMs}ms`);
79
+
}
80
+
51
81
exportinterfaceSubAgentSpawnSnapshot{
52
82
inFlightToolCalls: number;
53
83
inFlightByTool: Readonly<Record<string,number>>;
@@ -110,6 +140,12 @@ export async function disposeSubAgentSession(input: SubAgentSessionDisposeInput)
0 commit comments