Skip to content

Keep older chat handles from unregistering newer generations - #848

Merged
WaylandYang merged 3 commits into
deeplethe:devfrom
Maya-Kid:fix/chat-registry-handle-ownership
Sep 21, 2026
Merged

WaylandYang merged 3 commits into
deeplethe:devfrom
Maya-Kid:fix/chat-registry-handle-ownership

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 29a717e1d12ad3782f1634e0bf8d9dd0b9e5daef.

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.


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 returns idle instead of reconnecting to it.

Handle::finish now compares the entry's existing snapshot identity and removes it under the same registry write lock. The change preserves the current replacement behavior of begin, 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:

  • The regression invokes the real chat and reattach handlers 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 returns idle. After the fix, it receives the newer answer and done, and both answers are stored. Exactly four model-substitute requests occur; no paid model is used.
  • Registry tests cover all six finish orders for three replacements, independent conversations, late old emissions, current-owner cleanup, and snapshot/subscription continuity. Reverting only the ownership check makes the handler regression fail again; restoring it passes.
  • 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.
  • Frontend: frozen-lockfile install, 116 tests, and production build/typecheck/style guard pass (Node 22.23.2, pnpm 10.2.1). Backend: Rust 1.98.1.
  • A separate combination with Hand off exhausted tool runs to an evidence-only final answer #845 at 02e6aa3691f4f8e7494035d18f2a06bf28b58547 passes 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.

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-registry-handle-ownership branch from de24be9 to 29a717e Compare September 21, 2026 10:25
@WaylandYang
WaylandYang merged commit 8594a9c 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