[BUG] Failed pickle saves erase previously saved training data
Los mantenedores suelen responder en 1 día
@vatsalyd ya está trabajando en esto.
Desde el 6/11/2026.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 35/100
Línea de trabajo
Start by reading PickleHandler.save() and CrewTrainingHandler in the training handler implementation, then inspect the related tests. Reproduce the failure with an unpicklable object and verify that a failed save preserves existing training data and does not leave an empty destination file. Two open pull requests are already linked to this issue.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
PickleHandler.save() opens its destination with wb before calling pickle.dump(). If serialization fails, the existing file has already been truncated. CrewTrainingHandler inherits this behavior, so one invalid save can erase training data for previously saved agents.
Steps to Reproduce
- Save valid agent training data.
- Attempt to save another agent's data containing an unpicklable object.
- Catch the serialization error and load the saved training data.
Expected behavior
The save raises its serialization error and preserves the earlier file and training data.
Screenshots/Code snippets
from pathlib import Path
from tempfile import TemporaryDirectory
from threading import Lock
from crewai.utilities.training_handler import CrewTrainingHandler
with TemporaryDirectory() as directory:
path = Path(directory) / "training.pkl"
handler = CrewTrainingHandler(str(path))
handler.save_trained_data("saved-agent", {"score": 10})
try:
handler.save_trained_data("new-agent", {"lock": Lock()})
except TypeError as error:
print(error)
print(handler.load())
print(path.stat().st_size)
Operating System
Windows
Python Version
3.13.13
crewAI Version
1.15.36, main at 7abc196a176a5552c35c6e7a16817aa115f10655.
crewAI Tools Version
Not used.
Virtual Environment
Venv managed by uv with the repository lockfile.
Evidence
Before the failing save the file contains {'saved-agent': {'score': 10}} (42 bytes). Afterward:
cannot pickle '_thread.lock' object
{}
0
The failure also creates an empty file when the destination did not previously exist. Both regression cases reproduce locally without LLM calls.
Possible Solution
Serialize with pickle.dumps() before opening the destination, then write the resulting bytes under the existing lock.
Additional context
Prepared with AI assistance. This account cannot add labels; please apply the required llm-generated label.
- Lenguaje dominante
- Python
- Estrellas
- 60.6k
- Forks
- 9.1k
- Merge medio
- 1 d 2 h
- PR fusionados (30 d)
- 214
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de crewAIInc/crewAI
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día
-
Feature request: GoldenDirectiveTool (harmonic relationship score, full vs cropped reporting)Abiertofeature-request
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
crewAIInc/crewAI#9200 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
crewAIInc/crewAI#9132 · 5 comentarios ·
Los mantenedores suelen responder en 1 día
-
[BUG] Scrape tools reject the documented cookies mapping and drop cookies when the URL is passed at runtimePosiblemente ocupada @Luckyou-d la tomó hace 5 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
[BUG] OpenAI-compatible embedding model alias breaks embedder constructionPosiblemente ocupada @gokay-ai la tomó hace 11 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
crewAIInc/crewAI#8761 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de crewAIInc/crewAI
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
bigbio/sdrf-pipelines#372 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Open Source] PixelboltAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 84/100
521xueweihan/HelloGitHub#4297 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
aws-samples/sample-per-model-bedrock#822 ·
Los mantenedores suelen responder en 1 día
-
area:study-data p2-high ready-for-agent type:chore
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
fderuiter/deruiter.dev#3706 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
awslabs/visual-asset-management-system#1234 ·
Los mantenedores suelen responder en 1 día