Repository navigation
fix(http): fail fast when network is unavailable - #11066
Conversation
Entire-Checkpoint: c6964364bcde
📝 WalkthroughWalkthroughFast commands now cap remote-version timeouts and disable HTTP retries. HTTP requests classify and cache hard connection failures by host, reject subsequent attempts, and support HTTPS fallback. Retry callsites use the new settings accessor, with tests covering offline behavior and circuit handling. ChangesOffline HTTP behavior
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 `@src/http.rs`:
- Around line 618-623: Update send_once_with_https_fallback_with_retry_headers
so its HTTP-to-HTTPS fallback condition also recognizes circuit-broken hosts
from UNAVAILABLE_HTTP_HOSTS, in addition to is_connection_error(&err). Preserve
the existing fallback behavior for connection errors and ensure subsequent
requests to affected http:// URLs still retry via https://.
🪄 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: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 97bfc975-9cf6-4b2e-abba-f1e3f584d864
📒 Files selected for processing (4)
settings.tomlsrc/config/settings.rssrc/github/sigstore.rssrc/http.rs
Greptile SummaryThis PR addresses slow shim and activation paths when the network is unavailable by introducing three coordinated mechanisms: a prefer_offline-gated circuit breaker keyed by origin, DNS failure reclassification as non-transient, and a per-request 3 s timeout cap (plus retry=0) for fast-path commands.
Confidence Score: 5/5Safe to merge — the circuit and retry changes are strictly scoped to prefer_offline paths; artifact download timeouts and non-prefer_offline behavior are unchanged. Both the circuit write and read in send_once_inner are gated on prefer_offline(), confirmed by test_circuit_breaker_is_disabled_without_prefer_offline. Credential scrubbing (err.without_url()) prevents secret leakage into the circuit table. The two findings are minor usability nits that do not affect correctness. No files require special attention; src/http.rs carries the most logic but the circuit gating is thorough and well-tested. Important Files Changed
Reviews (3): Last reviewed commit: "fix(http): apply fast timeout per reques..." | Re-trigger Greptile |
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.7.7 x -- echo |
22.6 ± 2.5 | 19.5 | 37.8 | 1.00 |
mise x -- echo |
23.7 ± 2.3 | 19.9 | 58.2 | 1.05 ± 0.15 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.7.7 env |
22.4 ± 1.3 | 19.8 | 27.1 | 1.02 ± 0.09 |
mise env |
21.9 ± 1.5 | 18.8 | 31.0 | 1.00 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.7.7 hook-env |
23.5 ± 1.2 | 21.0 | 30.0 | 1.04 ± 0.09 |
mise hook-env |
22.5 ± 1.5 | 18.9 | 29.5 | 1.00 |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2026.7.7 ls |
20.1 ± 1.1 | 17.1 | 24.3 | 1.05 ± 0.09 |
mise ls |
19.2 ± 1.2 | 15.9 | 23.5 | 1.00 |
xtasks/test/perf
| Command | mise-2026.7.7 | mise | Variance |
|---|---|---|---|
| install (cached) | 184ms | 185ms | +0% |
| ls (cached) | 69ms | 68ms | +1% |
| bin-paths (cached) | 78ms | 74ms | +5% |
| task-ls (cached) | 162ms | 158ms | +2% |
Entire-Checkpoint: 369a52f0edfd
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 424b5bd. Configure here.
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 `@src/http.rs`:
- Around line 675-683: Update the circuit-breaker caching in the prefer_offline
hard-failure branch to store the error string after calling
reqwest::Error::without_url(), rather than using err.to_string() directly. Keep
the existing host selection and UNAVAILABLE_HTTP_HOSTS insertion behavior
unchanged.
🪄 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: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 592f0e08-470f-47da-b18d-524b3ef1d812
📒 Files selected for processing (1)
src/http.rs
Entire-Checkpoint: 832aefbdd3d8
|
Caution Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted. Error details |

Summary
prefer_offlineRoot cause
When a fuzzy tool request had no matching installed version, shims and other fast commands had to resolve it remotely. DNS and connection failures were classified as transient, so each endpoint repeated the full timeout and retry schedule. Multiple lookups to the same unavailable origin paid that cost independently.
User impact
Shims, shell activation, and
mise xnow make one bounded remote-version attempt when cached data is insufficient. Repeated requests to an origin that already failed hard return immediately. Artifact download timeouts remain unchanged.Context: #4598
Testing
mise run test:unit— 1,727 tests passedmise run lint-fixmise run render:schemagit diff --checkThis pull request was generated by an AI coding assistant.
Note
Medium Risk
Changes sit on the shared HTTP stack and settings used by shims and version resolution, but the new limits and circuit breaker apply only when
prefer_offlineis active; full install/download paths keep prior retry and timeout behavior.Overview
Fast commands (shims, shell activation, and anything using
prefer_offline) no longer stack long timeouts and HTTP retries when remote version lookups miss cache and the network is down.Settingsnow capsfetch_remote_versions_timeoutat 3 seconds and forceshttp_retriesto 0 underprefer_offline, with docs updated forfetch_remote_versions_timeoutandhttp_retries. The fetch HTTP client applies that shorter timeout per request at send time (the static client still uses the configured timeout).In
src/http.rs, a process-local circuit records hard DNS/connect failures per origin duringprefer_offlineand short-circuits later requests with the original cause (without leaking query strings). DNS failures are treated as non-retryable; HTTP→HTTPS fallback still runs when the circuit blocks anhttpattempt. Sigstore retry config follows the newhttp_retries()helper.Unit tests cover prefer-offline retry disabling, fetch timeout clamping, DNS/circuit behavior, and HTTPS fallback when the circuit is open.
Reviewed by Cursor Bugbot for commit 6344514. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit