diff --git a/src/hooks/bundled/session-memory/handler.test.ts b/src/hooks/bundled/session-memory/handler.test.ts index 98b0966629c..c192ff5f624 100644 --- a/src/hooks/bundled/session-memory/handler.test.ts +++ b/src/hooks/bundled/session-memory/handler.test.ts @@ -578,7 +578,11 @@ describe("session-memory hook", () => { async function drainPostHookActions(event: { postHookActions: Array<() => Promise | void>; }) { - for (const action of event.postHookActions) { + // Snapshot before draining — matches triggerInternalHook's production + // semantics (prevents self-scheduling actions from executing in the + // same drain cycle). + const pending = [...event.postHookActions]; + for (const action of pending) { try { await action(); } catch {