Include Node REPL results in Guardian reviews (#38397)

## What changed

- Capture accepted, successful `node_repl` results from Code Mode and include them as bounded, untrusted evidence in Guardian review prompts.
- Enable the enhanced transcript through `guardian_enhanced_node_repl_transcripts` or when the selected model requires automatic Node REPL review.
- Keep this evidence out of the parent model history, exclude encrypted and failed results, and avoid resending admitted evidence when a Guardian session is reused.
- Clear retained evidence and invalidate review sessions when a thread is rolled back.

## Testing

- Add unit coverage for evidence ordering, escaping, truncation, and empty responses.
- Add an integration test covering feature-disabled, feature-enabled, and model-required behavior, including filtering and review-session reuse.

GitOrigin-RevId: edc3dca5d5b88d472a492f35531ec46889a89d72
This commit is contained in:
Ankush Gupta authored and copyberry committed 2026-08-13 15:50:48 +00:00
1 parent 779e9114ae
commit 053dda6b89
14 files changed
+757 -39

No files matched your search

+4
View File
@@ -88,6 +88,9 @@ pub(crate) trait CoreToolRuntime: ToolExecutor<ToolInvocation> {
Vec::new()
}
/// Observes a tool result only after all PostToolUse hooks accept it.
fn on_tool_result_accepted(&self, _invocation: &ToolInvocation, _result: &dyn ToolOutput) {}
fn post_tool_use_payload(
&self,
invocation: &ToolInvocation,
@@ -743,6 +746,7 @@ impl ToolRegistry {
});
}
}
tool.on_tool_result_accepted(&invocation, result.result.as_ref());
dispatch_trace.record_completed(
&invocation,
&result.call_id,