Skip to content

feat: add a http_retries setting to define number of retry attempts#6444

Merged
jdx merged 1 commit intojdx:mainfrom
roele:issues/6429
Sep 28, 2025
Merged

feat: add a http_retries setting to define number of retry attempts#6444
jdx merged 1 commit intojdx:mainfrom
roele:issues/6429

Conversation

@roele
Copy link
Contributor

@roele roele commented Sep 27, 2025

I gave Add --retry option for mise install (#6429) a try (hence draft).

Not quite sure about making this global even though it affects various commands (e.g. ls, install, outdated, ...). Also not sure about the wording. Should we use MISE_HTTP_RETRIES to make it more clear or leave it open for possible use for other types of retries?

WDYT @jdx?


Note

Adds a new http_retries setting and implements exponential-backoff retries for HTTP requests and downloads.

  • HTTP Retries
    • Implement retries using tokio-retry with exponential backoff + jitter in src/http.rs (download_file_with_headers, send_with_https_fallback).
    • Add default_backoff_strategy(retries) helper to control retry count.
  • Configuration
    • New setting: settings.http_retries (env: MISE_HTTP_RETRIES) with docs; exposed in settings.toml and schema/mise.json.
  • Dependencies
    • Add tokio-retry crate; update Cargo.toml and Cargo.lock.

Written by Cursor Bugbot for commit ac6c653. This will update automatically on new commits. Configure here.

@jdx
Copy link
Owner

jdx commented Sep 27, 2025

I think just on install and maybe use would be good for now. I think global might be weird with mise run.

Maybe we could make this a setting too? Or maybe instead of the CLI flag?

@roele
Copy link
Contributor Author

roele commented Sep 27, 2025

Agreed. Having just a setting (and env var) is probably better than a flag and aligns better with the http_timeout.

@jdx
Copy link
Owner

jdx commented Sep 27, 2025

Might be good to name it MISE_TOOL_RETRIES so it's clear what it's for

@roele
Copy link
Contributor Author

roele commented Sep 27, 2025

It's currently implemented on HTTP level so it also affects other commands/requests like fetching GitHub releases/tags which is part of a tool installation. So it also applies when getting latest version via ls, checking outdated etc. so i think MISE_HTTP_RETRIES might be a better fit.
Regarding installation this might not work for all backends, for example spm does a Git clone so this would not apply. Maybe we require a different approach especially for installation failures?

@jdx
Copy link
Owner

jdx commented Sep 27, 2025

Ahh I see. Hmm. I was thinking this would be at a higher level for tool installs but maybe http is better?

@roele roele changed the title feat: add a --retries option to state number of retry attempts feat: add a http_retries setting to define number of retry attempts Sep 28, 2025
@roele roele marked this pull request as ready for review September 28, 2025 08:58
Copilot AI review requested due to automatic review settings September 28, 2025 08:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds HTTP retry functionality to mise with a configurable http_retries setting. The implementation uses an exponential backoff strategy with jitter to automatically retry failed HTTP requests.

  • Adds a new http_retries configuration setting with default value of 0 (no retries)
  • Implements retry logic for both file downloads and general HTTP requests using the tokio-retry crate
  • Uses exponential backoff with jitter starting from 10ms base duration

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.

File Description
src/http.rs Implements retry logic for HTTP operations using tokio-retry with exponential backoff
settings.toml Adds http_retries configuration setting with documentation
schema/mise.json Updates JSON schema to include the new http_retries setting
Cargo.toml Adds tokio-retry dependency

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@jdx
Copy link
Owner

jdx commented Sep 28, 2025

bugbot run

@jdx jdx merged commit e01ab79 into jdx:main Sep 28, 2025
23 checks passed
@jdx jdx mentioned this pull request Sep 28, 2025
jdx added a commit that referenced this pull request Sep 28, 2025
### 📦 Registry

- re-enable tests by @risu729 in
[#6454](#6454)
- restore comments and tests by @risu729 in
[#6378](#6378)
- add github backend for graphite by @jdx in
[#6455](#6455)

### 🚀 Features

- **(backend)** add environment variable override for tool backends by
@jdx in [#6456](#6456)
- add a http_retries setting to define number of retry attempts by
@roele in [#6444](#6444)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Bump version to 2025.9.22 with updated completions cache keys,
registry tweak for CycloneDX assets, doc star count update, and
usage-cli tool bump.
> 
> - **Release/versioning**
> - Bump `mise` to `2025.9.22` in `Cargo.toml`, `Cargo.lock`,
`default.nix`, `packaging/rpm/mise.spec`, and update version in
`README.md`.
>   - Add `CHANGELOG.md` entry for `2025.9.22`.
> - **Completions**
> - Update cached usage spec keys in `completions/_mise`,
`completions/mise.bash`, and `completions/mise.fish` to `2025_9_22`.
> - **Registry**
> - Adjust CycloneDX `cyclonedx-cli` assets in
`crates/.../cyclonedx-cli/registry.yaml` (remove linux musl overrides in
version overrides).
> - **Tooling/lockfile**
>   - Bump `cargo:usage-cli` to `2.3.0` in `mise.lock`.
> - **Docs**
>   - Update stars count in `docs/.vitepress/stars.data.ts` to `19.6k`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
5b3be09. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: mise-en-dev <release@mise.jdx.dev>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
@roele roele deleted the issues/6429 branch September 28, 2025 15:51
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.

4 participants