Session Info: native panel close reaches the page on every host, so the header toggle clears
Summary
Native Session Info's header toggle must read as on exactly while the App's panel shows, and off once it closes, as it does for the web panel. Leo (2026-11-02, softened): "the entire point was to have it look good work good HAVE THE TOGGLED HIGHLIGHT".
Spec (design/session-info.md): "Its header toggle and Esc (from inside it) close it." and "The header's tools stay where they are, open or closed."
What I found:
- The page-side state already drives both the toggle and the native model from one value (
showninuseSessionInfo), so the toggle follows the panel's open state through the toggle, the panel's ownclose(AppKit Esc), Esc on the toggle and per-chat switches. A new jsdom test pins all four with the native host on (webviews/test/native-session-info-toggle.test.tsx), so this coupling can't drift. - A real bug on the old page host (no page host: a dev-server page,
agent.pageHostoff):AgentPaneSessionInfo.actionScriptemittedwindow.cmuxAcpmuxSessionInfo?.action?(…). That is a JavaScript syntax error, so every native panel action there, including its Escclose, folds, drags and row clicks, never reached the page. The panel stayed open with its toggle lit after a close. It now emits?.action?.(…). A Swift test runs the scripts in JavaScriptCore and checks that they reach the page bridge (AgentPaneNativeSessionInfoTests.oldHostActionScriptsRunAndReachThePage).
The script bug came in with the native panel (#31930).
Only touches the action script and tests; no panel background, header/grip or column layout changes (sibling items).
Test plan
cd webviews && bun test test/native-session-info-toggle.test.tsx: 4 pass (head).swift test --filter AgentPaneNativeSessionInfoTestsvia cmux-ci (fleet), red on the test commit (bdc2b4d) and green on the fix: results in a comment below.cmux-ci compile-check --ref <head> --package CmuxNext: result in a comment below.
Observed / Not run
- Observed: the web test passes locally; web-lint passes (the type-aware lint is left to CI on this host); the prepush gate reports no new violations.
- Not run here: Swift build and tests (fleet only, results posted as comments). No capture: the visible state (the lit toggle) was already right on the page-host path, as the capture scene's
header_toggle_pressedreadiness check shows; the fix is on the old-host script path, which capture slots don't use.
Follow-up (not in this PR): Esc after clicking inside the native panel leaves first responder on the web view, so the page's Esc handler (which needs focus on the toggle or panel) does not see it. The web panel takes focus on a click, so it closes there.
Changelog
Fixed: closing native Session Info from the panel itself now clears the header toggle's highlight on every page host.
Agent session: agent session
🤖 Generated with Claude Code
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Summary by cubic
Fixes the native Session Info header toggle so closing the panel clears its highlight on every page host.
On the old page host, the panel's action script was invalid JavaScript (?.action?(…) is a syntax error), so closing the panel with Esc never reached the page and the toggle stayed lit. The script now emits valid ?.action?.(…) and the close always reaches the page.
- Adds a jsdom test pinning the toggle to the panel's open state through the toggle, the panel's own Esc close, Esc on the page, and per-chat switches.
- Adds a Swift test running the old-host action and host scripts in JavaScriptCore.
Only touches the action script and tests; no panel background, header, or column layout changes.