Skip to content

Commit 5dd8733

Browse files
fix(provider-core): ACP auth-required failures tell the user to sign in
When an ACP agent rejected a session or turn with the auth_required error (code -32000), the curated failure walk did not recognise it, so the thread showed the wrapper "Failed to open acpRegistry provider session <id>." with an internal id and no recovery step. The walk now maps an AcpRequestError with code -32000, which the ACP schema reserves for "Authentication required", to a fixed T3 message that names how to sign in and to retry. The agent's own text stays hidden, as for the other curated causes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent dfe923d commit 5dd8733

2 files changed

Lines changed: 14 additions & 11 deletions

File tree

‎apps/server/src/orchestration-v2/testkit/AcpRegistryReplayFixtures.integration.test.ts‎

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -182,17 +182,12 @@ describe("ACP registry replay fixtures", () => {
182182
const errors = projection.turnItems.filter((item) => item.type === "error");
183183
assert.lengthOf(errors, 1);
184184
assert.equal(errors[0]?.failure.class, "provider_error");
185-
if (testCase.code === -32602) {
186-
assert.equal(
187-
errors[0]?.failure.message,
188-
'The agent did not accept the model "replay-model-b". Choose another model for this provider, then retry.',
189-
);
190-
} else {
191-
assert.match(
192-
errors[0]?.failure.message ?? "",
193-
/^Failed to open acpRegistry provider session \S+\.$/u,
194-
);
195-
}
185+
assert.equal(
186+
errors[0]?.failure.message,
187+
testCase.code === -32602
188+
? 'The agent did not accept the model "replay-model-b". Choose another model for this provider, then retry.'
189+
: "The provider needs you to sign in. Sign in from its provider settings or with its own CLI or app, then retry the turn.",
190+
);
196191
}).pipe(
197192
Effect.provide(
198193
layerProviderReplay(scenario, AcpRegistryOrchestratorReplayHarness, {

‎packages/provider-core/src/server/failure.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@ function curatedCauseMessages(cause: unknown): {
118118
category: categoryMessage(),
119119
};
120120
}
121+
// ACP reserves -32000 for auth_required; the agent's own text is not shown.
122+
case "AcpRequestError":
123+
if ((cause as Record<string, unknown>).code !== -32000) break;
124+
return {
125+
known:
126+
"The provider needs you to sign in. Sign in from its provider settings or with its own CLI or app, then retry the turn.",
127+
category: categoryMessage(),
128+
};
121129
case "ContextHandoffDeliveryUncertainError":
122130
return {
123131
known:

0 commit comments

Comments
 (0)