Skip to content

fix: inject reasoning_config into MoA aggregator extra_body (#64187) - #64253

Closed
AlexFucuson9 wants to merge 1 commit into
NousResearch:mainfrom
AlexFucuson9:fix/moa-aggregator-reasoning-effort-64187
Closed

fix: inject reasoning_config into MoA aggregator extra_body (#64187)#64253
AlexFucuson9 wants to merge 1 commit into
NousResearch:mainfrom
AlexFucuson9:fix/moa-aggregator-reasoning-effort-64187

Conversation

@AlexFucuson9

Copy link
Copy Markdown
Contributor

Summary

When provider: moa is configured, the acting aggregator never receives the user's reasoning_effort in extra_body. The aggregator silently runs at the backend's default reasoning level.

Root Cause

build_kwargs() gates reasoning emission on agent._supports_reasoning_extra_body(), which checks the agent's own provider / base_url. On the MoA path these are the virtual moa / moa://local, which always fail the gate. The aggregator's real provider is only resolved later in moa_loop.py::create() via _slot_runtime(), but by then the reasoning decision has already been made (and was False).

Fix

Three changes:

  1. Stash reasoning_config on MoAClient — Pass agent.reasoning_config through MoAClient.__init__MoAChatCompletions.__init__ so create() has access to the user's configured reasoning settings.

  2. 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, inject extra_body[reasoning] with the configured effort level.

  3. New helper _moa_slot_supports_reasoning() — 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).

Testing

  • ruff check agent/moa_loop.py agent/agent_init.py — all checks passed
  • All 17 existing MoA tests pass
  • The new helper is exercised indirectly through the existing test_moa_aggregator_cost_slot tests

Fixes #64187

…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
@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P2 Medium — degraded but workaround exists duplicate This issue or pull request already exists labels Jul 14, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #64220 — both fix #64187 (MoA aggregator never receives the configured reasoning_effort because the reasoning gate keys on the virtual moa/moa://local identity) by re-evaluating the gate against the resolved aggregator slot in agent/moa_loop.py. #64220 is the earlier, cleaner canonical. Flagging for the maintainer to pick one.

@teknium1

Copy link
Copy Markdown
Contributor

Closing — the underlying bug is fixed by PR #64756 (merged). Your diagnosis of #64187 was correct (reasoning gates keyed to the virtual moa://local identity never fire for the aggregator). Thanks @AlexFucuson9.

Your PR predates #64631 (per-slot MoA reasoning, merged), which moved this plumbing: reasoning now flows through call_llm(reasoning_config=...) with provider-profile projection per aggregator provider. The merged fix resolves the aggregator as: slot reasoning_effort > agent.reasoning_overrides for the slot's model > global agent.reasoning_effort.

Note: #64220 was a parallel fix for the same issue submitted shortly before yours — crediting both of you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MoA: aggregator never gets agent.reasoning_effort

3 participants