Skip to content

feat(mac): show native notification permission in dashboard Notifications settings - #110646

Merged
steipete merged 2 commits into
mainfrom
claude/mac-app-notification-resync-dfff75
Jul 18, 2026
Merged

steipete merged 2 commits into
mainfrom
claude/mac-app-notification-resync-dfff75

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The Control UI Settings → Notifications page only knows about browser web push. Inside the macOS app's embedded dashboard (WKWebView), web push is unsupported, so the page shows "Unsupported / Not subscribed" even though the Mac app delivers notifications natively through UNUserNotificationCenter (the node runtime's notify path). Users see a dead, misleading settings page in the app that actually has the best notification support.

Why This Change Was Made

The dashboard webview is "only partially a website": the host app owns notification delivery, so the page must reflect the host's native permission state instead of browser push capability. This adds a small WebKit script-message bridge (openclawNotifications) following the existing dashboard bridge patterns (openclawLink, openclawWindowDrag, openclawUpdate):

  • The Mac app registers the handler on the dashboard webview and answers status / request-permission / send-test requests, publishing {permission: granted|denied|notDetermined} back via the same CustomEvent+global pattern as the native history bridge. request-permission reuses PermissionManager.ensure([.notifications], interactive: true), which prompts when undetermined and opens System Settings → Notifications when denied. send-test posts a real native notification.
  • The Control UI probes the handler; when present, the Notifications settings section renders native state (permission chip, Enable / Open System Settings / Send test) instead of the web-push rows. Browsers keep the existing web-push UI unchanged. Permission changes made in System Settings are picked up on window focus.
  • The notifications section renderer moved out of the grandfathered oversized ui/src/pages/config/view.ts into ui/src/pages/config/notifications-section.ts.

User Impact

Mac app users see real notification state on Settings → Notifications: whether the app can notify, a one-click permission request, a shortcut to System Settings when denied, and a native test notification. No behavior change for browsers or other hosts (handler absent → web-push UI as before).

Evidence

  • cd apps/macos && swift build — Build complete (verified twice, including after the .ephemeral cleanup below).
  • cd apps/macos && swift test --filter DashboardNotificationsBridgeTests — 3 tests pass (request parsing, invalid-request rejection, permission-label mapping including raw-value-4 ephemeral → notDetermined).
  • New UI unit tests in ui/src/app/native-notifications.test.ts cover bridge probe, status seeding from the injected global, event validation, focus re-sync, action posting, and dispose; they run in the UI CI lane (this worktree has no node_modules, so UI test execution is delegated to hosted CI per repo policy).
  • git diff --check clean; changed TS files formatted with oxfmt.
  • Structured autoreview (Codex gpt-5.6-sol): one P1 raised on an earlier revision (UNAuthorizationStatus.ephemeral is unavailable-by-name on macOS; it compiled only because pattern position tolerates it). Resolved by dropping the case into a commented default branch; the rerun reports "patch is correct" with zero findings.
  • ui/src/pages/config/view.ts (grandfathered oversized) shrank by ~150 lines via the section extraction; web-push rendering is byte-identical to before.
  • Trust guards on the new bridge mirror receiveUpdateMessage: main frame only, same webview, isTrustedLinkSource origin/path check.

…ions settings

The Mac app's embedded Control UI showed the web-push section as
Unsupported/Not subscribed even though the app delivers notifications
natively. The dashboard now installs an openclawNotifications WebKit
bridge (status / request-permission / send-test) and the Notifications
settings page renders native permission state with Enable, Open System
Settings, and Send test actions when hosted in the Mac app. Browsers
keep the existing web-push UI. The notifications section renderer moved
out of the oversized config view module.
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: macos App: macos app: web-ui App: web-ui size: L maintainer Maintainer-authored PR labels Jul 18, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jul 18, 2026
@clawsweeper

clawsweeper Bot commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 18, 2026, 8:15 AM ET / 12:15 UTC.

Summary
The branch adds a trusted macOS WebKit notification bridge and native permission controls to the embedded Control UI Notifications settings, while retaining browser web-push behavior elsewhere.

PR surface: Source +239, Tests +140, Docs +5, Other +123. Total +507 across 15 files.

Reproducibility: no. high-confidence live reproduction was supplied. The source-level path is clear: a provisional status is rendered as granted while the reviewed native sender accepts only authorized status.

