Repository navigation
fix(runner): a run's whole process tree ends with it; Try the app refuses a taken port - #259
Merged
Merged
Conversation
…uses a port that's already taken Found on the lab while trying TeacherHub: a vite dev server left behind by a finished agent run held port 5173, so Try the app reported "running" within 5 s — a stranger's server. Restarting the runner also left a whole CLI run working on as an orphan, racing its own retry for the same branch. - ProcessJob: on Windows each CLI run, server-driven shell call and preview goes into a Job Object with KILL_ON_JOB_CLOSE — background children join it, and closing it (run end, Stop, or the runner dying for any reason) kills everything left. Elsewhere it kills the current tree. - PreviewHost: refuses to start when something already listens on the recipe's port, with a plain reason; releases the job when the app ends on its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018WAdQ7Rm24xss5QDSvXtJB
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
Found on the lab while trying TeacherHub through Try the app:
vitedev server left behind by a finished agent run held port 5173 → the preview said "running" after 5 s (someone else's server).Fix:
ProcessJob— on Windows every CLI run, server-driven shell call and preview runs in a Job Object withKILL_ON_JOB_CLOSE. Background children join automatically; run end / Stop / the runner dying (handle closed by the OS) kills everything left. Non-Windows: kills the current tree.Test plan
ProcessJobTests: a detached grandchild that outlived its parent is killed when the job is disposed (Windows); double dispose is harmless.🤖 Generated with Claude Code
https://claude.ai/code/session_018WAdQ7Rm24xss5QDSvXtJB