Repository navigation
fix(dashboard): retry the Windows action spawn without breakaway on E… - #135693
Closed
Yicheng-Mark wants to merge 1 commit into
Closed
Yicheng-Mark wants to merge 1 commit into
Yicheng-Mark wants to merge 1 commit into
Conversation
…RROR_ACCESS_DENIED _spawn_hermes_action passed CREATE_BREAKAWAY_FROM_JOB unconditionally on win32. Inside a job object without JOB_OBJECT_LIMIT_BREAKAWAY_OK (Task Scheduler, some service runners), Popen raises PermissionError and POST /api/hermes/update dies with a 500 instead of starting the update. The contract in _subprocess_compat.windows_detach_flags -- callers catch OSError and fall back to windows_detach_flags_without_breakaway() -- was followed by gateway.py, gateway_windows.py and main_desktop.py but not here. Do the same two-step spawn (135179).
15 of 19 tasks
13 of 14 tasks
Author
|
Closing in favor of #129325 (by @ggmmlong, opened 9 days earlier), which fixes the same spawn site in Comparing the two diffs, theirs is also the better fix: it gates the fallback on #135179 stays reproducible until that lands — the terminal |
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.
Symptom
POST /api/hermes/update— or the Desktop app's "Update backend" affordance against a remote Windows backend — fails with HTTP 500:whenever the dashboard/gateway runs inside a Windows job object that does not grant
JOB_OBJECT_LIMIT_BREAKAWAY_OK(Task Scheduler, certain service runners, sandboxed sessions). No update ever starts. As reported in #135179.Cause
_spawn_hermes_actioninhermes_cli/web_server_gateway.pyspawned the action withwindows_detach_flags()unconditionally, and those flags includeCREATE_BREAKAWAY_FROM_JOB. In a job that forbids breakaway,PopenraisesPermissionError(WinError 5), which the endpoint surfaced as the 500._subprocess_compat.windows_detach_flagsdocuments the exact contract: "A job that forbids breakaway yields PermissionError from Popen — callers catch OSError and fall back towindows_detach_flags_without_breakaway."gateway.py,gateway_windows.pyandmain_desktop.pyfollow it; this spawn site was the one that didn't.Fix
Catch
OSErrorfrom the breakaway spawn and retry once withwindows_detach_flags_without_breakaway(), mirroringgateway.py's respawn path. The POSIX branch (start_new_session) is unchanged.Regression tests added:
PermissionErroron the breakaway flags) retries with the without-breakaway flags and still records the action's process handle;start_new_sessionand passes nocreationflags.Fixes #135179
Type of Change
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests pass — ran the new test module against the patched file on Windows (3/3), stubbing only the module's collaborators; full suite runs in CIDocumentation & Housekeeping
cli-config.yaml.example— N/ACONTRIBUTING.mdorAGENTS.md— N/A