Skip to content

Commit eace3c8

Browse files
fix: only abort in-flight turns on teardown for SDK-owned runtimes
The abort-before-teardown added for the Windows session.db EBUSY fix ran unconditionally, so stop() on a client merely connected to an external runtime it does not own would cancel that runtime's pending work. Scope the abort to !isExternalServer so external-server clients disconnect gracefully without cancelling pending permission/tool requests other clients may resume. Restores pending_work_resume e2e (7/7) under graceful stop().
1 parent 4a56646 commit eace3c8

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

nodejs/src/client.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -914,8 +914,12 @@ export class CopilotClient {
914914
// terminating a child and the file stays locked (Windows), preventing
915915
// removal of the session-state directory. Aborting lets the turn cancel
916916
// and release the handle. Best-effort and idempotent: a session with no
917-
// active turn is a no-op.
918-
await Promise.allSettled(activeSessions.map((session) => session.abort()));
917+
// active turn is a no-op. Skip for external servers: we don't own that
918+
// runtime, and aborting would cancel pending work other clients may
919+
// still resume.
920+
if (!this.isExternalServer) {
921+
await Promise.allSettled(activeSessions.map((session) => session.abort()));
922+
}
919923
for (const session of activeSessions) {
920924
const sessionId = session.sessionId;
921925
let lastError: Error | null = null;

0 commit comments

Comments
 (0)