fix(voice): treat a non-list record_keyterms argument as no change - #7468
Open
Lesereingrape wants to merge 2 commits into
Open
Lesereingrape wants to merge 2 commits into
Lesereingrape wants to merge 2 commits into
Conversation
`_parse_tool_call` assumed `pending`/`confirm`/`remove` decode to a list. A model that answers with `null` raised TypeError out of the detection pass, and a bare string — what the json_repair fallback returns for a truncated call — became one keyterm per character.
|
|
This branch has not been deployed
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
_parse_tool_callassumed each ofpending/confirm/removedecodes to a list. A valuethat is not a list is now ignored, the way blank and non-string items already were.
Why
The arguments come straight from a provider, through
parse_function_arguments, whichdeliberately recovers malformed JSON rather than rejecting it — and
data.get(key, [])theniterates whatever the model actually sent:
{"pending": null}is valid JSON, so it reaches_termsasNoneand raisesTypeError: 'NoneType' object is not iterable.KeytermDetector._run_onceis decorated with@utils.log_exceptions, which logs and re-raises, so the pass dies and that turn's keytermupdate is lost.
{"confirm": "Kubernetesis repaired byjson_repairinto the string"Kubernetes", and iterating a string yields its characters:_apply_passconfirmsK,u,b, …, and_run_oncepushes that set to_stt._update_session_keyterms()(
keyterm_detection.py:386-387). The detector's own instructions treat a wrong spelling asunrecoverable for the rest of the call, so ignoring a group the recognizer cannot use fits
"precision beats coverage" better than biasing on single letters.
Both reproduce on
mainat98ed3e8:Tests
tests/test_stt_context.py, which already covers_parse_tool_call:1 failed, 36 passed in 5.47s(theTypeErrorabove)37 passed in 0.60stest_keyterm_detection_span,test_stt_context,test_agent_session,test_meta_stt,test_session_options_report,test_trace_types_pii,--unit -n auto):1 failed, 155 passed, 1 error. The failure istest_trace_types_piireadinga source file with the Windows default codec, and the error is
test_meta_sttimporting a pluginthat is not installed here; both reproduce on the untouched base and neither touches a file in
this diff.
ruff check/ruff format --check: clean on both files.mypyin strict mode reports no errorin
keyterm_detection.py.Environment note: Windows, core package installed editable.
uv sync --all-extrascannot resolvebithumanhere (no Windows wheel), so plugin packages are absent and I could not run the full--unit --audio_eotgate locally.