Skip to content

Commit a29e50c

Browse files
committed
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)
1 parent a3ff28b commit a29e50c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/hooks/todo-continuation-enforcer.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,18 +268,23 @@ export function createTodoContinuationEnforcer(ctx: PluginInput): TodoContinuati
268268
if (event.type === "message.updated") {
269269
const info = props?.info as Record<string, unknown> | undefined
270270
const sessionID = info?.sessionID as string | undefined
271-
log(`[${HOOK_NAME}] message.updated received`, { sessionID, role: info?.role })
271+
const role = info?.role as string | undefined
272+
const finish = info?.finish as boolean | undefined
273+
log(`[${HOOK_NAME}] message.updated received`, { sessionID, role, finish })
272274

273-
if (sessionID && info?.role === "user") {
275+
if (sessionID && role === "user") {
274276
const countdown = pendingCountdowns.get(sessionID)
275277
if (countdown) {
276278
clearInterval(countdown.intervalId)
277279
pendingCountdowns.delete(sessionID)
278280
log(`[${HOOK_NAME}] Cancelled countdown on user message`, { sessionID })
279281
}
280282
}
281-
282283

284+
if (sessionID && role === "assistant" && finish) {
285+
remindedSessions.delete(sessionID)
286+
log(`[${HOOK_NAME}] Cleared reminded state on assistant finish`, { sessionID })
287+
}
283288
}
284289

285290
if (event.type === "session.deleted") {

0 commit comments

Comments
 (0)