Toggle agent session auto-resume on reopen (#3610)
Closes #3610.
Summary:
- Replaces the mistaken per-agent Vault visibility controls with one Terminal setting:
Resume Agent Sessions on Reopen. - Adds
terminal.autoResumeAgentSessionsforcmux.jsonand Settings search. - Gates only the reopen restore path that injects agent resume startup input; saved agent session metadata and Vault indexing remain unaffected.
- Adds regression coverage for the setting default/notification behavior, settings-file parsing, Settings search anchoring, and restored agent panels not injecting startup input when auto-resume is disabled.
Verification:
git fetch origin && git merge origin/maincompleted; conflicts resolved without YAML edits.git diff --checkjq empty Resources/Localizable.xcstrings web/data/cmux.schema.jsonpython3 scripts/swift_file_length_budget.py --budget .github/swift-file-length-budget.tsv- Local tests intentionally not run per repository policy.
[!NOTE]
Medium Risk
Changes session-restore behavior for agent-backed terminals and adds new managed setting propagation; regressions could affect whether restored agent sessions resume (or stay idle) after relaunch.
Overview
Adds a new Terminal setting, “Resume Agent Sessions on Reopen” (terminal.autoResumeAgentSessions), defaulting to on, exposed in Settings UI and searchable via Settings search/anchors.
Session restore now conditionally injects agent resume startup input based on this toggle, while cmux.json parsing/managed-default application is updated to support the new key (including supported JSON paths, schema/docs updates, and localized strings).
Refactors managed-default side effects to batch notifications, adds debug helpers for initial-input inspection, and introduces targeted tests covering the setting’s defaults/notifications, settings-file application, search indexing, and restore behavior when auto-resume is disabled.
Reviewed by Cursor Bugbot for commit d749a8e7267bea21730b9adb68a26c96cdb091bc. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
-
New Features
- Added "Resume Agent Sessions on Reopen" setting to terminal preferences, allowing users to control whether agent sessions automatically resume when reopening after quit.
- Expanded settings search to include agent auto-resume related terms.
- Implemented CLI events command with cursor tracking and reconnection support.
-
Documentation
- Updated configuration documentation and schema with the new auto-resume setting.
-
Tests
- Added comprehensive test coverage for the new agent session auto-resume functionality.