From 9744fa0b06edcc29a77cda1ac063465521ea96d9 Mon Sep 17 00:00:00 2001 From: zeroaltitude Date: Mon, 9 Mar 2026 23:24:28 -0700 Subject: [PATCH] fix: default postHookActions to [] for legacy callers Legacy callers constructing hook events without postHookActions would hit a TypeError when drainPostHookActions spreads undefined. Now defaults to empty array at trigger time for backwards compatibility. --- src/hooks/internal-hooks.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hooks/internal-hooks.ts b/src/hooks/internal-hooks.ts index 522406e5d7a..fcc46806132 100644 --- a/src/hooks/internal-hooks.ts +++ b/src/hooks/internal-hooks.ts @@ -297,7 +297,10 @@ export async function triggerInternalHook(event: InternalHookEvent): Promise { + // Default to empty array for legacy callers that construct hook events + // without the postHookActions field (pre-dates this PR's event shape change). + const actions = event.postHookActions ?? []; + await drainPostHookActions(actions, (err) => { const message = err instanceof Error ? err.message : String(err); log.error(`Post-hook action error [${event.type}:${event.action}]: ${message}`); });