#647

mux-activity: look up promoted agents' working directories in one call per poll under Herdr and Luvus

Openwiiiimmopened 10d ago

Under Herdr and Luvus, mux-activity looks up each catalogue-promoted agent's working directory with its own host::agent_cwds(&[pid]) call. Rex already makes one call for every pid.

Problem

stealth-factory/opscope#668 (PR stealth-factory/opscope#669) added catalogue-promoted agent rows under Herdr and Luvus. A promoted agent with a session-log reader (Claude Code, Codex, OpenCode) reads its log from the agent process's own directory. That directory comes from host::agent_cwds, called once per agent inside the pane loop:

  • widgets/src/widgets/mux-activity/herdr.rs: agent_cwds(&[pid]) in the pane loop;
  • widgets/src/widgets/mux-activity/luvus.rs: agent_cwds(&[pid]) in poll.

Linux: each call is a /proc/<pid>/cwd read, which is cheap.

macOS: each call starts its own lsof with a 5-second timeout. N promoted agents can hold a poll for up to N × 5 s, and the rows for that refresh are not drawn until the loop ends.

How often it happens: it is rare. It needs a log-reading agent that the multiplexer did not list itself, and Herdr and Luvus both list Claude Code, Codex and OpenCode directly.

Raised by CodeRabbit on PR stealth-factory/opscope#669 (review 5958296395, "Batch working-directory lookups for promoted agents"). It sat outside any review thread, so it was not addressed before merge.

Scope

  • Under Herdr and under Luvus, collect the pids of the promoted rows that need a directory before building those rows. Then call agent_cwds once per poll with the whole slice, as rex.rs does.
  • Keep reporting the outcome per pid: a directory, agent cwd: … when it cannot be read, or "agent process not found".
  • Make no call at all when no promoted row needs a directory.

Acceptance

  • One agent_cwds call per poll under Herdr, and one under Luvus, covering every promoted row that needs a directory. Zero calls when no row needs one.
  • The per-row outcome text is unchanged, with a test.
  • cargo test passes, including check.rs.

Activity

1
coderabbitai[bot]10d ago
🔗 Related PRs

stealth-factory/opscope#669 - feat: share one coding agent catalogue across mux-activity and agent-activity [closed]


📝 Issue Planner

Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

  • Create Plan

🧪 Issue enrichment is currently in open beta.

You can configure auto-planning by selecting labels in the issue_enrichment configuration.

To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

issue_enrichment:
  auto_enrich:
    enabled: false

💬 Have feedback or questions? Drop into our discord!