Give Guardian V2 full tool action context (#38441)

## Why

Guardian V2 needs the requested action and its conversation context to assess
risk; a tool name and call ID alone do not describe what the tool will do.

## What changed

- Expose the original, pre-hook `ToolPayload` to tool lifecycle contributors.
- Build Guardian V2 classifier input from the bounded conversation transcript
  and a structured planned-action object containing the tool name and arguments.
- Warn and skip classification if the planned action cannot be serialized.

## Testing

- Verify lifecycle contributors receive tool arguments.
- Verify Guardian V2 sends transcript history and planned-action JSON to the
  classifier.

GitOrigin-RevId: 28266ef7c1d2267ba705fcfbd9be4ef48e64e104
This commit is contained in:
felixxia-oai authored and copyberry committed 2026-08-13 21:49:32 +00:00
1 parent 4343b2bdc4
commit 53eaa297e5
7 files changed
+133 -16

No files matched your search

@@ -3,6 +3,7 @@ use std::pin::Pin;
use std::sync::Arc;
use codex_tools::ToolName;
use codex_tools::ToolPayload;
use crate::ConversationHistorySnapshot;
use crate::ExtensionData;
@@ -59,6 +60,10 @@ pub struct ToolStartInput<'a> {
pub call_id: &'a str,
/// Tool name as routed by the host.
pub tool_name: &'a ToolName,
/// Tool arguments before any pre-tool-use hook rewrites.
///
/// Payloads can contain sensitive plaintext and must not be logged.
pub payload: &'a ToolPayload,
/// Shared read-only snapshot of the conversation when the tool started.
pub conversation_history: Arc<dyn ConversationHistorySnapshot>,
/// Source that issued the tool call.