Repository navigation
feat(notifications): add focus-aware delivery modes - #133393
roboclaw-bot wants to merge 1 commit into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
@clawsweeper review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: blocked before merge. What this changesAdds account and per-device browser notification delivery modes, preserves Boolean RPC clients, and suppresses notifications when the service worker considers their destination focused. Review scores
Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 9 items remain The feature remains distinct from current main and the related merged work. Boolean RPC compatibility is repaired, but the five previously reported findings remain on the unchanged head, including a browser-contract violation that can disable subsequent notifications. The protected maintainer label also excludes cleanup closure. Priority: P2 Before merge
Findings
Agent review detailsHow this fits togetherThe Gateway selects authorized browser subscriptions and sends approval or attention events through Web Push. The Control UI stores notification preferences and its service worker decides whether to display each received push. flowchart TD
A[Approval and attention events] --> B[Gateway recipient checks]
C[Account and device preferences] --> B
B --> D[Browser push service]
D --> E[Service worker focus decision]
F[Focused browser windows] --> E
E --> G[Display or suppress notification]
Technical reviewBest possible solution: Implement device-specific focus avoidance through a browser-supported delivery boundary, using committed session and active Gateway identity, while preserving existing preferences and documenting the resulting semantics. Do we have a high-confidence way to reproduce the issue? Yes, the patch defects have concrete source-backed triggers: a focused destination omits showNotification, an unrelated same-origin window suppresses untargeted pushes, and route/Gateway mismatches produce incorrect decisions. No browser reproduction was executed in this read-only review. Is this the best way to solve the issue? No. Suppressing an already-received Web Push violates the supported WebKit contract; focus avoidance must happen through a supported delivery design, with session and Gateway identity rather than raw URL equality. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d641ea18101f. Merge-risk optionsMaintainer options:
SecurityNone. EvidenceWhat I checked:
PR surfaceSource +232, Tests +330. Total +562 across 19 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (4 earlier review cycles)
Reviewed October 7, 2026, 8:00 AM ET / 12:00 UTC (Revision 5). |
d0bab96 to
9179fbc
Compare
|
Addressed ClawSweeper's P1 compatibility finding in The preference write schema now accepts either legacy booleans or delivery modes, while the read schema and stored representation remain canonical modes. Validation after the repair:
The listed rank-up move is applied; no move was skipped. |
Add Never, Only when unfocused, and Always modes to every browser push category, with destination-aware suppression in the Control UI service worker. Preserve existing boolean preferences during the transition. Co-authored-by: Takhoffman <[email protected]> Worked on by: - @Takhoffman
9179fbc to
4b63003
Compare
|
Addressed ClawSweeper's second P1 rolling-upgrade finding in
Added boundary proof for both response generations and an assertion that current UI reads always advertise the capability. Final local validation: 170 focused tests passed, Both listed compatibility rank-up moves are applied; none were skipped. Real PWA suppression proof remains a known optional proof gap; the destination/focus decision is covered by the service-worker harness and the UI controls by inspected Chromium screenshots. |
Closes #133392
What Problem This Solves
Browser push categories were binary on/off. Users actively reading a destination chat still received a redundant push for that chat, while turning the category off also removed useful background notifications.
Why This Change Was Made
This adds one delivery-mode contract across every browser push category: Never, Only when unfocused, and Always. Account defaults and per-device overrides share the same choices. Existing stored booleans normalize to the equivalent canonical modes.
The preference RPC remains additive across rolling Gateway/UI upgrades. Older open Control UI clients can continue writing booleans and, because they omit the new
deliveryModesread capability, receive Boolean-compatible preference responses. Current clients advertisedeliveryModes: trueand receive canonical modes. Writes normalize immediately; durable state stays mode-only.The service worker owns device-local focus suppression. For a notification with a destination, it suppresses only when a visible, focused OpenClaw window reports the exact route. Destination-less notifications use any focused OpenClaw window. Missing, stale, malformed, cross-origin, or unresponsive client state fails open and shows the notification. Focus state never leaves the browser and one device cannot silence another.
Defaults remain conservative and compatible: approval requests are Always; agent turns, questions, scheduled-task failures, and background-task failures remain Never until enabled.
User Impact
Users can enable turn and other browser notifications without being alerted for work they are already viewing. They can choose different urgency per category and override the account choice on an individual browser or app. Already-open pre-upgrade Control UI tabs retain correct checkbox reads and saves after the Gateway updates.
Before: binary category checkboxes
After: account delivery modes
After: per-device overrides
Evidence
node scripts/run-vitest.mjs src/gateway/approval-web-push.test.ts src/gateway/event-web-push.test.ts src/gateway/server-methods/push.test.ts src/infra/push-web-preferences.test.ts src/infra/push-web.test.ts ui/src/app/service-worker-cache.test.ts ui/src/app/web-push.test.ts ui/src/pages/config/notifications-section.test.ts— 170 tests passed across four Vitest shards, including old/new read negotiation and legacy account/device writes.node scripts/check-changed.mjs— passed core, core-test, and UI formatting, typecheck, lint, i18n, dependency, storage, and architecture gates after both compatibility repairs..agents/skills/autoreview/scripts/autoreview --mode local --base 42396a01eba0c732d6618c3f88d37a1909529324— complete PR candidate scoped clean; no accepted/actionable P0 findings.4b630039216d295a50f5331d4c1077430af8e83cis being revalidated separately.42396a01eba; after images use the same UI implementation retained in the final head. Every attached image was inspected at full resolution.ClawSweeper follow-up
The first review identified legacy Boolean writes; the second identified legacy Boolean reads. The final head keeps canonical modes internally, accepts Boolean writes from old clients, negotiates Boolean reads when the mode capability is absent, and adds Gateway/UI boundary proof for both generations. All listed rank-up moves are applied; none were skipped.
Worked on by