Unclear Whether this applies to the sandbox on every platform is not settled.
What
The sandbox is a restricted environment Claude Code can run shell commands in. When Claude Code builds a sandboxed command of the form <bash|sh> -c cmd, it now rewrites it to start bash with -p, a mode in which bash reads no start-up file:
- The command becomes
bash -p -c 'set +p; unset BASH_ENV; unset CDPATH; PS4=...; cmd', soBASH_ENVandCDPATHare removed andPS4is reset before your command runs. - This is skipped, and the command is left as built, if a settings file or
/envsupplies a non-emptyBASH_ENV,SHELLOPTSorBASHOPTS. - An accompanying explanation is given for each case, for example "bash is started under -p, so it takes no start-up file, functions or shell options from variables stored for the sandbox account."
- The shell set-up snippet also gains
NO_EQUALSfor zsh, and is used when both shells match.
Before, the command was passed on exactly as built.
Why
Start-up files, shell functions and shell options stored for the sandbox account, possibly by another project, can no longer leak into a sandboxed command. If you rely on BASH_ENV, SHELLOPTS or BASHOPTS, setting them in settings or /env keeps the old behaviour.
Whether this applies to the sandbox on every platform is not settled.