-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
claude-codeRelated to Claude CodeRelated to Claude Codecross-referencePattern found across multiple CLIsPattern found across multiple CLIskimi-cliRelated to Kimi CLIRelated to Kimi CLIopencodeRelated to OpenCodeRelated to OpenCodesubagents
Description
Pattern
Subagent (child agent) lifecycle management is broken across all CLIs — agents don't stop when cancelled, sessions leak, and inter-agent communication is limited.
Occurrences
Claude Code
- #31469 — Plugin hooks not propagated to subagents
- #31451 — Agent iTerm session not closed after shutdown
- #31389 — Teammate ignores shutdown_request, loops indefinitely
- #31439 — Can't distinguish subagent vs main agent in UI
OpenCode
- #16311 — /fork is incredibly slow for long sessions
- #16341 — No timestamps in subagent session picker
Kimi CLI
- #1315 — Subagents keep running after hitting ESC
- #1297 — Cancelling subagents displays errors
- #1312 — Feature request: subagent sessions
Analysis
All CLIs struggle with the same subprocess lifecycle problem:
- Spawned agents don't respect cancellation signals
- No graceful shutdown protocol (just kill)
- Resource cleanup (temp files, connections) is missed
- Parent agent has no visibility into child agent state
Recommended Solution
- Implement cooperative cancellation (signal → grace period → force kill)
- Track child process PIDs and ensure cleanup on parent exit
- Add agent state machine: SPAWNING → RUNNING → CANCELLING → STOPPED
- Propagate hooks/permissions to child agents
Contribution Target
Kimi CLI — Fix #1315 (ESC doesn't stop subagents) with proper signal propagation.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
claude-codeRelated to Claude CodeRelated to Claude Codecross-referencePattern found across multiple CLIsPattern found across multiple CLIskimi-cliRelated to Kimi CLIRelated to Kimi CLIopencodeRelated to OpenCodeRelated to OpenCodesubagents