fix(tests): neutralize inherited voice TTS state - #40648
Closed
hanzckernel wants to merge 1 commit into
Closed
Conversation
hanzckernel
force-pushed
the
fix/test-voice-tts-isolation
branch
from
July 13, 2026 21:52
1a4cd08 to
0ad148c
Compare
teknium1
reviewed
Jul 14, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for covering both the runner subprocess and direct-pytest collection paths. The premise remains valid on current main: scripts/run_tests_parallel.py:263 forwards os.environ unchanged, and tui_gateway/server.py:9316-9328 starts speak_text when _voice_tts_enabled() is true; that helper reads HERMES_VOICE_TTS at tui_gateway/server.py:13362-13364.
Problems
tests/test_run_tests_parallel.py:343and:393write generated probe modules into the source checkout'stests/directory. Thefinallyblocks clean up ordinary failures, but process interruption can leave untracked artifacts.
Suggested changes
- Preserve the collection-time regression but place its probe in a temporary test root that explicitly loads the root conftest, rather than creating files under
tests/.
Automated hermes-sweeper review.
| """Direct pytest runs must neutralize voice flags before module import.""" | ||
| repo_root = Path(__file__).resolve().parent.parent | ||
| nonce = f"{os.getpid()}-{int(time.time() * 1000)}" | ||
| probe = repo_root / "tests" / f"_tmp_voice_collection_probe_{nonce}.py" |
Contributor
There was a problem hiding this comment.
This probe is created inside the source checkout. Even with the finally cleanup below, an interrupted pytest process can leave an untracked Python file under tests/; please keep the probe in a temporary test root while explicitly loading the root conftest.
This was referenced Jul 29, 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.
Summary
HERMES_VOICE,HERMES_VOICE_TTS, andHERMES_VOICE_DEBUGinscripts/run_tests_parallel.pypytest subprocesses.tests/conftest.pyis imported, before pytest imports test modules for collection.0after each fixture teardown, while allowing individual tests to opt in temporarily withmonkeypatch.HERMES_VOICE_TTSafter fixture teardown.Root cause
Runtime voice/TTS state is held in process-wide env vars. A live interactive Hermes process can have
HERMES_VOICE_TTS=1; if tests inherit that value, gateway tests that complete fake assistant turns can call the real TTS stack and play audio. One existing fixture text ispartial answer complete, which is why local test runs can audibly speak that phrase.A function-scoped autouse fixture alone is too late for module-level reads during pytest collection. Simply deleting the flags with
monkeypatchis also insufficient: fixture teardown restores inherited values while background gateway work may still be running.Existing issue / PR check
Related but not covering this fix:
/voice offis used and adds status-bar indication.Neither covers inherited test-process state, collection-time reads, or teardown restoring TTS while background gateway work is still running.
Verification
HERMES_VOICE=1 HERMES_VOICE_TTS=1 HERMES_VOICE_DEBUG=1 ... pytest tests/test_run_tests_parallel.py: 8 passed.1: 1 passed.git diff --check: passed.