Skip to content

cmux NEXT: a chat's composer chips and shell command come back after a relaunch - #22790

Merged
teamleaderleo merged 9 commits into
feat-cmux-nextfrom
cmux/relaunch-view-restore
Oct 21, 2026
Merged

teamleaderleo merged 9 commits into
feat-cmux-nextfrom
cmux/relaunch-view-restore

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Leo, 2026-10-20: "After nightlies, have the things running, but have the views go back to where they were."

After a relaunch, an agent chat's composer now comes back with its attached images and files and its unrun shell-mode command. Before this, that state (AgentPaneWakeState) lived only in memory, in AgentTabStore.wakeStates, which hibernation fills when it releases a hidden chat page. So every relaunch dropped it: Restart to Update, SIGTERM's Quit and keep sessions (tonight's 17:51 relaunch), and Cmd-Q.

There is one save path for every kind of relaunch: the quit's prepareWindows step, which all three run. It asks each live chat page for pane.wakeState. The pages are asked all at once, each within 1 s, and the ask only reads. A page still loading keeps the state it was built with, and released pages' kept states are added. The result is written to agent-pane-wake-states.json beside the launch snapshot. Tabs that are no longer in any tree are dropped. Each tab can hold at most 4 MiB and the file at most 8 MiB, keeping the smallest tabs first. At launch the tab store reads the file once and deletes it, and each tab's first page gets its state with its ready handshake, the same way a woken hibernated page does. The file holds attachment contents as plain JSON in the tag's state directory, next to the existing launch images.

What else is restored today (audit)

State Restored after a relaunch? Where it is kept
Terminals, panes, tabs, layout yes cmux-tui daemon
Window frame, display, order, full screen, closed windows yes daemon personal projection (WindowRecordSaver), flushed in prepareForTermination
Selected tab per pane, focused pane per workspace, active screen, top page yes WindowRecord
Sidebar width, sidebar hidden, sidebar group folds yes WindowRecord / sidebar doc
Agent chat draft text yes acpmux (#21509); a new chat's text in AgentUnsentDrafts
Agent chat scroll place yes agent-scroll-anchors.json (chat.scrollAnchor)
Agent pane first frame yes agent-pane-images/ launch images
Browser tab page and scroll yes browser tab records, flushed at quit
Composer attachments and shell-mode command no, fixed here was memory only
Terminal viewport scrolled up into scrollback no comes back at the bottom; needs daemon/Ghostty support, not in this PR
Agent pane inspector, diff view, subagent view no page-local React state; follow-up

Changelog

Fixed: Agent chats keep their attached images and files and an unrun shell command across an app relaunch or update.

Tests

cmux-ci run --class light --script scripts/ci/package-test-lane.sh --arg suite --arg Packages/macOS/CmuxNext --arg <suites> --ref <sha>

  • Red on f21f21b (the test, with the seam stubbed): step f1cd4f0c9bbc7f7481450b02 failed. aChatsComposerComesBackAfterARelaunch: "the live chat came back without its composer". anEmptyComposerLeavesNoFile: "a held shell command was not saved".
  • Green on af8744b: step 9ea6ee2944d89269b4a646be passed. AgentPaneRelaunchWakeTests passed (9 s), AgentPageHibernationTests passed (17 s), UnsentDraftTests passed (1 s).

Observed / Not run

Observed: the fleet red and green runs above, and python3 scripts/cmux-next/prepush-gate.py with no new violations on every push. An independent review subagent passed it with nits; the nits are fixed in af8744b (prune closed tabs, keep a loading page's state, lower the size caps).

Not run: a real relaunch of a tagged build (Restart to Update or SIGTERM) with chips in a composer, so the page-side wake apply after a relaunch is covered only by the existing hibernation path, not seen live. No app build was made on the Mac.

🤖 Generated with Claude Code

Agent session: cosmic-gray

teamleaderleo and others added 2 commits October 20, 2026 19:09
… a relaunch (red)

AgentPaneWakeState (attachments, shell mode with its unrun command, the
transcript's place) lives only in AgentTabStore.wakeStates, in memory, so
Restart to Update, SIGTERM's Quit and keep sessions and Cmd-Q drop it.
The test saves what a live and a released chat page hold through the
quit's seam and expects the next run's first pages to get it back with
their handshake, once. The seam (AgentPaneWakeStateFile,
relaunchWakeStates, restoreWakeStates) is stubbed here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15c01-a42d-7970-a4a7-2f0ac203c940&host=cosmic-gray
…a relaunch

The quit's window step, which every relaunch's quit runs (Restart to
Update, SIGTERM's Quit and keep sessions, Cmd-Q), now asks each live
chat page what it holds that acpmux does not (pane.wakeState, at once,
each within a second), adds the released pages' kept states, and saves
them in agent-pane-wake-states.json beside the launch snapshot. The tab
store reads the file once at launch and removes it; each tab's first
page gets its state with its handshake, as a woken hibernated page does.
A tab over 16 MiB of attachments is not kept, and the file stops at 64 MiB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15c01-a42d-7970-a4a7-2f0ac203c940&host=cosmic-gray
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review 4a2f539: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr22790 -f ref=cmux/relaunch-view-restore -f platform=macos -f backend_mode=local

Not verified: macOS jobs did not run: compile and app tests were skipped on 4a2f5390f3; ci-status is green without them.

CI passes on 4a2f5390f3 (run 39536440453 attempt 1).
macOS jobs did not run: compile and app tests were skipped: Fast static checks skipped (the macos job needs both to succeed). Re-run CI once they pass, before merging.

Written by scripts/ci/classify_failures.py (ci-failure-attribution.yml); signatures are its SIGNATURES table. A machine verdict is the runner's fault, not this PR's; yours means the failing file is one this PR changes, also red on main that main's latest full suite fails the same way, seen on other PRs that it failed on another pull request's run lately.

web and size checks: green

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Bead cx-txbfi created for this PR by the cmux coordinator.

…, and cap at 8 MiB

Review follow-up: a tab gone from every tree keeps nothing, a page built
but not yet handshaken keeps the state it was built with, and the file
the launch reads on the main actor is capped at 8 MiB (4 MiB per tab).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15c01-a42d-7970-a4a7-2f0ac203c940&host=cosmic-gray
@teamleaderleo teamleaderleo added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Oct 21, 2026
@teamleaderleo
teamleaderleo marked this pull request as ready for review October 21, 2026 02:39
@cursor

cursor Bot commented Oct 21, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot uses usage-based billing for this team and requires on-demand usage to be enabled.

A team admin can enable on-demand usage in the Cursor dashboard.

teamleaderleo and others added 3 commits October 20, 2026 19:46
…eep their composer (red)

Review findings on #22790: a restored New Tab page adopts the prewarmed
spare, whose handshake is past, so its kept chips never reach it and stay
in the store; a live page that does not answer pane.wakeState in time, or
that had only a reconnect handshake, saves nothing over the state it was
built with.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15c01-a42d-7970-a4a7-2f0ac203c940&host=cosmic-gray
…ges and slow pages keep it

- The wake file and its collection move to CmuxNextAgentPane
  (AgentPaneRelaunchWake), and AgentUnsentDrafts moves there with it, so
  CmuxNextApp shrinks (SW14, check-app-size) and keeps only the wiring.
- A restored New Tab page with a kept composer gets its own page instead
  of the prewarmed spare, whose handshake is past.
- At quit a page that has not taken its state (no ready yet) keeps it
  unasked, and a page that does not answer in time keeps the tab's held
  state or the one its ready took (AgentPaneModel.handedWake).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15c01-a42d-7970-a4a7-2f0ac203c940&host=cosmic-gray
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

owner: 01a15c01-a42d-7970-a4a7-2f0ac203c940

@blacksmith-sh

blacksmith-sh Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Found 1 test failure on Blacksmith runners:

Failure

Test View Logs
test_the_repository_highlights_validate (main.DigestTests.test_the_repository_highl
ights_validate)/
test_the_repository_highlights_validate (main.DigestTests.test_the_repository_highl
ights_validate)
View Logs

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

…r AgentUnsentDrafts

AgentUnsentDrafts moved to CmuxNextAgentPane in 86da2d5.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15c01-a42d-7970-a4a7-2f0ac203c940&host=cosmic-gray
@teamleaderleo
teamleaderleo merged commit df803fd into feat-cmux-next Oct 21, 2026
@teamleaderleo
teamleaderleo deleted the cmux/relaunch-view-restore branch October 21, 2026 03:18
teamleaderleo added a commit that referenced this pull request Oct 21, 2026
…nd depends on handedWake

Review of #22790: "reconnect" decoded as unsupported, so no handshake
ran; and the test put the held state back after ready, so it passed
without handedWake.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15c01-a42d-7970-a4a7-2f0ac203c940&host=cosmic-gray
teamleaderleo added a commit that referenced this pull request Oct 21, 2026
…nd depends on handedWake

Review of #22790: "reconnect" decoded as unsupported, so no handshake
ran; and the test put the held state back after ready, so it passed
without handedWake.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15c01-a42d-7970-a4a7-2f0ac203c940&host=cosmic-gray
teamleaderleo added a commit that referenced this pull request Oct 21, 2026
…nd depends on handedWake

Review of #22790: "reconnect" decoded as unsupported, so no handshake
ran; and the test put the held state back after ready, so it passed
without handedWake.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15c01-a42d-7970-a4a7-2f0ac203c940&host=cosmic-gray
teamleaderleo added a commit that referenced this pull request Oct 21, 2026
…nd depends on handedWake (#22908)

Review of #22790: "reconnect" decoded as unsupported, so no handshake
ran; and the test put the held state back after ready, so it passed
without handedWake.


Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15c01-a42d-7970-a4a7-2f0ac203c940&host=cosmic-gray

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Shipped in:

@github-actions

Copy link
Copy Markdown
Contributor

Shipped in:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant