fix(auxiliary): unwrap explicit provider:moa to its aggregator, not the literal name - #575
Open
hashbender wants to merge 1 commit into
Open
fix(auxiliary): unwrap explicit provider:moa to its aggregator, not the literal name#575hashbender wants to merge 1 commit into
hashbender wants to merge 1 commit into
Conversation
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.
What does this PR do?
_resolve_task_provider_model()inagent/auxiliary_client.pyreturned an explicitprovider="moa"override — either a caller-passed arg (e.g. a per-task model override naming a MoA preset) orauxiliary.<task>.provider: moain config.yaml — verbatim, with no MoA-preset unwrap. Only the implicit "main provider is moa" path inside_resolve_auto()unwraps to the aggregator slot (NousResearch#53827, already merged) — this function never goes through_resolve_auto()at all, so the explicit case was never covered.MoA is a virtual provider with no real HTTP endpoint:
resolve_provider_client()looks"moa"up inPROVIDER_REGISTRY(no such entry — it's not a real HTTP provider), falls to the unknown-provider dead end, andcall_llmsurfaces a nonsensical"Provider 'moa' is set in config.yaml but no API key was found. Set the MOA_API_KEY environment variable..."error.Verified live before the fix:
_resolve_task_provider_model('title_generation')withauxiliary.title_generation.provider: moaconfigured returned('moa', None, None, None, None)unresolved.Fix
Mirrors NousResearch#53827's aggregator-resolution approach exactly: when either the explicit
providerarg or the config-derivedcfg_provideris"moa", resolve the named (or default) MoA preset viaresolve_moa_preset()and continue with its aggregator's real provider+model, dropping any explicitbase_url/api_key(themoa://virtual endpoint and placeholder key belong to the facade, not the aggregator's real provider — same reasoning as NousResearch#53827). If the preset can't be resolved (e.g. renamed/deleted), it degrades gracefully to the pre-fix behavior instead of raising harder._unwrap_moa_provider()helper + call sites for both the explicit-arg and config-derivedprovider="moa"cases.base_url/api_keyparameter types toOptional[str](matching their actual None-accepting behavior) — incidentally resolved 5 pre-existingtydiagnostics at call sites (verified via before/after diagnostic diff).Testing
tests/agent/test_auxiliary_client.py::TestResolveTaskProviderModel: explicit-arg unwrap, config-derived unwrap, default-preset fallback when no model is configured, graceful degradation on preset-resolution failure, and a non-moa regression guard.tests/agent/test_auxiliary_client.py(285 tests) + all MoA-specific suites (test_moa_config.py,test_moa_trace_streamed_capture.py,test_moa_aggregator_cost_slot.py,test_moa_switch_api_mode.py,test_moa_slot_api_mode.py,test_auxiliary_main_first.py— the fix(moa): resolve auxiliary tasks to the aggregator, not the preset name NousResearch/hermes-agent#53827 reference test file) — 336 tests total, 0 failures.ruff checkclean.ty checkonagent/auxiliary_client.py: diffed diagnostics before/after — net 5 pre-existing diagnostics resolved, zero new ones introduced.Test plan
uv run --frozen --extra dev python -m pytest tests/agent/test_auxiliary_client.py -q— 285 passeduv run --frozen --extra dev python -m pytest tests/hermes_cli/test_moa_config.py tests/agent/test_moa_trace_streamed_capture.py tests/agent/test_moa_aggregator_cost_slot.py tests/agent/test_moa_switch_api_mode.py tests/agent/test_moa_slot_api_mode.py tests/agent/test_auxiliary_main_first.py -q— 51 passeduv run --frozen --extra dev ruff check agent/auxiliary_client.py tests/agent/test_auxiliary_client.py— cleanuv run --frozen --extra dev ty check agent/auxiliary_client.py— no new diagnostics (verified via before/after diff), 5 pre-existing ones resolvedMirror-of: NousResearch#56691
NousResearch#56691