Skip to content

fix(sessions): restore a session's colour, pin and image watcher after a restart - #591

Open
opticon454 wants to merge 1 commit into
Ark0N:masterfrom
opticon454:fix/restore-session-settings
Open

opticon454 wants to merge 1 commit into
Ark0N:masterfrom
opticon454:fix/restore-session-settings

Conversation

@opticon454

Copy link
Copy Markdown
Contributor

Summary

After a Codeman restart or crash, a session whose tmux pane survived came back with its name, auto-clear, auto-compact, auto-resume and flicker filter, but without its tab colour, pin and image watcher. They reset to defaults and the next persist wrote the defaults over the saved values.

restoreMuxSessions() re-applied the other settings from state.json but never read color, pinned/pinnedAt or imageWatcherEnabled. The reboot-restore path (reapplyPersistedSessionState()) already restores all three; this brings the surviving-pane path in line. The image-watcher flag is set before setupSessionListeners(), which reads it.

Found by running a server on a throwaway HOME, creating a shell session with a custom name, red colour, pin and every option on, kill -9 on the server, and restarting it: before this change colour, pin and image watcher were gone; after it, everything came back.

Tests

test/session-settings-recovery.test.ts pins that restoreMuxSessions() restores every persisted user setting (and everything the reboot-restore path restores), that the image-watcher flag is set before the listeners read it, and that the setters round-trip through toState(). restoreMuxSessions() is not reachable under vitest, so the wiring is a source check, as in test/session-model-recovery.test.ts.

…r a restart

restoreMuxSessions() re-applied name, auto-clear, auto-compact, auto-resume, nice and the
flicker filter from state.json but not color, pinned/pinnedAt or imageWatcherEnabled, which
the reboot-restore path (reapplyPersistedSessionState) already restores. After a restart or
crash a surviving pane came back uncoloured, unpinned and with its image watcher off, and the
next persist wrote that over the saved values. Found by killing -9 a server with a coloured,
pinned shell session and restarting it.
@opticon454
opticon454 force-pushed the fix/restore-session-settings branch from 387ff11 to 79fd2dc Compare October 10, 2026 06:15
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