Skip to main content

FinishGate

Type Alias FinishGate 

Source
pub type FinishGate = Arc<dyn Fn(&Transcript) -> FinishGateOutcome + Send + Sync>;
Expand description

Verify-before-finish gate hook (#2279): inspects the run’s own Transcript at the exact moment a successful finish_task call would otherwise terminate the loop, and may reject it with a human-readable reason instead.

Why: A closure (rather than a trait) lets two very different verification strategies share one turn-boundary hook without agent_loop knowing about either concrete strategy: a delegated engineer’s own loop needs only its own Transcript (its bash calls land there directly — see crate::verify_gate::default_finish_gate); the delegating PM’s loop never calls bash itself, so its gate closure instead captures an external run_task::SharedTranscript and consults that instead (see crate::verify_gate::pm_finish_gate). This is the SAME decoupling Self::stop_signal (#2265 fix #5) already established for “some external condition the loop must consult at a turn boundary” — reused here rather than adding a bespoke third turn-boundary check. What: Returns a crate::verify_gate::FinishGateOutcome — accept, accept with a note folded into the recorded completion report (#8206), or reject with the message fed back to the model as the rejected finish_task call’s recoverable tool result. Test: agent_loop::tests::finish_gate_*.

Aliased Type§

pub struct FinishGate { /* private fields */ }