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(vaults): hydrate protected approvals for UI inbox (#708)
Call Whited196900566df
diff --git a/storage/vault_service.py b/storage/vault_service.pyindex abe13146e..cd8e00bc4 100644--- a/storage/vault_service.py+++ b/storage/vault_service.py@@ -312,15 +312,11 @@ def _request_audience_from_requester(requester: Any) -> str:return REQUEST_AUDIENCE_UI-def _card_hydration_policy(audience: str | None, requester: Any) -> CardHydrationPolicy:+def _card_hydration_policy(audience: str | None) -> CardHydrationPolicy:normalized = _normalize_request_audience(audience)- requester_audience = _request_audience_from_requester(requester)return CardHydrationPolicy(audience=normalized,- include_protected_unlock_material=(- normalized == REQUEST_AUDIENCE_UI- and requester_audience != REQUEST_AUDIENCE_AGENT- ),+ include_protected_unlock_material=normalized == REQUEST_AUDIENCE_UI,)@@ -488,7 +484,7 @@ def _request_row_payload(requester = _loads(row.get("requester"))delivery = _loads(row.get("delivery"))card = delivery.get("card") if isinstance(delivery, dict) else None- policy = _card_hydration_policy(audience, requester)+ policy = _card_hydration_policy(audience)if (policy.include_protected_unlock_materialand row.get("status") == "pending"diff --git a/tests/test_vault_service.py b/tests/test_vault_service.pyindex 9e7cceed0..070a430fb 100644--- a/tests/test_vault_service.py+++ b/tests/test_vault_service.py@@ -1066,7 +1066,7 @@ def test_request_inbox_hydrates_unlock_material_without_persisting_it(vault):assert "ct-1" not in raw_delivery-def test_agent_created_request_never_hydrates_unlock_material(vault):+def test_agent_created_request_hydrates_only_for_ui_inbox(vault):_create(vault, name="STANDARD_KEY", protection="standard", group="crypto")with vault.begin() as conn:vs.create_secret(conn, name="PROTECTED_KEY", protection="protected", group="crypto", sealed=_sealed("protected"))@@ -1076,15 +1076,54 @@ def test_agent_created_request_never_hydrates_unlock_material(vault):requester={"source": "agent-cli", "session_id": "ses_1"},delivery={"session_id": "ses_1"},)- ui_payload = vs.get_request(conn, req["id"])agent_payload = vs.get_request(conn, req["id"], audience=vs.REQUEST_AUDIENCE_AGENT)listed = vs.list_requests(conn)- encoded = json.dumps({"ui": ui_payload, "agent": agent_payload, "listed": listed})- assert "secret_unlock_material" not in encoded- assert "unlock_material" not in encoded- assert "ct-protected" not in encoded- assert "wm-protected" not in encoded+ agent_encoded = json.dumps(agent_payload)+ assert "secret_unlock_material" not in agent_encoded+ assert "unlock_material" not in agent_encoded+ assert "ct-protected" not in agent_encoded+ assert "wm-protected" not in agent_encoded+ group_option = next(option for option in listed[0]["card"]["scope_options"] if option["scope_type"] == "group")+ assert group_option["unlock_material"] == [+ {+ "name": "PROTECTED_KEY",+ "kind": "static",+ "envelope": {+ "ciphertext": "ct-protected",+ "nonce": "n-protected",+ "wrap_meta": "wm-protected",+ },+ }+ ]+++def test_cli_resolve_protected_request_hydrates_only_for_ui_inbox(vault):+ _create(vault, name="PROTECTED_KEY", protection="protected", group="crypto")+ with vault.begin() as conn:+ result = vs.resolve_secret_access(+ conn,+ "PROTECTED_KEY",+ session_id="ses_1",+ requester={"source": "cli", "session_id": "ses_1"},+ delivery={"session_id": "ses_1"},+ )+ listed = vs.list_requests(conn)+ raw_delivery = conn.execute(+ select(vault_requests.c.delivery).where(vault_requests.c.id == result["request"]["id"])+ ).scalar_one()++ agent_encoded = json.dumps(result["request"]["card"])+ assert result["status"] == "approval_required"+ assert "secret_unlock_material" not in agent_encoded+ assert "ct-1" not in agent_encoded+ assert listed[0]["card"]["secret_unlock_material"]["envelope"] == {+ "ciphertext": "ct-1",+ "nonce": "n-1",+ "wrap_meta": "wm-1",+ }+ assert "secret_unlock_material" not in raw_delivery+ assert "ct-1" not in raw_deliverydef test_resolve_access_card_uses_delivery_session_fallback(vault):