fix(ralph-loop): harden Oracle VERIFIED detection
Replace fragile regex text matching with structured detection for Oracle verification evidence. - Add oracle-verification-detector.ts with parseOracleVerificationEvidence() - Use structured parsing instead of multiple regex patterns - Add comprehensive test coverage for edge cases - Update completion-promise-detector.ts to use isOracleVerified() - Update pending-verification-handler.ts to use structured extraction Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -3,6 +3,7 @@ import { existsSync, readFileSync } from "node:fs"
|
||||
import { log } from "../../shared/logger"
|
||||
import { HOOK_NAME } from "./constants"
|
||||
import { ULTRAWORK_VERIFICATION_PROMISE } from "./constants"
|
||||
import { isOracleVerified } from "./oracle-verification-detector"
|
||||
import { withTimeout } from "./with-timeout"
|
||||
|
||||
interface OpenCodeSessionMessage {
|
||||
@@ -17,8 +18,6 @@ interface TranscriptEntry {
|
||||
tool_output?: { output?: string } | string
|
||||
}
|
||||
|
||||
const ORACLE_AGENT_PATTERN = /Agent:\s*oracle/i
|
||||
|
||||
function extractTranscriptEntryText(entry: TranscriptEntry): string {
|
||||
if (typeof entry.content === "string") return entry.content
|
||||
if (typeof entry.tool_output === "string") return entry.tool_output
|
||||
@@ -47,7 +46,7 @@ function shouldInspectSessionMessagePart(
|
||||
return false
|
||||
}
|
||||
|
||||
return promise === ULTRAWORK_VERIFICATION_PROMISE && ORACLE_AGENT_PATTERN.test(partText)
|
||||
return promise === ULTRAWORK_VERIFICATION_PROMISE && isOracleVerified(partText)
|
||||
}
|
||||
|
||||
function shouldInspectTranscriptEntry(
|
||||
@@ -63,7 +62,7 @@ function shouldInspectTranscriptEntry(
|
||||
return false
|
||||
}
|
||||
|
||||
return promise === ULTRAWORK_VERIFICATION_PROMISE && ORACLE_AGENT_PATTERN.test(entryText)
|
||||
return promise === ULTRAWORK_VERIFICATION_PROMISE && isOracleVerified(entryText)
|
||||
}
|
||||
|
||||
export function detectCompletionInTranscript(
|
||||
|
||||
Reference in New Issue
Block a user