fix(cli): atomic trace-consent updates and drop unused re-exports

- traces enable/disable now use update_user_data (file-locked atomic
  read-modify-write) instead of bare _load_user_data + _save_user_data —
  prevents data loss under concurrent CLI invocations.
- Drop unused _get_nested_value / _get_project_attribute re-exports from
  crewai_cli.utils and crewai.utilities.project_utils — no callers.
- Mark crewai.events.listeners.tracing.utils re-exports via __all__ so
  CodeQL recognizes _save_user_data, is_tracing_enabled, update_user_data
  (and the other tracing helpers defined in the file) as public API.
This commit is contained in:
Greyson Lalonde
2026-05-05 21:38:45 +08:00
parent 832fdb7c5d
commit ed0f4f9dbb
4 changed files with 29 additions and 15 deletions

View File

@@ -32,6 +32,32 @@ from rich.text import Text
from crewai.utilities.serialization import to_serializable
__all__ = [
"_load_user_data",
"_save_user_data",
"_user_data_file",
"_user_data_lock_name",
"get_user_id",
"has_user_declined_tracing",
"is_first_execution",
"is_tracing_enabled",
"is_tracing_enabled_in_context",
"mark_first_execution_completed",
"mark_first_execution_done",
"on_first_execution_tracing_confirmation",
"prompt_user_for_trace_viewing",
"reset_tracing_enabled",
"safe_serialize_to_dict",
"set_suppress_tracing_messages",
"set_tracing_enabled",
"should_auto_collect_first_time_traces",
"should_enable_tracing",
"should_suppress_tracing_messages",
"truncate_messages",
"update_user_data",
]
logger = logging.getLogger(__name__)

View File

@@ -14,8 +14,6 @@ import types
from typing import Any, cast, get_type_hints
from crewai_core.project import (
_get_nested_value as _get_nested_value,
_get_project_attribute as _get_project_attribute,
get_project_description as get_project_description,
get_project_name as get_project_name,
get_project_version as get_project_version,