Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/test-chroot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ jobs:

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable

Copilot AI Feb 13, 2026

Copy link

Choose a reason for hiding this comment

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

This workflow pins most third-party actions to an immutable commit SHA, but dtolnay/rust-toolchain@stable is a moving ref. Since this step was modified, consider pinning it to a specific commit SHA as well to reduce supply-chain risk and improve CI reproducibility.

Suggested change
uses: dtolnay/rust-toolchain@stable
uses: dtolnay/rust-toolchain@f6f061c2c41cabfcbb40f19f8fa82a651c01a19b # stable as of 2025-02-13

Copilot uses AI. Check for mistakes.
with:
toolchain: stable

- name: Setup Java
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v4
Expand Down Expand Up @@ -186,6 +188,12 @@ jobs:
echo "Captured CARGO_HOME: ${CARGO_HOME}"
fi

# Rust: RUSTUP_HOME is needed so rustc can find the toolchain
if [ -n "$RUSTUP_HOME" ]; then
echo "RUSTUP_HOME=${RUSTUP_HOME}" >> $GITHUB_ENV
echo "Captured RUSTUP_HOME: ${RUSTUP_HOME}"
fi

# Java: JAVA_HOME is needed so entrypoint can add $JAVA_HOME/bin to PATH
# The setup-java action sets JAVA_HOME but sudo may not preserve it
if [ -n "$JAVA_HOME" ]; then
Expand All @@ -210,11 +218,14 @@ jobs:
echo "GOROOT: $GOROOT"
echo "Ruby: $(ruby --version)"
echo "Gem: $(gem --version)"
echo "Bundler: $(bundle --version 2>&1 || echo 'Not installed')"
echo "Rust: $(rustc --version)"
echo "Cargo: $(cargo --version)"
echo "CARGO_HOME: $CARGO_HOME"
echo "RUSTUP_HOME: $RUSTUP_HOME"
echo "Java: $(java --version 2>&1 | head -1)"
echo "JAVA_HOME: $JAVA_HOME"
echo "Maven: $(mvn --version 2>&1 | head -1 || echo 'Not installed')"
echo "dotnet: $(dotnet --version 2>&1)"
echo "DOTNET_ROOT: $DOTNET_ROOT"

Expand Down
5 changes: 5 additions & 0 deletions containers/agent/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,11 @@ AWFEOF
echo "[entrypoint] Adding CARGO_HOME/bin to PATH: ${AWF_CARGO_HOME}/bin"
echo "export PATH=\"${AWF_CARGO_HOME}/bin:\$PATH\"" >> "/host${SCRIPT_FILE}"
echo "export CARGO_HOME=\"${AWF_CARGO_HOME}\"" >> "/host${SCRIPT_FILE}"
# Also set RUSTUP_HOME if provided (needed for rustc to find toolchain)
if [ -n "${AWF_RUSTUP_HOME}" ]; then
echo "[entrypoint] Setting RUSTUP_HOME: ${AWF_RUSTUP_HOME}"
echo "export RUSTUP_HOME=\"${AWF_RUSTUP_HOME}\"" >> "/host${SCRIPT_FILE}"
fi
Comment on lines +295 to +299

Copilot AI Feb 13, 2026

Copy link

Choose a reason for hiding this comment

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

AWF_RUSTUP_HOME is only written into the generated chroot script when AWF_CARGO_HOME is set. If a caller provides RUSTUP_HOME without CARGO_HOME, the toolchain path won’t be propagated and rustc can still fail. Consider exporting RUSTUP_HOME whenever AWF_RUSTUP_HOME is non-empty (independent of the AWF_CARGO_HOME branch).

See below for a potential fix:

    else
      # Fallback: detect Cargo from default location if CARGO_HOME not provided
      # This ensures Rust binaries work even when CARGO_HOME env var is not set
      echo "# Add Cargo bin for Rust if it exists (fallback when CARGO_HOME not provided)" >> "/host${SCRIPT_FILE}"
      echo "[ -d \"\$HOME/.cargo/bin\" ] && export PATH=\"\$HOME/.cargo/bin:\$PATH\"" >> "/host${SCRIPT_FILE}"
    fi
    # Also set RUSTUP_HOME if provided (needed for rustc to find toolchain)
    if [ -n "${AWF_RUSTUP_HOME}" ]; then
      echo "[entrypoint] Setting RUSTUP_HOME: ${AWF_RUSTUP_HOME}"
      echo "export RUSTUP_HOME=\"${AWF_RUSTUP_HOME}\"" >> "/host${SCRIPT_FILE}"
    fi

Copilot uses AI. Check for mistakes.
else
# Fallback: detect Cargo from default location if CARGO_HOME not provided
# This ensures Rust binaries work even when CARGO_HOME env var is not set
Expand Down
4 changes: 4 additions & 0 deletions src/docker-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,10 @@ export function generateDockerCompose(
if (process.env.CARGO_HOME) {
environment.AWF_CARGO_HOME = process.env.CARGO_HOME;
}
// Rust: Pass RUSTUP_HOME so rustc/cargo can find the toolchain
if (process.env.RUSTUP_HOME) {
environment.AWF_RUSTUP_HOME = process.env.RUSTUP_HOME;
}
Comment on lines +361 to +364

Copilot AI Feb 13, 2026

Copy link

Choose a reason for hiding this comment

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

New behavior adds propagation of RUSTUP_HOME into the agent container environment, but the existing generateDockerCompose unit test that validates tool env passthrough doesn’t cover this variable. Please extend the relevant test in src/docker-manager.test.ts to set process.env.RUSTUP_HOME and assert environment.AWF_RUSTUP_HOME.

Copilot uses AI. Check for mistakes.
// Java: Pass JAVA_HOME so entrypoint can add $JAVA_HOME/bin to PATH and set JAVA_HOME
if (process.env.JAVA_HOME) {
environment.AWF_JAVA_HOME = process.env.JAVA_HOME;
Expand Down
Loading