Repository navigation
🔊 fix: Clear TTS Audio Cache On Session End and Hash Its Keys - #16998
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a20697241f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 90cb311faa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 21fc282bf1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a8325cef2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2e961b274b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5cd0f270fb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a4591fc1e5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 46514ac3b9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c3d1d11cfe
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: de4d516899
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9cb21fb2cf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e4601b30d4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
LibreChat/client/src/components/Chat/Input/StreamAudio.tsx
Lines 143 to 144 in 571486e
In a browser without MSE support, such as Safari, a TTS response that remains pending across a same-document logout and login still reaches this unconditional setter. Logout clears the atom and increments generation, but the effect neither aborts its fetch on unmount nor checks that generation before publishing the completed blob; the stale Recoil setter can therefore repopulate globalAudioURL after the next account signs in, causing its mounted autoplay element to play the departing account's audio. The fresh evidence beyond the obsolete persistent-cache threads is that this final in-memory implementation fences only setCachedTTSAudio, not response consumption; abort the stream or check the captured generation before publishing audio.
AGENTS.md reference: AGENTS.md:L45-L48
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 20b55700e8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
8a0a4ec to
f957159
Compare
b7016bf to
c97c988
Compare
|
Lighthouse CI failed. The last 80 log lines contain the measured budgets and assertion failures. |
f957159 to
ff97e0d
Compare
* fix: Clear TTS Audio Cache On Session End and Hash Its Keys * fix: Read Manual TTS Replays From the Hashed Cache Key * fix: Purge Legacy TTS Cache Keys and Fence Writes Across Logout * fix: Keep TTS Cache Writes Off the Playback Path * test: Expect Hashed Keys in the StreamAudio Cache Lookup * test: Use a Single-Token Reply Label in the TTS Cache Scenario * fix: Settle TTS Cache Clear Before IdP Logout and Across Tabs * test: Cover the TTS Cache Fence When Another Tab Logs Out * test: Wait for the Second Tab Before Logging Out in the TTS Scenario * fix: Latch TTS Cache Writes Shut Until the Tab Authenticates Again * fix: Reopen TTS Cache Writes When Authentication Completes In Place * fix: Leave for the IdP Even When TTS Cache Cleanup Fails * fix: Retry a Failed Legacy TTS Purge and Fence Other Tabs on Manual Clear * fix: Rerun the Legacy TTS Purge After Each Clear and Sign-In * fix: Rerun the Legacy TTS Purge When Another Tab Clears * fix: Fence Pre-Auth TTS Writes, Retry Failed Clears, and Fall Back to Storage Events * fix: Version the Hashed TTS Cache Key Path * fix: Move TTS Audio to a New Cache and Keep It Closed Until a Failed Clear Succeeds * fix: Persist a Pending TTS Cache Delete Across Navigation * fix: Reopen TTS Caching Only on Session Start and Fence Cache Reads * fix: Keep the TTS Delete Fence in Cache Storage and Close Reads After Logout * refactor: Keep Read-Aloud Audio in Tab Memory Instead of Cache Storage * test: Return to the Conversation After Re-Login in the TTS Logout Scenario * test: Close the Phone Sidebar Before Replaying in the TTS Logout Scenario * fix: Bound the In-Memory TTS Cache by Size as Well as Count * fix: Scope Cached TTS Audio to the Signed-In User * fix: Keep the Settings Cache Delete Available While Legacy Audio Remains * fix: Recheck Legacy TTS Audio After a Settings Clear and on Unowned Handoff * fix: Fence TTS Writes Started Before an Account Signs In * test: Opt the Fresh TTS Account Into Enter-to-Send
* fix: Encrypt User Plugin Credentials With Random-IV v3 Format * test: Cover Credential Encryption Formats in Mock E2E Scenarios * test: Round-Trip Real Credential Helpers in PluginService Spec * 🙈 fix: Remove SharePoint Picker Payload Logging (#16997) * fix: Add credentials.writeFormat to Gate v3 Credential Writes During Rollouts * test: Expect 201 When the Legacy Write Format Override Is Created * 🔊 fix: Clear TTS Audio Cache On Session End and Hash Its Keys (#16998) * fix: Clear TTS Audio Cache On Session End and Hash Its Keys * fix: Read Manual TTS Replays From the Hashed Cache Key * fix: Purge Legacy TTS Cache Keys and Fence Writes Across Logout * fix: Keep TTS Cache Writes Off the Playback Path * test: Expect Hashed Keys in the StreamAudio Cache Lookup * test: Use a Single-Token Reply Label in the TTS Cache Scenario * fix: Settle TTS Cache Clear Before IdP Logout and Across Tabs * test: Cover the TTS Cache Fence When Another Tab Logs Out * test: Wait for the Second Tab Before Logging Out in the TTS Scenario * fix: Latch TTS Cache Writes Shut Until the Tab Authenticates Again * fix: Reopen TTS Cache Writes When Authentication Completes In Place * fix: Leave for the IdP Even When TTS Cache Cleanup Fails * fix: Retry a Failed Legacy TTS Purge and Fence Other Tabs on Manual Clear * fix: Rerun the Legacy TTS Purge After Each Clear and Sign-In * fix: Rerun the Legacy TTS Purge When Another Tab Clears * fix: Fence Pre-Auth TTS Writes, Retry Failed Clears, and Fall Back to Storage Events * fix: Version the Hashed TTS Cache Key Path * fix: Move TTS Audio to a New Cache and Keep It Closed Until a Failed Clear Succeeds * fix: Persist a Pending TTS Cache Delete Across Navigation * fix: Reopen TTS Caching Only on Session Start and Fence Cache Reads * fix: Keep the TTS Delete Fence in Cache Storage and Close Reads After Logout * refactor: Keep Read-Aloud Audio in Tab Memory Instead of Cache Storage * test: Return to the Conversation After Re-Login in the TTS Logout Scenario * test: Close the Phone Sidebar Before Replaying in the TTS Logout Scenario * fix: Bound the In-Memory TTS Cache by Size as Well as Count * fix: Scope Cached TTS Audio to the Signed-In User * fix: Keep the Settings Cache Delete Available While Legacy Audio Remains * fix: Recheck Legacy TTS Audio After a Settings Clear and on Unowned Handoff * fix: Fence TTS Writes Started Before an Account Signs In * test: Opt the Fresh TTS Account Into Enter-to-Send
Summary
With
cacheTTSon (the default), auto-played and external TTS persisted audio to Cache Storage (tts-responses) keyed by the full assistant message text, and no logout or account-switch path cleared it. On a shared browser the next user could read previous replies, and play the audio, from DevTools.Read-aloud audio is now cached only in the tab's memory: a small map (50 recordings or 32 MB, least recently used evicted) keyed by a SHA-256 hash of the user id, voice and spoken text, so nothing reaches disk, one account can never match another's audio, and the cache dies with the tab. Every session end empties it (logout, IdP logout, a failed logout, a rejected or empty token refresh, a failed user query, and signing in as a different account without a logout), as does the Settings "delete cache" action; a generation counter keeps a request that was in flight across a logout from writing afterwards. The
tts-responsescache that earlier versions left on disk is deleted at app startup, on logout and on the Settings clear. The voice is part of the key, so changing voice no longer replays audio from the old one.Stacked on #16997.
Type of change
Testing
Tested environments/configuration:
cacheTTSon, external TTS engine (routed in the e2e harness), desktop light, desktop dark and mobile.Automated tests:
client/src/utils/ttscache.spec.ts(hash key, user isolation, hit and miss, count and size eviction, clear, account switch, generation fence, legacy cache delete guarded), oneAuthContext.spec.tsxtest per session-end path, andStreamAudio.spec.tsx(lookup by the spoken answer): all pass.e2e/specs/mock/scenarios/tts-cache.spec.ts: a replay plays without a second TTS request, Cache Storage never holds TTS audio, logout empties the cache in the same tab, and a legacytts-responsescache is deleted at startup. All four pass in desktop light, desktop dark and mobile.Screenshots / recordings
No user-facing change
Risk / compatibility
Cached audio no longer survives a reload or carries over to other tabs, so replaying a message after a reload, in another tab, or after signing back in regenerates the audio (one more TTS request). Per-conversation eviction on delete is not included.
Checklist