You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Agents running inside a user's tmux session are not detected/shown as running #7797
Orca does not identify running AI agents (e.g. claude, codex) when they run inside a user's tmux session. The agent never shows up as a live/running agent on the pane, worktree, or project view — the pane just reads as tmux.
Note: this is about live agent detection. The file-based Agent Session History (AI Vault, which scans ~/.claude/projects/**) still surfaces the transcript by cwd; only the live/running indicator is missing.
Root cause
Live foreground detection walks the process tree downward from the pane's shell pid and only inspects that subtree:
When a user runs tmux in an Orca pane, the process in the pane is the tmux client. tmux daemonizes a server (double-fork, reparented to pid 1), and every pane process — including claude — is a child of that server, not of the pane's shell. So the descendant walk from the shell pid reaches only the tmux client (not a recognized agent) and never the agent. It falls back to the client name (tmux).
The OSC path (OSC 133 / OSC 9999 status sequences) also misses it, because tmux does not forward those to the outer terminal by default.
Proposed fix
When the shell's subtree contains a tmux client, hop to that client's active pane pid and re-run the same recognition walk from there:
Detect a tmux client among the descendants.
tmux [-L/-S <sock>] list-clients -F '#{client_pid} #{pane_pid}' → map our client pid to its active pane pid (one call; #{pane_pid} resolves in the client's context).
Re-run the existing descendant recognition from that pane pid (and also consider the pane's own top process, for tmux new-session claude).
Best-effort (any tmux failure falls through unchanged), POSIX-only, mirrored in both the local and relay/SSH paths, with a short TTL cache to avoid forking tmux on every foreground poll.
Environment
Affects both local and SSH remote (relay) sessions.
Live agent detection walks the process tree downward from the pane's shell pid via collectDescendants in src/main/providers/agent-foreground-process.ts:20 (used by resolveAgentForegroundProcessFromPs at line 108). tmux double-forks its server and reparents it to pid 1, so the agent (claude/codex) is a child of the tmux server, not the pane shell. The descendant walk from the shell pid reaches only the tmux client (unrecognized) and returns the tmux fallback — the agent never shows as running. The relay/SSH twin src/relay/pty-shell-utils.ts:163 has the same downward-only walk, so remote sessions are affected too.
Repro pins the buggy result with the real product code, plus a control showing the identical ps table yields claude when the walk starts from the tmux server pid:
pnpm exec vitest run --config config/vitest.config.ts src/main/providers/repro-7797-tmux-agent-detection.test.ts
Fix direction: when a tmux client is found in the subtree, map it to its active pane pid (tmux list-clients -F '#{client_pid} #{pane_pid}') and re-run the recognition walk from there (best-effort, POSIX-only, mirrored in the relay path).
Automated bug-reproduction pass. Repro artifact committed on branch nwparker/bug-repro-pass2; check it out to run the command above. Writeup: docs/bug-reproductions/7797.md.
Activity
nwparker commentedon Jul 18, 2026
Status: REPRODUCED (unit test, macOS)
Live agent detection walks the process tree downward from the pane's shell pid via
collectDescendantsinsrc/main/providers/agent-foreground-process.ts:20(used byresolveAgentForegroundProcessFromPsat line 108). tmux double-forks its server and reparents it to pid 1, so the agent (claude/codex) is a child of the tmux server, not the pane shell. The descendant walk from the shell pid reaches only the tmux client (unrecognized) and returns thetmuxfallback — the agent never shows as running. The relay/SSH twinsrc/relay/pty-shell-utils.ts:163has the same downward-only walk, so remote sessions are affected too.Repro pins the buggy result with the real product code, plus a control showing the identical
pstable yieldsclaudewhen the walk starts from the tmux server pid:Fix direction: when a tmux client is found in the subtree, map it to its active pane pid (
tmux list-clients -F '#{client_pid} #{pane_pid}') and re-run the recognition walk from there (best-effort, POSIX-only, mirrored in the relay path).Key files:
src/main/providers/agent-foreground-process.ts,src/relay/pty-shell-utils.ts,src/shared/agent-process-recognition.ts.Automated bug-reproduction pass. Repro artifact committed on branch
nwparker/bug-repro-pass2; check it out to run the command above. Writeup:docs/bug-reproductions/7797.md.