hermes-agent/agent
joaomarcos a23d5073fb fix(agent): stop switch_model from pairing new provider with stale base_url
switch_model() unconditionally set agent.provider but only set
agent.base_url when the resolved value was truthy. When a real
provider change resolved an empty base_url (e.g. minimax after
copilot), the agent ended up with provider="minimax" but
base_url still pointing at api.githubcopilot.com. That incoherent
pair then got snapshotted into agent._primary_runtime, so it kept
re-applying on every subsequent turn via restore_primary_runtime()
until the process restarted.

try_activate_fallback() and _swap_credential() were audited and
confirmed unaffected: both always derive base_url from an actually
constructed client, never from a possibly-empty resolver hint.

Fix: when base_url is empty AND the provider is genuinely changing,
raise ValueError instead of silently keeping the old provider's URL.
This routes through switch_model()'s existing snapshot/rollback
path, and callers (tui_gateway/server.py's _apply_model_switch)
already catch and surface a clean "switch failed, staying on X"
message. Re-selecting the SAME provider with an empty base_url
(credential-only refresh) still keeps the current URL, unchanged.

Fixes #47828

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-09 16:36:06 -07:00
..
lsp refactor(setup): route dependency installs through the canonical uv→pip→ensurepip ladder 2026-07-07 04:09:35 -07:00
pet fix: remove dead f-string prefixes via ruff F541 (216 sites) (#52336) 2026-07-05 13:42:46 -07:00
secret_sources feat(secrets): adapt 1Password onto the SecretSource interface 2026-07-06 04:58:07 -07:00
transports refactor(salvage): scope #40632 to the two live copy-on-write sites 2026-07-09 14:35:14 +05:30
__init__.py
account_usage.py fix(usage): scope Codex usage pool fallback to AuthError, keep singleton token on account_id read failure 2026-07-07 12:01:33 +05:30
agent_init.py feat(openai): complete gpt-5.6 E2E — codex catalog + 272K compaction auto-raise 2026-07-10 00:47:51 +05:30
agent_runtime_helpers.py fix(agent): stop switch_model from pairing new provider with stale base_url 2026-07-09 16:36:06 -07:00
anthropic_adapter.py fix(auth): per-profile Anthropic OAuth file + complete port-binding platform set (#57563 salvage) (#59339) 2026-07-07 08:33:06 +00:00
async_utils.py
auxiliary_client.py feat(openai): complete gpt-5.6 E2E — codex catalog + 272K compaction auto-raise 2026-07-10 00:47:51 +05:30
azure_identity_adapter.py
background_review.py fix(background-review): guard summarize against list-shaped tool responses (#59437) 2026-07-06 03:28:30 -07:00
bedrock_adapter.py
billing_view.py
bounded_response.py fix(agents): bound streaming error-response body reads 2026-07-05 14:00:20 -07:00
browser_provider.py
browser_registry.py
chat_completion_helpers.py fix: preserve fallback switch notice on successful fallback 2026-07-09 13:40:19 +05:30
codex_responses_adapter.py fix(codex): route commentary-phase preamble text to reasoning channel (fixes #41293) 2026-07-05 06:29:45 -07:00
codex_runtime.py feat(agent): add Codex-native compaction paths 2026-07-07 02:39:54 -07:00
coding_context.py
context_breakdown.py
context_compressor.py fix(compression): stop compaction thrash — 75% trigger floor under 512K, no summary output cap, reasoning-trace exclusion (#60989) 2026-07-08 11:56:17 -07:00
context_engine.py
context_references.py
conversation_compression.py feat(agent): add Codex-native compaction paths 2026-07-07 02:39:54 -07:00
conversation_loop.py fix: preserve fallback switch notice on successful fallback 2026-07-09 13:40:19 +05:30
copilot_acp_client.py
credential_persistence.py
credential_pool.py fix(secrets): make 1Password bootstrap token reliable outside systemd 2026-07-06 04:58:07 -07:00
credential_sources.py
credits_tracker.py
curator.py
curator_backup.py fix: remove dead f-string prefixes via ruff F541 (216 sites) (#52336) 2026-07-05 13:42:46 -07:00
display.py feat(display): show file_path in skill_view tool progress lines (#60079) 2026-07-07 01:07:49 -07:00
error_classifier.py fix(error-classifier): retry HTTP 408 as timeout instead of aborting as format_error 2026-07-06 01:56:09 -07:00
errors.py
file_safety.py
gemini_native_adapter.py fix(agents): bound streaming error-response body reads 2026-07-05 14:00:20 -07:00
gemini_schema.py
i18n.py
image_gen_provider.py
image_gen_registry.py
image_routing.py Guard native image routing with file safety 2026-07-05 03:15:03 -07:00
insights.py
iteration_budget.py
jiter_preload.py
learn_prompt.py
learning_graph.py
learning_graph_render.py fix: cover remaining GNU-only %-d strftime site in learning graph render 2026-07-05 00:59:35 -07:00
learning_mutations.py
lmstudio_reasoning.py
manual_compression_feedback.py
markdown_tables.py
memory_manager.py refactor: address Phase-2 review findings on /new boundary handoff 2026-07-09 03:21:54 +05:30
memory_provider.py
message_content.py
message_sanitization.py
moa_loop.py
moa_trace.py
model_metadata.py review fixes: openai-api pricing route normalization, GA pricing_version, invariant tests 2026-07-10 00:47:51 +05:30
models_dev.py
moonshot_schema.py
nous_rate_guard.py
onboarding.py fix(config): close unreadable-overwrite bug class at a single chokepoint 2026-07-05 23:00:34 +05:30
oneshot.py
plugin_llm.py
portal_tags.py
process_bootstrap.py fix(agent): apply pool-level keepalive to the process_bootstrap sibling builder 2026-07-05 03:14:55 -07:00
prompt_builder.py perf(skills): speed up snapshot prompt builds 2026-07-09 02:41:24 +05:30
prompt_caching.py refactor(salvage): scope #40632 to the two live copy-on-write sites 2026-07-09 14:35:14 +05:30
rate_limit_tracker.py
reasoning_timeouts.py fix(reasoning): add deepseek-v4-flash and deepseek-v4-pro to reasoning timeout floor 2026-07-09 15:04:14 +05:30
redact.py fix(redact): skip env-lookup exception for JSON/YAML config field redaction 2026-07-05 13:58:19 -07:00
replay_cleanup.py fix: redact expired confirmations in place to preserve role alternation 2026-07-07 14:40:32 +05:30
retry_utils.py refactor(retry): single-source Z.AI overload short-attempts + drop change-detector assert 2026-07-07 11:57:01 +05:30
runtime_cwd.py
secret_scope.py
shell_hooks.py fix(cli): safe mode also skips shell-hook registration 2026-07-07 02:32:32 -07:00
skill_bundles.py fix(gateway): apply platform-disabled skill gate to bundle invocations (#59156) 2026-07-05 14:48:11 -07:00
skill_commands.py fix(cron): normalize absolute skill paths before skill_view (#59824) 2026-07-07 14:40:56 +05:30
skill_preprocessing.py
skill_utils.py perf(skills): speed up snapshot prompt builds 2026-07-09 02:41:24 +05:30
ssl_guard.py
ssl_verify.py
stream_diag.py
subdirectory_hints.py
system_prompt.py fix(agent): tag desktop chat sessions as desktop 2026-07-08 06:18:18 -07:00
think_scrubber.py
thinking_timeout_guidance.py
thread_scoped_output.py
title_generator.py
tool_dispatch_helpers.py
tool_executor.py feat(plugins): pass approve rule keys to approval gate 2026-07-07 15:14:30 -07:00
tool_guardrails.py
tool_result_classification.py
trace_upload.py feat(sessions): trace export + HF upload via 'sessions export --format trace' (#60507) 2026-07-07 15:12:49 -07:00
trajectory.py
transcription_provider.py
transcription_registry.py
tts_provider.py
tts_registry.py
turn_context.py feat(agent): add Codex-native compaction paths 2026-07-07 02:39:54 -07:00
turn_finalizer.py
turn_retry_state.py
usage_pricing.py feat(openai): cover gpt-5.6 -pro variants (PR #61587 complement) 2026-07-10 00:47:51 +05:30
verification_evidence.py
verification_stop.py
verify_hooks.py
vertex_adapter.py
video_gen_provider.py
video_gen_registry.py
web_search_provider.py fix(web): widen config-aware env resolution to exa/parallel/tavily/brave-free providers 2026-07-06 02:42:24 -07:00
web_search_registry.py fix(web): correct 'disabled plugin' diagnosis for web backends (#59573) 2026-07-06 04:38:17 -07:00