fix(gateway): retry detached Windows restart watcher without breakaway#42242
Open
worlldz wants to merge 2 commits into
Open
fix(gateway): retry detached Windows restart watcher without breakaway#42242worlldz wants to merge 2 commits into
worlldz wants to merge 2 commits into
Conversation
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.
Fixes #42116
On Windows, the detached gateway restart watcher could fail with
WinError 5/ access denied when the parent process was running inside a job object that disallowedCREATE_BREAKAWAY_FROM_JOB.That made the
/restartdetached watcher path brittle in restrictive environments: the first detached spawn could fail before the watcher ever got a chance to wait for the old gateway to exit and respawn it.This patch hardens both layers of the Windows restart chain:
CREATE_BREAKAWAY_FROM_JOBif the initial detachedPopenis deniedhermes gateway restartnow uses the same breakaway-first, fallback-without-breakaway patternThis keeps the preferred breakaway behavior where it is allowed, but no longer gives up when the parent job object rejects it.
Regression coverage added for:
Validation:
uv run --extra dev pytest tests/gateway/test_restart_drain.py tests/tools/test_windows_native_support.py -qResult:
82 passed in 6.40sValidation:
uv run --extra dev pytest tests/gateway/test_update_command.py tests/hermes_cli/test_gateway_service.py -q -k 'resolve_hermes_bin or restart'Result:
17 passed, 163 deselected in 3.73s