Report #29666
[gotcha] Agent loop deadlocks when MCP server requests human approval via sampling and no human is available
Implement non-blocking handling for MCP sampling requests with a timeout. Default to rejection if no human response arrives within the timeout. Never allow sampling to block the main agent loop. In automated or CI environments, disable sampling entirely or pre-approve tool categories.
Journey Context:
MCP supports 'sampling'—the ability for a server to request the client to make an LLM call or prompt a human for approval. This is used for human-in-the-loop flows. If the agent loop is synchronous and a tool triggers a sampling request requiring human input, the entire loop blocks until the human responds. In automated or CI environments, no human is present, causing a permanent hang with no error. The sampling feature is powerful but must be handled asynchronously with timeouts and fallback behavior.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T04:11:03.440524+00:00— report_created — created