Keep stable shell paths in detection and recover stale shell preferences - #15837
Keep stable shell paths in detection and recover stale shell preferences#15837thiagohflima wants to merge 1 commit into
Conversation
Shell detection canonicalized /opt/homebrew/bin/<shell> to the versioned Homebrew Cellar path, and that path was persisted as the new-session shell preference. A formula upgrade removes the old Cellar directory, so the exact path match against re-detected shells failed and the preference silently fell back to the system default shell. Detection now keeps the discovered (symlink-stable) path for storage and launch, using the canonical path only as the dedupe key. Preferences that no longer match a detected shell recover instead of resetting to the default: an existing path is matched by canonical target (covering preferences persisted by older builds), and a vanished path resolves to the detected known shell of the same type, preferring the install closest to the stale path. Session restore applies the same recovery to stale snapshot paths before falling back to a custom shell. Fixes warpdotdev#15836
|
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the users @thiagohflima on file. In order for us to review and merge your code, each contributor must visit https://cla.warp.dev to read and agree to our CLA. Once you have done so, please comment |
|
Every PR must be linked to a same-repo issue before Oz can review it. This PR is linked to #15836, but no linked issue is marked See the contribution guidelines for the full readiness model. Powered by Oz |
There was a problem hiding this comment.
Every PR must be linked to a same-repo issue before Oz can review it.
This PR is linked to #15836, but no linked issue is marked ready-to-implement yet. Only repository maintainers apply that label, so please wait for a maintainer to mark the issue. Once it is marked, push a new commit or comment /warp-agent-review to re-trigger review.
See the contribution guidelines for the full readiness model.
Powered by Oz
|
@cla-bot check |
1 similar comment
|
@cla-bot check |
|
The cla-bot has been summoned, and re-checked this pull request! |
1 similar comment
|
The cla-bot has been summoned, and re-checked this pull request! |
Description
Fixes #15836.
On macOS, selecting a Homebrew-installed shell (e.g. fish) as the default shell for new sessions silently reverted to the system default (zsh) after every
brew upgradeof the shell.Root cause: shell detection canonicalized
/opt/homebrew/bin/<shell>to the versioned Cellar path (dunce::canonicalizeinresolve_all_executables/load_fallback_shells), and that versioned path was persisted as theNewSessionShell::Executablepreference. A formula upgrade removes the old Cellar directory, so the exact-path match against re-detected shells failed andget_user_preferred_shellsilently fell back toSystemDefault.This PR implements the direction suggested in the issue's triage:
resolve_all_executablesandload_fallback_shells. New preferences persist/opt/homebrew/bin/fish, which survives upgrades.get_user_preferred_shellrecovers preferences that no longer exact-match a detected shell instead of silently resetting: an existing path is matched by canonical target (covers preferences persisted by older builds, i.e. the rollout transition), and a removed path resolves to the detected known shell of the same type, preferring the install closest to the stale path (multi-install machines).get_from_shell_launch_data) applies the same recovery to stale snapshot paths before falling back to a custom shell, so restored workspaces also survive an upgrade that happened while Warp was closed.No UI changes.
Linked Issue
Fixes #15836
ready-to-specorready-to-implement. — filed by this PR's author with a full root-cause analysis and repo-validated repro (repro:high, deemed eligible for auto-implementation); per the "PRs opened without a linked issue" guidance, this PR links it for maintainer readiness review.Testing
Automated (new regression tests in
app/src/terminal/available_shells_tests.rs, all hermetic viaVirtualFS):test_keeps_stable_symlink_path_for_homebrew_shells— detection stores the stablebin/fishsymlink, not the Cellar path, in a simulated Homebrew layout.test_recovers_executable_preference_via_canonical_alias— a preference persisted as an old Cellar path still matches while the file exists (Warp-update transition).test_recovers_stale_executable_preference_by_shell_type— a removed Cellar path recovers to the detected fish.test_recovery_prefers_the_closest_install_prefix— multi-install machines pick the install closest to the stale path.test_does_not_recover_existing_unmatched_or_non_shell_preference— out-of-catalog executables keep prior behavior.test_get_from_shell_launch_data_recovers_stale_snapshot_path— session restore recovers stale snapshot paths; existing unknown paths still restore as custom shells.test_dedupe_symlinks_when_discovering_paths— updated to document that dedupe keys are canonical while stored paths remain the discovered ones.I don't have a Rust toolchain on this machine, so I lean on CI for
./script/presubmit(fmt/clippy/nextest); I verified the change by close reading and self-review only. Happy to push follow-ups if CI flags nits../script/run— unable to build locally (no toolchain); the change alters shell resolution logic only and is covered by the tests above, but I understand if a manual./script/runpass is needed and can arrange one on request.Screenshots / Videos
Not applicable — no user-visible UI change.
Agent Mode
CHANGELOG-BUG-FIX: Fixed the default shell preference silently resetting to the system default shell after a Homebrew upgrade of the shell.