Keep older chat handles from unregistering newer generations - #848
Merged
WaylandYang merged 3 commits intoSep 21, 2026
Merged
Conversation
Maya-Kid
force-pushed
the
fix/chat-registry-handle-ownership
branch
from
September 21, 2026 09:28
51f3d84 to
de24be9
Compare
This was referenced Sep 21, 2026
Signed-off-by: dada-yan <BinjunYann@gmail.com>
Signed-off-by: dada-yan <BinjunYann@gmail.com>
Maya-Kid
force-pushed
the
fix/chat-registry-handle-ownership
branch
from
September 21, 2026 10:25
de24be9 to
29a717e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Latest dev synchronization (2026-09-21)
Based on
dev@474b904dc3e8014d42404a3c067af9906036a953; current head29a717e1d12ad3782f1634e0bf8d9dd0b9e5daef.Revalidated the combined integration tree
6cd976351b4d7cc7389730fce530526f4d197992on isolated Linux PostgreSQL fixtures (all 675 tracked source files hash-matched):cargo test -p utopia-server api::chat::, listed and executed 47 tests. All 37 introduced tests were observed passing: Hand off exhausted tool runs to an evidence-only final answer #845 22, Keep older chat handles from unregistering newer generations #848 1, Publish citation sources added by document reads #849 2, Keep fallback retrieval failures distinct from empty results #850 4, Preserve exact chat outcomes across stream closure and reattachment #851 3, Do not report fallback chat completion when saving fails #852 3, and upstream Assert a chat turn ends in exactly one earned terminal #858 2. No test module was deleted during CI consolidation.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.
When two chat producers overlap in one conversation, the older producer's
finish()removes the newer producer's registry entry. The newer answer continues generating and can still persist, but reopening the conversation returnsidleinstead of reconnecting to it.Handle::finishnow compares the entry's existing snapshot identity and removes it under the same registry write lock. The change preserves the current replacement behavior ofbegin, the snapshot/subscription locking boundary, and the SSE wire format. It adds no cancellation or request-serialization policy.Validation on Linux, based on
dev@ea0557ba466979449a93b7060ca42a2cf46e2b96:chatandreattachhandlers with PostgreSQL and a gated local HTTP model substitute. Both producers run before the older one finishes; its broadcast channel closing proves cleanup has completed before reattachment. Before the fix, reattachment returnsidle. After the fix, it receives the newer answer anddone, and both answers are stored. Exactly four model-substitute requests occur; no paid model is used.cargo fmt --all --check, strict workspace clippy, locked workspace build, and locked workspace tests pass: 977 passed, 0 failed, 1 existing public-network test ignored. Database and PDF dependency guards were enabled against an isolated migrated database.02e6aa3691f4f8e7494035d18f2a06bf28b58547passes 33 Chat tests and 3 Registry tests, retaining its finalization and persistence regressions. This PR does not depend on or modify that branch.CI runs the new handler regression in the PostgreSQL job with
UTOPIA_TEST_REQUIRE_DB=1. No browser E2E was run; this change is limited to server registry ownership. No schema/API migration or production deployment is involved. Rolling back restores the old unregister race; no stored data needs rewriting.