@devries-cameron20 / composio-1 / commits / 8a3a1a53a
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(cli): carry --yes in every setup remediation rerun command

The plugin hint learned to say 'composio setup --yes', but the error messages an agent hits next still suggested bare reruns that deterministically fail again with non_interactive_requires_yes in a non-TTY shell - the same 103-failure loop this PR set out to fix. Add --yes to the targeted-missing and no-host messages in setup.cmd, the validate-stage target/marketplace messages, the verify-stage messages, and the shared recovery-hint command; the most conflicting case also walked agents through the destructive marketplace remove before a rerun that could not succeed. Interactive users can drop the flag; agents get a command that actually completes. Adds rerun-message assertions for the three reachable failure paths.

jkomyno committed Sep 16, 2026 at 18:46 UTC 8a3a1a53a19007a2c9dd3c95837a453b5c7f45dd
4 files changed +61 -9
ts/packages/cli/CHANGELOG.md
+3 -2
@@ -5,8 +5,9 @@
5 ### Patch Changes
6
7 - The plugin hint shown under Claude Code or Codex now reads
8 - `'composio setup --yes' installs it`, so an agent following it no longer
9 - fails on the non-interactive `--yes` requirement. CLI telemetry gains
8 + `'composio setup --yes' installs it`, and setup error messages that suggest
9 + a rerun now include `--yes` too, so an agent following the printed text no
10 + longer fails on the non-interactive `--yes` requirement. CLI telemetry gains
11 `agent_host_env` on every event, a `CLI_PLUGIN_HINT_SHOWN` event, host
12 presence signals on `CLI_SETUP_HOST_DETECTED` when a host is not detected,
13 and a `failure_reason_code` on `CLI_SETUP_FAILED`.
ts/packages/cli/src/commands/setup.cmd.ts
+2 -2
@@ -147,14 +147,14 @@ const setupBaseCmd = Command.make(
147 if (detected.length === 0) {
148 if (target === 'claude' || target === 'codex') {
149 return yield* setupCommandError(
150 - `${target} is not installed or not available on PATH. Install it and rerun \`composio setup${uninstall ? ' --uninstall' : ''} --target ${target}\`.`,
150 + `${target} is not installed or not available on PATH. Install it and rerun \`composio setup${uninstall ? ' --uninstall' : ''} --yes --target ${target}\`.`,
151 operation,
152 'target_not_installed'
153 );
154 }
155 if (!ifPresent || target !== 'auto') {
156 return yield* setupCommandError(
157 - `No supported agent host was detected. Install Claude Code or Codex, then rerun \`composio setup${uninstall ? ' --uninstall' : ''}\`.`,
157 + `No supported agent host was detected. Install Claude Code or Codex, then rerun \`composio setup${uninstall ? ' --uninstall' : ''} --yes\`.`,
158 operation,
159 'no_host_detected'
160 );
ts/packages/cli/src/services/setup.ts
+8 -5
@@ -471,8 +471,11 @@ const errorMessage = (error: unknown): string => {
471
472 type SetupOperation = 'setup' | 'uninstall';
473
474 +// Remediation commands must stay usable from the non-interactive shells
475 +// agents run in (the plugin hint's primary audience), so they always carry
476 +// --yes; interactive users can drop it.
477 const setupCommand = (adapter: SetupTargetAdapter, operation: SetupOperation): string =>
475 - `composio setup${operation === 'uninstall' ? ' --uninstall' : ''} --target ${adapter.target}`;
478 + `composio setup${operation === 'uninstall' ? ' --uninstall' : ''} --yes --target ${adapter.target}`;
479
480 const recoveryHint = (adapter: SetupTargetAdapter, operation: SetupOperation): string =>
481 `Run \`${setupCommand(adapter, operation)}\` again. If the problem persists, run \`${hostUpdateCommand(adapter)}\` and retry.`;
@@ -661,14 +664,14 @@ const validateInitialState = (adapter: SetupTargetAdapter, initial: InspectedSet
664 return new SetupCommandError({
665 operation: 'setup',
666 reasonCode: 'target_not_installed',
664 - message: `${adapter.executable} is not installed or not available on PATH. Install it and rerun \`composio setup --target ${adapter.target}\`.`,
667 + message: `${adapter.executable} is not installed or not available on PATH. Install it and rerun \`composio setup --yes --target ${adapter.target}\`.`,
668 });
669 }
670 if (initial.marketplace_conflict) {
671 return new SetupCommandError({
672 operation: 'setup',
673 reasonCode: 'marketplace_conflict',
671 - message: `The ${adapter.target} marketplace named "composio" points to a different source. Run \`${adapter.marketplaceRemoveCommand}\`, then rerun \`composio setup --target ${adapter.target}\`.`,
674 + message: `The ${adapter.target} marketplace named "composio" points to a different source. Run \`${adapter.marketplaceRemoveCommand}\`, then rerun \`composio setup --yes --target ${adapter.target}\`.`,
675 });
676 }
677 return Effect.void;
@@ -727,7 +730,7 @@ const installAdapter = (adapter: SetupTargetAdapter, initial: InspectedSetupTarg
730 return yield* setupProcessError({
731 adapter,
732 stage: 'verify',
730 - message: `Setup commands completed, but ${adapter.target} did not report the Composio plugin and CLI skill as ready. Rerun \`composio setup --target ${adapter.target}\` or inspect the native ${adapter.target} plugin configuration.`,
733 + message: `Setup commands completed, but ${adapter.target} did not report the Composio plugin and CLI skill as ready. Rerun \`${setupCommand(adapter, 'setup')}\` or inspect the native ${adapter.target} plugin configuration.`,
734 });
735 }
736
@@ -767,7 +770,7 @@ const uninstallAdapter = (adapter: SetupTargetAdapter, initial: InspectedSetupTa
770 return yield* setupProcessError({
771 adapter,
772 stage: 'verify',
770 - message: `Uninstall commands completed, but ${adapter.target} still reports the Composio plugin as installed. Rerun \`composio setup --uninstall --target ${adapter.target}\` or inspect the native ${adapter.target} plugin configuration.`,
773 + message: `Uninstall commands completed, but ${adapter.target} still reports the Composio plugin as installed. Rerun \`${setupCommand(adapter, 'uninstall')}\` or inspect the native ${adapter.target} plugin configuration.`,
774 });
775 }
776
ts/packages/cli/test/src/commands/setup.cmd.test.ts
+48
@@ -1298,3 +1298,51 @@ describe('CLI: composio setup failure reason codes', () => {
1298 });
1299 }
1300 });
1301 +
1302 +describe('CLI: composio setup rerun hints stay non-interactive safe', () => {
1303 + afterEach(() => {
1304 + process.exitCode = undefined;
1305 + });
1306 +
1307 + const messageOf = (exit: Exit.Exit<unknown, unknown>): string | undefined => {
1308 + if (!Exit.isFailure(exit)) return undefined;
1309 + const failure = Cause.squash(exit.cause);
1310 + return failure instanceof Error ? failure.message : String(failure);
1311 + };
1312 +
1313 + layer(TestLive({ commandRunner: REASON_CODE_FIXTURES['only Claude Code installed']().runner }))(
1314 + 'targeted host missing',
1315 + it => {
1316 + it.effect('target_not_installed rerun carries --yes', () =>
1317 + Effect.gen(function* () {
1318 + const exit = yield* Effect.exit(cli(['setup', '--target', 'codex', '--yes']));
1319 + expect(messageOf(exit)).toContain('rerun `composio setup --yes --target codex`');
1320 + })
1321 + );
1322 + }
1323 + );
1324 +
1325 + layer(TestLive({ commandRunner: REASON_CODE_FIXTURES['no host installed']().runner }))(
1326 + 'no host detected',
1327 + it => {
1328 + it.effect('no_host_detected rerun carries --yes', () =>
1329 + Effect.gen(function* () {
1330 + const exit = yield* Effect.exit(cli(['setup', '--yes']));
1331 + expect(messageOf(exit)).toContain('rerun `composio setup --yes`');
1332 + })
1333 + );
1334 + }
1335 + );
1336 +
1337 + layer(TestLive({ commandRunner: REASON_CODE_FIXTURES['marketplace conflict']().runner }))(
1338 + 'marketplace conflict',
1339 + it => {
1340 + it.effect('marketplace_conflict rerun carries --yes', () =>
1341 + Effect.gen(function* () {
1342 + const exit = yield* Effect.exit(cli(['setup', '--target', 'claude', '--yes']));
1343 + expect(messageOf(exit)).toContain('rerun `composio setup --yes --target claude`');
1344 + })
1345 + );
1346 + }
1347 + );
1348 +});