fix(resource): preserve lock contention during auto-naming#3201
Open
huangruiteng wants to merge 1 commit into
Open
fix(resource): preserve lock contention during auto-naming#3201huangruiteng wants to merge 1 commit into
huangruiteng wants to merge 1 commit into
Conversation
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.
动机
修复 #3122 在当前 main 上仍存在的误导性错误。Embedding/Semantic circuit breaker 已会等待
retry_after再 requeue,但自动命名会把 101 个候选 URI 的锁竞争全部吞掉,最后统一抛FileExistsError;即使磁盘上没有同名路径,调用方也会误判为文件冲突。异步 understanding 路径还复制了一份相同逻辑。改动思路
保留两种失败语义:
FileExistsError;ResourceBusyError,并给出auto_name_reservation_busyconflict type。异步 understanding 路径不再维护第二份 100 次循环,改为调用
ResourceProcessor.reserve_unique_candidate()。关键代码
复现与验证
结果:18 passed。新增覆盖包括全候选锁竞争、真实路径全部存在、以及跳过已存在名称后成功取得下一候选。Ruff check、compileall、
git diff --check均通过。扩展运行的
resource_processor_mv与resource_service_watch暴露了未初始化 VikingFS/TaskTracker 的既有 fixture 漂移;在未修改的 origin/main 上用相同测试可稳定复现,因此未混入本 runtime PR,已独立记录后续。风险与边界
本改动不改变候选命名顺序、最大尝试次数或锁获取策略,只修正耗尽后的异常分类并去除重复实现。调用方现在会收到结构化 409 conflict,应该按
retryable=true退避重试,而不是创建更多编号副本或检查磁盘重名。