[BUG] Failed pickle saves erase previously saved training data
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 60.6k
- フォーク
- 9.1k
- 平均マージ
- 1日 9時間
- マージ済み PR(30日)
- 218
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
crewAIInc/crewAI のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 1 日以内に返信
-
feature-request
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
crewAIInc/crewAI#9200 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[FEATURE] Docs: ApifyActorsTool example with a typed-input Actor対応中かも @johnisanerd が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
crewAIInc/crewAI#9132 · コメント 5 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] Scrape tools reject the documented cookies mapping and drop cookies when the URL is passed at runtime対応中かも @Luckyou-d が 7 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
[BUG] OpenAI-compatible embedding model alias breaks embedder construction対応中かも @gokay-ai が 13 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
crewAIInc/crewAI#8761 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
crewAIInc/crewAI の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
FAIRmat-NFDI/pynxtools#861 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
NVIDIA/nsight-python#88 ·
メンテナーはふだん 1 日以内に返信
-
Criteria can pass when the deliverable is missing対応中かも @clementtisseau が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
harveyai/harvey-labs#217 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
priority/medium roadmap/v1.1.1 stakeholder/rapr type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
databrickslabs/ontos#1420 ·
メンテナーはふだん 3 日以内に返信