#626

mux-activity: read session markers from Claude processes on macOS

Openwiiiimmopened 12d ago

On macOS, mux-activity cannot tell which session a background Claude agent belongs to from its environment.

Each backend looks for a marker the agent inherited from the pane that started it: REX_SESSION for Rex, and the matching variables for Herdr and Luvus. It reads them with tc::procfs::read_environ, which opens /proc/<pid>/environ. That file does not exist on macOS, so the read always fails.

What happens today on a Mac: the marker step is skipped. The job is then filed by directory, or shown under BACKGROUND AGENTS. It is never filed in the wrong session; it just loses the exact match.

This predates stealth-factory/opscope#643**.** On main, core's claude_root_of and claude_fallback_root_of already depend on the same Linux-only reader. Codex raised it on PR stealth-factory/opscope#647, and we chose to track it here instead of widening that PR.

What done looks like

  • Core has a macOS way to read another process's environment, put behind mod host with the parsing in an always-compiled parse_* function, as the repo's three-tier cfg rule requires.
  • Rex, Herdr and Luvus find their session marker on macOS as they do on Linux.
  • Core's claude_root_of and claude_fallback_root_of work on macOS too.
  • Built and tested on a Mac, or on CI's hosted Mac when no Mac is available.
Agent notes
  • The likely route is sysctl with KERN_PROCARGS2, which returns argv followed by the environment for a process the caller owns. Check how it behaves for processes owned by another user, and under hardened runtime.
  • Callers: rex_marker in widgets/src/widgets/mux-activity/rex.rs, the Herdr and Luvus marker functions, and claude_root_of / claude_fallback_root_of in core/src/agent_work.rs.
  • Codex's comment is on PR stealth-factory/opscope#647, rex.rs, comment 4582730549.

Activity

1
linear-code[bot]12d ago