fix(aux): prefer _resolve_auto's model over pre-filled MoA preset name in auto branch - #58638
Closed
a844810597 wants to merge 1 commit into
Closed
fix(aux): prefer _resolve_auto's model over pre-filled MoA preset name in auto branch#58638a844810597 wants to merge 1 commit into
a844810597 wants to merge 1 commit into
Conversation
… auto branch When MoA is the main provider, _read_main_model() returns the preset name (e.g. "default"), which pre-fills the ``model`` arg in resolve_provider_client(). The auto branch then does ``final_model = model or resolved``, which picks the preset name over _resolve_auto()'s correctly-resolved aggregator model — sending an invalid model ID to the endpoint and causing HTTP 400. PR NousResearch#53827 fixed _resolve_auto() to resolve MoA→aggregator, but the pre-filled model override one level up in resolve_provider_client() still clobbers its return value. Swap the precedence so ``resolved`` wins. Verified live: title_generation on a MoA session now resolves to maas-glm-5.2-aliyun (the aggregator) instead of "default" (the preset name), and the 400 error is gone.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
When MoA (Mixture-of-Agents) is the active main provider, auxiliary tasks (title generation, compression, vision, session search, etc.) configured with
provider: autofail with HTTP 400 — the MoA preset name is sent as the model ID instead of the real aggregator model.Visible symptom (from
agent.log):Note
using auto (default)—"default"is the MoA preset name, not a valid model ID.All auxiliary tasks using
provider: auto(the default for title_generation, compression, vision, web_extract, session_search, curator, mcp, skills_hub, monitor, profile_describer, triage_specifier, kanban_decomposer, approval, tts_audio_tags) are affected when MoA is the main provider.Root Cause
In
agent/auxiliary_client.py,resolve_provider_client()has a model pre-fill step before the auto branch:When MoA is active,
set_runtime_main(provider="moa", model="default", ...)sets the process-global_RUNTIME_MAIN_MODEL = "default"(the preset name — MoA has no real HTTP endpoint). So_read_main_model()returns"default"andmodelgets pre-filled with it.Then in the auto branch:
_resolve_auto()correctly resolves MoA → aggregator and returns the real model ID (e.g."maas-glm-5.2-aliyun"). This resolution was added by #53827 (merged 2026-06-27) via theif main_provider == "moa":block inside_resolve_auto(). Butfinal_model = model or resolvedpicks the pre-filledmodel="default"(truthy) over the correctresolvedvalue, overriding #53827's fix.The request goes out with
model="default"→ the backend rejects it (400 / TM.00001005 / "not a valid model ID").Why PR #53827 Didn't Fully Fix This
#53827 fixed
_resolve_auto()to return the correct aggregator model. But the bug is one level up:resolve_provider_client()'s auto branch overrides_resolve_auto()'s return value with the pre-filledmodel. The pre-fill comes from_read_main_model(), which returns the MoA preset name — a value that is truthy but not a valid model ID for any real endpoint._resolve_auto()MoA→aggregator resolutionresolve_provider_client()auto branch model overrideFix
One-line change in
resolve_provider_client()'s auto branch:resolved(from_resolve_auto(), which handles MoA→aggregator) takes precedence.modelremains as fallback for the non-MoA fallthrough case where_resolve_autoreturnsNone.Verification
Before fix (live
hermes chat --provider moa -m default)agent.log:After fix (same command)
agent.log:No error follows. Model correctly resolved to aggregator's
maas-glm-5.2-aliyuninstead of preset name"default".Direct resolution test
Test Plan
uv run --frozen --extra dev python -m pytest tests/agent/test_auxiliary_client.py -quv run --frozen --extra dev python -m pytest tests/agent/test_auxiliary_main_first.py -q(existing MoA aux tests from fix(moa): resolve auxiliary tasks to the aggregator, not the preset name #53827)hermes chat --provider moa -m default -q "hi"— noAuxiliary title generation failedwarning in logsRisk Assessment
Low — The change only affects the
provider == "auto"branch ofresolve_provider_client(), and only changes behavior when_resolve_auto()returns a non-Noneresolvedvalue. For non-MoA providers,_resolve_auto()returns the same model that_read_main_model()would have pre-filled (they read the same source), soresolved or modelproduces the same result asmodel or resolved. For MoA providers,resolvedis the correct aggregator model andmodelis the invalid preset name — so the new order is strictly better. Themodelfallback is preserved for the case where_resolve_auto()returnsNone(fallthrough to Step 2/3).