Repository navigation
Conversation
V2-to-V1 normalization dropped any MCP server whose timeout was a plain number, because the compat Timeout schema only accepted the legacy {catalog, execution} struct. A numeric global mcp.timeout was worse: it was treated as a server entry and failed the whole config with ConfigInvalidError.
Accept PositiveInt alongside the struct, lower a numeric or {request} timeout to the V1 number, and treat a numeric global timeout as the global timeout.
Contributor
|
The following comment was made by an LLM, it may be inaccurate: |
|
I checked the compatibility-lowering change on this head. The intended mappings are present for the three important cases:
The invariant looks right by source/test inspection: V2 MCP timeout configuration should not silently disappear during V2 → V1 lowering. I haven't independently run the full |
This was referenced Sep 27, 2026
This was referenced Sep 28, 2026
Author
|
Superseded by #51853 on �2. dev is not where merges land (recent merges are overwhelmingly into |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #50807
Type of change
What does this PR do?
A
timeouton an MCP server entry was taking down more than the timeout.The V2-to-V1 compatibility layer only accepted the legacy
{ catalog, execution }shape, which broke two things:timeouton a server faileddecodeValue(Server, ...), so the entire server was dropped from the normalized config. That is the report: the 5s default could not be raised, and slowtools/listhandshakes kept timing out.mcp.timeoutwas worse.decodeRecord(60000)returned nothing, sotimeoutwas treated as a server named"timeout"and the resulting config failed V1 validation withConfigInvalidError.requestis the current field on the V2 schema (packages/core/src/config/mcp.ts), and it is whatmigrateMcpwrites when it converts a V1 number, so I accepted it alongside the legacy keys instead of only handling the number.Changes:
Timeoutis nowUnion([PositiveInt, Struct{ startup?, request?, catalog?, execution? }]).lowerTimeoutpasses a number through, prefersrequest, and keeps the existingcatalog/executionbehavior.mcp.timeoutis recognized as the global timeout rather than being treated as a server entry.I followed the runtime path as well:
packages/opencode/src/mcp/index.tsreads the per-servertimeoutforMcpCatalog.defs(tool discovery) and falls back toexperimental.mcp_timeout, so the lowered number does reachlistTools(..., { timeout }).How did you verify your code works?
bun test test/config/v2-compat.test.ts test/config/config.test.ts --timeout 30000frompackages/opencode— 147 pass, 0 fail; existing snapshot fixtures unchanged.bun typecheckfrompackages/opencode— clean.oxlinton the two changed files — 0 errors (3 pre-existing warnings in untouched functions).The new tests cover a numeric per-server timeout, a
{ request }per-server timeout, a numeric global timeout, and a config file loaded throughConfig.use.get().I did not test against a real remote MCP server with a slow handshake, since I do not have one. The behavior under test is the config normalization, which is where the server was being lost.
Screenshots / recordings
Not a UI change.
Checklist