Skip to content

feat(openworkflow): configurable worker lease duration - #878

Merged
jamescmartinez merged 2 commits into
openworkflowdev:mainfrom
cliftonc:worker-lease-duration
Oct 12, 2026
Merged

jamescmartinez merged 2 commits into
openworkflowdev:mainfrom
cliftonc:worker-lease-duration

Conversation

@cliftonc

Copy link
Copy Markdown
Contributor

Part of #877

Summary

Adds a leaseDurationMs worker option so deployments with very long steps or slow storage can tune the 30s lease. Heartbeats stay at half the lease, so there is a single knob and no way to configure a heartbeat that outlives the lease.

Changes

  • WorkerOptions.leaseDurationMs (default 30000), used when claiming and extending runs; missing/invalid values fall back to the default
  • OpenWorkflow#newWorker() and the CLI worker config accept it
  • Tests for the custom lease, invalid-value fallback, and heartbeat interval; docs in workers.mdx and configuration.mdx

Add a `leaseDurationMs` worker option, also accepted by
`OpenWorkflow#newWorker` and the CLI `worker` config. It replaces the fixed
30s lease used when claiming and extending workflow runs. Heartbeats stay at
half the lease, and missing or invalid values fall back to the 30s default.
@greptile-apps

greptile-apps Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; both previous findings are fixed.

Summary

Adds leaseDurationMs to worker options, OpenWorkflow.newWorker(), and CLI configuration.

  • Workers can choose how long each run lease lasts.

Reviews (2) · Last reviewed commit: "fix(openworkflow): cap heartbeat interva..." · Reviewed by Greptile

Comment thread packages/openworkflow/worker/worker.ts
Comment thread packages/openworkflow/worker/worker.test.ts Outdated
Node runs timer delays above 2^31-1 ms after 1 ms, so a very long lease would
heartbeat continuously. Cap the interval, and check the heartbeat timing with
controlled timers.
@pkg-pr-new

pkg-pr-new Bot commented Oct 12, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/openworkflowdev/openworkflow/@openworkflow/cli@878
npm i https://pkg.pr.new/openworkflowdev/openworkflow/@openworkflow/dashboard@878
npm i https://pkg.pr.new/openworkflowdev/openworkflow@878

commit: ad93c44

@codecov

codecov Bot commented Oct 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jamescmartinez
jamescmartinez merged commit 11a2d10 into openworkflowdev:main Oct 12, 2026
8 checks passed
@jamescmartinez

Copy link
Copy Markdown
Contributor

merged, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants