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(ts/cli): prevent cache corruption when using FORCE_USE_CACHE=true
jkomyno committed
Jan 15, 2026 at 00:41 UTC
269c444c2ee284a9b0c86bc32f3a70cb43bec842
1 file changed
+10
-7
ts/packages/cli/src/services/composio-clients-cached.ts
+10
-7
@@ -80,13 +80,16 @@ function createCachedEffect<T, E, R>(
80
// Fetch from the underlying service
81
const result = yield* computation;
82
83
- // Write to cache (best effort: don't fail if cache write fails)
84
- yield* encoder(result).pipe(
85
- Effect.flatMap(content => fs.writeFileString(cacheFilePath, content)),
86
- Effect.catchAll(error =>
87
- Effect.logWarning(`Failed to write to cache ${cacheFilePath}: ${error}`)
88
- )
89
- );
83
+ // Write to cache only if we're fetching the full dataset (no cacheFilter).
84
+ // Filtered API calls fetch partial data that would corrupt the shared cache file.
85
+ if (!cacheFilter) {
86
+ yield* encoder(result).pipe(
87
+ Effect.flatMap(content => fs.writeFileString(cacheFilePath, content)),
88
+ Effect.catchAll(error =>
89
+ Effect.logWarning(`Failed to write to cache ${cacheFilePath}: ${error}`)
90
+ )
91
+ );
92
+ }
93
94
return result;
95
});