34 Transport loss in scenarios
scenario-disconnect! closes the current session’s stdio pipes or HTTP listener and active connections. Outstanding requests and subscriptions observe the SDK client’s transport-failure outcome, distinct from a locally requested cancellation. Calls issued while disconnected fail immediately. scenario-session-connected? reports whether the session can issue requests.
scenario-reconnect! starts a fresh transport against the same runtime, store, clock, principal and adapters. It does not replay requests, reopen subscriptions, or change an already completed handle. Request IDs may restart on the fresh connection. Applications explicitly re-listen and refresh as needed. Repeated disconnect/reconnect calls in the corresponding state are harmless; either control rejects a session that has exited. Local sessions reject disconnect because they have no wire connection.
Runtime-owned task workers survive this fault and can be polled after reconnect. This control stops the session’s server transport, not the application runtime or process; it does not simulate SQLite reopen, process termination, packet loss or loss of one selected HTTP request while keeping others connected. Session exit still shuts down the runtime and its owned store normally. The executable examples/disconnect-scenario.rkt runs with raco mcp scenario examples/disconnect-scenario.rkt.
A stdio output failure is now reported once by the serving call. It interrupts a reader blocked on input, gives request workers bounded cleanup, and preserves the original raised value. Background workers do not retry writes to the failed output or emit uncaught secondary diagnostics. Scenario-injected pipe loss captures that expected serving failure; clients still observe actual EOF.