Skip to content

Qwen Code executes a tool after cancellation #5016

@N0zoM1z0

Description

@N0zoM1z0

What happened?

After SIGINT/cancellation is delivered during a streaming tool call, Qwen Code still executes tool work from the interrupted response.

The reproduction uses a local deterministic OpenAI-compatible provider endpoint and a fake API key, so it does not require a live Qwen account or external provider request.

What did you expect to happen?

After cancellation, Qwen Code should not execute tool work from the interrupted provider response.

Client information

Client Information

Run qwen to enter the interactive CLI, then run the /about command.

$ qwen /about
Version: Qwen Code 0.17.1
Platform: Linux x86_64 in Docker (`node:24-bookworm`)
Interface: CLI

Login information

API Config / OpenAI-compatible endpoint in the local replay command.

Anything else we need to know?

Standalone reproduction

Prerequisites: Docker, Python 3, and the GitHub CLI (gh) for the clone command below. The linked reproducer is self-contained and uses only Python standard-library modules plus Docker. It builds the affected CLI version from the public upstream package/release source and starts a local mock provider; it does not require this repository or any private fuzzing harness. The Docker run is limited to 2 CPUs and 4 GiB RAM by default.

Complete self-contained reproducer: https://gist.github.com/N0zoM1z0/00868524c2881f06d0f9044025dacea0

The Gist contains qwen-tool-executes-after-cancel.reproduce.py. Download and run:

gh gist clone 00868524c2881f06d0f9044025dacea0 qwen-tool-executes-after-cancel-reproducer
cd qwen-tool-executes-after-cancel-reproducer
python3 qwen-tool-executes-after-cancel.reproduce.py

To reuse an already-built local image:

python3 qwen-tool-executes-after-cancel.reproduce.py --skip-build

Key output from a local run against the affected version:

process_exit=-9
provider_requests=35
tool_result_counts={'edit_cancel_1': 595}
late_stream_events_after_stop=0
side_effect_file_contains qwen-tool-executes-after-cancel.log 'qwen-tool-executes-after-cancel': observed=True
REPRODUCED

Metadata

Metadata

Assignees

No one assigned

    Labels

    category/coreCore engine and logiccategory/toolsTool integration and executionpriority/P1High priority issuescope/interactiveInteractive CLI featuresstatus/in-reviewThis issue is currently in review.type/bugSomething isn't working as expected

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions