Skip to content

Python: fix(python): deduplicate CodeAct FIDES compatibility warnings - #9788

Open
Suhas Aggarwal (suhasagg) wants to merge 2 commits into
microsoft:mainfrom
suhasagg:fix-9251-codeact-fides-warning-location
Open

Suhas Aggarwal (suhasagg) wants to merge 2 commits into
microsoft:mainfrom
suhasagg:fix-9251-codeact-fides-warning-location

Conversation

@suhasagg

Copy link
Copy Markdown
Contributor

Motivation & Context

The Monty and Hyperlight CodeAct providers warn when registered host tools contain FIDES metadata because nested tool calls made from generated code do not pass through the normal function middleware enforcement path.

Previously, creating run-scoped CodeAct tool snapshots could repeatedly emit the same compatibility warning for unchanged FIDES metadata, creating unnecessary log noise.

This PR improves warning deduplication while retaining visibility when FIDES metadata is newly introduced or changed.

Description & Review Guide

What are the major changes?

  • Add FIDES metadata snapshot tracking for registered CodeAct host tools.
  • Deduplicate compatibility warnings for unchanged tool metadata across run-scoped snapshots.
  • Continue warning when FIDES metadata is newly registered or modified.
  • Apply consistent behavior to both Monty and Hyperlight.
  • Add regression tests for registration, snapshot creation, and metadata changes.

What is the impact of these changes?

  • Reduces repetitive compatibility warnings during agent execution.
  • Preserves warnings when unsupported FIDES metadata is detected.
  • Does not modify CodeAct execution behavior, tool approval behavior, or FIDES enforcement.
  • Does not introduce breaking API changes.

What do you want reviewers to focus on?

  • Whether warning deduplication is appropriately scoped to CodeAct tool registration and run snapshots.
  • Whether metadata changes are detected correctly.
  • Whether the approach is sufficiently lightweight for both providers.

Related Issue

Fixes #9251.

This is a focused compatibility-warning improvement following the maintainer's direction. It does not implement the original strict-mode or fail-closed enforcement proposal.

AI Assistance

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

AI assistance details:

AI assistance was used for implementation refinement, regression-test design, The resulting changes were reviewed and validated locally.

Contribution Checklist

  • The modified code passes Ruff formatting and lint checks.
  • Relevant unit tests pass, including newly added regression tests.
  • The PR follows the Contribution Guidelines to the best of my knowledge.
  • This PR links to an agreed issue with no competing open PR, or the Related Issue section documents an applicable exception.
  • This is not a breaking change.

Validation

  • Focused FIDES and warning tests: 84 passed.
  • Broader Monty and Hyperlight non-integration suite: 345 passed, 8 skipped.
  • Ruff formatting: passed.
  • Ruff lint: passed.
  • git diff --check: passed.

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

Both providers repeatedly warn for unchanged metadata because snapshots do not update parent warning history, and their warning caches retain removed or replaced tools indefinitely.

4 open issues
What changed in this PR

This PR reduces repetitive FIDES compatibility warnings in Python’s Monty and Hyperlight CodeAct providers. It focuses on warning deduplication without changing tool execution, approval, or FIDES enforcement.

Changes:

  • Track FIDES metadata snapshots by tool identity.
  • Carry warning history into run-scoped tools and detect metadata changes.
  • Add regression tests for unchanged metadata and changed keys or values.
File Description
python/​packages/​monty/​tests/​monty/​test_monty_codeact.py Adds Monty snapshot warning regression tests.
python/​packages/​monty/​agent_framework_monty/​_execute_code_tool.py Adds metadata tracking and warning deduplication for Monty.
python/​packages/​hyperlight/​tests/​hyperlight/​test_hyperlight_codeact.py Adds equivalent Hyperlight warning regression tests.
python/​packages/​hyperlight/​agent_framework_hyperlight/​_execute_code_tool.py Adds metadata tracking and warning deduplication for Hyperlight.

Review effort: Balanced

Comment thread python/packages/hyperlight/agent_framework_hyperlight/_execute_code_tool.py Outdated
Comment thread python/packages/monty/agent_framework_monty/_execute_code_tool.py
Comment thread python/packages/monty/agent_framework_monty/_execute_code_tool.py Outdated

This branch was successfully deployed

1 active deployment
github-app-auth — 1f2381b0 Deployed Oct 28, 2026 by suhasagg via add_label #26397
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: [Feature]: Python CodeAct fail-closed security coverage for FIDES-protected host tools

2 participants