`initialize_from(resume_at_next_action=False)` does not go back to the entrypoint
Maintainer thường phản hồi trong vòng 3 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 70/100
Hướng nghiên cứu
Start in ApplicationBuilder._init_state_from_persister, where the resume_at_next_action=False branch is a bare pass, and check how __PRIOR_STEP in the loaded state drives get_next_action(). Compare with the failed-status branch that already calls reset_to_entrypoint(). Done when a persister-backed app built with False starts at counter with its loaded state intact, a test covers this with InMemoryPersister, and docs/concepts/state-persistence.rst matches the behavior.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
With resume_at_next_action=False, loading from a persister behaves the same as True: the app continues after the saved step instead of starting at default_entrypoint.
Current behavior
After loading, get_next_action() returns the action after the last saved step, whether resume_at_next_action is True or False.
Steps to replicate behavior
from burr.core import ApplicationBuilder, State, action, default
from burr.core.persistence import InMemoryPersister
@action(reads=[], writes=["count"])
def counter(state: State) -> State:
return state.update(count=state.get("count", 0) + 1)
@action(reads=["count"], writes=[])
def done(state: State) -> State:
return state
persister = InMemoryPersister()
def build(resume_at_next_action):
return (
ApplicationBuilder()
.with_actions(counter=counter, done=done)
.with_transitions(("counter", "done", default))
.initialize_from(
persister,
resume_at_next_action=resume_at_next_action,
default_state={},
default_entrypoint="counter",
)
.with_identifiers(app_id="app", partition_key="pk")
.with_state_persister(persister)
.build()
)
build(True).step() # runs "counter" and saves it
for flag in (True, False):
app = build(flag)
print(f"resume_at_next_action={flag}: next action = {app.get_next_action().name}")
Output:
resume_at_next_action=True: next action = done
resume_at_next_action=False: next action = done
Library & System Information
apache-burr 0.43.0 and main (222b32c3), Python 3.13, macOS
Expected behavior
docs/concepts/state-persistence.rst describes it as "whether to start where you left off, or go back to the default_entrypoint", so with False the next action should be counter, keeping the loaded state.
Additional context
In ApplicationBuilder._init_state_from_persister the False branch is just pass ("self.start is already set to the default"), but the loaded state still has __PRIOR_STEP, and get_next_action() uses it. The existing tests that use False load from a fake loader or from the local tracker, and neither has __PRIOR_STEP in the loaded state, so they don't catch this. For the same reason the local tracker isn't affected, only persisters (in-memory, SQLite, etc.).
With False, the starting point also depends on how many times a step failed: after one failed attempt the app starts at the failed action, after two at the entrypoint, because the failed-status path removes __PRIOR_STEP when it restarts the action. I mentioned this on the dev list durable-execution thread: https://lists.apache.org/thread/3xp1mfozrxtrc0w8oqh0xh5lgt22kvwj
I'm opening a PR with a fix (calling reset_to_entrypoint() there, like the failed-status branch already does) and tests. If the current behavior is intended, I'm happy to update the docs instead.
- Ngôn ngữ chính
- Python
- Star
- 2.6k
- Fork
- 218
- Merge trung bình
- 4 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 35
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 apache/burr
-
Redis and Postgres persister integration tests fail when re-run against the same databasesCó thể đã có người làm @YongGoose đã nhận 3 ngày trước. Đang mởstatus/needs-triage
Độ 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 3 ngày
-
State.wipe() with no arguments raises TypeError instead of clearing stateCó thể đã có người làm @alibb007 đã nhận 5 ngày trước. Đang mởstatus/needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 3 ngày
-
Notebook UI launcher should use the current Python interpreterCó thể đã có người làm @sivakumar-mahalingam đã nhận 24 ngày trước. Đang mởstatus/needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 3 ngày
-
astep() passes unprocessed inputs to pre_run_step hooksCó thể đã có người làm @sivakumar-mahalingam đã nhận 24 ngày trước. Đang mởstatus/needs-triage
Độ 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 3 ngày
-
`burr` fails to start when the Python path has a space in itCó thể đã có người làm @enekoreto đã nhận 26 ngày trước. Đang mởstatus/needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 3 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
django-cms/djangocms-frontend#413 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
NanmiCoder/MediaCrawler#1004 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
facebookresearch/xformers#1417 ·
-
question
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
vllm-project/vime#524 ·
Maintainer thường phản hồi trong vòng 7 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
FinanceFlash/unvibecode#675 ·
Maintainer thường phản hồi trong vòng 1 ngày