fix(voice): redact TTS instructions from speech spans - #4676
Open
ayaangazali wants to merge 1 commit into
Open
Conversation
The speech span gates its input text on trace_include_sensitive_data but emits model_config["instructions"] unconditionally. Those instructions are author-written prompt text, the same category as the STT prompt and keywords that are already gated, so disabling sensitive data still exported them. Gate instructions on the same flag. voice and speed stay visible because they are settings rather than prompt text, and the TTS model still receives the real instructions.
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.
Summary
speech_spangates the text being spoken ontrace_include_sensitive_data, but emitsmodel_config["instructions"]unconditionally:TTSModelSettings.instructionsis author-written prompt text, documented as the knob for controlling the tone of the audio output. That is the same category as the STTpromptandkeywords, which #4663 gated a few hours ago. The transcription span now draws the line clearly:keywordsandpromptfollow the flag, whiletemperature,language,languagesandturn_detectionstay visible because they are settings rather than prompt text.instructionsis prompt text sitting on the settings side of that line.Reproduced on
mainwith a realVoicePipelineand a recording trace processor. Withtrace_include_sensitive_data=False:So a caller who explicitly turned sensitive data off still ships their instructions prompt to every trace backend. After the change that field is
Noneand nothing else about the span moves.This is not a provider-behavior change.
voiceandspeedstay visible either way, and the TTS model still receives the real instructions; only the exported span is redacted.Test plan
tests/voice/test_pipeline.py::test_speech_span_redacts_tts_instructions, parametrized over both values of the flag. It asserts the full matrix rather than just the redacted case: with the flag on,instructionsandinputboth carry their real values; with it off, both are cleared;speedis asserted unchanged in both to show the settings fields are untouched; and the recording TTS model asserts it received the real instructions either way, so the redaction is trace-only.Verified it fails without the source change by resetting
src/tomainand rerunning: theFalsecase fails, theTruecase passes, which is the expected split for a test that also pins existing behavior..agents/skills/code-change-verification/scripts/run.shpasses end to end: format, lint, typecheck and the full suite.Issue number
None. Found while sibling-checking #4663.
Checks
.agents/skills/code-change-verification/scripts/run.sh/reviewbefore submitting this PRI went looking for this straight after #4663 landed, on the theory that a redaction fix usually has a sibling field somewhere that nobody checked. Happy to be told that instructions are considered configuration rather than user content here, in which case the fix is wrong and the docs are the thing worth changing instead. I'm a freshman in college and this is the part of the codebase I have spent the most time in, so I would rather ask than assume.