Skip to content

Publish citation sources added by document reads - #849

Merged
WaylandYang merged 4 commits into
deeplethe:devfrom
Maya-Kid:fix/chat-document-citation-sources
Sep 21, 2026
Merged

WaylandYang merged 4 commits into
deeplethe:devfrom
Maya-Kid:fix/chat-document-citation-sources

Conversation

@Maya-Kid

@Maya-Kid Maya-Kid commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Latest dev synchronization (2026-09-21)

Based on dev@474b904dc3e8014d42404a3c067af9906036a953; current head 4d8204e016d79f97de4c46b3f0b2f09749d73132.

Revalidated the combined integration tree 6cd976351b4d7cc7389730fce530526f4d197992 on isolated Linux PostgreSQL fixtures (all 675 tracked source files hash-matched):

The evidence-only handoff core remains frozen. Earlier validation below belongs to its stated historical heads. Automated browser checks do not replace the maintainer's requested visual review.


get_document adds citation numbers to the same tool sink as search, but its document step did not trigger a sources event. A newly cited chunk was saved in history while live and reattached answers could not resolve its reference.

Publish the existing full sources frame whenever the append-only source list grows, independently of the UI step kind. Repeated document reads and graph-only tools do not publish duplicate lists. The sink lock is released before yielding.

Validation on Linux with an isolated migrated PostgreSQL database and a local gated HTTP model substitute:

  • Both regressions fail on dev ea0557b: search A → read A+B leaves only A in the live snapshot; direct document reads leave no sources.
  • Both pass after the fix. They exercise actual document/chunk creation, BM25 search, tool dispatch, chat, reattach, and history handlers. Repeated reads keep IDs/numbers stable; live sources, a pre-answer reattachment snapshot and stored sources agree.
  • Formatting and strict workspace clippy pass; the Chat suite and 24 existing MCP tests pass with the database guard enabled, including document read and isolation coverage.

No change to retrieval ranking, citation UI, truncation budgets, wire schema, or model finalization policy. No paid model or business data was used. Browser verification is not claimed by these handler tests.

Additional integration validation: isolated tree f7bcd0878bf490d6efb122b71d6f13d379df4709 combines this change with #845 and the other scoped Chat fixes. Linux Rust fmt, strict workspace Clippy, workspace build and 1,013 tests pass (one pre-existing external-HTTPS RSS test ignored); frontend 129 module tests, 27 real-component browser subtests and build pass. Database/PDF test guards were enabled. This combined result is separate from the standalone checks above.

Chrome against the actual Linux backend and PostgreSQL also confirmed that live, reattached and reloaded citation [2] opens the ingested document preview; the pre-answer snapshot sources equal stored history. The tool-phase event-count assertion now stops before the final graph step, so it still rejects duplicate document publication while allowing #845's later persisted-source replay.

Signed-off-by: dada-yan <BinjunYann@gmail.com>
Signed-off-by: dada-yan <BinjunYann@gmail.com>
Signed-off-by: dada-yan <BinjunYann@gmail.com>
@Maya-Kid
Maya-Kid force-pushed the fix/chat-document-citation-sources branch from 9a9f2e0 to 4d8204e Compare September 21, 2026 10:25
# Conflicts:
#	crates/utopia-server/src/api/chat_empty_reply_tests.rs
@WaylandYang
WaylandYang merged commit ae9b240 into deeplethe:dev Sep 21, 2026
4 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