49b9bb6724
Deploy Docs / deploy-docs (push) Failing after 1s
Conformance Tests / client-conformance (push) Failing after 3s
Conformance Tests / server-conformance (push) Failing after 1s
GitHub Actions Security Analysis / zizmor (push) Failing after 1s
CI / checks (push) Failing after 59m20s
CI / all-green (push) Waiting to run
reconnect
Probe server/discover once, persist the DiscoverResult, and reconnect with
zero round-trips. The first client connects at mode="auto" (one
server/discover request inside __aenter__); a second client at
mode=LATEST_MODERN_VERSION, prior_discover=<cached> enters with no wire
traffic and has server_info / server_capabilities available immediately.
Run it
# over HTTP — Streamable HTTP only; in-memory has no "round-trip" to skip.
# The client self-hosts the server on a free port, runs, then tears it down.
uv run python -m stories.reconnect.client --http
# same, against the lowlevel-API server variant
uv run python -m stories.reconnect.client --http --server server_lowlevel
What to look at
client.py— the firstClient(targets(), mode="auto"). Themode="auto"connect ladder runsserver/discoverinside__aenter__;client.session.discover_resultis the cached result. Round-trip it throughmodel_dump_json()/DiscoverResult.model_validate_json()to model an on-disk cache.client.py—Client(targets(), mode=LATEST_MODERN_VERSION, prior_discover=rehydrated). A version pin plus a priorDiscoverResultinstalls the cached state viaClientSession.adopt()with noinitializeand noserver/discoveron the wire — the era-neutralclient.server_info/.server_capabilitiesaccessors are populated before the first request.client.py—targets(). AClientcannot be re-entered after exit; each call yields a fresh target against the same server, so the reconnect is a genuinely new connection.
Caveats
mode=<version-pin>withoutprior_discover=synthesizes a placeholder whoseserver_infoisImplementation(name="", version=""). Pass the cached result to get real identity on reconnect. WhetherClientshould expose a public synthesizer (or refuse the bare pin) is open.client.session.discover_resultis a one-hop reach into the mechanics layer;Clientdoes not yet surface the cached result directly.- The wire-level proof that the second entry sends zero requests lives in the
interaction suite (
test_prior_discover_populates_state_with_zero_connect_time_traffic); this story asserts only what's observable through the publicClientsurface.
Spec
See also
dual_era/ (auto-discover + era-neutral accessors), parallel_calls/ (the
other multi-connection client).