SIGN IN SIGN UP

fix: add default timeout for terminal command tool execution (#10550)

* fix: add default timeout for terminal command tool execution

Terminal commands with waitForCompletion=true had no timeout, risking
indefinite hangs. Adds a 2-minute default timeout with graceful
SIGTERM -> 5s grace period -> SIGKILL escalation. Both streaming
and non-streaming code paths are covered. The SIGKILL timer is
properly cleared if the process exits during the grace period.

* fix: correct process running check and clear SIGKILL timer

Replace `childProc.killed` with `exitCode === null && signalCode === null`
for accurate process-state detection, and clear sigkillTimeoutId in error
handlers to prevent delayed kills after rejection.

Applied to both streaming and non-streaming paths.

---------

Co-authored-by: amabito <192487536+amabito@users.noreply.github.com>
Co-authored-by: amabito <amabito@local>
K
Keita A. committed
5d19470aa97a8df688af527227a404c3b6f385f7
Parent: 0d7d5a7
Committed by GitHub <noreply@github.com> on 3/24/2026, 6:04:28 PM