Resuming a Flow from an automatic checkpoint re-runs already completed methods when on_events=["*"]
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
The payload does not name implementation or test files. Start by tracing how Flow.from_checkpoint(...) restores checkpoint_completed_methods and how on_events=["*"] selects checkpoint events; compare with the working method_execution_finished case. Reproduce the three step flow with both JsonProvider and SqliteProvider, then verify that resuming runs only C. Linked PR #9844 is already open, so coordinate with that work before taking this on.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Thank you to the maintainers, and to everyone who reported and worked on the related checkpoint issues (#9290, #9022, #9023, #8438). This was found with ATLAS, an AI finder and verifier.
What happens
A flow a -> b -> c crashes in c. Resuming from the most recently written automatic checkpoint should run only c, since the docs say completed tasks are skipped on restore. With on_events=["method_execution_finished"] that is what happens. With on_events=["*"] (documented in CheckpointConfig) the resume runs A, B and C again, so side effects of completed methods are repeated.
Reproduction (crewAI main at 77237ae, Python 3.13, JsonProvider)
# crewAI main 77237ae. Resume after a crash re-runs completed flow methods when on_events=["*"].
import glob, os, tempfile
from crewai.flow.flow import Flow, start, listen
from crewai.state.checkpoint_config import CheckpointConfig
def run(events):
ran, crash = [], {"on": True}
class F(Flow):
@start()
def a(self): ran.append("A"); return "a"
@listen(a)
def b(self, x): ran.append("B"); return "b"
@listen(b)
def c(self, x):
ran.append("C")
if crash["on"]: raise RuntimeError("crash after B")
return "c"
d = tempfile.mkdtemp()
try: F(checkpoint=CheckpointConfig(location=d, on_events=events)).kickoff()
except Exception: pass
last = max(glob.glob(d + "/**/*.json", recursive=True), key=os.path.getmtime)
ran.clear(); crash["on"] = False
F.from_checkpoint(CheckpointConfig(location=d, restore_from=last)).kickoff()
return "".join(ran)
for ev in (["method_execution_finished"], ["*"]):
print(ev, "-> after resume ran:", run(ev), "(expected: C)")
Output:
['method_execution_finished'] -> after resume ran: C (expected: C)
['*'] -> after resume ran: ABC (expected: C)
Measured
| on_events | main | main + PR #9023 applied locally (PR is still open) |
|---|---|---|
| method_execution_finished | C (5/5) | C (5/5) |
| method_execution_started | 1 of 5 runs: B, C | C (5/5) |
| flow_failed | C (5/5) | C (5/5) |
| "*" | A, B, C (5/5) | A, B, C (5/5) |
(5 runs per setting, a fresh process per run; the single-process script above gave ABC in both runs I made.) PR #9023 fixes the out-of-order case in my runs, but not the "*" case.
Checked to rule out a file-selection artifact
Same flow, 3 ways of choosing the checkpoint to restore (last written, the one with the most completed methods, one from the middle), JsonProvider and SqliteProvider:
["method_execution_finished"]:Cin all 6 cases.["*"]:ABCin all 6 cases.
So it does not depend on which file is picked or on the storage backend.
Workaround
on_events=["method_execution_finished"] resumes correctly in my runs.
Observation, cause not located
The checkpoint file written last holds checkpoint_completed_methods: ["a", "b"], but after Flow.from_checkpoint(...) the restored flow reports checkpoint_completed_methods = None, so nothing is skipped.
Limits
Simple three-step flow, no human feedback, no routers, no crews. "Latest" means the most recently written file. I did not check whether this is the same root cause as #8438 (a resumed flow writing checkpoints of a blank flow); the blank restored state looks related.
Happy to adjust the reproduction or test a fix.
- Ngôn ngữ chính
- Python
- Star
- 61.2k
- Fork
- 9.2k
- Merge trung bình
- 1 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 180
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của crewAIInc/crewAI
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[FEATURE] Add Straitly as a native OpenAI-compatible LLM providerCó thể đã có người làm @HashimSyedUBC đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] Native OpenAI sync streaming with response_model returns an empty string and emits no completed event when the parse is missingCó thể đã có người làm @basil-k-aji-dev đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] Native Azure provider ignores the seed settingCó thể đã có người làm @basil-k-aji-dev đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
crewAIInc/crewAI#9787 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG] LiteLLM path reports 0 cached and reasoning tokens in the usage summaryCó thể đã có người làm @basil-k-aji-dev đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của crewAIInc/crewAI
Issue tương tự
-
[BUG] SMTP listener now binds to EMAIL_PORT instead of 2525 since the gunicorn switch 5.0.3-ls373Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
linuxserver/docker-healthchecks#137 · 1 bình luận ·
-
RequirementAgent treats list -> add -> list as a tool call cycle and drops the second list call (Python)Có thể đã có người làm @chaitanya0305 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
i-am-bee/beeai-framework#2049 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
fedora-infra/anitya#2272 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
unitaryfoundation/mitiq#3205 ·
Maintainer thường phản hồi trong vòng 6 ngày
-
[Bug]: Index worker test drops empty Git config values on WindowsCó thể đã có người làm @xiaoyesoso đã nhận hôm nay. Đang mởtriage/confirmed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
agentscope-ai/agentscope#4377 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày