feat(ulw-loop): require Oracle verification before completion
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -5,6 +5,8 @@ import { clearBoulderState } from "../features/boulder-state"
|
||||
import { log } from "../shared"
|
||||
import { resolveSessionAgent } from "./session-agent-resolver"
|
||||
import { parseRalphLoopArguments } from "../hooks/ralph-loop/command-arguments"
|
||||
import { ULTRAWORK_VERIFICATION_PROMISE } from "../hooks/ralph-loop/constants"
|
||||
import { readState } from "../hooks/ralph-loop/storage"
|
||||
|
||||
import type { CreatedHooks } from "../create-hooks"
|
||||
|
||||
@@ -62,6 +64,22 @@ export function createToolExecuteBeforeHandler(args: {
|
||||
const resolvedAgent = await resolveSessionAgent(ctx.client, sessionId)
|
||||
argsObject.subagent_type = resolvedAgent ?? "continue"
|
||||
}
|
||||
|
||||
const normalizedSubagentType =
|
||||
typeof argsObject.subagent_type === "string" ? argsObject.subagent_type : undefined
|
||||
const prompt = typeof argsObject.prompt === "string" ? argsObject.prompt : ""
|
||||
const loopState = typeof ctx.directory === "string" ? readState(ctx.directory) : null
|
||||
const shouldInjectOracleVerification =
|
||||
normalizedSubagentType === "oracle"
|
||||
&& loopState?.active === true
|
||||
&& loopState.ultrawork === true
|
||||
&& loopState.verification_pending === true
|
||||
&& loopState.session_id === input.sessionID
|
||||
|
||||
if (shouldInjectOracleVerification) {
|
||||
argsObject.run_in_background = false
|
||||
argsObject.prompt = `${prompt ? `${prompt}\n\n` : ""}You are verifying the active ULTRAWORK loop result for this session. Review whether the original task is truly complete: ${loopState.prompt}\n\nIf the work is fully complete, end your response with <promise>${ULTRAWORK_VERIFICATION_PROMISE}</promise>. If the work is not complete, explain the blocking issues clearly and DO NOT emit that promise.`
|
||||
}
|
||||
}
|
||||
|
||||
if (hooks.ralphLoop && input.tool === "skill") {
|
||||
|
||||
Reference in New Issue
Block a user