fix(opencode): yield retry to OMO fallback when retry-after exceeds threshold#36400
Open
UCASRMTG5D wants to merge 1 commit into
Open
fix(opencode): yield retry to OMO fallback when retry-after exceeds threshold#36400UCASRMTG5D wants to merge 1 commit into
UCASRMTG5D wants to merge 1 commit into
Conversation
…hreshold When a provider returns a retry-after header longer than 1 minute, OpenCode now detects whether OMO (oh-my-openagent) is installed with fallback enabled. If OMO is active and the computed wait exceeds RETRY_MAX_SINGLE_DELAY_MS (60s), the retry policy stops retrying and lets the error propagate to session.error, allowing OMO to activate its fallback chain. Without OMO installed, behavior is unchanged. Closes anomalyco#36398
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 #36398
Type of change
What does this PR do?
When a provider returns a
retry-afterheader longer than 1 minute, OpenCode would wait the entire duration before retrying — with no upper bound. If the error persists, OpenCode retries indefinitely and OMO never receives asession.error, so its fallback chain never activates.This PR adds auto-detection of OMO (oh-my-openagent) via its config file at
~/.config/opencode/oh-my-openagent.json. When OMO is present with fallback enabled and the computed single-retry delay exceeds 60s, the retry policy stops retrying and lets the error propagate tosession.error→ OMO fallback.Without OMO installed, behavior is unchanged.
How did you verify your code works?
lsp_diagnosticsclean onretry.tsdelay()is a pure synchronous function; the threshold check runs beforeEffect.genand returnsCause.done()when exceededOMO_HAS_FALLBACK = false, threshold never enforced — same as beforeChecklist