Skip to content

fix(tui): Python runners and CLI setup get honest confirmation badges - #4542

Merged
kovtcharov-amd merged 1 commit into
amd:mainfrom
kovtcharov:kalin/tui-risk-unbounded
Oct 1, 2026
Merged

kovtcharov-amd merged 1 commit into
amd:mainfrom
kovtcharov:kalin/tui-risk-unbounded

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Asking the flagship for a region total from a CSV raised a red DESTRUCTIVE prompt that said a read-only pandas groupby "may not be reversible". Six tools the agent gates (run_python, execute_python_file, wait_for_condition, install_cli, sign_in_cli and notify_desktop) were missing from the TUI's risk table, so they fell to the cautious default. A warning that is false on safe calls teaches people to approve without reading.

Code runners keep the cautious tier but now say what's true: Python code can read, change, or delete anything you can — check the code above before approving. CLI setup and desktop notifications are Write. A new test fails whenever a tool in TOOLS_REQUIRING_CONFIRMATION has no tier. It caught notify_desktop, which wasn't in the original bug report.

Test plan

  • go test ./internal/ui/components/
  • pytest tests/unit/agents/test_confirmation_required_tools.py
  • Live in the TUI with local Qwen3-30B: "Use run_python to print the sum of 2 and 2" shows the new wording, and approving it prints 4.

Overlap with #4461: that PR moves risk to a per-call risk field from the agent and adds a RUNS CODE tier for the two Python tools, which is better for those two. This PR is the small fix that ships now. Its coverage test and the install_cli, sign_in_cli, notify_desktop and wait_for_condition tiers still apply after #4461. Whichever merges second should take #4461's RiskExecute for the Python tools.

A read-only pandas groupby run through run_python was badged DESTRUCTIVE and
told it 'may not be reversible': run_python, execute_python_file,
wait_for_condition, install_cli, sign_in_cli and notify_desktop were gated by
the agent but missing from the TUI's risk table, so they fell to the cautious
default. Code runners now say what is true - code can do anything, check it -
and a test fails when a gated tool has no tier.
@github-actions github-actions Bot added tests Test changes tui Go terminal UI (gaia-tui) labels Oct 1, 2026
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Verdict: Approve with suggestions

This stops the terminal UI from telling people a read-only Python calculation "may not be reversible", gives the six missing tools a proper risk level, and adds a test that fails the next time a gated tool is left out. It's a small, well-tested fix and safe to merge.

One wording problem: for running a Python file, the new warning says "check the code above", but the prompt only shows the file path, not the file's contents. The user is told to check something they can't see. Give that tool its own wording, e.g. "check the script before approving".

Real-world evidence

N/A — no evidence bundle was produced for this run. The PR description reports a live TUI check (local Qwen3-30B: run_python showed the new wording and approving it printed 4). Apart from that, this verdict rests on static review of the TUI change.

🔍 Technical details

Issues

🟡 "Check the code above" doesn't fit execute_python_file (tui/internal/ui/components/confirmation.go:126). run_python(code=...) puts the code in its arguments, so the prompt can show it. execute_python_file(file_path, args, timeout) only passes a path, so the code isn't on screen. Calling the code "above" sends the user looking for something that isn't there, which is the same false-warning problem this PR fixes. Suggested fix: add a third kind for this tool.

	"execute_python_file": "script",

Then add a case in destructiveWarning:

	case "script":
		return "A Python script can read, change, or delete anything you can — " +
			"check what the file does before approving."

Also update TestDestructiveWarningForCodeRunnersPointsAtTheCode so it expects the new wording for execute_python_file.

🟢 The coverage test parses Go source text (tests/unit/agents/test_confirmation_required_tools.py:131). split("\n}", 1) relies on the map's closing brace being the first } at the start of a line. That holds today, and if the layout changes the test fails loudly rather than passing by mistake, so it's acceptable. A one-line note in confirmation.go that this test reads the map would warn the next person who edits it.

Strengths

  • The coverage test closes the real gap: it found notify_desktop, which wasn't in the bug report, and it will catch the next tool added to TOOLS_REQUIRING_CONFIRMATION without a tier.
  • Changing unboundedRiskActions from map[string]bool to map[string]string is safe. The only reader is destructiveWarning, and a missing key still falls through to the default text.
  • wait_for_condition correctly gets the shell-command wording, since it runs the same allowlisted shell command.

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Oct 1, 2026
Merged via the queue into amd:main with commit 15a2c9b Oct 1, 2026
44 of 47 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the kalin/tui-risk-unbounded branch October 1, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Test changes tui Go terminal UI (gaia-tui)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants