Conversation
The restart_required repair issues are created when a downloaded integration needs a restart to take effect, but nothing ever deletes them. Because the issue id embeds the ref, every download creates a new id instead of reusing an existing one, so the entries accumulate in the issue registry indefinitely. The issues are not persistent, so Home Assistant keeps them across a restart as inactive entries with their fields stripped. That hides them from the repairs UI while they are still written back to storage on every save, so the growth is invisible. One installation had 122 of them going back 15 months. Reaching startup_tasks means Home Assistant has restarted, so any restart_required issue from a previous run is already resolved and can be deleted. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This branch has not been deployed
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
restart_requiredrepair issues are created inHacsIntegrationRepository.async_post_installation, but nothing ever deletes them. The issue id embeds the ref (restart_required_{id}_{ref}), so every download mints a new id rather than reusing an existing one, and the entries accumulate in.storage/repairs.issue_registryindefinitely.This adds a sweep in
startup_tasks. Reaching that point means Home Assistant has restarted, so anyrestart_requiredissue from a previous run is by definition already resolved.Why this is not visible today
These issues are not persistent, so core keeps them across a restart as inactive entries with their fields stripped (
IssueRegistry._async_loadsetsactive=False, andIssueEntry.to_jsonwrites the stripped row back). That is intended core behaviour, so the fix belongs here rather than in core.The effect is that the rows never appear in the repairs UI or the websocket API, yet they are re-serialised to storage on every save. The growth is completely silent.
On my own installation there were 122 of them, dating back 15 months:
The repairs API reported 4 issues and none of these, even including dismissed ones.
Note on #4403
#4403 also called
async_delete_issueon these issues and was rejected, so I want to be explicit that this is a different change.That PR let users dismiss a pending restart without restarting, which is the behaviour you objected to: the code is still loaded until a restart, so the warning has to stand. This PR does not add any way to dismiss anything, and does not touch the repair flow. It only deletes issues after a restart has already happened, at which point the warning has served its purpose. Behaviour before a restart is unchanged.
If the accumulation is considered acceptable, feel free to close this — but the leak is unbounded and users cannot see or clear it themselves.
Testing
test_delete_stale_restart_issuescovers the deletion, thatremoved_*issues and other domains' issues are left alone, and that a second run is a no-op.tests/repositories/test_update_repository.py::test_update_repository_entity_no_updatefails, but it fails identically on an unmodified checkout ofadb7d83, so it is unrelated to this change.ruff check,ruff format --checkandisort --check-onlyall clean.