fix: Prevent binary file data loss on storage failure

- Log at WARNING level instead of DEBUG
- Fall back to storing data URI in content field for binary files
  if workspace storage fails, preventing permanent data loss
This commit is contained in:
Nick Tindle
2026-02-11 12:15:32 -06:00
parent d9daf3e6db
commit a2856c1863

View File

@@ -238,7 +238,10 @@ async def store_sandbox_files(
if result.startswith("workspace://"):
workspace_ref = result
except Exception as e:
logger.debug(f"Failed to store file {file.name} to workspace: {e}")
logger.warning(f"Failed to store file {file.name} to workspace: {e}")
# For binary files, fall back to data URI to prevent data loss
if not file.is_text:
content_str = data_uri
outputs.append(
SandboxFileOutput(