Follow symlinks in Tab path completion (remote + WSL) - #14746
Open
warp-agent-staging[bot] wants to merge 2 commits into
Open
Follow symlinks in Tab path completion (remote + WSL)#14746warp-agent-staging[bot] wants to merge 2 commits into
warp-agent-staging[bot] wants to merge 2 commits into
Conversation
Symlinks pointing at directories were classified as files in two completer code paths, so they were not offered as directory completions: - Remote/Warpified sessions: the find script used to list a directory omitted -L, so a symlink-to-directory failed -type d and landed in the files bucket. Add -L to both find invocations. - WSL (and other emulated) sessions: the local listing follows a symlink via a host-side metadata() call, which fails when the target lives in the guest path space (e.g. /mnt/c/...). Fall back to resolving the link target through the session before deciding whether it is a directory. Plain local Linux/mac behavior is unchanged (CORE-3402). Broken links and loops still classify as non-directories, so completion never breaks. Adds remote and local symlinked-directory regression tests. Co-Authored-By: Warp Agent <agent@warp.dev>
Comments-only change (no behavioral or test-logic changes). Rewrites the
comments added for the symlink completion fix to follow AGENTS.md: drop
internal-step narration and transformation ("used to") phrasing, keep only
the non-obvious why, and reflow to the 100-column width.
Co-Authored-By: Warp Agent <agent@warp.dev>
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.
Description
Tab path completion did not treat a symlink pointing at a directory as a directory, so such symlinks were not offered as directory completions (no trailing separator, excluded from
cddirectory suggestions). This fixes it in the two completer code paths where symlinks were misclassified:ls_script_for_dirlisted a directory withfind . -maxdepth 1 -type d, which does not follow symlinks, so a symlink-to-directory failed-type dand was bucketed as a file. Bothfindinvocations now use-Lso symlinks are followed when classifying entries.SessionType::Local, where a symlink's directory-ness is resolved with a host-sidemetadata(). When the link target lives in the guest path space (e.g./mnt/c/...), that host-side resolution fails and the entry falls back to file. The local listing now falls back to reading the link target, resolving it through the session's path space (maybe_convert_to_native_path), and stat'ing the converted native path. This fallback is purely additive: it only upgrades a symlink from file→directory when the direct host stat failed, so plain local Linux/mac behavior is unchanged and broken links / loops still classify as non-directories (completion never breaks or hangs).Plain local Linux/mac already followed symlinks (CORE-3402) and is unaffected.
Linked Issue
Closes #4498
ready-to-specorready-to-implement.Testing
Added
test_session_context_follows_symlinked_directories_remotely(regression test for the remote path) — it fails before the-Lchange (symlink-to-dir classified asFile) and passes after. Confirmed both states.Added
test_session_context_follows_symlinked_directories_locallypreserving/extending local-session symlink coverage../script/format --check,cargo clippy -p warp --all-targets --tests -- -D warnings, andcargo nextest run -p warp completer::(13/13 pass) all clean.The WSL runtime path (
\\wsl$\...with/mnt/c/...targets) requires a Windows + WSL host and cannot be exercised on this Linux runner; that code path is verified by inspection and its safety (additive-only, no regression to local/remote) is covered by the tests above. Full WSL behavior should be confirmed on a Windows+WSL host.The
Screenshots / Videossection is removed because there is no rendered UI surface to capture — this change only affects how completer entries are classified, which is verified deterministically by the automated tests above.The manual
./script/runbox below is left unticked: this was verified via the automated regression tests rather than a manual local run of the desktop app.I have manually tested my changes locally with
./script/runAgent Mode
CHANGELOG-IMPROVEMENT: Tab autocomplete now follows symlinks that point to directories (remote/SSH and WSL sessions).
Originating thread: https://warpdev.slack.com/archives/C0BDQDW8V5E/p1785963086148259
Conversation: https://staging.warp.dev/conversation/a9e89e2e-4f9a-4b93-894b-d15a326cacb8
Run: https://oz.staging.warp.dev/runs/019fd3be-69c6-72ae-aea4-bdb5ba1ca004
This PR was generated with Oz.