Repository navigation
Python: fix citation issue - #9436
sophia-ramsey wants to merge 7 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Citation offsets can be shifted incorrectly, and ordinary streaming introduces quadratic text copying.
2 open findings
What changed in this PR
Preserves citation metadata across the Python hosting boundary so downstream clients can render clickable citations, addressing #9434.
Changes:
- Converts framework citations into Responses annotations.
- Includes annotations in streaming and non-streaming output.
- Adds conversion and response regression tests.
| File | Description |
|---|---|
| python/packages/foundry_hosting/tests/test_responses.py | Tests citation conversion, edge cases, and response consistency. |
| python/packages/foundry_hosting/agent_framework_foundry_hosting/_responses.py | Converts and propagates citation annotations. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Code coverage overviewLanguages: Python Python / code-coverage/python
View coverage of the 6 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: Findings reported
Scope: full PR (1 commit(s)): 0da89b5958e8
Model: gpt-5.6-sol
Overview
The review found 3 verified inline finding(s).
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
3 verified findings remained after source verification (3 medium) across 1 file. Details are attached to the affected lines below.
Affected areas: python/packages/foundry_hosting/agent_framework_foundry_hosting/_responses.py
Jose Alvarez (jpalvarezl)
left a comment
There was a problem hiding this comment.
Approve with a small nit
ea1a03c to
63f108a
Compare
Eduard van Valkenburg (eavanvalkenburg)
left a comment
There was a problem hiding this comment.
sophia-ramsey Please take a look at the inline workflow citation-offset finding.
63f108a to
01261ad
Compare

Motivation & Context
An internal bug reported that citations were not correctly being propagated with hosted agents. The citation would include the correct filename or source, but would not link to the annotation properly, instead registering as plain text.
Description & Review Guide
ResponsesHostServerto serialize URL and file citation annotations into Responses payloads for both streaming and non-streaming responses, with regression coverage for supported annotation types and edge cases.Related Issue
Fixes #9434
AI Assistance
AI assistance details: Used GPT-5.6 Sol for planning, implementation, and testing
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.