Skip to content

Python: Improve settled approval matching - #9535

Open
westey (westey-m) wants to merge 2 commits into
microsoft:mainfrom
westey-m:python-settledapprovals-improvement
Open

westey (westey-m) wants to merge 2 commits into
microsoft:mainfrom
westey-m:python-settledapprovals-improvement

Conversation

@westey-m

Copy link
Copy Markdown
Collaborator

Motivation & Context

Description & Review Guide

Improve settled approval matching.

Related Issue

Fixes #

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:

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 links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • 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.

Copilot AI balanced review requested due to automatic review settings October 19, 2026 12:40
@agent-framework-automation agent-framework-automation Bot added documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python labels Oct 19, 2026
@github-actions github-actions Bot changed the title Improve settled approval matching Python: Improve settled approval matching Oct 19, 2026

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

Closed-request duplicates can incorrectly cause completed mixed-batch history replay to fail validation.

1 open issue
What changed in this PR

Strengthens Python tool-approval matching to prevent duplicate approval IDs from enabling execution without an authoritative session.

Changes:

  • Tracks pending approval responses by object identity.
  • Repeats filtering after mixed-batch reclassification.
  • Adds regression coverage and updates the specification.
File Description
python/​packages/​core/​tests/​core/​test_function_invocation_logic.py Adds streaming, non-streaming, and agent regression cases.
python/​packages/​core/​agent_framework/​_tools.py Updates pending-response tracking and repeated filtering.
docs/​specs/​004-python-function-calling-loop.md Links the new approval regression test.

Review effort: Balanced

Comment thread python/packages/core/agent_framework/_tools.py

@github-actions github-actions Bot 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.

MAF Automated Review — Iteration 1

Result: Findings reported
Scope: full PR (1 commit(s)): 1f55d3e2d403
Model: gpt-5.6-sol

Overview

The change strengthens no-session approval filtering by tracking settlement per response object and repeatedly reclassifying duplicate-ID histories until filtering stabilizes. Session-backed authorization, hosted approvals, strict-True execution, caller immutability, and streaming parity remain guarded by shared code paths and focused tests. One edge case remains: a completed mixed transcript whose terminal result precedes a stale approval response is reclassified as incomplete instead of replaying inertly.

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: python/packages/core/agent_framework/_tools.py

Comment thread python/packages/core/agent_framework/_tools.py

This branch was successfully deployed

1 active deployment
github-app-auth — f4336c0a Deployed Oct 19, 2026 by westey-m via add_label #25737
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants