Closes OPS-302 — https://linear.app/stealth-company/issue/OPS-302/mux-activity-look-up-promoted-agents-working-directories-in-one-call
[skip-cr]
Summary
Under Herdr and Luvus, a catalogue-promoted agent whose session log has a reader (Claude Code, Codex, OpenCode) asked for its own working directory with a separate call. On macOS each call is its own lsof with a 5-second timeout. Both paths now collect those pids first and make one host::agent_cwds call per poll, as Rex already does.
herdr poll
- for pane in panes
- foreground, detect agent
- agent_cwds(&[pid]) # one lsof per promoted agent
- build row
+ for pane in panes
+ foreground, detect agent # looked[]
+ agent_cwds(&cwd_wanted(looked)) # one call; nothing when empty
+ for pane in looked
+ build row from the shared map
luvus poll
- for agent in listed
- pid; agent_cwds(&[pid])
+ pids = listed.map(pid)
+ agent_cwds(pids where needs_agent_cwd) # one call
+ for (agent, pid) in listed.zip(pids)The per-row text is unchanged. A pid missing from the map shows agent cwd was not acquired, an unreadable directory shows agent cwd: …, and a missing pid still says "agent process not found".
Evidence
- Before:
herdr.rsandluvus.rseach calledagent_cwds(&[pid])inside their per-agent loop. - After:
grep -rn "agent_cwds(&\[" widgets/src core/srcfinds nothing. - New tests:
herdr::one_poll_asks_once_for_every_promoted_agent_whose_log_needs_its_directory: only log readers with a pid are asked about, each once, sorted; the result is empty when no row needs one.herdr::a_promoted_agent_left_out_of_the_lookup_still_says_why: the per-row text is unchanged.luvus::only_a_promoted_log_reader_with_no_session_id_needs_the_agents_directory.
- Gates:
cargo test -p opscope-widgets --bin mux-activitypasses 212 of 212, andwidgets/tests/check.rspasses 73 of 73.
Merge Danger
Door: two-way
A refactor of when the lookup happens, not what it returns. The same map feeds the same per-row code.
Blast Radius: mux-activity
Only Herdr and Luvus rows that the catalogue promoted, for log-reading agents. Rex is untouched. On Linux each lookup was already a cheap /proc read, so the gain is on macOS.
🤖 Generated with Claude Code
Activity
4- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
| Review | Status | Commit | Review trigger |
|---|---|---|---|
| 📝 Code Review | ✅ Completed 2026-11-18T16:30:33.186251Z | 59f4b97 | PR opened |
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.