You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 20a6147
Browse filesBrowse the repository at this point in the historyBrowse files
authored
feat: add secure PWA approval notifications and preferences (#129348)
* feat: notify PWAs about approval requests
* feat: add configurable Web Push notifications
* fix: harden web push lifecycle
* fix: close web push review findings
Co-authored-by: Tak Hoffman <[email protected]>
Worked on by:
- @Takhoffman
* fix(plugins): preserve install failure cause
Co-authored-by: Tak Hoffman <[email protected]>
Worked on by:
- @Takhoffman
* perf(ui): trim notification startup copy
Co-authored-by: Tak Hoffman <[email protected]>
Worked on by:
- @Takhoffman
* test: align notification metadata contracts
Co-authored-by: Tak Hoffman <[email protected]>
Worked on by:
- @Takhoffman
* fix: complete web push recovery lifecycle
Co-authored-by: Tak Hoffman <[email protected]>
Worked on by:
- @Takhoffman
* test(codex): stabilize persistent startup retry
Co-authored-by: Tak Hoffman <[email protected]>
Worked on by:
- @Takhoffman
* chore: drop superseded plugin lint workaround
Co-authored-by: Tak Hoffman <[email protected]>
Worked on by:
- @Takhoffman
* test(android): await replacement connection readiness
Co-authored-by: Tak Hoffman <[email protected]>
Worked on by:
- @Takhoffman
* test(ui): await Workboard picker expansion
Co-authored-by: Tak Hoffman <[email protected]>
Worked on by:
- @Takhoffman
* fix: sanitize web push display labels
Co-authored-by: Tak Hoffman <[email protected]>
Worked on by:
- @Takhoffman
* test(codex): stabilize persistent startup retry under load
Co-authored-by: Tak Hoffman <[email protected]>
Worked on by:
- @Takhoffman
* fix(web-push): repair subscription recovery and scoped delivery
Keep mismatched browser subscriptions explicitly recoverable in Settings,
and share registration validation between manual enablement and reconnects.
Use the canonical display sanitizer for notification labels while retaining
raw IDs for authorization and filtering. Honor implied admin scopes for
question notifications through the shared target resolver.
Consolidate duplicate state and display helpers, expand boundary regression
coverage, and document reset and re-enablement.
Co-authored-by: roboclaw-bot <[email protected]>
Co-authored-by: Tak Hoffman <[email protected]>
* fix(web-push): complete explicit recovery state and label normalization
Share one subscription state contract across the capability and Settings,
keep stale browser subscriptions resettable, and consolidate key validation.
Provide the canonical label normalizer used by delivery and preferences,
with raw agent identifiers preserved for authorization and allowlists.
Document the reset flow and cover reconnect, manual enable, first-send,
native notifications, and stale Gateway transitions.
Co-authored-by: roboclaw-bot <[email protected]>
Co-authored-by: Tak Hoffman <[email protected]>
* fix: preserve aggregate failure causes
Co-authored-by: Tak Hoffman <[email protected]>
Worked on by:
- @Takhoffman
* fix(ui): fence web push actions to current gateway
Co-authored-by: Tak Hoffman <[email protected]>
Worked on by:
- @Takhoffman
* fix(web-push): enforce subscription ownership through recovery
Share device/profile authorization across preferences and unsubscribe, atomically fence deletion, and require existing subscription keys for ownership transfers.
Co-authored-by: roboclaw-bot <[email protected]>
Co-authored-by: Tak Hoffman <[email protected]>
* fix(ui): settle passive push lookup without worker activation
Use the current service worker registration for existing subscription reads and unsubscribe. Keep readiness waiting only for explicit enablement.
Co-authored-by: Tak Hoffman <[email protected]>
* test(ui): keep a bound unsubscribe mock assertion
* fix(web-push): preserve implied scope authority
Co-authored-by: Tak Hoffman <[email protected]>
Worked on by:
- @Takhoffman
* fix(web-push): close final review findings
Co-authored-by: Tak Hoffman <[email protected]>
Worked on by:
- @Takhoffman
* fix(qa-lab): preserve aggregate causes portably
Co-authored-by: Tak Hoffman <[email protected]>
Worked on by:
- @Takhoffman
* fix(plugins): preserve install failure cause
Co-authored-by: Tak Hoffman <[email protected]>
Worked on by:
- @Takhoffman
---------
Co-authored-by: roboclaw-bot <[email protected]>
Co-authored-by: Tak Hoffman <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Copy file name to clipboardExpand all lines: docs/web/control-ui.md
+11-7Lines changed: 11 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -691,12 +691,12 @@ See [Notifications](/web/notifications) for the browser and macOS setup steps.
691
691
692
692
If the page shows **Protocol mismatch** right after an OpenClaw update, first reopen the dashboard with `openclaw dashboard` and hard-refresh. If it still fails, clear site data for the dashboard origin or test in a private browser window; an old tab or browser service-worker cache can keep running a pre-update Control UI bundle against the newer Gateway.
Upgrades from the retired `push/vapid-keys.json` and `push/web-push-subscriptions.json` stores are imported by `openclaw doctor --fix`. Stop the Gateway before running that repair so an older process cannot recreate retired state during import. Run the repair before using Web Push after an upgrade; registration, delivery, deletion, and key resolution refuse to proceed while either retired source or an interrupted Doctor claim remains. The Gateway runtime reads and writes SQLite only.
702
702
@@ -706,13 +706,17 @@ Override the VAPID keypair through env vars on the Gateway process when you want
706
706
-`OPENCLAW_VAPID_PRIVATE_KEY`
707
707
-`OPENCLAW_VAPID_SUBJECT` (defaults to `https://openclaw.ai`)
708
708
709
+
One service-worker registration scope has one browser push subscription and therefore one application-server key. If one installed PWA switches among multiple logical Gateways, configure the same public/private VAPID pair on every Gateway and set each Gateway's `gateway.publicOrigin`; otherwise registration fails closed with a VAPID-identity mismatch. Sharing the private VAPID key and browser endpoint creates one push-signing trust domain, so do this only among mutually trusted Gateways. PWAs installed from separate HTTPS origins or base-path scopes have separate registrations and do not need to share keys.
710
+
709
711
The Control UI uses these scope-gated Gateway methods to register and test browser subscriptions:
710
712
711
713
-`push.web.vapidPublicKey` fetches the active VAPID public key.
712
-
-`push.web.subscribe` registers an `endpoint` plus `keys.p256dh`/`keys.auth`.
714
+
-`push.web.subscribe` registers an `endpoint` plus `keys.p256dh`/`keys.auth`; the Gateway binds it to the authenticated browser device and current user profile.
713
715
-`push.web.unsubscribe` removes a registered endpoint.
714
716
-`push.web.test` sends a test notification to registered browser subscriptions.
715
717
718
+
Pending exec and plugin approvals also trigger Web Push. Approval delivery is narrower than `push.web.test`: the Gateway targets only bound subscriptions whose paired device, current operator token, profile role, and approval visibility still authorize the request. Legacy unbound subscriptions stay test-only until the Control UI reconnects and reconciles them. Push payloads contain generic text and an authenticated `/approve/<approvalId>` link, not approval details.
719
+
716
720
<Note>
717
721
Web Push is independent of the iOS APNS relay path (see [Configuration](/gateway/configuration) for relay-backed push) and the `push.test` method, which targets native mobile pairing.
Copy file name to clipboardExpand all lines: docs/web/notifications.md
+47-8Lines changed: 47 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,19 +7,19 @@ read_when:
7
7
- Comparing Control UI notifications with mobile push
8
8
---
9
9
10
-
OpenClaw can ping you when something needs your attention — in the browser that runs the Control UI, or through native macOS notifications when you use the OpenClaw macOS app. Your first chat send may request permission automatically; **Settings → Notifications** remains the place to enable or repair the current device, check its status, and send yourself a test.
10
+
OpenClaw can ping you when something needs your attention — including an exec or plugin approval request — in the browser that runs the Control UI, or through native macOS notifications when you use the OpenClaw macOS app. Your first chat send may request permission automatically; **Settings → Notifications** remains the place to enable or repair the current device, check its status, and send yourself a test.
11
11
12
12
This page covers those two surfaces. It does not control channel reaction notifications, Android notification forwarding, or iOS background push — the mobile apps register for push through their own node paths; see [iOS](/platforms/ios) and [Nodes](/nodes).
13
13
14
14
## Which surface you get
15
15
16
16
What the Notifications page controls depends on where you opened it:
17
17
18
-
| Where Settings is open | Transport | What you can do |
| Supported web browser or installed Control UI PWA | Browser Push API via the Control UI service worker |Grant permission, subscribe or unsubscribe this browser, send a test|
21
-
| OpenClaw macOS app | Native macOS notifications | Grant app permission, jump to System Settings when blocked, send a local test |
22
-
| Browser without Push API support | None | Status only; enable and test stay unavailable |
18
+
| Where Settings is open | Transport | What you can do |
| Supported web browser or installed Control UI PWA | Browser Push API via the Control UI service worker |Receive approval requests, manage this browser's subscription, and send a test |
21
+
| OpenClaw macOS app | Native macOS notifications | Grant app permission, jump to System Settings when blocked, send a local test |
22
+
| Browser without Push API support | None | Status only; enable and test stay unavailable |
23
23
24
24
The macOS app deliberately uses the native permission flow instead of browser push — that is the notification system your Mac already respects.
25
25
@@ -33,9 +33,42 @@ The Control UI asks for notification permission automatically the first time you
33
33
4. Allow notifications when the browser asks.
34
34
5. Select **Send test** — a test notification should arrive within a few seconds.
35
35
36
-
Behind the scenes, enabling creates a push subscription in this browser and registers its endpoint and keys with the Gateway. The Gateway keeps browser subscriptions and its VAPID signing key in `state/openclaw.sqlite` — there is no `openclaw.json` key to edit. When the Control UI reconnects, existing subscriptions are reconciled with the Gateway automatically.
36
+
Behind the scenes, enabling creates a push subscription in this browser and registers its endpoint and keys with the Gateway. The Gateway binds the subscription to the browser's paired device and, when operator roles are enabled, its authenticated user profile. The Gateway keeps browser subscriptions and its VAPID signing key in `state/openclaw.sqlite` — there is no `openclaw.json` key to edit. When the Control UI reconnects, existing subscriptions are reconciled with the Gateway automatically.
37
37
38
-
**Send test** asks the Gateway to push a test message to every registered browser subscription. **Unsubscribe** removes the current browser's endpoint from the Gateway, then unsubscribes locally.
38
+
Approval notifications use generic lock-screen text; command, working-directory, prompt, and plugin details stay out of the push payload. Selecting the notification opens the authenticated `/approve/<approvalId>` page. Before each send, the Gateway rechecks the paired device's current approval scopes, operator role, user profile, and approval visibility. A revoked or downgraded browser stops receiving approval pushes without needing to unsubscribe first.
39
+
40
+
### Choose what reaches each device
41
+
42
+
After subscribing, **Settings → Notifications** exposes two preference layers:
43
+
44
+
-**Account defaults** follow a durable authenticated user profile across devices. They control approval requests and updates, agent completion, agent questions, scheduled-task failures, background-task failures, lock-screen detail, quiet hours, timezone, and an optional agent allowlist.
45
+
-**This browser or app** can mute one browser profile or installed Home Screen app, add a source label, or override individual categories without changing the account defaults. Native OpenClaw app notifications are configured separately.
46
+
47
+
Owner-style Gateways without a durable user profile keep the same controls, but store them only with the current browser subscription. Preferences never grant access: every delivery still rechecks the paired device, current role and scopes, authenticated profile, and session visibility. Multi-user events without an authoritative session owner are suppressed instead of being broadcast to every operator.
48
+
49
+
The default preserves the original behavior: approval request and resolution notifications are enabled, while newly added attention categories are opt-in. Quiet hours suppress matching sends rather than queueing stale alerts for later delivery.
50
+
51
+
The detail levels are:
52
+
53
+
-**Private** — generic attention text only.
54
+
-**Names only** — may include a sanitized device, agent, task, or automation label.
55
+
-**Detailed** — currently uses the same bounded, sanitized producer-owned labels; raw prompts, command arguments, output, environment values, and errors never enter the push payload.
56
+
57
+
On iPhone and iPad, Web Push is available only after installing the Control UI with **Share → Add to Home Screen** and opening that installed app. A normal Safari tab remains usable for the Control UI, but the Notifications page reports the install requirement and does not attempt to dereference an unavailable `PushManager`.
58
+
59
+
**Send test** asks the Gateway to push a test message to every registered browser subscription. Tests intentionally verify transport only; approval requests are targeted to authorized device bindings. **Unsubscribe** removes the current browser's endpoint from the Gateway only when its paired device and user profile still own the subscription, then unsubscribes locally. Reconnecting under another profile can transfer the browser subscription only with its existing subscription keys; knowing an endpoint alone cannot change its owner or remove it.
60
+
61
+
The Gateway sends Web Push directly to the browser vendor's push service. This works with a self-hosted Gateway and does not use the OpenClaw-hosted iOS relay.
62
+
63
+
### Use more than one Gateway on one phone
64
+
65
+
The recommended self-hosted setup is one Control UI service-worker scope per Gateway. Open or install each Gateway's PWA from its own HTTPS origin or base path, enable notifications there, and reconnect once after upgrades. Each scope then owns an independent browser subscription, and approval links return to the Gateway that created them.
66
+
67
+
A single installed PWA can also switch among remote Gateways, but every Gateway behind that PWA must use the same VAPID keypair and set `gateway.publicOrigin` to its browser-reachable HTTPS origin. Reconnect the PWA to each Gateway once so each one registers the shared browser subscription and current device/profile binding. Approval notification links stay inside the installed PWA's scope and carry the owning Gateway URL in their fragment; the Control UI removes the fragment before authentication and uses the normal remote-Gateway handoff.
68
+
69
+
The browser Push API permits only one application-server key per service-worker registration. If a PWA subscription belongs to a different VAPID key, OpenClaw removes the unusable row from the current Gateway and shows **Unavailable** and **Not subscribed**, with an error explaining the mismatch. To switch that PWA scope to the current Gateway, select **Unsubscribe**, then **Enable notifications** and **Send test**. Unsubscribing deactivates the shared browser subscription for every Gateway registered through that scope; after re-enabling, reconnect to each Gateway once.
70
+
71
+
Sharing a private VAPID key and browser endpoint makes those Gateways one push-signing trust domain. Use that layout only for Gateways you trust equally. Configure VAPID values through each Gateway process's secure environment or secret manager; do not place private keys in URLs or command arguments.
39
72
40
73
## Enable notifications in the macOS app
41
74
@@ -66,6 +99,12 @@ The Control UI waits up to 10 seconds for its service worker. If that times out
66
99
67
100
Run `openclaw doctor --fix` with the Gateway stopped. Web Push refuses to use the retired JSON stores until Doctor imports them into SQLite.
68
101
102
+
### Tests arrive but approval requests do not
103
+
104
+
Reconnect or reload the Control UI once so an older subscription is bound to the current paired device. The device must still have `operator.approvals` and `operator.read`; when Gateway roles are enabled, the current user profile's role must allow those scopes too. Approval visibility and session-sharing rules can intentionally exclude a request that the same Gateway sends to another operator.
105
+
106
+
For a single PWA that switches among Gateways, also verify that every Gateway uses the same VAPID keypair and has a browser-reachable `gateway.publicOrigin`. Separate PWA origins or base-path scopes do not need to share VAPID keys.
107
+
69
108
## Related
70
109
71
110
-[Control UI PWA and Web Push](/web/control-ui#pwa-install-and-web-push)
0 commit comments