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): anchor and type-check host config dirs before install probes
CLAUDE_CONFIG_DIR / CODEX_HOME were passed verbatim to the install probe, so a relative override resolved against the process cwd (making host_config_dir_present depend on where composio was invoked) and a plain file at the config path counted as 'present'. Resolve overrides against the home directory - matching how the known-binary list already resolves - and probe with stat so presence means an actual directory. Unreadable paths report false instead of failing the probe.
jkomyno committed
Sep 16, 2026 at 18:40 UTC
8088313d5ac8892e9b5a9d2987600746625fc503
1 file changed
+8
-3
ts/packages/cli/src/services/agent-host-env.ts
+8
-3
@@ -54,8 +54,10 @@ export const hostConfigDirectory = (host: AgentHost) =>
54
const path = yield* Path.Path;
55
const os = yield* NodeOs;
56
const env = yield* rawHostEnvironment;
57
- if (host === 'claude') return env.claudeConfigDir ?? path.join(os.homedir, '.claude');
58
- return env.codexHome ?? path.join(os.homedir, '.codex');
57
+ // Anchor relative overrides to the home directory so probe results
58
+ // cannot depend on the process cwd; absolute overrides pass through.
59
+ if (host === 'claude') return path.resolve(os.homedir, env.claudeConfigDir ?? '.claude');
60
+ return path.resolve(os.homedir, env.codexHome ?? '.codex');
61
});
62
63
const KNOWN_BINARY_PATHS: Readonly<Record<AgentHost, ReadonlyArray<string>>> = {
@@ -80,7 +82,10 @@ export const probeHostInstallation = (host: AgentHost) =>
82
const path = yield* Path.Path;
83
const os = yield* NodeOs;
84
const exists = (target: string) => fs.exists(target).pipe(Effect.orElseSucceed(() => false));
83
- const configDirPresent = yield* exists(yield* hostConfigDirectory(host));
85
+ // Presence means an actual directory: a file at the config path (or an
86
+ // unreadable one) must not report the host as installed.
87
+ const dirInfo = yield* Effect.option(fs.stat(yield* hostConfigDirectory(host)));
88
+ const configDirPresent = Option.isSome(dirInfo) && dirInfo.value.type === 'Directory';
89
const found = yield* Effect.forEach(KNOWN_BINARY_PATHS[host], entry =>
90
exists(path.resolve(os.homedir, entry))
91
);