What happened?
RpcClient.start() resolves successfully when its child terminates with SIGTERM during the startup delay. A caller can therefore treat a dead agent as ready. The startup check only examines exitCode, which is null for a signal exit; the exit handler has already recorded the failure in exitError.
This is a reliability bug, not a security vulnerability. A small local fix checks the recorded error and signal exit as well. May I have lgtm approval to submit it with regression tests?
Steps to reproduce
On macOS, create a temporary child.mjs containing:
process.kill(process.pid, "SIGTERM");
Instantiate RpcClient from packages/coding-agent/src/modes/rpc/rpc-client.ts with cliPath pointing to that file, then await client.start(). It resolves rather than rejecting. The reproduction launches only this minimal Node child, not StepCode or any extensions.
Expected behavior
Reject startup with Agent process exited (code=null signal=SIGTERM) when the child has already terminated. The regression fails before the fix and passes afterward. Local npm run check and ./test.sh passed with Node 22, pnpm 9.15.9, and rg/fd available on PATH.
Version
main at b2dacb6d9e297f3c9931c1adbdc9d6e1e97ef048, macOS arm64.
What happened?
RpcClient.start()resolves successfully when its child terminates with SIGTERM during the startup delay. A caller can therefore treat a dead agent as ready. The startup check only examinesexitCode, which isnullfor a signal exit; the exit handler has already recorded the failure inexitError.This is a reliability bug, not a security vulnerability. A small local fix checks the recorded error and signal exit as well. May I have
lgtmapproval to submit it with regression tests?Steps to reproduce
On macOS, create a temporary
child.mjscontaining:Instantiate
RpcClientfrompackages/coding-agent/src/modes/rpc/rpc-client.tswithcliPathpointing to that file, thenawait client.start(). It resolves rather than rejecting. The reproduction launches only this minimal Node child, not StepCode or any extensions.Expected behavior
Reject startup with
Agent process exited (code=null signal=SIGTERM)when the child has already terminated. The regression fails before the fix and passes afterward. Localnpm run checkand./test.shpassed with Node 22, pnpm 9.15.9, andrg/fdavailable on PATH.Version
main at
b2dacb6d9e297f3c9931c1adbdc9d6e1e97ef048, macOS arm64.