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(api): treat unreadable agent imports as bad input

cyh5b40e9dcdf42
diff --git a/tests/test_ui_api.py b/tests/test_ui_api.py
index bc7537fd8..b74420282 100644
--- a/tests/test_ui_api.py
+++ b/tests/test_ui_api.py
@@ -1195,6 +1195,14 @@ def test_vibe_agent_api_crud_and_settings_catalog(tmp_path, monkeypatch):
assert updated["agent"]["model"] == "gpt-5.5"
+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"
+
+ with pytest.raises(ValueError, match="Unable to read agent import file"):
+ api.import_vibe_agents({"file": str(missing_file), "backend": "codex"})
+
+
def test_vibe_agent_api_rejects_backend_update(tmp_path, monkeypatch):
monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path / ".vibe_remote"))
api.create_vibe_agent({"name": "worker", "backend": "codex"})
diff --git a/vibe/api.py b/vibe/api.py
index 33ad8923c..0f1352acd 100644
--- a/vibe/api.py
+++ b/vibe/api.py
@@ -843,7 +843,10 @@ def import_vibe_agents(payload: dict) -> dict:
if name or import_all:
raise ValueError("name and all are only valid with from")
backend = validate_agent_backend(str(payload.get("backend") or ""))
- candidates.append(parse_agent_file(Path(file_path).expanduser(), backend=backend))
+ try:
+ candidates.append(parse_agent_file(Path(file_path).expanduser(), backend=backend))
+ except OSError as exc:
+ raise ValueError(f"Unable to read agent import file: {exc}") from exc
else:
if source not in {"claude", "codex", "opencode"}:
raise ValueError("from must be one of: claude, codex, opencode")