Send the first request behind `Configure` without waiting for its reply
The pool no longer configures a session in a turn of its own: Checkout::create keeps the Configure and the first request writes it out ahead of itself, reading the Configure reply (bounded by request_timeout) before its own. The child answers in order, so a session opens and runs its first Feed or Load in one round trip. A refused Configure is that request's error and ends the session; an oversize first request still opens it; a checkout finished without a request never configures its worker. Redial and turn_raw take the same path, and the wasm transport pipelines the same way.
session_id is None until the first turn; a Load reply replaces it and a refused Load keeps it. The telemetry recorders track the unanswered Configure apart from the turn pipelined behind it.
Claude-Session: https://claude.ai/code/session_018zfZ5xdFiagSnfMeWL7Nb6
Summary by cubic
The session's Configure now carries its first Feed or Load (Configure.first), so a session opens and runs its first request in one round trip: the pool sends the Configure and the request as one frame, and a refused Configure is the reply, a SessionRefused event, so that request never runs and ends the session.
Protocol and pool
- The pool encodes the borrowed
Configureand first request together (OpeningRequest) without cloning either, and the child arms the session's memory ceiling before running the request — except the subprocess shell, which sets its allocator baseline on the pristine worker before any request, so a first request decoded before its ceiling is armed still counts towardmax_memory. Each session is charged its own storedConfigure, shifting the exact usage figures in the subprocess tests. - Redial, raw turns, and the wasm transport take the same path; a checkout finished without a request never configures its worker, and a write that breaks the pipe keeps reading so a refused
Configurereports the child's own reason. - The protocol version bumps to 8, since a version 7 child would drop a request carried inside
Configure; version 7 parents still sendConfigurealone, which this child serves, soMIN_SUPPORTED_PROTOCOL_VERSIONstays at 7.
Session ID and errors
session_idis unset until the first request is answered, so it is read through the new awaitableget_session_id()/getSessionId(), which sends a loneConfigurewhen no request has gone out yet; thesession_idproperty is deprecated. ALoadreply replaces the ID, and a refusedLoadkeeps it along with the clock and limits of theConfigurereply reported. A refusedConfigureraisesMontyConfigurationErrorfrom Python and JS, including the wasm worker.- Telemetry tracks the unanswered
Configureapart from the request behind it. Only the first turn-ending reply acknowledges aConfigurecarrying a request — a later abort reply no longer re-adopts the server's clock, which would switch a remote CPU session to wall-clock supervision.FatalErrorandShutdownreplies report no clock and are classified as themselves, and a refusedConfigurerecords no run. A remote session's first request relies on a finiterequest_timeoutin place of the wall-time backstop, since the server's clock arrives with its reply.