Add a test for remote tool use by the agent (#30289)

- Adds a new smoke test for the use of the read_file tool by the agent
in an SSH project
- Fixes the SSH shutdown sequence to use a timer from the app's executor
instead of always using a real timer
- Changes the main executor loop for tests to advance the clock
automatically instead of panicking with `parked with nothing left to
run` when there is a delayed task

Release Notes:

- N/A
This commit is contained in:
Cole Miller 2025-05-08 16:53:04 -04:00 committed by GitHub
parent 660b4cee76
commit 8b764a5477
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 104 additions and 13 deletions

View file

@ -281,6 +281,9 @@ impl BackgroundExecutor {
}
if !dispatcher.parking_allowed() {
if dispatcher.advance_clock_to_next_delayed() {
continue;
}
let mut backtrace_message = String::new();
let mut waiting_message = String::new();
if let Some(backtrace) = dispatcher.waiting_backtrace() {

View file

@ -89,6 +89,15 @@ impl TestDispatcher {
self.state.lock().time = new_now;
}
pub fn advance_clock_to_next_delayed(&self) -> bool {
let next_due_time = self.state.lock().delayed.first().map(|(time, _)| *time);
if let Some(next_due_time) = next_due_time {
self.state.lock().time = next_due_time;
return true;
}
false
}
pub fn simulate_random_delay(&self) -> impl 'static + Send + Future<Output = ()> + use<> {
struct YieldNow {
pub(crate) count: usize,