mirror of
https://github.com/openai/codex.git
synced 2026-11-22 23:00:42 +00:00
Allow thread instruction providers to share updates with subagents (#46577)
## Why Subagents inherit applied instruction snapshots, so later provider updates do not reach running descendants. Hosts need an explicit way to share current thread instructions across an agent tree. ## What changed - Add `ThreadInstructionsProvider::share_with_subagents()`, defaulting to `false`. Opted-in descendants refresh instructions at their next model-request boundary. - Retain shared providers across root unloads and descendant reloads. Let a resumed root replace the provider for surviving descendants, or preserve their last shared instructions when it supplies a non-sharing provider. - Keep providers scoped to their root tree and preserve snapshot-only instructions for root forks and isolated sessions, including Guardian reviews. ## Testing Add coverage for child and grandchild instruction updates and clearing, provider replacement after root restart, lazy descendant reloads, default snapshot inheritance, and isolation between roots and Guardian sessions. GitOrigin-RevId: 44c9fb7fe9ae1f96156bdf3c47ab6c4a81bd65e9
This commit is contained in:
@@ -44,6 +44,18 @@ pub type LoadInstructionsFuture<'a> =
|
||||
pub trait ThreadInstructionsProvider: Send + Sync {
|
||||
/// Loads the current snapshot for the provider's root thread.
|
||||
fn load_thread_instructions(&self) -> LoadInstructionsFuture<'_>;
|
||||
|
||||
/// Whether descendants should retain this provider instead of only its applied text.
|
||||
/// Defaults to snapshot inheritance. Opt in only when the same instruction scope and
|
||||
/// credentials apply to descendants. Descendants share the installed provider; a root
|
||||
/// resume can replace it for surviving descendants. Providers must coalesce/cache
|
||||
/// concurrent reads and retain a usable snapshot during outages.
|
||||
/// If a resumed root supplies a non-sharing provider, existing descendants keep their
|
||||
/// last shared instructions without receiving any new private updates.
|
||||
/// Updates are loaded at each descendant's next model-request boundary, not mid-request.
|
||||
fn share_with_subagents(&self) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/// Loads global user instructions shared across root threads.
|
||||
|
||||
Reference in New Issue
Block a user