Skip to content

fix(ops): handle host rustup cargo shims correctly - #601

Open
Rahulstark2 wants to merge 2 commits into
AgentWorkforce:mainfrom
Rahulstark2:fix/cargo-rustup-detection
Open

Rahulstark2 wants to merge 2 commits into
AgentWorkforce:mainfrom
Rahulstark2:fix/cargo-rustup-detection

Conversation

@Rahulstark2

@Rahulstark2 Rahulstark2 commented Oct 3, 2026 •

Copy link
Copy Markdown

Summary

  • avoid overriding the host RUSTUP_HOME before resolving Cargo
  • verify that discovered Cargo is actually usable before selecting it
  • fall back to the private Relayflows Rust toolchain when no usable Cargo installation is available

Problem

ops/cargo.sh currently sets RUSTUP_HOME to the private toolchain directory before checking for an existing Cargo installation.

On machines where Cargo is provided through a rustup shim, command -v cargo can succeed even when the selected rustup environment cannot actually run Cargo.

Because RUSTUP_HOME has already been changed to the private toolchain location, the host rustup shim can look for a default toolchain in an unpopulated private RUSTUP_HOME and fail with:

Screenshot 2026-10-03 at 1 49 23 PM

This can happen even when the host Rust installation is correctly configured and:

cargo --version
cargo 1.99.0

works normally outside the wrapper.

Changes

The wrapper now:

  • leaves the host RUSTUP_HOME unchanged while checking existing Cargo installations
  • validates discovered Cargo with cargo --version instead of only checking whether the command exists
  • configures the private RUSTUP_HOME only when using or bootstrapping the private toolchain
  • preserves the existing fallback behavior of bootstrapping a private Rust toolchain when no usable Cargo installation can be found

The resulting resolution order is:

working Cargo on PATH
        ↓
standard Cargo locations
        ↓
working private Cargo
        ↓
bootstrap private Rust/Cargo toolchain

Validation

  • verified the host Rust/rustup installation with rustup show
  • verified rustc --version and cargo --version work correctly outside the wrapper
  • reproduced the failure with the original cargo.sh
  • verified the updated wrapper no longer overrides the host RUSTUP_HOME when using the host Cargo
  • verified the private toolchain path remains available when no usable Cargo installation is found
  • ran ../ops/cargo.sh test --workspace successfully with all tests passing

Note

Low Risk
Scoped to the Cargo wrapper’s env and discovery logic; fixes CI/dev false negatives without changing application runtime behavior.

Overview
ops/cargo.sh no longer exports RUSTUP_HOME to the private toolchain home at startup. That early override made host rustup shims look in an empty private tree and fail with “no default toolchain configured” even when the machine’s Rust install worked outside the wrapper.

Cargo resolution now treats a candidate as valid only if cargo --version succeeds (PATH, CARGO_INSTALL_ROOT, ~/.cargo, /usr/local/cargo, then private CARGO_HOME). RUSTUP_HOME is set only when probing or bootstrapping the private toolchain under RELAYFLOWS_TOOLCHAIN_HOME. If nothing usable is found, the existing bootstrap path (private install outside the propagated workspace) is unchanged.

Reviewed by Cursor Bugbot for commit 617babd. Bugbot is set up for automated code reviews on this repo. Configure here.


Summary by cubic

Fixes ops/cargo.sh so the host RUSTUP_HOME isn't overridden before Cargo detection, which made rustup-shimmed Cargo fail with "no default toolchain configured" even when the host toolchain worked fine.

  • Validates discovered Cargo with cargo --version instead of only checking the command exists.
  • Resolves Cargo in this order: working Cargo on PATH, standard Cargo locations, private toolchain, then bootstrapping a private toolchain when nothing works.
  • Sets RUSTUP_HOME only when using or bootstrapping the private toolchain.

Written for commit ce103f7. Summary will update on new commits.

Review in cubic

@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7429af11-d902-4429-8bfc-56ce34e3b44f
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 1 file

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread ops/cargo.sh Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ce103f7. Configure here.

Comment thread ops/cargo.sh
@Rahulstark2

Copy link
Copy Markdown
Author

@khaliqgant @willwashburn

@khaliqgant

Copy link
Copy Markdown
Member

Thanks @Rahulstark2! Was there an original issue / bug report attached to this?

@Rahulstark2

Copy link
Copy Markdown
Author

@khaliqgant There wasn’t an original issue attached. I found the bug while testing ops/cargo.sh locally.

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.

2 participants