Review metrics: 1 noteworthy metric.

  • Native bridge actions: 3 actions added. The new status, permission-request, and test-notification messages cross from web content into the macOS host and need boundary review beyond ordinary UI checks.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🦐 gold shrimp
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Make provisional authorization match the native sender’s delivery contract.
  • [P1] Add redacted after-fix macOS evidence covering granted, denied/System Settings, focus resync, and a delivered test notification.
  • Obtain macOS owner approval for the WebKit host-action boundary.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR reports builds, focused tests, and CI but no inspectable after-fix macOS dashboard evidence showing permission recovery, focus resync, and successful native test delivery; add redacted recording, terminal output, or runtime logs before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] Provisional macOS authorization currently presents as fully granted even though the native test-delivery path documented in review accepts only .authorized, producing a visible but ineffective Send test action.
  • [P1] The new trusted WebKit bridge can request notification permission and trigger native notifications; maintainers need to confirm that its source-validation contract is appropriate for all dashboard navigation paths.
  • [P1] The reported builds and tests do not demonstrate the actual embedded-dashboard permission flow or a delivered native notification on macOS.

Maintainer options:

  1. Correct delivery semantics and prove the native flow (recommended)
    Accept provisional authorization in the native sender or render it as a distinct non-sendable state, then provide redacted macOS proof of the corrected permission and Send test paths.
  2. Pause the action bridge
    Keep the PR open for explicit macOS owner review if maintainers do not want trusted dashboard content to initiate native permission or test-notification actions.

Next step before merge

  • [P1] A mechanical provisional-state repair is available, but native host-action exposure and the protected maintainer/security boundary require explicit owner judgment plus contributor-supplied real macOS proof.

Maintainer decision needed

  • Question: Should the embedded dashboard retain a native bridge that can request OS notification permission and send a test notification after its authorization-state semantics are corrected?
  • Rationale: This is an intentional host-to-webview security boundary and user-facing capability addition; code review alone cannot determine the desired permanent trust and product contract.
  • Likely owner: steipete — The available branch history ties this contributor directly to the macOS dashboard bridge and its UI integration.
  • Options:
    • Repair and approve the bridge (recommended): Make provisional authorization deliverable or represent it accurately, add real macOS proof, and approve the documented trusted-dashboard bridge contract.
    • Narrow the bridge: Keep permission-state display but remove or redesign OS-affecting actions if maintainers do not want dashboard content to initiate them.

Security
Needs attention: The diff adds OS-affecting WKWebView bridge actions, so the trust boundary needs explicit macOS owner confirmation before merge.

Review findings

  • [P2] Handle provisional notification permission consistently — apps/macos/Sources/OpenClaw/DashboardWindowController+Notifications.swift:33-34
Review details

Best possible solution:

Align provisional authorization with native delivery semantics, obtain redacted macOS after-fix evidence for permission request, denied-settings recovery, focus resync, and test delivery, then have the macOS owner explicitly approve the WebKit bridge boundary.

Do we have a high-confidence way to reproduce the issue?

No high-confidence live reproduction was supplied. The source-level path is clear: a provisional status is rendered as granted while the reviewed native sender accepts only authorized status.

Is this the best way to solve the issue?

No. The narrowest maintainable fix is to make the displayed provisional state agree with actual native delivery behavior, then prove the full embedded macOS flow rather than relying only on unit tests.

Full review comments:

  • [P2] Handle provisional notification permission consistently — apps/macos/Sources/OpenClaw/DashboardWindowController+Notifications.swift:33-34
    .provisional is rendered as fully granted, exposing only Send test, but the existing native sender documented in the review accepts .authorized only. That leaves provisionally authorized users with a button that does not deliver a notification and no in-page route to upgrade or open settings; either make native delivery accept provisional authorization or represent it as a distinct state.
    Confidence: 0.93

Overall correctness: patch is incorrect
Overall confidence: 0.86

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 74880cb56f9e.

Label changes

Label changes:

  • add P2: The new macOS-only Notifications UI can show a Send test control that is ineffective for provisional authorization, a bounded user-facing defect.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • remove P3: Current review triage priority is P2, so this older priority label is no longer current.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.

