Repository navigation
Wait out the Home Assistant landing page before reading onboarding - #28
Merged
Merged
Conversation
A fresh Home Assistant OS install serves the Supervisor's landing page until Core is pulled and started. It answers the front page with 200 and every /api/ path with a bare 401, so the hook recorded "Onboarding state unavailable (HTTP 401)" on fresh installs. The hook now reads the status view every 10 s while the answer is a bare 401 or no answer, until Core answers or 540 s after the run started, inside the declared 600 s timeout. A 401 with WWW-Authenticate is recorded at once. Each pass moves the progress bar, a write the platform refuses once the attempt has ended, so a cancelled attempt stops waiting.
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
On a fresh Home Assistant OS install, the onboarding hook records "Onboarding state unavailable (HTTP 401)" where it should record the onboarding state. The lab run for #26 and eshtek/hexos-platform#2105 on 2026-10-10 (fresh HAOS, Core 2026.10.1) caught it: the hook ran about 25 s after readiness, while the Supervisor's landing page ("Preparing Home Assistant") was still serving the guest. The landing page answers
/with 200, so the reachability check passes, and it answers every/api/path with a bare 401 (home-assistant/landingpage,main.go, unchanged since 2020). Core came up a few minutes later and served/api/onboardingwith 200. The old port 8123 hits the same landing page, so the bug predates #26.Core never answers the status view with 401. The view takes no authentication, and Core's HTTP server starts only after the frontend is set up, which depends on onboarding. A bare 401 therefore means Core is not up yet.
Changes, all in
home-assistant-os/haos_setup.ts:/api/onboardingevery 10 s for as long as the answer is a bare 401 or there is no answer (the gap between the landing page stopping and Core listening). Any other answer is described as before.WWW-Authenticatecomes from a proxy asking for credentials, so it is recorded at once, as before.performance.now(), so a wall-clock step on the box cannot stretch it past the timeout.timeoutinhome-assistant-os.jsonby hand. The tests read the declared timeout from the JSON and fail if the hook can outlast it, so lowering the timeout without the budget breaks CI.✅ Test plan
bun run test-hooks: 92 pass. The HAOS file has 23 tests, 10 of them new.WWW-Authenticateignored, no progress write, the last error winning over the last answer, every error logged, errors not waited through, a budget past the timeout, the budget measured from after the front page, no waiting message, and the read timeout dropped.bun run validate: 29 blueprints and 32 apps, 0 errors.bun run typecheck: the same 5 errors in the vendoredvm-surfaces.tsas onstaging, none from this PR./api/onboardingwith 401. The hook recorded "Home Assistant answered at http://:8123/", waited, and recorded "Fresh install: finish onboarding in the browser (4 of 4 steps remain)" once Core answered on port 80. The setup tasks took 91 s and 85 s. The second install ran the final revision: during the wait the checkpoint read "Waiting for Home Assistant to finish preparing" and progress went from 50 to 54. On 2026-10-10 the same box, running the hook fromstaging, recorded the 401.