Skip to content

fix(web-push): skip agent-finished pushes to the device viewing the session - #183535

Merged
steipete merged 3 commits into
openclaw:mainfrom
holgergruenhagen:fix/web-push-skip-viewing-device
Oct 26, 2026
Merged

steipete merged 3 commits into
openclaw:mainfrom
holgergruenhagen:fix/web-push-skip-viewing-device

Conversation

@holgergruenhagen

@holgergruenhagen holgergruenhagen commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Related: #164585

What Problem This Solves

Fixes: an enabled Agent finished Web Push places a banner over the reply on the device already displaying that conversation.

User Impact

User impact: only the paired device currently showing the finished conversation skips that completion push. Other subscribed devices still receive it. Hiding the document, switching conversations, or disconnecting restores normal delivery. Question, approval, scheduled-task, and mention notifications keep their existing behavior. No new setting or protocol is introduced.

Why This Change Was Made

The Control UI already declares its visible conversations through sessions.viewers.set. The existing declarations owner now answers a device/session query, and Web Push applies it when choosing completion recipients. Missing device identity, unavailable declarations, or ambiguous session scope continues to send.

The existing WebSocket heartbeat bounds a frozen client's stale declaration; this change adds no presence store or timeout. A client that freezes before declaring itself hidden can briefly miss a completion push on that device until its connection closes.

Original fix and real-device proof by @holgergruenhagen (Holger Gruenhagen); contributor commits are preserved.

Evidence

Exact-head CI: run 40250367398 is green on e547415a67ca0a66293124ffc4ce1d83b4035d71. ClawSweeper found no actionable code issue on this head; the remaining advisory request is a captured shipped-Gateway foreground run, with the local boundary capture and live gap below.

  • Regression on main: the viewing phone and desktop both received the completion push; expected only the desktop. The eight negative controls passed.
  • All 61 delivery, viewer-presence, and connection-state tests pass before and after integrating main. Final command: TMPDIR=/private/tmp/oc-ct-chanmisc node scripts/run-vitest.mjs src/gateway/event-web-push.test.ts src/gateway/session-viewer-presence.test.ts src/gateway/server-connection-state.test.ts --maxWorkers=1 (128.66 seconds wall time; 103.89 seconds in Vitest, 74% transform and 17% test execution). The installed tooling checkout used the exact integrated base and candidate bytes because linked-checkout config resolution could not locate the UI plugin. Targeted type-aware oxlint, oxfmt, and whitespace checks pass; broad checks are delegated to exact-head PR CI. Independent Codex review found no actionable P0–P2 issues.
  • Production delta: +49 lines; tests: +99; docs: one clarification. The required query and lifecycle wiring use existing state; no nearby obsolete implementation could fund the full addition without unrelated refactoring.
  • Contributor isolated-Gateway proof: a real agent turn with a local push-service stand-in delivered only to the other device when either phone or desktop viewed the session. Hidden, different-session, and disconnected controls delivered to both devices. The base delivered to both in all five cases.
  • Contributor iOS 26 proof on the original patch: an installed Home Screen app showed no banner while viewing the reply, received an Apple push after lock and app switching, and received the push when only the Mac displayed the conversation. Real Apple delivery returned 201; visible declarations cleared within the two-second observation interval.
  • Not independently live-tested on iPhone or against a push service during this repair; local proof is at the production delivery boundary. The frozen-client heartbeat window was not provoked on iOS.

Contributor images of the three cases that should notify:

Locked iPhone receives completion banner iPhone receives completion banner after switching apps iPhone receives banner while Mac displays the conversation

Review scope: a separate proposal for future delivery modes is not implemented here; this repair uses the existing binary Agent finished preference and device-local viewer declarations.

Captured owning-boundary regression output

This is production delivery-boundary evidence with synthetic device IDs, not a shipped-Gateway or iPhone capture. An additional Gateway foreground capture would require a new push-service harness, so it was not run during this repair.

Base:

FAIL event Web Push classification > suppresses only the device viewing a finished session (the viewing device)
AssertionError: expected [ 'phone', 'desktop' ] to deeply equal [ 'desktop' ]
Tests  1 failed | 8 passed | 39 skipped (48)

Integrated fix, including the same viewing-device regression and its negative controls:

Test Files  3 passed (3)
     Tests  61 passed (61)

…ession

The Gateway already receives per-connection `sessions.viewers.set`
declarations from clients that render a conversation. Agent-finished Web
Push delivery now consults that owner and skips only the subscription whose
own paired device has an open, current connection declaring the event's
session. Other devices, question/cron/mention categories, ambiguous session
scopes, unknown devices and closed or invalidated connections keep the push.

Refs openclaw#164585
@clawsweeper

clawsweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S labels Oct 25, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 25, 2026
@clawsweeper

clawsweeper Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

Suppress agent-completion Web Push notifications on the paired device currently displaying that conversation.

