Python: Prevent orphaned local approval responses - #7462
Open
eavanvalkenburg wants to merge 2 commits into
Open
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0efaca91-a0a7-46f4-9b81-022385607fe4
eavanvalkenburg
temporarily deployed
to
github-app-auth
July 31, 2026 14:41 — with
GitHub Actions
Inactive
eavanvalkenburg
temporarily deployed
to
github-app-auth
July 31, 2026 14:41 — with
GitHub Actions
Inactive
eavanvalkenburg
temporarily deployed
to
github-app-auth
July 31, 2026 14:41 — with
GitHub Actions
Inactive
Copilot stopped reviewing on behalf of
eavanvalkenburg due to an error
July 31, 2026 14:42
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates OpenAI chat message preparation to distinguish hosted vs local function-approval controls so only hosted approvals are serialized to MCP items (and local approvals remain in-process).
Changes:
- Gate serialization of
function_approval_request/function_approval_responseon whether the approval is “hosted”. - Add regression test ensuring local approval controls are dropped for both storage and stateless requests.
- Update docs/specs to clarify hosted vs local approval behavior and adjust related tests to include hosted markers.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| python/packages/openai/agent_framework_openai/_chat_client.py | Filters approval request/response contents based on hosted-approval detection during message preparation. |
| python/packages/openai/tests/openai/test_openai_chat_client.py | Updates existing tests to mark hosted approvals and adds a new test to ensure local approvals are omitted. |
| python/packages/openai/AGENTS.md | Clarifies hosted vs local approval serialization rules for service-side storage continuation. |
| docs/specs/004-python-function-calling-loop.md | Updates spec table entries to reflect hosted-only serialization and omission of local approvals. |
Contributor
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0efaca91-a0a7-46f4-9b81-022385607fe4
eavanvalkenburg
temporarily deployed
to
github-app-auth
July 31, 2026 14:50 — with
GitHub Actions
Inactive
eavanvalkenburg
marked this pull request as ready for review
July 31, 2026 14:58
eavanvalkenburg
temporarily deployed
to
github-app-auth
July 31, 2026 14:58 — with
GitHub Actions
Inactive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation & Context
Issue #7125 correctly identified that service-side continuation dropped the current hosted approval response. PR #7407 preserved that response, but the unconditional serializer now emits local
FunctionToolapprovals as MCP approval responses. Because no matching MCP approval request exists for local tools, the provider rejects the request as an orphaned approval and consumes the pending approval.Description & Review Guide
Related Issue
Fixes #7125
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.