Skip to content

Distinguish retrieved sources from cited references - #1268

Merged
Paul Lizer (paullizer) merged 2 commits into
Developmentfrom
paullizer-clarify-sources-and-citations
Aug 18, 2026
Merged

Paul Lizer (paullizer) merged 2 commits into
Developmentfrom
paullizer-clarify-sources-and-citations

Conversation

@paullizer

Copy link
Copy Markdown
Contributor

Summary

Separates the complete set of retrieved workspace and web search results from the smaller set of references the final assistant response actually cites, so Used documents, conversation details, and export references stop presenting every retrieval candidate as a citation.

Sources stays the full retrieval/execution disclosure. New assistant responses additionally persist exact cited document and web subsets, so conversation reads and exports consume persisted data instead of reparsing message history.

Fixes #1249

Behavior

Surface Before After
Per-message Sources All returned sources Unchanged — all returned sources
Used documents drawer Every retrieved document Documents cited by active responses
Conversation details Documents, no usage signal All source documents + Cited badge on exact matches
Export references Every returned source Exact cited document/web records + executed tools
JSON export Full source arrays Full source arrays plus exact cited subsets

Persisted contract

Assistant messages keep hybrid_citations, web_search_citations, and agent_citations unchanged, and add citation_tracking_version, cited_hybrid_citations, and cited_web_search_citations. Conversations gain used_documents for exact active-response usage and legacy_used_documents for pre-tracking compatibility.

Matching uses exact [#citation-id] tokens, with strict filename/location matching as a fallback for the visible (Source: file, Page/Sheet/Location: value) format. Agent/tool records remain references because they represent executions that actually occurred; Foundry web-source proxies are deduplicated into web references.

Coverage

  • Persisted across non-streaming, streaming, mixed-source, assigned-knowledge, document-action, canceled/interrupted partial, and workflow responses.
  • Exact aggregates rebuilt after retry, edit, attempt switching, deletion, and conversation fork; a failed rebuild is marked and repaired on the next read.
  • Propagated through collaboration conversion, synchronization, serialization, and stream mirroring, including persisted partial responses.
  • Sheet, page, and workbook schema locations render and export consistently.

Compatibility

No database migration and no read-time history parsing. Conversations and messages without tracking keep their existing document list and prior export behavior, and are never falsely marked as exactly cited.

Validation

  • test_chat_cited_source_tracking.py 15/15 (matching, aggregation, lifecycle, collaboration, UI/export contracts)
  • test_per_message_export.py 16/16, test_per_message_powerpoint_export.py 7/7
  • test_conversation_fork.py, test_chat_retry_edit_streaming_parity.py 4/4
  • Route policy suites 12/12, XSS guardrails 4/4, version-assertion and release-docs guardrails
  • Broken-access-control scan on all changed Python files, node --check on all changed JS, whitespace/diff checks

Authenticated Playwright tests were updated (drawer selection, details Cited badge, citation parsing) but skip in CI-less environments without a UI base URL and storage state.

Version bumped to 0.250.215 with release notes, fix documentation, and feature documentation updated.

Separate the complete set of retrieved workspace and web search results
from the smaller set of references the final assistant response actually
cites, so Used documents, conversation details, and export references
stop presenting every retrieval candidate as a citation.

New assistant responses persist exact cited document and web subsets
alongside the unchanged full source arrays. Conversation reads use a
compact persisted aggregate instead of reparsing message history, and
conversations without tracking keep their existing document list as a
no-migration compatibility fallback.

- Add shared citation tracking with exact citation IDs plus strict
  filename/location matching for visible legacy-style source references
- Persist cited subsets across non-streaming, streaming, mixed-source,
  assigned-knowledge, document-action, partial, and workflow responses
- Rebuild exact used documents after retry, edit, attempt switching,
  deletion, and conversation fork, and repair a failed rebuild on read
- Propagate tracking through collaboration conversion, synchronization,
  serialization, and stream mirroring, including persisted partials
- Show all source documents in conversation details with a Cited badge,
  and drive Used documents from exact usage plus legacy fallback
- Use cited document/web subsets plus executed tools for conversation
  Markdown/PDF and per-message Word, PowerPoint, and email references
  while JSON exports retain full source arrays for audit
- Render sheet, page, and workbook schema locations consistently

Fixes #1249

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment thread application/single_app/functions_citation_tracking.py Fixed
Comment thread application/single_app/functions_citation_tracking.py Fixed
Comment thread application/single_app/functions_citation_tracking.py Fixed
CodeQL flagged three polynomial regular expressions in the new citation
tracking module. The inline citation group, visible source reference, and
page range patterns all combined unbounded whitespace or lazy quantifiers
with variable-length character classes, so hostile or malformed model
output could force quadratic backtracking while parsing references.

Replace the unbounded quantifiers with bounded repetition, precompile the
page range pattern, and add a regression test that asserts adversarial
inputs are parsed well within a fixed time budget.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@paullizer
Paul Lizer (paullizer) merged commit 8ed6451 into Development Aug 18, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants