From b8c671042c8340180d1279fbf79e09b61f45bde0 Mon Sep 17 00:00:00 2001 From: Greyson Lalonde Date: Tue, 5 May 2026 05:18:25 +0800 Subject: [PATCH] fix(traces): align consent semantics with framework, clarify enable message --- lib/cli/src/crewai_cli/cli.py | 7 ++++--- lib/cli/src/crewai_cli/user_data.py | 14 +++++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/cli/src/crewai_cli/cli.py b/lib/cli/src/crewai_cli/cli.py index c8010e7c6..3d683687c 100644 --- a/lib/cli/src/crewai_cli/cli.py +++ b/lib/cli/src/crewai_cli/cli.py @@ -801,9 +801,10 @@ def traces_enable() -> None: _save_user_data(user_data) panel = Panel( - "✅ Trace collection has been enabled!\n\n" - "Your crew/flow executions will now send traces to CrewAI+.\n" - "Use 'crewai traces disable' to turn off trace collection.", + "✅ Trace consent recorded.\n\n" + "To activate trace collection, set [bold]CREWAI_TRACING_ENABLED=true[/bold] " + "in your environment or .env file.\n" + "Use 'crewai traces disable' to revoke consent.", title="Traces Enabled", border_style="green", padding=(1, 2), diff --git a/lib/cli/src/crewai_cli/user_data.py b/lib/cli/src/crewai_cli/user_data.py index dba02658b..63f82ae6e 100644 --- a/lib/cli/src/crewai_cli/user_data.py +++ b/lib/cli/src/crewai_cli/user_data.py @@ -58,14 +58,14 @@ def _save_user_data(data: dict[str, Any]) -> None: def is_tracing_enabled() -> bool: """Check if tracing is enabled. - Returns True when the user has positively consented (e.g. via - ``crewai traces enable``), False when they have declined, and falls back - to the ``CREWAI_TRACING_ENABLED`` env var when consent is unset. + Mirrors ``crewai.events.listeners.tracing.utils.is_tracing_enabled``: + consent only *blocks* tracing; activation requires + ``CREWAI_TRACING_ENABLED=true``. """ data = _load_user_data() - trace_consent = data.get("trace_consent") - if trace_consent is True: - return True - if data.get("first_execution_done", False) and trace_consent is False: + if ( + data.get("first_execution_done", False) + and data.get("trace_consent", False) is False + ): return False return os.getenv("CREWAI_TRACING_ENABLED", "false").lower() == "true"