Repository navigation
fix(acp): classify provider HTTP authentication errors - #48463
Closed
MrCapricornLiu wants to merge 1 commit into
Closed
MrCapricornLiu wants to merge 1 commit into
MrCapricornLiu wants to merge 1 commit into
Conversation
Signed-off-by: Chenghao Liu <[email protected]>
Member
|
This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2. — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #48297
Type of change
What does this PR do?
An invalid provider credential can arrive as an assistant
APIErrorwith HTTP status 401 or 403. ACP currently reports these as internal errors, so clients cannot recognize that authentication is required.Map these two statuses to the existing auth-required response (
-32000) and include the assistant's provider ID. API errors without a status, rate limits, and server errors retain their existing internal-error response.How did you verify your code works?
The two new authentication cases fail on the original code with
-32603. With the fix, all 132 tests undertest/acppass, including checks for absent status, 429 and 500. Package type checking and formatting pass; lint exits successfully with existing warnings.Commands:
bun test test/acpandbun typecheckfrompackages/opencode.Screenshots / recordings
Not applicable; protocol error handling only.
Checklist