Skip to content

Commit ef660b6

Browse files
Ilanlidoclaude
andcommitted
CM-71014: log the OSError when a read path cannot be stat-ed
The stat guard swallowed OSError silently, so a file read that was skipped because its path could not be reached looked identical to one skipped for being a directory. Log it at debug with the path. Reachable on the older interpreters in the support matrix: Path.is_file() raises PermissionError on 3.9 and 3.11 (verified), while on 3.13+ it delegates to os.path.isfile and swallows the error itself. requires-python is >=3.9 and the Docker image and release builds run 3.9, so the branch is live for those installs and inert for the bundled executable. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 166df32 commit ef660b6

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

cycode/cli/apps/ai_guardrails/ides/copilot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,8 @@ def _read_file_path(tool_name: str, tool_input: object) -> Optional[str]:
326326
try:
327327
if not Path(raw_path).is_file():
328328
return None
329-
except OSError:
329+
except OSError as e:
330+
logger.debug('Failed to stat read path, %s', {'path': raw_path}, exc_info=e)
330331
return None
331332
return raw_path
332333

0 commit comments

Comments
 (0)