Fix sandbox env var loading

This commit is contained in:
Christine Betts
2026-04-01 13:57:59 -04:00
parent dcf5afafda
commit 60d40f3d4e
5 changed files with 153 additions and 27 deletions
+23
View File
@@ -227,6 +227,29 @@ export SANDBOX_FLAGS="--flag1 --flag2=value"
$env:SANDBOX_FLAGS="--flag1 --flag2=value"
```
### Route custom environment variables
Use the `SANDBOX_ENV` environment variable to explicitly route custom
environment variables into the sandbox. This is a comma-separated list of
`KEY=VALUE` pairs.
**macOS/Linux**
```bash
export SANDBOX_ENV="MY_VAR=hello,ANOTHER_VAR=world"
gemini -p "echo \$MY_VAR \$ANOTHER_VAR"
```
**Windows (PowerShell)**
```powershell
$env:SANDBOX_ENV="MY_VAR=hello,ANOTHER_VAR=world"
gemini -p "echo %MY_VAR% %ANOTHER_VAR%"
```
Environment variables listed in `SANDBOX_ENV` are also available to tools run by
the agent.
## Linux UID/GID handling
The sandbox automatically handles user permissions on Linux. Override these