Repository navigation
Reconnect notification streams after broadcast lag to recover missed updates - #1080
Merged
Merged
Conversation
…updates Signed-off-by: Floating-Y <118035379+Floating-Y@users.noreply.github.com>
WaylandYang
approved these changes
Oct 5, 2026
WaylandYang
left a comment
Contributor
There was a problem hiding this comment.
Thanks @Floating-Y. Right: after a lag the stream stayed open, the lost event may have been the only one this listener would ever get, and nothing told the page to catch up. Ending the response reuses the recovery the page already has, so there is no new event to teach the client, and it costs two changed lines outside the tests. The filtering and alert payloads are pinned by the second test as they were. Landing it.
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.
Why
The shared broadcast channel can evict a knowledge base's only notification or the only alert. Continuing after
RecvError::Laggedleaves the SSE connection open while the remaining events are filtered out, so the client's reconnect recovery never runs for that loss.Follow-up to #1036 and #1053, which added reconnect recovery and consolidated notification subscriptions but did not cover broadcast overflow.
What changes
Authentication, filtering, alert payloads, keep-alives, event coalescing, and hidden-page connection handling retain their existing behavior. Chat-generation streams are untouched; no production frontend or dependency changes are needed.
How it was checked
continuebranches and pass with the fix, returning HTTP 200 SSE responses that finish with empty bodies. Coverage includes a lost KB document, a lost global alert on the KB stream, and a lost standalone alert.open → error → openand exactly one recovery refetch, without another business event. Other-KB and unrelated queries stayed unchanged; initial connection and cleanup caused no extra refetch. This used a local HTTP fixture around the production SSE constructors; a full deployed UI/authentication walkthrough was not performed.cargo fmt --all --checkandcargo clippy --workspace --all-targets -- -D warningspassed.cargo test --workspace: 1,432 passed, 6 existing opt-in tests ignored. Tests used a dedicated migrated PostgreSQL database withUTOPIA_TEST_REQUIRE_DB=1andUTOPIA_TEST_REQUIRE_PDFTOTEXT=1. The first run hit local proxy failures; the complete successful rerun set process-localNO_PROXY=127.0.0.1,localhost,::1.pnpm install --frozen-lockfile,pnpm test(228 tests), andpnpm buildpassed.An additional
cargo build --workspaceattempt failed when Cargo tried to replace the existing, runningtarget/debug/utopia-server.exeon Windows (access denied). That service was left running; the full non-test build is not reported as passing.Before review
git commit -s)cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warningsandcargo test --workspacepassweb/:pnpm buildandpnpm testpass