[PR #6081] [CLOSED] fix(notifications): play the completion sound whether or not the chat is still active #7053

Closed
opened 2026-10-23 04:16:06 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/6081
Author: @ghost
Created: 9/12/2026
Status: ❌ Closed

Base: staging ← Head: fix/same-chat-completion-ping-6080


📝 Commits (1)

  • a88b50f fix(notifications): play the completion sound whether or not the chat is still active (#6080)

📊 Changes

2 files changed (+42 additions, -15 deletions)

View changed files

📝 packages/client/src/hooks/use-generate.ts (+24 -15)
📝 scripts/regressions/open-issues.regression.ts (+18 -0)

📄 Description

Linked issue

Closes #6080

Why this change

  • In Roleplay and Conversation chats the completion sound only played after navigating to a different chat. Staying on the chat and looking away — the case the "only play sounds when unfocused" setting exists for — produced no sound. Game already pinged regardless of which chat was active.

What changed

  • packages/client/src/hooks/use-generate.ts: the Roleplay/Conversation ping moves out of the navigated-away block into its own block gated on notificationEligibleContent alone (the same eligibility the unread badge uses), placed ahead of the navigated-away block. That block now handles only the unread badge and the avatar bubble, so a reply that lands while you are on another chat pings once, not twice. The chat lookup and the notified message are computed once and shared by both blocks. Two behaviours are kept exactly: Game's single ping through gameTurnLoadedSoundPlayed, and the mode toggles + unfocused-only setting as the gate.
  • One added guard: a reply still held for a rewrite agent (messageHasPendingPostProcessing) does not ping. The group-chat member ping already checks this (#3095); the final reply's ping did not, and a held rewrite is never released at stream end, so a failed rewrite would have pinged on the placeholder.
  • scripts/regressions/open-issues.regression.ts: asserts the sound block precedes the navigated-away block and that the navigated-away block no longer calls playConfiguredNotificationPing. Run against unpatched staging it fails with "The completion sound must be gated on eligible content alone"; against this branch it passes.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Performed so far (draft; the boxes above get ticked by me after the manual pass):

  • pnpm install --frozen-lockfile, pnpm build:shared, tsc --noEmit in packages/client: clean.
  • pnpm check: passed (stale-client, impeccable, localization, format, lint, e2e types, build).
  • node ./scripts/run-regressions.mjs --filter open-issues: 1/1 passed on this branch; 0/1 on unpatched staging (the new assertion fails there, as intended).

Manual verification notes

  • In progress on a build of this branch beside my install (:7861, cloned data). The matrix I am running: Roleplay stay-on-chat unfocused → one ping; Roleplay navigate away → one ping + badge + bubble; Conversation same two; sound toggle off → none; unfocused-only on and window focused → none; Game → single ping unchanged; group chat → one ping per member, no double on the last; abort and error → none; regenerate, continue, impersonate → same as a fresh reply. Results will replace this note.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

No UI change. Sound only.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/6081 **Author:** [@ghost](https://github.com/ghost) **Created:** 9/12/2026 **Status:** ❌ Closed **Base:** `staging` ← **Head:** `fix/same-chat-completion-ping-6080` --- ### 📝 Commits (1) - [`a88b50f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a88b50f312627bbe160df57af9f6b9b2b097831b) fix(notifications): play the completion sound whether or not the chat is still active (#6080) ### 📊 Changes **2 files changed** (+42 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/hooks/use-generate.ts` (+24 -15) 📝 `scripts/regressions/open-issues.regression.ts` (+18 -0) </details> ### 📄 Description ## Linked issue Closes #6080 ## Why this change - In Roleplay and Conversation chats the completion sound only played after navigating to a *different* chat. Staying on the chat and looking away — the case the "only play sounds when unfocused" setting exists for — produced no sound. Game already pinged regardless of which chat was active. ## What changed - `packages/client/src/hooks/use-generate.ts`: the Roleplay/Conversation ping moves out of the navigated-away block into its own block gated on `notificationEligibleContent` alone (the same eligibility the unread badge uses), placed ahead of the navigated-away block. That block now handles only the unread badge and the avatar bubble, so a reply that lands while you are on another chat pings once, not twice. The chat lookup and the notified message are computed once and shared by both blocks. Two behaviours are kept exactly: Game's single ping through `gameTurnLoadedSoundPlayed`, and the mode toggles + unfocused-only setting as the gate. - One added guard: a reply still held for a rewrite agent (`messageHasPendingPostProcessing`) does not ping. The group-chat member ping already checks this (#3095); the final reply's ping did not, and a held rewrite is never released at stream end, so a failed rewrite would have pinged on the placeholder. - `scripts/regressions/open-issues.regression.ts`: asserts the sound block precedes the navigated-away block and that the navigated-away block no longer calls `playConfiguredNotificationPing`. Run against unpatched `staging` it fails with "The completion sound must be gated on eligible content alone"; against this branch it passes. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` Performed so far (draft; the boxes above get ticked by me after the manual pass): - `pnpm install --frozen-lockfile`, `pnpm build:shared`, `tsc --noEmit` in `packages/client`: clean. - `pnpm check`: passed (stale-client, impeccable, localization, format, lint, e2e types, build). - `node ./scripts/run-regressions.mjs --filter open-issues`: 1/1 passed on this branch; 0/1 on unpatched staging (the new assertion fails there, as intended). ### Manual verification notes - In progress on a build of this branch beside my install (:7861, cloned data). The matrix I am running: Roleplay stay-on-chat unfocused → one ping; Roleplay navigate away → one ping + badge + bubble; Conversation same two; sound toggle off → none; unfocused-only on and window focused → none; Game → single ping unchanged; group chat → one ping per member, no double on the last; abort and error → none; regenerate, continue, impersonate → same as a fresh reply. Results will replace this note. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) No UI change. Sound only. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:16:06 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#7053
No description provided.