Skip to content

fix(engine): resume running workflow runs when the engine starts - #4421

Merged
LHagfoss merged 1 commit into
mainfrom
fix/engine-workflow-startup-resume
Nov 25, 2026
Merged

LHagfoss merged 1 commit into
mainfrom
fix/engine-workflow-startup-resume

Conversation

@LHagfoss

Copy link
Copy Markdown
Owner

What

A workflow run left running by a restart was only taken up again when its starting thread registered with the hub, so on the background server (no app) it stayed undriven indefinitely. Runs also had no owner, so nothing could tell a run another engine process drives from one whose process died.

  • workflow/driver.rs: a driver.json stamp per run (owner id = data_store::engine_owner, every 10 s, stale after 45 s, kept beside run.json so the run's own saves never undo it) and an index of running runs at <config>/workflows/running/<run id>.
  • workflow::spawn stamps and indexes the run, beats while it is driven, and drops the marker once it settles.
  • resume_one refuses a run another live process drives; the register path retries once after the stale window so a thread that registers right after a restart still gets its run back.
  • workflow::keep_resuming (started in AcpEngine::start) sweeps the index at start and every minute, skipping after a clock jump: it forgets settled runs and resumes undriven ones whose thread is at Full access (local_threads::starts_threads_without_app), through the engine's own answers.
  • docs/workflows.md › Durability.

Changelog

Workflow runs cut off by a restart now continue on their own when the engine starts again, without opening their thread (Full-access threads).

Testing

cargo fmt --check, scripts/check-comments.py, scripts/check-rust-size.py locally; unit tests for the lease, index, sweep and refusal in workflow.rs and workflow/driver.rs run in CI.

Closes #4387

@github-actions github-actions Bot added the fix A bug fix label Nov 25, 2026
@LHagfoss
LHagfoss merged commit 86e7138 into main Nov 25, 2026
7 checks passed
@LHagfoss
LHagfoss deleted the fix/engine-workflow-startup-resume branch November 25, 2026 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(engine): resume running workflow runs when the engine starts

2 participants