fix(agent): ignore stale local base_url for direct providers - #30034
fix(agent): ignore stale local base_url for direct providers#30034Tranquil-Flow wants to merge 2 commits into
Conversation
8522096 to
a19702e
Compare
CI Fix:
|
a19702e to
183e54d
Compare
teknium1
left a comment
There was a problem hiding this comment.
Thanks for isolating the migration scenario. The current-main issue is still present, but this implementation needs to move to the runtime resolver.
Problems
agent/agent_init.py:981-987re-invokesresolve_provider_client()after clearing only local variables. The resolver then rereads matchingmodel.base_urland prefers it athermes_cli/runtime_provider.py:2028-2032, so the stale configured loopback URL returns.- The proposed registry-and-loopback predicate also includes LM Studio:
hermes_cli/auth.py:212-219declares its canonical127.0.0.1endpoint, andtests/hermes_cli/test_runtime_provider_resolution.py:415-453requires saved LM Studio URLs to be preserved. - The new test mocks
resolve_provider_client, so it does not execute the config-resolution behavior above.
Suggested changes
- Put the stale-route guard at
hermes_cli/runtime_provider.py:2028-2032, with an explicit local-provider exclusion/capability, and add a resolver-level DeepSeek regression that uses the persisted config.
Automated hermes-sweeper review.
| agent.base_url, | ||
| agent.provider, | ||
| ) | ||
| agent.base_url = "" |
There was a problem hiding this comment.
Clearing the init-local value here does not prevent the later resolve_provider_client() call from rereading the same matching model.base_url (hermes_cli/runtime_provider.py:2028-2032). Please enforce the stale-route rule in the runtime resolver instead, and exclude local-serving registry providers such as LM Studio.
Summary
model.base_urlvalues when a direct API-key provider fromPROVIDER_REGISTRYis selected.resolve_provider_client()uses the provider's canonical endpoint.deepseekwith an oldhttp://localhost:8081/v1base URL.Fixes #30033
Test plan
python -m pytest tests/run_agent/test_run_agent.py::test_direct_provider_ignores_stale_local_base_url -q -o addopts=python -m pytest tests/run_agent/test_run_agent.py -q -o addopts=python -m py_compile agent/agent_init.py tests/run_agent/test_run_agent.pyNotes
This is intentionally narrow: it only handles loopback URLs (
localhost,127.0.0.1,::1) for direct registry providers, and leaves custom/aggregator routing behavior unchanged.