fix(windows): discover S4U gateways from profile PID files - #73267
Open
Sagittarius987 wants to merge 1 commit into
Open
fix(windows): discover S4U gateways from profile PID files#73267Sagittarius987 wants to merge 1 commit into
Sagittarius987 wants to merge 1 commit into
Conversation
Include validated per-profile PID/lock records in all-profile gateway discovery before service and process scans. This lets Windows updates pause Session 0 scheduled-task gateways whose command lines are hidden from CIM, WMIC, and psutil while preserving PID exclusions and deduplication.
Contributor
|
Thanks for the focused Windows recovery fix. Current The proposed call to Automated hermes-sweeper review. |
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
hermes updateto pause Windows S4U/Session 0 gateways whose command lines are inaccessible to CIM, WMIC, or psutilProblem
On Windows, an S4U Scheduled Task runs in Session 0 without an interactive logon. The gateway remains visible by PID, and its validated profile
gateway.pid/runtime lock remains readable, but an unelevated interactive updater may receive noCommandLineorExecutablePathfrom CIM/WMIC/psutil.find_gateway_pids(all_profiles=True)previously skipped the current-profile PID lookup and depended on service/process-table discovery. That meant the updater could miss an S4U gateway during its pause phase, then correctly abort later when the venv-holder guard found the still-running Python process.This complements the broader Windows update recovery work discussed in #53124: that PR explicitly identified S4U/Session 0 command-line visibility as an uncovered case.
Fix
When
all_profiles=True, merge the already-validated records returned byfind_profile_gateway_processes()before the existing service and process-table scans._append_unique_pid()continues to enforce caller exclusions, self-PID rejection, and deduplication.The regression test models inaccessible process argv and verifies that:
exclude_pidsis propagated and enforced defensivelyVerification
26 passedpython -m py_compile hermes_cli/gateway.py tests/hermes_cli/test_update_concurrent_quarantine.pygit diff --check origin/main...HEADScope
Two files only; no account names, task names, machine paths, or deployment-specific process names are hardcoded.