Skip to content

Prevent post-install update entity flicker to “upgradable”#78

Draft
gensyn with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-upgradable-entities-after-upgrade
Draft

Prevent post-install update entity flicker to “upgradable”#78
gensyn with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-upgradable-entities-after-upgrade

Conversation

Copilot AI commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

After a container upgrade is triggered from the update entity, the entity could briefly return to on (update available) during the reload window before coordinator data settled. This change keeps the entity in an explicit install-in-progress phase until refreshed state is available.

  • Update entity state sequencing

    • In DockerContainerUpdateEntity.async_install, in_progress now remains True until coordinator.async_request_refresh() completes.
    • The transition to in_progress=False is deferred to the finalization block after refresh, avoiding an intermediate stale “upgradable” presentation.
  • Behavioral guardrail in tests

    • Added a unit test to assert that in_progress is still True while refresh is executing, and only resets afterward.
  • Illustrative change

    try:
        await self.coordinator.create()
    finally:
        try:
            await self.coordinator.async_request_refresh()
        finally:
            self._attr_in_progress = False
            self.async_write_ha_state()

Copilot AI changed the title [WIP] Fix bug with update entities showing as upgradable after container upgrade Prevent post-install update entity flicker to “upgradable” Jul 18, 2026
Copilot AI requested a review from gensyn July 18, 2026 08:00
Comment thread update.py
@@ -133,7 +133,9 @@ async def async_install(
try:
await self.coordinator.create()
finally:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Is an empty finally block in python valid and reasonable?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes—try ... finally without an except is valid Python, and it’s commonly used for guaranteed cleanup. In this case the outer finally is not empty; it ensures we always run the post-install refresh/cleanup path even if create() raises.

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.

bug: Update entities briefly show containers as upgradable after upgrade

2 participants