FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Python: Surface A2A preview consent URLs by LobsterQBA · Pull Request #7606 · microsoft/agent-framework · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
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
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def consent_url_from_error(exc: BaseException) -> list[ConsentError] | None:
# "errors" : [
# {
# "name": "Name of the MCP tool that requires consent",
# "type" : "mcp",
# "type" : "mcp" | "a2a_preview",
# "error": {
# "code": "CONSENT_REQUIRED",
# "message": consent_url,
Expand All @@ -146,7 +146,7 @@ def consent_url_from_error(exc: BaseException) -> list[ConsentError] | None:
for error in consent_details["errors"]:
if (
isinstance(error, dict)
and error.get("type") == "mcp" # type: ignore
and error.get("type") in ("mcp", "a2a_preview") # type: ignore
and "error" in error
and isinstance(error["error"], dict)
and error["error"].get("code") == "CONSENT_REQUIRED" # type: ignore
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -3626,6 +3626,7 @@ async def test_workflow_rejects_invalid_checkpoint_scope(
def _make_consent_error(
url: str = "https://consent.example.com/auth",
name: str = "Foundry Toolbox",
source_type: str = "mcp",
) -> Exception:
"""Build an exception wrapping a Foundry MCP gateway consent error.

Expand All @@ -3645,7 +3646,7 @@ def _make_consent_error(
"errors": [
{
"name": name,
"type": "mcp",
"type": source_type,
"error": {
"code": "CONSENT_REQUIRED",
"message": url,
Expand All @@ -3663,6 +3664,16 @@ def test_returns_consent_url_when_inner_arg_is_consent_mcp_error(self) -> None:
exc = _make_consent_error("https://example.com/consent", name="my-tool")
assert consent_url_from_error(exc) == [ConsentError(name="my-tool", consent_url="https://example.com/consent")]

def test_returns_consent_url_for_a2a_preview_source(self) -> None:
exc = _make_consent_error(
"https://example.com/a2a-consent",
name="work-iq",
source_type="a2a_preview",
)
assert consent_url_from_error(exc) == [
ConsentError(name="work-iq", consent_url="https://example.com/a2a-consent")
]

def test_returns_none_when_no_mcp_error_in_args(self) -> None:
assert consent_url_from_error(Exception("boom")) is None

Expand Down
Loading

Back | FazBrowse Home | New Git URL