Repository navigation
fix(acp): pass provider status and response headers of API errors to clients - #52861
Closed
benediktkraus wants to merge 1 commit into
Closed
benediktkraus wants to merge 1 commit into
benediktkraus wants to merge 1 commit into
Conversation
…clients
A failed prompt reached ACP clients as a generic -32603 with only
{service, errorName}. For an APIError, opencode already knows the HTTP
status, whether the provider marks it retryable, and the response headers
(retry-after, x-ratelimit-reset, ...). Without them a client cannot tell a
rate limit from any other provider failure, nor when it may try again.
ServiceFailureError now carries statusCode, isRetryable and
responseHeaders, filled from APIError.data only; other errors are mapped
as before.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MskzQg6anPuQU4pctoFQgW
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
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 #52860
Type of change
What does this PR do?
A prompt that fails with an
APIErrorreaches ACP clients as-32603with only{service, errorName}. TheAPIErroralready has the HTTP status, the retryable flag and the provider's response headers, butpromptResponsedrops them, so a client cannot recognise a rate limit or readretry-after/x-ratelimit-reset.ServiceFailureErrorgets three optional fields (statusCode,isRetryable,responseHeaders),toRequestErrorputs them into the error data when set, andpromptResponsefills them fromAPIError.dataonly. Every other error is mapped as before. The headers are the ones opencode already stores on the message error.How did you verify your code works?
bun test test/acp/inpackages/opencode: 140 pass. One new test for anAPIErrorwith status 429 and headers; the existing APIError test now also expectsisRetryable.bun run typecheckinpackages/opencodeis clean.script/build.tsand ranopencode acpthrough acpx against an OpenRouter free model with the daily limit used up: the error data now has"statusCode":429,"isRetryable":trueand the response headers includingx-ratelimit-reset.Screenshots / recordings
Not a UI change.
Checklist