mirror of
https://github.com/bendtherules/opencode-plugin-compaction-prompt.git
synced 2026-08-18 13:42:55 +00:00
fix: skip empty compaction instructions
This commit is contained in:
+18
-2
@@ -114,7 +114,23 @@ describe("CompactionPromptPlugin", () => {
|
||||
);
|
||||
|
||||
expect(context.logs).toHaveLength(0);
|
||||
expect(output.context).toHaveLength(1);
|
||||
expect(output.context).toHaveLength(0);
|
||||
});
|
||||
|
||||
test("does not modify compaction when no instructions are provided", async () => {
|
||||
const context = await createContext();
|
||||
const hooks = await CompactionPromptPlugin(context as never);
|
||||
const output: { context: string[]; prompt?: string } = {
|
||||
context: ["Existing context"],
|
||||
};
|
||||
|
||||
await hooks["experimental.session.compacting"]?.(
|
||||
{ sessionID: "test" },
|
||||
output,
|
||||
);
|
||||
|
||||
expect(output.context).toEqual(["Existing context"]);
|
||||
expect(output.prompt).toBeUndefined();
|
||||
});
|
||||
|
||||
test("logs non-missing memory file errors without failing compaction", async () => {
|
||||
@@ -131,6 +147,6 @@ describe("CompactionPromptPlugin", () => {
|
||||
);
|
||||
|
||||
expect(context.logs).toHaveLength(1);
|
||||
expect(output.context).toHaveLength(1);
|
||||
expect(output.context).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user