From 1947bdbe0178ca36256a1ec8b66ea40f980e6c7e Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Sat, 17 Oct 2026 14:10:45 +0200 Subject: [PATCH 1/2] agentHost: stop the Copilot runtime before deleting quick chat test homes The quick chat scratch directory tests run a real CopilotAgent whose Copilot runtime uses /.copilot as COPILOT_HOME. Since the Copilot SDK bump to 1.0.23-preview.5 (#342210) the runtime writes into .copilot/logs while the test's finally block removes the temp home, so fs.rm fails with ENOTEMPTY. The throw also skipped disposeAgent, leaking the model refresh retry timer into the leak checks of later, unrelated tests. Dispose the agent first so the runtime is stopped, then remove the temp home with retries. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/vs/platform/agentHost/test/node/copilotAgent.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/vs/platform/agentHost/test/node/copilotAgent.test.ts b/src/vs/platform/agentHost/test/node/copilotAgent.test.ts index a27d3ae71bc5b0..e7c781f39dc93a 100644 --- a/src/vs/platform/agentHost/test/node/copilotAgent.test.ts +++ b/src/vs/platform/agentHost/test/node/copilotAgent.test.ts @@ -7999,8 +7999,8 @@ suite('CopilotAgent', () => { const provisional = (agent as unknown as { _provisionalSessions: Map })._provisionalSessions.get('temp-fallback'); assert.strictEqual(provisional?.workspaceless, true); } finally { - await fs.rm(userHome.fsPath, { recursive: true, force: true }); await disposeAgent(agent); + await fs.rm(userHome.fsPath, { recursive: true, force: true, maxRetries: 5 }); } }).timeout(30_000); @@ -8026,8 +8026,8 @@ suite('CopilotAgent', () => { assert.deepStrictEqual(uris.includes(scratchInstructions.toString()), false); } finally { - await fs.rm(userHome.fsPath, { recursive: true, force: true }); await disposeAgent(agent); + await fs.rm(userHome.fsPath, { recursive: true, force: true, maxRetries: 5 }); } }).timeout(30_000); @@ -8052,8 +8052,8 @@ suite('CopilotAgent', () => { await internals._resumeSession(sessionId, sessionBackedChat(sessionId)).catch(() => undefined); await fs.access(scratchDir.fsPath); } finally { - await fs.rm(userHome.fsPath, { recursive: true, force: true }); await disposeAgent(agent); + await fs.rm(userHome.fsPath, { recursive: true, force: true, maxRetries: 5 }); } }).timeout(30_000); @@ -8098,8 +8098,8 @@ suite('CopilotAgent', () => { await disposeProvisionedSession(agent, session); return { afterPeer, afterDefault: await scratchExists() }; } finally { - await fs.rm(userHome.fsPath, { recursive: true, force: true }); await disposeAgent(agent); + await fs.rm(userHome.fsPath, { recursive: true, force: true, maxRetries: 5 }); } } From 84d8b3f172d051a95ce7a83ed8c7a2784f502b50 Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Sat, 17 Oct 2026 14:35:20 +0200 Subject: [PATCH 2/2] agentHost: also stop the runtime before deleting the session teardown test home Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/vs/platform/agentHost/test/node/copilotAgent.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vs/platform/agentHost/test/node/copilotAgent.test.ts b/src/vs/platform/agentHost/test/node/copilotAgent.test.ts index e7c781f39dc93a..a954f50e384109 100644 --- a/src/vs/platform/agentHost/test/node/copilotAgent.test.ts +++ b/src/vs/platform/agentHost/test/node/copilotAgent.test.ts @@ -8072,8 +8072,8 @@ suite('CopilotAgent', () => { await disposeProvisionedSession(agent, result.session); await assert.rejects(() => fs.access(scratchDir.fsPath)); } finally { - await fs.rm(userHome.fsPath, { recursive: true, force: true }); await disposeAgent(agent); + await fs.rm(userHome.fsPath, { recursive: true, force: true, maxRetries: 5 }); } }).timeout(30_000);