@devries-cameron20 / composio-1 / commits / 40221d8db
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

fix(python): clarify missing API key recovery (#5226)

Linear: [DEVREL-308](https://linear.app/composio/issue/DEVREL-308/missing-key-error-points-to-unavailable-cli-login) ## Problem The published composio 0.31.0 wheel and origin/next at e8782784b9af1cdc46895554235b6cf51398e04c both raised an error ending in `or run composio login`, although the Python distribution supplied neither that executable nor a module entry point. Reproduced both installed artifacts with credentials unset and network access blocked. Gauge recommendation cmvtkii1l00xu0iu600lzdvqr remains OPEN: source cmvtk2xiq000201fyyw2nuijf seq 47/101/105, cmvtk2xiq000401fydrgbbdd1 seq 157/167, and cmvtk2xiq000301fy68jp6nn8 seq 155/158/160 document the same failure. The latest self-contained Linear comment is https://linear.app/composio/issue/DEVREL-308/missing-key-error-points-to-unavailable-cli-login#comment-32b9ddcf. **Root cause.** Owned source `python/composio/exceptions.py::ApiKeyNotProvidedError` presented CLI login as an interchangeable recovery path without installation or application-key configuration requirements. `python/composio/sdk.py` resolves the project key from the explicit `api_key` argument or COMPOSIO_API_KEY and raises this error before constructing the HTTP client. Its resolution behavior was correct and is unchanged. Packaging in python/pyproject.toml and python/setup.py supplies the Python SDK, not a CLI. Open PR 3670's exceptions.py change concerns only legacy connected-account endpoint documentation and does not cover this defect. ## Change Committed as 454a53759 (`fix(python): clarify missing API key recovery`). Updated ApiKeyNotProvidedError to lead with COMPOSIO_API_KEY and Composio(api_key=...), identify project Settings > API Keys, and link the current quickstart. CLI login is explicitly optional, separately installed, linked to verified installation guidance, and not described as configuring the application's environment. Added matching package README guidance and removed its outdated generic Settings link. Extended existing behavioral authentication tests for omitted, None, and empty keys, including explicit missing values not falling back to the environment. No exact-wording snapshots, credential-resolution changes, generated-client changes, dependency changes, or CLI shims. ## Verification exercised - Read live Gauge recommendation, source insight, and cited trace windows using read-only hosted commands; confirmed the missing CLI/module discovery failure, not a shipped fix or successful changed-package replay. - Fetched current PyPI metadata and installed its composio 0.31.0 wheel in an isolated environment; reproduced the original misleading error without CLI, module entry point, credentials, or network access. Reproduced the same behavior from the unmodified next source installed in another environment. - Baseline tests/test_sdk.py: 42 passed before changes. Updated SDK/authentication and import tests: 51 passed, including preserved authentication modes and credential precedence checks. - Scoped Ruff lint passed; Ruff format check reported both changed Python files already formatted. - Built the final wheel and sdist with /tmp/devrel-308-verify/bin/python -m build --wheel --sdist --no-isolation --outdir /tmp/devrel-308-final-dist. Build succeeded with setuptools metadata warnings. - Installed the final built wheel into an isolated consumer environment outside the checkout with only runtime dependencies. With COMPOSIO_* variables removed, PATH restricted to the environment, an isolated home, and socket operations blocked, actual Composio construction raised the corrected ApiKeyNotProvidedError for omitted, None, and empty keys. Confirmed no composio executable, Python module entry point, or distribution entry points. No backend requests or secret output. - Verified the final wheel's Markdown description and sdist README include the updated recovery guidance. Rendered the package README with readme-renderer and inspected the HTML recovery section. An initial throwaway HTML assertion assumed an unadorned h2; inspection showed renderer-added anchors, and the corrected selector check passed. No repository check was changed or skipped. - Fetched the linked quickstart and CLI documentation in HTML and Markdown, confirmed public project-key setup guidance and the CLI install anchor, and read the supported unattended-authentication guide. The dashboard project-key URL from the quickstart resolved to sign-in, not an authenticated settings inspection. - Reviewed the three-file diff against the issue constraints and committed only the intended source, README, and behavioral tests. Removed temporary smoke scripts and checkout build scaffolding. Rerun by the Agent Experience Factory on the pushed commit before opening this PR: - `/tmp/devrel-308-verify/bin/python -m pytest -c config/pytest.ini tests/test_sdk.py tests/test_imports.py -q` in `python` — exit 0 - `/tmp/devrel-308-verify/bin/ruff check --config config/ruff.toml composio/exceptions.py tests/test_sdk.py` in `python` — exit 0 - `/tmp/devrel-308-verify/bin/ruff format --check --config config/ruff.toml composio/exceptions.py tests/test_sdk.py` in `python` — exit 0 ## Remaining validation - Publish a new Python package through the normal release process; the local artifact retains repository version 0.31.0 and has not been published or deployed. - After a changed package is available, an authorized matched Gauge retest must exercise the cited sessions, verify exposure to the new error, confirm original-finding removal, and inspect material regressions. No paid runs, evaluations, optimizations, or deployments were started; unchanged controls are not fix evidence. - No credentialed SDK requests, CLI login, customer actions, or authenticated dashboard inspection were performed. Package README rendering was inspected as HTML, not in a graphical browser. - The build emitted setuptools warnings about author metadata, dependency declarations overriding setup.py, and deprecated license classifiers; packaging metadata was intentionally unchanged. Not merged or deployed. A matched Gauge retest can only run after deployment. <sub>Opened by the Agent Experience Factory to improve agent preference across docs and landing pages (queue `2026-11-04-next`).</sub>

Brendan O'Leary committed Nov 6, 2026 at 09:16 UTC 40221d8db8b55c88173a9bb22c899562489bb495

No changes.