Skip to content

ACP: forward provider retry status to the client during a turn #50743

Closed

Description

@zeroliu

Description

When a provider request fails with a retryable error (429, 5xx, "high demand", some quota errors), OpenCode 2 schedules retries and publishes session.retry.scheduled (packages/core/src/session/runner/retry.ts). The ACP bridge (packages/cli/src/acp/) doesn't forward it, so an ACP client receives nothing for the whole retry window: up to 10 attempts, with waits as long as a retry-after header asks for. From the client side a retrying turn looks exactly like a hung one. If the user cancels, the prompt resolves cancelled with no trace of the provider's error.

We see this in reports from users of our ACP client (Obsidian Copilot): a turn shows only a running timer for many minutes while OpenCode's log records dozens of retries with messages like "Your project has reached its configured enforced spend limit" or "rate-limited upstream". The user never learns the cause.

Proposal

Forward retry status on the active turn, for example as a session_info_update carrying _meta["opencode/retry"] = { attempt, maxAttempts, nextRetryAt, error: { name, message } }, or as an opencode/session/retry extension notification, so clients can show "Retrying after: (attempt n)". Clients that don't understand it ignore it.

Related: a turn stopped by the client during retries could carry the last provider error in _meta on the session/prompt response, so it doesn't end silently.

OpenCode version

2.0.14

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