Skip to content

Stop leaves a turn non-terminal in Pi and leaves pending Claude approvals behind #16845

Description

@Adamulek123

Problem

Stop does not reliably bring a turn to a terminal state, in two adapters.

  • PiAdapterV2.ts:2474-2512 interruptTurn — a plain Stop returns after abort / terminate with nothing observing terminalization. PiAdapterV2.ts:13 itself states agent_settled is the only terminal signal, so if Pi never sends it the turn stays open indefinitely.
  • ClaudeAdapterV2.ts:3021, 7565 pendingRuntimeRequests — populated at 6633 / 6667 / 6734 / 6770, but only ever removed by a response. If a native approval request is in flight when the turn fails, the entry is never cleared, so the thread reports pending work that will never resolve.

Routing

#15778's body already deferred this class explicitly: "Native approval survival after interrupt and thread unload remains a maintainer lifecycle decision." #15308 reserves the same decision. So the routing exists — what is needed is the decision, then the code.

Related

#15298 ("Stop ends a run whose turn its adapter already settled") addresses the other half: Stop emitting a second terminal for a turn the adapter already settled. That is disjoint from this issue and does not need to land first.

Note that the terminal-on-close work in #16181 closes the session-close path for all four adapters, but it does not address Stop, and #15760 deliberately does not preserve native approvals across a session change (it closes the cross-thread leak instead). #15308 remains the authority on whether approvals should survive.

Impact

The user sees a turn that will not finish and cannot be finished — Stop appears to do nothing.

Environment

Found by static audit of the merged orchestrator-v2 work (#2829). Re-verified present at main. Not filed as a PR because it needs the maintainer decision above first.

Activity

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