fix(todo-continuation-enforcer): clear reminded state on assistant finish
- Fixed bug where remindedSessions was never cleared after assistant response - Now clears reminded state when assistant finishes (finish: true) - Allows TODO continuation to trigger again after each assistant response - Ensures continuation prompt can be injected multiple times if needed in long sessions 🤖 GENERATED WITH ASSISTANCE OF [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
@@ -268,9 +268,11 @@ export function createTodoContinuationEnforcer(ctx: PluginInput): TodoContinuati
|
|||||||
if (event.type === "message.updated") {
|
if (event.type === "message.updated") {
|
||||||
const info = props?.info as Record<string, unknown> | undefined
|
const info = props?.info as Record<string, unknown> | undefined
|
||||||
const sessionID = info?.sessionID as string | undefined
|
const sessionID = info?.sessionID as string | undefined
|
||||||
log(`[${HOOK_NAME}] message.updated received`, { sessionID, role: info?.role })
|
const role = info?.role as string | undefined
|
||||||
|
const finish = info?.finish as boolean | undefined
|
||||||
|
log(`[${HOOK_NAME}] message.updated received`, { sessionID, role, finish })
|
||||||
|
|
||||||
if (sessionID && info?.role === "user") {
|
if (sessionID && role === "user") {
|
||||||
const countdown = pendingCountdowns.get(sessionID)
|
const countdown = pendingCountdowns.get(sessionID)
|
||||||
if (countdown) {
|
if (countdown) {
|
||||||
clearInterval(countdown.intervalId)
|
clearInterval(countdown.intervalId)
|
||||||
@@ -278,8 +280,11 @@ export function createTodoContinuationEnforcer(ctx: PluginInput): TodoContinuati
|
|||||||
log(`[${HOOK_NAME}] Cancelled countdown on user message`, { sessionID })
|
log(`[${HOOK_NAME}] Cancelled countdown on user message`, { sessionID })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (sessionID && role === "assistant" && finish) {
|
||||||
|
remindedSessions.delete(sessionID)
|
||||||
|
log(`[${HOOK_NAME}] Cleared reminded state on assistant finish`, { sessionID })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.type === "session.deleted") {
|
if (event.type === "session.deleted") {
|
||||||
|
|||||||
Reference in New Issue
Block a user