Gemini CLI PR fixes sandbox: trap-wrapped commands broke per-command permission rules

MauroDruwel · ghdev · 2026-10-13

A PR (#29726) for google-gemini/gemini-cli fixes a bug where per-command rules in sandbox.toml and session permission approvals were never applied on POSIX (Linux/macOS).

Root cause: the shell tool wraps user commands in a subshell with an EXIT trap to track background jobs, but the root filter only skipped shopt and set, so the command name resolved to trap instead of the actual tool — causing configured rules like [commands.gradlew] to miss, and sandboxed runs to fail with read-only filesystem or missing network errors.

The fix centralizes IGNOREDCOMMANDROOTS = {'shopt', 'set', 'trap'} in shell-utils.ts, applies it consistently across Linux/macOS/Windows sandbox managers and command-name resolution, deduplicates helpers, and adds unit tests covering wrapped commands and per-command permissions.

Original post →

More from coding & agent

coding & agent channel →