Skip to content

do not try to fetch remote tags if there is no internet - #4331

Open
nicoschmdt wants to merge 2 commits into
bluerobotics:masterfrom
nicoschmdt:versionchooser-fetch-remote-1788
Open

do not try to fetch remote tags if there is no internet#4331
nicoschmdt wants to merge 2 commits into
bluerobotics:masterfrom
nicoschmdt:versionchooser-fetch-remote-1788

Conversation

@nicoschmdt

Copy link
Copy Markdown
Collaborator

fix: #1788

@nicoschmdt
nicoschmdt requested a review from a team August 26, 2026 19:57
@github-actions

Copy link
Copy Markdown

Automated PR Review

0. Summary

  • Verdict: MINOR SUGGESTIONS ✏️

Stops the version chooser from hanging when DockerHub is unreachable by adding a 60s/10s aiohttp timeout and catching network-level exceptions in set_remote_versions. On the frontend it also refactors the internet-state handling in VersionChooser.vue (splitting is_offline from can_fetch_remote) and defers the initial remote fetch in NewVersionNotificator.vue until connectivity is available.

1. Correctness & Implementation Bugs

  • 1.1 [minor] core/frontend/src/components/app/NewVersionNotificator.vue:56 — the new can_fetch_remote watcher calls this.run() unconditionally when connectivity returns, but run() has no re-entrance guard. If mounted() is still awaiting loadCurrentVersion() / loadAvailableVersions() when the internet state transitions, two overlapping run() invocations race and can leave available_versions, latest_beta, latest_stable, and should_open in an inconsistent state (last-writer-wins on the shared component fields). Consider a simple in-flight flag (or reuse a promise) before firing another run().
  • 1.2 [minor] core/services/versionchooser/utils/chooser.py:379except (aiohttp.ClientConnectionError, OSError) is broad enough to swallow non-network OSError subclasses (e.g. an unexpected filesystem/permission error surfaced from a lower layer) and mislabel them as NO_INTERNET_ERROR ("Unable to reach DockerHub…"). Catching OSError is necessary to pick up asyncio.TimeoutError on 3.11+ (it aliases TimeoutError, which is an OSError), but consider narrowing to (aiohttp.ClientConnectionError, aiohttp.ServerTimeoutError, asyncio.TimeoutError, socket.gaierror) so a genuinely unexpected error still falls through to the logger.critical branch instead of being silently reported as "no internet".

6. Code Quality & Style

  • 6.1 [minor] core/frontend/src/components/version-chooser/VersionChooser.vue:344 — the second branch in remote_alert_message (if (this.available_versions.error === this.offline_error_message) return null) is dead. resetToNoInternetAvailable no longer writes offline_error_message into available_versions.error (it's now null), and the backend's NO_INTERNET_ERROR is a different string ("Unable to reach DockerHub, can't fetch remote images"). Either drop the check, or intentionally match against the backend NO_INTERNET_ERROR constant if the goal is to avoid showing "no internet" twice when the frontend and backend disagree.
  • 6.2 [nit] core/frontend/src/components/version-chooser/VersionChooser.vue:709 — with error: null, resetToNoInternetAvailable is now just clearing remote and the two latest_* fields; the alert text is entirely derived by remote_alert_message. Consider renaming to reflect the new intent (e.g. clearRemoteVersions) so the method name still describes what it does.
  • 6.3 [nit] core/services/versionchooser/utils/dockerhub.py:15 — the three sessions all take the same timeout; extracting the pattern (or attaching the timeout to a shared ClientSession) would DRY things up. Not required, just noted since the file already has one session created per call (which AGENTS.md flags as a common pitfall).

7. Tests

  • 7.1 [minor] core/services/versionchooser/test_versionchooser.py — no coverage is added for the new exception branch in set_remote_versions or the DOCKERHUB_TIMEOUT behavior. A small test that patches TagFetcher.fetch_remote_tags to raise aiohttp.ClientConnectionError and asserts output["error"] == NO_INTERNET_ERROR and output["remote"] == [] would lock the intended behavior in place.

Generated by PR Review Bot. This is advisory, a human reviewer must still approve.

Comment thread core/frontend/src/components/version-chooser/VersionChooser.vue Outdated
Comment thread core/frontend/src/components/version-chooser/VersionChooser.vue
@nicoschmdt
nicoschmdt force-pushed the versionchooser-fetch-remote-1788 branch from 3457657 to 5d276b5 Compare August 27, 2026 16:39
Comment thread core/services/versionchooser/utils/chooser.py
Comment thread core/services/versionchooser/utils/dockerhub.py Outdated
Comment thread core/frontend/src/components/version-chooser/VersionChooser.vue Outdated
Comment thread core/frontend/src/components/version-chooser/VersionChooser.vue Outdated
Comment thread core/frontend/src/components/version-chooser/VersionChooser.vue Outdated
@nicoschmdt
nicoschmdt force-pushed the versionchooser-fetch-remote-1788 branch from 5d276b5 to 62ed41a Compare August 28, 2026 22:03
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.

version chooser: we shouldn't try to fetch remote tags if there is no internet

2 participants