Skip to content

Expose remote run approval policy - #131

Merged
delete-cloud merged 2 commits into
mainfrom
feat/remote-approval-mode
May 11, 2026
Merged

delete-cloud merged 2 commits into
mainfrom
feat/remote-approval-mode

Conversation

@delete-cloud

@delete-cloud delete-cloud commented May 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add --approval auto|interactive|yolo to remote run and remote repl
  • send the selected approval policy when creating remote sessions
  • report non-interactive approval aborts with an actionable error
  • document that --yes only skips workspace overwrite confirmation

Validation

  • uv run pytest tests/cli/test_remote_client.py -q
  • uv run pytest tests/ui/test_http_server.py tests/ui/test_execution_binding.py tests/ui/test_http_server_workspace_transfer.py -q
  • uv run basedpyright src/coding_agent/remote/client.py
  • uv run ruff format src/coding_agent/main.py src/coding_agent/remote/client.py tests/cli/test_remote_client.py
  • git diff --check

Summary by CodeRabbit

Release Notes

  • New Features

    • Added --approval CLI option to remote run and remote repl commands with three configurable modes: auto, interactive, and yolo.
    • Improved error messages for approval failures in non-interactive environments with actionable guidance.
  • Documentation

    • Updated Remote Operations CLI documentation with examples and clarification on approval policy behaviors and --yes flag usage.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 11, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@delete-cloud has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 49 minutes and 33 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d1c4cf5b-5398-47d1-9441-96bd060bb2f9

📥 Commits

Reviewing files that changed from the base of the PR and between f5f477e and 562a97c.

📒 Files selected for processing (4)
  • coding-agent/src/coding_agent/__main__.py
  • coding-agent/src/coding_agent/remote/approval.py
  • coding-agent/src/coding_agent/remote/client.py
  • coding-agent/tests/cli/test_remote_client.py
📝 Walkthrough

Walkthrough

The PR adds CLI-configurable remote tool approval policy (auto, interactive, yolo) to remote repl and remote run commands. The approval setting flows through the workflow helper to session creation, is validated and sent in the API request, and approval prompting now provides actionable error guidance for non-interactive environments.

Changes

Remote Approval Policy Configuration

Layer / File(s) Summary
CLI Approval Choices Constant
coding-agent/src/coding_agent/__main__.py
REMOTE_APPROVAL_CHOICES click choice type is defined for auto, interactive, yolo values.
Remote Commands with Approval Option
coding-agent/src/coding_agent/__main__.py
--approval option (defaulting to auto) is added to remote repl and remote run commands, binding to approval_policy parameter in handlers.
Workflow Helper Forwards Approval Policy
coding-agent/src/coding_agent/__main__.py
_remote_run_once accepts approval_policy and forwards it to create_remote_session.
Session Creation Validates and Sends Approval Policy
coding-agent/src/coding_agent/remote/client.py
create_remote_session accepts approval_policy (default "auto"), validates against allowed choices, and includes it in the /sessions POST payload instead of hardcoding.
Approval Prompting Helper and Error Handling
coding-agent/src/coding_agent/remote/client.py
_approval_prompt helper wraps click.prompt and converts click.Abort to ClickException with guidance to rerun with --approval yolo or provide stdin input. _prompt_for_approval uses the helper and handles reject-with-reason with a named prompt.
Tests for Approval Policy Configuration
coding-agent/tests/cli/test_remote_client.py
test_remote_run_sends_configured_approval_policy verifies the POST request includes configured approval_policy. test_remote_approval_abort_reports_actionable_noninteractive_error confirms non-interactive approval raises actionable ClickException.
Documentation Updates
coding-agent/docs/remote-sandbox-production.md
remote run instructions now explicitly show --approval yolo --yes example and explain how each approval mode affects tool-call approvals; non-interactive automation guidance clarifies stdin input or --approval yolo requirement.

Sequence Diagram

