Merge pull request #4049 from code-yeongyu/supersede/3790-session-firstmessage-no-clear
fix(hooks): do not clear sessionFirstMessageProcessed on session.idle (supersedes #3790)
This commit is contained in:
@@ -7,7 +7,12 @@ export const sessionInterruptState = new Map<string, { interrupted: boolean }>()
|
||||
export function clearSessionHookState(sessionID: string): void {
|
||||
sessionErrorState.delete(sessionID)
|
||||
sessionInterruptState.delete(sessionID)
|
||||
sessionFirstMessageProcessed.delete(sessionID)
|
||||
// sessionFirstMessageProcessed must NOT be cleared on idle.
|
||||
// It tracks whether the first message of a session has been processed,
|
||||
// so that SessionStart hooks fire only once per session. Clearing it
|
||||
// on idle (which fires after every model response) makes isFirstMessage
|
||||
// always return true, causing SessionStart hooks to fire on every
|
||||
// prompt instead of only the first one.
|
||||
}
|
||||
|
||||
export function clearAllSessionHookState(): void {
|
||||
|
||||
Reference in New Issue
Block a user