ITADN

`moon run` reinstalls `rust` toolchain on every run

#127Opennyermakh 创建于 2026-04-01
N
nyermakhcommented
## Description When the Rust toolchain is not yet installed and `moon run` triggers its installation, proto's `manifest.json` for the rust tool is never updated. This means every subsequent `moon run` from a clean state sees no installed version and reinstalls the full toolchain (including an uninstall/reinstall cycle via rustup). ## Environment - moon: 2.1.3 - proto: 0.55.4 - rust plugin: 0.13.8 - OS: Linux (arm64, Debian 12) - `PROTO_HOME`: `/usr/dev/proto` (non-default location) ## Steps to reproduce 1. Start with an empty `manifest.json` (simulating a fresh container or clean proto store): ```sh echo '{"installed_versions":[],"shim_version":0,"versions":{}}' > $PROTO_HOME/tools/rust/manifest.json ``` 2. Run any moon task that uses Rust: ```sh moon run example:test ``` 3. Observe that Rust is installed via rustup. Then run the task again: ```sh moon run example:test ``` ## Expected behavior The second run should detect that `1.93.0` is already installed and skip the install step. ## Actual behavior Every run reinstalls the toolchain: ``` ▮▮▮▮ installing rust 1.93.0 warn: removing the active toolchain; a toolchain override will be required for running Rust tools warn: removing the default toolchain; proc-macros and build scripts might no longer build info: uninstalling toolchain 1.93.0-aarch64-unknown-linux-gnu info: toolchain 1.93.0-aarch64-unknown-linux-gnu uninstalled info: syncing channel updates for 1.93.0-aarch64-unknown-linux-gnu info: downloading 6 components ... ``` After the run, `manifest.json` is still empty: ```json {"installed_versions":[],"shim_version":0,"versions":{}} ``` ## Root cause The Rust plugin delegates installation to rustup (storing toolchains under `$RUSTUP_HOME/toolchains/`) instead of using proto's standard download/unpack flow. As a result, proto's manifest write — which normally records the installed version — never fires during a `moon run`-triggered installation. Note that `proto install rust 1.93.0` via the CLI **does** correctly update `manifest.json`, and subsequent `moon run` calls then skip the install: ```json { "installed_versions": ["1.93.0"], "versions": { "1.93.0": { "installed_at": 1775071914298, "lock": { "os": "linux", "arch": "arm64" } } } } ``` ## Workaround Run `proto install rust --quiet` before any `moon run` (e.g., in a devcontainer `postCreateCommand`). This correctly registers the version in the manifest and prevents reinstalls.
2 条评论