From bebd9dffa19df16d1f305cbc61cfc35d6047dc8d Mon Sep 17 00:00:00 2001 From: Theo Mathieu Date: Tue, 9 Jun 2026 13:50:12 +0200 Subject: [PATCH] review: remove unrelated changelog bullets; assert abort() barrier in test --- packages/coding-agent/CHANGELOG.md | 3 +- packages/coding-agent/test/acp-agent.test.ts | 32 ++++++++++++++++---- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index 6a22e1b94..15b588214 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -362,8 +362,7 @@ ### Fixed - Fixed ACP cancel button leaving the session in a stuck state — a new prompt sent while a turn is still in-flight (e.g. immediately after pressing Stop in Zed before `session/cancel` is processed) now implicitly cancels the running turn and queues the new message, instead of throwing an error that blocks further interaction. -- Fixed `enabledModels` being ignored by the ACP model picker (Zed and other ACP clients) — `AgentSession.getAvailableModels()` now applies the configured allow-list, so only the models listed in `enabledModels` appear in the UI. Also applies consistently to the RPC `get_available_models` endpoint and the `/model` slash command. -- Fixed ACP `available_commands_update` to include extension-registered slash commands so clients like Zed surface them in the slash-command palette. + ## [15.10.1] - 2026-06-07 ### Added diff --git a/packages/coding-agent/test/acp-agent.test.ts b/packages/coding-agent/test/acp-agent.test.ts index 646766681..d93fcf3a0 100644 --- a/packages/coding-agent/test/acp-agent.test.ts +++ b/packages/coding-agent/test/acp-agent.test.ts @@ -1313,7 +1313,19 @@ describe("ACP agent", () => { const harness = await createHarness(); const created = await harness.agent.newSession({ cwd: harness.cwdA, mcpServers: [] }); const session = harness.findSession(created.sessionId)!; - // Use custom prompt mock that lets us unblock both calls cleanly + + // Block abort() until released so we can assert the second prompt waits + let releaseAbort!: () => void; + const abortStarted = Promise.withResolvers(); + const abortRelease = new Promise(resolve => { + releaseAbort = resolve; + }); + session.abort = async () => { + session.isStreaming = false; + abortStarted.resolve(); + await abortRelease; + }; + const blockers: Array<() => void> = []; session.prompt = async (text: string): Promise => { session.promptCalls.push(text); @@ -1335,7 +1347,6 @@ describe("ACP agent", () => { prompt: [{ type: "text", text: "long running" }], } as PromptRequest); await Bun.sleep(0); - // First session.prompt is blocking; only "long running" has been seen so far expect(session.promptCalls).toEqual(["long running"]); // Second prompt arrives mid-flight — must auto-cancel first, then queue @@ -1345,17 +1356,26 @@ describe("ACP agent", () => { prompt: [{ type: "text", text: "overlap" }], } as PromptRequest); - // First resolves immediately as cancelled; second is still queued + // First resolves immediately as cancelled const firstResponse = await firstPrompt; expect(firstResponse.stopReason).toBe("cancelled"); - // Let microtasks settle: abort completes, second session.prompt starts + // abort() must have been called as part of cancel cleanup + await abortStarted.promise; + + // Second prompt must NOT start until abort cleanup completes await Bun.sleep(0); - // Unblock both session.prompt calls: first (background, fire-and-forget) + second + expect(session.promptCalls).toEqual(["long running"]); + + // Release abort — second session.prompt should now start + releaseAbort(); + await Bun.sleep(0); + expect(session.promptCalls).toEqual(["long running", "overlap"]); + + // Unblock both session.prompt calls (first is fire-and-forget, second drives the response) for (const resolve of blockers) resolve(); const secondResponse = await secondPrompt; expect(secondResponse.stopReason).toBe("end_turn"); - expect(session.promptCalls).toEqual(["long running", "overlap"]); harness.abortController.abort(); await Bun.sleep(0);