Skip to content

fix(agents): a Full access desktop chat is told how to approve a gated command - #5555

Closed
kovtcharov wants to merge 1 commit into
amd:mainfrom
kovtcharov:kalin/full-access-shell-refusal-wording
Closed

kovtcharov wants to merge 1 commit into
amd:mainfrom
kovtcharov:kalin/full-access-shell-refusal-wording

Conversation

@kovtcharov

Copy link
Copy Markdown
Contributor

In a desktop chat set to Full access, asking GAIA to delete a file failed with "needs your approval … or turn on full access", although Full access was already on, and replying "yes, run it" didn't help. The refusal pointed at a switch that was already on and left no way forward. It now says Full access in this chat doesn't cover commands like this one and to switch the chat to Ask, where GAIA asks and the command can run.

Test plan

  • pytest tests/unit/test_shell_prompt_instead_of_refuse.py: 50 passed; the new Full access desktop-chat case fails on main
  • pytest tests/unit -k "shell or permission or confirm or approval": 2150 passed
  • python util/lint.py --black --isort
  • Eval on the next RC: gaia_tool_selection and error_recovery (the refusal text the model reads changed)
🔍 Technical details
  • Over the sidecar's HTTP transport, PermissionState(lifts_shell_gates=False) applies Full access as auto_approve_gated_tools + grants_paths, never full_access (feat(shell): let --bypass-permissions lift the shell operator block #3373). A gated command therefore hits _blanket_approval_refusal. The new branch fires only when grants_paths and answers_confirmations are both set, which is a person watching a Full access chat; an unattended GAIA_AUTO_APPROVE_TOOLS run keeps its old wording.
  • Not changed here: in that mode the command is refused rather than asked about. Prompting instead needs the confirmation gate to know which shell calls are gated, so that Full access keeps running safe commands without asking. That is a separate design change.
  • Found live while verifying fix(ui): show a relayed agent's file changes in Outputs, Changes and Undo #5553 (relayed delete in Full access).

…ommand

In an Agent UI chat set to Full access, a gated shell command such as a
delete was refused with "turn on full access", which was already on. Over
the agent sidecar's socket Full access keeps the shell gates on (amd#3373), so
the refusal now says so and points to Ask mode, where the command gets a
real approval prompt.
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Approve

In a desktop chat already set to Full access, the refusal for a gated command (like deleting a file) told the user to "turn on full access", which was already on. Now it tells them to switch the chat to Ask, which is the mode where GAIA actually asks before running the command. The new wording only shows when someone is watching a Full access desktop chat. Unattended auto-approve runs keep the old text, and the TUI's Full access never reaches this message because it lifts the shell gates.

Real-world evidence

N/A: no evidence bundle was produced for this run. Only the refusal text the agent reads changes, so this verdict rests on static review plus the author's unit-test results. The author has already listed gaia_tool_selection and error_recovery for the next RC eval.

🔍 Technical details

Issues

🟢 The code comment carries an issue number (src/gaia/agents/tools/shell_tools.py:2979-2980). CLAUDE.md asks for one-line WHY comments without task or issue references. Optional:

        # The sidecar socket keeps shell gates on under Full access, so don't
        # point the user at a switch that's already on.

Checked, no action needed

  • The new branch can't misfire in the TUI. _approval_is_blanket_only returns False when console.full_access is true (stdio sets it when lifts_shell_gates=True), so _blanket_approval_refusal is never called there.
  • The Ask advice is accurate. Ask leaves auto_approve_gated_tools false, so the gate prompts instead of refusing.
  • The condition matches the agent-side check at agents/base/agent.py:3105-3106 (answers_confirmations and grants_paths), so "watched Full access chat" has one definition in both places.

Strengths

  • The new test sets up exactly the handler state PermissionState(lifts_shell_gates=False) applies. It checks both the new wording and that the old "turn on full access" text is gone, and confirms nothing was staged.
  • It fails closed: the command is still refused and only the explanation changes. The PR body says plainly that prompting in this mode is a separate design change.

