fix: inject reasoning_config into MoA aggregator extra_body (#64187) - #64253
fix: inject reasoning_config into MoA aggregator extra_body (#64187)#64253AlexFucuson9 wants to merge 1 commit into
Conversation
…arch#64187) build_kwargs gates reasoning on _supports_reasoning_extra_body(), which checks the agent's own provider/base_url. On the MoA path those are the virtual moa / moa://local, which always fail the gate, so the aggregator never receives extra_body[reasoning] regardless of the user's configured reasoning_effort. Fix: stash the agent's reasoning_config on MoAClient at init time, then in create() resolve the aggregator slot's REAL runtime and re-evaluate the reasoning gate against the resolved provider/base_url. If supported, inject the reasoning config into extra_body before calling call_llm. Add _moa_slot_supports_reasoning() helper that mirrors the gate logic in AIAgent._supports_reasoning_extra_body but evaluated against the resolved slot identity (Nous Portal, GitHub Models, LM Studio, OpenRouter with reasoning-capable model prefixes). Fixes NousResearch#64187
Duplicate of #64220 — both fix #64187 (MoA aggregator never receives the configured |
|
Closing — the underlying bug is fixed by PR #64756 (merged). Your diagnosis of #64187 was correct (reasoning gates keyed to the virtual Your PR predates #64631 (per-slot MoA reasoning, merged), which moved this plumbing: reasoning now flows through Note: #64220 was a parallel fix for the same issue submitted shortly before yours — crediting both of you. |
Summary
When
provider: moais configured, the acting aggregator never receives the user'sreasoning_effortinextra_body. The aggregator silently runs at the backend's default reasoning level.Root Cause
build_kwargs()gates reasoning emission onagent._supports_reasoning_extra_body(), which checks the agent's ownprovider/base_url. On the MoA path these are the virtualmoa/moa://local, which always fail the gate. The aggregator's real provider is only resolved later inmoa_loop.py::create()via_slot_runtime(), but by then the reasoning decision has already been made (and was False).Fix
Three changes:
Stash reasoning_config on MoAClient — Pass
agent.reasoning_configthroughMoAClient.__init__→MoAChatCompletions.__init__socreate()has access to the user's configured reasoning settings.Re-evaluate the gate against the resolved aggregator — In
create(), after resolving the aggregator slot's real runtime, call the new_moa_slot_supports_reasoning()helper to check if the resolved provider supports reasoning. If so, injectextra_body[reasoning]with the configured effort level.New helper
_moa_slot_supports_reasoning()— Mirrors the gate logic inAIAgent._supports_reasoning_extra_bodybut evaluated against the resolved slot identity (Nous Portal, GitHub Models, LM Studio, OpenRouter with reasoning-capable model prefixes).Testing
ruff check agent/moa_loop.py agent/agent_init.py— all checks passedtest_moa_aggregator_cost_slottestsFixes #64187