Repository navigation
Conversation
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
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 #52464
Type of change
What does this PR do?
Two hardening changes in the session retry layer (
packages/opencode/src/session/retry.ts):RETRYABLE_MESSAGE_PATTERNSmatches429|500|502|503|504|524as raw substrings, so any error message containing those digits inside a larger number (e.g. "context length (500000 tokens)", "4290 requests", "id 503123") is misclassified as retryable. This anchors the pattern with\bso only standalone status codes match.context_length_exceeded, Anthropic "prompt is too long", Gemini), checked before the retryable heuristics. Context overflow is already handled upstream viaisContextOverflow→ContextOverflowError; this guard covers the fall-through case where an overflow error arrives as a plainAPIError.Known narrowing: plural forms like "returning 500s" no longer match the message pattern; real 5xx remain covered by
statusCode >= 500/isRetryable.How did you verify your code works?
packages/opencode/test/session/retry.test.ts(real overflow message shapes → not retried; standalone status codes → still retried).bun test test/session/retry.test.ts: 64 pass / 0 fail (60 existing + 4 new).isContextOverflow's pattern list.Screenshots / recordings
Not a UI change.
Checklist