What happened?
write_file and edit can still mutate the filesystem after their invocation has been cancelled. Both tools perform asynchronous preparation and edit-tracking work before the final write. If the abort signal fires while that work is pending, execution continues into the filesystem mutation.
Deterministic reproduction:
- Start a
write_file or edit invocation with an AbortSignal.
- Delay the asynchronous edit-tracking step immediately before the write.
- Abort the signal while that step is pending.
- Resolve the delayed step.
- Observe that the target file is still created or modified.
What did you expect to happen?
Once cancellation is observed before the filesystem mutation begins, the invocation should reject as aborted and leave the target file unchanged.
Client information
Client Information
Qwen Code: 0.21.4
Platform: Windows 11
Node.js: v24.16.0
npm: 11.13.0
Login information
Not login-provider specific; reproduced with deterministic core tool tests.
Anything else we need to know?
The required guard belongs immediately before the first irreversible filesystem mutation, after asynchronous tracking/preparation has completed.
What happened?
write_fileandeditcan still mutate the filesystem after their invocation has been cancelled. Both tools perform asynchronous preparation and edit-tracking work before the final write. If the abort signal fires while that work is pending, execution continues into the filesystem mutation.Deterministic reproduction:
write_fileoreditinvocation with anAbortSignal.What did you expect to happen?
Once cancellation is observed before the filesystem mutation begins, the invocation should reject as aborted and leave the target file unchanged.
Client information
Client Information
Login information
Not login-provider specific; reproduced with deterministic core tool tests.
Anything else we need to know?
The required guard belongs immediately before the first irreversible filesystem mutation, after asynchronous tracking/preparation has completed.