Skip to content

Commit a6bb4b1

Browse files
test(provider-core): assert the exact sign-in message and that other ACP codes stay generic
AI-assisted; verified with the tests and tools listed above.
1 parent 54a43b8 commit a6bb4b1

1 file changed

Lines changed: 9 additions & 14 deletions

File tree

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

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -139,27 +139,22 @@ it("names how the provider process exited and the stage it failed in, without it
139139
);
140140
});
141141

142-
it("tells the user to sign in when an ACP agent rejects the session as unauthenticated", () => {
142+
it("tells the user to sign in only when an ACP agent answers auth_required", () => {
143143
const providerSessionId = ProviderSessionId.make("provider-session:private-id");
144-
const sessionOpenFailure = {
144+
const sessionOpenFailure = (code: number) => ({
145145
_tag: "ProviderSessionOpenError",
146-
providerSessionId,
147146
cause: new ProviderAdapter.ProviderAdapterOpenSessionError({
148147
driver: ProviderDriverKind.make("acpRegistry"),
149148
providerSessionId,
150-
cause: Cause.fail({
151-
_tag: "AcpRequestError",
152-
code: -32000,
153-
errorMessage: "Authentication required",
154-
}),
149+
cause: Cause.fail({ _tag: "AcpRequestError", code, errorMessage: "Private agent text" }),
155150
}),
156-
};
151+
});
157152

158-
const known = knownProviderFailureMessage(sessionOpenFailure);
159-
assert.isDefined(known, "an ACP auth-required failure should have a curated message");
160-
assert.match(known ?? "", /sign(ed)?[ -]?in|log(ged)?[ -]?in/iu);
161-
assert.notInclude(known ?? "", providerSessionId);
162-
assert.equal(makeProviderFailure({ cause: Cause.fail(sessionOpenFailure) }).message, known);
153+
assert.equal(
154+
makeProviderFailure({ cause: Cause.fail(sessionOpenFailure(-32000)) }).message,
155+
"The provider needs you to sign in. Sign in from its provider settings or with its own CLI or app, then retry the turn.",
156+
);
157+
assert.isUndefined(knownProviderFailureMessage(sessionOpenFailure(-32603)));
163158
});
164159

165160
it("keeps unrecognized reasons and provider text out of category messages", () => {

0 commit comments

Comments
 (0)