Skip to content

fix: use kiro-cli-chat directly to prevent orphan child processes#129

Open
vokako wants to merge 1 commit intoopenclaw:mainfrom
vokako:fix/kiro-orphan-process-v2
Open

fix: use kiro-cli-chat directly to prevent orphan child processes#129
vokako wants to merge 1 commit intoopenclaw:mainfrom
vokako:fix/kiro-orphan-process-v2

Conversation

@vokako
Copy link
Contributor

@vokako vokako commented Mar 13, 2026

Problem

kiro-cli is a wrapper that forks kiro-cli-chat as the actual ACP server process. When acpx sends SIGTERM to kiro-cli on session close, only the wrapper is killed — the child process kiro-cli-chat continues running as an orphan.

These orphaned processes accumulate over time and cause resource conflicts, resulting in ACP_TURN_FAILED errors (exit code 1) on subsequent messages in persistent sessions. The first message in a session works fine, but follow-up messages fail because the stale kiro-cli-chat process is still holding resources.

Fix

Point the built-in kiro agent directly at kiro-cli-chat acp, bypassing the wrapper entirely. This ensures clean process lifecycle management without needing process group kill logic.

One-line change in src/agent-registry.ts:

-  kiro: "kiro-cli acp",
+  kiro: "kiro-cli-chat acp",

Related

Testing

  • Created persistent kiro session with acpx kiro sessions new
  • Sent multiple consecutive messages — all succeeded with session reuse
  • Verified only 1 kiro-cli-chat acp process running (no orphans)
  • Previously: 6+ orphan processes accumulated after a few session cycles

@vokako vokako force-pushed the fix/kiro-orphan-process-v2 branch from 9ea1acc to 2316e1a Compare March 13, 2026 01:59
kiro-cli is a wrapper that forks kiro-cli-chat as the actual ACP
server process. When acpx sends SIGTERM to kiro-cli on session close,
only the wrapper is killed while kiro-cli-chat continues running as
an orphan process. These orphaned processes accumulate over time and
cause port/resource conflicts that result in ACP_TURN_FAILED errors
on subsequent messages in persistent sessions.

Fix: point the built-in kiro agent directly at kiro-cli-chat acp,
bypassing the wrapper entirely. This ensures clean process lifecycle
without needing process group kill logic.

Related: openclaw#42 (proposed process group cleanup approach — this commit
provides a simpler fix by avoiding the wrapper altogether)
@vokako vokako force-pushed the fix/kiro-orphan-process-v2 branch from 2316e1a to f7bd853 Compare March 13, 2026 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant