Skip to content

fix: skip ripgrep if workspace is remote #6276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 25, 2025

Conversation

uinstinct
Copy link
Contributor

Description

When workspace is remote, we want to avoid running ripgrep. This is because ripgrep will run locally instead of running the workspace server.

  • when workspace is remote, use baseToolDefinitions excluding grepSearchTool
  • add a new type IDE interface isWorkspaceRemote to detect if workspace is remote in vscode and intellij

resolves CON-2298

If it is possible to run os remote call from remote installed extension, we should be able to implement grep search for remote ides. corresponding issue in vscode: microsoft/vscode#252269

Checklist

  • [] I've read the contributing guide
  • [] The relevant docs, if any, have been updated or created
  • [] The relevant tests, if any, have been updated or created

Screenshots

[ For visual changes, include screenshots. Screen recordings are particularly helpful, and appreciated! ]

before.mp4
after.mp4

Tests

[ What tests were added or updated to ensure the changes work as expected? ]

Replication

You can run a docker container for ssh into a remote host.
You can this dockerfile: https://gist.github.com/uinstinct/314da2b450f5440069bbce5ab14043d2

@uinstinct uinstinct requested a review from a team as a code owner June 24, 2025 13:24
@uinstinct uinstinct requested review from Patrick-Erichsen and removed request for a team June 24, 2025 13:24
Copy link

netlify bot commented Jun 24, 2025

👷 Deploy request for continuedev pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 5db1bef

Copy link

recurseml bot commented Jun 24, 2025

⚠️ Only 5 files will be analyzed due to processing limits.

@uinstinct uinstinct changed the title improve: skip ripgrep if workspace is remote fix: skip ripgrep if workspace is remote Jun 24, 2025
Copy link

recurseml bot commented Jun 24, 2025

✨ No issues found! Your code is sparkling clean! ✨

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jun 24, 2025
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Jun 24, 2025
Copy link
Collaborator

@Patrick-Erichsen Patrick-Erichsen left a comment

Choose a reason for hiding this comment

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

Great work, I'm going to save that dockerfile Gist for easier testing in the future! I've been spinning up an EC2 instance for SSH tests but that was way easier.

This worked for me, I just had a nitpick on some of the logic and then we should be good to merge here.

Comment on lines 33 to 34
export const baseToolDefinitions = [...remoteToolDefinitions, grepSearchTool];

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it would be a little more clear if we inverted the logic here/in the await ide.isWorkspaceRemote() call. Renaming baseToolDefinitions to remoteToolDefinitions forces us to always think in terms of remote or not which is more of an edge case

export const localOnlyToolDefinitions = [grepSearchTool]
export const baseToolDefinitions = [ ... ] // unchanged from before

...

 const continueConfig: ContinueConfig = {
    slashCommands: [],
    tools: [
      ...((await ide.isWorkspaceRemote())
        ? baseToolDefinitions
        : [...baseToolDefinitions, ...localOnlyToolDefinitions),
    ],

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, if it's possible to move the (await ide.isWorkspaceRemote()) ternary into a standalone fn in our core/tools folder I think that would be nice to keep the logic centralized. I anticipate that it will continue to get more complicated over time.

Copy link
Collaborator

Choose a reason for hiding this comment

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

One other thought 😅 let's throw a link to the upstream issue you opened on the vscode repo in a comment on the localOnlyToolDefinitions object. Then we can hopefully follow up and remove it in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense. refactored to getToolsForIde inside core/tools/index.ts

@@ -125,6 +125,10 @@ class IntelliJIDE(
return true
}

override suspend fun isWorkspaceRemote(): Boolean {
return this.getIdeInfo().remoteName != "local"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I didn't now we had remoteName logic already built out, neat

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Jun 24, 2025
@Patrick-Erichsen
Copy link
Collaborator

Hmm another thought, maybe we put your Gist into the scripts folder? That would be nice to have on hand.

@uinstinct
Copy link
Contributor Author

Hmm another thought, maybe we put your Gist into the scripts folder? That would be nice to have on hand.

yes agree. made a few changes and added it as a new script

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jun 25, 2025
@Patrick-Erichsen Patrick-Erichsen merged commit dae1218 into continuedev:main Jun 25, 2025
32 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Jun 25, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Jun 25, 2025
@uinstinct uinstinct deleted the remote-ripgprep branch June 26, 2025 03:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants