Skip to content

fix(acp): classify provider HTTP authentication errors - #48463

Closed
MrCapricornLiu wants to merge 1 commit into
anomalyco:devfrom
MrCapricornLiu:acp-auth-status
Closed

MrCapricornLiu wants to merge 1 commit into
anomalyco:devfrom
MrCapricornLiu:acp-auth-status

Conversation

@MrCapricornLiu

Copy link
Copy Markdown

Issue for this PR

Closes #48297

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

An invalid provider credential can arrive as an assistant APIError with 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 under test/acp pass, including checks for absent status, 429 and 500. Package type checking and formatting pass; lint exits successfully with existing warnings.

Commands: bun test test/acp and bun typecheck from packages/opencode.

Screenshots / recordings

Not applicable; protocol error handling only.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@thdxr

thdxr commented Oct 10, 2026

Copy link
Copy Markdown
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 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ACP: map structured provider HTTP 401/403 errors to AuthRequiredError

2 participants