Skip to content

test(core): cover legacy MCP timeout migration into the startup budget - #54174

Closed
Bearmancer wants to merge 3 commits into
anomalyco:devfrom
Bearmancer:mcp-startup-timeout
Closed

Bearmancer wants to merge 3 commits into
anomalyco:devfrom
Bearmancer:mcp-startup-timeout

Conversation

@Bearmancer

@Bearmancer Bearmancer commented Oct 9, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #54184

Type of change

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

What does this PR do?

This is the regression test for the V1 to V2 MCP timeout migration reported in #54184, which nothing asserted before.

The production change is already on dev: migrateMcpTimeout(timeout) in packages/core/src/v1/config/migrate.ts returns { startup: timeout, catalog: timeout, execution: timeout }. The gap was that no test pinned that mapping, so a legacy scalar timeout could stop reaching the connection/startup budget without any test noticing.

This PR adds that assertion to packages/core/test/config/normalization.test.ts and changes nothing else. The migration helper itself is not touched.

How did you verify your code works?

I ran the focused suite from packages/core on this branch (bun run script/test.ts test/config/normalization.test.ts): 38 pass, 0 fail, 340 expect() calls. I then temporarily reverted migrateMcpTimeout to drop startup and reran the same file: the new test failed as expected (36 pass, 2 fail), which shows it pins the mapping; I restored the file right after and the tree is clean again.

bun typecheck from packages/core exits 0. I started the full bun run test suite but stopped it under the time-box, so it is not cited here. I did not run the suite on the base SHA; by inspection the base already carries the same mapping and base-to-head differs only by this test.

Screenshots / recordings

If this is a UI change, please include a screenshot or recording.

Checklist

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

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

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

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@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 fix looks correct. v1 used a server's timeout for the connection handshake as well as for listing and tool calls (withTimeout(client.connect(...), mcp.timeout ?? 30_000)). Mapping it to startup restores that, while experimental.mcp_timeout rightly stays on catalog and execution only. I confirmed the new test fails on the base and passes here. normalization.test.ts and config.test.ts pass, and the packages/core typecheck is clean. I couldn't do an end-to-end run with a slow MCP server because opencode mcp list from source failed while starting the background service, on both the base and this branch.

Public API: unchanged. The config schema stays the same; only the v1→v2 migration output gains timeout.startup.

Points worth fixing:

  • The evidence in the description doesn't support the change. DEFAULT_STARTUP_TIMEOUT is already 30000, so a legacy timeout: 30000 gets the same 30s connection budget with or without this change, and the 61.9s failure has another cause. The "only lengthens the connect budget" claim is also wrong: any legacy value below 30000 now shortens connection from 30s to that value (e.g. 5000 gives 5s). That matches v1, so it's the right behaviour, but please correct the description.
  • prettier --check fails on both changed files (the long timeout: lines in migrate.ts and the new test). Please run the formatter.
  • For a two-line fix the new test isn't needed and can be dropped to keep the change minimal. If you keep it, a generic server name and no semantic-scholar command would be enough.

Related: #48743

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@Bearmancer

Bearmancer commented Oct 9, 2026 •

Copy link
Copy Markdown
Author

Thanks for the review. Three things you flagged, addressed:

  1. Evidence was a no-op. Correct that DEFAULT_STARTUP_TIMEOUT is already 30000, so a timeout: 30000 example proves nothing and I replaced it with 5000, where the divergence is observable (5s tool-call budget vs 30s connect budget). I also dropped the 61.9s span from the earlier description, it can't be explained by a 30s connect budget and I have no clean explanation for it.

  2. Blast radius was wrong. Corrected: a legacy value below 30000 now shortens connection from 30s down to that value. That matches V1, which is the intent, but the original claim only said "lengthens".

  3. Prettier. Ran [email protected] --write on both changed files; --check is clean now. The first commit missed this.

I kept the regression test, since the bug existed precisely because nothing asserted this mapping, and made the server name generic per your note.

The compliance bot has since confirmed the PR meets the guidelines.

The V1->V2 MCP migration maps a per-server scalar timeout to catalog and execution but never startup. Since startup is the only field the connection handshake reads, a migrated scalar is equivalent to leaving it unset, and the handshake falls back to DEFAULT_STARTUP_TIMEOUT.

Map the scalar to startup as well so the configured value reaches the budget that governs connection.
Also run prettier over both changed files, which the original commit missed.
@Bearmancer Bearmancer changed the title fix(core): migrate legacy MCP timeout into the startup budget test(core): cover legacy MCP timeout migration into the startup budget Oct 16, 2026
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue and removed needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Oct 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@Bearmancer

Copy link
Copy Markdown
Author

Closing as V1-obsolete: this test pins the V1-to-V2 MCP timeout migration (packages/core/src/v1/config/migrate.ts), which no longer matters.

@Bearmancer Bearmancer closed this Oct 19, 2026
@Bearmancer
Bearmancer deleted the mcp-startup-timeout branch November 2, 2026 04:45
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.

fix(core): V1 to V2 MCP migration drops timeout.startup, so scalar timeouts never reach the connect budget

1 participant