diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index ed078f4e1..79c1c5cfd 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -4,7 +4,6 @@ ### Fixed -- Fixed extension `sendUserMessage` throwing `Agent is already processing…` while the agent is streaming: without `deliverAs`, busy messages now queue as a steer. ACP/RPC skill invocations pass `streamingBehavior: "steer"` so they can land mid-turn the same way TUI skill commands do. - Fixed autolearn auto-continue firing a capture turn after an aborted stop (Esc/cancel): the controller now skips any `agent_end` whose last assistant message has `stopReason: "aborted"`. ## [16.3.12] - 2026-07-08 diff --git a/packages/coding-agent/test/autolearn-controller.test.ts b/packages/coding-agent/test/autolearn-controller.test.ts index e5f04d760..51b180892 100644 --- a/packages/coding-agent/test/autolearn-controller.test.ts +++ b/packages/coding-agent/test/autolearn-controller.test.ts @@ -1,5 +1,6 @@ import { describe, expect, it } from "bun:test"; import type { AgentMessage } from "@oh-my-pi/pi-agent-core"; +import type { AssistantMessage } from "@oh-my-pi/pi-ai"; import { AutoLearnController, buildAutoLearnInstructions } from "@oh-my-pi/pi-coding-agent/autolearn/controller"; import { Settings } from "@oh-my-pi/pi-coding-agent/config/settings"; import type { AgentSession, AgentSessionEvent } from "@oh-my-pi/pi-coding-agent/session/agent-session"; @@ -254,13 +255,24 @@ describe("AutoLearnController", () => { const session = new FakeSession(); install(session, { "autolearn.autoContinue": true }); session.toolCalls(5); - session.agentEnd([ - { - role: "assistant", - content: [{ type: "text", text: "partial" }], - stopReason: "aborted", - } as never, - ]); + const abortedMessage: AssistantMessage = { + role: "assistant", + content: [{ type: "text", text: "partial" }], + api: "anthropic-messages", + provider: "anthropic", + model: "mock", + usage: { + input: 0, + output: 0, + cacheRead: 0, + cacheWrite: 0, + totalTokens: 0, + cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }, + }, + stopReason: "aborted", + timestamp: Date.now(), + }; + session.agentEnd([abortedMessage]); expect(session.sent).toHaveLength(0); }); });