fix(agent): taint model-visible tool responses

This commit is contained in:
RaresKeY
2026-08-15 07:18:25 +00:00
parent 7a138e8a3f
commit 94cf119b11
3 changed files with 141 additions and 21 deletions
+10 -6
View File
@@ -3060,15 +3060,19 @@ def _append_tool_results(
"content": result_text,
}
capabilities = capabilities_for_action(tool_name, tool_content)
if capabilities.result_integrity is not ResultIntegrity.SYSTEM:
should_arm_gate = tool_result_should_arm_gate(
tool_name,
result,
tool_content,
)
if (
capabilities.result_integrity is not ResultIntegrity.SYSTEM
or should_arm_gate
):
result_message["metadata"] = {
"trusted": False,
"source": f"tool result: {tool_name}",
"tool_gate_untrusted": tool_result_should_arm_gate(
tool_name,
result,
tool_content,
),
"tool_gate_untrusted": should_arm_gate,
}
messages.append(result_message)
else: