- Only treat a retry as success on 2xx; on non-2xx/transport failure
close the retry response and restore the original 400 body, logging
reasoning_reference_retry_failed with the retry status.
- Always close the original network body after caching its bytes, and
hand downstream a fresh in-memory reader (also on read errors).
- Narrow the matcher to explicit 'reasoning item/reference ... not
found/expired' errors; add negative cases (unknown reasoning field,
bad reasoning_effort, unrelated 400s).
- Thread a cumulative attempt offset through doUpstreamTiers and the
anonymous path so retry attempts keep numbering [1 2] per request.
- Add HTTP-level tests via httptest upstream: retry success (with
stripped-payload assertion), retry non-2xx restore, non-matching
passthrough, no-op (nothing to strip), cumulative attempt numbers.
When Zen returns 400 such as "Referenced reasoning item 'rs_...' was
not found or has expired", replay once without the Responses reasoning
input items and previous_response_id under a fresh upstream session
instead of failing the client request. Other 400s pass through
unchanged. Adds unit tests for the classifier and payload stripping.
Add a top-level "prefer" config field ("zen" or "go", default "go") that
controls which upstream is used when a model is available in both pools,
including during the temporary model-discovery fallback. Previously Zen
was always preferred.