You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
parity(#282): csp mcp should exit promptly on stdin EOF while an index build is in flight #116
Upstream semble #282 (f1daa42) makes the MCP server exit immediately on stdin EOF or SIGTERM. Previously, interpreter shutdown joined worker threads that were still loading the model or building an index.
csp status
SIGTERM: csp is already fine. It installs no handler, so the OS default terminates the process.
Truncated manifest.json: csp is already fine. read_manifest returns None and the index is rebuilt.
stdin EOF while a request is in flight (gap):
run_mcp (crates/csp/src/bin/csp/mcp_server.rs:170-183) runs rt.block_on(serve(stdio()).await?.waiting()) on a multi-thread runtime.
The search / find_related handlers call the synchronous search_tool / find_related_tool inline. Index build, model download, and embedding all run on a runtime worker thread, with no spawn_blocking.
After EOF, waiting() returns, but dropping the Runtime waits for that worker. If an agent exits during a first-time index of a large repo, csp mcp stays alive until the build finishes.
rmcp also waits up to 5 s to drain in-flight handlers.
This analysis comes from reading tokio and rmcp 1.7 semantics; it has not been reproduced live yet.
Proposal
After block_on returns, exit without joining blocked workers: rt.shutdown_background(), or std::process::exit(0).
Optional hardening: move the synchronous search/build work into spawn_blocking.
Acceptance
An integration test starts csp mcp, triggers a slow build, closes stdin, and asserts that the process exits within about 1 s.
Activity
fix(mcp): exit promptly on stdin EOF while a tool call is in flight (#…
fix(mcp): exit promptly on stdin EOF while a tool call is in flight (#…