fix(hooks): avoid stale active-memory startup fallback

This commit is contained in:
Vincent Koc
2026-04-22 16:09:07 -07:00
parent 18507ed85f
commit d686e6f876
4 changed files with 33 additions and 9 deletions

View File

@@ -365,6 +365,27 @@ describe("active-memory plugin", () => {
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
});
it("fails closed when the live active-memory plugin entry is removed", async () => {
configFile = {
plugins: {
entries: {},
},
};
const result = await hooks.before_prompt_build(
{ prompt: "what wings should i order after active memory is removed?", messages: [] },
{
agentId: "main",
trigger: "user",
sessionKey: "agent:main:live-config-removed",
messageProvider: "webchat",
},
);
expect(result).toBeUndefined();
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
});
it("does not run for agents that are not explicitly targeted", async () => {
const result = await hooks.before_prompt_build(
{ prompt: "what wings should i order?", messages: [] },