Skip to content

Follow symlinks in Tab path completion (remote + WSL) - #14746

Open
warp-agent-staging[bot] wants to merge 2 commits into
masterfrom
factory/follow-symlinks-tab-complete
Open

Follow symlinks in Tab path completion (remote + WSL)#14746
warp-agent-staging[bot] wants to merge 2 commits into
masterfrom
factory/follow-symlinks-tab-complete

Conversation

@warp-agent-staging

@warp-agent-staging warp-agent-staging Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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 cd directory suggestions). This fixes it in the two completer code paths where symlinks were misclassified:

  • Remote / Warpified sessionsls_script_for_dir listed a directory with find . -maxdepth 1 -type d, which does not follow symlinks, so a symlink-to-directory failed -type d and was bucketed as a file. Both find invocations now use -L so symlinks are followed when classifying entries.
  • WSL / emulated sessions — these list through SessionType::Local, where a symlink's directory-ness is resolved with a host-side metadata(). 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

  • The linked issue is labeled ready-to-spec or ready-to-implement.
  • Where appropriate, screenshots or a short video of the implementation are included below (especially for user-visible or UI changes).

Testing

  • Added test_session_context_follows_symlinked_directories_remotely (regression test for the remote path) — it fails before the -L change (symlink-to-dir classified as File) and passes after. Confirmed both states.

  • Added test_session_context_follows_symlinked_directories_locally preserving/extending local-session symlink coverage.

  • ./script/format --check, cargo clippy -p warp --all-targets --tests -- -D warnings, and cargo 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 / Videos section 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/run box 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/run

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent 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.

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>
@cla-bot cla-bot Bot added the cla-signed label Aug 5, 2026
@warp-agent-staging warp-agent-staging Bot added the warpy-factory Label associated to the "Wob the Wuilder" factory on staging, also known as Warpy Factory. label Aug 5, 2026
@warp-agent-staging
warp-agent-staging Bot marked this pull request as ready for review August 5, 2026 21:46
@warp-agent-staging
warp-agent-staging Bot requested a review from acarl005 August 5, 2026 21:46
@acarl005 acarl005 self-assigned this Aug 5, 2026
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed warpy-factory Label associated to the "Wob the Wuilder" factory on staging, also known as Warpy Factory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Follow symlinks with Tab autocomplete (Linux client)

2 participants