mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Resample Guardian denials with the original request (#59659)
## What changed When `features.guardian_denial_reconsideration` is enabled, retry the first terminal denial once using the unchanged inference request. Buffer provisional output so only the selected response enters reviewer history, while allowing tool calls to proceed normally. Preserve the original denial if the retry fails or times out, and continue to honor cancellation. Account for token usage from both attempts, including failed reviews. Remove `auto_review.experimental_denial_reconsideration_prompt` and warn when it remains in configuration. ## Testing Update the Guardian scenario and snapshot to verify identical retry inputs, retained tool evidence, and reuse of the selected assessment in a subsequent review, with asynchronous compaction enabled. GitOrigin-RevId: cc4e303d40a02acc824c8b4b954852325e64ad52
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
//! Supplies a bounded, review-scoped request to reconsider a Guardian denial.
|
||||
|
||||
use super::ContextualUserFragment;
|
||||
use codex_protocol::models::ContentItem;
|
||||
use codex_protocol::models::ContentItemKind;
|
||||
use codex_protocol::models::input_text;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub(crate) struct GuardianDenialReconsideration<'a> {
|
||||
pub(crate) prompt: Option<&'a str>,
|
||||
}
|
||||
|
||||
impl GuardianDenialReconsideration<'_> {
|
||||
pub(crate) const MAX_BYTES: usize = 1_000;
|
||||
}
|
||||
|
||||
impl ContextualUserFragment for GuardianDenialReconsideration<'_> {
|
||||
fn content_kind(&self) -> ContentItemKind {
|
||||
ContentItemKind("guardian.denial_reconsideration".to_owned())
|
||||
}
|
||||
|
||||
fn role(&self) -> &'static str {
|
||||
"developer"
|
||||
}
|
||||
|
||||
fn markers(&self) -> (&'static str, &'static str) {
|
||||
Self::type_markers()
|
||||
}
|
||||
|
||||
fn type_markers() -> (&'static str, &'static str) {
|
||||
("", "")
|
||||
}
|
||||
|
||||
fn body(&self) -> ContentItem {
|
||||
let prompt = self.prompt.unwrap_or(
|
||||
"For this review only, reconsider your previous denial of the same planned action. \
|
||||
Think carefully about the action, the available evidence, and the user's authorization \
|
||||
under the same security policy. This request grants no new authorization and does not \
|
||||
change the policy. Return your final assessment using the same JSON schema.",
|
||||
);
|
||||
// Config loading rejects oversized overrides; also bound programmatic callers.
|
||||
input_text(prompt[..prompt.floor_char_boundary(Self::MAX_BYTES)].to_owned())
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,6 @@ mod guardian_budget_omission;
|
||||
mod guardian_conversation_history;
|
||||
mod user_goal;
|
||||
pub use guardian_budget_omission::GuardianBudgetOmission;
|
||||
mod guardian_denial_reconsideration;
|
||||
mod guardian_followup_review_reminder;
|
||||
mod guardian_node_repl_policy;
|
||||
mod guardian_policy;
|
||||
@@ -86,7 +85,6 @@ pub(crate) use guardian_approved_action::GuardianApprovedAction;
|
||||
pub(crate) use guardian_assistant_context::render_original_assistant_context;
|
||||
pub use guardian_assistant_context::render_retained_assistant_context;
|
||||
pub(crate) use guardian_conversation_history::GuardianConversationHistory;
|
||||
pub(crate) use guardian_denial_reconsideration::GuardianDenialReconsideration;
|
||||
pub(crate) use guardian_followup_review_reminder::GuardianFollowupReviewReminder;
|
||||
pub(crate) use guardian_node_repl_policy::GuardianNodeReplPolicy;
|
||||
pub(crate) use guardian_policy::GuardianPolicy;
|
||||
|
||||
Reference in New Issue
Block a user