-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Description
What happened
Launched Claude Code via agentctl launch claude-code --cwd ~/personal/agentctl. agentctl reports the session as stopped within seconds, but the actual Claude Code process (PID) is still alive and working.
Expected
Session status should reflect the actual Claude Code process state, not the wrapper's lifecycle.
Root cause
agentctl's launch wrapper gets SIGTERM'd by the parent process (OpenClaw's exec timeout). When the wrapper dies, agentctl marks the session stopped — but Claude Code was spawned as a child process that survives the wrapper's death (reparented to init/launchd).
Impact
- Misleading status leads to unnecessary relaunches (wasted API calls)
- No way to distinguish 'actually stopped' from 'wrapper died but agent is running'
- Supervision can't work if status is wrong
Observed
$ agentctl status pending-24490
Status: stopped # FALSE — PID 24490 is still running
$ ps aux | grep 24490
ms 24490 ... /Users/ms/.local/share/claude/versions/2.1.63 --dangerously-skip-permissions --print ...
Possible fixes
- PID check:
agentctl statusshould check if the PID is still alive before reportingstopped - Process group: Launch Claude Code in the same process group so wrapper death doesn't orphan it
- Webhook emission (Feature: Native lifecycle webhook emission for all harnesses #108): When Claude Code actually exits, emit a webhook — independent of wrapper lifecycle
Related
- Feature: Native lifecycle webhook emission for all harnesses #108 (lifecycle webhooks would provide ground truth on session exit)
- TOOLS.md documents this as known behavior but it's still a bug
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels