Cursor Sandbox seems to prevent the agent from running builds and tests within the project folder. It sets some strange paths to cargo and Rustup that mess-up builds and test e.g.
If I ask the agent to use correct values for these variables things work. Like I have a cursor rule to use commands like “RUSTUP_HOME=/Users/test/.rustup CARGO_HOME=/Users/test/.cargo /Users/test/.cargo/bin/cargo test“. That is a workaround but it takes some token tax on all requests.
Can I configure the agent sandbox to allow cargo commands?
I second this. For some reason Sandbox sometimes cannot even find Rust, so it has to manually run rustup default stable every once in a while. And the sandbox might have a different arch than my macbook or something, because I notice that it has to do nearly a full recompile everytime in the sandbox and/or my local environment if I switch between the two frequently. If I run sandbox twice in a row, no full recompile. If I run local env twice in a row, no full recompile. But if I bounce between the two, semi-full recompile.
Hey, thanks for the report. Handling of sandbox environment variables like CARGO_HOME and RUSTUP_HOME has improved in recent updates, and build cache sharing has also gotten better to avoid full recompiles.
Can you share your Cursor version? (Help > About or cursor --version). If you’re already on the latest version, try removing the Cursor workaround rule and run a clean cargo build in the sandbox. The fix might already cover your case.
Let me know how it goes after updating, if an update is needed.
I’ve also encountered with this problem. I’m on latest Cursor version, have one toolchain installed, yet the agent cannot find an existing toolchain in its /tmp/cursor-sandbox-cache/. Some commands by myself (begin with $) and by the agent (begin with 🔒 $) is attached below.
$ cursor --version
2.4.35
d2bf8ec12017b1049f304ad3a5c8867b117ed830
x64
$ rustup toolchain list
stable-x86_64-unknown-linux-gnu (active, default)
🔒 $ set +e; echo "PATH=$PATH"; echo "HOME=$HOME"; echo "RUSTUP_HOME=$RUSTUP_HOME"; echo "CARGO_HOME=$CARGO_HOME"; echo '---'; which cargo; cargo --version; echo '---'; rustup show
PATH=/home/blealtancao/command-line-tools/bin/:/home/blealtancao/.cursor-server/bin/d2bf8ec12017b1049f304ad3a5c8867b117ed830/bin/remote-cli:/home/blealtancao/.cargo/bin:/home/blealtancao/command-line-tools/bin/:/home/blealtancao/.cursor-server/bin/d2bf8ec12017b1049f304ad3a5c8867b117ed830/bin/remote-cli:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files (x86)/Microsoft/Edge/Application:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files (x86)/NetSarang/Xshell 8/:/mnt/c/Program Files/nodejs/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA App/NvDLISR:/mnt/c/Users/bleal/StrawberryPerl/c/bin:/mnt/c/Users/bleal/StrawberryPerl/perl/site/bin:/mnt/c/Users/bleal/StrawberryPerl/perl/bin:/mnt/c/Users/bleal/.local/bin:/mnt/c/Users/bleal/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/bleal/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/d/Games/PCL2/graalvm-jdk-21.0.6+8.1/bin:/mnt/c/Users/bleal/.deno/bin:/mnt/c/Users/bleal/AppData/Roaming/npm:/mnt/c/Users/bleal/.dotnet/tools:/mnt/c/Program Files/Huawei/DevEco Studio/bin:/mnt/c/Program Files/Huawei/DevEco Studio/sdk/default/openharmony/native/build-tools/cmake/bin/:/mnt/c/Program Files (x86)/GnuWin32/bin/
HOME=/home/blealtancao
RUSTUP_HOME=/tmp/cursor-sandbox-cache/d4f9e222c6f5e0d5bb71a209b3282849/rustup
CARGO_HOME=/tmp/cursor-sandbox-cache/d4f9e222c6f5e0d5bb71a209b3282849/cargo
---
/home/blealtancao/.cargo/bin/cargo
error: rustup could not choose a version of cargo to run, because one wasn't specified explicitly, and no default is configured.
help: run 'rustup default stable' to download the latest stable release of Rust and set it as your default toolchain.
---
Default host: x86_64-unknown-linux-gnu
rustup home: /tmp/cursor-sandbox-cache/d4f9e222c6f5e0d5bb71a209b3282849/rustup
installed toolchains
--------------------
active toolchain
----------------
no active toolchain
Shall we have some more detailed document about the Sandbox? I didn’t expect it to play with language toolchains when reading the document in Terminal | Cursor Docs, and the agent itself can’t find a way out either, without available documentation on how to configure the behavior.