Skip to content

fix(runtime): resolve bare custom provider to loopback or CUSTOM_BASE_URL (#14676)#14719

Closed
georgex8001 wants to merge 2 commits into
NousResearch:mainfrom
georgex8001:fix/bare-custom-runtime-base-url-14676
Closed

fix(runtime): resolve bare custom provider to loopback or CUSTOM_BASE_URL (#14676)#14719
georgex8001 wants to merge 2 commits into
NousResearch:mainfrom
georgex8001:fix/bare-custom-runtime-base-url-14676

Conversation

@georgex8001

Copy link
Copy Markdown
Contributor

Summary

Fixes incorrect routing when the user explicitly selects the Custom provider (e.g. via /model) while model.provider in config.yaml still reflects a previous provider (e.g. openrouter). In that case, model.base_url was ignored unless provider: custom, so resolution fell through to OpenRouter with a local model id (see #14676).

Changes

  • Trust model.base_url for bare custom when either:
    • model.provider is custom, or
    • the configured base_url host is loopback (localhost, 127.0.0.1, ::1, 0.0.0.0).
  • Consult CUSTOM_BASE_URL before OpenRouter default URLs so users can pin a local endpoint without a named custom:* entry.
  • Reject non-loopback model.base_url when provider is not custom, so a stale cloud URL cannot hijack a Custom session.

Tests

  • tests/hermes_cli/test_runtime_provider_resolution.py: three regressions for loopback YAML + non-custom provider, CUSTOM_BASE_URL override, and non-loopback URL not trusted.

Fixes #14676

…_URL

When /model selects Custom but model.provider in YAML still reflects a prior provider, trust model.base_url only for loopback hosts or when provider is custom. Consult CUSTOM_BASE_URL before OpenRouter defaults (NousResearch#14676).
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard area/config Config system, migrations, profiles labels Apr 23, 2026
Replace process-wide HERMES_INTERACTIVE mutation in ThreadPoolExecutor
with context-local state in tools.approval so concurrent ACP sessions
cannot race or bypass dangerous-command approval (GHSA-96vc-wcxf-jjff).

effective_hermes_interactive() overrides os.environ for terminal sudo
and cronjob eligibility checks.

Made-with: Cursor
@teknium1

Copy link
Copy Markdown
Contributor

Partial salvage: your runtime_provider.py commit (44e02f2) landed via #15103. The ACP/approval contextvar refactor commit (d9ef7a7) is a separate scope and is worth reviewing on its own — leaving this PR open for that piece. If you'd rather, we can drop the runtime commit from this branch (now duplicated on main) and leave just the ACP change, or close this and open a new PR for the ACP work. Your call.

@georgex8001

Copy link
Copy Markdown
Contributor Author

Awesome, thanks for cherry-picking the runtime fix! I completely agree that the ACP contextvar refactor deserves its own isolated review scope.

To keep things completely clean and avoid any git rebase confusion, I will close this PR and open a fresh, dedicated PR targeting main containing solely the d9ef7a7 commit for the ACP concurrency fix. Give me a few minutes!

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

Labels

area/config Config system, migrations, profiles comp/cli CLI entry point, hermes_cli/, setup wizard 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.

bug: bare 'custom' provider falls through to OpenRouter — no base_url resolution

3 participants