Skip to content

[fix] Say that the approval checkbox auto-approves - #6308

Open
ashrafchowdury wants to merge 3 commits into
mainfrom
fix/approval-auto-approve-copy
Open

[fix] Say that the approval checkbox auto-approves#6308
ashrafchowdury wants to merge 3 commits into
mainfrom
fix/approval-auto-approve-copy

Conversation

@ashrafchowdury

@ashrafchowdury ashrafchowdury commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Context

The grant checkbox on the approval card read "Don't ask again for this". That describes the prompt going away, not what happens instead, so a cautious reader could take it as the tool being skipped rather than run.

Ticking the box and approving writes that tool's permission to allow in the agent's draft config. The tool then runs with no prompt, on this run and on every future one. The label never said so.

Changes

The label now reads "Always auto-approve", and it stays on the same line as Deny and Approve.

Before:  [ ] Don't ask again for this
After:   [ ] Always auto-approve

The confirmation banner in the config pane follows the same wording. "Always allowing bash / Saved to this draft, this tool won't ask again" becomes "Auto-approving bash / Saved to this draft, it runs without asking from now on".

Two fixes in the same row:

The checkbox had no accessible name. Radix renders it as a <button role="checkbox">, and a wrapping <label> gives it no name, so a screen reader announced an unlabelled checkbox. It now points at the label text with aria-labelledby.

The action row wraps instead of squeezing. With NEXT_PUBLIC_AGENT_CHAT_STEER on, the extra Redirect button next to the longer label overflowed a 375px screen and pushed Approve out of view. The buttons now drop to a second line.

Batched approvals granted only the first tool

"Approve all" answers every pending gate, but the grant wrote only approvals[0].toolName. A batch spanning several tools left the rest to stop the next run, with nothing on screen to say so.

The card now collects every grantable tool in the batch and grants them together. Ineligible members are skipped rather than blocking the rest, so a commit_revision mixed into a batch stays gated while the shell and file tools beside it are granted.

They have to land as one write. Every withToolPermission and withHarnessToolAllow call returns a whole new parameters object, so calling the single-tool path once per tool would build each flip on the same stale base and keep only the last one. foldPermissions threads each result into the next call and returns a single config. The draft-change signal carries the full list, so the config pane's Undo reverts all of them.

Why some gates still never offer the checkbox

Worth stating, because "auto-approve" invites the question of why it is not offered everywhere. gateRulePattern refuses three classes, for two different reasons, and this PR does not change either.

Platform ops (commit_revision, test_run, schedules, subscriptions) are excluded by design. runner.permissions.default stays as authored specifically so these keep gating, and the code describes commit_revision and destructive ops as gated by construction. commit_revision publishes a revision that triggers then run on their own, so it is the one action that escapes the session you are watching.

MCP tools are excluded for a mechanical reason. wire_author_permission_rules drops mcp__ patterns from the runner plan, so a rule written for one would silently never take effect. MCP is governed per server instead.

Client tools (request_connection, request_input) are excluded because they exist to ask the user for something. There is nothing to auto-approve.

Tests

  • vitest in @agenta/chat, 14 tests across the card and the new fold. The card tests cover granting a whole batch and granting nothing on a denial. foldPermissions has its own tests for the stale-base trap, for skipping ineligible names, and for reversing a batch.
  • One new test pins that a click on the label toggles the box exactly once. A <button> is a labelable element, so the label already forwards the click natively; the test guards against someone adding a manual handler that double toggles it.
  • Checked in the browser at 375px and at desktop width, single gate and batched, with the Redirect control both off (the default) and on.

What to QA

  • Run an agent until it stops on a tool gate (a shell or file tool, not a commit). The card shows a checkbox reading "Always auto-approve" inline with Deny and Approve, the same shape as before.
  • Tick it and press Approve. The config pane shows an "Auto-approving <tool>" banner with Undo, and the same tool does not ask again later in the run.
  • Press Deny with the box ticked. Nothing is granted, and the tool asks again next time.
  • Get two or more gates pending at once for different tools. Tick the box and press "Approve all". Both tools are granted, the banner reads "Auto-approving 2 tools", and neither asks again later in the run.
  • Press Undo on that banner. Both tools go back to asking.
  • Regression: reach a commit_revision gate. The checkbox is absent, as it was before.
  • Regression on /m at phone width. The row still fits on one line and Approve is fully visible.

ashrafchowdury and others added 2 commits August 27, 2026 01:12
… it stops asking

"Don't ask again for this" described the prompt going away, leaving what
happens instead unstated — a user could reasonably read it as the tool being
skipped. It now says "Auto-approve this tool from now on", with a line naming
both halves: the agent runs the tool without asking, on this run and every
future one. The checkbox moved to its own row, since two lines of explicit copy
would collide with the buttons at 375px. The config pane's confirmation banner
follows the same wording.

Two defects fixed alongside: the checkbox had no accessible name, so a screen
reader announced a bare checkbox; and the wording carried a pointer cursor while
only the 16px box was hittable, which is rough on touch. The wrapping label
already forwards a click to Radix's button — a test pins that, so nobody adds a
handler that double-toggles it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The two-line version pushed the checkbox onto its own row and made the card
taller than it was before. "Always auto-approve" carries the same meaning in
two words and sits inline with Deny/Approve again, as it did originally. The row
now wraps instead of squeezing, so turning Redirect on cannot shove Approve off
a 375px screen.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Aug 27, 2026
@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview Aug 27, 2026 7:11am

