From a2856c1863c12edeaf87bcd53995c3384c0da814 Mon Sep 17 00:00:00 2001 From: Nick Tindle Date: Wed, 11 Feb 2026 12:15:32 -0600 Subject: [PATCH] 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 --- autogpt_platform/backend/backend/util/sandbox_files.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/autogpt_platform/backend/backend/util/sandbox_files.py b/autogpt_platform/backend/backend/util/sandbox_files.py index d5782a23eb..42f13eeb9f 100644 --- a/autogpt_platform/backend/backend/util/sandbox_files.py +++ b/autogpt_platform/backend/backend/util/sandbox_files.py @@ -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(