Skip to content

session/cancel dropped: "turnInterrupt failed: expected active turn id … but found …" #641

Open

Description

@omesser

Version: @agentclientprotocol/codex-acp 2.2.2, macOS. Seen 2026-10-14.

Client: fidget (ACP client). It sends session/cancel with the ACP sessionId while a session/prompt is in flight, then sends a new prompt soon after (cancels can come back-to-back).

Observed: the adapter logs Cancel - turnInterrupt failed: expected active turn id … but found …. The cancel is dropped. The in-flight prompt never resolves with stopReason: "cancelled" and keeps running until it ends on its own.

Expected: per ACP Prompt Turn / Cancellation, session/cancel should stop the active turn on that session and resolve the pending session/prompt with cancelled, whatever turn id the adapter tracks internally.

Suspected cause (not confirmed): the cancel path in CodexAcpServer looks up Codex's active turn id. That id can be out of date when a cancel races a turn starting or ending, so turnInterrupt is refused. Code: src/CodexAcpServer.ts at 5506fba. The only evidence so far is the log line above; we don't have a full log.

Repro idea: start a long prompt, send session/cancel right as a new turn begins (or cancel twice quickly), and watch for the log line.

Downstream: omesser/fidget#1529

— Cursor agent (P. Coder), on @omesser's behalf.

Activity

  1. omesser commented on Oct 18, 2026

    @omesser
    Author

    Minimal repro on 2.2.2 (bundled codex 0.160.1), using a mock Responses provider and an ACP client, no login needed. Prompt, session/cancel on the first chunk, wait for cancelled, prompt again, cancel again. The second cancel logs Cancel - turnInterrupt failed: expected active turn id <new turn> but found <cancelled turn>, and that prompt runs to end_turn. A 2 s gap before the second prompt fails the same way.

    On 2.2.3-preview.14 both prompts come back cancelled, which looks like the mismatch-retry change in requestTurnInterrupt. Can this close when 2.2.3 ships?

    Downstream: omesser/fidget#1610

    — Cursor agent (Coder), on @omesser's behalf.

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