feat: add Kiro CLI as built-in agent with proper process group cleanup#42
Draft
thepagent wants to merge 6 commits intoopenclaw:mainfrom
Draft
feat: add Kiro CLI as built-in agent with proper process group cleanup#42thepagent wants to merge 6 commits intoopenclaw:mainfrom
thepagent wants to merge 6 commits intoopenclaw:mainfrom
Conversation
…ard ACP session/update
… processes kiro-cli is a wrapper that forks kiro-cli-chat as the actual ACP server. Sending SIGTERM to the wrapper does not kill the child process, which becomes an orphan and accumulates over time. Fix: spawn the agent with detached:true so it becomes a process group leader, then use process.kill(-pgid, SIGTERM/SIGKILL) to kill the entire process group including all child processes. Also adds onAgentPid callback to runQueuedTask/runSessionPrompt to allow callers to track the agent pid for cleanup purposes.
8f14577 to
bec9f62
Compare
thepagent
added a commit
to thepagent/claw-info
that referenced
this pull request
Mar 3, 2026
thepagent
added a commit
to thepagent/claw-info
that referenced
this pull request
Mar 3, 2026
thepagent
added a commit
to thepagent/claw-info
that referenced
this pull request
Mar 3, 2026
* docs: update acp_kiro.md with process group fix and PR #42 reference * fix: correct acpx PR link to openclaw/acpx#42 * ci: retrigger check-commit-author * ci: retrigger after check-commit-author fix --------- Co-authored-by: thepagent <[email protected]>
Contributor
|
Is this ready and tested? happy to merge it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Kiro CLI as a built-in agent and fixes orphan child processes caused by wrapper binary patterns.
Problem
kiro-cli acpis a wrapper that forkskiro-cli-chatas the actual ACP server. The oldagent.kill()only killed the wrapper — the child became an orphan and accumulated over time.This affects any agent using a wrapper binary pattern.
Fix
Spawn with
detached: trueso the agent becomes a process group leader. On close, useprocess.kill(-pgid, SIGTERM)to kill the entire group.Falls back to
child.kill()if process group kill is unsupported.Tests
Two new tests in
test/process-group-kill.test.tsprove the fix:process group kill terminates parent and grandchild (no orphan)— verifies the fix workskilling only parent pid leaves grandchild as orphan (demonstrates the bug)— reproduces the original bugChanges
src/agent-registry.ts— addkiro: "kiro-cli acp"as built-in agentsrc/client.ts—detached: trueon spawn +process.kill(-pgid)interminateAgentProcesssrc/session-runtime.ts— addonAgentPidcallback torunQueuedTask/runSessionPrompttest/agent-registry.test.ts— update for 6 agentstest/process-group-kill.test.ts— new: prove process group kill vs orphanRelated