Example: An iPhone displays agent:research:thread.1 while a subscribed desktop is elsewhere.

  • Before: Both devices receive the completion notification.
  • After: Only the desktop receives it; hiding the iPhone conversation restores normal delivery.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation is focused and has no actionable finding; readiness is held by the proof assessment.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Preference · Worth it: Yes · Fix scope: Complete
User problem: An enabled completion notification covers the reply the user is already reading.
Reason: The existing notification behavior lacked foreground suppression; the later maintainer-authored documentation records adoption of this bounded device-local policy.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep this PR: it provides a focused solution to redundant foreground notifications, and no actionable code defect was found.

Priority: P2
Reviewed head: e547415a67ca0a66293124ffc4ce1d83b4035d71

Before merge

  • Add real behavior proof - The inspected iPhone screenshots establish background delivery controls, while foreground suppression and the five-case isolated-Gateway comparison are described only in prose; provide redacted terminal output, delivery logs, or a recording showing that changed path, removing IPs, keys, phone numbers, and non-public endpoints. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.

Findings

None.

Tests

  • Missing end-to-end proof: Supply a captured shipped-Gateway foreground completion showing the viewing device skipped and another device notified; the body reports a base/head comparison but does not expose its output.
Agent review details

How this fits together

The Gateway translates completion events into authorized Web Push deliveries and now consults its existing per-connection viewer declarations before selecting recipients.

flowchart TD
  A[Visible Control UI conversation] --> B[Viewer declarations]
  C[Agent completion event] --> D[Web Push recipient filtering]
  E[Current authorization and preferences] --> D
  B --> D
  D --> F[Other subscribed devices]
Loading

Technical review

Best possible solution:

Use existing live viewer declarations to suppress completion pushes only on the viewing device, preserving other devices and notification categories.

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

Current-main source sends eligible completion pushes without checking foreground viewers, consistent with the linked iPhone reports; this review executed no target code.

Is this the best way to solve the issue?

The patch is a small, coherent implementation using the existing presence owner and pre-transport recipient filter, with no parallel store or protocol.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against aad9395b4b62.

Provenance checked

  • Viewer declaration ownership keeps the original intent (ff72f28: Separate actual rendered-session declarations from message subscriptions, with clearing on visibility changes and disconnect.)
  • Web Push recipient policy changes intended behavior with a stated reason (20a6147: Deliver configured attention events using current device, profile, preference, and session authority.)
  • Connection-state and lifecycle ownership keeps the original intent (2046dbc: Keep transport-independent connection state separate from HTTP transport construction.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

PR surface

Source +49, Tests +99, Docs 0. Total +148 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 4 52 3 +49
Tests 1 99 0 +99
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 152 4 +148

Review metrics

Metric Value Why it matters
Production versus test LOC Production +52/-3; tests +99/-0 Production growth adds the existing owner's device query and lifecycle wiring; the table covers distinct recipient and connection-lifecycle outcomes.

Labels

Label changes:

  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.
  • remove proof: sufficient: Current real behavior proof status is insufficient, not sufficient.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🧂 unranked krab, so this older rating label is no longer current.
  • remove status: ⏳ waiting on maintainer: Current PR status label is status: 📣 needs proof.

Label justifications:

  • P2: Repeated completion banners obstruct replies without preventing conversation use.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-25T11:06:12.255Z sha 8f090c2 :: blocked before merge. :: none

Reviewed October 25, 2026, 8:46 PM ET / October 26, 2026, 00:46 UTC (Revision 2).

@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Oct 26, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. labels Oct 26, 2026
@steipete
steipete merged commit 672c435 into openclaw:main Oct 26, 2026
167 of 170 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 26, 2026
…ession (openclaw#183535)

Suppress agent-finished Web Push only for the paired device currently viewing the exact session. Reuse the existing visible-session owner and preserve pushes to other devices and all other categories, without a new setting or protocol.

The recipient regression fails on base and passes with the fix; all 61 delivery, presence and connection tests pass. Exact-head CI is green. The foreground live-capture gap and frozen-client heartbeat window are documented in the PR.

Co-authored-by: Holger Gruenhagen <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
RomneyDa added a commit that referenced this pull request Oct 28, 2026
…ession (#183535)

Suppress agent-finished Web Push only for the paired device currently viewing the exact session. Reuse the existing visible-session owner and preserve pushes to other devices and all other categories, without a new setting or protocol.

The recipient regression fails on base and passes with the fix; all 61 delivery, presence and connection tests pass. Exact-head CI is green. The foreground live-capture gap and frozen-client heartbeat window are documented in the PR.

Co-authored-by: Holger Gruenhagen <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>

Backport adaptation: preserve beta.5 object-options API, state-directory authority, diagnostic logging, and larger baseline regression fixtures. Add live aborted/stopped, ambiguous scope, and connection attachment coverage.

Source-commit: 672c435
Canonical-group: final-p0-review0-672c4357a65a
Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S 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.

2 participants