Skip to content

Fix provider reasoning follow-ups for Anthropic, Gemini, and OpenRouter#269

Merged
veithly merged 1 commit intomainfrom
codex/provider-thinking-followups
Apr 21, 2026
Merged

Fix provider reasoning follow-ups for Anthropic, Gemini, and OpenRouter#269
veithly merged 1 commit intomainfrom
codex/provider-thinking-followups

Conversation

@veithly
Copy link
Copy Markdown
Collaborator

@veithly veithly commented Apr 20, 2026

Summary

  • fix Anthropic thinking requests to drop incompatible temperature/top_k params and avoid forced tool_choice in thinking mode
  • keep Gemini native thought summaries visible while preserving function-call thought signatures across tool turns
  • stop leaking provider-neutral reasoning_effort into top-level OpenAI-compatible requests and keep OpenRouter reasoning nested under extra_body
  • preserve tool-call metadata in agent memory so provider-specific reasoning context survives round trips

Verification

  • PYTHONPATH=C:\Users\Ricky\Documents\Project\XSpoonAi\core .venv\Scripts\python.exe -m pytest core/tests/test_tool_streaming_output.py -q
  • PYTHONPATH=C:\Users\Ricky\Documents\Project\XSpoonAi\core .venv\Scripts\python.exe -m pytest core/tests/test_agent_llm_integration.py -k "preserves_tool_call_metadata_in_memory or forwards_reasoning_effort_to_llm or run_signatures_accept_reasoning_kwargs" -q

Notes

  • Anthropic/Gemini live network calls were not run in this PR.
  • This is a follow-up to the already-merged neutral reasoning-effort mapping work.

OpenAI follow-up work uncovered provider-specific drift elsewhere: OpenRouter could leak reasoning_effort at the wrong request level, Anthropic thinking requests still sent incompatible parameters, and Gemini was not preserving native thought summaries or function-call signatures. This change keeps provider-native thinking visible without faking normal progress as reasoning.

Constraint: Preserve visible execution text as content and only surface provider-native reasoning as thinking.
Rejected: Faking progress text as thinking; silently dropping Gemini function-call signatures.
Confidence: medium-high.
Scope-risk: medium.
Reversibility: revert the commit.
Directive: align OpenRouter, Anthropic, and Gemini reasoning/thinking handling with current provider APIs.
Tested: PYTHONPATH=C:\Users\Ricky\Documents\Project\XSpoonAi\core .venv\Scripts\python.exe -m pytest core/tests/test_tool_streaming_output.py -q; PYTHONPATH=C:\Users\Ricky\Documents\Project\XSpoonAi\core .venv\Scripts\python.exe -m pytest core/tests/test_agent_llm_integration.py -k "preserves_tool_call_metadata_in_memory or forwards_reasoning_effort_to_llm or run_signatures_accept_reasoning_kwargs" -q.
Not-tested: live Anthropic/Gemini network calls.
Related: spoon-bot reasoning-effort config/gateway PR.
@veithly veithly merged commit 6fc9d2b into main Apr 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant