Skip to content

feat(notifications): unify browser and native desktop delivery - #133164

Closed
steipete wants to merge 5 commits into
mainfrom
codex/unified-notifications
Closed

steipete wants to merge 5 commits into
mainfrom
codex/unified-notifications

Conversation

@steipete

@steipete steipete commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Follow-up to #129348, which merged as 20a6147. Browser notifications had Gateway preferences and delivery, while native Settings exposed a separate permission/local-test path. This connects the desktop apps to the same notification policy and gives browser and native devices one Settings experience.

Why This Change Was Made

The Gateway owns category selection, bounded lock-screen text, account defaults, device overrides, current paired-device/profile authority, and session visibility. Native subscriptions belong to exact authenticated sockets; the apps own OS permission, presentation, removal, and navigation back to the captured Gateway. The browser retains its durable Web Push transport for offline delivery. Native clicks never approve or execute anything.

Native delivery now lives for the app connection rather than a Dashboard window. Reconnect replays at most 32 recent eligible pending approvals quietly, while the Dashboard retains the complete list. Terminal events, expiry, connection replacement, and lost authority retire only the corresponding owned notifications. Swift invalidates presentation claims before suspended OS operations finish; Tauri binds delivery and click routing to each physical connection. Delayed acknowledgements cannot hide an OS presentation error. Failed native subscription attempts can be retried through Settings without restarting a healthy Gateway connection or entering an automatic reconnect loop. Settings requests are bound to the current document as well as the connection: reload, close, or replacement revokes pending work before effects. Tauri verifies the exact queued request in the top document before admitting its navigation transport, so a child frame cannot invent a privileged request.

Simplification pass: removed 152 production lines with no net test deletion. Tauri now owns notification connection state under one lock and shares its configuration-reset path; bridge URLs carry only a request ID, with payloads claimed from the current top document. Swift shares permission/subscription reconciliation and response construction. Gateway delivery prepares preferences once and removes descriptor wrappers plus the unused alternate removal path. Exact connection, document, and presentation ownership checks remain.

User Impact

Settings selects one transport: an embedded app never falls back to Web Push. Account defaults are shared; browser and native device overrides stay separate. Native Enable explicitly requests permission and restores a previously muted device without discarding its other settings. Profileless native overrides are visibly temporary and reset on reconnect. Changes to shared account defaults on another device refresh open native Settings. Existing APNS, node system.notify, pairing notices, and native exec decision dialogs remain separate.

Additional repairs carried forward after the original PR merged: completion notifications require a fact from the actual run owner (not any chat-final frame), lazy browser notification loading reports actionable reload guidance, and effective admin authority survives device/profile scope intersection without elevating either side. The startup-retry and Android fixture fixes remain included.

The protocol adds five notification RPCs and one targeted event. There are no new configuration keys, SQLite schema changes, or protocol-version bumps; preferences reuse the existing user preference store. Tauri pins the reviewed Rust listener change in tauri-plugin-notifications#1. The Windows companion gains ordinary PR test coverage without release signing or publishing.

Evidence

Validation so far:

