feat(restart): restart running agents in place, resuming their conversation#27
Merged
Conversation
…sation Add `yeschef restart`: swap every live agent in the brigade — the head chef and all running line cooks — for a fresh process without disturbing the brigade layout, resuming each one's prior conversation. This is the "I just updated Claude Code, pick up the new binary without losing context" button. - New `TmuxBackend::respawn_window` wraps tmux `respawn-pane -k -c <cwd>`, which kills the pane's current process and relaunches a command in the SAME pane. The window (name, tab position, `@status` colour) survives untouched — unlike kill + `new-window`, which drops and recreates the tab. - `run_restart` walks the ticket registry intersected with the live window list, respawning cooks first and the head chef last so a restart issued from the head chef's own window (respawning window 0 kills the caller) still brings every cook back up first. Gone windows are skipped; an absent session errors clearly. - Claude-family agents are relaunched with `--continue` to resume their latest conversation in the pane's cwd; other agents restart verbatim (no portable resume flag), keeping yeschef agent-agnostic. Tests: unit tests cover the resume-flag logic, cook-first/head-chef-last ordering, skipping gone windows, and the no-session error; an e2e test proves the real tmux respawn keeps the window while relaunching the process in the same worktree.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
yeschef restart: swap every live agent in the brigade — the head chef and all running line cooks — for a fresh process in place, resuming each one's prior conversation.This is the "I just updated Claude Code, pick up the new binary without losing context" button.
Why
There was no way to restart the running Claude Code sessions (e.g. after a Claude Code update) without killing each window and losing the brigade layout — and re-spawning starts a fresh conversation.
restartswaps only the process inside each window and resumes where the agent left off.How
TmuxBackend::respawn_windowwraps tmuxrespawn-pane -k -c <cwd>, which kills a pane's current process and relaunches a command in the same pane. The window (name, tab position,@statuscolour) survives untouched — unlike kill +new-window, which drops and recreates the tab.run_restartwalks the ticket registry intersected with the live window list, respawning cooks first and the head chef last — so arestartissued from the head chef's own window (respawning window 0 kills the caller) still brings every cook back up first. Gone windows are skipped; an absent session errors clearly (nothing to restart).--continue(reopen the latest conversation in the pane's cwd); other agents (codex,aider, …) restart verbatim — no portable resume flag — keeping yeschef agent-agnostic.Tests
claude→claude --continue, others verbatim), cook-first/head-chef-last ordering, skipping gone windows, and the no-session error.restart_respawns_agent_in_placeproves the window survives while the agent process is genuinely relaunched in the same worktree (a stand-in agent ticks a file on each start — one tick after spawn, a second after restart);restart_without_session_errorscovers the empty-brigade case.Full CI gate green locally:
nix flake check(fmt + nixfmt + clippy-pedantic + unit) andnix run .#e2e(19/19).