gemini-cli icon indicating copy to clipboard operation
gemini-cli copied to clipboard

Command substitution block should be user-configurable, not a hardcoded wall

Open N1kky-wed opened this issue 6 months ago • 35 comments

What would you like to be added?

A allowCommandSubstitution toggle in settings.json (defaulting to false) that lets users opt out of the hardcoded command substitution block. In YOLO mode, this should either default to true or surface a warning instead of a silent block so the model can adapt its approach.

Why is this needed?

The current hardcoded block creates two problems:

  1. Token/turn waste — the model writes out a full command with $() substitution, the CLI blocks it at execution time, and the entire turn is wasted with nothing to show for it. The model has no way to know in advance the command will be blocked.

  2. YOLO mode contradiction — in YOLO mode the user has explicitly opted into "run everything without asking me." Silently blocking an entire command class undercuts that contract without any warning.

A configurable toggle keeps the safe default for everyone while letting users who understand the risk opt out.

Additional context

Reproduction: run any agentic task that requires command substitution (e.g. security triage, process inspection) in YOLO mode. The model generates a valid command, the CLI blocks it silently, the turn is lost, and the tokens still count against the user's quota — making this a compounding cost with no output to show for it.

N1kky-wed avatar May 23 '26 10:05 N1kky-wed

Found possible duplicate issues:

  • #6436

If you believe this is not a duplicate, please remove the status/possible-duplicate label.

gemini-cli[bot] avatar May 23 '26 10:05 gemini-cli[bot]

#6436 raised the same pain point but was closed without implementation. This issue proposes a concrete approach: a allowCommandSubstitution toggle in settings.json defaulting to false, rather than just overriding in YOLO mode. The scope is broader — YOLO mode is one part of it, but the configurable toggle gives all users control regardless of approval mode.

N1kky-wed avatar May 23 '26 10:05 N1kky-wed

What would you like to be added?

A allowCommandSubstitution toggle in settings.json (defaulting to false) that lets users opt out of the hardcoded command substitution block. In YOLO mode, this should either default to true or surface a warning instead of a silent block so the model can adapt its approach.

Why is this needed?

The current hardcoded block creates two problems:

  1. Token/turn waste — the model writes out a full command with $() substitution, the CLI blocks it at execution time, and the entire turn is wasted with nothing to show for it. The model has no way to know in advance the command will be blocked.
  2. YOLO mode contradiction — in YOLO mode the user has explicitly opted into "run everything without asking me." Silently blocking an entire command class undercuts that contract without any warning.

A configurable toggle keeps the safe default for everyone while letting users who understand the risk opt out.

Additional context

Reproduction: run any agentic task that requires command substitution (e.g. security triage, process inspection) in YOLO mode. The model generates a valid command, the CLI blocks it silently, the turn is lost, and the tokens still count against the user's quota — making this a compounding cost with no output to show for it.

I cannot reproduce the problem.

tuapuikia avatar May 23 '26 11:05 tuapuikia

I cannot reproduce the problem.

Image

N1kky-wed avatar May 23 '26 12:05 N1kky-wed

/assign

N1kky-wed avatar May 23 '26 12:05 N1kky-wed

@gemini-cli-robot "Assign Issue on Comment: All jobs have failed"

N1kky-wed avatar May 23 '26 12:05 N1kky-wed

/assign

manohar-munna avatar May 23 '26 12:05 manohar-munna

👋 @manohar-munna, you've been assigned to this issue! Thank you for taking the time to contribute. Make sure to check out our contributing guidelines.

gemini-cli[bot] avatar May 23 '26 12:05 gemini-cli[bot]

This seems like a good place for a policy knob with a safe default and an audit trail. Users who need stricter protection can keep the block, but teams with known-good workflows should be able to tune it without fighting the whole agent. A simple allow/deny log would make the behavior easier to trust.

Keesan12 avatar May 25 '26 02:05 Keesan12

/assign

mehul-q avatar May 28 '26 16:05 mehul-q

@mehul-q Thanks for taking interest but this issue is already assigned. We'd still love to have you contribute. Check out our Help Wanted list for issues where we need some extra attention.

gemini-cli[bot] avatar May 28 '26 16:05 gemini-cli[bot]

assign

anshkumar2108 avatar Jun 05 '26 10:06 anshkumar2108

/assign

CodeItAlone avatar Jun 09 '26 11:06 CodeItAlone

@CodeItAlone Thanks for taking interest but this issue is already assigned. We'd still love to have you contribute. Check out our Help Wanted list for issues where we need some extra attention.

gemini-cli[bot] avatar Jun 09 '26 11:06 gemini-cli[bot]

/assign

ChampionNinja avatar Jul 13 '26 18:07 ChampionNinja

@ChampionNinja Thanks for taking interest but this issue is already assigned. We'd still love to have you contribute. Check out our Help Wanted list for issues where we need some extra attention.

gemini-cli[bot] avatar Jul 13 '26 18:07 gemini-cli[bot]

The current behavior is truly surprising. The harness displays the command it is about to execute and requests permission, yet when I respond with "yes," it denies the request. If the answer is "no" regardless of my input, why bother asking?

This whole process feels like security theater, especially since the model immediately rewrites the command in Python and prompts me again after triggering the "Blocked: command substitution detected in shell command" error.

While I understand that commands containing such substitutions might warrant caution under security policies, the system should honor the user’s "yes." The same applies to "yolo" mode; if I explicitly tell the system to run it, it should do so.

zbynekwinkler avatar Aug 14 '26 14:08 zbynekwinkler

/assign

jeelsoni01 avatar Aug 20 '26 16:08 jeelsoni01

@jeelsoni01 Thanks for taking interest but this issue is already assigned. We'd still love to have you contribute. Check out our Help Wanted list for issues where we need some extra attention.

gemini-cli[bot] avatar Aug 20 '26 16:08 gemini-cli[bot]

/assign

jeelsoni01 avatar Sep 23 '26 09:09 jeelsoni01