Skip to content

fix(opencode): yield retry to OMO fallback when retry-after exceeds threshold#36400

Open
UCASRMTG5D wants to merge 1 commit into
anomalyco:devfrom
UCASRMTG5D:retry-omo-fallback
Open

fix(opencode): yield retry to OMO fallback when retry-after exceeds threshold#36400
UCASRMTG5D wants to merge 1 commit into
anomalyco:devfrom
UCASRMTG5D:retry-omo-fallback

Conversation

@UCASRMTG5D

Copy link
Copy Markdown

Issue for this PR

Closes #36398

Type of change

  • Bug fix

What does this PR do?

When a provider returns a retry-after header 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 a session.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 to session.error → OMO fallback.

Without OMO installed, behavior is unchanged.

How did you verify your code works?

  • lsp_diagnostics clean on retry.ts
  • Verified logic: delay() is a pure synchronous function; the threshold check runs before Effect.gen and returns Cause.done() when exceeded
  • Config file detection only runs once at module load (IIFE), zero runtime overhead
  • Without OMO config file: OMO_HAS_FALLBACK = false, threshold never enforced — same as before

Checklist

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

…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
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.

fix: yield retry to OMO fallback when retry-after exceeds threshold

1 participant