Repository navigation
fix(shell): tell the model the shell rules, read git -C correctly, and stop throttling reads - #3909
Conversation
…d stop throttling reads The shell tool refused 342 of 2,001 agent tool calls in a Fireworks benchmark, mostly because nothing told the model the rules: no operators, one command per call, use working_directory instead of cd &&. The tool description now says so, the operator refusal points at working_directory, git's global flags (-C, -c, --git-dir, --work-tree, --no-pager) are skipped before reading the subcommand, and read-only allowlisted commands are exempt from the 3-per-10-seconds burst limit while the per-minute cap stays. Fixes amd#3737
Verdict: Approve with suggestionsThis makes the shell tool explain its own rules, stops Three things to settle before merge:
Worth a thought, not a blocker: the burst exemption doesn't raise the ceiling of 10 commands a minute, so a read-heavy orientation phase now reaches that cap in seconds instead of half a minute, and the refusal it gets carries a much longer wait. Whether that's a net win depends on which of the two windows the benchmark refusals actually came from — worth confirming against the run that motivated the change. Real-world evidenceN/A — no evidence bundle was produced for this PR, and I could not execute the suite here (pytest isn't installed in this review environment), so the verdict rests on static review plus the test plan's own report of 330 passed / 1 skipped. The surface that matters for a tool-description change is 🔍 Technical details🟡 Important1. Tool description contradicts active skill grants ( The docstring presents a closed allowlist ("Only read-only commands run without approval: ls, cat, …") and names 2. Agent eval not run for a tool-docstring change
3. Spec page documents the replaced git logic ( The "Git Command Filtering" block still shows 🟢 Minor4. The
5. "Read-only" is really "allowlisted" (
6. Unattached short-option form gets a confusing refusal
Strengths
|
…refused The shell tool's new rules block read as a closed list, so the model could talk itself out of a `gh` or `pytest` command a loaded skill had just granted it — the description is what it reads every turn, and it beats the skill body on a tie. It now says a skill grant widens the list. The `cd DIR && ...` hint also stopped proposing commands that are themselves refused: `cd /repo && rm x` used to answer with "call again with command='rm x'", buying a second refusal. Also renames the burst-limit exemption from "read-only" to "allowlisted" — ALLOWED_COMMANDS carries `cd` and `sysctl`, which are not reads — and brings docs/spec/shell-tools-mixin.mdx back in line with the code: the git filtering section still showed the `cmd_parts[1]` parse that `_resolve_git_subcommand` replaced, listed `config` as a safe subcommand it never was, and reproduced the pre-rules tool docstring.
|
Verdict: Approve Three distinct bugs are fixed here — One behavior change to be aware of: The No correctness, security, or architecture issues found. 🔍 Technical details
Spec / implementation consistency The spec shows |
|
The PR description now spells out that 🔍 Technical details
|
# Conflicts: # docs/spec/shell-tools-mixin.mdx # src/gaia/agents/tools/shell_tools.py
|
Merged #4049 landed a better version of this PR's headline change: the shell tool now allows What survives is the Suggested next step: retitle/re-describe this as the 🔍 Technical detailsConflicts were 7 regions in Kept:
Dropped as superseded:
One pre-existing bug fixed while trimming: the tests interpolated bare Plain merge commits, no rebase or force-push. |
`git -C/tmp status` is valid git, but the global-option walk matches whole tokens, so it came back as "global option '-C/tmp' is not recognized" — a refusal naming a flag nobody wrote, with nothing to change. It now names the spaced form (`-C /tmp`) when the two-character prefix is a known value-taking flag, and gives the real reason when the prefix is a forbidden one (`-ccore.pager=evil`). A genuinely unknown option still reads as before. The attached form stays refused rather than parsed: the `-C` allowed-paths sandbox runs its own scan over the same tokens, and teaching two parsers to split a token identically is how that sandbox springs a leak.
|
Two of the three follow-up nits were already fixed on the branch; the third is fixed in the commit I just pushed.
The attached form stays refused rather than parsed, deliberately: the 🔍 Technical details
|
Left behind when the callback path was removed; pylint W0611 and flake8 F401 both flag it, which reds the Code Quality gate.
The shell tool refused 17% of the agent's tool calls in a 168-run Fireworks benchmark (342 of 2,001), mostly for reasons the model was never told: no
&&/>/;, one command per call, and a 3-per-10-seconds burst limit that throttled ordinary reads. Each refusal cost a step and a model round trip, and throttled reads were one of the causes of runs the loop guard ended early. The tool description now states the rules, the operator refusal names theworking_directoryfix,git -C <path> statusis read correctly, and read-only commands no longer hit the burst limit. The allowlist and the operator ban are unchanged; this is orthogonal to #3808.git configis refused, including read-only forms likegit config --getandgit config --list. That was already true in the code, but the spec page listedconfigas an allowed git subcommand; the page is now corrected, so anyone who relied on the doc should expect the refusal. The-c,--config-envand--exec-pathglobal options stay refused too, and the refusal now says why instead of treating the option as the git command.Test plan
tests/unit/test_shell_guidance_3737.pyplus existing shell guardrail and skill binary-grant suites: 330 passed, 1 skippedgit -C <allowed> statusallowed,git -C <outside> statusrefusedrate_limitedandwait_time_secondsgaia eval agent— runs in the self-hosted CI job once the branch is pushed to amd/gaia (tool description changes)Fixes #3737