Skip to content
1 min read · 239 words

Interface: WrapperGrandchildExitedEvent ​

Defined in: src/batteries/llm/claude_code_cli/wire.ts:191

The claude grandchild's OS process has exited (observed via the wrapper's own grandchild.on('exit', ...) handler) — issue #42 round-2 defect #1's additive protocol extension. Emitted unconditionally on that exit, independent of whether it was expected (sawResult) or already mid-shutdown, and independent of whether the wrapper itself goes on to exit cleanly afterwards.

Remarks ​

Exists solely so the adapter can clear its own cached grandchildPid: once the grandchild is gone, its pid/pgid is free for the OS to reuse for an entirely unrelated process group, and the adapter's SIGKILL-escalation path in gracefulShutdown() must never signal a pid it no longer has positive evidence is still the grandchild's own group. The wrapper itself can observe (and emit) this even while stuck elsewhere in its own shutdown sequence — Node still delivers a ChildProcess 'exit' event to a handler registered on it regardless of what else the process is doing — unless the wrapper is wedged badly enough to never run any JS at all, in which case nothing it could emit would help regardless. A consumer/adapter build that predates this event simply never sees it — the union member is additive, and every existing branch keeps working unchanged.

Properties ​

PropertyTypeDescriptionDefined in
type"grandchild_exited"Discriminant for the WrapperEvent union.src/batteries/llm/claude_code_cli/wire.ts:193