ha: Remove Home Assistant notifications
CI / Check (push) Successful in 4m56s

The web app's Web Push notifications replace them: they are encrypted
end to end, and the page holds every pending request, so a dismissed
notification loses nothing. Drops `src/ha.rs`, the
`services.slop-broker.homeAssistant` options and `tokio-tungstenite`.
A config that still has `home_assistant` is refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jackos1998andClaude Opus 5.5 committed 2026-11-24 08:39:53 +00:00
1 parent 9d54664f5c
commit 2af7c55a17
11 files changed
+21 -425

No files matched your search

+9 -34
View File
@@ -11,8 +11,8 @@ The usual setup runs agents in a VM (the **agents' VM**) and the broker on the b
[nixfiles](https://git.nul.ie/dev/nixfiles), whose `docs/slop-broker.md` describes how its boxes use
the broker.
**Status:** the core, the box queries, `slop ssh`, the SSH transport, deploys, builds, Home
Assistant notifications and the approvals web app are implemented. The other operations here are
**Status:** the core, the box queries, `slop ssh`, the SSH transport, deploys, builds, age
secrets and the approvals web app are implemented. The other operations here are
designed but not built yet (see [Planned operations](#planned-operations)). How the code is put
together is in [`architecture.md`](architecture.md); the NixOS and home-manager modules are in
[`nix/modules`](../nix/modules).
@@ -113,40 +113,16 @@ automatically where it can. Approvals show it marked as agent-supplied.
`policy`, so several requesters, for example agents on different boxes, can share the same rules.
- An `ask` request waits for an answer (`services.slop-broker.timeout`) from the
[approvals web app](#approvals-web-app), `slop-approve` (on the broker's box, or over SSH from
another box) or a Home Assistant Companion notification. The answers are **once**, a **lease**
another box). The answers are **once**, a **lease**
(the same scope is approved for a while, and only lengths the policy allows are offered) or
**deny**.
- An operation or rule can also set `confirm = "passkey"`: approving such a request needs a fresh
passkey in the web app, so `slop-approve` and Home Assistant can only deny it. Deploys to routers
passkey in the web app, so `slop-approve` can only deny it. Deploys to routers
are a typical use.
- `auto` operations are rate-limited per requester, so a looping agent can't hammer boxes or APIs.
- Pending requests are capped per requester and overall to limit notification spam. If the broker
restarts, pending requests and leases are dropped.
### Home Assistant notifications
The broker keeps an outbound connection to Home Assistant's
[WebSocket API](https://developers.home-assistant.io/docs/api/websocket/) and sends a
[Companion actionable notification](https://companion.home-assistant.io/docs/notifications/actionable-notifications/)
for each `ask` request.
- The notification text is built from the scope, followed by the agent's label. Requests that
reveal a secret or change recipients are marked.
- Notifications are sticky and persistent: tapping one doesn't remove it, and before Android 14 it
can't be swiped away either. The broker clears each one once its request is answered, expires or
is cancelled. Since Android 14, users can dismiss even persistent notifications, and apps can't
prevent it. A dismissed request stays pending until it's answered elsewhere or expires.
- A possible fix: the Companion app fires `mobile_app_notification_cleared` when a notification is
dismissed. The broker could watch for it and re-post the notification while its request is still
pending, on a quiet notification channel so it doesn't alert again. Check first that the event
carries the notification's `tag`. The approvals web app (below) makes this matter less.
- Action IDs are random and never shown to the VM. A reply must match a live action and the
configured `device_id`: the Companion app's own ID, which differs from the device registry's.
The broker logs the ID of any answer it ignores, which is how to find it. Home Assistant, and
anyone who can fire events on it, is trusted to approve.
- If the connection fails, requests stay pending; a failure never approves anything. When the
broker reconnects, it reissues pending notifications with new action IDs.
### Approvals web app
Phone notifications are easy to lose, and a terminal isn't always at hand. The broker serves a web
@@ -213,11 +189,10 @@ worker answers with the session like the page does. Requests that need a passkey
- **Endpoints.** The broker only accepts subscriptions at the major push services (Google's
`fcm.googleapis.com` and `jmt<N>.google.com`, Mozilla, Apple, Microsoft), so a session can't make
it send requests elsewhere.
| Channel | Arrives with the app closed | Action buttons | Who can read it on the way | Needs |
|---|---|---|---|---|
| Web Push to the web app | Android; desktop while the browser runs; iOS 16.4 and later once added to the Home Screen | Yes, except on iOS | Nobody: the payload is end-to-end encrypted to the browser | An OIDC provider and a reverse proxy |
| [Home Assistant Companion](#home-assistant-notifications) | Yes | Yes | Google: pushes go through Firebase Cloud Messaging, encrypted only in transit, except with Local Push while the app holds its own connection to Home Assistant | Home Assistant |
- **Replacing Home Assistant.** The broker used to send Home Assistant Companion notifications
instead. Those pass through Firebase Cloud Messaging readable in transit, can be swiped away on
Android 14 and later with nothing to fall back on, and need an admin user on Home Assistant. Web
Push is end-to-end encrypted, and the page holds every pending request.
### Request details
@@ -230,7 +205,7 @@ what needs attention, such as a secret whose content belongs to another file.
marked as code (commands, commits, paths, keys) are in monospace, and diffs are coloured.
- **Everything else** shows the text rendering: a field per line, then each section under its
title, with tables in aligned columns and warnings marked `⚠`. `slop-approve` shows it as it is,
Home Assistant and Web Push a cut-down version that puts headline fields first.
and Web Push a cut-down version that puts headline fields first.
- **Audit log and passkeys:** the audit log keeps the text rendering, so old records read the same
whatever the structure becomes, and passkey confirmations fingerprint it.
- **Limits:** each value, row count and text section is capped, and sections past the total limit