Skip to content

feat(app): add Restart Session to the session menu - #1854

Open
chphch wants to merge 1 commit into
slopus:mainfrom
chphch:feat/restart-session
Open

chphch wants to merge 1 commit into
slopus:mainfrom
chphch:feat/restart-session

Conversation

@chphch

@chphch chphch commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Adds Restart Session to the session menu — a long press in the session list on phones, a right click on web — for a live session its machine can resume. It stops the session's CLI process and resumes the same session, so the conversation carries on in a fresh CLI process: what Archive followed by Resume does by hand today, for instance to pick up a newly installed CLI (a running session keeps the CLI it was started with) or to get a stuck session going again.

Why it is not literally Archive + Resume

Archive stops a session by asking its own process to exit, and until that process has gone the daemon answers a resume as if the session were still running — success, with nothing started — so a resume sent straight after it leaves the session down. Restart asks the daemon to do the stopping instead: the daemon marks the process as stopping and refuses a resume with an error until the process has exited, so the resume is retried (every 0.5 s, for up to 15 s) until the machine takes the session back. A daemon only knows the sessions started while it was running, so for a session older than its daemon Restart falls back to Archive's way of stopping and waits for the session to go offline before resuming. It leaves out what Archive does for a session that is going away: the worktree cleanup, taking the row out of the list, and moving the screen off the chat. The model and permission mode are resolved before anything is stopped, so a mode the resume would refuse cannot leave the session down.

It relies on two fixes kept separate: #1853 (without it, a session older than its daemon is never stopped and the restart ends in an error after 15 s) and #1852 (server — without it, the restarted session shows offline and is missing from the list for about a minute).

This is a different approach from #990, which restarts the Claude query inside the same CLI process. That keeps the old CLI, and picking up a new CLI is the main reason to restart after an upgrade.

Proof

Local stack with a real daemon and Claude session, #1852 and #1853 applied. The session's CLI process changed (pid 41087 → 41714) under the same session id, the old process was gone 0.6 s after the press, the session was back online 4 s after it, and a follow-up was answered from the conversation before the restart. The same session restarted again after a daemon-only restart (so the new daemon did not track it) was resumed 0.5 s after the press. On web the shortcut is ⌥⇧⌘R / Ctrl+Alt+Shift+R, next to Resume's ⌥⌘R; strings are added in all 10 languages. Typecheck and the app suite pass.

Restart Session: menu, stop, back online under the same session id, conversation continues

Restarting a session - to pick up a newer CLI, or to get a stuck one
going again - meant archiving it, finding it among the archived
sessions and resuming it. Restart Session does that from the session
menu (a long press in the session list on phones, a right click on
web) for a live session its machine could resume: the session keeps
its id and its conversation and gets a new CLI process.

It is not Archive followed by Resume. Archive stops a session by
asking its own process to exit, and until that process has gone the
daemon answers a resume as if the session were still running -
success, with nothing started. Restart has the daemon do the stopping
instead, which marks the process as stopping and makes a resume fail
until the process has exited, so the resume is retried until the
machine takes the session back. A daemon only knows the sessions
started while it was running, and a CLI upgrade restarts it, so a
session older than its daemon is stopped the way Archive stops it and
the resume waits for it to go offline first. Restart also leaves out
what Archive does for a session that is going away: the worktree
cleanup, taking the row out of the list, and moving the screen off
the chat.

The model and permission mode are resolved before anything is
stopped, so a mode the resume would refuse cannot leave the session
down. On web the shortcut is ⌥⇧⌘R / Ctrl+Alt+Shift+R, next to
Resume's ⌥⌘R.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant