Skip to content

[Feature]: Let ACP clients answer permission requests instead of always selecting the first option #5480

Open

Description

@vibewrk

Is there an existing feature request for this?

  • I have searched existing issues and feature requests, and this is not a duplicate.

Problem or Use Case

ACPAgent answers every session/request_permission from the ACP server by itself: _OpenHandsACPBridge.request_permission returns options[0], and the person using the conversation is never asked (acp_agent.py L1602–L1619 at 08af1d5).

I understand this is deliberate rather than a bug. The docstring says "Auto-approve all permission requests from the ACP server", the ACP guide says permission requests "are automatically granted", and the built-in Claude Code and Codex providers default to permission-skipping session modes. That is the right default for headless runs.

It leaves two gaps for anyone who wants a person in the loop, for example an interactive front end over Claude Code or Codex:

  1. There is no opt-in way to pass a permission request to the user. Choosing an acp_session_mode in which the server asks does not change the outcome, because the bridge answers before anyone sees the request. The comment in acp_providers.py says the same: prompts never block regardless of mode.
  2. The answer is chosen by position, not by kind. Whatever the server lists first is selected, including allow_always or a reject option, and the log line still reads "ACP auto-approving permission".

Versions: openhands-sdk 1.49.1 (measured September 21), 1.49.6 and 1.51.0 (re-run October 3), and main at 08af1d5 (read; the function is unchanged).

Reproduction. Inert: it calls the handler directly, so no ACP server, model, network call or tool execution is involved.

# repro_acp_permission.py
import asyncio
from importlib.metadata import version

from acp.schema import PermissionOption, ToolCallUpdate
from openhands.sdk.agent.acp_agent import _OpenHandsACPBridge

CASES = {
    "allow listed first": ["allow_once", "reject_once"],
    "allow-always listed first": ["allow_always", "allow_once", "reject_once"],
    "reject listed first": ["reject_once", "allow_once"],
}


async def main() -> None:
    print("openhands-sdk", version("openhands-sdk"))
    for label, kinds in CASES.items():
        response = await _OpenHandsACPBridge().request_permission(
            session_id="inert-session",
            tool_call=ToolCallUpdate(tool_call_id="inert", title="inert probe"),
            options=[PermissionOption(option_id=k, name=k, kind=k) for k in kinds],
        )
        print(f"{label}: selected {response.outcome.option_id}")


asyncio.run(main())
$ uv run --with openhands-sdk==1.51.0 python repro_acp_permission.py
openhands-sdk 1.51.0
allow listed first: selected allow_once
allow-always listed first: selected allow_always
reject listed first: selected reject_once

The same happens end to end. Through agent-server 1.49.1 and Agent Canvas 1.20.0, a stub ACP server that only sends one permission request (allow-once, then reject-once) and echoes the reply finished with {"outcome":{"optionId":"probe-allow-once","outcome":"selected"}}. Nobody clicked anything, and the conversation's event stream held no confirmation question.

Not measured: real Claude Code or Codex sessions in a non-bypass mode, and the order in which those servers list their options.

Desired Behavior

  1. Small: pick the automatic answer by kind instead of position. Prefer allow_once, then allow_always, and never select a reject option under an "auto-approving" log line.
  2. Larger, opt-in: a setting on ACPAgent (default unchanged) that, when enabled, publishes the pending permission request as an event, moves the conversation to the existing waiting_for_confirmation state, and resolves the ACP request with the option the user picks, or with cancelled on interrupt or timeout.

Headless use keeps today's behaviour in both cases.

Acceptance Criteria

  • With default settings, permission requests are still answered automatically and never block a headless run.
  • The automatic answer is chosen by option kind; a reject option is never auto-selected.
  • With the opt-in enabled, a permission request appears as an event, the conversation waits, and the user's choice is returned to the ACP server as the selected optionId.
  • Interrupting or pausing while a request is pending returns the ACP cancelled outcome.
  • An unknown, stale or repeated answer is rejected and never resolves a different request.

Alternatives Considered

  • Relying on the ACP server's own session mode. It does not help: the bridge answers regardless of mode.
  • Patching the private bridge from outside the SDK. I built a prototype this way against 1.49.1 and Agent Canvas 1.20.0 to check feasibility. Allow and Reject buttons in the UI returned the server's own allow_once and reject_once options, an interrupt returned cancelled, and missing or replayed request IDs were refused. It works, but it depends on private hooks, so it is not something to maintain outside the SDK.

Priority / Severity

Medium - Would improve experience

Estimated Scope

Medium - New feature with moderate complexity (the by-kind selection alone is small)

Feature Area

  • Agent API / Core functionality
  • Agent Server

Technical Implementation Ideas (Optional)

For the opt-in flow, the prototype kept one pending request per ACP session, keyed by a request ID carried on the published event, and resolved it from the existing confirmation endpoint. A maintained version would want a typed request-ID field and a dedicated permission event rather than reusing existing fields, plus defined behaviour for restarts and for overlapping requests.

Additional Context

I am happy to open a small pull request for the by-kind selection if that would be welcome, and to share the prototype notes for the opt-in flow. Thank you for the SDK, and for documenting the current behaviour so clearly.

Investigated and drafted with an AI coding agent; reviewed by me before posting.

Activity

  1. all-hands-bot commented on Oct 3, 2026

    @all-hands-bot
    Collaborator

    The following comments were added by the OpenHands AI agent.

    Decision needed

    Thanks for the detailed write-up. The by-kind auto-selection is well specified and looks ready on its own, but the interactive opt-in flow changes the public SDK and agent-server API surface, and the repository's existing confirmation endpoint (POST /{conversation_id}/events/respond_to_confirmation with ConfirmationResponseRequest{accept, reason}) is accept/reject only — it cannot carry an ACP optionId. Before this can be marked ready for development, I need the following decisions resolved:

    1. Answering contract. Should the client answer a pending request with the ACP optionId directly (a new field on the confirmation/response request), or through a new SDK-level permission-selection model? Should the published request carry a typed request ID distinct from the ACP tool_call_id so a stale or replayed answer can be matched to exactly one request?
    2. Split or single scope. May the by-kind auto-selection land as a standalone first PR, with the interactive opt-in designed separately? If the two must ship together, the whole issue stays blocked on the decisions below.
    3. Lifecycle. While a request is pending, what should interrupt/pause return (cancelled), and what happens on restart/reconnect or an overlapping second permission request in the same ACP session — one pending request at a time, or a queue keyed by request ID?

    Once these are settled I can attach observable acceptance criteria and mark the issue ready.

  2. LeonxLJX commented on Oct 27, 2026

    @LeonxLJX

    I'd like to take this one. The gap is in _OpenHandsACPBridge.request_permission — it unconditionally resolves to options[0], so every ACP permission request is auto-approved and there's no path to surface it to the human mid-run. Plan: add a configurable permission mode (keep auto as the default for headless), and when set to ask, route the request through the in-loop confirmation path instead of picking the first option; cover it with a test asserting the requested option is returned in ask mode. I'll open a draft PR shortly.

  3. LeonxLJX commented on Oct 28, 2026

    @LeonxLJX

    Hey - I've pushed a PR for this issue. The repo's PR description validator requires linked issues to carry the
    eady-for-dev label (and for bug-fix PRs, the �ug label). Could you or a maintainer add $(System.Collections.Hashtable.missing) label(s) to this issue? That would let the PR CI pass the description check. Thanks!

  4. jamesdwilson commented on Nov 27, 2026

    @jamesdwilson

    Thanks for documenting this and working on the opt-in path. We encountered the same limitation while validating human approval for a standalone ACP-backed OpenHands deployment.

    Additional version evidence: on November 26, our installed openhands-sdk reports 1.62.0. Inspection of its _OpenHandsACPBridge.request_permission still shows:

    option_id = options[0].option_id if options else "allow_once"
    return RequestPermissionResponse(
        outcome=AllowedOutcome(outcome="selected", option_id=option_id),
    )

    This callback has no pending-human-decision branch. Its installed source SHA-256 is 0186adb760103c70761b9bf65335b4a7060e387c6b3f4dda73fcb486bdc1d568.

    Our practical integration gap is that configuring the conversation confirmation policy does not add a wait to this ACP callback. We therefore cannot accept this deployment as supporting human-gated ACP permissions yet.

    Evidence boundary: this is installed-source inspection, not a newly reproduced end-to-end permission grant. An earlier AlwaysConfirm audit elicited no permission request, so it proves neither approval waiting nor an unauthorised tool execution. We deliberately did not trigger a sensitive action to manufacture a prompt.

    I found the linked open PR #6265, so this seems better kept here than filed as a duplicate bug. Is that still the intended path for the opt-in approval flow? Thank you!

  5. vibewrk commented on Nov 27, 2026

    @vibewrk
    Author

    @jamesdwilson Thanks for checking 1.62.0. The installed code shows why the conversation's confirmation policy doesn't make the ACP bridge wait for approval — once the opt-in flow lands, that needs a regression test sending an ACP permission request under a policy requiring confirmation.

    On #6265: no maintainer has weighed in yet, so the path isn't settled. As written it adds an in-process bridge callback; agent-server clients still need an API to receive and answer permission requests. I left specifics on the PR.

    Concrete proposals for the triage questions above:

    1. Scope: split. Land the default auto-selection fix first inside _OpenHandsACPBridge.request_permission with no public API change: prefer an offered allow_once, then allow_always (preserving offered order within each kind and returning the offered option_id); if neither is offered (empty or reject-only), return ACP's cancelled outcome instead of options[0] or a literal "allow_once", with unit tests. I'm happy to open that PR if maintainers agree on the split and @LeonxLJX doesn't want to include it in fix(acp): let ACP clients answer permission requests instead of always selecting the first option (#5480) #6265. (This doesn't close the confirmation-policy gap; that needs the opt-in flow below.)
    2. Answering contract (opt-in flow): Use a dedicated typed permission-response model rather than overloading boolean ConfirmationResponseRequest (which would allow contradictory accept=false + allow option_id states). Publish the tool_call context and offered options with a server-generated request_id (distinct from agent-controlled tool_call_id), and resolve once with either an offered option_id or explicit cancellation — rejecting unknown, stale, or replayed IDs. When the conversation policy requires confirmation, wait for a valid response or return cancelled if approval is unavailable.
    3. Lifecycle (opt-in flow): Key pending requests by request_id so overlapping requests in the same ACP session can be answered independently. Interrupt/cancel (session/cancel) and any configured timeout resolve live pending requests as cancelled; pause leaves them pending. On a client reconnect while the bridge is alive, replay live pending requests. On a server/bridge restart, invalidate persisted pending IDs and reject late responses, since the in-flight ACP request is gone.

    Maintainers: would you prefer a separate issue for the by-kind fix, or to track Part 1 here?

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions