Repository navigation
fix(web): retry transient thread watch failures - #871
Merged
Merged
Conversation
nixuuu
enabled auto-merge (squash)
November 16, 2026 13:12
nixuuu
added a commit
that referenced
this pull request
Nov 17, 2026
## 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
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.
Problem
A transient untyped exception from the gateway thread watcher arrived in the web client as
Code.Unknownwithwatch_failed. The client treated it as deterministic data corruption, exhaustedreset → smaller → stop, and left the thread requiring a page refresh.Change
Code.Unknownwithwatch_failedas a transient stream failure;decode_erroron the bounded cursor repair path;Validation
bun run check:tmp packages/domain/src/thread-watch-liveness.test.tsbun run --filter @canopy/domain typecheckbunx oxlint packages/domain/src/thread-watch-recovery.ts packages/domain/src/thread-watch-liveness.test.tsgit diff --checkCopy audit: no user-facing UI text changed.