cx-ncc.104: Debug toggle for the agent pane's in-session status (agent.sessionStatus)

Merged
TE
18d ago
+215-18

Following Lawrence's rule (no Labs registry): the agent pane's in-session status (Claude Code desktop's live plan card and recap card) gets a plain DEBUG settings toggle, agent.sessionStatus, off by default. This PR only adds the plumbing that delivers it to every agent page. Nothing visible changes until #20833 (plan card) and #20867 (recap card) read it instead of labs.previewFeatures / the page's preview state.

Design

  • Tunable: AgentPaneTunables.sessionStatus (agent.sessionStatus, "In-session status (plan card, recap card)", Pages section, default off), added to AgentPaneTunables.all, which Debug Settings already lists. No tunables export exists, so nothing is regenerated.
  • Swift, all in CmuxNextAgentPane (no CmuxNextApp lines): AgentPaneView.sessionStatus starts at the tunable's current value, so a new page starts right. Each view follows the tunable through Observation (AgentPaneSessionStatus.follow, a weak-view task), so a flip in Debug Settings reaches open pages without a reload. Changes go out as the sessionStatus page event on the page host and as cmuxAcpmuxBridge.applySessionStatus(on) on the old host. The value is replayed with the view's other state: AgentPanePageHost.currentEvents, old-host didFinish, and ready. AgentPaneView's type shrinks (1322 to 1315 lines) because three didSets were folded to one line each.
  • Policy: this is a host-to-page event, not a page request, so no knownParams or Rust policy entry applies (host events like diffColors and toolCards have none either).
  • Web: src/agent-session/acpmux/sessionStatus.ts is a module store with useSessionStatus() (and sessionStatusOn()), so a push that arrives before the chat mounts is kept. pageHost.ts handles sessionStatus, and the App bridge gains applySessionStatus. Consumers swap preview for useSessionStatus().
  • Gallery: AgentPaneVariant.sessionStatus?: boolean, delivered in deliver().

Testing

Red then green, same commands:

  • Swift: AgentPaneSessionStatusTests: turning the tunable on reaches an open AgentPaneView.sessionStatus and its page's bridge, is in the page-host replay events, a page made afterwards starts on, and turning it off reaches the open page.
    • Red at 9d31713abaa1: fleet step 4952103af1f199315c0c5438, 4 expected issues.
    • Green at b42d7f115e24: fleet step d2e2664b1c30022666d6818b, all 347 suites passed.
    • The red run's PinnedPageTests and RapidWorkspaceCreateTests failures are unrelated flakes. Both pass on the green head, and a base run (4e0fa51c5073ab65d3f1edd1, ec82ecfe04d0) also passed them; that base run's only failure was a different flake, SidebarInsertWhileDisplayAsleepTests.
  • Web (sbx): bun test test/agent-session-status.test.ts. Red: expected true, received false. Green: passes, and bunx vp check is clean.
  • Local checks: check-concurrency ok, crash_ratchet ok, check-app-size --base ok (CmuxNextApp unchanged), check-no-godfiles --only swift --base exit 0 (no "split it"; AgentPaneView did not grow).

Changelog

none

šŸ¤– Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Adds the agent.sessionStatus Debug Settings toggle (off by default) that delivers the agent pane's in-session status (live plan card, recap card) to every agent page without a reload.

  • Each agent view follows the tunable and pushes changes as the sessionStatus page event on the page host and cmuxAcpmuxBridge.applySessionStatus on the old host; open pages update live and later loads start at the current value.
  • The page keeps the value in sessionStatus.ts (useSessionStatus()), and the gallery's agent pane variant accepts sessionStatus.
  • Swift and web tests cover the toggle reaching open and new pages and the host event setting the store.
  • Rebased on the current feat-cmux-next; the merge kept the tunables list, view observations, and page host events alongside the sidebar preview variant.