Commit f78db0e1cd9f

Vincent Demeester <vincent@sbr.pm>
2026-03-31 15:09:44
fix(ai-storage): use --no-extensions flag
Replaced PI_DISABLE_EXTENSIONS env var with the proper --no-extensions CLI flag for pi invocations in both the summarizer and session export to prevent recursive extension loading.
1 parent 83ad8db
Changed files (2)
dots
pi
agent
extensions
dots/pi/agent/extensions/ai-storage/index.ts
@@ -680,10 +680,9 @@ export default function (pi: ExtensionAPI) {
 					try {
 						await mkdir(exportsDir, { recursive: true });
 						const { execSync } = await import("node:child_process");
-						execSync(`pi --export "${rawSessionPath}" "${htmlPath}"`, {
+						execSync(`pi --no-extensions --export "${rawSessionPath}" "${htmlPath}"`, {
 							encoding: "utf-8",
 							timeout: 30000,
-							env: { ...process.env, PI_DISABLE_EXTENSIONS: "1" },
 						});
 						// Inject export link back into the summary .md
 						try {
dots/pi/agent/extensions/ai-storage/summarizer.ts
@@ -130,6 +130,7 @@ Result of the session.
 			"pi",
 			[
 				"-p", // Non-interactive mode
+				"--no-extensions", // CRITICAL: prevent recursive summarization
 				"--provider", "github-copilot",
 				"--model", "gpt-5-mini", // Fast and cheap
 				prompt,
@@ -140,9 +141,8 @@ Result of the session.
 				maxBuffer: 10 * 1024 * 1024, // 10MB buffer
 				env: {
 					...process.env,
-					// Disable extensions to avoid recursion/side effects
-					PI_DISABLE_EXTENSIONS: "1",
 				},
+
 			}
 		);
 
@@ -156,14 +156,10 @@ Result of the session.
 		console.log("Stderr from gpt-5-mini attempt:", result.stderr);
 
 		// If specific model failed, try with default config
-		const fallbackResult = spawnSync("pi", ["-p", prompt], {
+		const fallbackResult = spawnSync("pi", ["-p", "--no-extensions", prompt], {
 			encoding: "utf-8",
 			timeout: 120000,
 			maxBuffer: 10 * 1024 * 1024,
-			env: {
-				...process.env,
-				PI_DISABLE_EXTENSIONS: "1",
-			},
 		});
 
 		console.log("Ran pi with default model, status:", fallbackResult.status);