2 Commits

Author SHA1 Message Date
Teknium
c41de4d95f fix(agent): timeout summary follows only the cause chain and names the real provider key
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.
2026-10-31 22:06:50 -07:00
Teknium
a8c7ec078d fix(agent): name the phase and the setting in transport-timeout error summaries
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.
2026-10-31 22:06:50 -07:00