Shared checkpoint retention can remove another run%27s only resume point
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
調査の方向性
Start by reading JsonProvider.prune() and SqliteProvider.prune(), then inspect the checkpoint pruning tests; the report says it will attach test_checkpoint_prune_shared_location.py with offline reproductions. Compare retention behavior for independent runs sharing a location and branch, including a writer configured with max_checkpoints=None. Done means the intended retention scope is clear and tests establish whether pruning can remove another run’s last resume point.
索引モデルが issue の本文から書いたものです。
説明
Thank you to everyone working on checkpoints, and to the authors of #5381 (forking with lineage tracking). This is a question about intended behaviour; it sits next to #8268, #9022 / #9023, #9674 and #9698, but I did not find it described there. We found this with ATLAS, an AI finder and verifier. This report was prepared with AI assistance (please apply llm-generated).
What happens
JsonProvider.prune() and SqliteProvider.prune() select by location and branch only (<location>/<branch>/*.json by mtime, or WHERE branch = ?). A fresh run starts on main, so independent runs that share one location share one retention budget.
So a later run with max_checkpoints set can delete the only checkpoint of an earlier failed run, even if that earlier run used max_checkpoints=None. None means that writer does not prune; it does not protect its checkpoints from another writer at the same location and branch. CheckpointPrunedEvent reports counts, not which checkpoints were removed.
Reproduction (offline, no model, crewai 1.15.45, main 77237ae)
Run A "pays" (a local list only) and then fails in ship. Runs B and C are unrelated runs in the same folder. A keeps its checkpoint reference; the script then tries to resume from it, and if the file is gone it starts A fresh.
import glob, sys, tempfile, time, json, logging
from crewai import CheckpointConfig
from crewai.flow.flow import Flow, listen, start
# usage: python repro_resume.py <limit of A> <limit of B and C> ("none" or a number)
lim = lambda s: None if s == "none" else int(s)
LA, LBC = lim(sys.argv[1]), lim(sys.argv[2])
effects = [] # simulated payments (local list only)
warn = []
class H(logging.Handler):
def emit(self, r): warn.append(r.getMessage())
logging.getLogger().addHandler(H()); logging.getLogger().setLevel(logging.WARNING)
class OrderFlow(Flow):
@start()
def charge(self):
effects.append(self.state["id"])
@listen(charge)
def ship(self):
if self.state.get("fail"):
raise RuntimeError("ship failed")
loc = tempfile.mkdtemp()
cfg = lambda m, **k: CheckpointConfig(location=loc, on_events=["method_execution_finished"], max_checkpoints=m, **k)
def stored():
prev = -1
for _ in range(30): # wait until write and prune are stable
time.sleep(0.5)
now = sorted(glob.glob(loc + "/**/*.json", recursive=True))
if len(now) == prev: return now
prev = len(now)
return now
try: OrderFlow(checkpoint=cfg(LA)).kickoff(inputs={"id": "A", "fail": True})
except RuntimeError: pass
a_files = stored()
a_ref = a_files[-1]
for n in ("B", "C"):
OrderFlow(checkpoint=cfg(LBC)).kickoff(inputs={"id": n}); stored()
left = stored()
print(f"A limit={LA}, B/C limit={LBC}: A's checkpoint files before={len(a_files)}, after={sum(f in left for f in a_files)}; total files={len(left)}")
print("warnings seen:", warn)
before = len(effects)
if a_ref in left:
try: OrderFlow.from_checkpoint(cfg(None, restore_from=a_ref)).kickoff()
except RuntimeError: pass
print("resume from A's reference: possible; new payments for A =", effects[before:].count("A"))
else:
print("resume from A's reference: file is gone")
OrderFlow(checkpoint=cfg(None)).kickoff(inputs={"id": "A"})
print("fresh start of A: payments for A in total =", effects.count("A"))
Measured output (the simulated payment is a local list, nothing real):
$ python repro_resume.py none none
A limit=None, B/C limit=None: A's checkpoint files before=1, after=1; total files=5
resume from A's reference: possible; new payments for A = 0
$ python repro_resume.py none 3
A limit=None, B/C limit=3: A's checkpoint files before=1, after=0; total files=3
resume from A's reference: file is gone
fresh start of A: payments for A in total = 2
$ python repro_resume.py 3 3
A limit=3, B/C limit=3: A's checkpoint files before=1, after=0; total files=3
resume from A's reference: file is gone
fresh start of A: payments for A in total = 2
A fresh start is a separate operation that the application chooses; no automatic restart or real double payment is claimed. The warning list contains only the error of the failing step, so I saw no warning about the removed checkpoint.
Fixture
I will attach test_checkpoint_prune_shared_location.py as a comment (22 tests, offline). On main: 11 pass (controls without a limit, one run alone, one location per run, and the mixed case with one location per run) and 11 fail. The failures cover the same limit for all runs (Flow with both providers, Crew with JsonProvider) and the mixed case (A without limit, B and C with limit 3; Flow and Crew, each with both providers). The resume tests check that A's last checkpoint is still there.
Workaround
Give every run its own location (own folder, or own SQLite file). The fixture confirms this keeps A's checkpoint for both providers.
Limits
- Affects only people who share a location between runs and set
max_checkpointsin at least one of them. The guide recommends the limit for disk use, and the default./.checkpointsis shared by a project. - Scripted flow and scripted model, not a real provider. The script above uses JsonProvider and Flow; the fixture covers SqliteProvider and Crew. The resume itself (with no new payment) is shown only in the script, with JsonProvider. I did not test
fork()or the CLIprune.
Question
As far as I understand, #5381 made pruning branch-scoped so that fork branches do not prune each other. Is it also intended that independent root runs on main share one retention budget? If yes, could the config description and the guide say so, including that max_checkpoints=None does not protect a writer's checkpoints from other writers at the same location and branch? If not, what should the unit of retention be for independent runs (per run, or one budget per store)?
Thank you for taking a look.
- 主要言語
- Python
- スター
- 61.2k
- フォーク
- 9.2k
- 平均マージ
- 1日 14時間
- マージ済み PR(30日)
- 180
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
crewAIInc/crewAI のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
[FEATURE] Add Straitly as a native OpenAI-compatible LLM provider対応中かも @HashimSyedUBC が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
[BUG] Native OpenAI sync streaming with response_model returns an empty string and emits no completed event when the parse is missing対応中かも @basil-k-aji-dev が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
[BUG] Native Azure provider ignores the seed setting対応中かも @basil-k-aji-dev が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
crewAIInc/crewAI#9787 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] LiteLLM path reports 0 cached and reasoning tokens in the usage summary対応中かも @basil-k-aji-dev が 2 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
crewAIInc/crewAI の issue をすべて見る
似ている issue
-
bug harness
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
mruangutai/harness#2687 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
modal-labs/modal-client#4158 ·
-
good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 半日 初心者へのやさしさ 72/100
The-Swarm-Corporation/swarms-rs#168 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] SMTP listener now binds to EMAIL_PORT instead of 2525 since the gunicorn switch 5.0.3-ls373オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
linuxserver/docker-healthchecks#137 · コメント 1 件 ·