Defer executor readiness when prewarming a selected project (#60309)

## What changed

Set `deferred_environment` to `true` in cloud thread prewarm requests when a project is selected. Omit the field for default thread prewarming.

## Testing

Update the prewarm request encoding test to verify that only requests with a selected project include the deferred readiness flag.

GitOrigin-RevId: e10a646ebde9cc3acbdb01b304af0f73ecc1dbeb
This commit is contained in:
Benjamin Carlsson
2026-11-09 00:19:47 +00:00
committed by copyberry
parent 4e4767ffa7
commit 25f4940d4a
2 changed files with 7 additions and 3 deletions
+2 -2
View File
@@ -232,7 +232,7 @@ async fn activation_preserves_native_settings_and_thread_metadata() {
}
#[tokio::test]
async fn prewarm_encodes_blank_and_project_managed_environments() {
async fn prewarm_defers_readiness_only_for_selected_projects() {
let mut fixture = fixture_responses(vec![
response(vec![frame(&[])], tonic::Status::ok("")),
response(vec![frame(&[])], tonic::Status::ok("")),
@@ -274,7 +274,7 @@ async fn prewarm_encodes_blank_and_project_managed_environments() {
b"git@github.com:acme/app.git",
b"\x0a\x21\x2a\x1f",
b"https://github.com/acme/lib.git",
b"\x12\x03App",
b"\x12\x03App\xe8\x01\x01",
]
.concat();
assert_request(&mut fixture, "Prewarm", &expected).await;
+5 -1
View File
@@ -37,13 +37,14 @@ impl Client {
.await
}
/// Prewarm a coding thread with an optional project checkout.
/// Prewarm a coding thread, deferring executor readiness for a selected project checkout.
pub async fn prewarm_thread(
&self,
model: Option<String>,
model_provider: Option<String>,
project: Option<ProjectEnvironment>,
) -> Result<crate::ThreadActivation, Error> {
let deferred_environment = project.is_some().then_some(true);
let managed = match project {
Some(ProjectEnvironment {
name,
@@ -71,6 +72,7 @@ impl Client {
wire::PrewarmRequest {
model,
model_provider,
deferred_environment,
environments: Some(wire::EnvironmentList {
values: vec![wire::EnvironmentSelection {
managed: Some(managed),
@@ -116,6 +118,8 @@ mod wire {
pub model: Option<String>,
#[prost(string, optional, tag = "16")]
pub model_provider: Option<String>,
#[prost(bool, optional, tag = "29")]
pub deferred_environment: Option<bool>,
}
#[derive(Clone, Message)]
pub(super) struct EnvironmentList {