fix(auxiliary): avoid failed DeepSeek requests before structured tasks - #113111
fangliquanflq wants to merge 2 commits into
Conversation
Related: #107963 (open) targets the same wasted DeepSeek |
|
Thanks for the cross-reference. I compared the current diffs: #107963 reacts after a schema rejection, retries with |
|
Thanks @fangliquanflq. The problem this PR targets landed on main via #113966 (5cc8177), which handles the whole class (primary and fallback auxiliary paths, provider capability up front, per-route memo) in one change. Closing as superseded by the landed fix; the issue is closed with the same reference. |
What does this PR do?
DeepSeek auxiliary tasks now select
json_objectbefore dispatch instead of first sending an unsupportedjson_schemarequest. This removes one deterministic HTTP 400 and retry from every structured title, kanban, goal-judge, and plugin call routed to DeepSeek while retaining the existing rejection retry for unknown provider behavior.Symptom
A structured auxiliary call routed to DeepSeek first fails with
This response_format type is unavailable now, then succeeds only after Hermes retries without the structured-output field.Impact
Every affected task pays for an avoidable failed request, extra round-trip latency, and a misleading error-like log entry. The feature eventually succeeds, but the cost repeats for every structured auxiliary call.
Bug Cause
Trigger:
agent/auxiliary_client.py/_build_call_kwargsalways forwards a caller'sjson_schemaresponse format.Causal chain:
json_schemaresponse format.Why it is wrong: DeepSeek's native API supports
json_objectbut not OpenAI'sjson_schemavariant, so the first request is guaranteed to fail.Working sibling / contrast: The existing rejection ladder recovers by removing the format entirely, proving that prompt-compliant JSON is sufficient; DeepSeek also accepts
json_objectdirectly.Ruled out: This is not a malformed schema or task-specific title bug. The direct provider comparison accepts the same request with
json_objectand rejects thejson_schemavariant, and every structured caller shares the same auxiliary request builder.Fix
json_schemaonly when model metadata positively identifies support; otherwise usejson_object.supports_structured_outputoverride.Related Issue
Closes #113064
Type of Change
Changes Made
agent/auxiliary_client.py- choose a supported structured-output format after each route resolves.agent/models_dev.py- expose JSON-schema capability selection and supportsupports_structured_outputmodel overrides.tests/agent/test_structured_output_rejection_retry.py- cover pre-dispatch DeepSeek format selection.tests/agent/test_models_dev.py- cover the explicit capability override and DeepSeek default.How to Test
response_format.type=json_objectand succeeds without the structured-output rejection retry.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) - or N/Acli-config.yaml.exampleif I added/changed config keys - or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows - or N/AScreenshots / Logs
N/A - automated coverage exercises the request payload selection without exposing credentials or session content.