Track provisioned environment state across registration (#37147)

## What changed

- Add pending, ready, and failed provisioning states for Noise environments.
- Preserve the same environment instance whether provisioning is reported before or after materialization, and reject conflicts with ordinary environments.
- Make readiness and failure reports idempotent while rejecting contradictory terminal transitions.
- Delay connection attempts until a provisioned environment is selected and provisioning succeeds.

## Testing

- Cover status reports before and after materialization, terminal failures, repeated and contradictory reports, and replacement between ordinary and deferred environments.

GitOrigin-RevId: 4360a8f2a80c1a99a1dc9257e5d77c07b72b8eb3
This commit is contained in:
TAFOYA-OAI authored and copyberry committed 2026-08-05 20:08:41 +00:00
1 parent 2b915a2eed
commit f5345f1ee8
5 files changed
+503 -106

No files matched your search

+18 -7
View File
@@ -106,15 +106,26 @@ impl ExecServerClient {
transport_params => (transport_params, None),
};
if let Some(readiness) = deferred_readiness {
readiness
if let Some(mut readiness) = deferred_readiness {
let provisioning_result = readiness
.wait_for(Option::is_some)
.await
.unwrap_or_else(|_| {
Err("environment registration ended before completion".to_string())
})
.map_err(|message| {
ExecServerError::Disconnected(format!("environment unavailable: {message}"))
.map_err(|_| {
ExecServerError::Disconnected(
"environment unavailable: environment provisioning ended before completion"
.to_string(),
)
})?
.clone()
.ok_or_else(|| {
ExecServerError::Disconnected(
"environment unavailable: provisioning remained pending after completion"
.to_string(),
)
})?;
provisioning_result.map_err(|message| {
ExecServerError::Disconnected(format!("environment unavailable: {message}"))
})?;
}
let (websocket_url, connect_timeout, initialize_timeout) = match transport_params {