Skip to content

Aborted tool permission/question waits survive cancellation and late approval can write files #601

Closed

Description

@agenteinstinct1-max

Reproduced on integration ef1d83b

An actual SessionPrompt run calls read then edit with edit permission set to ask and no permission timeout. After prompt.cancel returns and the runner ends, the permission remains pending. A stale once reply writes the aborted replacement to disk. Question and MCP permission waits also remain pending on unchanged base.

Mechanism

SessionTools execute callbacks start EffectBridge.promise fibers without the SDK AbortSignal. Cancel interrupts the stream but not the independent tool fiber, so permission/question finalizers and an EditTool file semaphore are not released.

Expected

Interrupt pending tool permission/question waits on session cancellation, reject stale replies, release edit locks and prevent post-abort writes. Preserve the existing Bash contract: stop its process and deliver captured/truncated interrupted output rather than discarding it.

Verification scope

Real prompt/SDK tests cover late edit approval, a fresh same-path edit after abort, question cleanup, MCP permission cleanup and Bash permission cancellation. This is not a claim that every external MCP transport cancels its remote side effects. HTTP routes use the same cancel boundary but are not independently retested in this fix yet.

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