mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +00:00
Support pending remote environment registration (#32231)
## Why Remote environment provisioning can finish after a thread starts, before an exec-server WebSocket URL is available. ## What changed - Add `EnvironmentManager::register_pending_environment` and a one-shot `PendingEnvironmentRegistration` handle that resolves to either a validated WebSocket URL or a terminal provisioning error. - Let lazy remote exec-server clients wait for that result, while preserving reconnection behavior after a successful registration. - Keep replacement registrations isolated so completing an older handle does not resolve the current environment with the same ID. ## Testing Add coverage for successful connection and reconnection, provisioning and dropped-registration failures, invalid URLs, replacement isolation, and the deferred-executor startup flow. GitOrigin-RevId: 5c05be2b72291b77a1f71176d7075b1ad63332a5
This commit is contained in:
1 parent
6962a2ecae
commit
4472698728
11 files changed
+244
-115
No files matched your search
@@ -177,25 +177,17 @@ mod tests {
|
||||
assert!(!environments.contains_key(LOCAL_ENVIRONMENT_ID));
|
||||
let remote_environment = &environments[REMOTE_ENVIRONMENT_ID];
|
||||
assert!(remote_environment.is_remote());
|
||||
assert_eq!(
|
||||
remote_environment.exec_server_url(),
|
||||
Some("ws://127.0.0.1:8765")
|
||||
);
|
||||
assert_eq!(
|
||||
default,
|
||||
EnvironmentDefault::EnvironmentId(REMOTE_ENVIRONMENT_ID.to_string())
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn default_provider_normalizes_exec_server_url() {
|
||||
let provider = DefaultEnvironmentProvider::new(Some(" ws://127.0.0.1:8765 ".to_string()));
|
||||
let snapshot = provider.snapshot().await.expect("environments");
|
||||
let environments: HashMap<_, _> = snapshot.environments.into_iter().collect();
|
||||
|
||||
#[test]
|
||||
fn normalizes_exec_server_url() {
|
||||
assert_eq!(
|
||||
environments[REMOTE_ENVIRONMENT_ID].exec_server_url(),
|
||||
Some("ws://127.0.0.1:8765")
|
||||
normalize_exec_server_url(Some(" ws://127.0.0.1:8765 ".to_string())),
|
||||
(Some("ws://127.0.0.1:8765".to_string()), false)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user