fix(update): exclude ancestor PIDs from running-process check#164
Merged
fix(update): exclude ancestor PIDs from running-process check#164
Conversation
On Windows, 'conductor.exe' is a shim that launches python.exe to run
this code. The shim has a different PID from os.getpid(), so excluding
only self_pid caused the launching shim to be reported as 'another
running Conductor process' during 'conductor update'.
Now walk the full ancestor chain (via wmic on Windows, ps elsewhere) and
exclude every PID along the way. Falls back to {getpid(), getppid()} if
the parent map cannot be built.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
On Windows,
conductor updatereports its own launching shim as another running Conductor process:The shim
conductor.exeis a separate process from the Python interpreter that runs this code, soos.getpid()does not match the shim's PID — the shim was incorrectly flagged.Fix
Walk the full ancestor process chain and exclude every PID along the way:
_get_self_and_ancestor_pids()— returns{getpid(), getppid()}plus every ancestor reachable via the parent-PID map._build_parent_pid_map()— useswmicon Windows andps -axo pid=,ppid=elsewhere. Returns{}on any failure._find_running_conductor_processes()now consults the excluded set on both platforms.Tests
Adds 6 new tests in
TestAncestorPidExclusion:All 68 update tests pass; lint and typecheck clean.