Add remote ripgrep search request support#12475
Conversation
119e324 to
bd6e2c8
Compare
This stack of pull requests is managed by Graphite. Learn more about stacking. |
bd6e2c8 to
407c565
Compare
| /// 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( |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
synchronously validate the reqeust
| let handle = self.spawn_request_handler( | ||
| request_id.clone(), | ||
| async move { | ||
| let stream = warp_ripgrep::search::search_streaming( |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
convert to proto shape
| break; | ||
| } | ||
|
|
||
| response_bytes += match_bytes; |
There was a problem hiding this comment.
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), |
|
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 Powered by Oz |
There was a problem hiding this comment.
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>
407c565 to
5e08537
Compare
| msg.roots.len() | ||
| ); | ||
|
|
||
| if msg.pattern.is_empty() || msg.roots.is_empty() { |
There was a problem hiding this comment.
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

Description
Base PR (1/2) for remote global search.
app/src/remote_server/server_model.rsis 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_ripgrepon 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
ready-to-specorready-to-implement.Testing
./script/formatcargo nextest run -p remote_server— 89 passedcargo nextest run -p warp -E 'test(global_search) or test(ripgrep_match_to_proto) or test(host_scoped_response)'— 10 passedcargo clippy --workspace --all-targets --all-features --tests -- -D warnings./script/runAgent Mode
CHANGELOG-NONE
Co-Authored-By: Oz oz-agent@warp.dev