fix: use boulder agent instead of hardcoded Atlas check for continuation

Address code review: continuation was blocked unless last agent was Atlas,
making the new agent parameter ineffective. Now the idle handler checks if
the last session agent matches boulderState.agent (defaults to 'atlas'),
allowing non-Atlas agents to resume when properly configured.

- Add getLastAgentFromSession helper for agent lookup
- Replace isCallerOrchestrator gate with boulder-agent-aware check
- Add test for non-Atlas agent continuation scenario
This commit is contained in:
Rishi Vhavle
2026-02-04 13:06:34 +05:30
parent d8137c0c90
commit 169ccb6b05
2 changed files with 54 additions and 6 deletions
+15 -2
View File
@@ -26,6 +26,13 @@ function isSisyphusPath(filePath: string): boolean {
const WRITE_EDIT_TOOLS = ["Write", "Edit", "write", "edit"]
function getLastAgentFromSession(sessionID: string): string | null {
const messageDir = getMessageDir(sessionID)
if (!messageDir) return null
const nearest = findNearestMessageWithFields(messageDir)
return nearest?.agent?.toLowerCase() ?? null
}
const DIRECT_WORK_REMINDER = `
---
@@ -549,8 +556,14 @@ export function createAtlasHook(
return
}
if (!isCallerOrchestrator(sessionID)) {
log(`[${HOOK_NAME}] Skipped: last agent is not Atlas`, { sessionID })
const requiredAgent = (boulderState.agent ?? "atlas").toLowerCase()
const lastAgent = getLastAgentFromSession(sessionID)
if (!lastAgent || lastAgent !== requiredAgent) {
log(`[${HOOK_NAME}] Skipped: last agent does not match boulder agent`, {
sessionID,
lastAgent: lastAgent ?? "unknown",
requiredAgent,
})
return
}