Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/acp-agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3542,6 +3542,12 @@ export class ClaudeAcpAgent {
update: {
sessionUpdate: "agent_message_chunk",
content: { type: "text", text },
_meta: {
claudeCode: {
kind: "informational",
level: message.level,
},
},
},
});
break;
Expand Down
29 changes: 28 additions & 1 deletion src/tests/acp-agent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10046,7 +10046,7 @@ describe("assembled assistant text fallback", () => {
});
}

it("does not re-emit the result text after an informational notice delivered it", async () => {
it("marks informational notices with metadata", async () => {
const { agent, updates } = createMockAgentWithCapture();
// A hook-blocked prompt: the SDK surfaces the block reason as an
// informational notice and then repeats it on the result with zero output
Expand All @@ -10066,7 +10066,34 @@ describe("assembled assistant text fallback", () => {

await agent.prompt({ sessionId: "test-session", prompt: [{ type: "text", text: "1+2" }] });

const chunks = updates.filter(({ update }) => update.sessionUpdate === "agent_message_chunk");
expect(messageChunkTexts(updates)).toEqual(["**Warning:** hook says no"]);
expect(chunks[0]?.update).toMatchObject({
_meta: { claudeCode: { kind: "informational", level: "warning" } },
});
});

it("marks info-level notices even when their text has no severity prefix", async () => {
const { agent, updates } = createMockAgentWithCapture();
injectSession(agent, [
{
type: "system",
subtype: "informational",
content: "plain hook detail",
level: "info",
session_id: "test-session",
},
result(),
idle,
]);

await agent.prompt({ sessionId: "test-session", prompt: [{ type: "text", text: "1+2" }] });

const chunks = updates.filter(({ update }) => update.sessionUpdate === "agent_message_chunk");
expect(messageChunkTexts(updates)).toEqual(["plain hook detail"]);
expect(chunks[0]?.update).toMatchObject({
_meta: { claudeCode: { kind: "informational", level: "info" } },
});
});

it("still forwards the result text after a turn failed without a result", async () => {
Expand Down