Repository navigation
.NET: [BREAKING] CodeAct: redact host-tool diagnostics by default - #9973
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
Security-sensitive Hyperlight redaction and callback/cache isolation remain unverified across the host/guest boundary because all three native backend tests were skipped due to an unavailable guest/hypervisor environment.
No open issues 🎉
What changed in this PR
Adds default-off diagnostic disclosure to .NET Hyperlight and LocalCodeAct, aligning their host-tool error handling while preserving failure signaling. This is the independent .NET companion to Python PR #9971.
Changes:
- Introduces
IncludeDetailedErrorsoptions, with generic host-error messages unless explicitly enabled. - Captures the policy in execution snapshots and includes it in Hyperlight cache fingerprints.
- Adds regression coverage and documents trusted opt-in behavior separately from outer-client error handling.
Native Hyperlight backend verification remains outstanding, as noted in the PR description.
| File | Description |
|---|---|
skills/agent-framework-builder-dotnet/references/integrations.md |
Documents default redaction and trusted opt-in. |
dotnet/tests/Microsoft.Agents.AI.LocalCodeAct.UnitTests/LocalExecuteCodeFunctionIntegrationTests.cs |
Tests caught and uncaught errors and provider policy capture. |
dotnet/tests/Microsoft.Agents.AI.Hyperlight.UnitTests/ToolBridgeTests.cs |
Tests redacted and detailed errors for synchronous and asynchronous tools. |
dotnet/tests/Microsoft.Agents.AI.Hyperlight.UnitTests/SandboxExecutorTests.cs |
Tests policy capture and fingerprint isolation. |
dotnet/tests/Microsoft.Agents.AI.Hyperlight.IntegrationTests/CodeActEndToEndTests.cs |
Adds backend coverage for diagnostic opt-in. |
dotnet/src/Microsoft.Agents.AI.LocalCodeAct/README.md |
Explains LocalCodeAct diagnostic policy and failure behavior. |
dotnet/src/Microsoft.Agents.AI.LocalCodeAct/LocalExecuteCodeFunction.cs |
Captures the standalone function’s diagnostic policy. |
dotnet/src/Microsoft.Agents.AI.LocalCodeAct/LocalCodeActProviderOptions.cs |
Adds the default-off diagnostic option. |
dotnet/src/Microsoft.Agents.AI.LocalCodeAct/LocalCodeActProvider.cs |
Captures provider policy and passes it into run snapshots. |
dotnet/src/Microsoft.Agents.AI.LocalCodeAct/Internal/ProcessBridge.cs |
Redacts host exception types and messages by default. |
dotnet/src/Microsoft.Agents.AI.LocalCodeAct/Internal/CodeExecutor.cs |
Carries snapshot policy into the subprocess bridge. |
dotnet/src/Microsoft.Agents.AI.Hyperlight/README.md |
Documents Hyperlight redaction and cache isolation. |
dotnet/src/Microsoft.Agents.AI.Hyperlight/Internal/ToolBridge.cs |
Redacts tool failures while retaining argument-parse diagnostics. |
dotnet/src/Microsoft.Agents.AI.Hyperlight/Internal/SandboxExecutor.cs |
Propagates policy, isolates cached configurations, and redacts execution exceptions. |
dotnet/src/Microsoft.Agents.AI.Hyperlight/HyperlightCodeActProviderOptions.cs |
Adds the default-off diagnostic option. |
Review effort: Balanced
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: Findings reported
Scope: full PR (1 commit(s)): 2cc859732ba4
Model: gpt-5.6-sol
Overview
The PR introduces a default-off detailed-error policy and consistently carries it through LocalCodeAct snapshots, Hyperlight tool callbacks, and Hyperlight cache fingerprints. Its tests cover sync and async tool failures, caught and uncaught LocalCodeAct errors, policy capture, and cache isolation. One residual Hyperlight path remains: initialization and snapshot-restore exceptions bypass the new redaction policy and can still expose backend diagnostics.
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
1 verified finding remained after source verification (1 medium) across 1 file. Details are attached to the affected lines below.
Affected areas: dotnet/src/Microsoft.Agents.AI.Hyperlight/Internal/SandboxExecutor.cs
Motivation & Context
Give .NET Hyperlight and LocalCodeAct a consistent, host-controlled policy for diagnostic details. Registered tool failures should remain failures without making backend exception text available to generated code unless the application explicitly opts in for a trusted channel.
This PR contains only the .NET implementation, tests, documentation, and .NET consumer guidance split from #9971. It targets
mainindependently and does not depend on the Python PR.Description & Review Guide
IncludeDetailedErrorsoptions to .NET Hyperlight and LocalCodeAct. Redact guest-facing host failures while preserving JSON/subprocess error protocols, capture the policy in provider and standalone snapshots, and include it in Hyperlight configuration fingerprints. Apply the policy to the complete Hyperlight lifecycle and include stack traces and inner exceptions only with trusted opt-in. Update .NET regression coverage and integration guidance.Targeted checks for the latest diagnostic-detail changes, run from
dotnet/:dotnet test --project tests/Microsoft.Agents.AI.Hyperlight.UnitTests -f net10.0 --no-restore -p:TargetFrameworks=net10.0 -p:WarningsNotAsErrors=NU1510— 58 passed.dotnet test --project tests/Microsoft.Agents.AI.LocalCodeAct.UnitTests -f net10.0 --no-restore -p:TargetFrameworks=net10.0 -p:WarningsNotAsErrors=NU1510 --filter-query "/*/*/LocalExecuteCodeFunctionIntegrationTests/*HostErrors*"— 6 passed with real Python subprocesses.Checks used SDK 10.0.401 in a Linux source export, retaining the existing NU1510 package-pruning diagnostic as a warning. SourceLink warnings reflect the Git-free export. The full LocalCodeAct suite previously passed 273 tests; only the 6 affected cases were rerun for this follow-up. Five native Hyperlight cases previously compiled but skipped because the guest/hypervisor environment was unavailable; they were not rerun for this follow-up. These skips are not native verification.
Related Issue
N/A — maintainer-directed consistency update. Companion to #9971, which contains only the Python changes.
AI Assistance
AI assistance details: GitHub Copilot assisted with implementation, tests, documentation, this description, and the language-only PR split.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and the title prefix in sync automatically.