Repository navigation
Conversation
Everything in #1832 that is not native workflows: decider fixes for standard workflows, the fixes the durability bench found, the durable workflow message queue, timeout policy and idempotent starts, and small API and UI fixes. #1832 is stacked on this change and now holds only native workflows. Decider (proposals/workflow-semantics/DECIDER_BUGS.md, bugs 1 to 15, found by a TLA+ model of the decider and checked against the server): - an optional task that fails last is saved COMPLETED_WITH_ERRORS - a JOIN waits for a failed attempt that can still be retried, and a JOIN that names a SWITCH waits for the case it took - reruns from a task in a fork, in a loop, from a SUB_WORKFLOW task, or from an older attempt complete; a rerun task a worker finished at once does not run again - a COMPLETED workflow cannot be retried and an ended one cannot be terminated (409); a retry after a failing TERMINATE ends FAILED; retry and rerun give a task a fresh total time budget - a skipped first task of a branch or case does not stop the flow; a skipped fork skips its JOIN - a poll or a task update does not overwrite a cancellation: tasks are saved only if their stored status is still the one read (ExecutionDAO.updateTaskIfStatus, atomic on Postgres, MySQL, SQLite, Redis) - reopened JOINs are queued only after they are saved - DecideTrace (-Dconductor.trace.dir) and the spec's server_check.py compare server runs with Workflow.tla step by step Durability bench (server, database and worker kills and pauses): - createWorkflow writes the decider queue entry before the row; a failed start does not delete the workflow; a failed first evaluation is left to the sweeper - a transient storage failure in scheduleTask or DO_WHILE retries the decide instead of failing the workflow; the decide loop saves a workflow an earlier iteration changed - the sweeper re-reads a task before re-queueing it - a system task another run completed is not overwritten; JOIN and PULL_WORKFLOW_MESSAGES reserve their message briefly (isExecuteIdempotent) - SQLite pop is scoped to its queue; Postgres definition writes are single upserts Workflow message queue: a durable SQL store (SQLite, Postgres, MySQL), claims so a re-run pull returns the same messages, a push applied inside a decide (WorkflowExecutor.decide(workflowId, change)), and undelivered messages of an ended workflow logged and counted. Also: - response and total timeouts follow the task's timeout policy - a start with an idempotency key returns the existing workflow - the skip-task endpoint reads its JSON body - the API workflow names the task it failed at (failedTaskId) - ui-next: hides Terminate and Retry where the server refuses them, "Jump to task" uses failedTaskId, an agent with no card snapshot is not UNRESOLVED in a run, and the scheduler page exports only its component - docs updated for the above Co-Authored-By: Claude <noreply@anthropic.com>
|
👥 Review policy — action needed. This PR changes 8,803 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 |
…ording - Classes this change uses are imported, not written out in full (main and test code, Java and Groovy); calls already covered by a static import use it. - DECIDER_BUGS.md, the spec README, a SQLite test and a TaskCard comment no longer refer to native workflows, which are not part of this change. spotlessApply run; core 1024, common 107, rest 135, sqlite 122, redis 81, mysql 54, postgres 158 (PostgresLockDAOTest's lease-timing check is flaky, on main too), grpc 4, http-task 26. Co-Authored-By: Claude <noreply@anthropic.com>
The e2e tests are passing in CI because they are cached. E.g.: https://github.com/conductor-oss/conductor/actions/runs/44349914306/job/134962466309 Starting a Gradle Daemon (subsequent builds will be faster) > Task :conductor-e2e:processResources NO-SOURCE > Task :conductor-e2e:compileJava NO-SOURCE > Task :conductor-e2e:classes UP-TO-DATE > Task :conductor-e2e:compileTestJava FROM-CACHE > Task :conductor-e2e:processTestResources > Task :conductor-e2e:testClasses > Task :conductor-e2e:test FROM-CACHE > Task :conductor-e2e:jacocoTestReport FROM-CACHE This is wrong. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
BLOCKING With the cache fix (cd8cc5c) e2e tests fail: https://github.com/conductor-oss/conductor/actions/runs/44560086396/job/135686714387
Both pass on main with the same cache fix (#1861: 227 run, 0 failed). Both failures come from changes in this PR. They were hidden because the e2e test results came from cache. |
| finalizeRerun(workflow, rerunFromTask); | ||
| return true; | ||
| } | ||
| // Remove all tasks after the "rerunFromTask" |
There was a problem hiding this comment.
Cause of the WorkflowRerunTests failure. This PR removes the path that main has for a rerun from a SUB_WORKFLOW task in a fork. The removal by seq now deletes the completed sibling branch, and scheduleForgotten starts it again with a new child workflow.
| // like one with no retries left. Under TIME_OUT_WF the workflow times out. | ||
| if (taskDefinition.getTotalTimeoutSeconds() > 0 | ||
| && task.getFirstScheduledTime() > 0 | ||
| && taskDefinition.getTimeoutPolicy() != TaskDef.TimeoutPolicy.ALERT_ONLY) { |
There was a problem hiding this comment.
Cause of the RetryPolicyTests failure. With ALERT_ONLY the total timeout guard is skipped, so the task is retried after totalTimeoutSeconds is spent. Before, the workflow ended.
| LOGGER.debug(reason); | ||
| task.setStatus(TIMED_OUT); | ||
| task.setReasonForIncompletion(reason); | ||
| timeoutTaskWithTimeoutPolicy(reason, taskDef, task); |
There was a problem hiding this comment.
The default timeoutPolicy is TIME_OUT_WF. A response timeout now ends the workflow with no retry for every task definition that keeps the defaults. Reproduced: retryCount 1, responseTimeoutSeconds 2, no policy set, one attempt and the workflow is TIMED_OUT. Can this go behind a property that is off by default?
| return Optional.empty(); | ||
| } | ||
| if (timeOutWorkflow) { | ||
| task.setStatus(TIMED_OUT); |
There was a problem hiding this comment.
With TIME_OUT_WF, a task that the worker failed and that is over totalTimeoutSeconds is rewritten to TIMED_OUT, and the workflow ends TIMED_OUT. Before, both were FAILED. Failure workflows, listeners and searches that use FAILED see a different status.
| LOGGER.debug(reason); | ||
| task.setStatus(TIMED_OUT); | ||
| task.setReasonForIncompletion(reason); | ||
| timeoutTaskWithTimeoutPolicy(reason, taskDef, task); |
There was a problem hiding this comment.
With ALERT_ONLY the task stays IN_PROGRESS and updateTime does not change, so the response timeout fires again on every decide pass. ExecutorUtils.computePostpone returns 0 for this task, so the sweeper evaluates the workflow again immediately while the worker is dead.
| @Override | ||
| public String startWorkflow(StartWorkflowInput input) { | ||
| if (StringUtils.isNotBlank(input.getIdempotencyKey())) { | ||
| return startWorkflowWithIdempotencyKey(input); |
There was a problem hiding this comment.
SchedulerService copies the idempotency key of the schedule to every trigger. The server ignored the key until now. Now every trigger after the first returns the first workflow. Reproduced with a 5 second cron for 27 seconds: 6 executions without a key, 1 with a key.
| .getBytes(StandardCharsets.UTF_8)) | ||
| .toString()); | ||
| } | ||
| if (input.getIdempotencyStrategy() == IdempotencyStrategy.FAIL) { |
There was a problem hiding this comment.
Only FAIL has a branch. FAIL_ON_RUNNING returns the existing workflow, also while it runs. Reproduced: the second start returns 200 with the same id.
| executionDAOFacade.removeWorkflow(workflowId, false); | ||
| } catch (Exception rwe) { | ||
| LOGGER.error("Could not remove the workflowId: " + workflowId, rwe); | ||
| executionDAOFacade.getWorkflowModelFromExecutionDAO(input.getWorkflowId(), false); |
There was a problem hiding this comment.
This read runs before the lock that startWorkflowIdempotent takes. Two concurrent FAIL starts can both get "not found", and the second then returns the existing workflow. No caller gets the 409.
| } | ||
| throw e; | ||
| } | ||
| return startWorkflowIdempotent(input).getWorkflowId(); |
There was a problem hiding this comment.
A start with no key runs decide in the request. This path only pushes to the decider queue, so the start returns before any task is scheduled. A2AWorkflowAgent.sendMessage reads the workflow immediately after the start and gets no tasks.
| // a crash leaves a queue entry for a workflow that does not exist, which the sweeper | ||
| // removes. The entry is delayed by the offset timeout, so the sweeper does not see it | ||
| // before the row is written. | ||
| queueDAO.push( |
There was a problem hiding this comment.
This holds only if the row write takes less than workflowOffsetTimeout (30 s). After a longer pause between the two writes, the sweeper removes the queue entry as "not found" and the workflow is abandoned again. A transactional start outbox does not depend on timing.
| LOGGER.debug(reason); | ||
| task.setStatus(TIMED_OUT); | ||
| task.setReasonForIncompletion(reason); | ||
| timeoutTaskWithTimeoutPolicy(reason, taskDef, task); |
There was a problem hiding this comment.
TaskDef.timeoutPolicy has no @NotNull, so "timeoutPolicy": null is accepted and the switch in timeoutTaskWithTimeoutPolicy throws an NPE. The response timeout path now reaches it by default. Also, a response timeout now counts in task_timeout as well as in task_response_timeout.
| : input.getName(); | ||
| input.setWorkflowId( | ||
| UUID.nameUUIDFromBytes( | ||
| (name + ":" + input.getIdempotencyKey()) |
There was a problem hiding this comment.
"a:b" + "c" gives the same id as "a" + "b:c". The version and the input are not part of the id. WorkflowModel has no key field, so Workflow.idempotencyKey stays null.
This branch had the native workflow changes and all the changes of #1857. With `main` as the base, the PR showed both. This commit removes what belongs to #1857, so the diff against `main` is native workflows only. Where the native code used a part of #1857: - `WorkflowMessageQueueDAO`: the `claim` default methods stay. The handler lane calls `claim`; without a durable queue it pops. - `WorkflowExecutorOps.decide`: a native wake-up saves the workflow at once. It used the `workflowDirty` flag of #1857. - `WorkflowExecutorOps.rerunWF`: standard workflows rerun as on `main`. A native rerun keeps its plan, starts a new child for a `SUB_WORKFLOW` task, and saves and queues its reopened JOINs. - `Join`: `isExecuteIdempotent` goes with #1857; the live join targets stay. - Tests: `TestDeciderOutcomes` keeps the failure matrix helper for the native matrix. A native test in `TestWorkflowExecutor` verifies `updateTask` in place of `updateTaskIfStatus`. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
WorkflowModel kept failedTaskId but the API's Workflow had no such field, so a failed run never said which task ended it. Taken from #1857 (95d2c72), which carries it with its UI use ("Jump to task"). A native run failing at a patch in a nested loop now returns that task's id; the operator checks pass 66/66.
Each claim in 01, 02, 03, 04, 06, 07 and the README checked against the server
and the SDK, and corrected where they differ:
- markers are kept in nativeState.markers on the workflow row (the API shows
each on its task), so the stored row grows by one marker per pause;
- a completion's variables are applied as sent: no fence on resumedWith;
- pinning: a worker that keeps an execution's code in memory, pin {domain,
stamp}, the pinned queue first with a shared fallback after pinTimeout;
- features of the standard-workflow PR #1857 (idempotent starts, the push
inside a decide, the conditional task save, the discarded-message count) are
marked as not on this branch;
- a diverged attempt is held and retried, not failed; one TERMINATE entry
marks where the code threw; a switch on replay takes its recorded case;
native JOINs are woken with no delay (#1882); lock and decide ordering;
- the SDK's completion retries (3 attempts, 2 s apart), the handler claimant
("handlers"), proto fields, metric and test names, counts, the README path;
- names moved by the split of NativeContinuationService (#1882).
07 stays the plan: its state model, SDK section and drift table now match the
code, with a drift row for pinning, and its opening note lists the later
changes the plan sections do not reflect. 06 keeps its history of bugs found,
with "(since changed: ...)" notes where behavior moved on.
Split out of #1832. That PR now holds only native workflows and is stacked on this one.
Why
#1832 mixed native workflows with fixes for standard workflows: decider bugs found with a TLA+ model of the decider, and bugs found by the durability bench (server, database and worker kills and pauses). These fixes don't depend on native workflows. This PR moves all of them out so they can be reviewed and merged on their own.
Some of this change is also in #1846 (decider), #1847 (durability), #1854 (timeout policy) and #1855 (idempotency key), split out earlier. Those four PRs conflict with each other in
TestWorkflowExecutor, so #1832 can't be stacked on them. This PR is the complete set #1832 builds on. Reviewers can use those four PRs to look at one area at a time. Whichever PRs merge, #1832 is then rebased on what landed.What changed
Decider fixes for standard workflows. These are bugs 1 to 15 in
proposals/workflow-semantics/DECIDER_BUGS.md.COMPLETED_WITH_ERRORS.SUB_WORKFLOWtask, or an older attempt.FAILED.ExecutionDAO.updateTaskIfStatus). The check and the write are atomic on Postgres, MySQL, SQLite and Redis.proposals/workflow-semantics/(Workflow.tla,server_check.py).DecideTrace(-Dconductor.trace.dir) records each decide, soserver_check.pycan compare a server run with the spec step by step. It is off by default.Durability bench fixes
createWorkflowwrites the decider queue entry before the workflow row.scheduleTaskor in aDO_WHILEretries the decide instead of failing the workflow.PULL_WORKFLOW_MESSAGEShold their queue message only briefly (isExecuteIdempotent).Workflow message queue
WorkflowExecutor.decide(workflowId, change)).workflow_messages_discarded).Also
timeoutPolicy.PUT /api/workflow/{id}/skiptask/{ref}) now reads its JSON body.failedTaskId).failedTaskId.docs/llms-full.txtis regenerated.Behaviour changes (release notes)
timeoutPolicy. Before, it always retried the task.RETRYretries the task.TIME_OUT_WF, the default, times the workflow out.ALERT_ONLYonly logs.totalTimeoutSecondsbudget. Automatic retries keep the old budget.How it was split
This branch is #1832's tree with the native-workflow code removed. That covers
NativeContinuationService, the continuation markers andNativeState, the native-code evaluator, the native paths in the decider, the executor, JOIN and poll, the gRPC mappings, the native UI views andproposals/native-workflows/. The branch is then rebased onmain. Nothing outside native workflows was changed. The only exception is wording: comments,DECIDER_BUGS.mdand the spec README that referred to native workflows.Testing
All runs are on this branch, rebased on
main:spotlessCheckis clean.PostgresLockDAOTest.testLockAcquisitionAndReleasefailed once on its lease-timing check and passed on a rerun. It is flaky onmaintoo.SimpleWorkflowSpecpasses 14/14.tscis clean.persistCopyInLocalStorage > rejects and drops the stale draft when the quota is exceededfails, and it fails the same way onmain.server_check.py --tests 100 --size 4 --seed 2026matches the spec step by step for 96 of 100 runs. The same 4 runs fail on Code native workflows #1832's previous tip, so they predate the split. All 4 are operator reruns:s2026x6,s2026x49,s2026x97: a rerun from a copy inside a dynamic fork of sub-workflows endsFAILED.s2026x59: a rerun from a task endsCOMPLETEDwith that taskCANCELED.🤖 Generated with Claude Code