The simplification was rechecked with 69 Gateway/preference tests, all 151 executable Linux Rust tests, the real Tauri client scenarios and WebKitGTK bridge probe, Swift app/test-bundle compilation, the complete changed-file static check, and a clean independent Codex review. The default Swift build backend stalled during SDK cache setup; the repository CI backend completed the compile-only check. Native macOS/Windows runtime proof remains outstanding.

  • Gateway owner/sibling run: 271 tests passed. Additional authenticated WebSocket/RPC plus native/approval run: 53 tests passed, including targeted delivery, reconnect registration, shared defaults, device separation, and profile handoff. These runs overlap; counts are not additive unique tests.
  • UI owner/sibling run: 160 tests passed. Four source Chromium cases passed for WebKit, Tauri, and browser/native runtime-load recovery. Four expected regression failures were observed before the host-marker and re-enable fixes.
  • Production build passed, including runtime/plugin-SDK validation and the unchanged UI bundle budget (346645 B startup gzip, below 346761 B). Native schema validation is lazy; the earlier eager import added about 209 KiB to browser startup and was removed.
  • Live Chrome and isolated Gateway: a fresh persistent browser profile registered a real Push subscription, saved device preferences, preserved them across reload/reconciliation, and had Send test accepted by the real vendor transport (HTTP 201). The service worker recorded the delivered test notification. This proves registration, settings, transport, and service-worker receipt; no visible OS banner is claimed from headless Chrome.
  • Codex startup-retry fixture: 14 tests passed on the current base. Direct upstream inspection covered fatal startup propagation and initialize ordering; the fixture now synchronizes on the handshake instead of assuming a startup delay.
  • Linux Tauri: 141 unit and 10 integration tests passed against the published Git pin with --locked; one existing logind test remains ignored. Five dependency listener-registry tests also passed.
  • Real Tauri app with the production GatewayClient, notification lease, and Settings handler plus a local WebSocket fixture: the pre-fix app could not recover after a subscription rejection. The repaired app retries and sends a test on the same socket, repeated rejection does not reconnect, older Gateways keep working, retiring a successfully retried lease triggers reconnect, and a targeted shared-preference event refreshes native settings before reconnect (the pre-fix client retained stale preferences). This is real client/RPC execution against a fixture Gateway; it does not claim native banner presentation.
  • Real WebKitGTK bridge regression: the saved pre-fix module accepted forged opaque-child-frame requests and replayed a legitimate request; the fixed module admitted only the legitimate request, revoked document authority on same-URL reload, reported an unsupported Gateway while preserving OS permission, and settled a pending request with an error after Gateway reconfiguration without publishing stale preferences. This uses the actual WebKit navigation and production bridge with a Gateway recorder, not a complete native Gateway connection.
  • Real Linux daemon proof: the actual Rust callback received default activations; dismissal did not invoke it; removing one notification left the other active and clickable; no notifications remained afterward. This used Tauri and dunst on an isolated desktop session, not a mocked notification daemon.
  • Swift app and test-bundle compilation, SwiftFormat, SwiftLint, and focused docs validation passed. An isolated Node probe of the actual injected Swift script failed before and passed after the originating-document repair; it does not execute WebKit or the OS. Expiry validation and interrupted-test regression cases compile but still require native test execution. Native macOS/Windows OS presentation is not verified: local native tests would access an operator desktop, so disposable macOS CI and platform runtime proof remain required before landing this follow-up.

The full changed-file static check passed: core/UI/plugin test types, scoped lint and styles, formatting, dead exports, protocol/state/database guards, runtime cycles, and pairing checks. The assertion-safety baseline reduction and workflow syntax were also checked. Independent Codex review of the complete candidate passed with no actionable P0–P2 findings after the native lifecycle, retry, and shared-preference repairs. Before/after UI screenshots and a live browser proof video were captured and inspected. Attachment upload is pending because the configured GitHub CLI rejects attachment arguments before upload. The screenshots use deterministic committed/current-renderer fixtures, not OS-delivery evidence.

Named follow-up: Tauri secondary Gateway discovery windows need their own authenticated native connection owners before they can expose notification controls; this PR follows the configured primary Gateway. Swift already covers primary and saved-profile Gateways.

Diff accounting against the follow-up base: production +4100/-745 (net +3355) after discounting 62 unchanged Swift subscription lines moved between files; tests/support +2400/-224; generated protocol clients +350. The production growth adds the native app-lifetime subscriptions and document/socket lifecycle owners across Swift and Tauri. Presentation and authorization policy are shared with the browser instead of duplicated. Configuration surfaces added: 0; SQLite schema changes: 0.

Known dependency boundary: Linux callbacks inherit notify-rust's trusted desktop-session-bus model and do not attest a user action. Sender binding remains a named upstream hardening follow-up; OpenClaw resolves only live owned IDs and applies normal authorization at the destination.

