Fix relative file Cmd-clicks in managed SSH terminals
Summary
Fixes #26328. Cmd-clicking a relative file path in a managed SSH terminal now uses the foreground process’s live directory, including after cd without OSC 7. The lookup uses the projected terminal’s already connected SSH link with a five-second deadline and falls back to the reported directory when unavailable.
Candidates keep their original order. An earlier successful absolute path opens without waiting for a later relative candidate’s directory lookup. When every remote candidate fails, the existing localized remote-file error dialog replaces the beep. Successes and failures share the same request, lifecycle, connection, projection and focus checks.
kitty-shell-cwd support is already present on main. No shell configuration or protocol change is needed.
Testing
The regression command is ./scripts/run-e2e.sh cmuxTests/RemoteTerminalFilePreviewLoaderTests --ref <sha>. On test-only commit a37491d90f3d23c723baa1f32a18e1af33498147, 12 tests ran with the two expected failures: an absolute success still queried the directory, and missing candidates returned the file-explorer availability error. The repaired suite passed in head 498c9456 CI; current-head verification is running.
The broader app-host lane also exposed inherited failures. The two shortcut tests now use the existing test-only focus helper, which establishes first responder without requiring a key window in the app-host process. Cloud-header assertions now expect the current localized help text introduced on main. Their routing, selection and tooltip assertions remain intact.
Observed / Not run
- All 16 scoped static checks, changed-Swift syntax parsing,
git diff --check, and Python syntax parsing passed. - Localization audit: existing alert/help keys reused; 11 catalogs and all nine macOS locales passed strict parity validation.
- Independent source review passed the live-cwd implementation and the lazy-lookup/error-dialog repair. Current-head review and remote CI are running.
- Tagged fleet build passed for
09e78f71d4c44b726cc6fc9c3a7f2bdd02ee8653: job71143fd7048a7f2d453cf542, tagissue-26328-ssh-relative-final, artifactsha256:8e4185afdb7f5d72fda2ee8444e57405af3c10bb8cb5926c8c0ceac461fce687. This is app compilation/packaging, not test or runtime interaction evidence. - Live managed-SSH Cmd-click E2E has not run. Its workload now changes directory without injecting OSC 7. Modal presentation and stale-completion UI behavior have source review but no focused runtime UI test.
Changelog
Fixed: Relative file Cmd-clicks in managed SSH terminals follow the shell’s current directory, and unavailable remote files show an error.
Summary by CodeRabbit
- Improvements
- Remote terminal file previews now resolve relative paths using the terminal’s live working directory when available, falling back to its reported directory. Absolute and home-relative paths are also supported.
- Preview errors now display an alert when a remote file cannot be retrieved, with guidance to check the path or reconnect and retry.
- Machine-limit help now clarifies that both running and paused machines count toward the plan limit.