cx-ncc.104: Debug toggle for the agent pane's in-session status (agent.sessionStatus)
Merged
TE
18d ago+215+215+012345678901234567890123456789-18-18-01234567890123456789
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 toAgentPaneTunables.all, which Debug Settings already lists. No tunables export exists, so nothing is regenerated. - Swift, all in CmuxNextAgentPane (no CmuxNextApp lines):
AgentPaneView.sessionStatusstarts 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 thesessionStatuspage event on the page host and ascmuxAcpmuxBridge.applySessionStatus(on)on the old host. The value is replayed with the view's other state:AgentPanePageHost.currentEvents, old-hostdidFinish, andready. 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
knownParamsor Rust policy entry applies (host events likediffColorsandtoolCardshave none either). - Web:
src/agent-session/acpmux/sessionStatus.tsis a module store withuseSessionStatus()(andsessionStatusOn()), so a push that arrives before the chat mounts is kept.pageHost.tshandlessessionStatus, and the App bridge gainsapplySessionStatus. Consumers swappreviewforuseSessionStatus(). - Gallery:
AgentPaneVariant.sessionStatus?: boolean, delivered indeliver().
Testing
Red then green, same commands:
- Swift:
AgentPaneSessionStatusTests: turning the tunable on reaches an openAgentPaneView.sessionStatusand 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
PinnedPageTestsandRapidWorkspaceCreateTestsfailures 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.
- Red at 9d31713abaa1: fleet step
- Web (sbx):
bun test test/agent-session-status.test.ts. Red: expected true, received false. Green: passes, andbunx vp checkis clean. - Local checks:
check-concurrencyok,crash_ratchetok,check-app-size --baseok (CmuxNextApp unchanged),check-no-godfiles --only swift --baseexit 0 (no "split it"; AgentPaneView did not grow).
Changelog
none
š¤ Generated with Claude Code
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
sessionStatuspage event on the page host andcmuxAcpmuxBridge.applySessionStatuson 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 acceptssessionStatus. - 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.