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): honor last duplicate permission key
cyhc1a8d62716b7
diff --git a/tests/test_ui_api.py b/tests/test_ui_api.pyindex 7fcedc060..5c90f4e66 100644--- a/tests/test_ui_api.py+++ b/tests/test_ui_api.py@@ -334,6 +334,38 @@ def test_setup_opencode_permission_handles_multiline_object_with_inline_closing_}+def test_setup_opencode_permission_updates_last_duplicate_permission_entry(monkeypatch, tmp_path):+ config_path = tmp_path / ".config" / "opencode" / "opencode.json"+ config_path.parent.mkdir(parents=True, exist_ok=True)+ config_path.write_text(+ """{+ "permission": "prompt",+ "model": "openai/gpt-5",+ "permission": "deny"+}+""",+ encoding="utf-8",+ )++ monkeypatch.setattr(api.Path, "home", lambda: tmp_path)++ result = api.setup_opencode_permission()+ updated_text = config_path.read_text(encoding="utf-8")++ assert result["ok"] is True+ assert result["config_path"] == str(config_path)+ assert updated_text == """{+ "permission": "prompt",+ "model": "openai/gpt-5",+ "permission": "allow"+}+"""+ assert parse_jsonc_object(updated_text) == {+ "permission": "allow",+ "model": "openai/gpt-5",+ }++def test_setup_opencode_permission_skips_comment_only_file_and_uses_next_valid_path(monkeypatch, tmp_path):xdg_path = tmp_path / ".config" / "opencode" / "opencode.json"legacy_path = tmp_path / ".opencode" / "opencode.json"diff --git a/vibe/opencode_config.py b/vibe/opencode_config.pyindex 5e31057c8..abf281974 100644--- a/vibe/opencode_config.py+++ b/vibe/opencode_config.py@@ -308,9 +308,13 @@ def set_jsonc_top_level_string_property(source: str, key: str, value: str) -> stroot_start, root_end, properties = _scan_jsonc_top_level_properties(source)serialized_value = json.dumps(value)- for prop in properties:- if prop.key == key:- return source[: prop.value_start] + serialized_value + source[prop.value_end :]+ matching_property = next((prop for prop in reversed(properties) if prop.key == key), None)+ if matching_property is not None:+ return (+ source[: matching_property.value_start]+ + serialized_value+ + source[matching_property.value_end :]+ )newline = _detect_newline(source)root_line_start = _line_start(source, root_start)