Skip to content

fix(session): UnknownError should be retried by default #20822

@KingingWang

Description

@KingingWang

Description

Session errors wrapped as UnknownError are never retried, causing the entire conversation to terminate on transient failures.

The retry logic in SessionRetry.retryable() uses a whitelist approach — only explicitly recognized errors (APIError with isRetryable: true, rate limit keywords, etc.) are retried. Everything else, including new provider error formats, unexpected network issues, and unclassified transient errors, falls through to UnknownError and terminates the session.

Current behavior: retryable() returns undefined for UnknownError → no retry → session dies.

Expected behavior: Unknown errors should be retried with a small cap (e.g. 2 attempts). The cost of retrying a permanent error is seconds; the cost of not retrying a transient error is losing the entire conversation context.

Key files:

  • packages/opencode/src/session/retry.tsretryable() function defaults to no-retry
  • packages/opencode/src/session/processor.tshalt() publishes error and sets status to idle without retry

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions