diff --git a/src/cleveragents/skills/inline_executor.py b/src/cleveragents/skills/inline_executor.py index b85b69378..b10ce08d2 100644 --- a/src/cleveragents/skills/inline_executor.py +++ b/src/cleveragents/skills/inline_executor.py @@ -263,13 +263,15 @@ class InlineToolExecutor: try: resolved = Path(value).resolve() sandbox_resolved = sandbox_path.resolve() - if not str(resolved).startswith(str(sandbox_resolved)): - return ( - f"Path '{value}' for key '{key}' escapes sandbox " - f"root '{sandbox_path}'" - ) - except (OSError, ValueError): - return f"Invalid path '{value}' for key '{key}'" + except OSError as exc: + return f"Invalid path '{value}' for key '{key}': {exc}" + try: + resolved.relative_to(sandbox_resolved) + except ValueError: + return ( + f"Path '{value}' for key '{key}' escapes sandbox " + f"root '{sandbox_path}'" + ) return None def _run_with_timeout(