Thanks to the contributors to #129348; the original contributor attribution is preserved in the carried-forward commits.

steipete and others added 3 commits August 29, 2026 22:17
Record completed-run provenance at the lifecycle and reply-dispatch owners, retain explicit silence, and make failed notification modules recoverable. Synchronize the existing Codex startup fixture without a timing race.

Co-authored-by: roboclaw-bot <[email protected]>
Keep device and profile scope ceilings while retaining jointly granted admin authority for approval visibility and terminal recovery. Exercise the real visibility owners and preserve deterministic test lifecycle behavior.

Co-authored-by: roboclaw-bot <[email protected]>
Share Gateway policy and preferences while native apps own OS permission, presentation, and captured navigation. Fence document and socket lifetimes, recover failed subscriptions, and refresh account preferences across devices.

Co-authored-by: roboclaw-bot <[email protected]>
@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: android App: android app: macos App: macos app: web-ui App: web-ui gateway Gateway runtime extensions: codex app: linux size: XL maintainer Maintainer-authored PR labels Aug 30, 2026
Consolidate native connection state, permission reconciliation, and bridge replies. Prepare browser preferences once and remove unused notification wrappers.

Use notification bridge URLs only to wake the current top-document queue; preserve socket, document, and presentation lifetime checks.
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 1, 2026
@clawsweeper

clawsweeper Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed September 1, 2026, 5:14 AM ET / 09:14 UTC.

ClawSweeper review

What this changes

This branch unifies browser and native desktop notification delivery, preferences, lifecycle handling, and Control UI settings.

Merge readiness

⚠️ Ready for maintainer review - 7 items remain

Keep open: the new native notification path has two source-proven P2 defects, and its direct Git-pinned notification backend still needs source/provenance review before merge.

Priority: P2
Reviewed head: b065571bf3b224ee351b5368a4c5464df825f43d
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The feature has substantial owner-path coverage, but two P2 behavior gaps and an unreviewed native dependency prevent a higher rating.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The member-authored PR contains stated browser and native runtime evidence, but its own text leaves macOS and Windows OS-presentation coverage as a merge-readiness gap rather than external-contributor proof debt.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The member-authored PR contains stated browser and native runtime evidence, but its own text leaves macOS and Windows OS-presentation coverage as a merge-readiness gap rather than external-contributor proof debt.
Evidence reviewed 6 items Agent-filtered terminal notifications lose their agent identity: The introduced completion option reaches the broadcaster, but agent-scoped session keys deliberately omit the agent ID from the payload and options; nonempty agent allowlists reject an absent ID. Finalization has the known ID, so it should remain available privately to notification delivery.
Notification filtering rejects missing agent IDs: A selected-agent preference permits delivery only when the supplied agent ID is present in its allowlist.
Native recovery control is inaccurate on Linux and before reconnect: The UI shows Open System Settings for every denied native host, while the Tauri bridge only opens system settings on macOS and Windows; it also requests OS permission before validating the Gateway lease.
Findings 2 actionable findings [P2] Preserve the agent identifier for terminal notifications
[P2] Gate native recovery by platform and Gateway state
Security Needs attention Unreviewed Git-pinned notification backend revision: The PR changes the exact native backend revision used across desktop targets, but the pinned source could not be retrieved for contract or provenance inspection.

How this fits together

Gateway lifecycle events select eligible notification targets and send them to browser or native desktop clients. The Control UI configures notification preferences and invokes native-host permission or test actions.

flowchart LR
A[Agent run completes] --> B[Gateway terminal broadcaster]
B --> C[Notification eligibility]
C --> D[Browser push delivery]
C --> E[Native desktop bridge]
E --> F[Operating system notification]
G[Control UI settings] --> C
Loading

Decision needed

Question Recommendation
Should this direct native notification dependency update proceed only after its exact revision is source-reviewed and native platform evidence is completed? Review, repair, and prove: Review the exact dependency revision, repair both P2 paths, and provide macOS and Windows native presentation evidence before merge.

