fix(active-memory): honor resolved dreaming session keys

This commit is contained in:
Vincent Koc
2026-06-22 14:31:54 +08:00
parent 3d222677ce
commit fc8717e8f4
2 changed files with 26 additions and 1 deletions

View File

@@ -859,6 +859,26 @@ describe("active-memory plugin", () => {
expect(runEmbeddedAgent).not.toHaveBeenCalled();
});
it("does not run when a session id resolves to a dreaming-narrative cron session key", async () => {
hoisted.sessionStore["agent:main:dreaming-narrative-light-abc123"] = {
sessionId: "dreaming-session",
updatedAt: 1,
};
const result = await hooks.before_prompt_build(
{ prompt: "what wings should i order?", messages: [] },
{
agentId: "main",
trigger: "user",
sessionId: "dreaming-session",
messageProvider: "webchat",
},
);
expect(result).toBeUndefined();
expect(runEmbeddedAgent).not.toHaveBeenCalled();
});
it("allows non-canonical session keys that merely contain the dreaming-narrative substring", async () => {
const result = await hooks.before_prompt_build(
{ prompt: "what wings should i order?", messages: [] },

View File

@@ -3630,7 +3630,12 @@ export default definePluginEntry({
});
return undefined;
}
if (!isEligibleInteractiveSession(ctx)) {
if (
!isEligibleInteractiveSession({
...ctx,
sessionKey: resolvedSessionKey ?? ctx.sessionKey,
})
) {
await persistPluginStatusLines({
api,
agentId: effectiveAgentId,