Skip to content

.NET: include host-tool JsonSchema in Hyperlight execute_code descriptions - #8528

Open
leilei3167 wants to merge 2 commits into
microsoft:mainfrom
leilei3167:fix/issue-8446-hyperlight-host-tool-jsonschema
Open

leilei3167 wants to merge 2 commits into
microsoft:mainfrom
leilei3167:fix/issue-8446-hyperlight-host-tool-jsonschema

Conversation

@leilei3167

Copy link
Copy Markdown
Contributor

Motivation & Context

InstructionBuilder.BuildExecuteCodeDescription listed each host AIFunction name and description but never read JsonSchema. Models therefore did not receive host-tool parameter names, requiredness, descriptions, enums, or nested shapes through the execute_code description. Sibling Python work landed separately; this PR covers the .NET Hyperlight path only.

Description & Review Guide

  • What are the major changes?
    • BuildExecuteCodeDescription now appends each host tool's existing JsonSchema under a Parameters (JSON Schema): line in the model-facing description (shared by HyperlightExecuteCodeFunction and HyperlightCodeActProvider).
    • Added a parameterized-host-tool unit test so zero-parameter coverage can no longer miss this gap.
  • What is the impact of these changes? Host-tool parameter schemas are visible to the model in the execute_code description. No public API changes. execute_code input schema, approval behavior, filesystem host-path protection, and network restriction text are unchanged.
  • What do you want reviewers to focus on? Whether embedding the raw JsonSchema text is the preferred rendering for .NET (Python added compact/json format options separately). Happy to adjust formatting if maintainers want a compact layout instead.

Related Issue

Fixes #8446

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

Evidence

  • Old red: dotnet test …Hyperlight.UnitTests.csproj -c Release -f net10.0 -- --filter-class …InstructionBuilderTestsBuildExecuteCodeDescription_WithParameterizedTools_IncludesHostToolJsonSchema failed (Assert.Contains missing Parameters (JSON Schema)).
  • New green: same command — 7/7 InstructionBuilder tests passed; full Hyperlight unit suite via test dll — 50/50 passed.

…tions

BuildExecuteCodeDescription listed host AIFunction names and descriptions
but never read JsonSchema, so models missed parameter names, requiredness,
descriptions, enums, and nested shapes. Append each tool's existing schema
to the model-facing description and cover it with a parameterized regression.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Valid boolean schemas are omitted, and the input-schema preservation assertion examines the wrong function.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Surfaces .NET Hyperlight host-tool parameter schemas in model-facing execute_code descriptions.

Changes:

  • Appends each host tool’s JSON schema to its description.
  • Adds parameterized-tool regression coverage.
  • Documents that schemas do not alter execute_code inputs.
File summaries
File Description
dotnet/src/Microsoft.Agents.AI.Hyperlight/Internal/InstructionBuilder.cs Renders host-tool schemas.
dotnet/tests/Microsoft.Agents.AI.Hyperlight.UnitTests/InstructionBuilderTests.cs Tests parameterized schema rendering.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread dotnet/src/Microsoft.Agents.AI.Hyperlight/Internal/InstructionBuilder.cs Outdated
Comment thread dotnet/tests/Microsoft.Agents.AI.Hyperlight.UnitTests/InstructionBuilderTests.cs Outdated
Valid JSON Schema roots include boolean true/false; render those and stop
accepting non-schema Array/String roots. Assert execute_code keeps its
code-only input via HyperlightExecuteCodeFunction and the provider tool.
@leilei3167
leilei3167 deployed to github-app-auth September 18, 2026 14:22 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NET Usage: [Issues, PRs], Target: .Net

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.NET: Hyperlight host-tool parameter schemas missing from execute_code descriptions

2 participants