Skip to content

fix(acp): bind permission requests to each turn - #404

Open
BunsDev wants to merge 1 commit into
mainfrom
fix/acp-turn-permissions-current-main
Open

BunsDev wants to merge 1 commit into
mainfrom
fix/acp-turn-permissions-current-main

Conversation

@BunsDev

@BunsDev BunsDev commented Oct 18, 2026

Copy link
Copy Markdown
Member

Summary

  • Bind ACP permission requests to the prompt's cancellation token so cancellation releases unanswered approvals and rejects later approvals from that canceled generation.
  • Keep approval available to a background ToolContext after its parent prompt completes.

Context

  • Related user request: Goal 3 manifest position 129 (logical unit 133), ported onto main 87239e7.
  • Scope: ACP permission ownership and query cancellation precedence at the turn limit.
  • Non-goals: nested-agent cancellation, interrupting approved tool execution, concurrent transcript replacement, dispatch bounds, authentication policy, and releases. Merge remains held until v0.9.0 exists.

Changes

  • Replace the shared session queue and prompt-owned drainer with a direct synchronous handler backed by the async ACP round trip. Each handler retains its captured cancellation token; cancellation wins the select before a late request is sent.
  • Use a session-wide permission ID counter so overlapping generations do not reuse query-reset IDs.
  • Preserve current permission payloads, decision mapping, cancellation re-arm, and redacted client/transport diagnostics. Adapt existing diagnostic and request-lifetime fixtures to the new owner.
  • Check query cancellation before max-turn exhaustion so a canceled final tool round reports cancelled.

Validation

Rust commands ran from src-rust/ with serialized Cargo, an isolated Cargo home, and a shared target. Owned regression children clear the environment and use scratch homes.

  • Before production changes, cargo test -p claurst-acp turn_permission_tests --locked: 4 failed, 1 worker ignored. Failures reproduced unanswered approval retention, missing background approval after parent completion, and retained approval wait after cancellation.
  • Handler-only checkpoint, cargo test -p claurst-acp --locked: 51 passed, 1 failed, 1 ignored. The sole failure reproduced refusal instead of cancelled at max_turns=1.
  • Final cargo test -p claurst-acp --locked: 52 passed, 0 failed, 1 isolated worker ignored; doctests passed.
  • Permission title/content/kind helpers compared byte-identical to main; source session-state composition matched. Query diff is only the existing five-line cancellation check relocation.
  • Independent spec and quality review: no blocking findings.
  • git diff --check: passed.
  • cargo fmt --all and cargo fmt --all -- --check: passed.
  • cargo check --workspace --all-targets --locked: passed.
  • cargo clippy --workspace --all-targets --locked -- -D warnings: passed.
  • cargo test --workspace --locked: 2765 passed, 0 failed, 53 ignored across 110 outer suites, counting nested worker results once.
  • N/A: terminal suite, as TUI and input code are unchanged.

Direct denial now uses ToolContext's existing direct-decision error path rather than its queued-decision error text. No wire fields or approval options change.

Limits: background coverage uses a real cloned ToolContext retained by a fixture tool, not an actual AgentTool run. Aborting an async request future is covered; aborting a task inside synchronous block_in_place alone is not a cancellation guarantee. Cancellation can still occur after a wire frame or approved tool has started. Those are separate lifetime boundaries.

PR Readiness

  • Diff is limited to the unit and preserves landed ACP prerequisites.
  • Cargo regenerated the lockfile; only one ACP dev-dependency edge changed.
  • User-facing docs/help are not needed for this permission cancellation correction.
  • No real credentials, captured private data, or unrelated changes are included.
  • Remaining risks and proof limits are listed above.

Release unanswered approvals on session cancellation and deny late requests from canceled generations. Retain direct permission forwarding for background ToolContext owners after their parent prompt completes, preserve redacted diagnostics, and report cancellation before max-turn exhaustion.

Coven-Harness: Codex / GPT-6
@vercel

vercel Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
docs Building Building Preview Oct 18, 2026 2:17pm UTC

Request Review

This branch was successfully deployed

1 active deployment
Preview — 2c9adb36 Deployed Oct 18, 2026 by vercel[bot]
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