Skip to content

fix(agent): make Auto Mode auto-approve edits and shell commands#2970

Merged
charlesvien merged 1 commit into
mainfrom
posthog-code/auto-mode-hands-off-approval
Jul 6, 2026
Merged

fix(agent): make Auto Mode auto-approve edits and shell commands#2970
charlesvien merged 1 commit into
mainfrom
posthog-code/auto-mode-hands-off-approval

Conversation

@posthog

@posthog posthog Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Problem

A customer reported PostHog Code "asking for lots of permissions allow this and that even when I have auto mode on." Auto Mode is labelled "Use a model classifier to approve/deny permission prompts", implying hands-off approval, but its allow-set (AUTO_ALLOWED_TOOLS.auto) only contained the base read/search/web/agent tools. Bash, BashOutput, KillShell, Edit, Write, and NotebookEdit fell through canUseTool to a manual prompt on every call, so users had to babysit each edit and shell command despite the mode promising the opposite.

Why: The mode's behavior didn't match what it advertises, which read as broken and drove a frustrated paying-customer ticket. (The broader complaints in that ticket — delays, errors, chat not starting — are upstream LLM-gateway capacity degradation and not fixable in this repo.)

Changes

  • Add WRITE_TOOLS and BASH_TOOLS to the auto allow-set so Auto Mode auto-approves file edits and shell commands hands-off. MCP tools stay gated separately (do_not_use denied, needs_approval still prompts), so auto remains narrower than bypassPermissions.
  • Correct the misleading "model classifier" description to "Auto-approve file edits and shell commands" in both the agent and core mode definitions, since the host's canUseTool arbiter can't re-defer to the SDK classifier for these tools.

How did you test this?

  • Added parameterised unit tests in permission-handlers.test.ts verifying Auto Mode auto-allows Bash/BashOutput/KillShell/Edit/Write/NotebookEdit without prompting, and that Default Mode still prompts for them.
  • vitest run on the touched test files (permission-handlers: 25 passed, execution-mode: 2 passed).
  • pnpm --filter @posthog/agent typecheck clean; biome lint clean on changed files.

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code from an inbox report.

Auto Mode advertised hands-off, classifier-based approval but its
allow-set (`AUTO_ALLOWED_TOOLS.auto`) only contained the base
read/search/web/agent tools. Bash, BashOutput, KillShell, Edit, Write,
and NotebookEdit fell through `canUseTool` to a manual permission
prompt on every call, so users on Auto Mode were still asked to approve
each edit and command.

Add WRITE_TOOLS and BASH_TOOLS to the auto allow-set so the mode runs
hands-off as advertised. MCP tools stay gated separately (do_not_use is
denied, needs_approval still prompts), so auto remains narrower than
bypassPermissions. The "model classifier" wording in the mode
description is also corrected to describe the actual behavior, since the
SDK's canUseTool arbiter can't re-defer to the classifier for these
tools.

Generated-By: PostHog Code
Task-Id: 0add1c68-e7b5-4ef4-9221-508ff13108e0
@github-actions

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 041eeee.

@charlesvien charlesvien marked this pull request as ready for review June 30, 2026 06:39
@charlesvien charlesvien merged commit 678215f into main Jul 6, 2026
24 checks passed
@charlesvien charlesvien deleted the posthog-code/auto-mode-hands-off-approval branch July 6, 2026 22:05
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.

1 participant