Skip to content

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

Closed as duplicate

Description

@UCASRMTG5D

When a provider returns a retry-after header longer than 1 minute (e.g. retry-after: 3600), OpenCode waits that entire duration before retrying — and there is no cap. If the error keeps coming back, OpenCode retries indefinitely without ever notifying OMO.

This means OMO never receives a session.error event and can never activate its fallback chain. The session stays stuck in a retry loop for hours.

Fix: Add an optional RETRY_MAX_SINGLE_DELAY_MS threshold (60s). When OMO (oh-my-openagent) is detected on the system (via its config file at ~/.config/opencode/oh-my-openagent.json) and the computed wait exceeds this threshold, the retry policy stops retrying and lets the error propagate to session.error → OMO fallback.

Verification:

  • Without OMO installed → behavior unchanged (no threshold enforced)
  • With OMO + retry-after < 60s → behavior unchanged
  • With OMO + retry-after > 60s → retry yields, OMO receives session.error and activates fallback chain

Activity

  1. github-actions commented on Jul 11, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • The issue does not use one of the three required templates (Bug Report, Feature Request, or Question). It is written as a fix proposal rather than following the template structure. If this is a bug report, please use the Bug Report template with a proper Description field and reproduction context. If it is a feature request, the title should start with [FEATURE]: and include the required verification checkbox.
    • The issue title uses a commit-style prefix (fix:) which is not appropriate for issue titles.

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


    This issue might be a duplicate of existing issues. Please check:

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. UCASRMTG5D commented on Jul 11, 2026

    @UCASRMTG5D
    Author

    It is true that these existing issues reflect the same problem I've encountered.

  3. UCASRMTG5D commented on Jul 11, 2026

    @UCASRMTG5D
    Author

    When using omo with opencode, things like free usage exceeded and too many requests can put a limit on their waiting time. Because if opencode raised an error, OMO can catch it and fallback, which means OMO can hand the prompt to a next model that functions normally. But if opnecode keep holding the session and retry, it will cost a huge amount of time.

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

Metadata

Metadata

Assignees

Labels

needs:complianceThis means the issue will auto-close after 2 hours.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions