Skip to content

[8329] fix(SDK): Require Bash approval under Ask policy - #8332

Open
prnayyay wants to merge 4 commits into
Agenta-AI:mainfrom
prnayyay:fix/8329-bash-ask-approval-review
Open

prnayyay wants to merge 4 commits into
Agenta-AI:mainfrom
prnayyay:fix/8329-bash-ask-approval-review

Conversation

@prnayyay

Copy link
Copy Markdown

Summary

Under Ask, Claude could run Bash without sending an approval request to the runner. The SDK now writes an explicit Bash ask rule into Claude's settings. Authored Bash allow rules cannot bypass Ask in either Claude settings or the runner plan.

Fixes #8329.

Testing

Verified locally

  • uv run --no-sync pytest oss/tests/pytest/unit/agents/adapters/test_claude_settings.py oss/tests/pytest/unit/agents/test_dtos_harness_configs.py -q — 263 passed.
  • Ruff format check passed for the five changed files.
  • git diff --check passed.

Added or updated tests

  • Added regression tests for Bash under Ask, including an authored Bash allow rule.

QA follow-up

  • Confirm that a live Claude Code agent shows an approval request before running Bash.

Demo

8329-bash-ask-output

Checklist

  • Relevant tests pass locally.
  • Relevant formatting passes locally.
  • I have signed the CLA, or I will sign it when prompted.

Ruff lint still reports findings across these files; I did not include a broad lint cleanup in this fix.

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • When the permission default is set to ask, Bash commands now prompt for approval instead of being allowed by authored Bash permissions.
    • Other authored permissions, such as read access, continue to apply as configured.
    • The ask behavior also applies when no authored permissions are provided.

When the permission default is ask, authored Bash allow rules are excluded from derived permissions, and Claude settings add Bash to the ask rules. Tests cover permission derivation and the rendered settings.

Changes: Bash Ask Permissions

Layer / File(s) Summary
Permission rule derivation and wiring
sdks/python/agenta/sdk/agents/permission_rules.py, sdks/python/agenta/sdk/agents/dtos.py, sdks/python/oss/tests/pytest/unit/agents/test_dtos_harness_configs.py
The rule helper recognizes Bash patterns and omits authored Bash allow rules when the default is ask. The harness template passes the selected default to the helper. Tests cover Pi and Claude configurations.
Claude settings rendering
sdks/python/agenta/sdk/agents/adapters/claude_settings.py, sdks/python/oss/tests/pytest/unit/agents/adapters/test_claude_settings.py
When the default is ask, Claude settings add Bash to ask rules and exclude authored Bash allow rules. Tests cover the rendered rules and the unset-tool case.

Estimated code review effort: 2 (Simple) | ~10 minutes

Severity of issue fixed: Medium

Possibly related PRs

Merge Risk: Minimal · up to a44d8

Under the Ask policy, Bash now requires approval and authored Bash allow rules no longer bypass it. The tests that were run cover the changed behavior. Confirm with a live Claude Code approval check before relying on it in production.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: Bash under the Ask policy now requires approval. It also follows the conventional commit style and references the issue number. The changeset adds a Bash ask rule to C…
Description check Passed The description states the problem, the fix (an explicit Bash ask rule in Claude settings, and authored Bash allow rules no longer bypass Ask), the tests run, and a QA follow-up. These match the raw s…
Linked Issues check Passed Issue #8329 requires that a Bash call under the Ask policy request approval, as a Write call does. The reviewed head implements this in two places. (1) In sdks/python/agenta/sdk/agents/adapters/claude…
Out of Scope Changes check Passed All reviewed changes address the Bash-under-Ask objective of #8329. The changes are in the Claude settings adapter, the shared permission-rule helper, the DTO wiring that passes permission_default, an…
Full details: Title check

Explanation

The title names the main change: Bash under the Ask policy now requires approval. It also follows the conventional commit style and references the issue number. The changeset adds a Bash ask rule to Claude settings and drops authored Bash allow rules under Ask, which matches the title.

Full details: Description check

Explanation

The description states the problem, the fix (an explicit Bash ask rule in Claude settings, and authored Bash allow rules no longer bypass Ask), the tests run, and a QA follow-up. These match the raw summary's changes to claude_settings.py, permission_rules.py, dtos.py, and the test files.

Full details: Linked Issues check

Explanation

Issue #8329 requires that a Bash call under the Ask policy request approval, as a Write call does. The reviewed head implements this in two places. (1) In sdks/python/agenta/sdk/agents/adapters/claude_settings.py, when permission_default is "ask", authored Bash allow rules are removed through is_bash_rule before the merge, so Claude settings do not allow Bash. The raw summary states that "Bash" is added to the merged ask rules. The visible portion of the file at head supports the removal logic, but the ask-rule addition lies past the read truncation. (2) In sdks/python/agenta/sdk/agents/permission_rules.py, wire_author_permission_rules(slice_, permission_default) omits authored Bash allow rules when permission_default is "ask". The file at head confirms this logic. dtos.py passes permission_default through, per the summary. Tests in test_claude_settings.py and test_dtos_harness_configs.py cover the Ask behavior, including an authored Bash allow rule. The issue's permissions-screen clause applies only when Bash is excluded from Ask on purpose. This PR keeps Bash under Ask, so that clause does not apply. The live Claude Code approval check is a non-coding QA follow-up and is excluded from this assessment. Limits: the text diff could not be read because changed blobs were missing, so the verdict relies on head file reads and the supplied summary.

Full details: Out of Scope Changes check

Explanation

All reviewed changes address the Bash-under-Ask objective of #8329. The changes are in the Claude settings adapter, the shared permission-rule helper, the DTO wiring that passes permission_default, and tests for these paths. The helper change adds is_bash_rule and an optional permission_default parameter with default "allow_reads", so behavior is unchanged for other defaults. The commit that added and then reverted a demo-settings documentation change nets to no change. No unrelated behavior change was identified. Limits: the full diff could not be read, so this rests on the supplied summary and the head file reads.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Agenta-AI/agenta
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 8d6f0df
  • Layers: Repository YAML (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a573fe75-149f-45e4-b4fa-f27e5586b64c
Commits

Reviewing files that changed from the base of the PR and between 8d6f0df and a44d86e.

Files selected for processing: 5

  • sdks/python/agenta/sdk/agents/adapters/claude_settings.py
  • sdks/python/agenta/sdk/agents/dtos.py
  • sdks/python/agenta/sdk/agents/permission_rules.py
  • sdks/python/oss/tests/pytest/unit/agents/adapters/test_claude_settings.py
  • sdks/python/oss/tests/pytest/unit/agents/test_dtos_harness_configs.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

This branch has not been deployed

No deployments
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.

(bug) Bash runs without approval when the tool policy is Ask

1 participant