fix(hooks): guard stale idle prompts

This commit is contained in:
YeonGyu-Kim
2026-05-13 16:44:52 +09:00
parent a337635e3b
commit 3b4d2431ee
7 changed files with 94 additions and 11 deletions
+10 -2
View File
@@ -19,7 +19,7 @@ import { isSessionInBoulderLineage } from "./boulder-session-lineage"
import { createInternalAgentContinuationTextPart } from "../../shared"
import { getAgentConfigKey } from "../../shared/agent-display-names"
import { log } from "../../shared/logger"
import { settleAfterSessionIdle } from "../shared/session-idle-settle"
import { shouldPromptAfterSessionIdle } from "../shared/session-idle-settle"
import { injectBoulderContinuation } from "./boulder-continuation-injector"
import { HOOK_NAME } from "./hook-name"
import { resolveActiveBoulderSession } from "./resolve-active-boulder-session"
@@ -283,6 +283,11 @@ export async function handleAtlasSessionIdle(input: {
boulderState.agent ?? (isAgentRegistered("atlas") ? "atlas" : undefined),
)
if (atlasAgent && isAgentRegistered(atlasAgent)) {
if (!(await shouldPromptAfterSessionIdle(ctx.client, sessionID, options?.idleSettleMs))) {
log(`[${HOOK_NAME}] Boulder completion nudge skipped because session is active`, { sessionID })
return
}
await ctx.client.session.promptAsync({
path: { id: sessionID },
body: {
@@ -379,7 +384,10 @@ export async function handleAtlasSessionIdle(input: {
return
}
await settleAfterSessionIdle(options?.idleSettleMs)
if (!(await shouldPromptAfterSessionIdle(ctx.client, sessionID, options?.idleSettleMs))) {
log(`[${HOOK_NAME}] Skipped: session became active during idle settle`, { sessionID })
return
}
await injectContinuation({
ctx,