Python: foundry-hosting drops request `metadata` from the stored response — `_create_response_event_stream` never passes `request` to `ResponseEventStream`
Maintainer thường phản hồi trong vòng 1 ngày
@its-amann đang làm issue này rồi.
Từ ngày 19/10/2026.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
Hướng nghiên cứu
Bắt đầu tại agent_framework_foundry_hosting/_responses.py và lần theo _handle_response đến _create_response_event_stream; issue chỉ ra rằng thiếu đối số yêu cầu cho các response mới. Kiểm tra cách ResponseEventStream khởi tạo các trường từ một yêu cầu, rồi thêm hoặc cập nhật một bài kiểm thử tập trung vào metadata trên response được tạo và lưu trữ. Hoàn tất khi metadata gửi bằng POST được giữ nguyên trong các sự kiện response và trong GET /responses/{id}.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Python
- Star
- 14.2k
- Fork
- 2.5k
- Merge trung bình
- 2 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 381
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/agent-framework
-
Python: [Bug]: A non-positive MCP request timeout silently disables the timeoutCó thể đã có người làm @jpalvarezl đã nhận 10 ngày trước. Đang mởpython
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
microsoft/agent-framework#9313 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
.NET: Proposal: add an llms.txtĐang mở.NET python triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
microsoft/agent-framework#9092 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Python: raw-data content mappings lose annotations and attachment metadataCó thể đã có người làm @moonbox3 đã nhận 23 ngày trước. Đang mởpython triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
microsoft/agent-framework#8632 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Python: Clarify when to use platformCó thể đã có người làm @eavanvalkenburg đã nhận 23 ngày trước. Đang mởpython triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
microsoft/agent-framework#8599 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
.NET compaction documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
microsoft/agent-framework#4629 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của microsoft/agent-framework
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
aws-samples/sample-per-model-bedrock#464 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
lesson-submission pending-review
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Ikalus1988/MisakaNet#3789 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Python Volcengine provider returns failures instead of raising themCó thể đã có người làm @Ricardo-M-L đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
agent-infra/sandbox#248 ·
-
[Bug] cloud JSON directory loading assumes a Key field in fsspec listingsCó thể đã có người làm @Ricardo-M-L đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
hiyouga/LlamaFactory#10910 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Bundled uv is never updated and trusts the compromised eMudhra certificatesCó thể đã có người làm @FabienDanieau đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100