Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
Adds step-level retry policies to OpenWorkflow so individual step.run(...) calls can control backoff/attempt limits independently of the workflow-level retry policy, with backend support and documentation updates.
Changes:
- Introduces step-level retryPolicy override on
step.run(...)and tracks retry budgets perstepNameduring execution. - Adds
Backend.rescheduleWorkflowRunAfterFailedStepAttempt(...)and implements it for SQLite and Postgres backends. - Expands test coverage (worker + execution + backend testsuite) and updates docs/architecture to describe the new behavior.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/openworkflow/execution.ts | Implements step retry policy resolution + per-step failed-attempt counting; reschedules runs via new backend method on step failures. |
| packages/openworkflow/backend.ts | Extends Backend interface with rescheduleWorkflowRunAfterFailedStepAttempt params/method. |
| packages/openworkflow/sqlite/backend.ts | Adds SQLite implementation of rescheduleWorkflowRunAfterFailedStepAttempt. |
| packages/openworkflow/postgres/backend.ts | Adds Postgres implementation of rescheduleWorkflowRunAfterFailedStepAttempt. |
| packages/openworkflow/backend.testsuite.ts | Adds tests validating backend reschedule behavior and worker-ownership enforcement. |
| packages/openworkflow/worker.test.ts | Adds worker-level tests for step-default retries, overrides, per-step budget isolation, and lease/sleep interactions. |
| packages/openworkflow/execution.test.ts | Adds unit tests for createStepExecutionStateFromAttempts. |
| packages/docs/docs/steps.mdx | Documents per-step retryPolicy usage in step.run. |
| packages/docs/docs/retries.mdx | Clarifies retry policy shape and separates step vs workflow retry policy descriptions. |
| packages/docs/docs/advanced-patterns.mdx | Updates wording referencing step-level retry configuration. |
| ARCHITECTURE.md | Updates architecture docs to reflect per-step retry budgeting and separation from workflow-level retry policy. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (error instanceof StepError) { | ||
| const serializedError = serializeError(error.originalError); | ||
| const retryDecision = computeFailedWorkflowRunUpdate( | ||
| error.retryPolicy, | ||
| error.stepFailedAttempts, | ||
| workflowRun.deadlineAt, | ||
| serializedError, | ||
| new Date(), | ||
| ); |
There was a problem hiding this comment.
When multiple steps fail in the same execution slice (e.g., Promise.all), only the first surfaced StepError is used to compute availableAt. This can violate other failed steps' retry policies (retrying too early) because there is a single workflow-level reschedule time but potentially multiple per-step backoff requirements. Consider aggregating failed step retry decisions for the current run and rescheduling to the latest required availableAt (or otherwise defining/encoding a deterministic rule), potentially by persisting each step’s resolved retry policy/config so it can be recomputed from history.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Adds per-step retry policies. Step failure backoff/budget decisions now use the step's own retry policy rather than the workflow's.
Example code: