Skip to content

ACP adapter: unanswered permission request leaks pendingClientRequests entry and is never replied (#4707 audit gap b) #8314

Closed

Description

@dezren39

Filed by the #4707 closing audit of design #4706 (task 12695, lane code-n, 2026-11-10). Evidence at origin/main 9b65fa2, bin/opencode-acp-adapter.mjs.

Gap

pendingClientRequests (:206) holds one entry per outbound session/request_permission (requestClient, :224-232); an entry is deleted only when the ACP client's response arrives (dispatch, response branch). The adapter sets no timeout anywhere on that wait.

If the client never answers:

  • the map entry leaks for the adapter's process lifetime (bounded only by process exit and by the number of unanswered asks — small, but unbounded within a long-lived process), and
  • handlePermissionAsked (:446ff) awaits forever, so the permission reply is never posted to the serve. No evidence in this repo shows the pinned serve expiring an unanswered permission.asked on its own clock, so the serve-side tool call the permission gates stays blocked until the session is interrupted or deleted.

Fix shape (named, not designed here)

Give the client request a bounded wait in the adapter: on expiry, resolve the permission flow through the path handlePermissionAsked already uses for a failed client request — post {decision: "reject"} to POST /api/session/:id/permission/:permId/reply — and delete the pendingClientRequests entry. The timeout value is the implementer's call, recorded on the PR; it should be generous enough for a human approver and finite.

Activity

  1. added
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    on Nov 10, 2026
  2. developing-today commented on Nov 10, 2026

    @developing-today
    Contributor
  3. added
    task/small-fixQueue packet kind: bounded fix with reproduction and targeted tests
    priority/normalOrdinary priority (the default)
    effort/sSmall: expected under 2 hours of work
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    status/triagedTriaged and routed (see agent note)
    on Nov 17, 2026
  4. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up + triaged

  5. added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed on Nov 17, 2026
  6. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · state: in progress (fix in PR #11215)

    • Agent: queue worker (repo-worker-code), lane any-e
    • Session / ID: task 20121
    • Found via: queue claim

    PR #11215 bounds the ACP adapter's permission-request wait: requestClient entries in pendingClientRequests now expire after PERMISSION_REQUEST_TIMEOUT_MS (default 600,000 ms — generous for a human approver, finite so an abandoned ask cannot wedge a gated tool call; OPENCODE_ACP_PERMISSION_TIMEOUT_MS overrides). On expiry the entry is deleted and the request rejects through handlePermissionAsked's existing failed-request path, posting {decision: reject} to the serve reply endpoint. Answered requests are unchanged.

    Verification: node --test bin/opencode-acp-adapter.test.mjs — 23 passed, 0 failed, including a new unanswered-expiry test (reject posted, late answer ignored) and the pre-existing answered round-trip test. PR #11215 closes this issue on merge; the timeout rationale is recorded on the PR as the acceptance requires.

  7. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · state: done (fix merged, issue closed)

    • Agent: queue worker (repo-worker-code), lane any-e
    • Session / ID: task 20121
    • Found via: queue claim

    Task 20121 is done: PR #11215 MERGED (squash 554e1404a902f4bc4836a22ccff0df1fb15efdea, 2026-11-17T10:23:02Z), and this issue was closed by the merge.

    • The ACP adapter's permission-request wait is now bounded (PERMISSION_REQUEST_TIMEOUT_MS, default 600,000 ms, env-overridable; rationale on the PR): an unanswered session/request_permission expires, its pendingClientRequests entry is deleted, and the flow resolves through the existing failed-request path, posting the reject decision to the serve reply endpoint. Answered requests are unchanged.
    • Verification: node --test bin/opencode-acp-adapter.test.mjs — 23 passed, 0 failed (new unanswered-expiry test + pre-existing answered round-trip).
    • Codex gate: Codex quota-failed with zero findings; disposition recorded on PR fix(acp-adapter): bound the permission-request wait (#8314) #11215 (comment 6945287462).
    • Claim labels set by this lane have been removed.

    Task 20121 completes as fixed_merged.

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

Metadata

Metadata

Assignees

Labels

app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)status/triagedTriaged and routed (see agent note)status:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions