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(agents): publish names during onboarding

Maxvint8eb67c9bf54d
diff --git a/tests/test_agent_organization_onboarding.py b/tests/test_agent_organization_onboarding.py
index 55b60d622..6c43dca8f 100644
--- a/tests/test_agent_organization_onboarding.py
+++ b/tests/test_agent_organization_onboarding.py
@@ -300,11 +300,13 @@ def test_owner_http_workflow_lists_and_onboards_agents_while_editor_is_denied(mo
store.create(name="legacy-http", backend="codex", system_prompt="must-not-appear")
finally:
store.close()
- monkeypatch.setattr(
- remote_access,
- "sync_resource_acl_once",
- lambda *_args, **_kwargs: {"ok": True, "organizations": [{"organization_id": "org-1"}]},
- )
+ sync_requests: list[dict[str, object]] = []
+
+ def _sync_resource_acl_once(*_args, **kwargs):
+ sync_requests.append(kwargs)
+ return {"ok": True, "organizations": [{"organization_id": "org-1"}]}
+
+ monkeypatch.setattr(remote_access, "sync_resource_acl_once", _sync_resource_acl_once)
client = app.test_client()
client.set_cookie(
@@ -347,6 +349,24 @@ def test_owner_http_workflow_lists_and_onboards_agents_while_editor_is_denied(mo
assert onboarded.status_code == 200
assert onboarded.get_json()["counts"]["not_onboarded"] == 0
assert onboarded.get_json()["console_url"].endswith("/app/organizations/org-1/resources")
+ assert len(sync_requests) == 1
+ published_legacy = next(
+ descriptor
+ for descriptor in sync_requests[0]["resources"]
+ if descriptor["resource_kind"] == "agent" and descriptor["display_name"] == "legacy-http"
+ )
+ assert set(published_legacy) == {
+ "resource_id",
+ "resource_kind",
+ "display_name",
+ "owner_user_id",
+ "metadata_revision",
+ "applied_acl_revision",
+ "access_level",
+ "group_ids",
+ "sync_status",
+ }
+ assert "must-not-appear" not in repr(sync_requests[0]["resources"])
client.set_cookie(
remote_access.SESSION_COOKIE_NAME,
diff --git a/vibe/api.py b/vibe/api.py
index 5179c5e1c..05020ae68 100644
--- a/vibe/api.py
+++ b/vibe/api.py
@@ -1416,6 +1416,37 @@ def _organization_resource_console_url(config: V2Config, organization_id: str) -
return f"{backend_url}/app/organizations/{organization}/resources"
+def _agent_onboarding_resource_descriptors(
+ organization_id: str,
+ inventory: list[dict],
+) -> list[dict]:
+ """Enrich the full ACL snapshot with safe Agent names for first publication."""
+
+ from vibe import remote_access
+
+ display_names: dict[str, str] = {}
+ for agent in inventory:
+ resource_id = str(agent.get("id") or "")
+ try:
+ display_names[resource_id] = remote_access._safe_resource_acl_identifier(
+ agent.get("name"),
+ limit=240,
+ )
+ except ValueError:
+ display_names[resource_id] = resource_id
+
+ # A resource-index update is a full snapshot. Preserve non-Agent resources
+ # while enriching newly onboarded Agent rows with their safe names.
+ descriptors = remote_access._local_policy_resource_descriptors(organization_id)
+ for descriptor in descriptors:
+ if descriptor.get("resource_kind") != "agent":
+ continue
+ display_name = display_names.get(str(descriptor.get("resource_id") or ""))
+ if display_name:
+ descriptor["display_name"] = display_name
+ return descriptors
+
+
def get_vibe_agent_onboarding() -> dict:
"""Return the safe owner inventory for Organization Agent onboarding."""
@@ -1452,6 +1483,10 @@ def onboard_vibe_agents() -> dict:
store.close()
organization_id = str(result["organization_id"])
+ resources = _agent_onboarding_resource_descriptors(
+ organization_id,
+ list(result.get("agents") or []),
+ )
result.update(
{
"ok": True,
@@ -1459,6 +1494,7 @@ def onboard_vibe_agents() -> dict:
"sync": remote_access.sync_resource_acl_once(
config,
organization_id=organization_id,
+ resources=resources,
),
}
)