fix(tui): reap orphaned slash_worker processes on gateway startup (Fixes #48643) - #48656
Open
Nigmat-future wants to merge 3 commits into
Open
fix(tui): reap orphaned slash_worker processes on gateway startup (Fixes #48643)#48656Nigmat-future wants to merge 3 commits into
Nigmat-future wants to merge 3 commits into
Conversation
Orphaned tui_gateway.slash_worker subprocesses survived gateway restarts and blocked Desktop reconnects. Reap unowned workers at startup, bind new workers to a Windows kill-on-close job object, and treat zombie parents as orphaned in the in-worker watchdog. Fixes NousResearch#48643
psutil 7.x exposes ppid as a method; attribute access returned a bound method and crashed the orphan reaper on real process scans.
Use CREATE_BREAKAWAY_FROM_JOB when spawning slash workers on Windows so AssignProcessToJobObject succeeds under Desktop/Electron parent jobs. Add Windows e2e tests for job teardown and orphan reaping.
10 tasks
3 tasks
supplefrog
added a commit
to supplefrog/hermes-agent
that referenced
this pull request
Jun 23, 2026
Resume Desktop chats lazily so opening a stored session can paint history before slow agent construction completes. Avoid starting the lazy agent build when staging image attachments; prompt submission will consume the queued attachment when the agent is actually needed. Also harden the Electron backend shutdown path on Windows by terminating the backend process tree. Slash-worker lifecycle cleanup is intentionally left to NousResearch#48656.
teknium1
reviewed
Jul 14, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for addressing a real cross-process slash-worker lifecycle gap.
Problems
tui_gateway/server.py:262needs current-main reconciliation. Current main's samePopencall already passescreationflags=windows_hide_flags()attui_gateway/server.py:323; applying the PR's separatecreationflagsvalue would either conflict or discard the existing no-console-window behavior. Compose the flags when salvaging.- The PR's startup reaper is useful, but it does not eliminate the startup parent-identity race: current
tui_gateway/slash_worker.py:30-31importsclibefore the PPID snapshot/watchdog at:147-152. #64534 contains focused coverage for that remaining window and is complementary.
Suggested changes
- Retain the startup reaper/zombie-parent work, but integrate the Windows creation flag with
windows_hide_flags()and evaluate it alongside #64534's immutable parent-PID handoff.
Automated hermes-sweeper review.
| @@ -256,7 +262,11 @@ def __init__(self, session_key: str, model: str): | |||
| bufsize=1, | |||
Contributor
There was a problem hiding this comment.
Current main already passes creationflags=windows_hide_flags() in this same Popen call (tui_gateway/server.py:323). Salvage this by composing the breakaway bit with that helper; adding a second creationflags kwarg conflicts, while replacing it loses the existing no-console-window behavior.
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
tui_gateway.slash_workerprocesses on gateway startup when they no longer descend from a livetui_gatewayprocessFixes #48643
Test plan
pytest tests/tui_gateway/test_slash_worker_lifecycle.py tests/test_slash_worker_watchdog.py -q(11 passed)pytest tests/test_tui_gateway_server.py::test_slash_worker_close_reaps_zombie_and_closes_fds tests/test_tui_gateway_server.py::test_restart_slash_worker_closes_orphan_when_session_reaped -qslash_workerPIDs remain and Desktop reconnects without taskkill