mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #2749] [Issue]: Notification ping is silently broken — AudioContext created suspended and never resumed (no webkit fallback) #1388
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#1388
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kolacheee on GitHub (Jun 21, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2749
Originally assigned to: @SpicyMarinara on GitHub.
Summary
notification-sound.tslazily constructs a module-level singletonAudioContextand never checksctx.state/callsctx.resume(). The very first real ping originates from a non-gesture event (incoming streamed message), so per browser autoplay policy the context is createdsuspended; itscurrentTimedoes not advance, oscillators scheduled atnow/now+0.25never render, and because the context is a singleton that is never resumed it stays suspended for the page lifetime. The siblinggame-audio.tsdoes the correctif (state === 'suspended') void resume(), proving the intended pattern is simply absent here.Sub-bug 1: Permanently-silent ping (#14)
getAudioContext()(lines 7-12) doesnew AudioContext()with no state check;playNotificationPing()(19-55) readsnow = ctx.currentTime(frozen) and schedules/stops oscillators against a clock that never advances.Sub-bug 2: No webkit fallback, swallowed error (#15)
new AudioContext()(line 9) has nowindow.webkitAudioContextfallback. On prefixed-only WebKit engines the bare identifier throwsReferenceError, swallowed by the emptycatch {}(52-54) — no sound, no log, no toast.game-audio.ts:190-196resolveswindow.AudioContext ?? webkitAudioContext; this file omits it.AudioContext. Ping never plays, no error surfaced.new AudioContext()throws -> caught at 52 -> returns silently.Suggested Fix
In
getAudioContext(): resolveconst Ctor = window.AudioContext ?? (window as any).webkitAudioContext;(guard undefined), and inplayNotificationPing()after obtaining the context doif (ctx.state === 'suspended') void ctx.resume();before scheduling (mirror game-audio.ts:198-199). The context recovers once any user gesture has occurred.Verification checklist (all manual)
pnpm checkAffected files
packages/client/src/lib/notification-sound.tsAudit provenance
Found by a multi-agent static audit of the TTS/voice + image-generation subsystems (Round 1 + round-2 gap sweep + completeness critic, each finding adversarially verified) against the merged
stagingtree. Severity: HIGH.@SpicyMarinara commented on GitHub (Jun 21, 2026):
Addressed on PR #2747. notification-sound now resolves window.AudioContext with the webkitAudioContext fallback, handles unavailable audio contexts gracefully, and resumes a suspended singleton before scheduling the synthesized ping. Deferred full pnpm validation until the end of the issue sweep, per maintainer request.