Skip to main content

parse_latest_verify

Function parse_latest_verify 

Source
pub fn parse_latest_verify(transcript: &str) -> Option<VerifyOutcome>
Expand description

Find the LAST canonical VERIFY_RESULT: sentinel in transcript and parse it. Returns None if none is present. This is the deterministic-gate seam.

Canonical means ANCHORED and exactly the shape render_verify_result emits as its last line (VERIFY_RESULT: PASS|FAIL exit_code=<i32> command=<cmd> — uppercase verdict, fixed field order). Anchored = the sentinel starts the line, or is immediately preceded by the [Tool result: wrapper messages_to_text puts around a tool result — the only two placements the renderer produces for a genuine tool sentinel. A prose mention mid-line (“look for VERIFY_RESULT: PASS …”) or a loosely fabricated line does not gate.

Residual risk: this still parses the rendered transcript, so an assistant message (or untrusted tool output) reproducing the exact format at the start of its own line can forge a verdict. Closing that requires keying the gate on the VerifyOutcome recorded when the tool itself executes (runner state) — until then this is best-effort hardening, not a security boundary.