@devries-cameron20 / composio Mirror · read-only / commits / b74722476
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.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 11:00 UTC

chore: follow-ups from the rc8 port review (#4573)

## Summary Follow-ups to #4568 (merged). Addresses the review findings from the shallow pass on that PR that were not raised as PR comments. - **Python status errors** go through the rc8 client's `_make_status_error` hook instead of try/except wrappers around `_decode` and `_process_response`. Every status error the kernel raises is built through that hook, so one override covers all response paths (the #4537 regression surface). - **Examples harness** prints the excluded entries before failing on an empty selection, and the failure names `--exclude-toolkits` as the cause. The selection flag parser and exclusion report now live in `harness/manifest.mjs`, shared by `harness/run.mjs` and `scripts/examples-provision.mjs`. - **examples-live workflow** falls back to `googledrive` only on the nightly schedule. A dispatch uses the `exclude_toolkits` input as given, so clearing it runs the full manifest. - **Docs nav CSS** anchors the social icon selectors to the `https://github.com/` and `https://x.com/` origins instead of a substring match. ## Not changed - `connectedAccounts.revoke()` still maps every 400 to `ComposioConnectedAccountRevocationNotSupportedError`. The OpenAPI contract documents 400 on this endpoint as exactly "non-OAUTH2 auth scheme or toolkit lacks a revoke configuration", and the error body carries no stable code to narrow on, so a message-fragment match would risk regressing the typed error. - `Toolkits.get_many()` stays annotated `List[Any]`. The owned client exports `ToolkitRetrieveMultiResponse` but not its item type (only reachable via `composio_client._generated`), so a precise annotation needs an `Item` alias added by the client codegen first. ## Verification - `python -m pytest tests/test_client_errors.py tests/test_connected_accounts.py tests/test_sdk_logging.py`: 90 passed - `ruff check` / `ruff format --check` on the changed Python file: no new findings - `node harness/run.mjs selftest`: PASS - `node scripts/examples-provision.mjs --ids ts/tools/index --exclude-toolkits googledrive` and the matching `run.mjs sweep` now print the excluded entry and `--exclude-toolkits googledrive removed all 1 matching entries (ts/tools/index)` before exiting

Alberto Schiabel committed Sep 22, 2026 at 17:31 UTC b7472247675cb090e6d1535414e9a8c6291fa71b
6 files changed +74 -64
.github/workflows/examples-live.yml
+5 -2
@@ -60,7 +60,10 @@ env:
60 ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
61 # Keep unavailable coverage explicit. The harness records excluded entry ids
62 # in its summary artifact; remove this default when staging has Drive auth.
63 - EXCLUDE_TOOLKITS: ${{ inputs.exclude_toolkits || 'googledrive' }}
63 + # The nightly excludes googledrive; a dispatch uses the exclude_toolkits
64 + # input as given (its default is googledrive), so clearing it runs the full
65 + # manifest.
66 + EXCLUDE_TOOLKITS: ${{ github.event_name == 'schedule' && 'googledrive' || inputs.exclude_toolkits }}
67 # mock unless explicitly dispatched live; the nightly adds a small live canary.
68 LLM_MODE: ${{ inputs.llm || 'mock' }}
69 # Entries mocks cannot cover (llmMock:false) plus one representative
@@ -69,7 +72,7 @@ env:
72
73 jobs:
74 examples-live:
72 - name: ${{ inputs.client || 'baseline' }} sweep (${{ inputs.lang || 'all' }}, excluding ${{ inputs.exclude_toolkits || 'googledrive' }})
75 + name: ${{ inputs.client || 'baseline' }} sweep (${{ inputs.lang || 'all' }}, excluding ${{ (github.event_name == 'schedule' && 'googledrive' || inputs.exclude_toolkits) || 'none' }})
76 environment: staging
77 runs-on: ubuntu-latest
78 timeout-minutes: 60
docs/app/global.css
+6 -6
@@ -602,8 +602,8 @@ textarea:focus-visible {
602 }
603
604 /* Social icon links */
605 -#nd-nav a[href*="github.com"],
606 -#nd-nav a[href*="x.com"] {
605 +#nd-nav a[href^="https://github.com/"],
606 +#nd-nav a[href^="https://x.com/"] {
607 display: inline-flex;
608 align-items: center;
609 justify-content: center;
@@ -614,14 +614,14 @@ textarea:focus-visible {
614 transition: color var(--header-transition), background var(--header-transition);
615 }
616
617 -#nd-nav a[href*="github.com"]:hover,
618 -#nd-nav a[href*="x.com"]:hover {
617 +#nd-nav a[href^="https://github.com/"]:hover,
618 +#nd-nav a[href^="https://x.com/"]:hover {
619 color: var(--color-fd-foreground);
620 background: var(--color-fd-accent);
621 }
622
623 -#nd-nav a[href*="github.com"]:focus-visible,
624 -#nd-nav a[href*="x.com"]:focus-visible {
623 +#nd-nav a[href^="https://github.com/"]:focus-visible,
624 +#nd-nav a[href^="https://x.com/"]:focus-visible {
625 outline: 2px solid var(--composio-orange);
626 outline-offset: 2px;
627 }
harness/manifest.mjs
+34
@@ -90,6 +90,40 @@ export const selectManifestEntries = (
90 };
91 };
92
93 +// Selection flags shared by harness/run.mjs and scripts/examples-provision.mjs:
94 +// [--lang ts|py] [--ids a,b] [--tiers 1,2,3] [--exclude-toolkits a,b]
95 +export const parseOption = (argv, name, fallback) => {
96 + const index = argv.indexOf(`--${name}`);
97 + return index >= 0 && argv[index + 1] !== undefined ? argv[index + 1] : fallback;
98 +};
99 +
100 +export const parseSelectionOptions = argv => ({
101 + lang: parseOption(argv, 'lang'),
102 + ids: parseOption(argv, 'ids'),
103 + tiers: parseOption(argv, 'tiers', '1,2,3'),
104 + excludeToolkits: parseOption(argv, 'exclude-toolkits'),
105 +});
106 +
107 +// One line per excluded entry, preceded by a summary; empty when nothing was excluded.
108 +export const describeExclusions = selection => {
109 + if (selection.excludedEntries.length === 0) return [];
110 + return [
111 + `excluding ${selection.excludedEntries.length} entries requiring ${selection.excludedToolkits.join(', ')}:`,
112 + ...selection.excludedEntries.map(entry => ` - ${entry.id}`),
113 + ];
114 +};
115 +
116 +// Names the exclusion as the cause when it emptied the selection, so an
117 +// operator is not left with a bare "no entries selected".
118 +export const emptySelectionMessage = (selection, subject = 'entries') => {
119 + const excluded = selection.excludedEntries;
120 + if (excluded.length === 0) return `no ${subject} selected`;
121 + return (
122 + `no ${subject} selected: --exclude-toolkits ${selection.excludedToolkits.join(',')} ` +
123 + `removed all ${excluded.length} matching ${subject} (${excluded.map(entry => entry.id).join(', ')})`
124 + );
125 +};
126 +
127 export const requiredBrowserGrantToolkits = entries =>
128 BROWSER_GRANT_TOOLKITS.filter(toolkit =>
129 entries.some(entry => entryToolkits(entry).includes(toolkit.slug))
harness/run.mjs
+9 -19
@@ -13,8 +13,12 @@ import { mkdirSync, readFileSync, writeFileSync, appendFileSync, existsSync, rmS
13 import { dirname, join, relative, resolve } from 'node:path';
14 import { fileURLToPath } from 'node:url';
15 import {
16 + describeExclusions,
17 + emptySelectionMessage,
18 entryToolkits,
19 loadManifest,
20 + parseOption,
21 + parseSelectionOptions,
22 requiredBrowserGrantToolkits,
23 requiresDemoToolkit,
24 selectManifestEntries,
@@ -34,30 +38,16 @@ let LLM_MOCK = false;
38
39 const args = process.argv.slice(2);
40 const cmd = args[0];
37 -const opt = (name, fallback) => {
38 - const i = args.indexOf(`--${name}`);
39 - return i >= 0 && args[i + 1] !== undefined ? args[i + 1] : fallback;
40 -};
41 +const opt = (name, fallback) => parseOption(args, name, fallback);
42
43 const fail = (msg, code = 2) => {
44 throw new HarnessError(msg, code);
45 };
46
46 -const selectionOptions = () => ({
47 - lang: opt('lang'),
48 - ids: opt('ids'),
49 - tiers: opt('tiers', '1,2,3'),
50 - excludeToolkits: opt('exclude-toolkits'),
51 -});
52 -
53 -const selectEntries = () => selectManifestEntries(loadManifest(), selectionOptions());
47 +const selectEntries = () => selectManifestEntries(loadManifest(), parseSelectionOptions(args));
48
49 const reportExclusions = selection => {
56 - if (selection.excludedEntries.length === 0) return;
57 - console.log(
58 - `excluding ${selection.excludedEntries.length} entries requiring ${selection.excludedToolkits.join(', ')}:`
59 - );
60 - for (const entry of selection.excludedEntries) console.log(` - ${entry.id}`);
50 + for (const line of describeExclusions(selection)) console.log(line);
51 };
52
53 const baseUrl = () => {
@@ -410,10 +400,10 @@ const cmdSweep = async () => {
400 if (!['live', 'mock'].includes(llm)) fail(`--llm must be live|mock`);
401 LLM_MOCK = llm === 'mock';
402 const selection = selectEntries();
403 + reportExclusions(selection);
404 const entries = selection.entries;
414 - if (entries.length === 0) fail('no entries selected');
405 + if (entries.length === 0) fail(emptySelectionMessage(selection));
406 if (!process.env.COMPOSIO_API_KEY) fail('COMPOSIO_API_KEY is required for a sweep (disposable examples-project key)', 2);
416 - reportExclusions(selection);
407
408 const id = `${runId()}-${client}${LLM_MOCK ? '-mock' : ''}`;
409 const runDir = join(ARTIFACTS, id);
python/composio/client/__init__.py
+13 -17
@@ -448,27 +448,23 @@ class HttpClient(BaseComposio, WithLogger):
448 finally:
449 _active_log_wrapper.reset(token)
450
451 - def _decode(self, response: Response) -> t.Any:
451 + def _make_status_error(
452 + self,
453 + err_msg: str,
454 + *,
455 + body: object,
456 + response: Response,
457 + ) -> APIStatusError:
458 """
453 - Raise status errors that are also ``ComposioError``s; see
459 + Build status errors that are also ``ComposioError``s; see
460 ``_with_sdk_error_base``.
455 - """
456 - try:
457 - return super()._decode(response)
458 - except APIStatusError as error:
459 - raise _as_sdk_error(error) from None
461
461 - def _process_response(
462 - self, response: Response, cast_to: t.Optional[t.Type[t.Any]]
463 - ) -> t.Any:
462 + Every status error the client raises is built through this hook, so
463 + overriding it here covers all response paths at once.
464 """
465 - Raise status errors that are also ``ComposioError``s; see
466 - ``_with_sdk_error_base``.
467 - """
468 - try:
469 - return super()._process_response(response, cast_to)
470 - except APIStatusError as error:
471 - raise _as_sdk_error(error) from None
465 + return _as_sdk_error(
466 + super()._make_status_error(err_msg, body=body, response=response)
467 + )
468
469 def _prepare_request(self, request: Request) -> None:
470 """
scripts/examples-provision.mjs
+7 -20
@@ -38,7 +38,10 @@
38 import {
39 BROWSER_GRANT_TOOLKITS,
40 DEMO_TOOLKIT,
41 + describeExclusions,
42 + emptySelectionMessage,
43 loadManifest,
44 + parseSelectionOptions,
45 requiredBrowserGrantToolkits,
46 requiresDemoToolkit,
47 selectManifestEntries,
@@ -57,19 +60,12 @@ const USER_ID = process.env.COMPOSIO_EXAMPLES_USER_ID ?? 'examples';
60 const INITIATE_MISSING = process.argv.includes('--initiate-missing');
61 const GC = process.argv.includes('--gc');
62 const DRY_RUN = process.argv.includes('--dry-run');
60 -const option = name => {
61 - const index = process.argv.indexOf(`--${name}`);
62 - return index >= 0 ? process.argv[index + 1] : undefined;
63 -};
63 +const report = line => console.error(line);
64
65 -const selection = selectManifestEntries(loadManifest(), {
66 - lang: option('lang'),
67 - ids: option('ids'),
68 - tiers: option('tiers') ?? '1,2,3',
69 - excludeToolkits: option('exclude-toolkits'),
70 -});
65 +const selection = selectManifestEntries(loadManifest(), parseSelectionOptions(process.argv));
66 +for (const line of describeExclusions(selection)) report(line);
67 if (selection.entries.length === 0) {
72 - console.error('no example entries selected for provisioning');
68 + report(emptySelectionMessage(selection, 'example entries'));
69 process.exit(1);
70 }
71 const selectedBrowserGrantToolkits = requiredBrowserGrantToolkits(selection.entries);
@@ -84,15 +80,6 @@ if (!API_KEY) {
80 process.exit(1);
81 }
82
87 -const report = line => console.error(line);
88 -
89 -if (selection.excludedEntries.length > 0) {
90 - report(
91 - `excluding ${selection.excludedEntries.length} entries requiring ${selection.excludedToolkits.join(', ')}:`
92 - );
93 - for (const entry of selection.excludedEntries) report(` - ${entry.id}`);
94 -}
95 -
83 async function api(method, path, body) {
84 const res = await fetch(`${BASE_URL}${path}`, {
85 method,