Skip to content

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): read CI env var at call time so redact is testable

jkomynod9bc116306e3
diff --git a/ts/packages/cli/src/ui/redact.ts b/ts/packages/cli/src/ui/redact.ts
index 88930014a..9f5cd682a 100644
--- a/ts/packages/cli/src/ui/redact.ts
+++ b/ts/packages/cli/src/ui/redact.ts
@@ -1,7 +1,5 @@
import process from 'node:process';
-const CI = process.env.CI === 'true';
-
/**
* Redact a value when running in CI (e.g., CLI recordings).
* Preserves a recognized prefix (e.g., "ac_" -> "ac_<REDACTED>").
@@ -14,6 +12,6 @@ export function redact<const Prefix extends string = string>({
value: string;
prefix?: Prefix;
}): `${Prefix}${string}` {
- if (!CI) return value as `${Prefix}${string}`;
+ if (process.env.CI !== 'true') return value as `${Prefix}${string}`;
return `${prefix ?? ''}<REDACTED>` as `${Prefix}${string}`;
}
diff --git a/ts/packages/cli/test/src/commands/tools/tools.execute.cmd.test.ts b/ts/packages/cli/test/src/commands/tools/tools.execute.cmd.test.ts
index 23ab11946..a8481261b 100644
--- a/ts/packages/cli/test/src/commands/tools/tools.execute.cmd.test.ts
+++ b/ts/packages/cli/test/src/commands/tools/tools.execute.cmd.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, layer } from '@effect/vitest';
-import { vi } from 'vitest';
+import { vi, beforeEach, afterEach } from 'vitest';
import { ConfigProvider, Effect } from 'effect';
import { extendConfigProvider } from 'src/services/config';
import { ComposioToolExecutionError } from '@composio/core';
@@ -27,6 +27,17 @@ const parseLastJson = (lines: ReadonlyArray<string>) => {
};
describe('CLI: composio tools execute', () => {
+ // Disable CI redaction so tests see raw values.
+ // The explicit CI-redaction test overrides via vi.spyOn and is unaffected.
+ let savedCI: string | undefined;
+ beforeEach(() => {
+ savedCI = process.env.CI;
+ delete process.env.CI;
+ });
+ afterEach(() => {
+ if (savedCI !== undefined) process.env.CI = savedCI;
+ });
+
layer(
TestLive({
baseConfigProvider: testConfigProvider,