mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:50:52 +00:00
Enforce refreshed Guardian policy on running threads (#62585)
## Why A Guardian policy refresh could leave a thread using its previous restrictions if the new policy disallowed its current model. A refresh could also report success after its managed policy source changed before publication. ## What changed - Use the app server's configuration manager to load Guardian policy from current local and managed configuration. Report an error when the policy source changes before publication or a live thread rejects the update. - Apply updated reviewer and model restrictions even when they block the current model. Keep automatic work queued while the model is blocked and wake it when a later refresh permits it. Allow a new turn to supply a compliant replacement model. ## Testing Regression tests cover policy changes during thread startup and live refresh, queued work resuming after a blocking policy is lifted, and updated policy text reaching Guardian reviews without reconnecting MCP. GitOrigin-RevId: c7d3e119aa409342cc2fa18946ce2b6a4392e0e3
This commit is contained in:
@@ -15,6 +15,7 @@ use std::collections::BTreeMap;
|
||||
use std::collections::VecDeque;
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::Mutex;
|
||||
use tokio::sync::Notify;
|
||||
use tokio::sync::watch;
|
||||
use tokio_util::sync::CancellationToken;
|
||||
use tokio_util::task::AbortOnDropHandle;
|
||||
@@ -136,6 +137,7 @@ pub(crate) struct InputQueue {
|
||||
activity_tx: watch::Sender<InputQueueActivity>,
|
||||
controller: Option<(ThreadId, Arc<dyn AgentControl>, watch::Receiver<bool>)>,
|
||||
mailbox_pending_mails: Mutex<VecDeque<PendingMailboxCommunication>>,
|
||||
pub(super) pending_work_wake: Notify,
|
||||
}
|
||||
|
||||
pub(crate) struct PendingMailboxCommunication {
|
||||
@@ -151,6 +153,7 @@ impl InputQueue {
|
||||
activity_tx,
|
||||
controller: None,
|
||||
mailbox_pending_mails: Mutex::new(VecDeque::new()),
|
||||
pending_work_wake: Notify::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user