cx-r9ffsp: acpmux translate Claude control cancellations

Merged
TE
11d ago
+87-21

Fixes #24562. Builds on the hub handler merged in #24809.

Claude Code can withdraw a question it asked: an MCP server's form (an elicitation) or a permission prompt. It sends {type: "control_cancel_request", request_id} when the turn is interrupted or the asking tool call ends.

Translate the withdrawal to ACP $/cancel_request using the original request id, for permissions and elicitation forms. Clear the control, input, suggestion, and elicitation maps only when cancellation wins ownership of that id. If an answer already claimed it, preserve the answer's remaining input and permission rules. Unknown and already answered ids remain no-ops.

Risk: cancellation racing with an answer on direct children. Tests cover withdrawal first, answer first, and the payload handoff between those steps.

Verification:

  • Hosted red-before 40506288889: the two new cancellation expectations fail against the original translator.
  • Hosted race red-before 40508269055: losing cancellation deletes the winning answer's payload before the ownership fix.
  • Hosted green 40508387610: 16 elicitation tests passed and clippy passed with warnings denied; exact source tree 6a3455e33619a1c4b5077d10f18ef8bd6a637c3d.
  • The code-identical rebase dd1ffa984bd1406be3ec39ce8c4168581d6da8c2 includes the landed hub handler; combined hosted run 40510217677 passed 31 focused translator, permission, adoption, and direct-child tests plus clippy at that exact head (tree 35245710cd1c908d24ae2a2f502ab3487bd44150). Independent Codex Astra xhigh review through acpmux: SHIP, including the landed handler and durable generation-isolated recovery.
  • Base warnings remain in the state-root and release-notary guards. Required checks are satisfied; non-required cross-platform CLI builds were still running at landing.

Agent session: agent session