mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-04-07 19:48:13 +00:00
* fix(telemetry): skip signal handler registration in non-main threads When CrewAI is initialized from a non-main thread (e.g. Streamlit, Flask, Django, Jupyter), the telemetry module attempted to register signal handlers which only work in the main thread. This caused multiple noisy ValueError tracebacks to be printed to stderr, confusing users even though the errors were caught and non-fatal. Check `threading.current_thread() is not threading.main_thread()` before attempting signal registration, and skip silently with a debug-level log message instead of printing full tracebacks. Fixes crewAIInc/crewAI#4289 * fix(test): move Telemetry() inside signal.signal mock context Refs: #4649 * fix(telemetry): move signal.signal mock inside thread to wrap Telemetry() construction The patch context now activates inside init_in_thread so the mock is guaranteed to be active before and during Telemetry.__init__, addressing the Copilot review feedback. Refs: #4289 * fix(test): mock logger.debug instead of capsys for deterministic assertion Replace signal.signal-only mock with combined logger + signal mock. Assert logger.debug was called with the skip message and signal.signal was never invoked from the non-main thread. Refs: #4289