Skip to content

Add remote ripgrep search request support#12475

Open
moirahuang wants to merge 1 commit into
masterfrom
moira/remote-global-search-backend
Open

Add remote ripgrep search request support#12475
moirahuang wants to merge 1 commit into
masterfrom
moira/remote-global-search-backend

Conversation

@moirahuang

@moirahuang moirahuang commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Description

Base PR (1/2) for remote global search.

app/src/remote_server/server_model.rs is the main logic change, I tried to add comments to break it down and explain what it's doing.

Adds a bounded, cancellable host-scoped remote-server API for running warp_ripgrep on a remote host. The daemon preserves complete matches, caps responses at 5,000 raw matched lines and an approximate 8 MB payload budget, and registers requests synchronously so callers can deterministically cancel stale searches.

The user-facing global search integration is in the stacked follow-up PR.

Linked Issue

N/A

  • 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

  • ./script/format
  • cargo nextest run -p remote_server — 89 passed
  • cargo nextest run -p warp -E 'test(global_search) or test(ripgrep_match_to_proto) or test(host_scoped_response)' — 10 passed
  • cargo clippy --workspace --all-targets --all-features --tests -- -D warnings
  • 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-NONE

Co-Authored-By: Oz oz-agent@warp.dev

@cla-bot cla-bot Bot added the cla-signed label Jun 10, 2026
@moirahuang moirahuang force-pushed the moira/remote-global-search-backend branch from 119e324 to bd6e2c8 Compare June 10, 2026 23:14

moirahuang commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

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

@moirahuang moirahuang force-pushed the moira/remote-global-search-backend branch from bd6e2c8 to 407c565 Compare June 11, 2026 22:16
/// Registers a remote ripgrep request synchronously and returns its typed
/// pending result. Global search uses this instead of `HostRequestHandle`
/// so query cancellation cannot race request registration.
pub fn start_ripgrep_search(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this is synchronous because i wnat to make sure that abort_host_request can find it if needed

msg.roots.len()
);

if msg.pattern.is_empty() || msg.roots.is_empty() {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

synchronously validate the reqeust

let handle = self.spawn_request_handler(
request_id.clone(),
async move {
let stream = warp_ripgrep::search::search_streaming(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

pass params to start searching

let mut matches = Vec::new();
let mut response_bytes: usize = 0;
let mut capped = false;
while let Some(m) = stream.next().await {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

collect results against a match cap, break if we hit the match cap

this version of the design gets all of the results together instead of streaming them as we receive them to the client. we can revisit this if there's performance issues

capped = true;
break;
}
let m = ripgrep_match_to_proto(m);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

convert to proto shape

break;
}

response_bytes += match_bytes;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we're approximating the response bytes by adding up each match's approx bytes to make sure we're staying within a reasonable response size (want to avoid performance issues of huge matches)

me.send_server_message(
Some(conn_id),
Some(&request_id_for_response),
server_message::Message::RipgrepSearchResponse(response),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

send response

@moirahuang moirahuang requested a review from MaggieShan June 11, 2026 23:45
@moirahuang moirahuang marked this pull request as ready for review June 11, 2026 23:46
@oz-for-oss

oz-for-oss Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

@moirahuang

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

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

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.

Overview

This PR adds a host-scoped remote ripgrep search request/response path, including protobuf messages, daemon-side search handling with response caps and cancellation, manager-side pending-search support, and focused tests for conversion and request lifecycle behavior.

Concerns

  • No blocking correctness, security, or spec-drift concerns found in the annotated diff. No approved repository spec context was provided for this PR.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

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

Powered by Oz

Adds a host-scoped remote-server API for bounded, cancellable ripgrep searches, including daemon execution and typed manager lifecycle handling.

Co-Authored-By: Oz <oz-agent@warp.dev>
@moirahuang moirahuang force-pushed the moira/remote-global-search-backend branch from 407c565 to 5e08537 Compare June 12, 2026 01:02
msg.roots.len()
);

if msg.pattern.is_empty() || msg.roots.is_empty() {

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.

nit: is there a way we can move most of this logic to its own file, including the proto helper conversion? this would help isolate the handling of server messages to server_model.rs and prevent the file from growing too large

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