mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-10-28 14:10:37 +00:00
* fix(runtime): keep thread checkpoints when a rollback cancel precedes snapshot capture A rollback cancel that lands after try_start() flips the run to running but before _capture_rollback_point() completes left rollback_point=None with snapshot_capture_failed=False. The rollback finalizer treated that state as "the thread never had a pre-run checkpoint" and called adelete_thread(thread_id), deleting the whole conversation's checkpoints. Initialize snapshot_capture_failed fail-closed and clear it only after the capture completes. A completed capture that returns None still resets an empty thread as before. Covered by two regressions in tests/test_run_worker_rollback.py (cancellation before and during the capture await). * fix(runtime): drop the redundant snapshot_capture_failed assignment The fail-closed initializer owns the capture state: `snapshot_capture_failed` is True from the top of run_agent, and the capture block runs once, so the except branch can only observe it still True. Re-assigning it there was dead code (review nit from @willem-bd). --------- Co-authored-by: Willem Jiang <willem.jiang@gmail.com>