diff --git a/lib/cli/src/crewai_cli/run_declarative_flow.py b/lib/cli/src/crewai_cli/run_declarative_flow.py index 7b6ff8347..d263d9fa0 100644 --- a/lib/cli/src/crewai_cli/run_declarative_flow.py +++ b/lib/cli/src/crewai_cli/run_declarative_flow.py @@ -102,6 +102,16 @@ def _run_declarative_flow_tui(flow: Any, resolved_inputs: dict[str, Any] | None) # listener, and the TUI's trace/telemetry features depend on it. EventListener() + # The STEPS panel and header are driven by flow method events. A flow may + # declare ``config.suppress_flow_events`` (a headless/production + # optimization) which would leave STEPS stuck on "waiting…" here — so force + # emission on for the interactive TUI run. The headless path never reaches + # this and keeps the flow's declared setting. + try: + flow.suppress_flow_events = False + except Exception: # noqa: S110 + pass + app = CrewRunApp(crew_name=getattr(flow, "name", None) or type(flow).__name__) app._flow = flow app._flow_inputs = resolved_inputs diff --git a/lib/cli/tests/test_run_declarative_flow.py b/lib/cli/tests/test_run_declarative_flow.py index c0b86fc42..10167c820 100644 --- a/lib/cli/tests/test_run_declarative_flow.py +++ b/lib/cli/tests/test_run_declarative_flow.py @@ -540,6 +540,19 @@ def test_run_declarative_flow_tui_no_deploy_when_not_requested( assert deploy_calls == [] +def test_run_declarative_flow_tui_enables_flow_events( + monkeypatch: pytest.MonkeyPatch, +) -> None: + # The STEPS panel depends on flow method events; a flow that declared + # suppress_flow_events must have it forced off for the interactive TUI run. + _install_fake_flow_app(monkeypatch, status="completed") + flow = SimpleNamespace(name="Flow", suppress_flow_events=True) + + run_declarative_flow_module._run_declarative_flow_tui(flow, None) + + assert flow.suppress_flow_events is False + + def test_flow_method_types_from_definition() -> None: flow = SimpleNamespace( _definition=SimpleNamespace(