Repository navigation
fix(core): treat an env tracing false as off in is_tracing_enabled - #8608
Conversation
Strix Security ReviewWarning This pull request has 31 commits after the last Strix review ( ✅ No open security findings. PR summary: This PR makes the CLI's tracing-state helper `is_tracing_enabled` treat `CREWAI_TRACING_ENABLED=false`/`0` as an explicit off (matching the runtime tracing gate), shows an unset variable as "not set" in `crewai traces status`, and makes `crewai eval`'s `tracing_already_on` consult the project `.env` before the process environment. Review summaryI reviewed all seven changed files: the Ruled out (1)
Review 1 on this PR · Reviewed by Strix |
70102b3 to
d90f207
Compare
alex-clawd
left a comment
There was a problem hiding this comment.
Approving. CREWAI_TRACING_ENABLED=false was not actually turning tracing off:
if os.getenv("CREWAI_TRACING_ENABLED", "false").lower() in ("true", "1"):
return True
if has_user_declined_tracing():
return FalseAn explicit false fell straight through to the consent check, so a user who had previously consented kept tracing on despite setting the env var to disable it. Setting a variable to false and having it ignored is worse than the variable not existing — it looks like an off switch and is not one.
The fix reads the value once and handles both directions, with false/0 checked before true/1, so explicit intent always beats recorded consent.
test_tracing_gate_parity.py is the right addition: the docstring claims this mirrors should_enable_tracing, and now a test holds the two in step rather than a comment asserting it.
…abled `crewai_core.user_data.is_tracing_enabled` says it mirrors the runtime gate, but it ignored an explicit `CREWAI_TRACING_ENABLED=false`/`0`, so with a consent recorded `crewai traces status` showed ENABLED while runs were not traced (`should_enable_tracing` returns False there). It now returns False for false/0, like the runtime gate. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…eval `traces status` printed `false` for an unset CREWAI_TRACING_ENABLED, which now reads differently from an explicit false. `tracing_already_on` reads the project .env first, as `tracing_turned_off` does, so a shell false under a .env true no longer re-asks for consent. Co-Authored-By: Claude Opus 5.5 <[email protected]>
d90f207 to
0a82ef4
Compare
crewai_core.user_data.is_tracing_enabledignoredCREWAI_TRACING_ENABLED=falseonce consent was recorded, socrewai traces statussaid ENABLED while runs went untraced. It now returns False forfalse/0, as the runtimeshould_enable_tracingdoes.traces statusshows an unset variable asnot setinstead offalse, andcrewai eval'stracing_already_onreads the project.envfirst, so a.envtrue still beats a shell false.is_tracing_enabledand its callers,traces statusandeval_crew.tracing_already_on(also behind the run app's Evaluate button).crewai.events.listeners.tracing.utilsandcrewai_cli.user_datachange only for false/0 with consent; other env/consent combinations are pinned unchanged.should_enable_tracing(runs in CI); thetraces statusandtracing_already_oncaller tests fail on main, but lib/cli tests only run in CI onceci/ci-cli-core-files-testslands.crewai doctor: feat(cli): add crewai doctor for login, tracing and integration checks #8609 (feat/cli-doctor) stacks on this one; this one merges on its own.traces statusstill ignores the project.env(needs a Linear ticket); no change toshould_enable_tracing; no docs change, since the docs already say false turns tracing off.🤖 Generated with Claude Code