@kovtcharov

Copy link
Copy Markdown
Contributor Author

Superseded by #5562: a Full access desktop chat now asks before a gated shell command instead of refusing it, so the reworded refusal here is no longer needed.

@kovtcharov kovtcharov closed this Oct 22, 2026
kovtcharov-amd added a commit to kovtcharov/gaia that referenced this pull request Oct 23, 2026
…p chat (amd#5562)

Before: a desktop (Agent UI) chat set to Full access couldn't run a
delete, `git add`, or any other command that needs approval. GAIA
refused it and told the user to turn on Full access, which was already
on. After: GAIA shows the normal approval prompt for that command (Allow
once / Deny, plus "always" where it's offered) and runs it only if the
user allows. Commands that never need approval still run without asking,
and a command that needs approval still never runs unasked through the
desktop app's agent connection.

This replaces amd#5555, which only reworded the refusal. That case now gets
a prompt, so amd#5555 can be closed.

## Test plan

- [ ] `pytest tests/unit/test_shell_prompt_instead_of_refuse.py
tests/unit/test_relay_tool_confirmation.py` passes. New cases cover: a
Full access chat asks about a gated command and runs it only after
Allow; Deny means it doesn't run; a one-time line is asked once; a safe
command runs unasked; an unwatched run, `GAIA_AUTO_APPROVE_TOOLS`, and a
direct tool call all still refuse without prompting; the model can't
pass the marker itself; the live sidecar relays the prompt to the Agent
UI and acts on its answer.
- [ ] `pytest tests/unit -k "shell or permission or confirm or approval
or relay" -n 4`: the same 3 Windows-only failures fail on `origin/main`
too (`cat`/compound-line tests).
- [ ] Manual: in the Agent UI with the flagship running as a sidecar,
set a chat to Full access and ask it to delete a scratch file. A prompt
appears. Deny leaves the file; Allow deletes it. `git status` still runs
with no prompt.
- [ ] Eval categories to watch on the next RC: `gaia_tool_selection`,
`error_recovery`.

<details>
<summary>🔍 Technical details</summary>

- Over HTTP, Full access sets `auto_approve_gated_tools=True` with
`full_access=False`, so the shell gates stay on (amd#3373). The shell
pre-flight used to refuse every gated call when the only approval on
hand was blanket.
- Now, when the console says a person can answer
(`answers_confirmations` and `grants_paths` are True, `full_access` is
False, it isn't in background mode, the `GAIA_AUTO_APPROVE_TOOLS` env
var isn't set, and the handler declares `asks_past_preapproval`), the
pre-flight records the call. `confirmation_args_for_call` adds the
reserved `NEEDS_PERSON_ARG`.
- `SSEOutputHandler.confirm_tool_execution` removes the marker before
anything is emitted. For a marked call it skips auto-approve, which is
the same pattern as the existing `widens_scope` exception, and it denies
when `answers_confirmations` is False.
- On the execution path, a call counts as confirmed only if
`note_confirmed_call` recorded an approval for exactly that `(command,
working_directory)`. A direct tool call, or a call whose approval was
auto-approved, is still refused by `_nothing_could_have_confirmed`.
- `_execute_tool` rejects the marker if the model sends it, and treats a
marked call like a one-time call, so the reroute question can't stand in
for the real prompt. `wait_for_condition` is not marked and still
refuses.
- The sidecar's HTTP routes and schemas don't change, so the OpenAPI
spec doesn't need regenerating. What changes is behaviour: under
`/bypass`, a gated shell call on an answerable run now emits
`needs_confirmation`. `SPEC.md`, `SKILL.md` and `CHANGELOG.md` in
`hub/agents/gaia/npm` describe it.
</details>

Co-authored-by: Kalin Ovtcharov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant