@devries-cameron20 / composio Mirror · read-only / commits / 920d5409c
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, 04:45 UTC

fix(cli): name dev-tree commands in hints and the skill (#5349)

This PR: - part of [PRDE-2212](https://linear.app/composio/issue/PRDE-2212/cli-e2e-tests-fake-backend-operation-suites-and-agent-journeys-with) - split from https://github.com/ComposioHQ/composio/pull/5312 - names `composio dev connected-accounts link <toolkit>` when `composio dev playground-execute` has no connection, including parallel execution failures - teaches `composio dev playground-execute` in the `composio-cli` developer reference so developer tasks stay on their project and user - replaces the nonexistent `composio dev orgs list` example with `composio orgs list` and accepts `orgs` in the reference validator - tests the error mapping and records the CLI changes in `CHANGELOG.md` ## Context Local validation passed: frozen install, CLI dependency builds, repository and CLI typechecks, Effect diagnostics, oxlint, Prettier, and CLI tests (3,085 passed, one skipped). The hint change adds no command or workflow requiring a recording.

Alberto Schiabel committed Nov 16, 2026 at 12:24 UTC 920d5409cf283192e9feb209b2f3f971a15e603a
8 files changed +113 -9
ts/packages/cli/CHANGELOG.md
+14
@@ -4,6 +4,20 @@
4
5 ### Patch Changes
6
7 +- The `composio-cli` skill now says how to run a tool inside a developer
8 + project: `composio dev playground-execute`, with
9 + `composio dev connected-accounts link <toolkit>` for a missing connection.
10 + Agents on developer tasks used to fall back to `composio execute`, which acts
11 + on the consumer project; in live runs with `claude-haiku-5-5` that happened
12 + on every developer run, and no longer does.
13 +
14 +- `composio dev playground-execute` without a connection now names
15 + `composio dev connected-accounts link <toolkit>` as the fix. It used to name
16 + `composio link <toolkit>`, which connects the consumer user and leaves the
17 + developer project's test user unconnected, so the retry failed the same way.
18 + The `composio-cli` skill's developer reference now lists `composio orgs list`
19 + in place of `composio dev orgs list`, which does not exist.
20 +
21 - Update @composio/client to 2.1.32 to include the latest API changes.
22
23 - `composio dev connected-accounts link --help` now shows
ts/packages/cli/skills-src/composio-cli/index.ts
+1 -1
@@ -344,7 +344,7 @@ export const renderComposioCliSkill = (
344 '',
345 'If the user is stuck on top-level commands or needs fallback inspection commands, load [references/troubleshooting.md](references/troubleshooting.md).',
346 '',
347 - 'If the user explicitly asks about developer projects, auth configs, connected accounts, triggers, logs, orgs, or projects, load [references/composio-dev.md](references/composio-dev.md). `composio dev` is not the default end-user path.'
347 + 'If the user explicitly asks about developer projects, auth configs, connected accounts, triggers, logs, orgs, or projects, load [references/composio-dev.md](references/composio-dev.md). `composio dev` is not the default end-user path. In a developer project, run tools with `composio dev playground-execute`, not `composio execute`.'
348 );
349
350 return lines.join('\n') + '\n';
ts/packages/cli/skills-src/composio-cli/reference-schema.ts
+1
@@ -45,6 +45,7 @@ const TOP_LEVEL_COMMANDS = new Set([
45 'listen',
46 'login',
47 'logout',
48 + 'orgs',
49 'proxy',
50 'run',
51 'search',
ts/packages/cli/skills-src/composio-cli/references/composio-dev.ts
+14 -2
@@ -15,6 +15,18 @@ export const composioDevReference: ReferenceDocument = {
15 ],
16 commands: [{ code: 'composio dev init -y --no-browser' }],
17 },
18 + {
19 + title: 'Run Tools In A Developer Project',
20 + body: [
21 + 'Top-level `composio execute` and `composio link` act on your own account, in your consumer project. To run a tool inside a developer project, as its playground test user or the user given by `--user-id`, use `composio dev playground-execute`. It takes the same `-d`, `--get-schema`, and `--dry-run` flags as `execute`.',
22 + 'If it reports that the toolkit is not connected for that user, connect it with `composio dev connected-accounts link <toolkit>`, then retry.',
23 + ],
24 + commands: [
25 + {
26 + code: 'composio dev playground-execute GMAIL_SEND_EMAIL --get-schema\ncomposio dev playground-execute GMAIL_SEND_EMAIL -d \'{ recipient_email: "a@b.com", subject: "Hello", body: "World" }\'\ncomposio dev connected-accounts link gmail',
27 + },
28 + ],
29 + },
30 {
31 title: 'Inspect Toolkits And Versions',
32 body: ['Use toolkit commands to inspect developer-scoped capabilities:'],
@@ -61,9 +73,9 @@ export const composioDevReference: ReferenceDocument = {
73 title: 'Switch Or Inspect Org And Project Context',
74 body: [
75 'Use these commands when the user needs to confirm or change the active developer scope:',
64 - 'If the user only wants to connect and execute tools as an end user, return to the top-level workflow instead of staying in `composio dev`.',
76 + 'If the user wants to act on their own account rather than in a developer project, return to the top-level workflow instead of staying in `composio dev`.',
77 ],
66 - commands: [{ code: 'composio dev orgs list\ncomposio dev projects list' }],
78 + commands: [{ code: 'composio orgs list\ncomposio dev projects list' }],
79 },
80 ],
81 };
ts/packages/cli/src/commands/tools/execute/tools.execute.failure.ts
+7 -1
@@ -83,6 +83,7 @@ export const emitExecuteFailureTelemetry = (params: {
83 error: params.error,
84 toolkit: toolkitSlug,
85 toolSlug: params.toolSlug,
86 + tree: params.surface,
87 });
88 const apiDetails = mapped.apiDetails;
89 const message = mapped.message;
@@ -229,7 +230,12 @@ export const handleExecutionError = (
230 ) =>
231 Effect.gen(function* () {
232 const toolkit = yield* toolkitFromToolSlug(context.toolSlug, context.projectScope);
232 - const mapped = mapComposioError({ error, toolkit, toolSlug: context.toolSlug });
233 + const mapped = mapComposioError({
234 + error,
235 + toolkit,
236 + toolSlug: context.toolSlug,
237 + tree: context.surface,
238 + });
239 const normalized = mapped.normalized;
240 if (normalized instanceof ToolInputValidationError) {
241 yield* emitExecuteFailureTelemetry({
ts/packages/cli/src/commands/tools/execute/tools.execute.parallel.ts
+12 -2
@@ -340,7 +340,12 @@ const runParallelSchemaFetchFromParsed = (params: ParsedParallelExecuteArgs) =>
340 Effect.catch(error =>
341 toolkitFromToolSlug(spec.slug, toolkitProjectScope(context.resolvedProject)).pipe(
342 Effect.map(toolkit => {
343 - const mapped = mapComposioError({ error, toolkit, toolSlug: spec.slug });
343 + const mapped = mapComposioError({
344 + error,
345 + toolkit,
346 + toolSlug: spec.slug,
347 + tree: params.surface,
348 + });
349 return {
350 slug: spec.slug,
351 successful: false,
@@ -496,7 +501,12 @@ const runParallelToolsExecuteFromParsed = (params: ParsedParallelExecuteArgs) =>
501 Effect.catch(error =>
502 toolkitFromToolSlug(spec.slug, toolkitProjectScope(context.resolvedProject)).pipe(
503 Effect.map(toolkit => {
499 - const mapped = mapComposioError({ error, toolkit, toolSlug: spec.slug });
504 + const mapped = mapComposioError({
505 + error,
506 + toolkit,
507 + toolSlug: spec.slug,
508 + tree: params.surface,
509 + });
510 return {
511 slug: spec.slug,
512 successful: false,
ts/packages/cli/src/services/composio-error-overrides.ts
+35 -3
@@ -44,12 +44,26 @@ export const isNoActiveConnectionApiError = (
44 details: { code?: number; slug?: string } | undefined
45 ): boolean => details?.code === 4302 || isNoConnectionSlug(details?.slug);
46
47 +/** The command tree the failing command ran in; connections do not carry over between the two. */
48 +type ConnectionTree = 'root' | 'dev';
49 +
50 +/**
51 + * The link command of the tree the failure happened in. A root-tree link
52 + * connects the consumer user, which leaves a `dev` command failing as before.
53 + */
54 +const linkStep = (toolkit: string, tree: ConnectionTree): string =>
55 + tree === 'dev'
56 + ? `Run \`composio dev connected-accounts link ${toolkit}\` (with the same \`--user-id\`, if you passed one), then retry.`
57 + : `Run \`composio link ${toolkit}\`, then retry.`;
58 +
59 export const buildNoActiveConnectionMessage = (params: {
60 readonly toolkit?: string;
61 readonly toolSlug?: string;
62 + readonly tree?: ConnectionTree;
63 }) => {
64 + const tree = params.tree ?? 'root';
65 if (params.toolkit) {
52 - return `No active connection found for toolkit "${params.toolkit}". Run \`composio link ${params.toolkit}\`, then retry.`;
66 + return `No active connection found for toolkit "${params.toolkit}". ${linkStep(params.toolkit, tree)}`;
67 }
68 if (params.toolSlug) {
69 // Best-effort fallback for callers that could not resolve the toolkit.
@@ -58,7 +72,7 @@ export const buildNoActiveConnectionMessage = (params: {
72 // bare-slug case.
73 const toolkit = guessToolkitFromToolSlug(params.toolSlug);
74 if (toolkit && toolkit !== 'composio') {
61 - return `No active connection found for toolkit "${toolkit}". Run \`composio link ${toolkit}\`, then retry.`;
75 + return `No active connection found for toolkit "${toolkit}". ${linkStep(toolkit, tree)}`;
76 }
77 }
78 return 'No active connection found for this tool call. Link the required toolkit/app, then retry.';
@@ -69,17 +83,20 @@ export class ComposioNoActiveConnectionError extends Error {
83 readonly apiDetails?: ApiErrorDetails;
84 readonly toolkit?: string;
85 readonly toolSlug?: string;
86 + readonly tree: ConnectionTree;
87
88 constructor(params: {
89 readonly details: unknown;
90 readonly apiDetails?: ApiErrorDetails;
91 readonly toolkit?: string;
92 readonly toolSlug?: string;
93 + readonly tree?: ConnectionTree;
94 }) {
95 super(
96 buildNoActiveConnectionMessage({
97 toolkit: params.toolkit,
98 toolSlug: params.toolSlug,
99 + tree: params.tree,
100 })
101 );
102 this.name = 'ComposioNoActiveConnectionError';
@@ -87,6 +104,7 @@ export class ComposioNoActiveConnectionError extends Error {
104 this.apiDetails = params.apiDetails;
105 this.toolkit = params.toolkit;
106 this.toolSlug = params.toolSlug;
107 + this.tree = params.tree ?? 'root';
108 }
109 }
110
@@ -94,6 +112,8 @@ export const mapComposioError = (params: {
112 readonly error: unknown;
113 readonly toolkit?: string;
114 readonly toolSlug?: string;
115 + /** The tree of the command reporting the failure; the root tree when omitted. */
116 + readonly tree?: ConnectionTree;
117 }) => {
118 const normalized = normalizeCliError(params.error);
119 const apiDetails =
@@ -105,14 +125,26 @@ export const mapComposioError = (params: {
125 normalized instanceof ComposioNoActiveConnectionError ||
126 isNoActiveConnectionApiError(apiDetails)
127 ) {
128 + const tree = params.tree ?? 'root';
129 + // The executor raises this error without knowing the tree; the command
130 + // that reports it does, and its message has to name that tree's link.
131 const mapped =
132 normalized instanceof ComposioNoActiveConnectionError
110 - ? normalized
133 + ? normalized.tree === tree
134 + ? normalized
135 + : new ComposioNoActiveConnectionError({
136 + details: normalized.details,
137 + apiDetails: normalized.apiDetails,
138 + toolkit: normalized.toolkit ?? params.toolkit,
139 + toolSlug: normalized.toolSlug ?? params.toolSlug,
140 + tree,
141 + })
142 : new ComposioNoActiveConnectionError({
143 details: apiDetails ?? params.error,
144 apiDetails,
145 toolkit: params.toolkit,
146 toolSlug: params.toolSlug,
147 + tree,
148 });
149
150 return {
ts/packages/cli/test/src/services/composio-error-overrides.test.ts
+29
@@ -57,6 +57,35 @@ describe('composio-error-overrides', () => {
57 );
58 });
59
60 + it('names the dev-tree link when the failing command ran on the dev tree', () => {
61 + const result = mapComposioError({
62 + toolkit: 'slack',
63 + tree: 'dev',
64 + error: apiError({
65 + code: 4302,
66 + slug: 'ToolRouterV2_NoActiveConnection',
67 + message: 'No active connection',
68 + }),
69 + });
70 +
71 + expect(result.message).toBe(
72 + 'No active connection found for toolkit "slack". Run `composio dev connected-accounts link slack` (with the same `--user-id`, if you passed one), then retry.'
73 + );
74 + expect(result.normalized).toHaveProperty('message', result.message);
75 + });
76 +
77 + it('renames the link of an error the executor raised without knowing the tree', () => {
78 + const raised = new ComposioNoActiveConnectionError({ details: {}, toolkit: 'slack' });
79 + expect(raised.message).toContain('`composio link slack`');
80 +
81 + const onDevTree = mapComposioError({ error: raised, tree: 'dev' });
82 + expect(onDevTree.message).toContain('`composio dev connected-accounts link slack`');
83 + expect(onDevTree.message).not.toContain('`composio link slack`');
84 +
85 + // Reported from the root tree, the same error keeps its message and identity.
86 + expect(mapComposioError({ error: raised }).normalized).toBe(raised);
87 + });
88 +
89 it('still recognizes an API error wrapped in an Effect cause chain', () => {
90 const result = mapComposioError({
91 toolkit: 'gmail',