Skip to content

Enable cmd-O and @ context on remote SSH session#11295

Merged
kevinyang372 merged 1 commit into
masterfrom
kevin/enable-cmd-o-at-context-on-remote
May 20, 2026
Merged

Enable cmd-O and @ context on remote SSH session#11295
kevinyang372 merged 1 commit into
masterfrom
kevin/enable-cmd-o-at-context-on-remote

Conversation

@kevinyang372
Copy link
Copy Markdown
Member

@kevinyang372 kevinyang372 commented May 19, 2026

Summary

Enable Cmd-O file search palette and @ context menu file/code categories in remote SSH sessions.

Both features were broken in SSH because the client-side gating assumed local-only paths. The underlying repo metadata layer already supported remote repos — this PR threads LocalOrRemotePath through the remaining client-side consumers.

Changes

Core: Workspace ActiveSession stores LocalOrRemotePath

  • WindowActiveSession.path_if_local: Option<PathBuf>working_directory: Option<LocalOrRemotePath>
  • New working_directory() accessor returns Option<&LocalOrRemotePath> (local or remote)
  • path_if_local() remains as a derived convenience for callers that only need local paths
  • update_active_session now calls terminal.pwd_as_local_or_remote() to populate it

FileSearchModel — remote repo contents + cache

  • New repo_root_location() method uses ActiveSession::working_directory()DetectedRepositories::get_root_for_path() (handles both local/remote)
  • get_contents_from_repo() refactored to accept &LocalOrRemotePath and handle both local and remote repos
  • Cache key changed from HashMap<PathBuf, ...> to HashMap<LocalOrRemotePath, ...>
  • Cache invalidation handles RepositoryIdentifier::Remote via new to_local_or_remote_path() helper

RepositoryIdentifier — new conversion helper

  • Added to_local_or_remote_path() method for clean RepositoryIdentifierLocalOrRemotePath conversion

OpenedFilesModel — remote path support

  • Repo root key: HashMap<PathBuf, ...>HashMap<LocalOrRemotePath, ...>
  • Inner file map: HashMap<PathBuf, Instant>HashMap<String, Instant> (repo-relative paths as strings)
  • file_opened() uses strip_repo_prefix() to compute relative paths (works for both local/remote)
  • code_pane.rs FileOpened handler now tracks files for all repo types, not just local

UI gating updates

  • Command palette (data_sources.rs): uses repo_root_location() to detect remote repos
  • @ context menu (view.rs): is_active_dir_in_git_repo uses ActiveSession::working_directory() directly
  • @ context menu file data source: snapshot_last_opened uses working_directory()get_root_for_path()

Plan

Enable File Search Palette (Cmd-O) and @ Context Menu in Remote SSH

Conversation

https://staging.warp.dev/conversation/700915cd-6778-4a7e-9686-3a25eeb476ce

@cla-bot cla-bot Bot added the cla-signed label May 19, 2026
Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@kevinyang372 kevinyang372 marked this pull request as ready for review May 19, 2026 16:06
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 19, 2026

@kevinyang372

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview

This PR extends file search, opened-file tracking, and @ context gating to use LocalOrRemotePath so remote SSH sessions can surface repo-backed file/code actions.

Concerns

  • The non-local_fs FileSearchModel stub introduces a compile break because LocalOrRemotePath is only imported under feature = "local_fs".
  • This is a user-facing behavior change, but the PR description does not include screenshots or a screen recording demonstrating Cmd-O and @ context menu behavior in a remote SSH session end to end.
  • No approved spec context was available; I did not find security findings in the changed code.

Verdict

Found: 0 critical, 2 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread app/src/search/files/model.rs Outdated
@kevinyang372 kevinyang372 force-pushed the kevin/enable-cmd-o-at-context-on-remote branch from 5e35125 to 38b18bf Compare May 19, 2026 17:56
@kevinyang372 kevinyang372 requested a review from moirahuang May 19, 2026 22:57
Copy link
Copy Markdown
Contributor

@moirahuang moirahuang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. called this out over slack but we should fix the at context menu outside of repos, this can be in a follow-up PR
Screen.Recording.2026-05-19.at.4.16.16.PM.mov
  1. also in the above video, i'm seeing some flicker from "Loading" to "No results" which might be unavoidable but maybe we can debounce or skip "Loading" if we quickly are able to know we have no results

  2. not related to this PR but we're missing path on hover of the tooltip when we open a remote code file

Image

let relative_path =
file_local.strip_prefix(&canonical_repo_path).ok()?;
Some(FileSearchResult {
path: relative_path.to_string_lossy().to_string(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we store the host id as well?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Erm why do we need the host ID here?

Comment thread app/src/terminal/view.rs
// Force the workspace to re-evaluate
// ActiveSession::working_directory. The
// AppStateChanged at line 11671 already ran
// update_active_session once, but for remote
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we make this the definitive place for us to evaluate ActiveSession::working_directory?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are multiple sources for ActiveSession's working directory to change. I think semantically what we want to communicate here is remote repo path updating is a valid state change which should cause us to re-evaluate active session data

@kevinyang372 kevinyang372 force-pushed the kevin/enable-cmd-o-at-context-on-remote branch from 3b848a8 to 49608eb Compare May 20, 2026 02:55
@kevinyang372
Copy link
Copy Markdown
Member Author

I addressed (1)

I will look into (2)(3) as a followup

@kevinyang372 kevinyang372 merged commit 3bd21f8 into master May 20, 2026
28 checks passed
@kevinyang372 kevinyang372 deleted the kevin/enable-cmd-o-at-context-on-remote branch May 20, 2026 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants