Don't auto-load Web Workflow on bare localhost#480
Merged
makermelissa merged 2 commits intocircuitpython:mainfrom Apr 29, 2026
Merged
Conversation
getBackend() previously fell through to Web Workflow whenever isLocal() was true. On bare http://localhost/ that meant Web Workflow was loaded without a target, which then triggered the "You are connected with localhost, but didn't supply the device hostname." error before the user ever saw the connect dialog. Restrict the auto-pick to cases where there is actually a Web Workflow target: an mdns or IP hostname, or a host= URL parameter. On bare localhost with no hint, return null so the connect dialog can prompt for BLE / Serial / USB instead.
makermelissa
approved these changes
Apr 29, 2026
…-on-bare-localhost # Conflicts: # js/script.js
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.
Problem
Visiting the editor at bare
http://localhost/(i.e. running it locally for development with no?backend=and no?host=URL params) silently auto-selects the Web Workflow.WebWorkflow.parseParams()then seesisTestHost()is true with nohost=supplied and returns:The user never reaches the connect dialog, so they can't pick BLE / Serial / USB instead.
Cause
getBackend()injs/script.jsfalls through to Web Workflow wheneverisLocal()is true:isLocal()returns true for barelocalhost(no path constraint on the localhost branch), so Web Workflow is auto-loaded even when there's no plausible Web Workflow target.Fix
Only auto-pick Web Workflow when there's actually a target for it:
*.local)host=URL paramOtherwise return
nullsoscript.jsfalls through to the connect dialog and lets the user choose.Risk / compatibility
Small surface change. The only behaviour difference is on bare
localhostwith no URL hints — previously it auto-picked Web Workflow (and immediately errored), now it falls through to the connect dialog. Any URL that previously connected successfully (mdns, IP, or?host=) still does.Testing
Verified locally on a dev server: bare
http://localhost:PORT/now shows the connect dialog instead of the "didn't supply the device hostname" error, and BLE / Serial / USB selections work as expected. Web Workflow paths (mdns / IP /?host=) unchanged.