ci(bench): self-heal a bench box that lost rustup from PATH#926
Conversation
The bare-metal bench workflow died at 'Build guest agent' with "rustup: command not found" (exit 127) when the self-hosted box lost the Rust toolchain from PATH, blocking every bare-metal bench (fork-exec, exec-rt, metering, and the CoW density sweep #766/#764). Guard the step: source $HOME/.cargo/env first in case only PATH was lost, and install rustup (minimal stable profile) only when it is genuinely absent. Idempotent, so a healthy box is unchanged and a stripped box self-heals instead of failing the run. Closes #767 Signed-off-by: Jannes Stubbemann <jannes@openclaw.rocks>
📝 WalkthroughWalkthroughThe bare-metal benchmark workflow now restores the Cargo environment and conditionally installs a minimal stable Rust toolchain before adding targets and building the guest agent. ChangesBench workflow Rust setup
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 @.github/workflows/bench.yaml:
- Around line 130-133: Update the Cargo environment sourcing block in the
workflow to run `. "$HOME/.cargo/env"` through a non-fatal guard, allowing
sourcing failures to continue to the existing rustup recovery or installation
path while retaining the file-existence check.
🪄 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: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: f76ba11a-bfc2-41ba-b53d-1a86012878cb
📒 Files selected for processing (1)
.github/workflows/bench.yaml
| if [ -f "$HOME/.cargo/env" ]; then | ||
| # shellcheck disable=SC1091 | ||
| . "$HOME/.cargo/env" | ||
| fi |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n--- bench.yaml excerpt ---\n'
nl -ba .github/workflows/bench.yaml | sed -n '118,150p'
printf '\n--- kvm-test.yaml excerpt ---\n'
nl -ba .github/workflows/kvm-test.yaml | sed -n '118,150p'Repository: mitos-run/mitos
Length of output: 221
🏁 Script executed:
python3 - <<'PY'
from pathlib import Path
for path in [Path('.github/workflows/bench.yaml'), Path('.github/workflows/kvm-test.yaml')]:
print(f"\n--- {path} excerpt ---")
lines = path.read_text().splitlines()
for i in range(117, 151):
if i <= len(lines):
print(f"{i:4d}: {lines[i-1]}")
PYRepository: mitos-run/mitos
Length of output: 4209
🏁 Script executed:
python3 - <<'PY'
from pathlib import Path
for path in [Path('.github/workflows/kvm-test.yaml'), Path('.github/workflows/bench.yaml')]:
text = path.read_text()
for needle in ['.cargo/env', 'rustup', 'source', 'shellcheck disable=SC1091']:
if needle in text:
print(f'\n--- {path} matches {needle!r} ---')
for i, line in enumerate(text.splitlines(), 1):
if needle in line:
print(f'{i:4d}: {line}')
PYRepository: mitos-run/mitos
Length of output: 6771
Make Cargo env sourcing failure-tolerant
set -euo pipefail makes . "$HOME/.cargo/env" abort the step if that file is unreadable or broken, so the rustup recovery path never runs. Wrap the source in a non-fatal guard like the one in .github/workflows/kvm-test.yaml so a stale env file can still fall back to installation.
🤖 Prompt for 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.
In @.github/workflows/bench.yaml around lines 130 - 133, Update the Cargo
environment sourcing block in the workflow to run `. "$HOME/.cargo/env"` through
a non-fatal guard, allowing sourcing failures to continue to the existing rustup
recovery or installation path while retaining the file-existence check.
Thinking Path
Linked Issues or Issue Description
Closes #767.
What Changed
rustup target add, source$HOME/.cargo/envif present, and ifrustupis still not on PATH, install it with the official installer pinned to a minimal stable profile, then source the env. Idempotent.Verification
run: |shell block at matching indentation; the repo's actionlint and shellcheck-install checks validate it in CI.Risks
Low risk. The install runs only when rustup is absent, so a healthy runner is untouched. The workflow is not one of the eight required checks and does not gate other PRs; worst case a network hiccup during install fails the same step that already fails today.
Model Used
Claude Opus 4.8 (claude-opus-4-8), 1M context, extended thinking.
Summary by CodeRabbit