Recover missed events and add safe history replay - #170
Draft
flinter15 wants to merge 4 commits into
Draft
Conversation
flinter15
force-pushed
the
codex/upstream-event-recovery
branch
from
July 22, 2026 10:50
2811fea to
1cdedc2
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.
Summary
This draft addresses event-history fidelity and recovery after transient gateway gaps:
getEventSummaryonlycat.backfill_event_summariesaction, including optional cursor-based full-history replayMotivation
The existing reconnect path hydrates only the newest event. If the WebSocket silently drops events and a later event is delivered, earlier event IDs can remain absent from Home Assistant Recorder indefinitely. That loses transit and contraband history even though the gateway still retains those events.
Safety and gateway load
The interval and full-history option are intentionally called out for maintainer review because the OnlyCat team can best judge the gateway's preferred load profile and API guarantees.
Compatibility
The branch is based on current upstream
masterand retains the new API-key setup and persisted pet/device-tracker state. It does not change upstream ownership, repository URLs, manifest version, or changelog.The work is separated into four logical commits for easier review. I am happy to split it into smaller PRs if preferred.
Testing
ruff format --check .ruff check .git diff --checkghcr.io/home-assistant/home-assistant:stable(Python 3.14.6): 26 passedRegression coverage includes a gap where event IDs 1331 and 1332 are missing even though a later ID has already been processed, plus retry behavior when an event summary is temporarily incomplete.