Why: The changed Git dependency executes in native notification paths, and repository policy requires explicit approval after dependency review; source access was unavailable during this review.

Before merge

  • Preserve the agent identifier for terminal notifications (P2) - For agent:&lt;id>:… sessions, this broadcaster intentionally removes params.agentId from the socket payload, but the new agentRunCompleted options also omit it. The notification owner therefore receives no ID and rejects every nonempty Only agents filter. Keep the known ID in private broadcast options (without adding it to the payload) and cover the terminal-broadcast path with an agent filter.
  • Gate native recovery by platform and Gateway state (P2) - A denied Tauri Linux host renders Open System Settings even though the bridge only opens settings on macOS and Windows. These native actions also remain enabled while disconnected, allowing permission handling before the reconnect error. Have the host advertise supported recovery actions and readiness, then cover denied Linux and disconnected-native states.
  • Resolve security concern: Unreviewed Git-pinned notification backend revision - The PR changes the exact native backend revision used across desktop targets, but the pinned source could not be retrieved for contract or provenance inspection.
  • Resolve merge risk (P1) - The updated Git-pinned native notification backend has not received source-level provenance or contract review.
  • Resolve merge risk (P1) - The PR body leaves macOS and Windows OS-presentation proof outstanding; provided checks also show a Windows companion failure without accessible logs.
  • Complete next step (P2) - The protected draft needs contributor repairs plus maintainer dependency approval and platform proof; it is not a safe automatic repair lane.

Findings

  • [P2] Preserve the agent identifier for terminal notifications — src/gateway/server-methods/chat-broadcast.ts:123-130
  • [P2] Gate native recovery by platform and Gateway state — ui/src/pages/config/notifications-section.ts:448-456
  • [medium] Unreviewed Git-pinned notification backend revision — apps/linux/src-tauri/Cargo.toml:52
Agent review details

Security

Needs attention: The direct Git-pinned native notification backend requires source and provenance review before its new native callback path can be cleared.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

Metric Value Why it matters
Implementation and test delta implementation +4,901/-823; tests +1,979/-208; docs +35/-24; generated/lock +74/-2 This is a large native and Gateway feature expansion, so the owner-boundary defects and dependency review merit resolution before merge.

Stored data model

Persistent data-model change detected: unknown-data-model-change: packages/gateway-protocol/src/schema/push.ts, unknown-data-model-change: ui/src/app/notifications-auto-prompt.ts, unknown-truncated-pull-files, vector/embedding metadata: apps/linux/src-tauri/src/gateway_notifications_bridge.rs. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Complete the native delivery gate (recommended)
    Repair the two notification paths, inspect and approve the pinned backend revision, and add macOS and Windows presentation evidence.
  2. Pause native rollout
    Keep the draft open until the dependency contract and platform-specific runtime evidence are available.

Technical review

Best possible solution:

Preserve the known agent ID privately for terminal notification filtering, advertise native recovery capabilities and connection readiness to the UI, then review the exact dependency revision and attach native platform evidence.

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

No executed reproduction was established; source traces show both failing paths with high confidence.

Is this the best way to solve the issue?

No: the proposed consolidation is directionally appropriate, but it must retain the private agent identity and accurately expose each native host's recovery capability before it is merge-ready.

Full review comments:

  • [P2] Preserve the agent identifier for terminal notifications — src/gateway/server-methods/chat-broadcast.ts:123-130
    For agent:&lt;id>:… sessions, this broadcaster intentionally removes params.agentId from the socket payload, but the new agentRunCompleted options also omit it. The notification owner therefore receives no ID and rejects every nonempty Only agents filter. Keep the known ID in private broadcast options (without adding it to the payload) and cover the terminal-broadcast path with an agent filter.
    Confidence: 0.97
  • [P2] Gate native recovery by platform and Gateway state — ui/src/pages/config/notifications-section.ts:448-456
    A denied Tauri Linux host renders Open System Settings even though the bridge only opens settings on macOS and Windows. These native actions also remain enabled while disconnected, allowing permission handling before the reconnect error. Have the host advertise supported recovery actions and readiness, then cover denied Linux and disconnected-native states.
    Confidence: 0.94

