@devries-cameron20 / composio-1 / commits / a8e238386
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): thread operation into validateInitialState instead of hardcoding setup

validateInitialState hardcodes operation 'setup' in its SetupCommandError while its only caller, the exported inspectSetupTargets, already threads options.operation for wording. Uninstall skips validation today (allowMarketplaceConflict: uninstall), so nothing mislabels now, but any future uninstall caller that validates would get operation 'setup' and the wrong failure_reason_code in telemetry. Pass options.operation ?? 'setup' through and use it in both constructions.

jkomyno committed Sep 16, 2026 at 18:47 UTC a8e238386be5d82afd1aa1f24850790efbf5301e
1 file changed +8 -4
ts/packages/cli/src/services/setup.ts
+8 -4
@@ -659,17 +659,21 @@ const runRequired = (
659 }
660 });
661
662 -const validateInitialState = (adapter: SetupTargetAdapter, initial: InspectedSetupTarget) => {
662 +const validateInitialState = (
663 + adapter: SetupTargetAdapter,
664 + initial: InspectedSetupTarget,
665 + operation: SetupOperation
666 +) => {
667 if (!initial.available) {
668 return new SetupCommandError({
665 - operation: 'setup',
669 + operation,
670 reasonCode: 'target_not_installed',
671 message: `${adapter.executable} is not installed or not available on PATH. Install it and rerun \`composio setup --yes --target ${adapter.target}\`.`,
672 });
673 }
674 if (initial.marketplace_conflict) {
675 return new SetupCommandError({
672 - operation: 'setup',
676 + operation,
677 reasonCode: 'marketplace_conflict',
678 message: `The ${adapter.target} marketplace named "composio" points to a different source. Run \`${adapter.marketplaceRemoveCommand}\`, then rerun \`composio setup --yes --target ${adapter.target}\`.`,
679 });
@@ -824,7 +828,7 @@ export const inspectSetupTargets = (
828 );
829 if (!options.allowMarketplaceConflict) {
830 yield* Effect.forEach(inspected, status =>
827 - validateInitialState(ADAPTERS[status.target], status)
831 + validateInitialState(ADAPTERS[status.target], status, options.operation ?? 'setup')
832 );
833 }
834 return inspected;