Label justifications:

  • P2: The new macOS-only Notifications UI can show a Send test control that is ineffective for provisional authorization, a bounded user-facing defect.
  • merge-risk: 🚨 security-boundary: The PR introduces a WKWebView message handler that can invoke OS notification-permission and notification-delivery actions.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR reports builds, focused tests, and CI but no inspectable after-fix macOS dashboard evidence showing permission recovery, focus resync, and successful native test delivery; add redacted recording, terminal output, or runtime logs before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +239, Tests +140, Docs +5, Other +123. Total +507 across 15 files.

View PR surface stats
Area Files Added Removed Net
Source 8 401 162 +239
Tests 1 140 0 +140
Docs 2 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 4 125 2 +123
Total 15 671 164 +507

Security concerns:

  • [medium] Confirm native notification bridge trust boundary — apps/macos/Sources/OpenClaw/DashboardWindowController+Notifications.swift:45
    The handler lets trusted dashboard content request OS notification permission and send a native notification. The stated main-frame, same-webview, and trusted-source guards are the correct kind of controls, but the security-sensitive host-action exposure requires explicit maintainer confirmation alongside real runtime proof.
    Confidence: 0.77

What I checked:

Likely related people:

  • steipete: The available feature history attributes both the native-notification bridge implementation and its follow-up integration cleanup to this contributor; current-main ownership history was not available in the supplied review evidence. (role: recent macOS dashboard contributor; confidence: low; commits: 2d60496e92df, 0af3c8b2073d; files: apps/macos/Sources/OpenClaw/DashboardWindowController+Notifications.swift, ui/src/app/native-notifications.ts, ui/src/pages/config/notifications-section.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (1 earlier review cycle)
  • reviewed 2026-07-18T11:14:12.479Z sha 2d60496 :: needs real behavior proof before merge. :: none

…n gates

Move the notifications section props to a leaf contract (no view.ts
type import), unexport the status-event constant, use bracket access
for the injected dunder global, default-case the status switch, and
refresh the native i18n inventory line offset.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0af3c8b207

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +34 to +35
case .authorized, .provisional:
"granted"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat provisional notification permission consistently

When macOS reports .provisional (Apple documents it as provisionally authorized to post noninterruptive notifications: https://developer.apple.com/documentation/usernotifications/unauthorizationstatus/provisional), this maps the dashboard UI to granted, which shows only the native “Send test” action. That action calls NotificationManager().send, but apps/macos/Sources/OpenClaw/NotificationManager.swift only accepts .authorized, so provisional users get a button that silently fails and no in-page way to request full permission or open Settings; either keep provisional out of the granted UI state or make the native send path accept it.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. P2 Normal backlog priority with limited blast radius. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 18, 2026
@steipete
steipete merged commit 42133d0 into main Jul 18, 2026
247 of 255 checks passed
@steipete
steipete deleted the claude/mac-app-notification-resync-dfff75 branch July 18, 2026 13:13
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 19, 2026
…ions settings (openclaw#110646)

* feat(mac): show native notification permission in dashboard Notifications settings

The Mac app's embedded Control UI showed the web-push section as
Unsupported/Not subscribed even though the app delivers notifications
natively. The dashboard now installs an openclawNotifications WebKit
bridge (status / request-permission / send-test) and the Notifications
settings page renders native permission state with Enable, Open System
Settings, and Send test actions when hosted in the Mac app. Browsers
keep the existing web-push UI. The notifications section renderer moved
out of the oversized config view module.

* fix(ui): break config view import cycle and satisfy lint/deadcode/i18n gates

Move the notifications section props to a leaf contract (no view.ts
type import), unexport the status-event constant, use bracket access
for the injected dunder global, default-case the status switch, and
refresh the native i18n inventory line offset.
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…ions settings (openclaw#110646)

* feat(mac): show native notification permission in dashboard Notifications settings

The Mac app's embedded Control UI showed the web-push section as
Unsupported/Not subscribed even though the app delivers notifications
natively. The dashboard now installs an openclawNotifications WebKit
bridge (status / request-permission / send-test) and the Notifications
settings page renders native permission state with Enable, Open System
Settings, and Send test actions when hosted in the Mac app. Browsers
keep the existing web-push UI. The notifications section renderer moved
out of the oversized config view module.

* fix(ui): break config view import cycle and satisfy lint/deadcode/i18n gates

Move the notifications section props to a leaf contract (no view.ts
type import), unexport the status-event constant, use bracket access
for the injected dunder global, default-case the status switch, and
refresh the native i18n inventory line offset.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos app: web-ui App: web-ui docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: L status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant