fix(moa): keep virtual provider on MoA client

This commit is contained in:
Gille 2026-06-27 14:03:43 -06:00 committed by Teknium
parent 5db1430af9
commit 66aeda3550
5 changed files with 34 additions and 5 deletions

View file

@ -41,7 +41,7 @@ moa:
agent = AIAgent(
api_key="moa-virtual-provider",
base_url="moa://local",
base_url="http://127.0.0.1/v1",
model="review",
provider="moa",
quiet_mode=True,
@ -50,10 +50,18 @@ moa:
enabled_toolsets=["file"],
max_iterations=1,
)
monkeypatch.setattr(
agent,
"_create_request_openai_client",
lambda *_args, **_kwargs: (_ for _ in ()).throw(
AssertionError("MoA calls must use MoAClient, not a request OpenAI client")
),
)
result = agent.run_conversation("solve this")
assert result["final_response"] == "aggregator acted"
assert agent.base_url == "moa://local"
assert [(c["task"], c["provider"], c["model"]) for c in calls] == [
("moa_reference", "openai-codex", "gpt-5.5"),
("moa_aggregator", "openrouter", "anthropic/claude-opus-4.8"),
@ -61,6 +69,16 @@ moa:
assert calls[1]["tools"] is not None
def test_moa_runtime_provider_uses_virtual_endpoint():
from hermes_cli.runtime_provider import resolve_runtime_provider
runtime = resolve_runtime_provider(requested="moa", target_model="review")
assert runtime["provider"] == "moa"
assert runtime["base_url"] == "moa://local"
assert runtime["api_key"] == "moa-virtual-provider"
def test_moa_does_not_cap_output_tokens(monkeypatch, tmp_path):
"""MoA must not inject an output cap on reference or aggregator calls.
@ -459,4 +477,3 @@ def test_moa_facade_reruns_references_on_new_turn(monkeypatch, tmp_path):
# 2 references × 2 distinct turns = 4 reference runs.
assert len(ref_runs) == 4