10 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
Maciej Lisiewski
d76cce4f11 ci: apply all automatic linter fixes available 2026-10-08 17:22:54 +02:00
kshitijk4poor
144e9711b8 fix(agent): treat jiter SSE parse ValueErrors as transient provider errors (#65147)
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>
2026-09-24 22:26:23 +05:30
kshitijk4poor
32a0d2d2e1 refactor(agent): one home for the stream parse-error markers
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.
2026-09-14 20:01:19 +05:30
joaomarcos
dfb4caf4b7 fix(anthropic): recover malformed streamed tool JSON 2026-09-14 20:01:19 +05:30
Teknium
e83816a4d1 review-fix(comments): restore lost #NNNN rationale comments across non-test source (mechanical sweep, condensed, code unchanged)
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.
2026-09-03 09:44:26 -07:00
Teknium
a5e537cfa9 refactor(agent/agent_init): wip checkpoint — phase-helper split of init, param tables, header factory table, compression parse helpers; mixin compaction 2026-09-02 19:07:13 -07:00
Teknium
1e778ae7c6 refactor(run_agent): re-wrap compacted docstrings, restore lost issue-ref rationale 2026-09-02 13:29:40 -07:00
Teknium
ce6b4d1e16 refactor(run_agent): extract ApiErrorSummaryMixin (agent/api_error_summary.py) 2026-09-02 13:29:40 -07:00