mirror of
https://github.com/openai/codex.git
synced 2026-11-10 21:00:47 +00:00
Allow hosts to provide agent controllers through ThreadManager (#47808)
## What changed - Add `ThreadManager::with_agent_control_factory` to select a host-owned controller asynchronously using the final thread ID for new and cold-resumed threads. Keep local control as the default, reuse live controllers on warm resume, and preserve parent controllers for internal sessions. - Fail startup on factory errors or when a provided controller's identity does not match the session identity. - Defer root service-tier updates to host controllers until thread registration succeeds, preventing failed starts from changing settings on a shared controller. GitOrigin-RevId: 095afbecfee5d47329038d2a97d0cc0081f181df
This commit is contained in:
@@ -70,12 +70,12 @@ impl LocalAgentRuntime {
|
||||
}
|
||||
}
|
||||
|
||||
/// Local construction binds identity after reading history; internal children inherit
|
||||
/// an already-bound controller without selecting a backend again.
|
||||
/// Local construction binds identity after reading history. Hosts and internal children
|
||||
/// provide an already-bound controller without selecting a backend again.
|
||||
#[derive(Clone)]
|
||||
pub(crate) enum AgentControlInit {
|
||||
Local(LocalAgentControl),
|
||||
Inherited {
|
||||
Provided {
|
||||
control: Arc<dyn AgentControl>,
|
||||
runtime: LocalAgentRuntime,
|
||||
},
|
||||
@@ -91,14 +91,14 @@ impl AgentControlInit {
|
||||
pub(crate) fn runtime(&self) -> &LocalAgentRuntime {
|
||||
match self {
|
||||
Self::Local(control) => &control.runtime,
|
||||
Self::Inherited { runtime, .. } => runtime,
|
||||
Self::Provided { runtime, .. } => runtime,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn control(&self) -> &dyn AgentControl {
|
||||
match self {
|
||||
Self::Local(control) => control,
|
||||
Self::Inherited { control, .. } => control.as_ref(),
|
||||
Self::Provided { control, .. } => control.as_ref(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user