Clear stale base_url on gateway model switches - #51488
Closed
ipriyaaanshu wants to merge 1 commit into
Closed
Conversation
1 task
ipriyaaanshu
force-pushed
the
codex/clear-stale-base-url
branch
from
June 23, 2026 18:29
75c8992 to
bb3a90e
Compare
ipriyaaanshu
marked this pull request as ready for review
June 23, 2026 18:38
teknium1
added a commit
that referenced
this pull request
Jun 28, 2026
teknium1
added a commit
that referenced
this pull request
Jun 28, 2026
Contributor
pai-scaffolde
pushed a commit
to pai-scaffolde/hermes-agent
that referenced
this pull request
Jun 28, 2026
pai-scaffolde
pushed a commit
to pai-scaffolde/hermes-agent
that referenced
this pull request
Jun 28, 2026
waefrebeorn
pushed a commit
to waefrebeorn/slermes
that referenced
this pull request
Jul 2, 2026
Jasper6439
pushed a commit
to Jasper6439/hermes-agent
that referenced
this pull request
Jul 5, 2026
Jasper6439
pushed a commit
to Jasper6439/hermes-agent
that referenced
this pull request
Jul 5, 2026
habarmc1223-sudo
pushed a commit
to habarmc1223-sudo/hermes-agent-fluxmem
that referenced
this pull request
Jul 8, 2026
habarmc1223-sudo
pushed a commit
to habarmc1223-sudo/hermes-agent-fluxmem
that referenced
this pull request
Jul 8, 2026
santhreal
pushed a commit
to santhreal/hermes-agent
that referenced
this pull request
Jul 13, 2026
santhreal
pushed a commit
to santhreal/hermes-agent
that referenced
this pull request
Jul 13, 2026
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
leewenjie
pushed a commit
to leewenjie/hermes-agent
that referenced
this pull request
Aug 7, 2026
leewenjie
pushed a commit
to leewenjie/hermes-agent
that referenced
this pull request
Aug 7, 2026
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?
Clears stale inline
model.base_urlvalues when gateway model switches persist non-customproviders.This is a focused follow-up to merged PR #49380. That PR added shared stale endpoint cleanup and wired it into gateway model-switch persistence, but the shared helper clears
api_key, legacyapi, andapi_modeonly. It does not clearbase_url, so a gateway/modelswitch can still re-save an old inline endpoint for a built-in provider.In my local repro, switching models from Telegram rewrote
config.yamlwith:The provider profile endpoint is
https://opencode.ai/zen/go/v1, so later gateway-spawned agents inherited the stale inline endpoint and failed even though TUI/direct provider calls worked.This PR keeps existing helper behavior backward-compatible by making
base_urlclearing opt-in, then enables it only in the gateway persistence paths for non-customproviders.Relationship to existing work
base_urlcleanup gap from fix(model): clear stale endpoint credentials across all provider switches #49380 for gateway model switches.gateway/slash_commands.pypersistence paths, not the oldergateway/run.pypath referenced by some historical PRs.Related Issue
Fixes #25107
Refs #47533 and #51486.
Type of Change
Changes Made
hermes_cli/config.py: add optionalclear_base_urlsupport toclear_model_endpoint_credentials(...).gateway/slash_commands.py: clear inlinebase_urlwhen persisting gateway model switches for non-customproviders.tests/gateway/test_model_picker_persist.py: assert picker-based built-in provider switches do not persistmodel.base_url.tests/gateway/test_model_command_flat_string_config.py: assert typed/modelbuilt-in provider switches do not persistmodel.base_url.How to Test
Run the focused gateway regression tests:
Confirm the result:
Manual repro used before this patch: switch an
opencode-gomodel from Telegram and inspectconfig.yaml; the stale rootmodel.base_urlwas reintroduced before this fix.Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) - or N/Acli-config.yaml.exampleif I added/changed config keys - or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows - or N/AFor New Skills
N/A
Screenshots / Logs
Sanitized failing endpoint before the fix: