sidebar: per-agent status rows (one row per agent pane)

LA
2mo ago
+6183-2572

Summary

  • One sidebar status row per agent pane. statusEntries is workspace-scoped and keyed by agent type (last write wins), so N agents of the same type in one workspace collapsed into a single ambiguous pill. This PR stores a panel-scoped copy of every structured agent status report (statusEntriesByPanelId on the sidebar agent runtime observation model, written in the same socket upsert path) and renders one row per live agent pane.
  • Row semantics: the panel-scoped report wins; the workspace-level entry is only trusted when a single pane owns that status key; with multiple panes and no panel-scoped report, the per-panel agent lifecycle (running / needs input / idle) drives the row so a stale shared text is never attributed to the wrong pane.
  • Rows show a pane label (custom title, directory label, or pane title) when more than one agent runs in the workspace, and clicking a row focuses that pane. Structured entries covered by rows are removed from the flat metadata list to avoid double display; non-structured set_status keys and the CLI list-status output are unchanged.
  • Rows follow pane moves via the existing DetachedAgentRuntimeState transfer (extract now prefers the panel-scoped entry; adopt seeds it in the destination) and clear on agent PID clear, clear_status, and pane close.

Testing

  • cmuxTests/PerAgentSidebarStatusRowTests.swift (wired into pbxproj, lint-pbxproj-test-wiring ok): two same-type agents keep separate rows; sole owner falls back to the workspace entry; shared key without panel entries uses per-panel lifecycle and never the ambiguous shared text; PID clear removes only that pane's row; detached-runtime transfer carries the panel-scoped entry; pane close drops panel-scoped entries.
  • Tagged cloud build agrows.

Issues


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.


[!NOTE]
Medium Risk
Touches sidebar agent attribution, persistence, and control-socket mutation paths where incorrect panel/workspace targeting could show stale or wrong rows; changes are feature-flagged but span CLI and UI behavior.

Overview
Adds one sidebar status row per agent pane instead of collapsing multiple agents of the same type into a single workspace pill. Status is stored and resolved per panel (with safe fallbacks when a shared workspace key is ambiguous), rows can focus their pane, and structured keys shown as rows are hidden from the flat metadata list.

CLI / control socket: cmux set-status gains --panel and --pid; new commands set-agent-lifecycle and clear-agent-pid forward to the socket. Sidebar metadata forwarding resolves workspace/tab and panel IDs more consistently. set_status with a panel can mark dynamicAgentRowKey when the key passes the vault-agent allowlist (not enabled for report_meta).

Also adds localization for agent row lifecycle copy, a sidebar-agent-rows feature flag, debug Agent Rows Style strings, and routine Swift file-length budget updates.

Reviewed by Cursor Bugbot for commit 32fae4cd993d6ba2fe28bc21343519caa872123a. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Show one sidebar status row per agent pane and store status per panel. Previously we collapsed same‑type agents into a workspace pill; now each pane keeps its own row that persists, focuses its pane on click, and safely falls back when a shared key is ambiguous.

  • Storage and rendering: prefer panel‑scoped status; trust a workspace entry only with a sole owner; otherwise render from per‑panel lifecycle. Hide covered keys from metadata. Labels include surface names and pane titles; same‑text title provenance changes (auto→user) now re-render immediately. URL‑backed rows mirror metadata link behavior, and clicks focus the target pane across workspaces.
  • Persistence and autosave: persist panel‑scoped url/priority/format and lifecycles; snapshots carry agentStatusRows; autosave fingerprints hash panel‑scoped content and lifecycles so value‑only changes save promptly. On restore, running → unknown; identical heartbeats don’t churn snapshots.
  • PID ownership and displacement: record PID ownership before writes; bare shared keys rekey to synthesized per‑pane keys so siblings keep rows. Non‑owner clear-agent-pid clears only that pane and refreshes ports; workspace clear_status reaps displaced runtimes. Pane close and agent replacement drop stale rows and workspace slots.
  • CLI/control socket and UI: set-status adds --panel/--pid; new set-agent-lifecycle and clear-agent-pid; registry‑validated dynamic keys can create rows; --workspace resolves both --tab and panel scope; validation runs off‑main. Brand icons with state dots; spinner for running, idle hides; accordion summary when multiple; independent below‑card click targets; graphite prototype and a debug “Agent Rows Style” lab. Gated behind sidebar-agent-rows-enabled-release (DEBUG on, release off).

Summary by CodeRabbit

  • New Features
    • Added dedicated sidebar agent-status rows with idle, needs input, and running states, including per-panel detail, optional URL navigation, and accordion summaries when multiple rows exist.
  • Bug Fixes
    • Improved panel-scoped status attribution and refresh behavior when agents are replaced, panels are adopted/closed, or status entries are cleared—reducing stale, duplicated, or cross-pane updates.
  • Localization
    • Added English and Japanese translations for new sidebar agent-status strings and summary counts.
  • Tests
    • Added coverage for per-panel sidebar status row rendering and counting behavior.