Skip to content

fix: evaluate activation conditions outside the workflow executor's monitor - #3626

Open
afalhambra-hivemq wants to merge 1 commit into
operator-framework:nextfrom
afalhambra-hivemq:fix/activation-start-outside-monitor-3617
Open

afalhambra-hivemq wants to merge 1 commit into
operator-framework:nextfrom
afalhambra-hivemq:fix/activation-start-outside-monitor-3617

Conversation

@afalhambra-hivemq

Copy link
Copy Markdown
Contributor

Moves the activation condition evaluation and the event source register/deregister out of handleReconcile and into NodeReconcileExecutor, so the blocking informer sync no longer happens while the executor's monitor is held.

Turns out the delete and cleanup paths already do it this way (NodeDeleteExecutor.doRun and CleanupExecutor.doRun), so this is mostly making the reconcile path consistent with them rather than inventing anything.

Two things worth knowing:

  • the not-met branch needs unmarkAsExecuting before it cascades, because a parentless node is its own bottom node when marked for delete and handleDelete skips a node that is executing. The cascade itself is kept under the monitor: markDependentsForDelete walks the parents and the cascade reads that back, so two of them interleaving see each other's partial state. I had this wrong at first and the workflow tests caught it intermittently, about 2 runs in 5.
  • it also makes a throwing activation condition on a top-level dependent behave like one on any other dependent, aggregated rather than propagated raw. Non top-level ones already go through NodeExecutor's catch.

The new test asserts the condition is not evaluated on the reconciling thread, which fails if the evaluation moves back under the monitor.

Fixes #3617

Copilot AI lite review requested due to automatic review settings September 17, 2026 16:58
@openshift-ci
openshift-ci Bot requested review from metacosm and xstefank September 17, 2026 16:58
@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 808fffe9-d05d-4f4f-91bd-1d03b5d6523f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…onitor

Signed-off-by: Antonio Fernandez Alhambra <antonio.alhambra@hivemq.com>
@afalhambra-hivemq
afalhambra-hivemq force-pushed the fix/activation-start-outside-monitor-3617 branch from 542a697 to 6313ad4 Compare September 17, 2026 17:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Pull request overview

Aligns reconcile execution with delete/cleanup paths by moving activation/precondition evaluation and event source registration out from under the WorkflowReconcileExecutor monitor to reduce blocking while holding the lock.

Changes:

  • Moved activation condition + event source register/deregister into NodeReconcileExecutor.doRun
  • Added unmarkAsExecuting helper to support the “conditions not met” cascade semantics
  • Added a test to ensure activation condition isn’t evaluated on the reconciling thread

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
operator-framework-core/src/test/java/io/javaoperatorsdk/operator/processing/dependent/workflow/WorkflowReconcileExecutorTest.java Adds a regression test asserting activation conditions run off the reconciling thread
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/workflow/WorkflowReconcileExecutor.java Moves condition evaluation + event source registration out of the monitor and adjusts “not met” path
operator-framework-core/src/main/java/io/javaoperatorsdk/operator/processing/dependent/workflow/AbstractWorkflowExecutor.java Introduces unmarkAsExecuting helper for early execution relinquish

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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