Skip to content

Commit cb01fea

Browse files
fix(acp): linked terminal output no longer reopens a completed tool call
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 693192e commit cb01fea

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎packages/provider-acp/src/server/adapter.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4965,10 +4965,10 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
49654965
? ("completed" as const)
49664966
: ("failed" as const);
49674967
const embeddedToolCallIds = toolCallIdsByAgentTerminalId.get(terminalKey);
4968-
const projectedToolCallIds =
4969-
embeddedToolCallIds === undefined || embeddedToolCallIds.size === 0
4970-
? [`acp-agent-terminal:${update.terminalId}`]
4971-
: [...embeddedToolCallIds];
4968+
const linked = embeddedToolCallIds !== undefined && embeddedToolCallIds.size > 0;
4969+
const projectedToolCallIds = linked
4970+
? [...embeddedToolCallIds]
4971+
: [`acp-agent-terminal:${update.terminalId}`];
49724972
const output = next.output.slice(-MAX_AGENT_TERMINAL_OUTPUT_CHARS);
49734973
for (const toolCallId of projectedToolCallIds) {
49744974
const existing = context.tools.get(toolCallId);
@@ -4987,7 +4987,8 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
49874987
setToolOutputText(
49884988
{
49894989
...seeded,
4990-
status,
4990+
// An agent-reported tool owns its status; terminal state only drives the synthetic one.
4991+
status: (linked ? existing?.status : undefined) ?? status,
49914992
...(next.command === undefined ? {} : { command: next.command }),
49924993
},
49934994
output,

0 commit comments

Comments
 (0)