Skip to content

fix(opencode): pass mcp_timeout as AI SDK streamText stepMs to prevent 120s timeout#25404

Closed
claude-code-best wants to merge 1 commit intoanomalyco:devfrom
claude-code-best:dev
Closed

fix(opencode): pass mcp_timeout as AI SDK streamText stepMs to prevent 120s timeout#25404
claude-code-best wants to merge 1 commit intoanomalyco:devfrom
claude-code-best:dev

Conversation

@claude-code-best
Copy link
Copy Markdown

The AI SDK streamText() defaults stepMs to 120s, which covers the entire step including tool execution. This caused MCP tool calls to timeout at 120s even when experimental.mcp_timeout was configured to a much larger value, because the AI SDK step timeout fired before the MCP-level timeout.

Type of change

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

What does this PR do?

MCP tool calls timeout at 120s regardless of experimental.mcp_timeout config.

The AI SDK streamText() has a stepMs param (default 120s) that covers the entire step — LLM call + tool execution. OpenCode correctly passes mcp_timeout to MCP SDK's callTool(), but never sets stepMs on streamText(). So the AI SDK's 120s default fires before the MCP-level timeout is ever reached.

Fix: pass experimental.mcp_timeout as stepMs to streamText(), so the AI SDK step timeout aligns with the MCP timeout. When mcp_timeout is not configured, behavior is unchanged (AI SDK default applies).

How did you verify your code works?

  • Typecheck: pass (0 errors)
  • Lint: pass (0 errors)
  • Tests: 2324 pass / 3 fail — failures are pre-existing installation > latest network tests, unrelated to this change

Screenshots / recordings

Checklist

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

The AI SDK streamText() defaults stepMs to 120s, which covers the entire
step including tool execution. This caused MCP tool calls to timeout at
120s even when experimental.mcp_timeout was configured to a much larger
value, because the AI SDK step timeout fired before the MCP-level timeout.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label May 2, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

Hey! Your PR title Fix MCP tool timeout: pass mcp_timeout as AI SDK streamText stepMs doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@claude-code-best claude-code-best changed the title Fix MCP tool timeout: pass mcp_timeout as AI SDK streamText stepMs fix(opencode): pass mcp_timeout as AI SDK streamText stepMs to prevent 120s timeout May 2, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

Feel free to open a new pull request that follows our guidelines.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label May 2, 2026
@github-actions github-actions Bot closed this May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants