Skip to content

Fix Fast provider retry settlement - #1482

Merged
daniel-lxs merged 1 commit into
codex/fast-mode-provider-retriesfrom
agent/fix-fast-provider-retry-settlement
Aug 19, 2026
Merged

Fix Fast provider retry settlement#1482
daniel-lxs merged 1 commit into
codex/fast-mode-provider-retriesfrom
agent/fix-fast-provider-retry-settlement

Conversation

@daniel-lxs

Copy link
Copy Markdown
Member

What changed

  • normalize OpenCode provider errors from both session.error events and resolved prompt results while preserving the original structured cause
  • classify HTML 403 gateway/WAF blocks separately from credential failures and keep named terminal OpenCode errors out of outer retry loops
  • leave OpenCode's prompt deadline as the single budget for its internal provider retries
  • retry terminal Fast failures only before any native tool invocation, then rebuild from compatibility history in a fresh OpenCode session
  • invalidate failed warm sessions so system-posted terminal closeouts are included when the next turn bootstraps
  • keep retry notices best-effort so a progress-post failure cannot hide the eventual provider error

Why

The same provider rejection could previously follow two different paths: a streamed session error preserved the status code, while a resolved prompt result wrapped it in a plain Error and lost the structured metadata. That made retry and terminal reporting depend on event ordering.

Retrying in the same persistent session also appended the same user turn after abort, and retrying after native tools had run could replay visible or external side effects. Terminal closeouts posted by Roomote were mirrored for rollback compatibility but were absent from the live OpenCode transcript, so a follow-up could not explain the error the user had just seen.

This PR is stacked on #1466 and is intended to merge into codex/fast-mode-provider-retries.

Validation

  • pnpm --filter @roomote/cloud-agents exec vitest run (99 files, 792 tests)
  • pnpm check-types
  • pnpm lint
  • pnpm knip
  • targeted ESLint for all six changed files

@roomote-community

roomote-community Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

1 issue outstanding. See task

  • Failed-session native-tool executor remains active during the clean-session retry (packages/cloud-agents/src/server/fast-agent/fast-agent-service.ts:918).

Reviewed d0ad487

// and abort does not roll it back. Discard the failed session
// and rebuild from visible compatibility history instead of
// appending the same turn to a poisoned transcript.
openCodeSession.id = undefined;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resetting the session ID here leaves the failed session's native-tool executor bound until the replacement reaches onSessionReady (or the outer finally). runNonTaskSdkPrompt explicitly treats session.abort as non-guaranteed, so that old turn can still call the bridge during this retry window and trigger a visible reply, integration call, or task operation; the replacement then replays the same turn. Unbind the failed session before scheduling the retry so stale calls are rejected.

@daniel-lxs
daniel-lxs marked this pull request as ready for review August 19, 2026 20:22
@daniel-lxs
daniel-lxs merged commit 3bd0826 into codex/fast-mode-provider-retries Aug 19, 2026
3 checks passed
@daniel-lxs
daniel-lxs deleted the agent/fix-fast-provider-retry-settlement branch August 19, 2026 20:22
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.

1 participant