Repository navigation
feat(cli): add crewai doctor for login, tracing and integration checks - #8609
joaomdmoura wants to merge 5 commits into
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Strix Security ReviewWarning This pull request has 36 commits after the last Strix review ( To fix before merging (1)
PR summary: Adds a `crewai doctor [--app SELECTOR]...` CLI command that prints one `<status> <check>: <detail>` line for login, tracing, and each `--app` integration check, exiting 1 when any check fails, and aligns the tracing helpers so `CREWAI_TRACING_ENABLED=false` disables tracing even when consent is recorded. Review summaryThe PR adds a read-only One issue was confirmed dynamically by running the real command against recording servers: Cleared areas: the login check performs no network call and no secret value is printed by any check (only variable names and the base URL); the Fixed the findings? re-run the review, or tag Review 1 on this PR · Reviewed by Strix |
861f77b to
f0ab539
Compare
alex-clawd
left a comment
There was a problem hiding this comment.
Approving the command. One sequencing note.
This is stacked on #8608 — git merge-base --is-ancestor confirms #8609 contains #8608’s two commits, which is why both show the same user_data.py, eval_crew.py and test_tracing_gate_parity.py changes. So #8608 merges first, and this one shrinks to the four crewai doctor commits on top. Nothing to change in the code; it just should not land in the other order.
On the command itself: crewai doctor is the right shape for a tool whose failures are usually environmental — login state, tracing config, integration reachability — and where the current answer is "read the error and guess." 719 lines of tests against 282 of implementation.
The three follow-up commits read like real findings from using it rather than planned work:
- naming the trace credential a run actually sends
- sending the integration token only to a machine-configured AMP
- pinning the machine transport after
doctorimportscrewai_tools
The second is the one I would have flagged if it were not already handled — a diagnostic command that sends a token somewhere unintended is a worse bug than the one it is diagnosing. Good that it is scoped to a machine-configured AMP.
aa66156 to
7d5d336
Compare
7d5d336 to
b6930a3
Compare
A coding agent needed three commands and a Python recipe to learn a project's AMP state, and the login commands exit 0 when logged out. `crewai doctor [--app SELECTOR]...` loads the project's .env like `crewai run`, prints one `<status> <check>: <detail>` line per check (login and selected org, tracing on/off with its reason and destination, one line per --app selector), and exits 1 when any check fails. The login and tracing checks are local. The integration check makes the same GET `CrewaiPlatformTools` makes, with CREWAI_ENTERPRISE_ACTION_AUTH_TOKEN; it never calls /me/integration-token, which writes on AMP. Tracing off is a warn, never a fail. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The tracing line now follows the runtime's credential order (CREWAI_USER_PAT, then CREWAI_ENTERPRISE_ACTION_AUTH_TOKEN, then the login), pinned by a parity test against grants.tracing_credential_source. An env false now points at the variable instead of `crewai traces enable`, a non-JSON answer is no longer "could not reach AMP", a valueless .env key no longer claims the source, and one action reads "1 action". The doctor docs section sits at the end of the page in every language. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… in crewai doctor `crewai doctor --app` loaded the project's .env and then sent CREWAI_ENTERPRISE_ACTION_AUTH_TOKEN to whatever CREWAI_PLUS_URL, proxy, CA bundle or CREWAI_FACTORY verification setting that .env chose, so a cloned project could collect a token it did not supply. The trusted AMP origins (a shell CREWAI_PLUS_URL, the configured enterprise URL, crewAI's own) are now read before the .env loads, as `crewai eval` already does. The token goes only to one of them over HTTPS or loopback HTTP, through the machine's proxy, CA and verification settings; anything else fails the check without sending it. The token value itself may still come from the project's .env. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…i_tools Importing crewai_tools imports crewai, and `crewai.llm` calls load_dotenv(), which finds the project's .env again. Without override it still restored every key doctor had just removed, so the integrations GET went out with the project's CREWAI_FACTORY (verify off), CA bundle and proxy. The pin now runs after that import, right before the request. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A project created before #7990 sets only CREWAI_PLATFORM_INTEGRATION_TOKEN, which crews no longer read. doctor said CREWAI_ENTERPRISE_ACTION_AUTH_TOKEN was not set, the misleading message #8636 removed from the integrations client. It now gives the same rename instruction the crew's error does. Co-Authored-By: Claude Opus 5.5 <[email protected]>
b6930a3 to
bfee40d
Compare
alex-clawd
left a comment
There was a problem hiding this comment.
Re-approving. The stacking is resolved and the one new commit is a good catch.
No longer stacked
When I looked on the 27th this contained #8608's commits and I flagged the merge order. #8608 merged at 03:04Z, so the branch is now just its own five crewai doctor commits against current main — +1156/-0, down from +1288/-10. Nothing to sequence any more.
The new commit closes a real gap
bfee40dea is a direct consequence of #8636, which I reviewed on Monday. That PR fixed the crew's error for projects still setting the pre-rename variable:
CREWAI_PLATFORM_INTEGRATION_TOKENis set, but CrewAI now reads the Enterprise Action Auth Token only fromCREWAI_ENTERPRISE_ACTION_AUTH_TOKEN
But doctor had its own copy of the check and still said the new variable was "not set" — the exact misleading message #8636 removed. So the diagnostic tool would have contradicted the runtime error, which is close to the worst outcome for a command whose whole job is telling you what is wrong with your environment. Someone would trust doctor, conclude they had no token at all, and go set a second one.
Now both paths give the same rename instruction:
missing = (
f"{LEGACY_INTEGRATION_TOKEN_ENV} is set, but CrewAI now reads the "
f"token only from {INTEGRATION_TOKEN_ENV}; rename the variable in "
"your .env, the value stays the same"
if os.environ.get(LEGACY_INTEGRATION_TOKEN_ENV)
else f"{INTEGRATION_TOKEN_ENV} is not set in the environment or .env"
)The Remove in 2.0 note is on the branch itself, which is where it will be seen. Same pattern as #8636 — worth grepping both when 2.0 comes around, since this is now the second copy of that deprecation.
Also worth noting it does not read the legacy value, only its presence. Consistent with #7990's intent: the message is a signpost, not a fallback.
Standing observations
The other four commits are unchanged from my earlier review, and the two I called out still read as real findings from using the tool rather than planned work — scoping the integration token to a machine-configured AMP, and pinning the machine transport after doctor imports crewai_tools. A diagnostic command that leaks a token while diagnosing would be worse than the problem it reports.
All checks green across 3.10–3.13. Mintlify Validation - vale-spellcheck is NEUTRAL and link-rot is still running; neither gates, and docs changes here are additive CLI reference in four locales.
|
Closing without merging. A public command needs a caller, and this one has none yet.
Worth keeping if this comes back: the token-origin gate and the transport pin after the |
No single command tells a person or a coding agent whether this project is logged in to AMP, whether its runs are traced and with which credential, and whether an
apps=[...]selector resolves.crewai doctor [--app SELECTOR]...prints one<status> <check>: <detail>line per check (ok/warn/fail/skip) and exits 1 when any check fails.loginis local only (saved token + selected org);tracingloads the project.envascrewai rundoes and names the credential a run sends (PAT, then integration token, then login);--appmakes the same actions GETCrewaiPlatformToolsmakes, never/me/integration-token, and sends the token only to a machine-configured AMP over HTTPS, through the machine's proxy, CA and TLS settings (pinned after thecrewai_toolsimport, which reloads the.env).CREWAI_PLATFORM_INTEGRATION_TOKENis told to rename it, as the crew's own error says.lib/cli/tests/test_doctor.py(42 tests, including where the token may go and one that makes every non-GET request raise) runs in CI now that ci: run the lib/cli, crewai-core and crewai-files tests in the pr matrix #8603 has merged; the credential-order parity test inlib/crewai/tests/tracingruns now.docs/edge/{en,ar,ko,pt-BR}/concepts/cli.mdx.--json. Needs Linear tickets:LegacyClient.get_actionscrashes on AMP's{"actions": []}error reply (doctor fails with the AttributeError), and the AGENTS.md template update waits on T5.🤖 Generated with Claude Code