fix(notifications): resolve agent-push dispatch review findings from #4627#4656
Merged
Conversation
Two unresolved review comments from #4627 (jeanduplessis): 1. Concurrent-replay double-send: the DO yields the isolate on every external await (presence RPC, Expo send), so a replay of the same idempotency key could interleave, read the pending marker the first attempt left, treat it as a reusable retry slot, and submit a second OS push. Add an in-memory in-flight claim so a concurrent replay returns duplicate; sequential post-failure retries still reuse the storage pending slot. 2. PII in push-sink logs: the dev/E2E push sink logged the full title, body, and data object (agent/user-controlled content) into local/CI/Worker logs. Log content-free metadata instead (sizes, data key names, the type discriminator); the sink still drives E2E to a delivered outcome.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryBoth review findings from #4627 are addressed correctly: the in-memory in-flight claim closes the concurrent-replay double-send window without a check/await race, and the push-sink log now records only content-free metadata (lengths, key names, a fixed schema-enum discriminator) with no PII. Files Reviewed (2 files)
Reviewed by claude-sonnet-5 · Input: 26 · Output: 7.8K · Cached: 582.1K Review guidance: REVIEW.md from base branch |
jeanduplessis
approved these changes
Jul 21, 2026
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.
Follow-up to #4627 addressing the two unresolved review comments from @jeanduplessis on
NotificationChannelDO. Both were flagged but non-blocking, so #4627 merged approved; this PR resolves them. The agent-notification push path is still dark in production (its CLI companionKilo-Org/kilocode#12392is unapproved), so this lands ahead of the feature going live.1. Concurrent-replay double-send (correctness)
The DO serializes turns, but a turn yields the isolate on every external
await(presence RPC, Expo send). A replay of the same idempotency key can interleave while the first attempt is mid-flight, read thependingmarker the first attempt left, treat it as a reusable retry slot, and submit a second OS push.Fix: an in-memory in-flight claim (
Set<string>keyed by idempotency key). A concurrent replay seeing a live claim returnsduplicate; a sequential post-failure retry (claim already released) still reuses the storagependingslot exactly as before. New test drives two concurrent dispatches of the same key with a held-open Expo send and asserts exactly one submission.2. PII in push-sink logs (privacy)
The dev/E2E-only sink (
PUSH_SINK_MODE=log) logged fulltitle/body/data.Fix: log content-free metadata only — sizes,
datakey names, and the fixedtypediscriminator. The sink still drives E2E to adeliveredoutcome (its actual purpose); no flow consumed the logged content. Test updated to assert the redacted shape and that no content values appear.Verification
services/notifications: 142 tests pass (incl. new concurrent + redaction tests),tsgoclean, oxlint clean.