Skip to content

Python: [Bug]: Foundry hosting emits oauth consent payload shape that does not trigger consent popup #6553

@bcage29

Description

@bcage29

Description

What happened?

When oauth_consent_request is returned from Foundry hosting, the consent button does not show in the chat messages because the response event stream emits a completed event. If it emits emit_incomplete() then the consent button will show up.

Two issues:

  • json payload returned does not match docs
  • event emitted with consent link should not be 'completed'

What did you expect to happen?

The consent popup should open when the response includes the OAuth consent item, per docs:
https://learn.microsoft.com/en-us/azure/foundry/agents/how-to/mcp-authentication#flow-using-oauth-identity-passthrough

Expected event example from docs:

"type":"response.output_item.done",
"sequence_number":7,
"output_index":1,
"item":{
    "type":"oauth_consent_request",
    "id":"oauthreq_10b0f026610e2b76006981547b53d48190840179e52f39a0aa",
    "created_by":{},
    "consent_link":"https://logic-swedencentral-001.consent.azure-apihub.net/login?data=xxxx"
}

Returned

{
  "type": "response.output_item.done",
  "output_index": 0,
  "item": {
    "id": "oauthreq_2bebadxxxxxx",
    "consent_link": "https://logic-apis-eastus2.consent.azure-apim.net/login?data=eyJMb2dpbxxx",
    "server_label": "[tool name]",
    "type": "oauth_consent_request",
    "response_id": "caresp_76c1a63xxxx",
    "agent_reference": null
  },
  "sequence_number": 3
}

Steps to reproduce

  1. Configure Foundry MCP Tool with OAuth identity passthrough.
  2. Trigger a tool call that requires consent/uses OAuth Identity passthrough.
  3. Observe oauth_consent_request in response output/events.
  4. Consent popup does not open.

Code Sample

Error Messages / Stack Traces

Package Versions

agent-framework=1.8.1, agent-framework-foundry-hosting=1.0.0a260609

Python Version

Python 3.14

Additional Context

Running this in Agent Inspector Playground.

Possible secondary bug

Once you emit emit_incomplete() you will be able to consent to the app. Once this is fixed and the consent card is shown, if you click on 'Cancel', there is no cancel message sent to the agent. It will send a new post request and will be in a loop of continuing to show the consent button card.

Metadata

Metadata

Assignees

Type

No fields configured for Bug.

Projects

Status
No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions