fix: contain throwing onRunStarted hook in emitRunStarted so TUI PTY runs can't orphan (#6002) - #6075
Merged
Conversation
…runs can't orphan (#6002)
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
onRunStartedhook call insideemitRunStarted()(server/services/runner.js) through the existingsafeSettlewrapper, so a throwing hook is logged but can never reject the caller.emitRunStartedfires from the TUI spawn path (server/services/tuiPromptRunner.js) after the PTY is already registered in the active-run map; previously a hook throw rejected the spawn with a live PTY and no terminal settlement — the same orphaned-child shape A throwing onRunStarted hook orphans a spawned Run Prompt child before its error listener exists #5792 closed for the CLI path.Test plan
server/services/runner.test.js("contains a throwing onRunStarted hook instead of rejecting the TUI spawn path (A throwing onRunStarted hook still orphans a live PTY via the unguarded emitRunStarted helper #6002)"): verified it fails against the unpatched helper (hook error propagates out ofemitRunStarted) and passes with the fix (no throw, error logged viasafeSettle).npx vitest run services/runner.test.js services/tuiPromptRunner.test.js: 139 passed.cd server && npm test): 1907 files passed / 1 skipped, 38487 tests passed / 24 skipped.Review note
Closes #6002