Python: foundry-hosting drops request `metadata` from the stored response — `_create_response_event_stream` never passes `request` to `ResponseEventStream`
I maintainer di solito rispondono entro 1 giorno
@its-amann ci sta già lavorando.
Dal 19/10/2026.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
Direzione di ricerca
Inizia da agent_framework_foundry_hosting/_responses.py e segui _handle_response fino a _create_response_event_stream; la issue segnala che manca l’argomento della richiesta per le nuove risposte. Controlla come ResponseEventStream inizializza i campi a partire da una richiesta e aggiungi o aggiorna un test mirato per i metadati della risposta creata e memorizzata. Il lavoro è completato quando i metadati inviati con POST vengono mantenuti negli eventi della risposta e in GET /responses/{id}.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
When a client calls POST /responses on a ResponsesHostServer with a metadata object, that metadata is not present on the response object that is emitted (response.created / terminal events) or persisted, so GET /responses/{id} returns metadata: null.
This breaks the standard OpenAI Responses contract, where request metadata is echoed onto the response, and prevents clients from using response metadata to label/correlate turns (for example, recording per-turn settings and reading them back when listing conversation history).
Client impact (.NET SDK)
Our client is a .NET service using Azure.AI.Projects / Azure.AI.Extensions.OpenAI (2.1.0-beta.4). It sends the metadata when creating the response (CreateResponseOptions.Metadata), and when listing conversation history it reads it back per turn:
GetProjectConversationItemsAsync(conversationId)to enumerate message items (items carry no metadata, onlyResponseId).GetResponseAsync(new GetResponseOptions(responseId))and readresult.Value.Metadata.
Because the hosted agent never seeds metadata onto the response, result.Value.Metadata is always empty for responses produced by a ResponsesHostServer-hosted agent, so the .NET client has no way to recover the per-turn values it sent.
Root cause
azure-ai-agentserver-responses already supports this: ResponseEventStream(request=...) seeds metadata, background, previous_response_id, conversation, model and agent_reference from the request.
However, in agent_framework_foundry_hosting/_responses.py the stream is created without the request:
def _create_response_event_stream(context: ResponseContext) -> ResponseEventStream:
"""Create a response stream seeded from recovery state when available."""
if context.is_recovery:
persisted_response = context.persisted_response
if persisted_response is not None:
return ResponseEventStream(response=persisted_response, response_id=context.response_id)
return ResponseEventStream(response_id=context.response_id)
and ResponsesHostServer._handle_response(self, request, context, cancellation_signal) calls _create_response_event_stream(context) even though request is in scope. The same code is still present on main.
Steps to reproduce
- Host any agent or workflow with
ResponsesHostServer. POST /responseswith"metadata": {"foo": "bar"}and"store": true.- Inspect the
response.createdevent, orGET /responses/{id}.
Expected: metadata == {"foo": "bar"}
Actual: metadata is null / missing.
Suggested fix
Pass the request through for fresh (non-recovery) responses:
def _create_response_event_stream(context: ResponseContext, request: CreateResponse) -> ResponseEventStream:
if context.is_recovery:
persisted_response = context.persisted_response
if persisted_response is not None:
return ResponseEventStream(response=persisted_response, response_id=context.response_id)
return ResponseEventStream(request=request, response_id=context.response_id)
and call _create_response_event_stream(context, request) from _handle_response.
Current workaround
Monkey-patching the private agent_framework_foundry_hosting._responses._create_response_event_stream to stamp metadata onto stream.response["metadata"] before response.created is emitted. This depends on a private symbol and breaks on upgrade.
Related: #9265 (public per-request / stream-wrapping hooks).
Versions
agent-framework-foundry-hosting1.0.0b260903 (also verified onmain)agent-framework1.18.xazure-ai-agentserver-responses2.2.0b1,azure-ai-agentserver-core2.1.0- Python 3.14
- Lingua principale
- Python
- Stelle
- 14.2k
- Fork
- 2.5k
- Merge medio
- 2g 9h
- PR unite (30g)
- 369
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/agent-framework
-
Python: [Bug]: A non-positive MCP request timeout silently disables the timeoutForse già presa @jpalvarezl l’ha presa 8 giorni fa. Apertapython
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
microsoft/agent-framework#9313 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
.NET python triage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
microsoft/agent-framework#9092 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Python: raw-data content mappings lose annotations and attachment metadataForse già presa @moonbox3 l’ha presa 22 giorni fa. Apertapython triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
microsoft/agent-framework#8632 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Python: Clarify when to use platformForse già presa @eavanvalkenburg l’ha presa 21 giorni fa. Apertapython triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
microsoft/agent-framework#8599 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
.NET compaction documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
microsoft/agent-framework#4629 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di microsoft/agent-framework
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
volcengine/OpenViking#6445 ·
I maintainer di solito rispondono entro 1 giorno
-
BUG:Edit Album strips spaces from the password so albums with a leading/trailing space in the password can't be editedForse già presa @ManyaJain111 l’ha presa oggi. Apertabug enhancement possible-duplicate
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
AOSSIE-Org/PictoPy#1637 · 4 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
deepspeedai/DeepSpeed#8884 ·
I maintainer di solito rispondono entro 3 giorni
-
Flaky: test_advisor_live_calibrates_an_unmeasured_circuit ranks engines by a 1.8ms sleep marginAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
flagos-ai/FlagQuantum#718 ·
I maintainer di solito rispondono entro 1 giorno
-
bug CI-failure high priority
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
vllm-project/afd-plugin#483 ·
I maintainer di solito rispondono entro 1 giorno