Skip to content

RPC agent crashes (unhandled process exit) on a single null input line #141

Description

@dangzitou

What happened?
A single line containing just null on stdin kills the whole RPC agent with an unhandled rejection, instead of returning an error response. Every other malformed line ([], 123, {}, "hi") is handled fine — only valid-JSON null is fatal:

$ printf 'null\n' | step --mode rpc
TypeError: Cannot read properties of null (reading 'id')
    at handleInputLine (...)
Node.js v22.23.2      <- process exits

One bad line (from a client that emits a half-written frame, or any upstream producer) tears down the running session/daemon.

Steps to reproduce

  1. printf 'null\n' | step --mode rpc
  2. Process exits non-zero with the TypeError above; it should stay up.

Root cause: packages/coding-agent/src/modes/rpc/rpc-mode.ts handleInputLine casts the parsed payload to RpcCommand and reads command.id in both handleCommand and the catch. On null the first read throws, then the catch reads command.id again and re-throws, escaping as an unhandled rejection.

Expected behavior
Emit an error response frame for that line and keep serving subsequent commands.

Version
0.84.4

I'd like to implement the fix myself.

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