Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(routing): normalize selected backend on refresh

cyh90a43d74fcd9
diff --git a/core/handlers/settings_handler.py b/core/handlers/settings_handler.py
index 14a1e8809..a18c05c0b 100644
--- a/core/handlers/settings_handler.py
+++ b/core/handlers/settings_handler.py
@@ -703,6 +703,9 @@ class SettingsHandler(BaseHandler):
current_routing = routing_data.current_routing
registered_backends = routing_data.registered_backends
current_backend = routing_data.current_backend
+ visible_selected_backend = (
+ selected_backend if selected_backend in registered_backends else current_backend
+ )
if hasattr(im_client, "update_routing_modal"):
await im_client.update_routing_modal( # type: ignore[attr-defined]
@@ -719,7 +722,7 @@ class SettingsHandler(BaseHandler):
claude_models=routing_data.claude_models,
codex_agents=routing_data.codex_agents,
codex_models=routing_data.codex_models,
- selected_backend=selected_backend,
+ selected_backend=visible_selected_backend,
selected_opencode_agent=selection.selected_opencode_agent,
selected_opencode_model=selection.selected_opencode_model,
selected_opencode_reasoning=selection.selected_opencode_reasoning,
diff --git a/tests/test_settings_handler.py b/tests/test_settings_handler.py
index 0beda10ee..7c616c4cb 100644
--- a/tests/test_settings_handler.py
+++ b/tests/test_settings_handler.py
@@ -323,3 +323,4 @@ def test_handle_routing_modal_update_uses_visible_current_backend() -> None:
assert len(update_calls) == 1
assert update_calls[0]["current_backend"] == "opencode"
+ assert update_calls[0]["selected_backend"] == "opencode"