[FEATURE] Include pid/pgid in terminal_info ACP metadata for orphan process detection
Resolved 💬 1 comment Opened Apr 27, 2026 by Dnreikronos Closed May 31, 2026
What variant of Codex are you using?
CLI
What feature would you like to see?
Add pid and pgid fields to the terminal_info metadata sent via ACP ToolCall._meta. Currently terminal_info only includes terminal_id and cwd. With pid/pgid, ACP clients like Zed can detect and clean up orphaned child processes after the shell exits.
Current:
{"terminal_info": {"terminal_id": "toolu_...", "cwd": "/some/path"}}
Proposed:
{"terminal_info": {"terminal_id": "toolu_...", "cwd": "/some/path", "pid": 12345, "pgid": 12345}}
_meta is freeform JSON, so no ACP protocol changes are needed — just two extra fields in existing JSON.
Use case:
- User starts agent session in Zed (or any ACP client)
- Codex CLI runs something that forks background workers (dev server, build watcher, etc.)
- Shell exits with 0, CLI sends
terminal_exit - Child processes keep running, consuming resources, no parent
- ACP client can't touch them because it has no PID or PGID
- With pid/pgid in
terminal_info, client callskillpg(pgid, 0)after exit, finds orphans, cleans up with SIGTERM
Alternatives considered:
- A reverse
terminal/killin ACP protocol (client-to-agent direction) — works but requires protocol-level change on both sides for what could be two JSON fields - Scanning
/procby command string — too fragile, too many false positives
Additional information
- Related Zed issue: https://github.com/zed-industries/zed/issues/51455
- Same request filed for Claude Code: https://github.com/anthropics/claude-code/issues/45180
- The Zed-side parsing already exists at
crates/agent_servers/src/acp.rswhereterminal_infois extracted from_meta. Once Codex CLI starts sending pid/pgid, the Zed side is a small patch.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