#1060 openai_compat drops reasoning_content: DeepSeek thinking mode rejects every multi-turn tool call; agent runs on prism fail after the first tool call
Description
EditEARS SPEC:
- When a provider response carries reasoning_content (or reasoning) on an assistant message with tool_calls, the LLM router shall return it and the agent loop shall send it back unchanged on that assistant message in the next request.
- If the provider rejects a request as invalid (HTTP 400), then Highway shall report it as a non-retryable request error, never as provider unavailability.
- The llm_routes health probe shall exercise a two-turn tool call (assistant tool_calls + tool result) for each candidate, so a provider that fails multi-turn shows as dead.
EVIDENCE (#1056, 2026-10-23):
- Direct to https://prism.rodmena.co.uk/v1/chat/completions, deepseek-v4-flash, messages [user, assistant{tool_calls}, tool]: HTTP 400 invalid_request_error 'The reasoning_content in the thinking mode must be passed back to the API.' (request_id 03e8d04f-2f33-4298-9c90-c2e5b594b554). Same request with reasoning_content on the assistant message: HTTP 200.
- engine/tools/llm/openai_compat.py:118 uses reasoning_content only as fallback content; the result dict never carries it, so agent history loses it.
- Live: highway-mcp run_goal 97cee9ae-3d6f-42a7-9d1e-01bb2430555b (email approval rejected, turn 1) failed 4 attempts with 'prism HTTP 503 model_unavailable ... (provider out of quota or unreachable)'; 12 such 503s 23:02-23:04Z plus more on other agent runs. Single-turn goal d3542106 succeeded (391). Health llm_routes showed prism live throughout (single-turn probe): the probe cannot see this failure.
- Mitigation applied: SPECS/1044-routes.patch reverted on vm-1 at 23:08Z; routes back to ollama/gemma4:31b-cloud; multi-turn approve probe 323c9102 completed.
SYNTHESIS: domain = OpenAI-compatible chat protocol with provider extensions; concept = round-trip opaque provider fields on assistant messages (as DeepSeek docs require for thinking mode). Alternatives: (a) carry reasoning_content through result and history [CHOSEN candidate], (b) disable thinking mode per request (loses model quality, provider-specific flag), (c) strip tool history (breaks agents). Error mapping: 400 -> request error. Probe: two-turn probe per candidate.
Comments
Loading comments...
Context
Loading context...
Audit History
View AllLoading audit history...