mirror of
https://github.com/openai/codex.git
synced 2026-11-28 23:34:06 +00:00
Include policy approval reasons in Guardian reviews (#36939)
## Why Guardian reviews received sandbox retry reasons, but not the execution-policy reason that triggered an initial approval request. ## What changed - Propagate approval and retry reasons through the tool approval flow and include the applicable reason in the Guardian prompt. - Prefer a sandbox retry reason when both are available. - Truncate approval context to 512 tokens while preserving the start and end of the reason. ## Testing Added prompt and integration coverage for policy reasons, retry precedence, and truncation. GitOrigin-RevId: 5b0f4e1c40b792b031bc8f7b31685a61d12b8d92
This commit is contained in:
1 parent
3ca9f375aa
commit
2b1357c27c
15 files changed
+219
-58
No files matched your search
@@ -116,13 +116,19 @@ where
|
||||
decision
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub(crate) struct ApprovalRequestReasons {
|
||||
pub(crate) approval: Option<String>,
|
||||
pub(crate) retry: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct ApprovalCtx<'a> {
|
||||
pub session: &'a Arc<Session>,
|
||||
pub turn: &'a Arc<TurnContext>,
|
||||
pub call_id: &'a str,
|
||||
pub tool_name: &'a ToolName,
|
||||
pub retry_reason: Option<String>,
|
||||
pub reasons: ApprovalRequestReasons,
|
||||
pub network_approval_context: Option<NetworkApprovalContext>,
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user