Conversation
4 tasks
…earch#77276) _spawn_gateway_restart() now calls _reap_unsupervised_gateway_orphans() before spawning a new `hermes gateway restart` child. On desktop-app restart the old serve exits but its gateway child gets reparented to launchd (PPID=1) and keeps its platform connection alive. The new serve then spawns a fresh gateway, resulting in two live gateways racing the same connection. The reap was already implemented for the CLI restart path (NousResearch#75936) but the dashboard's _spawn_gateway_restart path was not covered. Fixes NousResearch#77276
RelaxJonh
force-pushed
the
fix/orphan-gateway-reap-on-restart
branch
from
August 4, 2026 02:14
262acfd to
c7b8023
Compare
19 tasks
Collaborator
|
Merged via PR #83542 — your commit(s) were cherry-picked onto current main with your authorship preserved in git log (rebase merge). Thank you for the contribution! This follow-up PR completed the EMFILE hardening cluster after #83406: restart-path gateway orphan reap, Desktop-managed gateway termination on serve shutdown, SSH-spawn ulimit raise, and the dashboard iterdir→scandir fd-leak fixes. Everything was live-tested end-to-end on a real serve backend before merge, including a hostile unreadable-profile-dir fixture that surfaced (and fixed) a pre-existing /api/profiles 500 along the way. |
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.
Problem
When the desktop app restarts, the old
serveprocess exits but its gateway child gets reparented to launchd (PPID=1) and keeps its platform connection alive. The newservespawns a fresh gateway, resulting in two live gateways racing the same connection — messages split across parallel session trees (#77276).Root cause
_reap_unsupervised_gateway_orphans()was implemented for the CLI restart path (stop_profile_gateway()→ #75936) but the dashboard's_spawn_gateway_restart()path was not covered.Fix
Call
_reap_unsupervised_gateway_orphans()at the top of_spawn_gateway_restart()before spawning the newhermes gateway restartchild. The reap is wrapped in a try/except so a failure never blocks the restart.Testing
test_gateway.pyorphan tests continue to passFixes #77276