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(remote): preserve safe Show events
Maxd1fff5e504b5
diff --git a/core/show_session_events.py b/core/show_session_events.pyindex 75de41181..179537aad 100644--- a/core/show_session_events.py+++ b/core/show_session_events.py@@ -120,6 +120,27 @@ def show_event_requests_dispatch(event: dict[str, Any]) -> bool:return isinstance(payload, dict) and bool(payload.get("dispatch"))+def show_event_request_requests_dispatch(request_payload: dict[str, Any]) -> bool:+ """Whether a raw Show event request would start an agent turn.++ HTTP routes must decide before handing a request to the event store, while+ ``show_event_requests_dispatch`` intentionally accepts the store's normalized+ event shape. Normalize the two closed dispatching request types here so both+ decisions use the same trigger definition.+ """++ event_type = str(request_payload.get("type") or "").strip()+ if event_type not in SHOW_TRIGGER_KIND:+ return False+ return show_event_requests_dispatch(+ {+ "type": event_type,+ "actor": "human",+ "payload": _normalize_event_payload(event_type, request_payload),+ }+ )++@dataclass(frozen=True)class ShowSessionEventStore:db_path: Path | None = Nonediff --git a/docs/plans/2026-08-04-org-master-conservative-harness-gate.md b/docs/plans/2026-08-04-org-master-conservative-harness-gate.mdindex 220b291ac..8faacd2c2 100644--- a/docs/plans/2026-08-04-org-master-conservative-harness-gate.md+++ b/docs/plans/2026-08-04-org-master-conservative-harness-gate.md@@ -22,9 +22,11 @@ entitlement mirror before remote recurring execution can be enabled.- Keep IM-triggered Agent behavior unchanged.- This phase provides no remote authorization for Harness execution ordefinition writes, Vault secret-bearing operations, IM ingress configuration,- native Agent session forks, or non-read private Show Runtime routes; these- capabilities remain trusted-local. Public `/p/<share_id>/...` flows are a- separate sharing surface, not remote Workbench authorization.+ native Agent session forks, or private Show Runtime API writes; these+ capabilities remain trusted-local. Signed private Show human annotations and+ mark-read receipts remain available only when they cannot dispatch an Agent+ turn. Public `/p/<share_id>/...` flows are a separate sharing surface, not+ remote Workbench authorization.- Make every remote Workbench capability read-only with respect to local Agent,terminal, file, and Harness execution.- Reject remote Task and Watch creation or update at the definition service@@ -52,14 +54,16 @@ entitlement mirror before remote recurring execution can be enabled.policy payload-filters routes that persist future execution choices withexplicit safe-field allowlists: Session Agent/model overrides, Projectcreation/workdir/default Agent, and Agent/platform/runtime config sections.- IM channel and thread settings, native Agent session forks, and non-read- private Show Runtime routes are explicitly trusted-local because they can- alter future Agent ingress or invoke local runtime code. Unknown fields fail- closed. Complete config round-trips may preserve protected values but cannot- change them, and protected fields are stripped before persistence so a- concurrent local update cannot be overwritten by a stale remote round-trip.- Explicit Session/Project display fields and explicit UI/config preferences- remain available.+ IM channel and thread settings, native Agent session forks, and private Show+ Runtime API writes are explicitly trusted-local because they can alter future+ Agent ingress or invoke local runtime code. The separate server-owned Show+ human-event endpoint may record a signed annotation or mark-read receipt, but+ rejects remote requests that would reserve or dispatch an Agent turn before+ event persistence. Unknown fields fail closed. Complete config round-trips+ may preserve protected values but cannot change them, and protected fields+ are stripped before persistence so a concurrent local update cannot be+ overwritten by a stale remote round-trip. Explicit Session/Project display+ fields and explicit UI/config preferences remain available.3. The durable Delivery owner retires remote-origin queue entries before theFIFO claim that starts an Agent turn.4. Task and Watch stores reject explicit remote definition writes.diff --git a/tests/test_instance_authorization.py b/tests/test_instance_authorization.pyindex 935c2705e..afd7cc8e4 100644--- a/tests/test_instance_authorization.py+++ b/tests/test_instance_authorization.py@@ -179,6 +179,7 @@ def test_remote_http_policy_defaults_local_machine_and_unknown_routes_to_local_o("GET", "/api/users", REMOTE_HTTP_ALLOWED),("GET", "/api/bind-codes", REMOTE_HTTP_ALLOWED),("GET", "/show/ses-1/", REMOTE_HTTP_ALLOWED),+ ("POST", "/show/ses-1/__show/events", REMOTE_HTTP_ALLOWED),("POST", "/api/config", REMOTE_HTTP_PAYLOAD_FILTERED),("PATCH", "/api/projects/proj-1", REMOTE_HTTP_PAYLOAD_FILTERED),("PATCH", "/api/sessions/ses-1", REMOTE_HTTP_PAYLOAD_FILTERED),diff --git a/tests/test_show_session_events.py b/tests/test_show_session_events.pyindex 293cde44c..d3d9f8c93 100644--- a/tests/test_show_session_events.py+++ b/tests/test_show_session_events.py@@ -22,6 +22,7 @@ from core.show_session_events import (_format_dispatch_text,_format_transcript_text,localized_show_event_error,+ show_event_request_requests_dispatch,show_event_requests_dispatch,)from storage import message_deliveries@@ -970,6 +971,35 @@ def test_show_trigger_kind_is_closed_over_dispatching_event_types():)+ "request_payload",+ [+ {+ "type": "human.annotation.created",+ "annotation": {"comment": "Run this.", "dispatch": True},+ },+ {+ "type": "human.intent.submitted",+ "payload": {"intent": "choose", "dispatch": True},+ },+ ],+)+def test_show_event_request_dispatch_matches_normalized_event(request_payload):+ assert show_event_request_requests_dispatch(request_payload) is True+++def test_show_event_request_without_dispatch_does_not_start_agent_turn():+ assert (+ show_event_request_requests_dispatch(+ {+ "type": "human.annotation.created",+ "annotation": {"comment": "Leave a review."},+ }+ )+ is False+ )++def test_show_event_store_records_assistant_page_update(isolated_state):_seed_session()diff --git a/tests/test_ui_show_pages.py b/tests/test_ui_show_pages.pyindex ff18f7177..34443e2d9 100644--- a/tests/test_ui_show_pages.py+++ b/tests/test_ui_show_pages.py@@ -2935,6 +2935,45 @@ def test_private_show_page_records_remote_oauth_author(monkeypatch, tmp_path):assert event["message"]["metadata"]["author"] == expected_author+def test_private_show_page_rejects_remote_dispatch_before_event_store(monkeypatch, tmp_path):+ monkeypatch.setenv("AVIBE_HOME", str(tmp_path))+ config = _save_config(tmp_path)+ _create_agent_session("ses123")+ _create_show_page("ses123", "private")+ token = "session-write-token"+ monkeypatch.setattr("vibe.ui_server.show_event_write_token", lambda session_id: token)+ client = app.test_client()+ client.set_cookie(+ remote_access.SESSION_COOKIE_NAME,+ remote_session_cookie(config, "[email protected]", "user-1"),+ domain="alex.avibe.bot",+ )+ monkeypatch.setattr(+ "vibe.ui_server._show_session_event_store",+ lambda: (_ for _ in ()).throw(+ AssertionError("remote Show dispatch reached the event store")+ ),+ )++ response = client.post(+ "/show/ses123/__show/events",+ base_url="https://alex.avibe.bot",+ environ_base=_remote_peer(),+ headers={+ "Origin": "https://alex.avibe.bot",+ "Content-Type": "application/json",+ "X-Vibe-Show-Token": token,+ },+ json={+ "type": "human.annotation.created",+ "annotation": {"comment": "Try to dispatch.", "dispatch": True},+ },+ )++ assert response.status_code == 403+ assert response.get_json()["code"] == "remote_execution_disabled"++def test_private_show_page_accepts_mark_read_receipt_and_records_reader(monkeypatch, tmp_path):from core.show_session_events import ShowSessionEventStorediff --git a/vibe/authorization.py b/vibe/authorization.pyindex 453963160..7adfe3efe 100644--- a/vibe/authorization.py+++ b/vibe/authorization.py@@ -464,12 +464,18 @@ def http_authorization_policy(method: str, path: str) -> HttpAuthorizationPolicyif path.startswith("/api/cloud-management/"):return HttpAuthorizationPolicy("viewer")if path.startswith("/show/"):- minimum_role = (- "viewer" if normalized_method in {"GET", "HEAD", "OPTIONS"} else "editor"+ is_read = normalized_method in {"GET", "HEAD", "OPTIONS"}+ # The server-owned event endpoint does not proxy into Show Runtime. Its+ # handler rejects any remote request that would dispatch an Agent turn+ # before the event store can reserve a delivery.+ is_safe_human_event = normalized_method == "POST" and re.fullmatch(+ r"^/show/[^/]+/(?:__show/events|__events)$",+ path,)+ minimum_role = "viewer" if is_read else "editor"remote_access = (REMOTE_HTTP_ALLOWED- if normalized_method in {"GET", "HEAD", "OPTIONS"}+ if is_read or is_safe_human_eventelse REMOTE_HTTP_LOCAL_ONLY)return HttpAuthorizationPolicy(minimum_role, remote_access)diff --git a/vibe/ui_server.py b/vibe/ui_server.pyindex 4c21c0ff8..418ddecc1 100644--- a/vibe/ui_server.py+++ b/vibe/ui_server.py@@ -52,6 +52,7 @@ from core.show_session_events import (ShowSessionEventError,localized_show_event_error,show_event_payload_session_mismatch,+ show_event_request_requests_dispatch,show_event_requests_dispatch,)from core.terminal_service import TERMINAL_SUPPORTED, TerminalService, TerminalServiceError, sanitize_session_id@@ -11592,7 +11593,7 @@ async def _show_event_response_from_payload(if (context is not Noneand context.is_remote- and show_event_requests_dispatch(payload)+ and show_event_request_requests_dispatch(payload)):return _remote_execution_disabled_response()if show_event_payload_session_mismatch(session_id, payload):