feat: add app.restorePreviousSession toggle to disable startup session restore - #13
Merged
Merged
Conversation
…n restore cmux unconditionally restores the previous launch (windows, workspaces, working directories, and terminal content) on startup. There was no user-facing way to turn that off — only the undocumented CMUX_DISABLE_SESSION_RESTORE=1 env var, which is awkward for a GUI app. Add app.restorePreviousSession (default true, preserving current behavior). When false, the automatic startup restore is skipped and each launch opens a fresh workspace seeded by app.defaultWorkspacePath. The explicit "Restore Previous Launch" command is intentionally unaffected — it does not route through shouldAttemptRestore(). The gate lives in SessionRestorePolicy.shouldAttemptRestore(), alongside the existing CMUX_DISABLE_SESSION_RESTORE / automated-test gates, so all startup-restore suppression stays in one place. Wired through every surface per repo conventions: - AppCatalogSection.restorePreviousSession (DefaultsKey<Bool>) - SessionRestorePolicy gate + UserDefaults reader (default true when unset) - cmux.json boolean mapping (CmuxSettingsJSONPathSupport) - JSON schema (web/data/cmux.schema.json) - Settings → App toggle row + settings-search entry - generated cmux.json template - localization (en + ja) in Localizable.xcstrings - docs/configuration.md - regression tests (SessionPersistenceTests, wired target) Claude-Session: https://claude.ai/code/session_01CNYr3XgjVDLsPNnPQxarn4
evandhoffman
enabled auto-merge (squash)
June 20, 2026 17:21
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 a user-facing setting to stop cmux from automatically restoring the previous launch (windows, workspaces, working directories, and terminal content) on startup.
Previously the only way to disable this was the undocumented
CMUX_DISABLE_SESSION_RESTORE=1env var — awkward for a GUI app. Now there'sapp.restorePreviousSession(defaulttrue, preserving today's behavior). Whenfalse:app.defaultWorkspacePath.How
The gate lives in
SessionRestorePolicy.shouldAttemptRestore()(Sources/SessionPersistence.swift), next to the existingCMUX_DISABLE_SESSION_RESTOREand automated-test gates, so all startup-restore suppression stays in one place. ArestorePreviousSessionEnabled(defaults:)reader returnstruewhen the key is unset (historical behavior).Surfaces wired (mirrors the
app.defaultWorkspacePathpattern from #5/#12)AppCatalogSection.restorePreviousSession—DefaultsKey<Bool>SessionRestorePolicygate + default-true UserDefaults readercmux.jsonboolean mapping (CmuxSettingsJSONPathSupport)web/data/cmux.schema.json)cmux.jsontemplateResources/Localizable.xcstrings)docs/configuration.mdTests
Four regression tests in
SessionPersistenceTests(a wired target), all passing locally:truewhen unset; reader reflects stored valueshouldAttemptRestore(restorePreviousSessionEnabled: false)→ skips restoreshouldAttemptRestore(restorePreviousSessionEnabled: true)→ proceedsValidation
xcodebuildDebug build: SUCCEEDEDAppSection.swift,SessionPersistence.swift, test file grew)description(matchesdefaultWorkspacePathprecedent — nodescriptionKey); template key and docs are not translatable UI strings.https://claude.ai/code/session_01CNYr3XgjVDLsPNnPQxarn4