Skip to content

fix(terminal-security): honor Automatic mode for run_terminal_command - #13103

Open
santhiprakash wants to merge 1 commit into
continuedev:mainfrom
santhiprakash:fix/13035-terminal-automatic-mode
Open

fix(terminal-security): honor Automatic mode for run_terminal_command#13103
santhiprakash wants to merge 1 commit into
continuedev:mainfrom
santhiprakash:fix/13035-terminal-automatic-mode

Conversation

@santhiprakash

Copy link
Copy Markdown

Description

Fixes #13035 (also addresses #10512).

Setting run_terminal_command to Automatic previously had little effect: terminal security evaluation demoted Automatic (allowedWithoutPermission) back to Ask First for any command outside a small allowlist (e.g. npm install, msbuild, curl …). Other tools honor Automatic as expected, so this felt like a broken setting.

Maintainer direction on #10512: keep hard failures for critical commands (e.g. rm -rf), and stop re-prompting for everything else when the user chose Automatic.

Problem

  • Input: Tools → Built-in → run_terminal_command = Automatic; agent runs a normal command (npm test, msbuild, etc.)
  • Wrong: IDE still requires manual Accept for nearly every command
  • Expected: Automatic auto-executes non-critical commands; only critical commands stay blocked

Triage / Root cause

evaluateTerminalCommandSecurity in @continuedev/terminal-security starts from the user's base policy, then getMostRestrictive with per-command risk checks. For non-allowlisted commands that evaluation returns allowedWithPermission, which overrode Automatic. Ask First was effectively forced for most agent terminal use.

Fix

  • When base policy is Automatic, only honor tightenings to disabled (critical commands)
  • Do not demote Automatic → Ask First for high/medium/unknown risk
  • Ask First behavior unchanged (still prompts; high-risk classification coverage kept in tests)

Checklist

  • I've read the contributing guide
  • The relevant docs, if any, have been updated or created
  • The relevant tests, if any, have been updated or created

Screen recording or screenshot

N/A — non-visual policy evaluation change; covered by unit/thunk tests.

Tests

  • packages/terminal-security: updated High/Medium risk coverage to assert Ask First still prompts; added Automatic mode honors base policy cases (auto-approve high-risk/unknown; still disable rm -rf / sudo)
  • gui thunk: regression that Automatic run_terminal_command auto-calls tools/call when policy evaluation returns Automatic
  • Local: cd packages/terminal-security && npm test230 passed

Notes / Risks

- Problem: setting run_terminal_command to Automatic still prompted for nearly every command because security evaluation demoted Automatic to Ask First for non-allowlisted commands.
- Fix: when the base policy is Automatic, only hard-disable critical commands; do not re-prompt for other commands. Ask First behavior is unchanged.
- Verification: npm test in packages/terminal-security (230 passed); added GUI thunk regression for Automatic auto-execute.
@santhiprakash
santhiprakash requested a review from a team as a code owner August 8, 2026 23:26
@santhiprakash
santhiprakash requested review from sestinj and removed request for a team August 8, 2026 23:26
@santhiprakash

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

automatic mode is broken for ´run_terminal_command´ tool

1 participant