Overall correctness: patch is incorrect
Overall confidence: 0.93

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 1544e2345589.

Labels

Label changes:

  • add P2: Selected-agent completion alerts can be silently suppressed and native recovery can present a nonfunctional action, with limited notification-surface blast radius.
  • add merge-risk: 🚨 security-boundary: The PR updates a directly executed Git-pinned native notification backend whose exact source contract was unavailable for review.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The member-authored PR contains stated browser and native runtime evidence, but its own text leaves macOS and Windows OS-presentation coverage as a merge-readiness gap rather than external-contributor proof debt.

Label justifications:

  • P2: Selected-agent completion alerts can be silently suppressed and native recovery can present a nonfunctional action, with limited notification-surface blast radius.
  • merge-risk: 🚨 security-boundary: The PR updates a directly executed Git-pinned native notification backend whose exact source contract was unavailable for review.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The member-authored PR contains stated browser and native runtime evidence, but its own text leaves macOS and Windows OS-presentation coverage as a merge-readiness gap rather than external-contributor proof debt.

Evidence

Security concerns:

  • [medium] Unreviewed Git-pinned notification backend revision — apps/linux/src-tauri/Cargo.toml:52
    The PR changes the exact native backend revision used across desktop targets, but the pinned source could not be retrieved for contract or provenance inspection.
    Confidence: 0.9

Acceptance criteria:

  • [P1] Add an integration regression from terminal broadcast through a nonempty selected-agent filter.
  • [P1] Exercise denied Linux native recovery and disconnected native action states.
  • [P1] Inspect the exact Git-pinned notification backend revision and run platform-native presentation checks.

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • roboclaw-bot: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Preserve agent identity through the terminal broadcaster without exposing it in socket payloads.
  • Expose host-specific recovery capability and connection readiness in native notification status.
  • Review the exact dependency revision and add macOS and Windows notification-presentation evidence.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

@steipete

Copy link
Copy Markdown
Contributor Author

Retiring this stale feature branch. Unified browser/native notifications add five RPCs, persisted preferences, and a Git-pinned native dependency, and the branch conflicts with main and lacks native end-to-end proof. Revisit as a fresh design if needed.

Closed in a sweep of stale maintainer PRs (no activity for 7+ days). Reopen with a current reproduction if this still matters.

@steipete steipete closed this Oct 21, 2026
@RomneyDa
RomneyDa deleted the codex/unified-notifications branch October 22, 2026 05:32
steipete pushed a commit that referenced this pull request Oct 27, 2026
…144862)

fix(web-push): identify completed sessions by explicit labels

Show authorized explicit session labels in Names only and Detailed completion notifications. Keep Private notifications generic and preserve recipient authorization, generation matching, and ambiguity fallback.

Closes #143946
Related: #133164

Validation: base label regression failed; 78 focused tests and five encrypted HTTPS delivery controls passed. Exact-head CI 40586819281 has only the five existing curly lint diagnostics, matching scheduled-main 40586712140 job 122480223353; its aggregate gate is derived.

Co-authored-by: Alix-007 <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 28, 2026
…penclaw#144862)

fix(web-push): identify completed sessions by explicit labels

Show authorized explicit session labels in Names only and Detailed completion notifications. Keep Private notifications generic and preserve recipient authorization, generation matching, and ambiguity fallback.

Closes openclaw#143946
Related: openclaw#133164

Validation: base label regression failed; 78 focused tests and five encrypted HTTPS delivery controls passed. Exact-head CI 40586819281 has only the five existing curly lint diagnostics, matching scheduled-main 40586712140 job 122480223353; its aggregate gate is derived.

Co-authored-by: Alix-007 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android app: linux app: macos App: macos app: web-ui App: web-ui docs Improvements or additions to documentation extensions: codex gateway Gateway runtime 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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant