mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:20:47 +00:00
core: populate guardian parent ids for direct reviews
Populate parent tool item ids for direct guardian-reviewed tool actions while preserving distinct network approval review ids. Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
co-authored by
Codex
parent
8e2dc92d6a
commit
7beebc0c57
@@ -313,7 +313,7 @@ async fn handle_exec_approval_uses_call_id_for_guardian_review_and_approval_id_f
|
||||
assessment_event,
|
||||
GuardianAssessmentEvent {
|
||||
id: "command-item-1".to_string(),
|
||||
parent_tool_item_id: None,
|
||||
parent_tool_item_id: Some("command-item-1".to_string()),
|
||||
turn_id: parent_ctx.sub_id.clone(),
|
||||
status: GuardianAssessmentStatus::InProgress,
|
||||
risk_score: None,
|
||||
|
||||
@@ -406,12 +406,12 @@ pub(crate) fn guardian_request_parent_tool_item_id(
|
||||
parent_tool_item_id,
|
||||
..
|
||||
} => parent_tool_item_id.as_deref(),
|
||||
GuardianApprovalRequest::Shell { .. }
|
||||
| GuardianApprovalRequest::ExecCommand { .. }
|
||||
| GuardianApprovalRequest::ApplyPatch { .. }
|
||||
| GuardianApprovalRequest::McpToolCall { .. } => None,
|
||||
GuardianApprovalRequest::Shell { id, .. }
|
||||
| GuardianApprovalRequest::ExecCommand { id, .. }
|
||||
| GuardianApprovalRequest::ApplyPatch { id, .. }
|
||||
| GuardianApprovalRequest::McpToolCall { id, .. } => Some(id),
|
||||
#[cfg(unix)]
|
||||
GuardianApprovalRequest::Execve { .. } => None,
|
||||
GuardianApprovalRequest::Execve { id, .. } => Some(id),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use super::approval_request::guardian_request_parent_tool_item_id;
|
||||
use super::*;
|
||||
use crate::codex::Session;
|
||||
use crate::codex::TurnContext;
|
||||
@@ -370,6 +371,14 @@ fn guardian_request_turn_id_prefers_network_access_owner_turn() {
|
||||
guardian_request_turn_id(&apply_patch, "fallback-turn"),
|
||||
"fallback-turn"
|
||||
);
|
||||
assert_eq!(
|
||||
guardian_request_parent_tool_item_id(&network_access),
|
||||
Some("command-1")
|
||||
);
|
||||
assert_eq!(
|
||||
guardian_request_parent_tool_item_id(&apply_patch),
|
||||
Some("patch-1")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user