Review findings on #80873:
- _timeout_phase walked __context__ too, so an HTTP error raised inside an
`except ReadTimeout:` block (e.g. a 401) was reported as a timeout. Walk only
the explicit __cause__ chain (the SDK's `raise APITimeoutError from err`).
- PoolTimeout / WriteTimeout mean the provider never got to answer; they now
keep the existing summary instead of the "waiting for the provider" hint.
- The read-timeout hint prints providers.<agent.provider>.request_timeout_seconds
when called on an agent; class-level calls keep the <provider> placeholder.
A timeout that survived the retry loop surfaced as the SDK's bare text:
"Request timed out." (openai APITimeoutError) or "timed out" (raw httpx
ReadTimeout mid-stream). Neither said whether a connection was ever made or
which setting to raise.
agent/timeout_error_summary.py reads the phase from the most specific
exception in the cause chain (the openai SDK wraps connect timeouts in
APITimeoutError too) and returns one line per phase:
- connect: "Connection to the provider timed out before it was established
(check the base_url and network path)"
- read: "Request timed out waiting for the provider to respond (if the model
needs longer, raise providers.<provider>.request_timeout_seconds ...)"
Both keep the "timed out" wording that cron failure notices and the error
classifier match on. Non-timeout errors fall through unchanged.
ApiErrorSummaryMixin._summarize_api_error consults it after the offline check;
its signature and every caller are unchanged.
Port of an upstream idea.
Extends PROVIDER_STREAM_PARSE_MARKERS (single home) with jiter's serde
vocabulary and excludes those ValueErrors from _is_local_validation_error so
the turn-level retry/fallback path runs instead of aborting as a local bug.
Grafted from #65154 (its conversation_loop regex is superseded by the markers).
Co-authored-by: Simplicio, Wesley (ext) <wesley.simplicio.ext@siemens-energy.com>
The SDK's malformed-frame ValueError substrings were hand-copied into the
retry classifier and the error summary; a third SDK message would need
both remembered. The mid-tool retry branch no longer clears
partial_tool_names itself — _start_stream_attempt resets it for every
attempt. buffer_anthropic_tool_input's docstring states the trade: the
knob stays on the turn's kwargs and the changed tools block costs one
prompt-cache miss.
For each issue anchor present in BASE 63279301bcb non-test .py and absent on HEAD, the BASE comment/docstring block was re-attached at the HEAD location of the code it explained (matched by the distinctive code line / enclosing def). Sentences already covered by an existing HEAD comment were deduped; the issue number always survives. Insert-only: no code lines changed.