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(agent): avoid stale scope overrides on agent switch

cyh1d3276d11341
diff --git a/core/vibe_agents.py b/core/vibe_agents.py
index 4c11168ae..19511a6fb 100644
--- a/core/vibe_agents.py
+++ b/core/vibe_agents.py
@@ -287,6 +287,8 @@ class VibeAgentStore:
f"agent '{agent_name}' already exists with backend '{existing.backend}', "
f"cannot use it as the built-in default for '{backend}'"
)
+ if not is_builtin_default_agent(existing):
+ return existing
merged = {**existing.metadata, **metadata}
if existing.source != "builtin" or existing.metadata != merged:
return self.update(existing.name, metadata=merged)
@@ -324,7 +326,7 @@ class VibeAgentStore:
backend = validate_agent_backend(backend)
for candidate in (backend, DEFAULT_AGENT_NAME):
agent = self.get(candidate)
- if agent and agent.backend == backend:
+ if agent and agent.backend == backend and is_builtin_default_agent(agent):
return agent
with self.engine.connect() as conn:
rows = conn.execute(select(agents).where(agents.c.backend == backend).order_by(agents.c.name)).mappings()
diff --git a/tests/test_ui_api.py b/tests/test_ui_api.py
index 2885df50d..fd9cc82dd 100644
--- a/tests/test_ui_api.py
+++ b/tests/test_ui_api.py
@@ -1227,6 +1227,21 @@ def test_builtin_default_agent_does_not_reuse_conflicting_user_agent(tmp_path, m
store.close()
+def test_builtin_default_agent_does_not_lock_existing_user_agent(tmp_path, monkeypatch):
+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path / ".vibe_remote"))
+ store = VibeAgentStore()
+ try:
+ created = store.create(name="opencode", backend="opencode")
+ ensured = store.ensure_builtin_default_agent(backend="opencode")
+
+ assert ensured.id == created.id
+ assert ensured.source == "user"
+ assert ensured.metadata == {}
+ assert api.remove_vibe_agent("opencode")["ok"] is True
+ finally:
+ store.close()
+
+
def test_vibe_agent_import_reports_unreadable_file_as_client_error(tmp_path, monkeypatch):
monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path / ".vibe_remote"))
missing_file = tmp_path / "missing-agent.md"
diff --git a/ui/src/components/shared/RoutingConfigPanel.tsx b/ui/src/components/shared/RoutingConfigPanel.tsx
index e6acdb750..1bf07a352 100644
--- a/ui/src/components/shared/RoutingConfigPanel.tsx
+++ b/ui/src/components/shared/RoutingConfigPanel.tsx
@@ -252,6 +252,8 @@ export const RoutingConfigPanel: React.FC<RoutingConfigPanelProps> = ({
...value.routing,
agent_name: nextName,
agent_backend: null,
+ model: null,
+ reasoning_effort: null,
},
});
}}