mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-06 17:52:35 +00:00
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:
@@ -33,8 +33,8 @@ from crewai_cli.triggers.main import TriggersCommand
|
||||
from crewai_cli.update_crew import update_crew
|
||||
from crewai_cli.user_data import (
|
||||
_load_user_data,
|
||||
_save_user_data,
|
||||
is_tracing_enabled,
|
||||
update_user_data,
|
||||
)
|
||||
from crewai_cli.utils import build_env_with_all_tool_credentials, read_toml
|
||||
|
||||
@@ -794,11 +794,7 @@ def traces_enable() -> None:
|
||||
|
||||
console = Console()
|
||||
|
||||
# Update user data to enable traces
|
||||
user_data = _load_user_data()
|
||||
user_data["trace_consent"] = True
|
||||
user_data["first_execution_done"] = True
|
||||
_save_user_data(user_data)
|
||||
update_user_data({"trace_consent": True, "first_execution_done": True})
|
||||
|
||||
panel = Panel(
|
||||
"✅ Trace consent recorded.\n\n"
|
||||
@@ -820,11 +816,7 @@ def traces_disable() -> None:
|
||||
|
||||
console = Console()
|
||||
|
||||
# Update user data to disable traces
|
||||
user_data = _load_user_data()
|
||||
user_data["trace_consent"] = False
|
||||
user_data["first_execution_done"] = True
|
||||
_save_user_data(user_data)
|
||||
update_user_data({"trace_consent": False, "first_execution_done": True})
|
||||
|
||||
panel = Panel(
|
||||
"❌ Trace collection has been disabled!\n\n"
|
||||
|
||||
@@ -7,8 +7,6 @@ from typing import Any
|
||||
|
||||
import click
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user