diff --git a/backend/agent/tools/sb_files_tool.py b/backend/agent/tools/sb_files_tool.py index 590df309..7e192c8a 100644 --- a/backend/agent/tools/sb_files_tool.py +++ b/backend/agent/tools/sb_files_tool.py @@ -540,12 +540,12 @@ def authenticate_user(username, password): await self.sandbox.fs.upload_file(new_content.encode(), full_path) # Return rich data for frontend diff view - return self.success_response({ + return ToolResult(success=True, output=json.dumps({ "message": f"File '{target_file}' edited successfully.", "file_path": target_file, "original_content": original_content, "updated_content": new_content - }) + })) except Exception as e: logger.error(f"Unhandled error in edit_file: {str(e)}", exc_info=True) diff --git a/frontend/src/components/thread/tool-views/file-operation/_utils.ts b/frontend/src/components/thread/tool-views/file-operation/_utils.ts index af6ebf31..a762a347 100644 --- a/frontend/src/components/thread/tool-views/file-operation/_utils.ts +++ b/frontend/src/components/thread/tool-views/file-operation/_utils.ts @@ -289,7 +289,7 @@ export const extractFileEditData = ( filePath: parsed.file_path || null, originalContent: parsed.original_content ?? null, updatedContent: parsed.updated_content ?? null, - success: true, // Assume success if we have content + success: parsed.updated_content !== null, // Success is false if updated_content is null timestamp: null, errorMessage: parsed.message, };