Skip to content

fix: decider fixes for standard workflows, with the TLA+ spec - #1846

Open
mp-orkes wants to merge 4 commits into
mainfrom
fix/decider-semantics
Open

mp-orkes wants to merge 4 commits into
mainfrom
fix/decider-semantics

Conversation

@mp-orkes

@mp-orkes mp-orkes commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Split out of #1832.

Why

#1832 contains 15 fixes for standard workflows and a TLA+ spec that describes how standard workflows must behave. These fixes are independent of the other changes in that PR. This PR moves them out, so that they can be reviewed and merged first.

What changed

  • Optional tasks: an optional task that fails last is saved as COMPLETED_WITH_ERRORS.
  • JOIN: a JOIN waits for a failed task that can still be retried. A JOIN that names a SWITCH waits for the case to finish.
  • Rerun: a rerun from a task in a fork or in a loop now completes. Before, the workflow could stay RUNNING with nothing to run. A rerun from a SUB_WORKFLOW task starts a new child; the tasks after it are kept, as before (bug 4, partly fixed). A rerun from an old attempt uses the latest attempt.
  • Retry: a COMPLETED workflow cannot be retried (409). A retry after a failing TERMINATE ends the workflow FAILED. A retry or a rerun gives the task a new total time budget.
  • Terminate: a workflow that already ended FAILED or TIMED_OUT cannot be terminated (409).
  • Skip: a skipped first task of a branch or a case does not stop the flow. A skipped fork also skips its JOIN.
  • Races: a poll or a task update does not overwrite a cancellation. A reopened JOIN is queued only after it is saved. A rerun task that a worker completed at once does not run again.
  • Spec: specs/workflow-semantics has Workflow.tla, its models, and the scripts that compare a server with the spec.

specs/workflow-semantics/DECIDER_BUGS.md has the cause, the fix and the test for each of the 15 bugs.

How to test

  • Start a server from this branch on port 8099.
  • In specs/workflow-semantics, run TLA2TOOLS=/path/to/tla2tools.jar python3 server_check.py --server http://localhost:8099/api --tests 200 --size 3.
  • Each test that does not match the spec prints its execution id.

Notes

  • The split was made by hand. Review hotspots: WorkflowExecutorOps.rerunWF, scheduleForgotten and Join.execute.
  • Two fixes change API behavior: retry of a COMPLETED workflow and terminate of an ended workflow now return 409.
  • ExecutionDAO.updateTaskIfStatus is new. Postgres, MySQL, SQLite and Redis do the check and the write atomically. Other stores use the default, which is not atomic.

🤖 Generated with Claude Code

@mp-orkes

Copy link
Copy Markdown
Contributor Author

The e2e job fails on WorkflowRerunTests "Rerun CANCELLED sibling SUB_WORKFLOW task in parent": https://github.com/conductor-oss/conductor/actions/runs/44157752279/job/134303056980

This PR removes the path that main has for a rerun from a SUB_WORKFLOW task in a fork. The rerun now removes the completed sibling branch and scheduleForgotten starts it again, so a completed sub-workflow runs a second time.

The same test fails on #1832.

@mp-orkes
mp-orkes marked this pull request as ready for review November 19, 2026 12:47
@github-actions github-actions Bot added size: XL Applied by the review-policy workflow needs: 2 approvals Applied by the review-policy workflow labels Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

👥 Review policy — action needed. This PR changes 5,023 lines, which crosses the large-PR threshold (2,000). Large PRs require 2 approvals; it currently has 0. 2 more to go.

This is a review-policy gate, not a CI/test failure — see the review-policy / approvals check.

@mp-orkes

Copy link
Copy Markdown
Contributor Author

Closing this in favor of #1857.

My strategy was to make these changes incrementally and discuss things like the rerun change: a rerun from one fork branch runs again the completed sibling branches that were scheduled after it, and the e2e test WorkflowRerunTests fails on it.

@mp-orkes mp-orkes closed this Nov 19, 2026
@mp-orkes mp-orkes reopened this Nov 19, 2026
@mp-orkes
mp-orkes force-pushed the fix/decider-semantics branch from 8e3189b to f49b6ca Compare November 19, 2026 17:14
@mp-orkes

Copy link
Copy Markdown
Contributor Author

Reopened after discussing #1857.

@mp-orkes
mp-orkes requested a review from c4lm November 19, 2026 19:57
mp-orkes and others added 4 commits November 19, 2026 17:29
Split out of the design/native-workflows branch: the 15 fixes listed in
proposals/workflow-semantics/DECIDER_BUGS.md, their unit tests, the TLA+
spec of standard workflows and its checkers.

Not included: native workflows, the durable workflow message queue, the UI
changes, the docs changes, and the other engine fixes on that branch that
DECIDER_BUGS.md does not list.

Co-authored-by: Viren Baraiya <viren@v1r3n.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ge fixes

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A direct rerun from a SUB_WORKFLOW task took the common rerun path. That path removes every task scheduled after the target, which includes the tasks of the other fork branches, and then schedules them again. A COMPLETED sibling SUB_WORKFLOW ran a second time, and this e2e test failed:

WorkflowRerunTests, "Rerun CANCELLED sibling SUB_WORKFLOW task in parent reschedules FAILED sibling, leaves COMPLETED sibling alone"

The direct rerun from a SUB_WORKFLOW task now uses the path it had before: reset the task in place, start a new child, reset the failed siblings. The rerun still starts a new child instead of reusing the finished one.

The bug list marks bug 4 as partly fixed: the tasks after the target are kept again.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

This branch has not been deployed

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

Labels

needs: 2 approvals Applied by the review-policy workflow size: XL Applied by the review-policy workflow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant