Repository navigation
fix(mcp-gateway): give a server reaped at the initialize deadline a longer one next time (0.13) - #39598
Conversation
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check: this backend-only change to MCP gateway deadlines adds or changes no user-visible control. [UX-REVIEWED] e8feab5 Description read[DESCRIPTION-READ] 6fb71ea16d2771c6507dc523859c857a2cc12d7676a32d7e694e85530efb86b9 That sha256 names everything this verdict read: the PR description, plus the 3 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: this is a clean backport of #39546 and its follow-up #39878. The deadline only gets longer for a pool key after a deadline reap, and the reap memory is capped. Notes
[DESIGN-REVIEWED] e8feab5 Description read[DESCRIPTION-READ] 376ed2fe42fbdaee2d12a36700af08be77dcd44e77e2b892c16a0bc51c50e827 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks: this backports two fixes from main that remove a reported failure (#30915) at the point where it happens, by stretching the respawn deadline after a deadline reap. Not checked: the patch file lists 94 files; git shows only 3 differ between this merge and its base. The other 91 are already on the base. What this change shipsInventory (5 items) — 5 justifiedIntent: let a slow-starting MCP server start on a later try in 0.13, instead of every chat failing at the 30 s initialize deadline. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] e8feab5 Description read[DESCRIPTION-READ] 3952bb1b4f158066c305b0b3b254ccdf1913bdc6643da29d2a431815615d615b That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Review detailsNo findings. Notes:
[OPUS-REVIEWED] e8feab5 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ human override acceptedHuman judgment by @buluoray overrides the GPT 6.1 finding for [GPT-OVERRIDE] e8feab5 This comment is updated in place on each push. The model was not re-run because an authorized human decision supersedes it. False positive or not applicable? A repository writer can comment: |
|
/ai-review override gpt e8feab5 not-applicable: finding is in dashboard/chat_api/slot_detail.py, which this backport does not touch; the same code is already on main. The diff only changes mcp_gateway/admission.py, gatewayd.py and one test. |
Human judgment recorded@buluoray recorded a not-applicable release (class
This decision applies only to this commit. A new push requires a new judgment. |
Problem / Motivation
Goal: Ship the fix from #39546 in 0.13, so a Crew MCP server whose cold start runs a little past the 30 s initialize deadline starts on a later attempt, instead of failing every chat.
Every commit in this PR is a cherry-pick from
main(git cherry-pick -x).8548bc5df60ekirocrew-core: failed (backend init failed: initialize did not complete within 30s), and updating does not help (#30915)e77a3e51f025Prerequisites: none. Both picks applied cleanly to
release/0.13.0.Why it matters
When it happens, no chat works on that machine. The gateway kills the slow backend at 30 s and starts the next attempt cold with the same 30 s, so every attempt fails the same way.
Not a goal
What changed (motivation → approach → change)
The pick makes the next spawn of a pool key wait longer after a deadline reap: 60 s after one reap, 120 s (cap) after two or more; a completed handshake resets it. The first spawn keeps today's deadline. Full rationale on #39546.
Backwards compatibility
Compatible: the first spawn of every key keeps today's deadline; only a respawn after a deadline reap waits longer.
Removes nothing: the pick only lengthens a deadline for a key whose last spawns were reaped.
Tests
The picks carry
test/test_mcp_gateway_spawn_gate.py::TestAcquireBackendOrder::test_a_key_reaped_at_the_initialize_deadline_gets_a_longer_one_nextand::test_reaped_keys_that_never_come_back_ready_are_capped. After the second pick,test_mcp_gateway_spawn_gate.pypasses on this branch (96 passed) and flake8 is clean.Run on this branch (release PRs get no backend CI lanes):
test_mcp_gateway_spawn_gate.py95 passed,test_mcp_gateway_spawn_order.py17,test_adaptive_controller.py71,test_mcp_gateway_daemon_composition_contract.py60,test_kas_managed_mcp_start_reattempt.py26,test_mcp_gateway_breaker.py4,test_mcp_gateway_backend_coverage.py88,test_flake_pattern_ratchet.py71; flake8 and mypy clean.Proof: not provable -- other: backport of a pick from main; the proof and the before/after run are on #39546.
Manual verification
N/A — verified on #39546 with a real slow server through the real spawn path.
Real-machine verification
N/A -- backport of #39546; its real-machine before/after run is on that PR.
Related Issues
Part of #30915
Sibling sweep
Siblings: none -- a backport; the sweep is on #39546.
Pattern harvest
Not generalizable: a backport of #39546, whose harvest line covers it.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...); PR Hygiene does not count commits