fix(mcp): dedicated timeout for initialize handshake - #102
Merged
Merged
Conversation
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.
Closes #101
Summary
The MCP
initializehandshake previously borrowed the steady-state per-request timeout (request_timeout_seconds) as its start-up budget, so callers who tightened that knob strangled slow-to-boot servers (and flaked tests). This PR gives the handshake its own budget:McpSettings.initialize_timeout_seconds(default30.0, envOCTAVE_MCP_INITIALIZE_TIMEOUT_SECONDS) inoctave/mcp/config.py._await_initialize()'sfail_afterandconnect()'s timeout error message now read the dedicated knob;_run()and the steady-state budget are untouched. Zero-impact for default settings (both default to 30 s).OCTAVE_MCP_INITIALIZE_TIMEOUT_SECONDSrow added to the MCP env-var table indocs/DEVELOPMENT.md.Commits
feat(mcp): add initialize_timeout_seconds settingfix(mcp): run initialize handshake under its own timeout budgetdocs(mcp): document OCTAVE_MCP_INITIALIZE_TIMEOUT_SECONDSdocs(specs): design and plan for dedicated initialize handshake timeoutTest evidence
4 new tests (TDD: verified failing before implementation, passing after):
test_settings_default_initialize_timeout/test_settings_env_override_initialize_timeout— config default + env overridetest_initialize_timeout_uses_dedicated_budget— silent peer; error cites0.05(dedicated budget), not1.0(request budget)test_slow_initialize_survives_tight_request_timeout— regression: peer boots in 0.2 s underrequest_timeout=0.05; connect still succeeds on the 30 s initialize budgetGates:
uv run pytest— 281 passeduv run ruff check .— All checks passeduv run mypy src— Success: no issues found in 48 source filesChecklist