fix(ralph-loop): continue ultrawork until oracle verifies
Keep /ulw-loop iterating after the main session emits DONE so completion still depends on an actual Oracle VERIFIED result. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import type { PluginInput } from "@opencode-ai/plugin"
|
||||
import { log } from "../../shared/logger"
|
||||
import { HOOK_NAME } from "./constants"
|
||||
import type { RalphLoopState } from "./types"
|
||||
import { handleFailedVerification } from "./verification-failure-handler"
|
||||
|
||||
type LoopStateController = {
|
||||
restartAfterFailedVerification: (sessionID: string, messageCountAtStart?: number) => RalphLoopState | null
|
||||
}
|
||||
|
||||
export async function handlePendingVerification(
|
||||
ctx: PluginInput,
|
||||
input: {
|
||||
sessionID: string
|
||||
state: RalphLoopState
|
||||
verificationSessionID?: string
|
||||
matchesParentSession: boolean
|
||||
matchesVerificationSession: boolean
|
||||
loopState: LoopStateController
|
||||
directory: string
|
||||
apiTimeoutMs: number
|
||||
},
|
||||
): Promise<void> {
|
||||
const {
|
||||
sessionID,
|
||||
state,
|
||||
verificationSessionID,
|
||||
matchesParentSession,
|
||||
matchesVerificationSession,
|
||||
loopState,
|
||||
directory,
|
||||
apiTimeoutMs,
|
||||
} = input
|
||||
|
||||
if (matchesParentSession || (verificationSessionID && matchesVerificationSession)) {
|
||||
const restarted = await handleFailedVerification(ctx, {
|
||||
state,
|
||||
loopState,
|
||||
directory,
|
||||
apiTimeoutMs,
|
||||
})
|
||||
if (restarted) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
log(`[${HOOK_NAME}] Waiting for oracle verification`, {
|
||||
sessionID,
|
||||
verificationSessionID,
|
||||
iteration: state.iteration,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user