Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

fix: Remove possibility of empty strings when updating (#4149)

Matthew Zhoud078100a897f
diff --git a/letta/services/agent_serialization_manager.py b/letta/services/agent_serialization_manager.py
index 55b509070..5635ed3bd 100644
--- a/letta/services/agent_serialization_manager.py
+++ b/letta/services/agent_serialization_manager.py
@@ -936,7 +936,10 @@ class AgentSerializationManager:
# update file status to ERROR
try:
await self.file_manager.update_file_status(
- file_id=file_id, actor=actor, processing_status=FileProcessingStatus.ERROR, error_message=str(e)
+ file_id=file_id,
+ actor=actor,
+ processing_status=FileProcessingStatus.ERROR,
+ error_message=str(e) if str(e) else f"Agent serialization failed: {type(e).__name__}",
)
except Exception as update_error:
logger.error(f"Failed to update file status to ERROR for {file_id}: {update_error}")
diff --git a/letta/services/file_processor/file_processor.py b/letta/services/file_processor/file_processor.py
index 76cac3d7e..6e63a1ec4 100644
--- a/letta/services/file_processor/file_processor.py
+++ b/letta/services/file_processor/file_processor.py
@@ -264,7 +264,10 @@ class FileProcessor:
},
)
await self.file_manager.update_file_status(
- file_id=file_metadata.id, actor=self.actor, processing_status=FileProcessingStatus.ERROR, error_message=str(e)
+ file_id=file_metadata.id,
+ actor=self.actor,
+ processing_status=FileProcessingStatus.ERROR,
+ error_message=str(e) if str(e) else f"File processing failed: {type(e).__name__}",
)
return []
@@ -361,7 +364,7 @@ class FileProcessor:
file_id=file_metadata.id,
actor=self.actor,
processing_status=FileProcessingStatus.ERROR,
- error_message=str(e),
+ error_message=str(e) if str(e) else f"Import file processing failed: {type(e).__name__}",
)
return []
diff --git a/letta/utils.py b/letta/utils.py
index 7ca81bff2..b3983eab8 100644
--- a/letta/utils.py
+++ b/letta/utils.py
@@ -1132,7 +1132,7 @@ def safe_create_file_processing_task(coro, file_metadata, server, actor, logger:
file_id=file_metadata.id,
actor=actor,
processing_status=FileProcessingStatus.ERROR,
- error_message=f"Processing failed: {str(e)}" if str(e) else "Processing failed due to an unexpected error",
+ error_message=f"Processing failed: {str(e)}" if str(e) else f"Processing failed: {type(e).__name__}",
)
except Exception as update_error:
logger.error(f"Failed to update file status to ERROR for {file_metadata.id}: {update_error}")