Move trusted tool metadata into shared Guardian context (#43597)

## What changed

Represent host-verified tool metadata as `TrustedTool` in `codex-guardian-context` and collect it through an async-only context section. Route Guardian v2 sampling through that section while preserving separate developer-message delivery and the 512-token rendering budget. Omit tool metadata from debug output.

## Testing

Move the rendering-budget test into the shared crate, extend registry coverage for async-only collection and debug redaction, and narrow the scoped approval test to messages tagged `guardian.trusted_tool`.

GitOrigin-RevId: ee7cb4e9b9ceced70438cb58060d1a2973e1dc6a
This commit is contained in:
felixxia-oai authored and copyberry committed 2026-09-07 21:29:31 +00:00
1 parent 0b9b5ecff3
commit 2554239561
16 files changed
+426 -302

No files matched your search

@@ -101,6 +101,7 @@ fn registered_transcript_preserves_shared_roles_and_node_repl_tool_attribution()
planned_action: None,
permissions: None,
previous_reviews: None,
trusted_tool: None,
})
.expect("transcript collection should succeed");
@@ -176,6 +177,7 @@ fn excluded_tool_calls_still_attribute_included_results() {
planned_action: None,
permissions: None,
previous_reviews: None,
trusted_tool: None,
})
.expect("transcript collection should succeed");
@@ -270,6 +272,7 @@ fn outputs_with_call_ids_or_explicit_names_are_retained() {
planned_action: None,
permissions: None,
previous_reviews: None,
trusted_tool: None,
})
.expect("transcript collection should succeed");
let mut expected = vec![
@@ -318,6 +321,7 @@ fn reused_registry_applies_current_history_sources_and_entry_limits() {
planned_action: None,
permissions: None,
previous_reviews: None,
trusted_tool: None,
})
.expect("transcript collection should succeed");
assert_eq!(
@@ -353,6 +357,7 @@ fn reused_registry_applies_current_history_sources_and_entry_limits() {
planned_action: None,
permissions: None,
previous_reviews: None,
trusted_tool: None,
})
.expect("transcript collection should succeed");
let mut expected = vec![ConversationTranscriptEntry {