Skip to content

fix(moa): keep virtual provider on MoA client + preserve slot identity (salvage #53809) - #53826

Merged
teknium1 merged 2 commits into
mainfrom
hermes/moa-virtual-provider-routing
Jun 27, 2026
Merged

fix(moa): keep virtual provider on MoA client + preserve slot identity (salvage #53809)#53826
teknium1 merged 2 commits into
mainfrom
hermes/moa-virtual-provider-routing

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Salvage of #53809 by @helix4u (Gille). Fixes two MoA routing bugs so selecting a MoA preset as the active model stays on the in-process MoAClient facade and adapter-backed slot providers keep their provider identity.

Bug A — fake localhost endpoint. The non-streaming provider="moa" path rebuilt a real request-local OpenAI client and the virtual runtime advertised http://127.0.0.1/v1. On Windows boxes running IIS/another local service there, this produced confusing Endpoint: http://127.0.0.1/v1 HTTP 404s instead of using the facade.

Bug B — slot reclassified as custom. _slot_runtime() forwarded each slot's resolved base_url into call_llm(), which treats any explicit base_url as a custom endpoint. A slot like openai-codex:gpt-5.5 became custom:gpt-5.5 at chatgpt.com/backend-api/codex, bypassing the Codex auth-header/Responses adapter → Cloudflare 403s.

Changes

  • agent/chat_completion_helpers.py: non-streaming provider="moa" uses the MoAClient facade directly instead of building a request-local OpenAI client.
  • agent/agent_init.py: MoA agents pin base_url = "moa://local" instead of carrying a stale http://127.0.0.1/v1.
  • agent/agent_runtime_helpers.py: mid-session switches to MoA stay on the facade.
  • agent/moa_loop.py: _slot_runtime() preserves provider identity for adapter-backed slots (openai-codex, xai-oauth) so resolved URLs don't reclassify them as custom.
  • hermes_cli/runtime_provider.py: reports the MoA virtual runtime as moa://local.
  • tests/run_agent/test_moa_loop_mode.py: regression coverage (no request-local client for MoA, virtual endpoint, Codex slot not forwarded as custom).

Validation

Cherry-picked both contributor commits onto current main (authorship preserved). The merge coexists cleanly with the recently-landed MoA reference-block + cache work (#53793).

tests/run_agent/test_moa_loop_mode.py → 13/13 pass (contributor's 3 routing tests + the reference-block/cache tests).

Credit

Original PR #53809 by @helix4u — cherry-picked with authorship preserved.

Infographic

moa-virtual-provider-routing

@github-actions

Copy link
Copy Markdown
Contributor

🔎 Lint report: hermes/moa-virtual-provider-routing vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 11528 on HEAD, 11528 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 6072 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@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 comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have labels Jun 27, 2026
@teknium1
teknium1 merged commit e7bb673 into main Jun 27, 2026
30 checks passed
@teknium1
teknium1 deleted the hermes/moa-virtual-provider-routing branch June 27, 2026 21:20
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 comp/cli CLI entry point, hermes_cli/, setup wizard P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants