Skip auto-save during boot grace to prevent restore clobber#159
Open
vivek8031 wants to merge 1 commit into
Open
Skip auto-save during boot grace to prevent restore clobber#159vivek8031 wants to merge 1 commit into
vivek8031 wants to merge 1 commit into
Conversation
When @continuum-restore is on, a periodic auto-save can fire after the bootstrap (single-session) tmux state is created but before the backgrounded continuum_restore.sh has finished. The save then overwrites the resurrect 'last' symlink with the bootstrap-only state, so auto-restore reads a near-empty file and brings nothing back. Reproduce: kill the tmux server, start it fresh (e.g. via @continuum-boot or `tmux new-session -d`), and let auto-restore race the next status-bar driven continuum_save. Affected users have reported intermittent restore failures over the years (tmux-plugins#90, tmux-plugins#94, joeywrites.dev/posts/fixing-broken-tmux-resurrect-save). Add an in_boot_grace_window guard that, only when auto-restore is enabled, blocks auto-save until uptime exceeds @continuum-restore-max-delay + 30s. The 30s buffer covers the actual restore work after the delay window expires. When auto-restore is disabled the guard is a no-op, preserving existing behaviour. Verified with three isolated tests against a separate tmux socket: 1. uptime=21s, restore=on -> save SKIPPED (correct) 2. uptime=42s, restore=on -> save FIRED (correct) 3. uptime=1s, restore=off -> save FIRED (correct, no false positive)
This was referenced May 21, 2026
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.
Problem
When
@continuum-restore onis set, a status-bar drivencontinuum_save.shcan fire after the bootstrap (single-session) tmux state has been created but before the backgroundedcontinuum_restore.shhas finished restoring the saved sessions. The save then overwrites the resurrectlastsymlink with the bootstrap-only state, so auto-restore reads a near-empty file on the next boot and brings nothing back.This matches symptoms reported in:
ln -sfworkaround for exactly this clobbered-symlink stateReproduction
Fix
Add an
in_boot_grace_windowguard tocontinuum_save.sh's main loop. The guard only activates when@continuum-restore onis set (so users who don't auto-restore aren't affected) and blocks auto-save until uptime exceeds@continuum-restore-max-delay + 30s. The 30s buffer covers the actual restore work after the delay window for restore-start expires.Verification
Tested against a separate tmux socket (
-L test-patch) with@resurrect-save-script-pathpointed at a probe script that logs invocations:@continuum-restoreononoffCompatibility
@continuum-restore-max-delay(default10).@continuum-restoreis off or unset (default).