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(acl): guard defaults and honor poll delay
Maxvintb62d0db40b31
diff --git a/tests/test_remote_resource_acl_sync.py b/tests/test_remote_resource_acl_sync.pyindex 34f99a5a7..b8d3895de 100644--- a/tests/test_remote_resource_acl_sync.py+++ b/tests/test_remote_resource_acl_sync.py@@ -234,3 +234,29 @@ def test_sync_publishes_empty_index_after_last_organization_policy_is_deleted(moassert [call["method"] for call in calls] == ["PUT", "GET"]assert calls[0]["json"]["resources"] == []assert resource_access_service.list_resource_organization_ids() == []+++def test_poll_delay_honors_successful_organization_backoff() -> None:+ result = {+ "ok": False,+ "organizations": [+ {"organization_id": "org-1", "ok": True, "poll_after_seconds": 45},+ {"organization_id": "org-2", "ok": True, "poll_after_seconds": 120},+ {"organization_id": "org-3", "ok": False, "poll_after_seconds": 300},+ ],+ }++ assert remote_access._resource_acl_poll_delay(result, 30) == 120+++def test_poll_delay_falls_back_without_valid_successful_result() -> None:+ result = {+ "ok": False,+ "organizations": [+ {"organization_id": "org-1", "ok": False, "poll_after_seconds": 120},+ {"organization_id": "org-2", "ok": True, "poll_after_seconds": 0},+ {"organization_id": "org-3", "ok": True, "poll_after_seconds": "invalid"},+ ],+ }++ assert remote_access._resource_acl_poll_delay(result, 30) == 30diff --git a/tests/test_resource_acl_agents.py b/tests/test_resource_acl_agents.pyindex 820d9190c..a920244d3 100644--- a/tests/test_resource_acl_agents.py+++ b/tests/test_resource_acl_agents.py@@ -217,6 +217,20 @@ def test_remote_agent_request_and_selection_reject_inaccessible_agent(monkeypatcassert {agent["name"] for agent in catalog.get_json()["agents"]} == {"public-agent", "scope-agent"}assert public_mutation.status_code == 403assert public_mutation.get_json()["code"] == "agent_access_forbidden"+ default_mutation = client.post(+ "/api/agents/default",+ json={"name": public_agent.name},+ headers=csrf_headers(client, "https://alex.avibe.bot"),+ base_url="https://alex.avibe.bot",+ environ_base=_remote_peer(),+ )+ assert default_mutation.status_code == 403+ assert default_mutation.get_json()["code"] == "agent_access_forbidden"+ store = VibeAgentStore()+ try:+ assert store.get_default_agent_name() == private_agent.name+ finally:+ store.close()engine = get_cached_sqlite_engine()with engine.begin() as connection:diff --git a/vibe/api.py b/vibe/api.pyindex 971bd3490..28e7c03bd 100644--- a/vibe/api.py+++ b/vibe/api.py@@ -1482,9 +1482,10 @@ def remove_vibe_agent(name: str) -> dict:def set_default_vibe_agent(name: str) -> dict:store = VibeAgentStore()try:- store.require_accessible(name, user_context=resolve_resource_access_context(), enabled_only=True)+ agent = store.require_manageable(name, user_context=resolve_resource_access_context())+ if not agent.enabled:+ raise ValueError(f"agent '{agent.name}' is disabled")store.set_default_agent_name(name)- agent = store.require(name)return {"ok": True, "default_agent_name": agent.name, "agent": _vibe_agent_payload(agent, brief=True)}finally:store.close()diff --git a/vibe/remote_access.py b/vibe/remote_access.pyindex 8d627574d..51a1af280 100644--- a/vibe/remote_access.py+++ b/vibe/remote_access.py@@ -1111,6 +1111,30 @@ def sync_resource_acl_once(_RESOURCE_ACL_SYNC_LOCK.release()+def _resource_acl_poll_delay(result: Mapping[str, Any], fallback_seconds: int) -> int:+ fallback = max(1, fallback_seconds)+ organizations = result.get("organizations")+ if not isinstance(organizations, list):+ return fallback++ delays: list[int] = []+ for organization in organizations:+ if not isinstance(organization, Mapping) or not organization.get("ok"):+ continue+ raw_delay = organization.get("poll_after_seconds")+ if isinstance(raw_delay, bool):+ continue+ try:+ delay = int(raw_delay)+ except (TypeError, ValueError):+ continue+ if delay > 0:+ delays.append(delay)+ # One poller serves every organization, so do not poll any organization+ # sooner than the control plane requested.+ return max(delays, default=fallback)++def start_resource_acl_sync_polling(config: V2Config | None = None,*,@@ -1135,7 +1159,7 @@ def start_resource_acl_sync_polling("resource_acl_sync_in_progress",}:logger.debug("Resource ACL sync poll did not complete: %s", result.get("error"))- time.sleep(max(1, interval_seconds))+ time.sleep(_resource_acl_poll_delay(result, interval_seconds))with _RESOURCE_ACL_SYNC_POLL_LOCK:if _RESOURCE_ACL_SYNC_POLL_STARTED: