fix(restart): only stop the proxy serving this checkout's port - #205
Merged
teamchong merged 1 commit intoAug 8, 2026
Merged
Conversation
`list_serving_pids` discovered proxies with `pgrep -f 'node.*bin/[c]li\.js'`, which matches a pxpipe proxy served from any clone on the machine. On a box with two checkouts, `pnpm run restart` in one SIGTERMed the serving proxy of the other: same pattern, different repository, no warning, and nothing in the output to say it had happened. A process-name match is not ownership. The port this checkout is about to bind is, so candidates are now intersected with the PIDs actually listening on it, resolved through lsof or ss. With neither tool available the script declines to signal anything and says why, rather than falling back to the pattern match. Killing a stranger's session is worse than not restarting. Narrowing correctly is half the job; not over-narrowing is the other half, so both directions are tested: a pxpipe process that holds no port is left alone, and one that holds ours is still found. The first fails on the previous script. The warp exclusion is unchanged, and so is the behaviour for orphans of our own port, which are all still cleared. `pnpm run test:restart` 6/6. No TypeScript changed, so the vitest suite is unaffected.
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 #204.
Candidates from the process-name match are now intersected with the PIDs actually listening on
TARGET_PORT, resolved through lsof or ss. With neither available the script declines to signal anything and explains why, rather than falling back to the pattern match.The warp exclusion is unchanged, and orphans of our own port are all still cleared.
Verification
pnpm run test:restart6/6, including two new cases:The existing harness cannot assert on signals, because
killis a bash builtin and never reaches the PATH shim, so both tests assert on the script's own discovery output instead.No TypeScript changed, so the vitest suite is unaffected.
Note for #152: this is the same hazard that proposal would widen, which is why the process matcher there should not be adopted as-is.