Repository navigation
fix(notifications): replay completion sounds reliably - #15940
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📥 CommitsReviewing files that changed from the base of the PR and between 3d6de18537aa03416a44c70fdbf14b6507b4bca8 and e757ec2ff72976cd5fb533cfe1be554b4b1864f0. 📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughNotification sound playback no longer tracks an active-playing flag or suppresses repeated requests. Concurrent loads reuse a matching cached sound entry. New Vitest coverage checks repeated and concurrent playback, failures, volume limits, and missing paths. A new end-to-end test generates a WAV tone and records Chromium playback. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to Notification sounds now play for every eligible notification instead of being suppressed while a previous sound is playing. The change is small and has regression tests. I found no concrete merge-blocking risk. Security Architecture ReviewSecurity architecture risk: ⚪ Minimal · up to The change restarts an existing notification sound without granting new file access or privileges. Concurrent requests reuse one cached player, and playback failures remain recoverable. No material security risk introduced or worsened by this change was identified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
9d98292 to
3d6de18
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
|
Rebased onto latest main and resolved the conflict. Now 1 commit, 2 files, +90/−16. The conflict was not a normal one: #14703 split The bug is still present on main ( What changed:
The Verified locally: |
|
@DEOWL-kan thanks, reviewing this and your other PRs |
3d6de18 to
e757ec2
Compare
The in-flight `isNotificationSoundPlaying` gate dropped every notification sound that arrived while the previous one was still ringing, so bursts played once. Drop the gate and restart the cached Audio instead, and reuse an entry a concurrent call already cached for the same path so parallel first playbacks share one Audio rather than revoking each other's blob URL. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016S8SZpkXGcnU5UWwA8UiF2
e757ec2 to
88e47c7
Compare
nwparker
left a comment
There was a problem hiding this comment.
Adversarial review of #15933 and this PR, followed by rebase and fixes. Reviewed head: 88e47c79f8574da6b7aec3a92eccc9255cb2234e on 9323443c835f.
- The old global playing flag drops an eligible second completion while audio is active; a stalled element can also leave later notifications silent indefinitely. Removing that gate satisfies the issue's eligible-notification requirement better than the 10-second guard in #15938, which still drops completions inside its window.
- Confirmed the cold-cache race reuses one Audio element instead of overlapping players. Removed ended/error listeners that existed only to maintain the deleted flag. Added regression checks for restart seek, concurrent loading, rejected-play retry, volume limits, and cache disposal when configuration disappears.
- Playback restarts the current sound; bursts truncate the earlier sound rather than queueing full recordings. That behavior is explicit in the updated description.
Evidence is attached in the PR body: actual audible Chromium recordings before and after, with the second request at about 0.6 seconds. Three passing baseline runs and three passing after runs; the final rebased head also passed three real-Electron runs. One Audio element in every run; decoded audio remains audible past the old endpoint after the restart. The recording uses the real preload and sound IPC with audio redirected into MediaRecorder, so physical speakers and OS banner delivery are not claimed.
45 focused tests passed. Changed-code quality, focused lint, renderer/CLI typecheck, and Electron build pass. Full typecheck remains blocked by main's unrelated missing codexProviderHandle symbol in journal-submission-positions.test.ts:29. Suppressed/muted notification delivery is covered by the dispatch suite. Only macOS was exercised with Electron; Linux/Windows and live SSH were not run. No new remote protocol behavior.
No remaining blocker found in this sound change. CI has not reported checks on the pushed fork head; this is a comment review, not a blanket CI or native-OS approval.
ELI5
Two completions close together could show two notifications but play only the first sound. Each delivered custom-sound notification now restarts one cached player, so a later completion is audible without overlapping players.
What Changed
Removed the global “already playing” gate, including the flag that could stay set after an audio stall. Concurrent cold loads reuse the same player. Removed the event listeners used only to maintain that deleted flag. Added seek-reset, concurrency, failed-play retry, volume, missing-configuration, and real Electron audio coverage.
Why
A timeout, as proposed in #15938, limits permanent silence but still drops legitimate completions during its dedupe window. Restarting the existing player avoids that window and bounds playback resources. Bursts restart the file; this does not queue every sound to play to completion.
Linked Issue
Fixes #15933
Visual Proof
Same reproducer before and after: a two-second WAV is requested at approximately 0.0s, 0.6s and 3.0s. Turn audio on. The short high note at the beginning makes the restart at 0.6s audible. The waveform comes from the actual Chromium audio, recorded with MediaRecorder through CDP; it is not a synthesized reconstruction.
Before — current main drops the middle request:
notification-sound-before.mp4
After — the middle request restarts the same player:
notification-sound-after.mp4
Three passing Electron repetitions for each implementation. All runs construct one real Audio element. Decoded PCM at 2.25–2.4s is silent before (RMS 0) and audible after (RMS 0.1295), demonstrating the restarted sound lasts beyond the original endpoint. This isolates playback through the real preload and sound IPC; it does not automate macOS Notification Center or capture the physical speakers.
Testing
pnpm tcis blocked by an existing missingcodexProviderHandlesymbol insrc/main/native-chat/agent-session-journal/journal-submission-positions.test.ts:29on base commit9323443c835f. Renderer and CLI projects pass.ORCA_BACKGROUND_LAUNCH=1 pnpm exec playwright test tests/e2e/notification-sound-replay.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1 --repeat-each=3.AI Disclosure
Original implementation used Codex. Maintainer review, rebase, regression coverage, and evidence capture also used Codex.
Review
Checked cold-cache races, cached replay, recovery after rejected playback, resource disposal, volume bounds, and delivery suppression. Intentionally suppressed notifications still do not reach playback. Shared HTML audio code has no new platform or remote-wire branch; only macOS was exercised in Electron.
Agent skill upstream boundary
Notes
Rebased onto
9323443c835f; reviewed head88e47c79f857. The attachments compare the same preload playback behavior on the earlierb6c5f3f12337base; the rebased head was rechecked with the regression suite and real Electron playback. Sound remains client-local for SSH and runtime workspaces. No Git-provider or mobile contract change. Media is attached, not committed.Checklist