diff --git a/src/dx_productivity/trial_task_center/ui/main_window.py b/src/dx_productivity/trial_task_center/ui/main_window.py index 2b4ff64..9d47685 100644 --- a/src/dx_productivity/trial_task_center/ui/main_window.py +++ b/src/dx_productivity/trial_task_center/ui/main_window.py @@ -854,6 +854,11 @@ class TrialTaskCenterWindow(QMainWindow): except Exception as error: operation_error = error self._close_pending = False + if execution: + # A result renderer is part of the worker lifecycle. + # If it fails, release the execution controls just as + # the service failure path does. + self._finish_run() self.operation_state = self.operation_state.finish(error) self._show_error(error) def failed(error): diff --git a/tests/ui/test_trial_task_center_workflow.py b/tests/ui/test_trial_task_center_workflow.py index 5de50fe..f02344f 100644 --- a/tests/ui/test_trial_task_center_workflow.py +++ b/tests/ui/test_trial_task_center_workflow.py @@ -60,6 +60,17 @@ def test_regular_mutation_locks_navigation_until_completion(ui,qtbot): ui.open(ui.tasks[1]) +def test_execution_callback_failure_releases_run_controls(ui,qtbot): + w=ui.window + w._begin_run(ui.tasks[0].task_id) + w._run_async(lambda: 'result', lambda _result: (_ for _ in ()).throw(RuntimeError('render failed')), + expected_task_id=ui.tasks[0].task_id) + ui.settle() + assert w._batch_stop is None + assert not w.run_panel.busy_indicator.isVisible() + assert not w.run_panel.force_stop_button.isVisible() + + def test_close_during_execution_requests_boundary_pause_and_waits(ui,qtbot): w=ui.window;started,release=Event(),Event() def work():