sequenceDiagram
  participant CLI as remote run
  participant Handler as remote_run handler
  participant Workflow as _remote_run_once
  participant Session as create_remote_session
  participant API as /sessions endpoint
  CLI->>Handler: --approval yolo
  Handler->>Workflow: approval_policy="yolo"
  Workflow->>Session: approval_policy="yolo"
  Session->>Session: validate("yolo" in choices)
  Session->>API: POST {approval_policy: "yolo"}
  API-->>Session: session created
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A rabbit hops through approval gates,
With yolo, auto, interactive states—
From CLI flag to session request,
Non-interactive errors now confess the rest,
Approval flows smooth, no ambiguity waits! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Expose remote run approval policy' directly and clearly describes the main change: adding a --approval option to configure approval policy for remote run commands.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/remote-approval-mode

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 and usage tips.

@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: 2

🧹 Nitpick comments (1)
coding-agent/src/coding_agent/remote/client.py (1)

127-130: ⚡ Quick win

Centralize approval-policy literals to prevent drift

{"auto", "interactive", "yolo"} is now defined here and separately in CLI option choices. Consider using a single shared constant/module so validation and CLI parsing can’t diverge later.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@coding-agent/src/coding_agent/remote/client.py` around lines 127 - 130, The
approval-policy literals are duplicated; create a single exported constant
(e.g., APPROVAL_POLICIES = {"auto","interactive","yolo"}) in a shared module and
import it into this file, then replace the inline set used in the
approval_policy check with that constant (the validation in the function taking
approval_policy: str should use APPROVAL_POLICIES), and update the CLI option
choices to reference the same constant so validation and CLI parsing cannot
diverge.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@coding-agent/src/coding_agent/__main__.py`:
- Around line 529-536: You added a new CLI flag (--approval mapped to
approval_policy using REMOTE_APPROVAL_CHOICES) in coding_agent.__main__ which
changes entrypoint behavior; run the entire tests/cli/ test suite (not just
test_remote_client.py) locally or in CI to ensure no regressions, address any
failing tests (e.g., update tests that expect prior defaults or adjust CLI
parsing in __main__.py, approval_policy handling, or REMOTE_APPROVAL_CHOICES),
and re-run until all tests in tests/cli/ pass before merging.

In `@coding-agent/tests/cli/test_remote_client.py`:
- Around line 1751-1754: The test currently only asserts the message prefix via
pytest.raises(..., match="Remote approval requires input"); update the match to
assert the actionable guidance is present too by using a regex that requires
both the example flag and the input source (e.g. include "--approval yolo" and
"stdin"); locate the pytest.raises call in the test and replace the simple
string match with a regex that ensures the message contains both actionable
parts.

---

Nitpick comments:
In `@coding-agent/src/coding_agent/remote/client.py`:
- Around line 127-130: The approval-policy literals are duplicated; create a
single exported constant (e.g., APPROVAL_POLICIES =
{"auto","interactive","yolo"}) in a shared module and import it into this file,
then replace the inline set used in the approval_policy check with that constant
(the validation in the function taking approval_policy: str should use
APPROVAL_POLICIES), and update the CLI option choices to reference the same
constant so validation and CLI parsing cannot diverge.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d6eaa8e4-03b2-4b06-b3d3-3d2307ad6017

📥 Commits

Reviewing files that changed from the base of the PR and between 62792ea and f5f477e.

📒 Files selected for processing (4)
  • coding-agent/docs/remote-sandbox-production.md
  • coding-agent/src/coding_agent/__main__.py
  • coding-agent/src/coding_agent/remote/client.py
  • coding-agent/tests/cli/test_remote_client.py

Comment thread coding-agent/src/coding_agent/__main__.py
Comment thread coding-agent/tests/cli/test_remote_client.py
@delete-cloud
delete-cloud merged commit 51b18ad into main May 11, 2026
1 check passed
@delete-cloud
delete-cloud deleted the feat/remote-approval-mode branch May 11, 2026 02:03
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