Repository navigation
Python: Handle invocation-time Foundry Toolbox OAuth consent - #10339
Eduard van Valkenburg (eavanvalkenburg) merged 2 commits into
Conversation
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: Findings reported
Scope: full PR (1 commit(s)): 05cb63a861fd
Model: gpt-5.6-sol
Overview
The PR translates validated invocation-time Toolbox consent failures into paired terminal results and consent actions, with substantial coverage for streaming and non-streaming execution, sibling ordering, URL validation, stored continuation, and service-history settlement. Its mixed-pause persistence and replay guards are especially thorough. One Medium issue remains: a gateway payload containing both consent and a hard failure is reclassified as pure resumable consent, suppressing the failure that authorization cannot resolve.
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/foundry_hosting/agent_framework_foundry_hosting/_toolbox.py
There was a problem hiding this comment.
MAF Automated Review — Iteration 2
Result: Findings reported
Scope: 1 net-new commit(s): 47eb14ec5386
Model: gpt-5.6-sol
Overview
The review found 1 verified inline finding(s).
Reviewed the supplied incremental 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/foundry_hosting/agent_framework_foundry_hosting/_toolbox.py
| return None | ||
| error = cast(dict[str, object], raw_error) | ||
| if error.get("type") not in ("mcp", "a2a_preview"): | ||
| return None |
There was a problem hiding this comment.
An aggregate containing valid mcp and unfamiliar-source CONSENT_REQUIRED entries returns None at line 180, causing _invoke_tool to re-raise and emit a generic function failure without consent URLs or continuation; any fix must reconcile the tested invariant that unsupported source types are not classified as consent (test_responses.py:9241-9272).
f118d9a
into
python-foundry-hosting-rc
Motivation & Context
Invocation-time Foundry Toolbox OAuth consent currently becomes a generic function error, leaving callers without the authorization link. Simply forwarding a consent request also leaves its function call unresolved and breaks stored continuation.
This implements the agreed consent follow-up on
python-foundry-hosting-rc, targeting the feature branch for #10260 rather than opening a separate integration path.Description & Review Guide
CONSENT_REQUIREDfailures into native consent requests, paired with one terminal result per interrupted invocation. Finish the authorized batch under its configured concurrency and retain successful, failed, and additional consent outcomes. Reuse native pending-batch state when another call still needs approval or input, including replacement-approval identity, caller instructions, and restored call budgets.store=falseconsent fails explicitly. Ordinary MCP failures and provider-owned consent retain their existing handling.Caller setup is unchanged. Before this change, the protected invocation produced a generic error; the same configuration now returns structured consent and a resumable incomplete response:
The function-loop specification and proposed hosting ADR describe the selected contract. Package version/dependency-floor coordination and README finalization remain separate from this change. No new public configuration API or generic MCP URL-elicitation support is introduced.
Related Issue
Fixes #10020
Fixes #9903
Both issues have explicit maintainer decisions. #10260 is the parent feature-integration PR, not a competing implementation; this PR supplies its OAuth-consent follow-up. No other open implementation PR was found for these issues.
AI Assistance
AI assistance details: GitHub Copilot assisted with the design, implementation, regression tests, specification and ADR updates, and this PR description.
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.