| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…#7267) `_replace_approval_contents_with_results` deduped restored function calls against only the message currently being scanned. On an approval round-trip the hosting layer replays the stored `function_call` item and its `mcp_approval_request` item as two separate assistant messages, so the per-message check never fired and the approval request restored a second copy of the call. Only one copy received the function result; the orphaned copy was left unanswered, which the Responses API rejects with "No tool output found for function call call_<id>". Collect existing call ids across all messages instead, and add a restored call to that set so two approval requests for the same call cannot both expand. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@microsoft-github-policy-service agree |
Sorry, something went wrong.
There was a problem hiding this comment.
Fixes an approval round-trip edge case in the Python core tooling pipeline where a function_call could be restored twice (when the hosting layer replays the stored call and its approval request in separate assistant messages), leaving one copy orphaned without a matching function_result and causing the Responses API to reject the next turn.
Changes:
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| python/packages/core/agent_framework/_tools.py | Fixes call-id dedupe scope so approval request expansion cannot introduce duplicate function_calls across messages. |
| python/packages/core/tests/core/test_function_invocation_logic.py | Adds a regression test ensuring only one function_call remains and the result is properly paired after an approval round-trip. |
Sorry, something went wrong.
Refactor approval handling logic to improve clarity and maintainability.
Updated the test to allow reused call IDs after completion, ensuring that a completed call does not suppress later approval requests with the same ID. Adjusted assertions to reflect the new behavior.
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Motivation & Context
Approving a run_skill_script tool call in the Agent Inspector left the function
call unanswered: the tool block showed a red ✗ and the next conversation turn was
rejected by the Responses API with
400 - No tool output found for function call call_<id>.
The same defect affects any approval round-trip served through a hosting layer,
not just skills — SkillsProvider is simply the configuration that surfaces it,
because it puts an approval-gated tool on the default path.
Description & Review Guide
What are the major changes?
One scoping fix in _replace_approval_contents_with_results
(python/packages/core/agent_framework/_tools.py).
The function restores a function_call from its function_approval_request
wrapper, deduping against calls already present so it does not add a second
copy. That dedupe set was rebuilt inside the per-message loop, so it only ever
saw the message currently being scanned. On an approval round-trip the hosting
layer replays the stored function_call item and its mcp_approval_request
item as two separate assistant messages — so the check never fired and the
approval request restored a duplicate of the call.
Only one copy was matched to the function result. The orphaned copy went back
to the service unanswered, which is exactly what the 400 reports.
The fix collects existing call ids across all messages, and adds a restored
call to that set so two approval requests for the same call cannot both expand.
What is the impact of these changes?
Not a breaking change; no public API or signature changes. Conversation history
sent on an approval round-trip now contains each function_call exactly once,
paired with its result.
Verified with a full-stack ResponsesHostServer + SkillsProvider repro
(load_skill approval, then run_skill_script approval). Outgoing history on
the final turn, before and after:
Regression test added in
python/packages/core/tests/core/test_function_invocation_logic.py; it fails on
main with ['call_1', 'call_1'] == ['call_1']. Core suites and all 192
agent-framework-foundry-hosting tests pass.
What do you want reviewers to focus on?
Two things I could not close out locally, both worth a second opinion:
client the registered script_runner was invoked on both the pre-fix and
post-fix paths. This change fixes the duplication that produces the 400;
whether the hang is entirely downstream of it is unconfirmed without the
live Foundry API.
reported flow should have failed one turn earlier than the issue describes.
That may mean the service tolerates some duplicate shapes, or that a second
factor is involved.
Related Issue
Fixes #7267
Contribution Checklist