fix(todo-continuation): clean up idle event diagnostics

This commit is contained in:
YeonGyu-Kim
2026-05-15 21:29:21 +09:00
parent 047ca069a2
commit 65c1283338
2 changed files with 9 additions and 9 deletions
@@ -2,19 +2,19 @@ import type { PluginInput } from "@opencode-ai/plugin"
import type { BackgroundManager } from "../../features/background-agent"
import { getSessionAgent } from "../../features/claude-code-session-state"
import { normalizeSDKResponse } from "../../shared"
import { log } from "../../shared/logger"
import { getAgentConfigKey } from "../../shared/agent-display-names"
import { log } from "../../shared/logger"
import { ABORT_WINDOW_MS, CONTINUATION_COOLDOWN_MS, DEFAULT_SKIP_AGENTS, FAILURE_RESET_WINDOW_MS, HOOK_NAME, MAX_CONSECUTIVE_FAILURES } from "./constants"
import { isLastAssistantMessageAborted } from "./abort-detection"
import { acknowledgeCompactionGuard, isCompactionGuardActive } from "./compaction-guard"
import { ABORT_WINDOW_MS, CONTINUATION_COOLDOWN_MS, DEFAULT_SKIP_AGENTS, FAILURE_RESET_WINDOW_MS, HOOK_NAME, MAX_CONSECUTIVE_FAILURES } from "./constants"
import { startCountdown } from "./countdown"
import { hasUnansweredQuestion } from "./pending-question-detection"
import { resolveLatestMessageInfo } from "./resolve-message-info"
import type { SessionStateStore } from "./session-state"
import { shouldStopForStagnation } from "./stagnation-detection"
import { getIncompleteCount } from "./todo"
import type { MessageInfo, MessageWithInfo, ResolvedMessageInfo, Todo } from "./types"
import { resolveLatestMessageInfo } from "./resolve-message-info"
import { acknowledgeCompactionGuard, isCompactionGuardActive } from "./compaction-guard"
import type { SessionStateStore } from "./session-state"
import { startCountdown } from "./countdown"
import type { MessageWithInfo, ResolvedMessageInfo, Todo } from "./types"
export async function handleSessionIdle(args: {
ctx: PluginInput
@@ -132,7 +132,7 @@ export async function handleSessionIdle(args: {
}
const effectiveCooldown =
CONTINUATION_COOLDOWN_MS * Math.pow(2, Math.min(state.consecutiveFailures, 5))
CONTINUATION_COOLDOWN_MS * 2 ** Math.min(state.consecutiveFailures, 5)
if (state.lastInjectedAt && Date.now() - state.lastInjectedAt < effectiveCooldown) {
log(`[${HOOK_NAME}] Skipped: cooldown active`, { sessionID, effectiveCooldown, consecutiveFailures: state.consecutiveFailures })
return
@@ -1,5 +1,5 @@
import { log } from "../../shared/logger"
import { resolveMessageEventSessionID, resolveSessionEventID } from "../../shared/event-session-id"
import { log } from "../../shared/logger"
import { COUNTDOWN_GRACE_PERIOD_MS, HOOK_NAME } from "./constants"
import type { SessionStateStore } from "./session-state"