What
The SDK is the kit for driving Claude Code from your own program. Its Query class opens with an initialize message, and it now holds everything else until that message has been written:
request()waits forinitialize, and fails at once with "Query closed before response received" once the query has been cleaned upcontrol_cancel_requestis sent only if the original request actually went outstreamInputwaits forinitialize- messages from SDK MCP servers (tool providers run inside your program) go through
writeAfterInitialize - late replies to a manifest capture are dropped
- removing a server rejects its pending requests
Why
Programs built on the SDK no longer send messages out of order at startup. They also no longer wait forever for replies after a query has closed or a server has been removed.