Request Review

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Approval prompts can now auto-approve or revoke multiple tools at once.
    • “Approve all” applies eligible selections across the full approval batch.
    • Undo can revert all tools affected by a batch change.
  • UI Improvements

    • Updated approval wording to “Auto-approving” and “Always auto-approve.”
    • Approval controls wrap properly on narrow screens.
    • Checkbox labels reliably toggle auto-approve settings.

Walkthrough

The approval flow now supports granting and revoking multiple tools at once. The approval card derives eligible tools from the full batch, while the notice undoes all affected tools. Copy, accessibility labeling, responsive layout, and tests were updated.

Changes

Batch auto-approve

Layer / File(s) Summary
Batch permission operations
web/packages/agenta-chat/src/hooks/useAlwaysAllowTool.ts, web/packages/agenta-shared/src/state/draftConfigChangeSignal.ts, web/packages/agenta-chat/tests/unit/hooks/foldPermissions.test.ts
foldPermissions applies deduplicated grants or revocations across tool entries and harness rules. The hook exposes grantMany and revokeMany. Draft-change signals carry toolNames. Tests cover batch, duplicate, skipped, and empty cases.
Approval card batch integration
web/packages/agenta-chat/src/components/ApprovalCard.tsx, web/packages/agenta-chat/tests/unit/ApprovalCard.test.tsx
The card grants every eligible tool in the approval batch. The checkbox uses an associated label, and the action controls wrap on narrow screens. Tests cover batch approval and denial.
Batch notice undo
web/oss/src/components/Playground/Components/AlwaysAllowedNotice.tsx
The notice uses revokeMany for undo and pluralizes the subtitle for multiple tools.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: 🔵 Low · up to de850

The PR improves approval wording, accessibility, responsive layout, and batched permission handling. It is mergeable with owner awareness that seven new comments should be condensed to the repository’s one-line comment standard.

Sequence Diagram(s)

sequenceDiagram
  participant ApprovalCard
  participant useAlwaysAllowTool
  participant foldPermissions
  participant AlwaysAllowedNotice
  ApprovalCard->>useAlwaysAllowTool: grantMany(grantableTools)
  useAlwaysAllowTool->>foldPermissions: apply batch permissions
  foldPermissions-->>useAlwaysAllowTool: applied tool names
  useAlwaysAllowTool-->>AlwaysAllowedNotice: draft-change signal with toolNames
  AlwaysAllowedNotice->>useAlwaysAllowTool: revokeMany(toolNames) on Undo
  useAlwaysAllowTool->>foldPermissions: revoke batch permissions
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 60.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 6 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately describes the primary user-facing change: the approval checkbox now communicates that it auto-approves the tool.
Description check ✅ Passed The description is directly related to the changeset and explains the label update, accessibility fix, responsive layout, batched approvals, undo behavior, and testing coverage.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/approval-auto-approve-copy

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: c46267e1-665d-4ef1-a800-bfd4e3f37003

📥 Commits

Reviewing files that changed from the base of the PR and between e24609c and e0810ff.

📒 Files selected for processing (3)
  • web/oss/src/components/Playground/Components/AlwaysAllowedNotice.tsx
  • web/packages/agenta-chat/src/components/ApprovalCard.tsx
  • web/packages/agenta-chat/tests/unit/ApprovalCard.test.tsx

Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review.

Comment thread web/packages/agenta-chat/src/components/ApprovalCard.tsx
@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Preview URL https://gateway-pr-6308.up.railway.app/w
Project agenta-oss-clone-spike
Image tag pr-6308-2ea8752
Status Deployed
Railway logs Open logs
Workflow logs View workflow run
Updated at 2026-08-27T07:22:17.926Z

Approve all answers every pending gate, but the grant only wrote the first
gate's tool, so a batch spanning several tools left the rest to stop the next
run. The card now collects every grantable tool in the batch and grants them
together.

They have to land as ONE write. Each withToolPermission/withHarnessToolAllow
call returns a whole new parameters object, so calling the single-tool path per
tool would build each one on the same stale base and keep only the last.
foldPermissions threads the result of each flip into the next and returns a
single config, and the draft-change signal now carries the full list so the
config pane's Undo reverts all of them.

Ineligible members are skipped, not blocked: a commit_revision mixed into the
batch stays gated while the shell and file tools beside it are granted.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Aug 27, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 61cfb37f-d15d-47f0-9091-0da0aa4e733e

📥 Commits

Reviewing files that changed from the base of the PR and between e0810ff and de850d2.

📒 Files selected for processing (6)
  • web/oss/src/components/Playground/Components/AlwaysAllowedNotice.tsx
  • web/packages/agenta-chat/src/components/ApprovalCard.tsx
  • web/packages/agenta-chat/src/hooks/useAlwaysAllowTool.ts
  • web/packages/agenta-chat/tests/unit/ApprovalCard.test.tsx
  • web/packages/agenta-chat/tests/unit/hooks/foldPermissions.test.ts
  • web/packages/agenta-shared/src/state/draftConfigChangeSignal.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 3 remain after this review.

Comment thread web/packages/agenta-chat/src/hooks/useAlwaysAllowTool.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend size:L This PR changes 100-499 lines, ignoring generated files. ux

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant