dcmaf opened a new issue, #6906: URL: https://github.com/apache/incubator-kie/issues/6906
### Describe the bug @tkobayas This appears to be a remaining auto-focus path not covered by the fixes for [#6421](https://github.com/apache/incubator-kie/issues/6421). Issue #6421 was fixed by adding haltGroupEvaluation() after a successful auto-focus setFocus(...) call in AlphaTerminalNode, for both insert and update paths. However, the equivalent auto-focus handling in PhreakRuleTerminalNode still calls setFocus(...) without halting the currently active group evaluator. On current main, both doLeftInserts and doLeftUpdates contain logic equivalent to: ```java if (rtnNode.getRule().getAutoFocus() && !ruleAgendaItem.getAgendaGroup().isActive()) { activationsManager.getAgendaGroupsManager().setFocus(ruleAgendaItem.getAgendaGroup()); } ``` When this occurs while another group is being evaluated, the prior group evaluator can continue and fire a pending activation while the auto-focused group is on top of the focus stack. The attached patch applies the same approach used to resolve #6421: ```java if (activationsManager.getAgendaGroupsManager().setFocus(ruleAgendaItem.getAgendaGroup())) { activationsManager.haltGroupEvaluation(); } ``` It centralizes that logic in PhreakRuleTerminalNode.autoFocusIfNeeded(...) and applies it to both doLeftInserts and doLeftUpdates. Attachments: - PhreakRuleTerminalNodeAutoFocusTest.java — minimal regression test, intended for drools-core/src/test/java/org/drools/core/phreak. - drools-10.2-autofocus-halting.patch — implementation patch [drools-autofocus-issue-attachments.zip](https://github.com/user-attachments/files/31280542/drools-autofocus-issue-attachments.zip) The attached test fails with the current 10.2 build and the issue appears to still be present in main. The test passes with the attached patch applied. ### Expected behavior 1. A rule in primaryGroup creates an activation of a rule in autoFocusGroup which has auto-focus true. 3. autoFocusGroup is pushed onto the focus stack. 4. Evaluation of primaryGroup stops. 5. The auto-focused rule fires before any pending rule in primaryGroup. ### Actual behavior Actual behavior: The active primaryGroup evaluator can continue to fire. In the attached test, the expected event order is: ``` [auto-focus, process-target, process-source] ``` Without the fix, the observed result is: ``` [process-source] ``` ### How to Reproduce? See the attached Java unit test. ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Kogito version or git rev (or at least Quarkus version if you are using Kogito via Quarkus platform BOM) _No response_ ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
