Repository navigation
fix(server): answer MCP initialize before startup warm-up - #49
Merged
Merged
Conversation
app_lifespan awaited _warm_projects before yielding, so the server answered no request, initialize included, until every warm path had opened its store. With five warm paths and an uncompacted concord table, initialize took 9.99 s and Vision abandoned each spawn at its 10 s connect deadline. Warm-up now runs as a background task that the lifespan cancels and awaits at shutdown, alongside the startup sweep. run_server also configures logging before capping malloc arenas: the cap's startup event otherwise went through structlog's default printer to stdout, the stdio MCP channel.
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.
Problem
Since 06:32 EDT every Vision respawn of lgrep fails:
end-to-end initialize: context deadline exceeded, thenshared_session.spawn_failed error="context canceled"10 s after spawn.app_lifespanawaited_warm_projectsbefore yielding, so initialize waited for every warm path's store open. With Vision's five warm paths a direct stdio probe answered initialize after 9.99 s; the concord store open alone took 6.6 s (uncompacted versions, LGREP-36).A second startup defect, from #48:
cap_malloc_arenas()logged beforeconfigure_logging(), so its event went through structlog's default printer to stdout, the stdio MCP channel.Change
app_lifespanruns warm-up as a background task, cancelled and awaited at shutdown with the startup sweep.run_serverconfigures logging before capping arenas.Evidence
tests/test_server.py::TestLifecycle::test_lifespan_yields_before_warm_and_cancels_it_at_shutdownandtests/test_bootstrap.py::...::test_run_server_writes_nothing_to_stdout_before_servingeach fail without their fix.