a4b620f17c
build_cache_parity_fork gives the same-model fork the parent's session_id, cached system prompt, tools[] and session_start — but with _persist_disabled=True and _session_db=None, BOTH cache-identity resolvers diverged from the parent on their own: declared_conversation_scope failed closed on _persist_disabled, and the lineage walk skipped on the missing DB. The fork's affinity header (set_affinity_scope) and body prompt_cache_key (cache_scope_id on the OpenAI-wire transports) therefore keyed a different bucket than the gateway parent, costing one cold ~full-context request per review. Not gateway-only: any parent whose lineage root != current physical id diverges too (teknium1's triage table). Fix, per the triage's suggested direction: on the not-routed branch only, the fork stamps _inherited_cache_scope = resolve_prompt_cache_scope_safe (parent) — the parent's ALREADY-RESOLVED scope, no DB access from the fork, persistence fully detached. Both declared_conversation_scope and resolve_prompt_cache_scope return the inherited scope first when set, so the header path and the body path are fixed together (fixing only one leaves the other divergent — Vivamisu's header/body split observation). Routed (different-model) forks, /branch children, delegate/tool children and fresh sessions set nothing; the fail-closed default stands untouched. /btw shares build_cache_parity_fork and gets the repair for free.