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
The `redact` function cached `process.env.CI` at module load time, causing tools-execute tests to fail in GitHub Actions where CI=true.
jkomyno committed
Feb 23, 2026 at 22:23 UTC
d9bc116306e3db8d36ab964ed1ce46edbc56080f
2 files changed
+13
-4
ts/packages/cli/src/ui/redact.ts
+1
-3
@@ -1,7 +1,5 @@
1
import process from 'node:process';
2
3
-const CI = process.env.CI === 'true';
4
-
3
/**
4
* Redact a value when running in CI (e.g., CLI recordings).
5
* Preserves a recognized prefix (e.g., "ac_" -> "ac_<REDACTED>").
@@ -14,6 +12,6 @@ export function redact<const Prefix extends string = string>({
12
value: string;
13
prefix?: Prefix;
14
}): `${Prefix}${string}` {
17
- if (!CI) return value as `${Prefix}${string}`;
15
+ if (process.env.CI !== 'true') return value as `${Prefix}${string}`;
16
return `${prefix ?? ''}<REDACTED>` as `${Prefix}${string}`;
17
}
ts/packages/cli/test/src/commands/tools/tools.execute.cmd.test.ts
+12
-1
@@ -1,5 +1,5 @@
1
import { describe, expect, layer } from '@effect/vitest';
2
-import { vi } from 'vitest';
2
+import { vi, beforeEach, afterEach } from 'vitest';
3
import { ConfigProvider, Effect } from 'effect';
4
import { extendConfigProvider } from 'src/services/config';
5
import { ComposioToolExecutionError } from '@composio/core';
@@ -27,6 +27,17 @@ const parseLastJson = (lines: ReadonlyArray<string>) => {
27
};
28
29
describe('CLI: composio tools execute', () => {
30
+ // Disable CI redaction so tests see raw values.
31
+ // The explicit CI-redaction test overrides via vi.spyOn and is unaffected.
32
+ let savedCI: string | undefined;
33
+ beforeEach(() => {
34
+ savedCI = process.env.CI;
35
+ delete process.env.CI;
36
+ });
37
+ afterEach(() => {
38
+ if (savedCI !== undefined) process.env.CI = savedCI;
39
+ });
40
+
41
layer(
42
TestLive({
43
baseConfigProvider: testConfigProvider,