Skip to content

fix(threads): recover disconnected thread watches - #920

Merged
nixuuu merged 1 commit into
devfrom
fix/reconnect-disconnected-thread
Nov 17, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/reconnect-disconnected-thread

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 17, 2026

Copy link
Copy Markdown
Member

Change

A disconnected thread could repeatedly fail to resume with Unknown/watch_failed while Load from scratch restored it. A snapshot from another reader can leave several pending revisions of the same large item in the replay range. Saving those revisions in a single upsert violated PostgreSQL's one-update-per-row rule and rolled back every resume attempt.

Keep the latest revision per entity when saving current content pointers, including inline replacements and removals, and prevent older revisions from overwriting newer pointers. Replay still delivers every sequence record. After two transient retries, repeated untyped gateway failures now try a fresh window, then a smaller window, before stopping with recovery actions. Visible messages remain available during recovery; ordinary transport drops retain automatic retries.

The regression reproduces the original failure over WorkerLink and gRPC, then verifies replay catches up without replacing the snapshot. A separate gRPC-to-SSE regression verifies automatic recovery with a fresh window. Updated the transcript and UI API documentation.

Verification

  • check:tmp: 27 passing tests across thread sequence content replay, replication retention, watch failures, and watch liveness; no temporary files left behind.
  • Domain and integration package typechecks passed.
  • Edited-file lint and formatting passed; git diff --check passed.
  • Full repository checks and builds remain with CI.
  • Copy audit: not applicable; no user-facing text changed.

Fixes: #864
Fixes: #871

@nixuuu
nixuuu enabled auto-merge (squash) November 17, 2026 08:59
@nixuuu
nixuuu merged commit dd08847 into dev Nov 17, 2026
15 checks passed
@nixuuu
nixuuu deleted the fix/reconnect-disconnected-thread branch November 17, 2026 09:05
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.

1 participant