ui.genetic_miner: the genetic miner reruns on every interaction after a failed run #12

Open
opened 2026-10-06 13:46:25 +00:00 by ffrauenberger · 1 comment
Owner

Severity: medium (after one failure, every click starts a full genetic run)

Where

  • app/ui/genetic_miner_ui/genetic_miner_controller.py:136-150, :165-194
  • app/ui/genetic_miner_ui/genetic_miner_view.py:81-83

Problem

The Run Genetic Mining button sets st.session_state.rerun_genetic_miner = True. The flag is only reset at the end of a successful perform_mining():

super().perform_mining(...)
# Reset the rerun flag after run
st.session_state.rerun_genetic_miner = False

If mining raises (e.g. a GraphException from #7, or any Exception caught at line 190), the flag stays True. Both run() and have_parameters_changed() check it, so every subsequent interaction (toggling Show Happy Path, opening an expander, …) starts the full genetic algorithm again. With the defaults that is 500 individuals × 100 generations, and it fails again each time.

Steps to reproduce

  1. Open the application
  2. Import a log that makes the genetic miner fail (e.g. one with an activity named Start, see #7)
  3. Select the Genetic Miner and click Run Genetic Mining
  4. After the error, toggle Show Happy Path or open an expander

Expected behavior

The miner only runs again when the user clicks Run Genetic Mining.

Actual behavior

The full genetic run starts again on every interaction.

Fix

Reset the flag in a finally: block, or before starting the run.


from issues/BUG-012-genetic-rerun-flag-not-reset-after-failure.md (code analysis of commit 6bcc646, 2026-10-03)

**Severity:** medium (after one failure, every click starts a full genetic run) ## Where - `app/ui/genetic_miner_ui/genetic_miner_controller.py:136-150`, `:165-194` - `app/ui/genetic_miner_ui/genetic_miner_view.py:81-83` ## Problem The *Run Genetic Mining* button sets `st.session_state.rerun_genetic_miner = True`. The flag is only reset at the end of a **successful** `perform_mining()`: ```python super().perform_mining(...) # Reset the rerun flag after run st.session_state.rerun_genetic_miner = False ``` If mining raises (e.g. a `GraphException` from #7, or any `Exception` caught at line 190), the flag stays `True`. Both `run()` and `have_parameters_changed()` check it, so every subsequent interaction (toggling *Show Happy Path*, opening an expander, …) starts the full genetic algorithm again. With the defaults that is 500 individuals × 100 generations, and it fails again each time. ### Steps to reproduce 1. Open the application 2. Import a log that makes the genetic miner fail (e.g. one with an activity named `Start`, see #7) 3. Select the Genetic Miner and click *Run Genetic Mining* 4. After the error, toggle *Show Happy Path* or open an expander ### Expected behavior The miner only runs again when the user clicks *Run Genetic Mining*. ### Actual behavior The full genetic run starts again on every interaction. ## Fix Reset the flag in a `finally:` block, or before starting the run. --- from `issues/BUG-012-genetic-rerun-flag-not-reset-after-failure.md` (code analysis of commit 6bcc646, 2026-10-03)
Author
Owner

Reviewed by Codex (GPT-6) against origin/main 6bcc646eb464.

Review: partially correct.

The missing finally reset is a real bug. Please replace “every interaction” with “every interaction that triggers a script rerun.” The ordinary st.expander used here has no state callback; merely opening it does not invoke another genetic run. A widget toggle does. Also, the expected behavior is not exclusively “only the Run button”: have_parameters_changed() deliberately includes shared log-filter changes (lines 109–111), and the page's information text advertises that behavior. The fix should prevent unrelated reruns from restarting a failed run while preserving intended filter-triggered mining.

Code references: app/ui/genetic_miner_ui/genetic_miner_controller.py:136, app/ui/genetic_miner_ui/genetic_miner_controller.py:100, app/ui/genetic_miner_ui/genetic_miner_view.py:13.

Reviewed by **Codex (GPT-6)** against origin/main [`6bcc646eb464`](https://code.swisdata.eu/ffrauenberger/ProcessIntel/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4). **Review: partially correct.** The missing `finally` reset is a real bug. Please replace “every interaction” with “every interaction that triggers a script rerun.” The ordinary `st.expander` used here has no state callback; merely opening it does not invoke another genetic run. A widget toggle does. Also, the expected behavior is not exclusively “only the Run button”: `have_parameters_changed()` deliberately includes shared log-filter changes (lines 109–111), and the page's information text advertises that behavior. The fix should prevent unrelated reruns from restarting a **failed** run while preserving intended filter-triggered mining. Code references: [app/ui/genetic_miner_ui/genetic_miner_controller.py:136](https://code.swisdata.eu/ffrauenberger/ProcessIntel/src/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4/app/ui/genetic_miner_ui/genetic_miner_controller.py#L136), [app/ui/genetic_miner_ui/genetic_miner_controller.py:100](https://code.swisdata.eu/ffrauenberger/ProcessIntel/src/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4/app/ui/genetic_miner_ui/genetic_miner_controller.py#L100), [app/ui/genetic_miner_ui/genetic_miner_view.py:13](https://code.swisdata.eu/ffrauenberger/ProcessIntel/src/commit/6bcc646eb464e0dd897228b5e49867f65d7255c4/app/ui/genetic_miner_ui/genetic_miner_view.py#L13).
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ffrauenberger/ProcessIntel#12
No description provided.