fc2421cfa7
On a fresh boot with no resume_pending sessions, _finish_startup_restore opened the inbound gate almost immediately while the agent-side turn machinery (run_agent import graph, tool schemas + check_fn probes, context-file tier) was still cold. A message arriving in that window was served with a skeleton system prompt (~1.7K tokens vs ~14.6K healthy): no AGENTS.md/context tier, no tool schemas, memory provider initializing mid-turn. Fix: start a background turn-machinery warm-up when the startup gate closes (overlapping the network-bound platform connects) and have _finish_startup_restore await it — BOUNDED by agent.gateway_startup_warmup_timeout (default 20s, 0 disables) — before draining the queue and opening the gate. On timeout the gate opens anyway and the warm-up finishes in the background, so a wedged init can never make the gateway permanently unavailable. Reported by @yhfmstr in #99373. Fixes #99373