From b01d11d3f373d7d70b2934b5ff63c9b0eb3186ff Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Sat, 26 Sep 2026 18:23:22 +0530 Subject: [PATCH] fix(file-tools): count bad_size probe as an existing remote binary _probe_regular_file returns "bad_size" only after `[ -f ]` succeeded and `wc -c` output was unparseable, so a regular file IS present on the execution target. Treat it as "exists" (the precise existing-binary refusal) instead of the generic "unavailable" retry message; both refuse, but the retry hint is wrong for a file that is known to exist. Mirrors how the other _probe_regular_file callers treat bad_size. Idea and the original report/Docker reproduction come from #122663, the first submitted fix for this bug. Fixes #122662 Co-authored-by: liuzikaii <2319582736@qq.com> --- tools/file_tools_write_guards.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/file_tools_write_guards.py b/tools/file_tools_write_guards.py index 5cc1442a09..0b0d0d3aa4 100644 --- a/tools/file_tools_write_guards.py +++ b/tools/file_tools_write_guards.py @@ -468,7 +468,8 @@ def _target_regular_file_state(filepath: str, task_id: str = "default") -> str: _size, status = file_ops._probe_regular_file(file_ops._expand_path(resolved or filepath)) except Exception: return "unavailable" - if status == "ok": + if status in ("ok", "bad_size"): + # bad_size: ``[ -f ]`` succeeded, only ``wc`` was unparseable. return "exists" if status in ("missing", "not_regular"): # not_regular: no REGULAR file at the path (dir/FIFO/dangling link) —