Repository navigation
fix(web-push): skip agent-finished pushes to the device viewing the session - #183535
Conversation
…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
|
🦞👀 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. |
|
Codex review: needs real behavior proof before merge. What this changesSuppress 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.
Review scores
ProductKind: Preference · Worth it: Yes · Fix scope: Complete 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 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe 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]
Technical reviewBest 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
TestingProof path: unit tests only. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +49, Tests +99, Docs 0. Total +148 across 6 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
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 (1 earlier review cycle)
Reviewed October 25, 2026, 8:46 PM ET / October 26, 2026, 00:46 UTC (Revision 2). |
Co-authored-by: Holger Gruenhagen <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…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]>
…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]>
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.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.Contributor images of the three cases that should notify:
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:
Integrated fix, including the same viewing-device regression and its negative controls: