You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a Foundry-hosted Agent Framework Responses agent receives a streaming model failure caused by a CostControl budget block, the raw model response includes x-ms-budget-cause: budget_exceeded and related budget headers. The OpenAI streaming SDK later raises a generic APIError from the SSE error event, and the hosting adapter currently emits a generic response.failed with error.code: server_error.
Expected behavior:
Preserve the allowlisted CostControl response headers across the streaming exception boundary.
Emit response.failed.error.code as budget_exceeded.
Include compact CostControl details in response metadata so streaming and non-streaming Responses clients can render the correct budget-block experience.
The outer Responses HTTP status should remain protocol-compatible; this issue concerns the terminal failure body and metadata.
🤖 Automated triage reproduction notes(agent-authored — trust but verify)
Agent analysis
Repro: python/packages/foundry_hosting/agent_framework_foundry_hosting/_responses.py::ResponsesHostServer._emit_failure emits a generic failure when an exception carries response_headers containing x-ms-budget-cause: budget_exceeded. Minimal repro: raise such an exception from an agent ResponseStream, then POST to the Foundry Responses endpoint with either stream=False or stream=True; both return HTTP 200 with error.code: server_error and no CostControl metadata.
This looks worth considering in the MAF hosting integration. Darren Cohen (@dargilco), I have added you as an owner; could you have a look and advise on the appropriate scope?
We should keep this narrowly scoped to a safe, allowlisted budget-exhaustion classification and bounded metadata, preserving the existing sanitized public failures and Responses transport contract rather than exposing arbitrary exception bodies or headers.
For context, the earlier #8488 is closed unmerged, with outstanding feedback about retaining headers when Azure tracing wraps streaming responses, including the retrieve path. Azure/azure-sdk-for-python#49073 merged generic failure-metadata support, but selecting safe public fields and reliably carrying those headers through the adapter still need assessment. Please review those boundaries before we settle the implementation direction; this is consideration, not a commitment to implementation or timing.
Activity
[-]Hosted Responses lose CostControl budget failure metadata[/-][+]Python: Hosted Responses lose CostControl budget failure metadata[/+]github-actions commentedon Sep 18, 2026
🤖 Automated triage reproduction notes (agent-authored — trust but verify)
Agent analysis
Repro:
python/packages/foundry_hosting/agent_framework_foundry_hosting/_responses.py::ResponsesHostServer._emit_failureemits a generic failure when an exception carriesresponse_headerscontainingx-ms-budget-cause: budget_exceeded. Minimal repro: raise such an exception from an agentResponseStream, then POST to the Foundry Responses endpoint with eitherstream=Falseorstream=True; both return HTTP 200 witherror.code: server_errorand no CostControl metadata.python/packages/foundry_hosting/tests/test_responses.py1.0.0b260910eavanvalkenburg commentedon Oct 27, 2026
This looks worth considering in the MAF hosting integration. Darren Cohen (@dargilco), I have added you as an owner; could you have a look and advise on the appropriate scope?
We should keep this narrowly scoped to a safe, allowlisted budget-exhaustion classification and bounded metadata, preserving the existing sanitized public failures and Responses transport contract rather than exposing arbitrary exception bodies or headers.
For context, the earlier #8488 is closed unmerged, with outstanding feedback about retaining headers when Azure tracing wraps streaming responses, including the retrieve path. Azure/azure-sdk-for-python#49073 merged generic failure-metadata support, but selecting safe public fields and reliably carrying those headers through the adapter still need assessment. Please review those boundaries before we settle the implementation direction; this is consideration, not a commitment to implementation or timing.