openclaw - ✅(Solved) Fix [Bug]: sessions_spawn does not expose child process PID for running ACP sessions [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#74684Fetched 2026-04-30 06:21:17
View on GitHub
Comments
1
Participants
2
Timeline
2
Reactions
2
Timeline (top)
commented ×1cross-referenced ×1

sessions_spawn(runtime="acp", ...) returns session identifiers such as childSessionKey / sessionKey, but does not expose the OS process PID(s) for the spawned ACP adapter / child agent process. When the child appears stuck, is still running, or has empty projected history, operators have no first-class way to correlate the OpenClaw session with the process that must be inspected or terminated.

This is related to #68916, but narrower: #68916 covers orphaned ACP processes and cleanup on completion/reset. This issue is about the missing observability/control surface while a sessions_spawn child is still running.

Root Cause

  • Makes stuck ACP sessions hard to diagnose.
  • Makes cleanup risky because manual kill commands can target the wrong process.
  • Makes related empty-history / orphan-process bugs harder to investigate.
  • Prevents automation from safely detecting and remediating runaway spawned sessions.

PR fix notes

PR #74756: fix(acp): expose child process PID in sessions_spawn results #74684

Description (problem / solution / changelog)

Summary

Fixes #74684

Issue

sessions_spawn does not expose child process PID for running ACP sessions

Solution

Add optional pid field to AcpRuntimeHandle, AcpRuntimeStatus, AcpSessionStatus, and SessionAcpMeta types. Propagate the PID from the ACPX delegate through the control plane manager and acp-spawn result so callers can inspect the OS process ID of running ACP sessions.

Testing

  • Unit tests for PID extraction in runtime.test.ts (with and without PID)
  • Unit tests for PID inclusion in spawn results in acp-spawn.test.ts (with and without PID)
  • Defensive spread pattern ensures backward compatibility when PID is absent

Changed files

  • extensions/acpx/src/runtime.test.ts (modified, +89/-0)
  • extensions/acpx/src/runtime.ts (modified, +32/-4)
  • src/acp/control-plane/manager.core.ts (modified, +16/-0)
  • src/acp/control-plane/manager.types.ts (modified, +2/-0)
  • src/acp/runtime/types.ts (modified, +4/-0)
  • src/agents/acp-spawn.test.ts (modified, +63/-0)
  • src/agents/acp-spawn.ts (modified, +4/-0)
  • src/config/sessions/types.ts (modified, +2/-0)

Code Example

{
  "runtime": "acp",
  "agentId": "claude",
  "mode": "run",
  "task": "<long-running task>"
}

---

childSessionKey -> ACP adapter process PID -> child agent process PID
RAW_BUFFERClick to expand / collapse

Summary

sessions_spawn(runtime="acp", ...) returns session identifiers such as childSessionKey / sessionKey, but does not expose the OS process PID(s) for the spawned ACP adapter / child agent process. When the child appears stuck, is still running, or has empty projected history, operators have no first-class way to correlate the OpenClaw session with the process that must be inspected or terminated.

This is related to #68916, but narrower: #68916 covers orphaned ACP processes and cleanup on completion/reset. This issue is about the missing observability/control surface while a sessions_spawn child is still running.

Environment

  • OpenClaw: 2026.4.27 (cbc2ba0)
  • Install: npm global
  • OS: Linux
  • Gateway: systemd user service
  • ACP backend: bundled acpx
  • Observed with ACP child sessions; most relevant for agentId: "claude" / agentId: "codex" style runs

Steps to reproduce

  1. Spawn an ACP child session from a parent conversation, for example:
{
  "runtime": "acp",
  "agentId": "claude",
  "mode": "run",
  "task": "<long-running task>"
}
  1. Observe the sessions_spawn response. It provides session-level identifiers, but no OS PID / process handle metadata.
  2. While the task is running or appears stuck, inspect available session APIs such as sessions_list, sessions_history, and session_status.
  3. Attempt to correlate the child session with live OS processes (claude-agent-acp, claude, codex-acp, etc.).

Expected behavior

For spawned sessions that create local child processes, OpenClaw should expose enough process metadata to correlate and debug the run. For example, one or more of:

  • pid / pids in the sessions_spawn response when available
  • persisted process metadata in the child session record
  • session_status showing adapter PID and child agent PID while running
  • a first-class sessions_kill / sessions_close path that can target the stored process handle without requiring manual ps matching

If a PID is unavailable for a backend, the response should explicitly say so rather than silently omitting it.

Actual behavior

The spawn result exposes logical session identifiers but no process PID. When the child appears to be running, hung, orphaned, or projected as empty by sessions_history, there is no reliable way to map:

childSessionKey -> ACP adapter process PID -> child agent process PID

Operators are forced to use manual process-table heuristics, timestamps, command-line matching, or gateway logs. That is brittle when multiple ACP sessions are active.

Impact

  • Makes stuck ACP sessions hard to diagnose.
  • Makes cleanup risky because manual kill commands can target the wrong process.
  • Makes related empty-history / orphan-process bugs harder to investigate.
  • Prevents automation from safely detecting and remediating runaway spawned sessions.

Related issues

  • #51328: ACP session transcript exists but session APIs may return empty history.
  • #68916: ACP oneshot sessions leave orphaned processes and parent reset does not clean child ACP sessions.
  • #66465: persistent ACPX subprocess stderr logs would help post-mortem debugging, but PID/session correlation is still needed.

extent analysis

TL;DR

Expose process metadata, such as pid or pids, in the sessions_spawn response to enable correlation and debugging of spawned ACP child sessions.

Guidance

  • Modify the sessions_spawn API to include process metadata, such as pid or pids, in its response when available.
  • Consider adding a sessions_kill or sessions_close API that can target the stored process handle without requiring manual process matching.
  • Update the session_status API to display adapter PID and child agent PID while the session is running.
  • If a PID is unavailable for a backend, explicitly indicate this in the response instead of silently omitting it.

Example

{
  "childSessionKey": "...",
  "sessionKey": "...",
  "pid": 1234,
  "pids": [1234, 5678]
}

Notes

The proposed solution assumes that the ACP backend can provide process metadata. If this is not possible, alternative solutions, such as logging process information or using external process management tools, may be necessary.

Recommendation

Apply a workaround by modifying the sessions_spawn API to include process metadata in its response, as this will provide the necessary information for correlation and debugging.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

For spawned sessions that create local child processes, OpenClaw should expose enough process metadata to correlate and debug the run. For example, one or more of:

  • pid / pids in the sessions_spawn response when available
  • persisted process metadata in the child session record
  • session_status showing adapter PID and child agent PID while running
  • a first-class sessions_kill / sessions_close path that can target the stored process handle without requiring manual ps matching

If a PID is unavailable for a backend, the response should explicitly say so rather than silently omitting it.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: sessions_spawn does not expose child process PID for running ACP sessions [1 pull requests, 1 comments, 2 participants]