- 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.
The models.dev metadata store used its own plain http.Client, so the
periodic price/deprecation refresh always bypassed the configured proxy
pool and failed on networks where direct access to models.dev is
unreliable or blocked.
Introduce a client provider on the store that resolves candidates at
refresh time: the active runtime's healthy proxy transports first, then
the original direct client as fallback. The provider reads the current
runtime atomically, so WebUI hot reloads automatically pick up new proxy
transports without touching the long-lived store.
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.