Skip to content

[P1] Distinguish retrieved sources from cited documents #1249

Closed

Description

@paullizer

Summary

Separate complete retrieved source sets from the smaller set of document and web references explicitly cited in final assistant responses.

User Value

Users can inspect every retrieved result under Sources, see exactly cited documents in conversation navigation and details, and trust that exported reference sections contain actual citations rather than every candidate source.

Proposed Behavior

  • Keep each assistant message's Sources disclosure as the full returned document, web, and agent/tool set.
  • Persist exact cited document records by matching inline citation IDs in final assistant text.
  • Persist exact cited web records by matching normalized URLs in final assistant text.
  • Treat agent/tool records as used executions rather than unused retrieval candidates.
  • Show only active-response cited documents in Used documents, with a no-migration legacy fallback for historical conversations.
  • Keep the conversation details modal's complete source-document inventory and add a Cited marker only to exact tracked documents.
  • Make conversation JSON/Markdown/PDF and per-message Word/PowerPoint/email reference sections use exact cited document/web subsets plus executed tools.
  • Preserve full source arrays in JSON exports for audit and use historical broad-reference behavior only when tracking is absent.
  • Avoid read-time history parsing; rebuild aggregates only on retry/edit, attempt switching, deletion, and fork mutations.

Acceptance Criteria

  • Retrieved-but-not-referenced document and web results remain visible under Sources but are excluded from newly tracked references.
  • Exact cited document and web subsets are persisted on new streaming, non-streaming, assigned-knowledge, mixed-source, and document-action responses.
  • Used documents follows active, visible, non-deleted attempts and retains an explicit historical fallback without a database migration.
  • Conversation details lists all source documents and marks only exact tracked documents as Cited.
  • Conversation Markdown/PDF references and per-message Word/PowerPoint/email references exclude uncited tracked sources.
  • JSON export retains full source arrays and adds exact cited subsets.
  • Agent/tool references remain available because they represent executions that occurred.
  • Retry, edit, attempt switch, delete, collaboration, and fork flows maintain correct aggregates.
  • Functional and UI coverage verifies tracking, compatibility, source disclosure, details badges, and export behavior.

Notes

Expected size: L. Relevant areas include citation parsing, assistant message persistence, conversation metadata, retry/attempt lifecycle, collaboration serialization, conversation details/navigation, and export formatting.

Activity

  1. paullizer commented on Aug 14, 2026

    @paullizer
    ContributorAuthor

    Implemented in 0.250.202.

    • Persisted complete returned source arrays separately from exact cited document/web subsets.
    • Updated Used documents, full conversation details with Cited badges, active-attempt lifecycle handling, collaboration/workflow propagation, partial streams, and historical fork fallback.
    • Updated conversation Markdown/PDF and per-message Word/PowerPoint/email references to exclude retrieved-only sources while preserving full JSON audit data.
    • Added source/location-aware citation handling for pages, sheets, workbook schema locations, comma-containing names, and visible legacy-style references.

    Validation completed: cited-source tracking 15/15, per-message exports 16/16, PowerPoint 7/7, retry/edit 4/4, fork coverage, route policy suites 12/12, XSS guardrails 4/4, changed-file broken-access-control scan, Python compilation, JavaScript syntax, and diff checks. Authenticated Playwright tests were collected but skipped because no UI base URL/storage state is configured in this session.

  2. moved this from Pending Evaluation to In review in Simple Chat Roadmapon Aug 14, 2026
  3. paullizer commented on Aug 18, 2026

    @paullizer
    ContributorAuthor

    Rebased onto latest Development and opened PR #1268.

    Version retargeted to 0.250.215 because 0.250.202 was taken upstream by an unrelated fix. Release notes, fix documentation, feature documentation, and test headers updated accordingly.

    Post-rebase validation: cited-source tracking 15/15, per-message exports 16/16, PowerPoint 7/7, retry/edit 4/4, conversation fork, route policy suites 12/12, XSS guardrails 4/4, version-assertion and release-docs guardrails, plus Python compilation and node --check on all changed JavaScript.

  4. paullizer commented on Aug 18, 2026

    @paullizer
    ContributorAuthor

    CodeQL flagged three high-severity polynomial regular expressions (ReDoS) in the new citation tracking module on the first PR run. The inline citation group, visible source reference, and page range patterns each combined unbounded whitespace or lazy quantifiers with variable-length character classes, so malformed model output could force quadratic backtracking.

    Fixed by replacing the unbounded quantifiers with bounded repetition, precompiling the page range pattern, and adding a regression test that parses adversarial inputs within a fixed time budget.

    CodeQL now reports "No new alerts in code changed by this pull request" and all 12 PR checks pass, including CodeQL Python/JavaScript/Actions analysis, broken-access-control, xss-sink, swagger-route, syntax, and release-notes. PR #1268 is mergeable with a clean merge state.

  5. added a commit that references this issue on Aug 18, 2026
    9a17a13
  6. paullizer commented on Aug 19, 2026

    @paullizer
    ContributorAuthor

    Shipped in v0.250.215 via #1268.

    Release note entries:

    • v0.250.215: Retrieved Sources and Cited References

    Full notes: https://microsoft.github.io/simplechat/explanation/release_notes/

    Closing as completed. This issue stayed open after the fix merged because pull requests target Development while the repository default branch is main, so GitHub never applied the Fixes # keyword automatically.

  7. moved this from In review to Released in Simple Chat Roadmapon Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions