Four issues raised on the first commit, all reproduced before fixing:
- The DNS pre-check hardcoded huggingface.co, so a reachable HF_ENDPOINT
mirror was forced offline whenever huggingface.co did not resolve. It now
follows the configured endpoint.
- The reachability verdict was memoised for 60s, and a stale "reachable"
hid the user pulling the plug right after a download, which is the exact
workflow this fix targets. Window is now 5s in both directions: long
enough to dedupe the probes within one load, short enough that neither
direction goes stale.
- hf_endpoint_unreachable counts 502/503/504 as offline, and the training
worker used it to set flags for the whole job, so a momentary hub blip
blocked every download for the rest of the run. Added
gateway_errors_offline=False for callers setting lifetime flags; scoped
callers keep the existing behaviour.
- Dropped the guard from _target_is_vision. The resolver only yields local
paths there, so it returns from the mmproj filesystem branch without
touching the hub, and the probe only added latency per request.
Verified unchanged offline: load 686s -> 5s, /models/config 378s -> 0s,
/models/check-vision 28s -> 0s.