Skip to content

Commit 5b1190e

Browse files
committed
fix(claude): probe commands when settings redirect the plugin cache
Made with GPT-6.1 Sol via Codex in T3 Code.
1 parent 26a02ed commit 5b1190e

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

‎apps/server/src/provider/ClaudeCapabilitiesProbe.test.ts‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,29 @@ it.effect("always starts the CLI when its sources cannot be vouched for", () =>
205205
yield* probesTwice(commands);
206206
yield* write(settings, "{}");
207207

208+
const redirectedPlugins = path.join(root, "redirected-plugins");
209+
const redirectedCommand = path.join(
210+
redirectedPlugins,
211+
"cache",
212+
"a",
213+
"1.0.0",
214+
"commands",
215+
"review.md",
216+
);
217+
for (const settingsPath of [path.join(config, "settings.json"), settings]) {
218+
yield* write(
219+
settingsPath,
220+
JSON.stringify({ env: { CLAUDE_CODE_PLUGIN_CACHE_DIR: redirectedPlugins } }),
221+
);
222+
yield* write(redirectedCommand, "before edit");
223+
yield* probesTwice(commands);
224+
const beforeRedirectedEdit = probes();
225+
yield* write(redirectedCommand, "after redirected command edit");
226+
yield* commands.get(machine, cwd);
227+
assert.strictEqual(probes(), beforeRedirectedEdit + 1);
228+
yield* write(settingsPath, "{}");
229+
}
230+
208231
const installed = path.join(config, "plugins", "installed_plugins.json");
209232
yield* write(
210233
installed,

‎apps/server/src/provider/Drivers/ClaudeSkills.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,10 @@ export const fingerprintClaudeCommandSources = Effect.fn("fingerprintClaudeComma
720720
const contents = yield* fileSystem
721721
.readFileString(settingsPath)
722722
.pipe(Effect.catchReason("PlatformError", "NotFound", () => Effect.undefined));
723-
if (CLAUDE_COMMAND_SOURCE_REDIRECTS.some((name) => contents?.includes(name))) {
723+
if (
724+
contents?.includes("CLAUDE_CODE_PLUGIN_CACHE_DIR") ||
725+
CLAUDE_COMMAND_SOURCE_REDIRECTS.some((name) => contents?.includes(name))
726+
) {
724727
return yield* Effect.fail("redirected" as const);
725728
}
726729
hash.update(`${settingsPath}\0${contents ?? "absent"}\0`);

0 commit comments

Comments
 (0)