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.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(opencode): handle permission write failures
cyh910569c7f03e
diff --git a/tests/test_ui_api.py b/tests/test_ui_api.pyindex 4a6a06c2f..eaf152338 100644--- a/tests/test_ui_api.py+++ b/tests/test_ui_api.py@@ -279,6 +279,31 @@ def test_setup_opencode_permission_skips_comment_only_file_and_uses_next_valid_p}+def test_setup_opencode_permission_returns_error_when_existing_config_update_fails(monkeypatch, tmp_path):+ config_path = tmp_path / ".config" / "opencode" / "opencode.json"+ config_path.parent.mkdir(parents=True, exist_ok=True)+ config_path.write_text('{"model": "openai/gpt-5"}\n', encoding="utf-8")++ original_write_text = api.Path.write_text++ def failing_write_text(self, data, encoding=None, errors=None, newline=None):+ if self == config_path:+ raise OSError("read-only file system")+ return original_write_text(self, data, encoding=encoding, errors=errors, newline=newline)++ monkeypatch.setattr(api.Path, "home", lambda: tmp_path)+ monkeypatch.setattr(api.Path, "write_text", failing_write_text)++ result = api.setup_opencode_permission()++ assert result == {+ "ok": False,+ "message": "read-only file system",+ "config_path": str(config_path),+ }+ assert json.loads(config_path.read_text(encoding="utf-8")) == {"model": "openai/gpt-5"}++def test_parse_jsonc_object_preserves_comment_markers_inside_strings():parsed = parse_jsonc_object("""{diff --git a/vibe/api.py b/vibe/api.pyindex 6c8418749..7dd33e4fa 100644--- a/vibe/api.py+++ b/vibe/api.py@@ -724,12 +724,16 @@ def setup_opencode_permission() -> dict:}probe.config["permission"] = "allow"- probe.path.write_text(json.dumps(probe.config, indent=2) + "\n", encoding="utf-8")- return {- "ok": True,- "message": "Permission set to 'allow'",- "config_path": str(probe.path),- }+ try:+ probe.path.write_text(json.dumps(probe.config, indent=2) + "\n", encoding="utf-8")+ return {+ "ok": True,+ "message": "Permission set to 'allow'",+ "config_path": str(probe.path),+ }+ except Exception as e:+ logger.error(f"Failed to update OpenCode config at {probe.path}: {e}")+ return {"ok": False, "message": str(e), "config_path": str(probe.path)}if probe.existing_paths:error_path, error_message = probe.errors[0] if probe.errors else (probe.existing_paths[0], "unknown parse error")