mirror of
https://github.com/openai/codex.git
synced 2026-09-16 12:13:30 +00:00
## Why An environment connection can be available before its owner has supplied the configuration for a particular thread attachment. Threads need to start without blocking while ensuring turns do not use that attachment prematurely. ## What changed - Accept `Pending` environment configuration and resolve each attachment only after both its shared executor connection and owner configuration are ready. - Add a `Failed` configuration state and `environment_failed` callback so an owner can fail one thread's attachment without affecting other threads. - Keep pending and failed attachments out of capability-root inspection and turn environments, and allow failed attachments to recover through a ready update. - Apply owner configuration before waking a waiting turn so its permission profile, login-shell policy, capability roots, and tools are immediately consistent. ## Testing Add an integration test covering non-blocking thread startup, independent ready and failed callbacks, waiting-turn resumption, installed capability and tool configuration, and recovery from failure. GitOrigin-RevId: d587e2025d584c867d782d470b18bf5a1a27b76c
27 lines
1.1 KiB
Rust
27 lines
1.1 KiB
Rust
use crate::capabilities::SelectedCapabilityRoot;
|
|
use crate::models::PermissionProfileSnapshot;
|
|
|
|
/// Configuration supplied for a thread's selected environment.
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub enum EnvironmentConfigState {
|
|
/// Preserve the existing thread-derived environment configuration.
|
|
FromThread,
|
|
/// The owner will supply environment configuration later.
|
|
Pending,
|
|
/// The owner supplied configuration for this environment attachment.
|
|
Ready(EnvironmentConfig),
|
|
/// The owner could not supply configuration for this environment attachment.
|
|
Failed(String),
|
|
}
|
|
|
|
/// Resolved configuration for a thread/environment attachment.
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub struct EnvironmentConfig {
|
|
/// Whether shell tools may start login shells in this environment.
|
|
pub allow_login_shell: bool,
|
|
/// Resolved permissions for this thread's environment attachment.
|
|
pub permission_profile: PermissionProfileSnapshot,
|
|
/// Capability roots selected for this thread's environment attachment.
|
|
pub selected_capability_roots: Vec<SelectedCapabilityRoot>,
|
|
}
|