fix(tmux): restore saved sessions after a reboot ourselves, not via continuum #59

Merged
jmz merged 1 commit from maximus/tmux-autorestore into master 2026-11-24 17:20:45 +00:00 AGit
Member

Why

After the spl-vm05 restart on 2026-11-24, tmux came back with one empty window, and every Claude session had to be resumed by hand.

Root cause. The status-right autosave hook (#(continuum_save.sh), hardcoded since 10612a9) fires on the first status redraw of a new server. At that point continuum has not yet seeded @continuum-save-last-timestamp, so it saves the empty new server straight away (server start 18:06:02, save 18:06:03) and points last at that save. The restore then has nothing left to restore. Continuum's restore has a second weak spot: it skips whenever it counts more than one other tmux process at startup, and oh-my-tmux's config commands are such processes.

Change

  • Seed @continuum-save-last-timestamp from #{start_time} when the server starts. The first autosave then runs 15 minutes later, and last keeps the pre-reboot layout.
  • Set @continuum-restore off. Instead, run the new ~/.config/tmux/autorestore.sh once per server, on the default socket only, so tmux -L or tmux -S test servers never restore your saves. The script waits until tmux-resurrect has loaded, then runs its restore.sh. The tmux-claude-attention resurrect-restore hook (Claude panes resume) still fires.
  • ~/tmux_no_auto_restore still turns the restore off, as it did with continuum.

Test

Run on an isolated server: separate HOME, separate socket directory, all TMUX* and XDG_* variables unset, and a client attached at once, as after a boot. The fake save held two sessions and three windows.

Config Result
old (master) empty save 1 s after start, last overwritten, nothing restored (reproduces the bug)
new all sessions and windows restored, last untouched
new + source reload no second restore

Rollout: spl-vm05 and wyse-01 pick this up through dotfiles-pull. It takes effect at the next tmux server start.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XMf4EKe3p4ASJuA4DPKqVy

## Why After the spl-vm05 restart on 2026-11-24, tmux came back with one empty window, and every Claude session had to be resumed by hand. **Root cause.** The status-right autosave hook (`#(continuum_save.sh)`, hardcoded since 10612a9) fires on the first status redraw of a new server. At that point continuum has not yet seeded `@continuum-save-last-timestamp`, so it saves the *empty* new server straight away (server start 18:06:02, save 18:06:03) and points `last` at that save. The restore then has nothing left to restore. Continuum's restore has a second weak spot: it skips whenever it counts more than one other `tmux` process at startup, and oh-my-tmux's config commands are such processes. ## Change - Seed `@continuum-save-last-timestamp` from `#{start_time}` when the server starts. The first autosave then runs 15 minutes later, and `last` keeps the pre-reboot layout. - Set `@continuum-restore off`. Instead, run the new `~/.config/tmux/autorestore.sh` once per server, on the **default socket only**, so `tmux -L` or `tmux -S` test servers never restore your saves. The script waits until tmux-resurrect has loaded, then runs its `restore.sh`. The `tmux-claude-attention resurrect-restore` hook (Claude panes resume) still fires. - `~/tmux_no_auto_restore` still turns the restore off, as it did with continuum. ## Test Run on an isolated server: separate HOME, separate socket directory, all `TMUX*` and `XDG_*` variables unset, and a client attached at once, as after a boot. The fake save held two sessions and three windows. | Config | Result | |---|---| | old (master) | empty save 1 s after start, `last` overwritten, nothing restored (reproduces the bug) | | new | all sessions and windows restored, `last` untouched | | new + `source` reload | no second restore | Rollout: spl-vm05 and wyse-01 pick this up through dotfiles-pull. It takes effect at the next tmux server start. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01XMf4EKe3p4ASJuA4DPKqVy
fix(tmux): restore saved sessions after a reboot ourselves, not via continuum
Some checks were skipped
ci / gate (pull_request) Has been skipped
cb2a5a0a89
The spl-vm05 restart on 2026-11-24 brought tmux back with one empty window.
The status-right autosave (#(continuum_save.sh), hardcoded since 10612a9)
fires on the first redraw of the new server. @continuum-save-last-timestamp
is still unset then, so it saves the empty server at once (18:06:03, server
start 18:06:02) and points `last` at it. Continuum's restore then has nothing
to restore. Its restore also skips whenever it counts more than one other
`tmux` process at startup, which oh-my-tmux's config commands can be.

- Seed @continuum-save-last-timestamp from #{start_time} when the server
  starts, so the first autosave runs 15 min later and `last` keeps the
  pre-reboot layout.
- @continuum-restore off. Instead run ~/.config/tmux/autorestore.sh once
  per server, on the default socket only (tmux -L/-S test servers never
  restore). It waits until tmux-resurrect has loaded, then runs its
  restore script, so the Claude resume hook fires as before.

Tested on an isolated server (own HOME and socket, client attached at
once as after a boot). The old config reproduced the bug: an empty save
1 s after start, `last` overwritten, nothing restored. The new config
restored all saved sessions and windows, `last` stayed untouched, and a
config reload did not restore a second time.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01XMf4EKe3p4ASJuA4DPKqVy
jmz merged commit cb2a5a0a89 into master 2026-11-24 17:20:45 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
public/dotfiles-public!59
No description provided.