Skip to content

Commit c28f4b4

Browse files
authored
fix: claude error (#145)
1 parent 2ec3c9e commit c28f4b4

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/main/services/agent.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { randomUUID } from "node:crypto";
2+
import { rmSync } from "node:fs";
23
import { join } from "node:path";
34
import { Agent, PermissionMode } from "@posthog/agent";
45
import {
@@ -86,6 +87,22 @@ export function registerAgentIpc(
8687
process.env.POSTHOG_API_KEY = apiKey;
8788
process.env.POSTHOG_API_HOST = apiHost;
8889

90+
// Workaround for claude-agent-sdk bug where cached tool definitions include input_examples
91+
// Clear the statsig cache to force regeneration without input_examples
92+
// See: https://github.com/anthropics/claude-code/issues/11678
93+
try {
94+
const claudeConfigDir =
95+
process.env.CLAUDE_CONFIG_DIR || join(app.getPath("home"), ".claude");
96+
const statsigPath = join(claudeConfigDir, "statsig");
97+
rmSync(statsigPath, { recursive: true, force: true });
98+
console.log(
99+
"[agent] Cleared statsig cache to work around input_examples bug",
100+
);
101+
} catch (error) {
102+
// Ignore errors if the folder doesn't exist
103+
console.warn("[agent] Could not clear statsig cache:", error);
104+
}
105+
89106
const taskId = randomUUID();
90107
const channel = `agent-event:${taskId}`;
91108

0 commit comments

Comments
 (0)