Repository navigation
fix(android): stop interrupted assistant audio and remove cached files - #129574
Merged
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
steipete
marked this pull request as ready for review
August 25, 2026 19:33
Contributor
Author
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Aug 26, 2026
threely-lab
pushed a commit
to threely-lab/openclaw
that referenced
this pull request
Aug 28, 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.
What Problem This Solves
Interrupting a compressed assistant-audio reply cancelled its playback coroutine before either cleanup dispatcher could run. The Android
MediaPlayercould continue playing without being released, and the reply's audio bytes remained in a private app-cache file. Cancellation while handing a newly created file back from the I/O dispatcher, or an exception during player setup, also lost the corresponding resource before its existing cleanup scope began.Why This Change Was Made
Give the existing playback owner immediate ownership of each temporary file and
MediaPlayeras soon as it is allocated. Keep the existing player teardown on Android's main dispatcher and file deletion on the I/O dispatcher, but make both cleanup sections non-cancellable. Nested ownership preserves file deletion even if player teardown fails, while keeping active-playback registration, replacement, formats, and public behavior unchanged.Production delta: +53/-43 (net +10), justified by the four independently reproduced resource-lifetime gaps. Regression coverage: +171 test lines. No new dependency, permission, configuration, fallback, or product policy.
User Impact
Interrupted Android assistant replies stop playing immediately and do not leave their speech audio cached on disk. Failed player initialization and cancellation during audio-file creation also release their resources reliably.
Evidence
STARTED, its private speech file remained on disk, cancellation before the file-creation dispatcher returned orphaned a second file, and a player whose initialization failed remainedIDLEinstead of reaching releasedEND.ShadowMediaPlayer.State.ENDdirectly proves thatMediaPlayer.release()ran.TalkAudioPlayerand a real platformMediaPlayer, confirmed active speech playback throughAudioManager, and confirmed creation of the actual private app-cache audio file.OK (1 test)) while proving that cancelling real playback leftactivePlayers=1and the actual 384,044-byte private WAV inorphanFiles.TALK_AUDIO_CANCELLED expectedLeak=false activePlayers=0 initialPlayers=0 orphanFiles=[]after cancellation.AudioManagerproves that real playback stopped; the owner-levelENDregression independently proves the stronger player-release contract. Test audio was synthetic and all task-created cache files were removed.