Repository navigation
docs(plans): a permission model that decides on what a command does - #4050
kovtcharov wants to merge 2 commits into
Conversation
Shell permissions blocked legitimate work nine times in one benchmark campaign, and every fix admitted one more spelling of a command that was always safe. This design replaces text matching with facts: parse the command into the programs it runs, the files it reads, writes and deletes, the code it runs and the network it names; decide on those against a mode and user-written rules; run exactly what was parsed and report what ran and changed in the typed tool outcome. It covers the reach x approval settings and the named presets, the rule format, the decision order, what stays refused, network and the credential floor, a walk-through of the nine cases, the corpus replay test, every place the design widens what runs, and the staged PRs. Design only; no code until the owner signs off.
amd#4071 showed the gap the design has to answer: write_file refused a path outside the allowed folders and the model wrote the same file from a run_python snippet, so whether a refusal holds is currently the model's choice. The new section 3.11 says which writes the facts model decides by construction (file tools, shell redirects, command operands), and what it takes to hold the line for code: the prompt says what a snippet can reach, an audit hook applies the roots to GAIA's own Python execution, and the report names writes nobody predicted. It also says what the hook is not, which is a sandbox.
|
Overturning the "large, so defer" read on this one: +748 lines of prose in two files is not a large PR, it is one plan document plus its nav entry. There is zero code risk here and the docs CI is green. Size is not what is holding it. What is holding it is that you marked it draft and said so yourself: design only, no code until it's signed off, with §6 listing four places the model deliberately lets something run that today prompts or refuses, and §9 listing six decisions for the owner. Those are security-boundary calls — whether reads run unprompted in The diagnosis is worth saying out loud regardless of what you decide: nine blocks in one campaign, each fix admitting one more spelling of a safe command, is a pattern argument that text matching cannot win. Deciding on parsed facts is the right shape. One collision to be aware of before this lands: 🔍 Technical details
Marking ready for review is the unblock, once §9 is answered. Nothing else is in the way. |
|
Verdict: Approve with suggestions This adds a design doc proposing that GAIA parse each shell command into what it actually does (reads, writes, runs code, uses the network), decide on those facts against a user-chosen mode and user rules, and then run exactly what it parsed. It's a design only, with no code. The code it cites exists as described, the page is wired into navigation, and internal links pass. One point to fix before sign-off: the proposed credential floor leaves out the list that stops the agent reading private keys and certificates by file extension ( Real-world evidenceN/A: docs-only change (a design plan plus one 🔍 Technical details🟡 Important 🟡 The credential floor omits (and "three lists" → "four lists" on line 505) 🟢 Minor 🟢 §3.5 doesn't say an allow rule can't cover opaque syntax (line 356). Step 6 allows when "every fact is covered by … an allow rule", and 🟢 🟢 🟢 §6 item 1's fourth guard is about writes, not reads (line 657). " Strengths
|
|
Keeping this open — the problem it describes is still live on I re-checked today: with full access on, The nine-case table got more load-bearing, not less. Seven of the nine still reproduce on Two things need a pass first: The header and §9 item 4 are stale. Both name PRs to merge or close before this one; that queue resolved while this sat — one merged, the rest closed. Rewrite them to today's state, and drop rows 7 and 8 from the table, which are genuinely fixed. The credential floor in §3.10 is one list short. It names three, but the read guard also refuses a category of sensitive files by extension. Since §6 lets reads run unprompted, omitting it widens something §6 doesn't declare — and declaring every widening is §6's whole job. Decisions 1, 2, 3, 5 and 6 are mine; I'll come back with answers. §5 is the best part of this — an adversarial set plus a parser-vs-shell differential means the suite can't pass by allowing everything. 🔍 Technical detailsState. Why the premise still holds. #3394 merged on 2026-09-25 and is what created the developer set. #3995 was stacked on it and on #3808, and its description promised to "replace #3394's developer set with the normal checks" — but #3808 was closed, and what landed in Measured against
Nine-case table, measured today. Rows 7 (#3909) and 8 (#3995) fixed. Row 2 still Staleness. Line 14 "Builds on #3808" — closed; "#4043" — merged. Line 16 "Would replace #4037, #4041, #4042, #4044" — all closed. §9 item 4's triage list resolved. Line 665 describes #3995 as running "anything inside the allowed folders under full access" — narrower than that in practice. §3.10 (line 506) lists Still open: #4071 (§3.11's target). The #3812 collision stands — still open at 214 files, and Separately: |
|
Closing this in favour of #4466, which carries the six open questions as a tracked decision rather than a parked branch. The analysis is the part I want to keep — deciding on what a command does (reads, writes, runs code, reaches the network) instead of what characters it contains is the right frame, and §3.10's recommendation that the credential floor survives full access is the one call in here that already comes with a reason attached. The 1,378-session data behind the effect table is what makes the argument, not the prose. What stopped it is that a page under One thing to fix whenever it comes back: §1 says "Under full access, Nothing is lost. |
… as timeouts (amd#4461) Closes amd#4446 Running a project's tests used to raise a **DESTRUCTIVE** prompt that printed the command twice, wrapped a temp path over three lines, offered only "run once", and — if nobody answered in 10 minutes — told the agent the user had refused. Now the prompt says what the command does (`RUNS CODE`), shows it once relative to the project, offers `y` once · `a` always · `n` deny on shell and Python prompts too, and an expired prompt is reported as a timeout. Shift+Tab cycles ask → accept edits → full access, with the mode on the status bar; full access still turns on only after it has been confirmed once this session (or at launch), and commands GAIA refuses stay refused in every mode but full access. - **`a` covers a command family, not a spelling.** Approving `python -m pytest` also covers `cd proj && pytest 2>&1 | tail`, so one answer ends the stream of prompts in a bugfix turn. Deletes, lines GAIA can't read, and file redirects never get it; interpreter grants say they cover any script. - **Accept edits** lets file edits inside the starting folder run unasked — never `.git/`, a `PATH` folder, or (on Windows) a file that would shadow a real program. - **Docs:** terminal-hub guide, the CLI reference's full-access section plus the TUI flags amd#3140 flagged as undocumented, the stdio contract, and the hub agent's SPEC/SKILL/CHANGELOG. Aligned with amd#4050 on the presets and on full access never being one stray keypress away. Two deliberate differences, since amd#4050 isn't signed off: `a` is offered for inline Python (the issue asks for it on every prompt type; the label says "any inline Python"), and Shift+Tab reaches full access once it is unlocked rather than never. ## Test plan - [ ] `cd tui && go test ./...` — includes frame tests for the new prompt, the Shift+Tab cycle, timeout delivery, and the status bar never clipping `Ctrl+C quit` - [ ] `python -m pytest tests/unit/agents/test_tool_grants.py tests/unit/agents/test_call_risk.py tests/unit/chat/ui/test_confirmation_summary.py tests/unit/test_stdio_permission_control.py hub/agents/gaia/python/tests/test_stdio_wire_contract.py` - [ ] `python util/tui_driver.py gate` → `13/13 as expected` - [ ] In `gaia tui`, ask the flagship to run a project's tests: the prompt reads `RUNS CODE`, shows the command once, and offers `a always: pytest`; after `a`, a differently spelled test run doesn't prompt - [ ] Shift+Tab: status bar shows `⏵⏵ accept edits`; a file edit in the project runs unasked while a shell command still asks; the next Shift+Tab explains full access and lands on ask - [ ] CI re-runs the `gaia_resilience` and `gaia_files` eval categories: the agent now sees different wording after an approval prompt expires on a write <details> <summary>🔍 Technical details</summary> Live drive (flagship agent over stdio, Fireworks `deepseek-v4p1-flash`), same request on a clean `main` build and on this branch. Before: ``` DESTRUCTIVE Confirm: run_shell_command Run 'run_shell_command' with command="python -m pytest -q tests/", working_directory="C:\Users\Kalin\AppData\Local\Temp\claude\C--Users-Kalin-Work-gaia--claude-worktrees-youthful- pike-76967f\0b35cb91-efcd-4a06-814b-4b5da6860f61\scratchpad\proj"? A shell command can read, change, or delete anything you can — check the command above before approving. y run once · n/esc deny · auto-denies in 10 minutes if you do nothing ``` After (keys are filled keycaps; no red text on the prompt — only the `DESTRUCTIVE` badge stays red): ``` RUNS CODE Run this command? python -m pytest -q tests/ mode: ask · shift+tab to change · expires in 10 minutes y once · a always: pytest (this session) · n/esc deny ───────────────────────────────────────────────────────────────────────── ● agent gaia waiting for your answer ↑↓/wheel scroll · answer above · Ctrl+C quit ``` After `a`, `cd <proj> && pytest -q tests/ 2>&1 | tail -5` ran with no prompt (trace: one `needs_confirmation` across both turns). In accept edits, `edit_file` + `write_file` ran unasked and the test run still prompted with `mode: accept edits`. Wire changes (all additive): `needs_confirmation.risk`; `tool_decision` accepts `timeout` (stdio and `POST …/tool_decision`); stdio control verb `accept_edits` and `--accept-edits` for respawn. An older agent treats `timeout` as `deny` and ignores `accept_edits`. Grant safety: a line is granted only when shlex's POSIX (escape on) and Windows (escape off) readings put the operators in the same places, so `pytest \" ; curl x ; \"` gets no grant. Accept edits resolves `file_path`/`project_dir` exactly as `file_io_tools._resolve_target` (parity test). `Agent._policy_refusal` still runs before any grant or mode check. The eval wasn't run: no system prompt, tool schema, or docstring changed. The only model-facing text is the denial reason on a timeout. </details> --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: Kalin Ovtcharov <[email protected]>
Shell permissions blocked legitimate work nine times in one benchmark campaign. Each fix (#4019, #4020, #4037, #4041, #4042, #4044, …) let through one more spelling of a command that had always been safe, so another one was always waiting. In the worst case the agent couldn't copy a project to a scratch folder. It ran the tests on the unpatched code instead and reported "still green". This design replaces text matching with facts. GAIA parses each command into what it does, decides on that against a mode the user picked and rules they wrote, then runs exactly what it parsed and reports what ran. After this, a new command pattern needs at most a config rule or a mode change, never a code change.
Design only. No code until it's signed off. Section 6 lists every place the design lets something run that doesn't today, and section 9 lists six decisions for the owner.
Test plan
python util/check_doc_links.py --internal-onlypasses