Skip to content

Bug: Session status shows 'stopped' while Claude Code process is still running #109

@c-h-

Description

@c-h-

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

  1. PID check: agentctl status should check if the PID is still alive before reporting stopped
  2. Process group: Launch Claude Code in the same process group so wrapper death doesn't orphan it
  3. Webhook emission (Feature: Native lifecycle webhook emission for all harnesses #108): When Claude Code actually exits, emit a webhook — independent of wrapper lifecycle

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions