Skip to content

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

Description

@Fatty911

Description

SessionRetry.policy() in retry.ts retries retryable errors indefinitely with no maximum attempt count. The policy() function stops only when retryable() returns undefined (non-retryable error). Once an error is classified as retryable, the schedule retries forever.

This is the same underlying problem described in #21960, #17648, and #12234.

Steps to reproduce

  1. Use a provider that returns persistent 429/overloaded errors (e.g., GitHub Copilot weekly limit exhausted)
  2. Send any message
  3. Observe the session retrying forever with exponential backoff

Expected behavior

  • Configurable max retry attempts (e.g., experimental.max_retries)
  • After max attempts exhausted, session should stop and surface the error
  • Backward compatible: existing behavior preserved when not configured

Suggested fix location

  • packages/opencode/src/config/config.ts - add experimental.max_retries to schema
  • packages/opencode/src/session/retry.ts - add max attempt check in policy()

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions