Skip to content

Fix transitive duplicate task rerun requests - #283

Open
P1naCol4da wants to merge 5 commits into
StackStorm:masterfrom
P1naCol4da:fix/transitive-rerun-request-dedup
Open

P1naCol4da wants to merge 5 commits into
StackStorm:masterfrom
P1naCol4da:fix/transitive-rerun-request-dedup

Conversation

@P1naCol4da

Copy link
Copy Markdown

Summary

This PR fixes a remaining issue in Orquesta's task rerun request deduplication logic, where transitive descendant tasks may be scheduled redundantly.

For a previously completed workflow:

task1 -> task2 -> task3

Requesting a rerun of both task1 and task3 can incorrectly schedule both tasks, even though rerunning task1 will naturally lead to task3.

This extends the duplicate-rerun handling introduced in #188 to deeper task chains and overlapping rerun requests.

Root Cause

Two issues were identified in orquesta/conducting.py:

  1. Incomplete descendant traversal: WorkflowState.get_task_sequence() appends a descendant to the sequence before checking whether it has already been included. Consequently, the traversal does not continue beyond immediate successors.

  2. Incorrect request collapsing: WorkflowConductor._collapse_task_rerun_requests() retains a candidate when its task sequence differs from any other candidate, rather than checking whether another requested task subsumes it.

Together, these conditions allow redundant descendant rerun requests to remain scheduled.

Changes

This PR introduces the following changes:

  • Track visited task-state indices to enable transitive descendant traversal.
  • Correct rerun request collapsing using strict subset comparisons.
  • Add six self-contained regression tests covering:
    • Three-task sequential workflows
    • Multiple overlapping rerun requests
    • Four-task sequential workflows
    • Branching workflows
    • Independent sibling task requests
    • Single-task rerun requests

The changes are limited to the workflow conductor implementation and a new regression test file.

Validation

Previously tested against upstream commit 2d523c6aebacb189c3d6aa3b6973e306ad118b24.

Existing upstream test suite:

  • Original implementation: 868/868 passed
  • Patched implementation: 868/868 passed

New regression tests:

  • Original implementation: 4 failed, 2 passed
  • Patched implementation: 6/6 passed

Combined test suite:

  • Patched implementation: 874/874 passed

The four failing regression cases reproduce the targeted behavior on the original implementation. All six new tests pass after applying the proposed fix.

The test results were obtained in a CPU-only environment and independently checked against recorded JUnit XML results and source/patch hashes.

GitHub CI results for this PR have not yet been verified.

Scope and Limitations

The regression tests exercise Orquesta's actual workflow conductor using simulated action completion events.

The following limitations apply:

  • No end-to-end testing was performed in a deployed StackStorm environment.
  • Correctness across all cyclic workflows, multiple execution routes, and with-items scenarios has not been formally established.
  • No production security vulnerability or real-world exploitability is claimed.

This PR addresses a reproducible workflow execution correctness issue and does not introduce a new workflow scheduling algorithm.

Related Work

PR #188, merged in 2020, introduced handling for duplicate task rerun requests.

However, the current implementation still fails to correctly collapse certain transitive descendant requests in deeper task chains and overlapping request combinations.

This PR builds upon the existing implementation by addressing those remaining cases and introducing additional regression coverage.

Review Notes

Feedback on the expected rerun semantics, edge cases, and the proposed implementation is welcome.

Additional regression tests or adjustments can be incorporated based on maintainer feedback.

@CLAassistant

CLAassistant commented Nov 6, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@P1naCol4da
P1naCol4da marked this pull request as ready for review November 6, 2026 07:02
P1naCol4da added a commit to P1naCol4da/orquesta that referenced this pull request Nov 7, 2026
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