fix(daemon): deduplicate image transfer notifications#100
Merged
Conversation
Image transfer envelopes bypassed the Deduper entirely because they have no GenericMessage payload. This caused notification spam when the remote shim fetched the same clipboard image repeatedly within a short window. Extend AllowAt() to dedup image transfers by (SessionID, Fingerprint) using the same 12-second suppression window. Signed-off-by: Aseem Shrey <LuD1161@users.noreply.github.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Owner
|
Thanks @LuD1161 — merged in a9f83f6. Clean, well-scoped fix: keying image-transfer dedup on (SessionID, Fingerprint) and reusing the existing window was exactly the right layer, and the dedup_test/notify_test updates made the behavior change easy to verify. Appreciated the clear root-cause writeup. 🙏 |
Contributor
Author
|
Hey @ShunmeiCho 👋 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When connected to a remote machine via SSH, clipboard image fetches trigger repeated macOS notifications:
Example:
cc-clip #2848 — 7de9adb894b27c61 · 220x220 · png — Duplicate of #2846The remote shim can fetch the same clipboard image multiple times in rapid succession (clipboard managers, agent retries, or the agent re-checking clipboard type after reading). Each fetch fires a new notification with no suppression.
Root Cause
Image transfer envelopes (
KindImageTransfer) bypass theDeduperentirely because they have noGenericMessagepayload — the dedup logic returns early withreturn true, nilwhenmsg == nil.Fix
Extend
Deduper.AllowAt()to handle image transfer envelopes using(SessionID, Fingerprint)as the dedup key, applying the same 12-second suppression window used for other notification types. Repeated fetches of the same image within the window are silently suppressed.Test plan
TestDeduperImageTransferDedup— verifies first image passes, duplicate within window is suppressed, and same fingerprint passes again after window expiresTestDuplicateDetectionViaNotification— integration test now expects duplicate suppression