agy print mode on Windows: allowed gh command is denied intermittently Summary

Summary

In print mode on Windows, agy soft-denies a command that matches an allow rule. The same command, rules and folder give different results from run to run: 2 allowed, 13 denied. The same version and rules pass every time on macOS.

Environment

  • Windows 10 Home 10.0.19045, shell reported by agy: powershell (Windows PowerShell 5.1)
  • agy 1.3.3 (language server 1.3.3), toolPermission=request-review
  • GitHub CLI 2.102.0, on the system PATH as gh.exe

Steps to reproduce

  1. %USERPROFILE%\.gemini\antigravity-cli\settings.json contains:

    "permissions": { "allow": ["command(gh)", "command(git)", "command(cat)", "command(grep)",
    

    "command(ls)", "command(find)", "command(git apply)"] }

    The folder is under a trustedWorkspaces entry. The startup log confirms the rules load: CLI settings initialized: permissions=&{Allow:[command(gh) command(git) ...] Deny:[] Ask:[]}

  2. Run, several times:

    agy --print-timeout 3m --print "Run exactly this shell command and print only its output, nothing else: gh api user --jq .login"
    

Expected

gh api user --jq .login runs every time, as it does on macOS.

Actual

Most runs print: jetski: no output produced — a tool required the "command" permission that headless mode cannot prompt for, so it was auto-denied. and the log shows Print mode: soft-denying tool confirmation "RunCommand" at step 2. Exit code is 0.

Configuration Runs Allowed Denied
Rules in settings.json only (same as macOS) 4 0 4
command(gh), command(git) also added to userSettings.globalPermissionGrants.allow in %USERPROFILE%\.gemini\config\config.json (log: stored shared config permissions: allow=3) 11 2 9

Adding the rules to config.json made no reliable difference. git --version was denied in all 3 runs, in both configurations.

Identical tool-call records, different outcome

From the conversation databases (conversations\<id>.db), same Cwd in both:

Allowed (23:27:14):

{"CommandLine":"gh api user --jq .login","Cwd":"<same folder>","IsDaemon":false,"WaitMsBeforeAsync":5000,"toolAction":"Running gh command","toolSummary":"Run gh api user"}

Denied (23:25:31):

{"CommandLine":"gh api user --jq .login","Cwd":"<same folder>","IsDaemon":false,"WaitMsBeforeAsync":5000,"toolAction":"Running gh command","toolSummary":"Run gh api user"}

The command is a bare gh ..., not gh.exe and not wrapped in powershell or cmd. No other permission-related string differs between the two databases except the denial message.

Log lines present on both Windows and macOS

W declarative_config_loader.go:280] skipping component during resolution: empty component: pre-tool hook "command_assessor" is empty

W declarative_config_loader.go:280] skipping component during resolution: empty component: post-tool hook "command_assessor" is empty

macOS comparison

agy 1.3.3 with the same seven rules in settings.json, no config.json, and the same toolPermission=request-review: the same command is allowed on every run.

Hi @Harel_Shuker,

To allow gh and git commands with arguments in print mode on Windows PowerShell, try either option: Alternatively, pass --dangerously-skip-permissions to agy --print or set "toolPermission": "always-proceed" in %USERPROFILE%\.gemini\antigravity-cli\settings.json.

If the command is still denied after updating settings.json, reply here with the updated permissions block.

I can’t speak to gh specifically, but in case it helps narrow this down: on agy 1.4.7 (Windows 11, PowerShell 7, print mode) an exact allow rule ran the command every time I tried it, both as a grant in the config and under permissions.allow in settings.json. That was only 3 runs, with command(python <full path to a script>), so it doesn’t rule out the intermittent case. Since this report is from 1.3.3, it may be worth retesting on 1.4.7.

That side-by-side comparison of the SQLite conversation records is super helpful. Seeing 2 runs pass and 13 fail with the exact same CommandLine and Cwd really narrows this down.

The smoking gun in your logs is that declarative_config_loader.go:280 warning (pre-tool hook "command_assessor" is empty). On Windows with PowerShell 5.1, when the built-in command_assessor fails to initialize in time or bails out while parsing arguments like --jq .login, toolPermission=request-review falls back to asking for confirmation, which --print mode immediately auto-denies.

If you want gh and git to pass every single time in headless --print mode without turning on --dangerously-skip-permissions for everything else, you can drop a tiny PreToolUse hook into .agents/hooks.json that explicitly returns {"decision": "allow"} for your safe CLI prefixes:

{
  "headless-safe-cli": {
    "PreToolUse": [
      {
        "matcher": "run_command",
        "hooks": [
          {
            "type": "command",
            "command": "python .agents/scripts/allow_safe_cli.py",
            "timeout": 5
          }
        ]
      }
    ]
  }
}

Where .agents/scripts/allow_safe_cli.py reads the stdin JSON payload, checks if toolCall.args.CommandLine starts with gh or git , and prints {"decision": "allow"} (or {} for everything else). Because an explicit "decision": "allow" from a PreToolUse hook overrides the fallback confirmation prompt, your headless agy --print runs won’t get soft-denied on Windows anymore.

this has been reviewed by, approved by and submitted on behalf of j…@gmail.com