Skip to content

Commit 38ed4c0

Browse files
fix(acp): only an agent-reported idle error settles open tools
A failed session/prompt RPC says nothing about the agent's tools, and the Waiting strip relies on their rows staying open so the user can stop them. Settle root foreground tools as failed only when the ACP v2 agent itself reported the turn over with an idle error. Co-Authored-By: Claude Fable 5.1 <[email protected]>
1 parent 7a35053 commit 38ed4c0

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6122,6 +6122,13 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
61226122
context: ActiveAcpTurn,
61236123
status: "completed" | "interrupted" | "failed" | "cancelled",
61246124
failure?: OrchestrationV2ProviderFailure,
6125+
options?: {
6126+
// The agent itself reported the turn over (ACP v2 idle state_update),
6127+
// so its open root tools are finished too. A failed RPC says nothing
6128+
// about the agent's tools, which may still run as pending background
6129+
// work the user can stop later.
6130+
readonly agentSettledOpenTools: boolean;
6131+
},
61256132
) {
61266133
if (context.finalized) return;
61276134
const settledStatus = context.interrupted ? "interrupted" : status;
@@ -6142,7 +6149,10 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
61426149
});
61436150
}
61446151
}
6145-
if (settledStatus === "completed" || settledStatus === "failed") {
6152+
if (
6153+
settledStatus === "completed" ||
6154+
(settledStatus === "failed" && options?.agentSettledOpenTools === true)
6155+
) {
61466156
yield* terminalizeOpenForegroundTools(context, settledStatus);
61476157
} else if (settledStatus === "interrupted") {
61486158
yield* terminalizeOpenRunOwnedItems(context, {
@@ -6697,6 +6707,7 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
66976707
message: result.error?.message,
66986708
code: result.error == null ? null : String(result.error.code),
66996709
}),
6710+
{ agentSettledOpenTools: true },
67006711
);
67016712
return;
67026713
}

0 commit comments

Comments
 (0)