mirror of
https://github.com/openai/codex.git
synced 2026-11-14 21:40:39 +00:00
Honor network policy in remote control and recover remote execution (#47410)
## What changed - Route remote-control enrollment, pairing, client management, and WebSocket connections through the authenticated HTTP client factory. Keep policy denials distinct from authentication failures and wait for policy changes before reconnecting. - Preserve policy denials through exec-server connection failures so later connection attempts and capability discovery can recover. Keep direct executors running through temporary policy outages while rejecting permanent policy failures. - Build cached HTTP transports on blocking workers, serialize construction, and retain successful builds after callers time out so request deadlines cover queued construction. ## Testing Add regression coverage for policy recovery during remote startup, direct registration, accepted WebSocket reconnection, and capability discovery; queued transport construction timeouts; and remote-control WebSocket fallback with invalid custom CA files. GitOrigin-RevId: c81db18e83de957175bb213d165281ac701089dd
This commit is contained in:
@@ -1021,19 +1021,28 @@ impl Environment {
|
||||
tracing::warn!(%error, "replaying capability discovery after executor recovery");
|
||||
let recovered =
|
||||
tokio::time::timeout(std::time::Duration::from_secs(8), async {
|
||||
while self.readiness_result().is_none_or(|result| result.is_err()) {
|
||||
loop {
|
||||
match self.readiness_result() {
|
||||
Some(Ok(())) => return Some(Ok(())),
|
||||
Some(Err(error))
|
||||
if !crate::client::is_retryable_recovery_error(
|
||||
&error,
|
||||
) =>
|
||||
{
|
||||
return Some(Err(error));
|
||||
}
|
||||
Some(Err(_)) | None => {}
|
||||
}
|
||||
if connection_state.changed().await.is_err() {
|
||||
return false;
|
||||
return None;
|
||||
}
|
||||
}
|
||||
true
|
||||
})
|
||||
.await
|
||||
.unwrap_or(false);
|
||||
if recovered {
|
||||
discover().await
|
||||
} else {
|
||||
Err(error)
|
||||
.await;
|
||||
match recovered {
|
||||
Ok(Some(Ok(()))) => discover().await,
|
||||
Ok(Some(Err(error))) => Err(error),
|
||||
Ok(None) | Err(_) => Err(error),
|
||||
}
|
||||
}
|
||||
response => response,
|
||||
|
||||
Reference in New Issue
Block a user