Repository navigation
fix(storage): 等待 AGFS 复制收尾后再传播取消 - #6178
Merged
Merged
Conversation
Keep caller cleanup behind the physical copy lifetime, including repeated cancellation. Co-authored-by: qin-ctx <qinhaojie.exe@bytedance.com>
qin-ctx
approved these changes
Oct 19, 2026
qin-ctx
added a commit
that referenced
this pull request
Oct 19, 2026
Keep caller cleanup behind the physical copy lifetime, including repeated cancellation. Co-authored-by: qin-ptr <222410531+qin-ptr@users.noreply.github.com> Co-authored-by: qin-ctx <qinhaojie.exe@bytedance.com> (cherry picked from commit dfc22d1)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
补齐 AGFS
cp的取消收尾保护。普通 AGFS 调用已经等待底层 I/O 完成,但复制仍直接等待asyncio.to_thread,取消后可能提前释放外层锁或开始清理。以持有目标路径锁,将
/local/account/source复制到/local/account/file时取消任务为例:CancelledError,调用方开始释放锁或清理,底层复制线程仍可能继续写入。CancelledError,外层锁和清理流程不会先于复制收尾;连续取消也保持这个顺序。Human Involvement
Related Issue
无关联 Issue。
Type of Change
Changes Made
cp复用现有run_to_completion,统一复制线程与协程的收尾顺序。ctx兼容行为。Testing
改写现有测试补充回归覆盖。以下聚焦测试全部通过(27 passed):
python -m pytest tests/agfs/test_async_client.py tests/pyagfs/test_async_client_fs_ctx.py tests/test_task_tracker_concurrency.py -o addopts='' -q回放修复前的
cp实现时,复制取消用例失败,原有 AGFS 与向量用例通过。Ruff 检查、格式检查及git diff --check通过。Checklist
Screenshots (if applicable)
不适用。
Additional Notes
取消不会回滚已经开始的复制;取消响应需要等待当前复制收尾。无新增依赖或 API 参数。
相对
main,生产代码净减 4 行,测试净增 5 行,合计净增 1 行。