Repository navigation
Adapt OS update test to Supervisor no longer auto-rebooting - #4906
Conversation
Since Supervisor 2026.07 (home-assistant/supervisor#6982) a successful /os/update no longer reboots the host automatically. It installs the bundle to the other slot, marks it as the pending boot slot (exposed as "version_pending", see home-assistant/supervisor#7006) and raises a reboot-required repair issue, leaving the actual reboot to the user. test_os_update still waited for an immediate "Booting `Slot " right after `ha os update`, so when run against a 2026.07+ Supervisor it timed out and failed (cascading into test_supervisor). This is why the QEMU test job started failing on the dev builds built after 2026-06-30. Adapt the test to the new flow: - run `ha os update` and wait until the update is installed as pending (version_pending == target), retrying only while the OTA URL is not available yet; re-requesting an already-installed version is rejected. - apply the pending update with `ha host reboot` and wait for the new slot to boot. - assert the new version is running and nothing is pending anymore. Verified end-to-end in QEMU against the current dev image with the latest Supervisor: the update stages to slot B (version_pending=18.1, still booted on A), `ha host reboot` boots slot B, and afterwards version=18.1 with version_pending cleared. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. ๐ โน๏ธ Recent review infoโ๏ธ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: ๐ Files selected for processing (1)
๐ง Files skipped from review as they are similar to previous changes (1)
๐ WalkthroughWalkthroughThe OS update smoke test polls until Supervisor reports the target version as pending, reloads Supervisor when necessary, reboots to activate the update, and verifies both the running version and cleared pending state. ChangesOS update validation
Estimated code review effort: 2 (Simple) | ~10 minutes Poem
๐ฅ Pre-merge checks | โ 5โ Passed checks (5 passed)
โจ Finishing Touches๐ Generate docstrings
๐งช Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
๐ค Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/smoke_test/test_os_update.py`:
- Around line 62-69: Update the polling loop around shell_json to use a bounded
iteration count, preventing indefinite hangs when the update never reaches
stable_version. Make the os info command tolerate transient CLI failures like
the existing defensive handling earlier in the test, and parse its output safely
so failed or incomplete responses trigger the existing reload-and-retry path
rather than crashing. Preserve the successful version_pending check and retry
behavior.
๐ช Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
โน๏ธ Review info
โ๏ธ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 5713ba06-1ce7-4dcc-8e97-8df8da1c58aa
๐ Files selected for processing (1)
tests/smoke_test/test_os_update.py
There was a problem hiding this comment.
Pull request overview
Updates the QEMU smoke test for OS updates to match the new Supervisor behavior where /os/update installs to the other slot and marks it pending, but does not automatically reboot.
Changes:
- Waits for the target version to appear as
version_pendingafterha os update. - Explicitly reboots the host (
ha host reboot) to apply the pending slot. - Verifies the target version is running and that no update remains pending after reboot.
๐ก Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Bound the retry loop and fail with the last `ha os update` output instead of relying on the global test timeout when the update never installs. - Tolerate a transient `ha os info` CLI failure (|| true + defensive JSON parse), matching the pattern already used in test_init. - Use dict.get() for the post-reboot version_pending assertion. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
tests/smoke_test/test_os_update.py:65
- This retry loop can exceed the test-level timeout (600s):
shell.run_check(..., timeout=300)insiderange(10)allows up to 3000s blocked time before even reaching the reboot/ready waits. Consider doing one long attempt and then only short retries (or fewer attempts) so the overall upper bound stays within the test timeout budget.
for _ in range(10):
update_output = "\n".join(
shell.run_check(f"ha os update --no-progress --version {stable_version} || true", timeout=300)
)
- `ha os info --raw-json` returns "data": null on an error result; coerce it to an empty dict so the version_pending lookup can't raise AttributeError. - Lower the per-attempt timeout to 120s and the retry count to 4 so the loop's worst case stays within the test's 600s timeout budget. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The problem
The QEMU test job fails on the dev builds. Besides the offline test (see #4905),
test_os_updatefails:ha os updatereturnsCommand completed successfullybut the test times out waiting forBooting \Slotโ and that cascades intotest_supervisor` (setup can't reach a shell).Root cause
Since home-assistant/supervisor#6982 (merged 2026-06-30, an intentional breaking change) a successful
/os/updateno longer reboots the host automatically. Instead the Supervisor:version_pendingin/os/info(Track installed OS update pending reboot activationย supervisor#7006, which is whyversion/version_pendingboth read as the target),reboot_requiredrepair issue with anexecute_rebootsuggestion,and leaves the reboot to the user.
test_os_updatestill assumed the old "update โ immediate reboot" behavior.Timeline confirms it: the last green run (Jun 29) ran against a 2026.06 Supervisor (still auto-rebooted); the Jul 7 / Jul 10 failures ran against 2026.07 Supervisor (post-#6982). Since tests always pull the latest Supervisor, the test is what must adapt.
Reproduced and captured from the Supervisor log:
No auto-reboot within 150s;
version_pending: 18.1persists.The fix
Adapt
test_os_updateto the new flow:ha os updateand wait until the update is installed as pending (version_pending == target), retrying only while the OTA URL isn't available yet (right after boot);ha host rebootand wait for the new slot to boot;Verification
Driven end-to-end in QEMU against the current dev image + latest Supervisor:
Together with #4905 (offline
pingfix) this should restore the QEMU test job.Summary by CodeRabbit