Skip to content

Commit aa3c4c3

Browse files
fix(acp): keep ACP v1 null tool names as unchanged
ACP v1 defines a null tool name as "leave unchanged", while the v2 runtime model now reads null as a clear. Drop name:null from v1 tool_call and tool_call_update notifications at the protocol normalization boundary so v1 agents keep the tool name (and Agent calls keep their subagent completion projection). Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent fc62457 commit aa3c4c3

2 files changed

Lines changed: 22 additions & 4 deletions

File tree

‎packages/effect-acp/src/client.test.ts‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,7 +1608,7 @@ it.layer(NodeServices.layer)("effect-acp client", (it) => {
16081608
}),
16091609
);
16101610

1611-
it.effect("delivers ACP v1 session notices, which the pinned v1 schema predates", () =>
1611+
it.effect("normalizes ACP v1 session notices and null tool names to v2 semantics", () =>
16121612
Effect.gen(function* () {
16131613
const { stdio, input, output } = yield* makeInMemoryStdio();
16141614
const scope = yield* Scope.make();
@@ -1636,7 +1636,12 @@ it.layer(NodeServices.layer)("effect-acp client", (it) => {
16361636
description: "Continuing without it.",
16371637
} as const;
16381638
const untitled = { sessionUpdate: "notice", severity: "info" } as const;
1639-
for (const update of [notice, untitled]) {
1639+
const toolUpdate = {
1640+
sessionUpdate: "tool_call_update",
1641+
toolCallId: "c",
1642+
status: "completed",
1643+
};
1644+
for (const update of [notice, untitled, { ...toolUpdate, name: null }]) {
16401645
yield* Queue.offer(
16411646
input,
16421647
yield* encodeJsonl(SessionUpdateNotification, {
@@ -1646,12 +1651,16 @@ it.layer(NodeServices.layer)("effect-acp client", (it) => {
16461651
}),
16471652
);
16481653
}
1649-
const received = yield* acp.raw.notifications.pipe(Stream.take(2), Stream.runCollect);
1654+
const received = yield* acp.raw.notifications.pipe(Stream.take(3), Stream.runCollect);
16501655
assert.deepEqual(
16511656
Array.from(received, (event) =>
16521657
event._tag === "SessionUpdate" ? event.params.update : undefined,
16531658
),
1654-
[notice, { sessionUpdate: "_t3_unknown", originalSessionUpdate: "notice", raw: untitled }],
1659+
[
1660+
notice,
1661+
{ sessionUpdate: "_t3_unknown", originalSessionUpdate: "notice", raw: untitled },
1662+
toolUpdate,
1663+
],
16551664
);
16561665
yield* Scope.close(scope, Exit.void);
16571666
}),

‎packages/effect-acp/src/client.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,15 @@ function normalizeV1SessionUpdate(
528528
},
529529
};
530530
}
531+
const update = notification.update;
532+
// v1 defines a null tool name as unchanged; v2 consumers read null as a clear.
533+
if (
534+
(update.sessionUpdate === "tool_call" || update.sessionUpdate === "tool_call_update") &&
535+
update.name === null
536+
) {
537+
const { name: _name, ...rest } = update;
538+
return { ...notification, update: rest } as unknown as AcpSchema.SessionNotification;
539+
}
531540
if (notification.update.sessionUpdate !== "available_commands_update") {
532541
return notification as unknown as AcpSchema.SessionNotification;
533542
}

0 commit comments

Comments
 (0)