Skip to content

fix(opencode): cap session retry attempts#30245

Open
Fatty911 wants to merge 2 commits into
anomalyco:devfrom
Fatty911:codex/session-retry-max-retries
Open

fix(opencode): cap session retry attempts#30245
Fatty911 wants to merge 2 commits into
anomalyco:devfrom
Fatty911:codex/session-retry-max-retries

Conversation

@Fatty911

@Fatty911 Fatty911 commented Jun 1, 2026

Copy link
Copy Markdown

Issue for this PR

Fixes #25733

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds experimental.max_retries to cap retry attempts for transient provider errors.

When the option is unset, retry behavior is unchanged. When set, SessionRetry.policy() stops scheduling retries after the configured number of retry attempts and lets the session surface the error.

How did you verify your code works?

  • git diff --check
  • bun --cwd packages/opencode prettier --check src/config/config.ts src/session/retry.ts src/session/processor.ts test/session/retry.test.ts
  • bun run --cwd packages/opencode typecheck
  • bun test --cwd packages/opencode test/session/retry.test.ts --timeout 30000

Screenshots / recordings

N/A. This is retry/config behavior only.

Checklist

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

@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found one potentially related PR:

#26369 - fix(session): cap retry schedule at RETRY_MAX_ATTEMPTS = 3

This PR addresses similar retry capping logic for sessions. However, PR #30245 (the current PR) appears to be a more recent and generalized approach using experimental.max_retries configuration, whereas #26369 used a hardcoded constant.

The other result (#28691) is about LLM provider retry attempts and appears unrelated to session retry configuration.

@Fatty911

Fatty911 commented Jun 1, 2026

Copy link
Copy Markdown
Author

For reviewer context: #26369 is related, but this PR takes the configurable route instead of adding a hardcoded retry cap.

That keeps current behavior unchanged unless experimental.max_retries is set, and it also matches the feedback on #26369 asking for retries to remain configurable. If maintainers prefer a default cap, this can be adjusted, but this PR is intentionally opt-in to keep the behavior change small.

…max-retries

# Conflicts:
#	packages/opencode/src/config/config.ts
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.

Session retry loops forever — no max attempt cap or configurable limit

1 participant