Repository navigation
feat: add secure PWA approval notifications and preferences - #129348
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
26592de to
156577c
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed August 29, 2026, 10:42 PM ET / August 30, 2026, 02:42 UTC. ClawSweeper reviewWhat this changesAdds targeted Control UI PWA push notifications for approval requests, per-device and per-user notification preferences, and browser-subscription recovery handling. Warning SQLite table change This PR modifies persisted SQLite tables in Merge readinessKeep open for explicit maintainer review: the implementation appears to enforce targeted delivery correctly, but it introduces material shared-SQLite retention and recovery semantics that require recorded maintainer acceptance. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway records browser push subscriptions, checks their current device/profile authorization when an approval needs attention, and sends an encrypted alert to the Control UI PWA. The PWA reconciles its browser subscription with the Gateway and exposes notification controls in Settings. flowchart LR
A[Approval request] --> B[Gateway authorization]
B --> C[Current device and profile binding]
C --> D[Durable delivery record]
D --> E[Web Push sender]
E --> F[Control UI PWA]
F --> G[Authenticated approval page]
Decision needed
Why: This is a material persistent-state and operator-policy choice that source inspection cannot make on behalf of maintainers. Before merge
Agent review detailsSecurityNone. PR surfaceSource +2503, Tests +3203, Docs +63, Generated +12, Other +2. Total +5783 across 72 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Record explicit maintainer acceptance of the shared-state lifecycle contract, then merge only after ordinary exact-head review and checks complete. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR introduces a new approval-notification capability rather than repairing a demonstrated current-main failure. Is this the best way to solve the issue? Unclear pending an explicit durable-state decision; the targeted authorization design is source-supported, but maintainers must choose whether to retain this persistence lifecycle. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2646feaaf553. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (32 earlier review cycles; latest 8 shown)
|
|
Production-boundary approval Web Push proof is complete on the latest local patch. The isolated run used production device pairing/approval, profile-role persistence, shared SQLite subscription storage, VAPID signing, payload encryption, and the real {
"allowed": { "delivered": true, "outgoingRequests": 1 },
"revoked": { "delivered": false, "outgoingRequestsAdded": 0 },
"reassigned": { "delivered": false, "outgoingRequestsAdded": 0 },
"transport": {
"status": 201,
"contentEncoding": "aes128gcm",
"ttl": "60",
"urgency": "high",
"authorizationPresent": true,
"plaintextLeaked": false
}
}Sequence:
This satisfies the ClawSweeper final-effect authority ask. A real Apple/Google phone notification display is still not claimed; that remaining vendor-display gap is now stated in the PR body. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
156577c to
bfc8136
Compare
|
Addressed the final ClawSweeper finding on
The earlier production-boundary allowed/revoked/reassigned HTTPS proof remains valid. Exact-head hosted CI is running on a @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
Closes #129347
Related: #93724
AI-assisted.
What Problem This Solves
Installed Control UI PWAs can test Web Push, but operators were not notified when time-sensitive approvals or configured agent/task events needed attention. The subscription store also lacked enough durable ownership information to target notifications safely after a browser disconnect or Gateway restart.
This PR adds authenticated, device/profile-bound PWA notifications, account and device preferences, restart-safe approval lifecycle handling, and a clear multi-Gateway browser contract.
How It Works
Each Web Push subscription is bound server-side to the paired browser device and canonical user profile that registered it. Request, terminal/restart, and configured event delivery share one authorization owner.
Immediately before network I/O, delivery checks current runtime policy, paired-device token and scopes, profile role, subscription binding, preferences, and approval/session visibility. Missing roles fail closed. Sender invocation remains in the same synchronous continuation as the final authority read.
Approval payloads are intentionally generic: no command, working directory, prompt, plugin detail, or session metadata appears on the lock screen. Resolution, expiry, abort, and authority closure always replace an actionable approval with a generic same-tag terminal notification, regardless of optional alert preferences or quiet hours. Durable delivery targets preserve that cleanup across Gateway restart.
One service-worker registration owns one browser subscription and VAPID identity. Separate PWA scopes remain independent. Switching between equally trusted Gateways requires a shared VAPID keypair; mismatches fail visibly without destroying the existing browser subscription. Operators can explicitly reset a mismatched local subscription even when the current Gateway no longer owns its server row. Reconciliation and in-flight actions are fenced across Gateway switches and preference invalidation.
Preferences and Defaults
Fresh preferences enable only the essential Approval requested alert. Optional alerts default off:
Operators can also configure lock-screen detail, quiet hours and time zone, agent filters, account defaults, per-device overrides, device labels, test notifications, and unsubscribe controls. Existing stored preferences are preserved.
Preference updates use a scope-discriminated protocol union so account and device payloads cannot be mixed. Rapid edits are serialized from the latest acknowledged state, and invalid IANA time zones are rejected rather than silently disabling quiet hours.
Persistent Surface
device_id,user_profile_id, andpreferences_jsoncolumns onweb_push_subscriptions.web_push_approval_deliveriestable/index with cascading approval and subscription foreign keys.config_machine_state; the retiredweb_push_vapid_keystable is not restored.Screenshots
Complete notification settings and defaults
iPhone and iPad installation guidance
Mobile approval actions
Terminal approval state
Remote Gateway confirmation
Validation
Exact remote head:
34d02eb8774da3cd58a04475751a5caef84d42cc, rebased ontoorigin/maina202e76e78d370beb9bc9835fbcfb9a6414c7e49.node scripts/check-changed.mjscompleted formatting, policy, dependency, plugin-boundary, dead-export, i18n, core/test/UI/extension typecheck and lint, schema-v15, database-first, and import-cycle checks. The post-rebase changed gate is also green.pnpm buildpassed outside the process sandbox, including native-require postbuild and package/declaration checks. The final post-rebase Control UI build passes at 346,432 B gzip against the 346,761 B enforcement limit.Detailed earlier evidence: #129348 (comment)
Review Status
All actionable findings from the latest published ClawSweeper review are addressed on this head, including stable pagination beyond 1,024 terminal approvals, current-Gateway VAPID mismatch state/reset, subscription ownership transfer, and bounded display labels. Fresh exact-head ClawSweeper review and CI are pending and must be green before squash merge.
A real installed-PWA Apple/Google OS notification banner was unavailable, so that display path is not claimed. Browser UI, service-worker behavior, encrypted outbound delivery, authorization, persistence, and restart recovery are covered deterministically.
Change Size
Worked on by
View the OpenClaw team session