Repository navigation
fix(media-use): escape the audio engine's summary and broken audio_meta.json errors - #8258
Merged
michaelwang11394 merged 1 commit intoNov 19, 2026
Conversation
…n errors The run summary now escapes the BGM provider and SFX count carried over from audio_meta.json. A malformed audio_meta.json now stops the engine through its usual error line, which escapes the file's bytes, instead of an uncaught exception.
jrusso1020
approved these changes
Nov 19, 2026
jrusso1020
left a comment
Collaborator
There was a problem hiding this comment.
Approving at 76228f9.
- Summary line: the line with
bgm_providerand the sound-effect count now goes throughterminalText(), like the lines around it. With--only ttsor--only sfx, both values are carried over fromaudio_meta.json, so they're project-file text. - Malformed file:
openAudioMetanow runs inside atry, and a malformedaudio_meta.jsonexits throughdie()withaudio_meta.json at <path>: <message>, escaped line by line aswait-bgm.mjsdoes. Node's default uncaught-error printer no longer runs on it. - Tests:
audio.test.mjspasses 20/20 at this head. Withaudio.mjsput back to main and the tests kept, exactly the 3 new tests fail (17/20):--only tts,--only sfx, and the broken file. The first two also checkaudio_meta.jsonis written unchanged.
Non-blocking, as the body says: a valid but wrong-shape audio_meta.json (for example null) still ends in a stack trace. That trace holds no file bytes, but routing it through die() too would make every bad file end the same way.
Need: nothing.
michaelwang11394
deleted the
michaelwang/secops-3103-media-use-audio-engine-prints
branch
November 19, 2026 22:52
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
The media-use audio engine (
skills/media-use/audio/scripts/audio.mjs) now escapes the last two places where it printed text fromaudio_meta.jsonraw.bgm_providerand the number of sound effects goes throughterminalText(), like the lines around it. With--only ttsor--only sfx,bgm_providerandsfxare kept unchanged from the existingaudio_meta.json, so they are project-file text.openAudioMeta(outPath)runs inside atry. A malformedaudio_meta.jsonnow stops throughdie()withaudio_meta.json at <path>: <message>, which escapes each line the same waywait-bgm.mjsdoes. It no longer reaches Node's default uncaught-error printer, which quoted bytes of the file raw.Why
A project folder someone else made can put terminal control sequences in
audio_meta.json. Printed raw, they can rewrite earlier output, set the window title or, on some terminals, write the clipboard. #8235 escaped the rest of these scripts' output; these two places were left.Related work
Follows #8235, #8249 and #8013.
How
See What.
Visible change
A malformed
audio_meta.jsonnow prints a one-line error naming the file instead of Node's stack trace. Text with control characters shows as escapes such as\x1b. Ordinary output reads as before.Test plan
Unit tests added/updated
Manual testing performed
Documentation updated (if applicable)
Comments follow CONTRIBUTING.md "Comments": they say why, not what, and a bug fix says what the code must do and how to reproduce the bug
fails without the fix: 3 new tests in
skills/media-use/audio/scripts/audio.test.mjsfail on main:--only ttswith ESC and BEL in the keptbgm_providerandsfxvalues;--only sfxwith the same file;audio_meta.jsonholding ESC and BEL bytes.The first two also check that
audio_meta.jsonis written unchanged. None of the tests use the network.All tests in
skills/media-use/audio/scripts/*.test.mjspass. The media-use copy-parity check passes 4 of 4, andgen-skills-manifest --check, oxlint, oxfmt and the comment ratchet pass.skills-manifest.jsonchanges only the media-use hash.Manual: a normal
--only sfxrun prints the same stdout and writes the sameaudio_meta.jsonon main and on this branch.Not changed:
die()escapes each line but keeps real line breaks, likewait-bgm.mjsand the rest of fix(media-use): duck, cut, transcribe, dither and audio scripts print control characters as escapes #8235. So a line break inside the file's bytes still starts a new line. A valid but wrong-shapeaudio_meta.json(for examplenull) still crashes with a stack trace, but that trace holds no project bytes.