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(auth): close remaining remote review gaps
Maxf11405d5fb7d
diff --git a/config/v2_config.py b/config/v2_config.pyindex ffde130bd..603656987 100644--- a/config/v2_config.py+++ b/config/v2_config.py@@ -1319,14 +1319,22 @@ class V2Config:avault=avault,)- memory_payload = payload.get("memory") or {}+ memory_payload = payload.get("memory")+ if memory_payload is None:+ memory_payload = {}if not isinstance(memory_payload, dict):raise ValueError("Config 'memory' must be an object")- memory_processing_payload = memory_payload.get("processing") or {}+ memory_processing_payload = memory_payload.get("processing")+ if memory_processing_payload is None:+ memory_processing_payload = {}if not isinstance(memory_processing_payload, dict):raise ValueError("Config 'memory.processing' must be an object")- memory_llm_payload = memory_processing_payload.get("llm") or {}- memory_embedding_payload = memory_processing_payload.get("embedding") or {}+ memory_llm_payload = memory_processing_payload.get("llm")+ memory_embedding_payload = memory_processing_payload.get("embedding")+ if memory_llm_payload is None:+ memory_llm_payload = {}+ if memory_embedding_payload is None:+ memory_embedding_payload = {}if not isinstance(memory_llm_payload, dict):raise ValueError("Config 'memory.processing.llm' must be an object")if not isinstance(memory_embedding_payload, dict):diff --git a/core/memory/runtime.py b/core/memory/runtime.pyindex 4641cb9e5..67ad111fe 100644--- a/core/memory/runtime.py+++ b/core/memory/runtime.py@@ -433,6 +433,14 @@ class MemoryRuntime:"reason": "memory_runtime_install_requires_disabled_memory","download_error": None,}+ if supervisor is not None and not getattr(supervisor, "down", False):+ # A supervisor between retry attempts owns a live recovery+ # lifecycle. Refuse repair without cancelling that lifecycle.+ return {+ "ok": False,+ "reason": "memory_runtime_install_requires_disabled_memory",+ "download_error": None,+ }if supervisor is not None:async with self.module._lifecycle_lock:try:diff --git a/tests/test_instance_authorization.py b/tests/test_instance_authorization.pyindex 33011b0a7..839016287 100644--- a/tests/test_instance_authorization.py+++ b/tests/test_instance_authorization.py@@ -128,6 +128,16 @@ def test_http_policy_defaults_unknown_api_to_owner() -> None:@pytest.mark.parametrize(("method", "path"),[+ ("POST", "/api/show-pages/ses-1/visibility"),+ ("GET", "/api/backend/codex/runtime"),+ ("GET", "/api/global-prompts"),+ ("GET", "/api/harness/runs"),+ ("GET", "/api/harness/runs/run-1"),+ ("GET", "/api/harness/bootstrap"),+ ("GET", "/api/vault/pubkey"),+ ("GET", "/api/vault/agent/pubkey"),+ ("GET", "/api/vault/sandbox/root-metadata"),+ ("GET", "/api/vault/vmk"),("GET", "/api/doctor"),("POST", "/api/doctor"),("POST", "/api/logs"),@@ -174,12 +184,12 @@ def test_remote_http_policy_defaults_local_machine_and_unknown_routes_to_local_o("PUT", "/api/resource-policies/agent/agent-1", REMOTE_HTTP_ALLOWED),("GET", "/api/models/runtime/status", REMOTE_HTTP_ALLOWED),("GET", "/api/models/agents/codex/chain", REMOTE_HTTP_ALLOWED),- ("GET", "/api/backend/codex/runtime", REMOTE_HTTP_ALLOWED),+ ("GET", "/api/backend/codex/runtime", REMOTE_HTTP_LOCAL_ONLY),("GET", "/api/opencode/permission-status", REMOTE_HTTP_ALLOWED),("GET", "/api/vault/audit", REMOTE_HTTP_ALLOWED),("POST", "/api/dock/pins", REMOTE_HTTP_ALLOWED),("POST", "/api/web-push/subscriptions", REMOTE_HTTP_ALLOWED),- ("GET", "/api/harness/runs/run-1", REMOTE_HTTP_ALLOWED),+ ("GET", "/api/harness/runs/run-1", REMOTE_HTTP_LOCAL_ONLY),("GET", "/api/users", REMOTE_HTTP_ALLOWED),("GET", "/show/ses-1/", REMOTE_HTTP_ALLOWED),("POST", "/show/ses-1/__show/events", REMOTE_HTTP_ALLOWED),@@ -205,6 +215,25 @@ def test_remote_http_policy_keeps_approved_management_and_read_surfaces(assert http_authorization_policy(method, path).remote_access == expected+ ("method", "path"),+ [+ ("POST", "/api/show-pages/ses-1/visibility"),+ ("GET", "/api/backend/codex/runtime"),+ ("GET", "/api/global-prompts"),+ ("GET", "/api/harness/runs"),+ ("GET", "/api/harness/runs/run-1"),+ ("GET", "/api/harness/bootstrap"),+ ("GET", "/api/vault/pubkey"),+ ("GET", "/api/vault/agent/pubkey"),+ ("GET", "/api/vault/sandbox/root-metadata"),+ ("GET", "/api/vault/vmk"),+ ],+)+def test_remote_local_execution_and_sensitive_surfaces_are_local_only(method, path) -> None:+ assert http_authorization_policy(method, path).remote_access == REMOTE_HTTP_LOCAL_ONLY++def test_workbench_event_policy_filters_privileged_and_unknown_events() -> None:viewer = _remote_context("viewer")editor = _remote_context("editor")diff --git a/tests/test_memory_config.py b/tests/test_memory_config.pyindex d755857f4..0d9bd7278 100644--- a/tests/test_memory_config.py+++ b/tests/test_memory_config.py@@ -110,6 +110,16 @@ def test_memory_config_defaults_disabled_for_legacy_payload() -> None:assert config.memory == MemoryConfig()+def test_memory_config_rejects_explicit_non_object_memory_block() -> None:+ with pytest.raises(ValueError, match="Config 'memory' must be an object"):+ V2Config.from_payload(_payload([]))+++def test_memory_config_rejects_falsey_non_object_memory_payload() -> None:+ with pytest.raises(ValueError, match="Config 'memory' must be an object"):+ V2Config.from_payload(_payload(0))++def test_generic_config_save_preserves_memory_keys(monkeypatch, tmp_path) -> None:monkeypatch.setenv("AVIBE_HOME", str(tmp_path))original = V2Config.from_payload(diff --git a/tests/test_memory_runtime.py b/tests/test_memory_runtime.pyindex 6b2f50f25..2ad1e62b9 100644--- a/tests/test_memory_runtime.py+++ b/tests/test_memory_runtime.py@@ -1521,6 +1521,30 @@ def test_runtime_repair_rejects_healthy_running_sidecar(monkeypatch, tmp_path: Passert runtime._process is not None+def test_runtime_repair_rejects_supervisor_between_restart_attempts(monkeypatch, tmp_path: Path) -> None:+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))++ class _Process:+ running = False+ down = False++ async def stop(self) -> None:+ raise AssertionError("a recovering supervisor must not be stopped")++ runtime = MemoryRuntime(+ MemoryConfig(enabled=True),+ artifact_manager=FakeMemoryArtifactManager(root_format=None, fingerprint=None),+ effective_home=tmp_path,+ )+ runtime._process = _Process()++ assert asyncio.run(runtime.install_artifact()) == {+ "ok": False,+ "reason": "memory_runtime_install_requires_disabled_memory",+ "download_error": None,+ }++def test_runtime_activation_timeout_cancels_and_settles_submitted_coroutine(tmp_path: Path, monkeypatch) -> None:async def run() -> None:cleanup_started = asyncio.Event()diff --git a/vibe/authorization.py b/vibe/authorization.pyindex 678a06069..8d17d7525 100644--- a/vibe/authorization.py+++ b/vibe/authorization.py@@ -358,6 +358,10 @@ _REMOTE_LOCAL_ONLY_HTTP_RULES = tuple(("DELETE", r"^/api/settings/thread$"),("GET", r"^/api/bind-codes$"),("DELETE", r"^/api/projects/[^/]+$"),+ ("GET", r"^/api/harness/(?:runs|bootstrap|runs/[^/]+)$"),+ ("GET", r"^/api/vault/(?:pubkey|agent/pubkey|sandbox/root-metadata|vmk)$"),+ ("GET", r"^/api/global-prompts$"),+ ("POST", r"^/api/show-pages/[^/]+/visibility$"),))@@ -385,11 +389,11 @@ _REMOTE_OWNER_ALLOWED_HTTP_RULES = tuple(),(frozenset({"GET", "HEAD"}),- r"^/api/vault/(?:pubkey|agent/pubkey|sandbox/root-metadata|settings|vmk|requests|requests/[^/]+|provision-requests/[^/]+|provision-requests/by-id/[^/]+|grants|audit)$",+ r"^/api/vault/(?:settings|requests|requests/[^/]+|provision-requests/[^/]+|provision-requests/by-id/[^/]+|grants|audit)$",),(frozenset({"POST"}),- r"^/api/show-pages/[^/]+/(?:ensure|rotate-share|share-id|visibility)$",+ r"^/api/show-pages/[^/]+/(?:ensure|rotate-share|share-id)$",),(frozenset({"GET", "HEAD"}), r"^/api/dock$"),(frozenset({"POST"}), r"^/api/dock/pins$"),@@ -411,7 +415,7 @@ _REMOTE_OWNER_ALLOWED_HTTP_RULES = tuple(),(frozenset({"GET", "HEAD"}),- r"^/api/(?:projects/[^/]+/agents-md|global-prompts)$",+ r"^/api/projects/[^/]+/agents-md$",),(frozenset({"GET", "HEAD"}), r"^/api/skills/(?:check|find)$"),(@@ -428,7 +432,7 @@ _REMOTE_OWNER_ALLOWED_HTTP_RULES = tuple(),(frozenset({"GET", "HEAD"}),- r"^/api/backend/(?:[^/]+/runtime|(?:claude|codex)/auth|[^/]+/auth/oauth/status/[^/]+)$",+ r"^/api/backend/(?:(?:claude|codex)/auth|[^/]+/auth/oauth/status/[^/]+)$",),(frozenset({"GET", "HEAD"}),@@ -436,7 +440,7 @@ _REMOTE_OWNER_ALLOWED_HTTP_RULES = tuple(),(frozenset({"GET", "HEAD"}),- r"^/api/harness/(?:counts|tasks|watches|runs|bootstrap|runs/[^/]+)$",+ r"^/api/harness/(?:counts|tasks|watches)$",),(frozenset({"GET", "HEAD"}), r"^/api/users$"),)diff --git a/vibe/remote_access.py b/vibe/remote_access.pyindex 530375819..730b46c29 100644--- a/vibe/remote_access.py+++ b/vibe/remote_access.py@@ -1875,7 +1875,7 @@ def _sync_one_organization(acknowledged = 0skipped = 0ack_errors = 0- narrowed_resource_kinds: set[str] = set()+ changed_resource_kinds: set[str] = set()engine = get_cached_sqlite_engine()for raw_intent in intents:try:@@ -1915,8 +1915,6 @@ def _sync_one_organization(outcome["policy"],))- if policy_narrowed:- narrowed_resource_kinds.add(resource_kind)if resource_kind == "vault_secret" and outcome["status"] == "applied":from storage import vault_service@@ -1931,6 +1929,7 @@ def _sync_one_organization(if release_key is not None:release_scopes = _load_pending_vault_release_scopes(connection, release_key)if outcome["status"] == "applied":+ changed_resource_kinds.add(resource_kind)applied += 1if release_scopes:try:@@ -1993,14 +1992,14 @@ def _sync_one_organization(except Exception:logger.warning("failed to clear published empty resource organization", exc_info=True)ack_errors += 1- if narrowed_resource_kinds:+ if changed_resource_kinds:from vibe.sse_broker import brokerbroker.publish("authorization.changed",{"project_ids": [],- "resource_kinds": sorted(narrowed_resource_kinds),+ "resource_kinds": sorted(changed_resource_kinds),},)return {diff --git a/vibe/ui_server.py b/vibe/ui_server.pyindex 0b4d437d4..ec222be9b 100644--- a/vibe/ui_server.py+++ b/vibe/ui_server.py@@ -6156,13 +6156,22 @@ def _remote_resource_access_context():def _resource_policy_api_payload(policy: dict[str, Any], user_context: Any, connection: Any) -> dict[str, Any]:from storage import resource_access_service+ can_manage = resource_access_service.can_manage_resource_acl(+ user_context,+ policy["resource_kind"],+ policy["resource_id"],+ connection=connection,+ )+ group_ids = policy.get("group_ids") or []+ if not can_manage:+ group_ids = sorted(set(group_ids).intersection(user_context.group_ids or set()))return {"resource_kind": policy["resource_kind"],"resource_id": policy["resource_id"],"access_level": policy["access_level"],"owner_user_id": policy.get("owner_user_id"),"organization_id": policy.get("organization_id"),- "group_ids": policy.get("group_ids") or [],+ "group_ids": group_ids,"policy_revision": policy.get("policy_revision"),"last_applied_control_plane_revision": policy.get("last_applied_control_plane_revision"),"can_use": resource_access_service.can_use_resource(@@ -6171,12 +6180,7 @@ def _resource_policy_api_payload(policy: dict[str, Any], user_context: Any, connpolicy["resource_id"],connection=connection,),- "can_manage": resource_access_service.can_manage_resource_acl(- user_context,- policy["resource_kind"],- policy["resource_id"],- connection=connection,- ),+ "can_manage": can_manage,}@@ -10378,6 +10382,20 @@ def _workbench_event_visible_to_context(context, event_type: str, payload: str)def _workbench_event_payload_for_context(context, event_type: str, payload: str) -> str:"""Project-filter aggregate payloads whose values depend on the recipient."""+ if event_type == "vaults.updated" and context is not None and context.is_remote:+ try:+ envelope = json.loads(payload)+ except (TypeError, json.JSONDecodeError):+ return payload+ if isinstance(envelope, dict) and isinstance(envelope.get("data"), dict):+ return json.dumps(+ {+ **envelope,+ "data": {"scope": envelope["data"].get("scope", "")},+ },+ ensure_ascii=False,+ separators=(",", ":"),+ )if event_type != "inbox.unread.changed":return payloadtry: