Same class as the router fix: nine stop paths released their group from the owner-death supervisor
as soon as the leader exited, but members that ignore TERM or outlive the leader keep the group
alive. Releasing it let those members survive a later kill -9 of this process.
Lightpanda, real-profile Chrome, embedded cua-driver, the TTS command provider, dashboard WhatsApp
pairing, the raft and WhatsApp bridges, verify's app server, agent-browser session groups, and
Browser Use harness daemons stopped by --reload now go through release_process_group_once_empty.
New test stops a raft bridge whose TERM-ignoring helper survives. It fails when raft releases
unconditionally, and the group stays covered with the fix. Test seams moved from the per-module
release_process_groups name to the shared helper.
Reported by Greptile on #137057 (thread on the router).
Command providers run in their own session so the IDLE timeout (default 120 s, reset by every byte
of output) can kill the whole tree. That timer lives in the Hermes process: a SIGKILLed or
OOM-killed gateway left a stalled or long-running provider (a shell plus its synthesiser) running
forever, detached and reparented to init.
run_command_provider now starts the command through process_identity.spawn_owned (POSIX: group
leader, group handed to the owner-death supervisor, so provider_popen_group_kwargs no longer adds
start_new_session) and releases the group once the command has exited or the idle kill stopped it.
Windows keeps its CREATE_NEW_PROCESS_GROUP | CREATE_NO_WINDOW flags and taskkill tree kill.
Measured on Linux, owner killed inside the idle timeout, 6 s settle: origin/main 3 of 3
survived; this commit 0 of 4 descendants. New kill -9 / live-owner case and an own-then-release
test (success and idle kill); reverting spawn_owned to the main-era Popen turns the kill -9 case
red. Existing spawn-kwargs tests now patch the module's spawn_owned seam.
run_command_provider() spawns the user's TTS/STT command-provider shell with
shell=True and, on Windows, creationflags=CREATE_NEW_PROCESS_GROUP only.
shell=True routes through cmd.exe, a console-subsystem shim, so without
CREATE_NO_WINDOW the child allocates a visible console window flash on every
provider run from a windowless host (pythonw gateway, TUI, Desktop) — issue
#101585.
Switch the branch to the shared bundle
hermes_cli/_subprocess_compat.windows_detach_flags_without_breakaway()
(CREATE_NEW_PROCESS_GROUP | CREATE_NO_WINDOW), extracted into a pure
provider_popen_group_kwargs(os_name) helper so the platform contract is
assertable on every host. CREATE_BREAKAWAY_FROM_JOB is deliberately NOT used:
the provider is foreground-owned and killed by us on idle timeout, so job
teardown propagation must keep working. POSIX keeps start_new_session=True.
Same bug class one path later: terminate_command_process_tree()'s taskkill
run also lacked flags — give it windows_hide_flags() so the idle-timeout kill
doesn't flash a console either.
Co-authored-by: finn763 <165816600+finn763@users.noreply.github.com>
run_command_provider forwarded declared env_passthrough keys from os.environ,
which under the multiplexer is the LAUNCH profile's .env. A served profile's
command TTS/STT subprocess (voice-note transcription, speech, warm/release
hooks) got the launch profile's credential and never its own. Resolve each key
with resolve_passthrough_value, as the terminal and code-execution spawns do.
(cherry picked from commit 22a299d5f562e1d174fa5d37590cd46361a1383a)
Completes the half-done move snapshotted by the parent (wip commit 283f63b):
the tts.providers.<name> config layer (_get_named_provider_config,
_resolve_command_provider_config, _generate_command_tts, ...) now lives in
tools/tts_command_provider.py; tts_tool re-imports the historical names.