Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(pi): no condensed marker when compaction returns an empty summary
AdityaUmaleb92002699f91
diff --git a/server/drivers/pi.ts b/server/drivers/pi.tsindex 3ef790fb44..0c5a81d889 100644--- a/server/drivers/pi.ts+++ b/server/drivers/pi.ts@@ -734,7 +734,7 @@ export const PiDriver: ProviderDriver<PiConfig> = {compactionObserved = true;deletePromptSplitReceipt("pi", JSON.stringify([threadId, sessionFile]));}- if (evt.type.endsWith("compaction_end") && (evt as { result?: unknown }).result && !(evt as { aborted?: boolean }).aborted && !(evt as { errorMessage?: string }).errorMessage) { flushAssistantText(); emit({ ...base(threadId, turnId), type: "context.compacted" }); }+ if (evt.type.endsWith("compaction_end") && /\S/.test(String((evt as { result?: { summary?: unknown } }).result?.summary ?? "")) && !(evt as { aborted?: boolean }).aborted && !(evt as { errorMessage?: string }).errorMessage) { flushAssistantText(); emit({ ...base(threadId, turnId), type: "context.compacted" }); }return;}case "message_end":diff --git a/server/testing/fake-pi-cli.ts b/server/testing/fake-pi-cli.tsindex 356f9fd586..8582e98b1c 100755--- a/server/testing/fake-pi-cli.ts+++ b/server/testing/fake-pi-cli.ts@@ -140,6 +140,9 @@ const streamCompactionTurn = () => {send({ type: "compaction_end", reason: "threshold", result: undefined, aborted: false, willRetry: false, errorMessage: "Compaction failed" });send({ type: "compaction_start", reason: "threshold" });send({ type: "compaction_end", reason: "threshold", result: undefined, aborted: false, willRetry: false });+ // An extension can also hand back a result with an empty summary: nothing usable was made, so no marker either.+ send({ type: "compaction_start", reason: "threshold" });+ send({ type: "compaction_end", reason: "threshold", result: { summary: " ", firstKeptEntryId: "e1", tokensBefore: 100 }, aborted: false, willRetry: false });if (process.env.FAKE_PI_COMPACTION_FAILS_ONLY !== "1") {send({ type: "compaction_start", reason: "threshold" });send({ type: "compaction_end", reason: "threshold", result: { summary: "fake summary", firstKeptEntryId: "e1", tokensBefore: 100 }, aborted: false, willRetry: false });