Skip to content

fix(core): cap WebSocket idle timeout retries - #58076

Open
vkpdeveloper wants to merge 2 commits into
anomalyco:devfrom
vkpdeveloper:fix/cap-websocket-idle-retries
Open

vkpdeveloper wants to merge 2 commits into
anomalyco:devfrom
vkpdeveloper:fix/cap-websocket-idle-retries

Conversation

@vkpdeveloper

@vkpdeveloper vkpdeveloper commented Oct 22, 2026 •

Copy link
Copy Markdown

Issue for this PR

Fixes #57127

Type of change

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

What does this PR do?

WebSocket idle timeouts come back with code idle-timeout, but the timeout counter in model-retry.ts only counts Timeout. So they skip the 3-timeout cap and use the general 10-retry schedule, and a dead stream can hold a step for hours. This counts idle-timeout in the same timeout budget. Non-timeout failures (like WebSocket disconnects) keep the 10-retry allowance.

How did you verify your code works?

Added tests in session-runner-retry.test.ts for repeated WebSocket idle timeouts, mixed HTTP/WebSocket timeouts, and disconnects still getting 10 retries. The two timeout tests fail without the fix (a 4th retry is allowed) and pass with the fix. bun run check passes. The full core suite has 2 failures that also fail without this change.

Screenshots / recordings

Not a UI change.

Checklist

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

Code by gpt-6-astra (xhigh) in Codex CLI. PR description written with Claude Code (Opus 5.5).

🤖 Generated with Claude Code


Added by the opencode bot (AI-generated).

Related: #49030

@opencode-agent opencode-agent Bot left a comment

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.

Looks good. I ran the reproduction script for #57127. On the base branch, a WebSocket idle-timeout got 10 retries while an HTTP Timeout stopped after 3. With this change both stop after 3. The new tests fail on the base and pass here, and typecheck for packages/core passes. The idle-timeout code matches what model-transport.ts raises when the 30-minute idle wait runs out. The other WebSocket timeout, connect-timeout, gives up after 15s, so keeping it under the general allowance makes sense.

Public API: unchanged.

One thing to coordinate: open PR #54544 changes the same timeout check for gateway 504s, and its tests expect WebSocket idle timeouts to keep the full 10-retry allowance. Whichever merges second will need to update that.

Related: #49030

@opencode-agent opencode-agent Bot left a comment

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.

The only new commit merges dev. The pull request's own change is the same as in the last review. I re-ran the reproduction script for #57127 and session-runner-retry.test.ts at the new head: a WebSocket idle-timeout now stops after 3 retries, the same as an HTTP Timeout, and all tests pass. typecheck for packages/core also passes. Nothing new to raise.

Public API: unchanged.

This branch has not been deployed

No deployments
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.

v2: WebSocket idle-timeout bypasses the 3-timeout retry cap, so a dead stream can hold a step for hours

1 participant