Skip to content

fix: contain throwing onRunStarted hook in emitRunStarted so TUI PTY runs can't orphan (#6002) - #6075

Merged
atomantic merged 1 commit into
mainfrom
claim/issue-6002
Sep 3, 2026
Merged

fix: contain throwing onRunStarted hook in emitRunStarted so TUI PTY runs can't orphan (#6002)#6075
atomantic merged 1 commit into
mainfrom
claim/issue-6002

Conversation

@atomantic

Copy link
Copy Markdown
Owner

Summary

  • Routes the onRunStarted hook call inside emitRunStarted() (server/services/runner.js) through the existing safeSettle wrapper, so a throwing hook is logged but can never reject the caller.
  • emitRunStarted fires 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.
  • Signature and call site unchanged; payload-flattening logic untouched.

Test plan

  • New test in 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 of emitRunStarted) and passes with the fix (no throw, error logged via safeSettle).
  • npx vitest run services/runner.test.js services/tuiPromptRunner.test.js: 139 passed.
  • Full server suite (cd server && npm test): 1907 files passed / 1 skipped, 38487 tests passed / 24 skipped.

Review note

  • Local reviewer (mtplx, effort low) could not run: no model configured on the Settings → Code Reviewers page. Proceeding without a local-reviewer verdict; CI review requested instead.

Closes #6002

@atomantic
atomantic merged commit 0f1fa8f into main Sep 3, 2026
7 checks passed
@atomantic
atomantic deleted the claim/issue-6002 branch September 3, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A throwing onRunStarted hook still orphans a live PTY via the unguarded emitRunStarted helper

1 participant