Python: foundry-hosting drops request `metadata` from the stored response — `_create_response_event_stream` never passes `request` to `ResponseEventStream`
Los mantenedores suelen responder en 1 día
@its-amann ya está trabajando en esto.
Desde el 19/10/2026.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
Empieza en agent_framework_foundry_hosting/_responses.py y sigue _handle_response hasta _create_response_event_stream; el issue señala que falta el argumento de solicitud para las respuestas nuevas. Comprueba cómo ResponseEventStream inicializa campos a partir de una solicitud y añade o actualiza una prueba específica para los metadatos de la respuesta creada y almacenada. El trabajo está terminado cuando los metadatos enviados con POST se conservan en los eventos de respuesta y en GET /responses/{id}.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- Python
- Estrellas
- 14.2k
- Forks
- 2.5k
- Merge medio
- 2 d 9 h
- PR fusionados (30 d)
- 392
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/agent-framework
-
Python: [Bug]: A non-positive MCP request timeout silently disables the timeoutPosiblemente ocupada @jpalvarezl la tomó hace 8 días. Abiertopython
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
microsoft/agent-framework#9313 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
.NET: Proposal: add an llms.txtAbierto.NET python triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
microsoft/agent-framework#9092 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Python: raw-data content mappings lose annotations and attachment metadataPosiblemente ocupada @moonbox3 la tomó hace 22 días. Abiertopython triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/agent-framework#8632 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Python: Clarify when to use platformPosiblemente ocupada @eavanvalkenburg la tomó hace 21 días. Abiertopython triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
microsoft/agent-framework#8599 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
.NET compaction documentation
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
microsoft/agent-framework#4629 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/agent-framework
Issues similares
-
infrastructure
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
khuisman/mcp-gee-sweet#1152 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
backroom bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
ditto-assistant/ditto-subnet#3069 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
open-webui/open-webui#32901 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
0.3.3 bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día