Skip to content

bug: RpcClient.start reports success after a signal exit during startup #128

Description

@imshunsuke

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions