fix(aux): retry fallback candidates once without response_format on structured-output rejection - #92908
Conversation
…tructured-output rejection _call_fallback_candidate_sync and _call_fallback_candidate_async only special-cased auth errors — any other error (including DeepSeek's HTTP 400 "This response_format type is unavailable now" on json_schema) re-raised immediately and aborted the whole auxiliary task. The primary call_llm path already retries once without the field; this mirrors that degradation for the fallback path. Affects every aux task whose fallback candidate rejects response_format: title_generation, vision, compression, web_extract, plugin structured completions, etc. Closes the fallback-candidate gap not covered by NousResearch#85424 (which drops the field for title generation but does not protect other aux tasks that legitimately keep structured output).
05ee8bc to
31579ed
Compare
Overall: correct parity fix — the fallback-candidate path now degrades
Nice catch on keeping sibling |
|
Thanks — this matches my current-main code-path verification. On current main, the structured-output rejection retry from #89589 is present on the primary call paths, while I support the retry-without- Please rebase this PR onto current |
|
Thanks @Legion-is-life — this landed on main via #113966 (5cc8177) with a Co-authored-by credit for your change. Closing this PR as merged-through-salvage; the fix is on main. |
Problem
When a configured auxiliary endpoint (for example, a local Ollama instance) fails,
call_llmcan fall back to the main agent model. The fallback-candidate helpers (_call_fallback_candidate_syncand_call_fallback_candidate_async) previously special-cased auth errors only. Any other error—including DeepSeek's HTTP 400"This response_format type is unavailable now", vLLM gateways without xgrammar, and strict Anthropic-wire gateways—escaped immediately and aborted the auxiliary task.The primary
call_llm/async_call_llmpath already retries once without the structured-output field via_is_structured_output_rejectionand_without_structured_output_format; the fallback-candidate path did not.Live repro: title-generation request → local Ollama timeout → fallback to the main DeepSeek model → HTTP 400 on
response_format→ title generation fails. This fallback-candidate gap was reported in #83390 and documented in #83390 (comment).Fix
response_formatwhile preserving siblingextra_bodyfields.response_format.Tests
Regression coverage includes sync and async cases for:
response_format;response_format.Verification on current
main:tests/agent/test_structured_output_rejection_retry.py: 32 passed;git diff --check: passed.Relationship to #85424
PR #85424 removes
response_formatfrom title generation, addressing the title-specific failure. This PR is complementary: it closes the generic fallback-candidate leak for other auxiliary tasks and plugin structured completions that legitimately keep structured output.Related to #83390.