Skip to main content

Module restart

Module restart 

Source
Expand description

Putting a claude session back on the version that is installed now.

The part where a mistake costs a turn of work rather than a redraw. Everything here is built around one rule: a pane it cannot be sure about is skipped, with a reason. Guessing which conversation a pane is on and then interrupting it is worse than doing nothing.

The guards, in the order they are applied, and what each is for:

  1. Not this pane. Restarting the pane taimux is running in would kill taimux mid-restart.
  2. Only a stale version. A pane already on the installed version has nothing to gain from being interrupted.
  3. Idle, unless --include-busy. A turn in flight is work in progress.
  4. A conversation that could be identified, from the ladder in conv.
  5. No dialog on screen, ever, even with --include-busy: a half-answered permission prompt is the one state where a Ctrl-C means something else.
  6. No unsent draft, and a settled transcript, unless --include-busy.
  7. No transcript claimed twice. Resuming one conversation into two panes is the same mistake on a restart as on a restore.

Structs§

Live
The live implementation of everything plan needs.
Opts
Plan
Planned
One pane the plan will act on.

Traits§

Env
Everything the plan needs from the outside, so it can be built against fixtures as well as against a live machine.

Functions§

capture_zoomed
One pane’s screen, read at a size claude will draw its prompt box on.
confirm_yes
The default answer is yes, so a bare Enter restarts. The plan has already been printed by then, which is what makes that safe.
describe_nonpane
What to say about a claude that has no pane.
installed
What a session started right now would run, refusing rather than guessing when the launcher points somewhere unexpected.
launcher
nonpane_pids
A claude process that is not any pane’s foreground job: Zed’s ACP bridge, a background agent, one of the daemon’s spare pty hosts.
plan
Decide what to restart, and say why for everything else.
render
The plan, as the reader sees it. Byte-for-byte what bash printed, because the only way to know a port of this is right is to compare it.
restart_pane
Interrupt a session, wait for it to go, and type its replacement.
screen_has_no_dialog
Is the screen free of anything a Ctrl-C would mean something else to?
screen_has_no_draft
Is the prompt box empty?
transcript_is_settled
Is this transcript quiet enough to interrupt?
version_of_pid
The version a running process is executing, read from its own /proc/exe rather than from the binary on $PATH: a long-lived session goes on running the release it started under.
versions_dir