Require passing verifier before implementation

This commit is contained in:
Meta Vens 2026-04-30 09:42:54 +01:00
commit cda1b26416
5 changed files with 82 additions and 12 deletions

View file

@ -4665,6 +4665,10 @@ impl CodexMessageProcessor {
.as_ref()
.is_some_and(|state| epiphany_role_finding_already_accepted(state, finding))
});
let verification_result_allows_implementation = verification_result_accepted
&& verification_finding
.as_ref()
.is_some_and(epiphany_verification_finding_allows_implementation);
let source_signals = ThreadEpiphanyCoordinatorSignals {
pressure_level: pressure.level,
@ -4683,6 +4687,7 @@ impl CodexMessageProcessor {
&roles,
&source_signals,
verification_result_accepted,
verification_result_allows_implementation,
reorient_finding_accepted,
);
let note = render_epiphany_coordinator_note(
@ -13993,6 +13998,7 @@ fn map_epiphany_coordinator(
roles: &[ThreadEpiphanyRoleLane],
signals: &ThreadEpiphanyCoordinatorSignals,
verification_result_accepted: bool,
verification_result_allows_implementation: bool,
reorient_finding_accepted: bool,
) -> EpiphanyCoordinatorDecision {
let build = |action,
@ -14095,6 +14101,20 @@ fn map_epiphany_coordinator(
);
}
if signals.verification_result_status == ThreadEpiphanyRoleResultStatus::Completed
&& verification_result_accepted
&& !verification_result_allows_implementation
{
return build(
ThreadEpiphanyCoordinatorAction::LaunchModeling,
Some(ThreadEpiphanyRoleId::Modeling),
Some(ThreadEpiphanySceneAction::RoleLaunch),
false,
true,
"The accepted verification/review finding did not pass; strengthen modeling/checkpoint evidence before implementation continues.",
);
}
if signals.modeling_result_status == ThreadEpiphanyRoleResultStatus::Completed
&& !verification_result_accepted
{
@ -14233,6 +14253,16 @@ fn epiphany_role_finding_already_accepted(
})
}
fn epiphany_verification_finding_allows_implementation(
finding: &ThreadEpiphanyRoleFinding,
) -> bool {
finding.role_id == ThreadEpiphanyRoleId::Verification
&& finding
.verdict
.as_deref()
.is_some_and(|verdict| verdict.eq_ignore_ascii_case("pass"))
}
fn map_epiphany_roles(
state: Option<&EpiphanyThreadState>,
jobs: &[ThreadEpiphanyJob],
@ -16364,6 +16394,10 @@ pub(crate) async fn maybe_run_epiphany_coordinator_automation_for_turn_boundary(
let verification_result_accepted = verification_finding
.as_ref()
.is_some_and(|finding| epiphany_role_finding_already_accepted(&state, finding));
let verification_result_allows_implementation = verification_result_accepted
&& verification_finding
.as_ref()
.is_some_and(epiphany_verification_finding_allows_implementation);
let source_signals = ThreadEpiphanyCoordinatorSignals {
pressure_level: pressure.level,
should_prepare_compaction: pressure.should_prepare_compaction,
@ -16381,6 +16415,7 @@ pub(crate) async fn maybe_run_epiphany_coordinator_automation_for_turn_boundary(
&roles,
&source_signals,
verification_result_accepted,
verification_result_allows_implementation,
reorient_finding_accepted,
);
@ -19632,6 +19667,7 @@ mod tests {
&signals,
false,
false,
false,
);
assert_eq!(
@ -19671,6 +19707,7 @@ mod tests {
&signals,
false,
false,
false,
);
assert_eq!(
@ -19712,6 +19749,7 @@ mod tests {
&[],
&signals,
false,
false,
true,
);
@ -19767,6 +19805,7 @@ mod tests {
&signals,
false,
false,
false,
);
assert_eq!(
@ -19809,6 +19848,7 @@ mod tests {
&signals,
false,
false,
false,
);
assert_eq!(
@ -19847,6 +19887,7 @@ mod tests {
&missing,
false,
false,
false,
);
assert_eq!(
launch_modeling.action,
@ -19872,6 +19913,7 @@ mod tests {
&modeling_backend_unavailable,
false,
false,
false,
);
assert_eq!(
relaunch_modeling.action,
@ -19893,6 +19935,7 @@ mod tests {
&modeling_done,
false,
false,
false,
);
assert_eq!(
launch_verification.action,
@ -19918,6 +19961,7 @@ mod tests {
&verification_done,
false,
false,
false,
);
assert_eq!(
review_verification.action,
@ -19925,6 +19969,26 @@ mod tests {
);
assert!(review_verification.requires_review);
let accepted_needs_evidence_verification = map_epiphany_coordinator(
ThreadEpiphanyReorientStateStatus::Ready,
true,
&pressure,
&recommendation,
&roles,
&verification_done,
true,
false,
false,
);
assert_eq!(
accepted_needs_evidence_verification.action,
ThreadEpiphanyCoordinatorAction::LaunchModeling
);
assert_eq!(
accepted_needs_evidence_verification.target_role,
Some(ThreadEpiphanyRoleId::Modeling)
);
let accepted_verification = map_epiphany_coordinator(
ThreadEpiphanyReorientStateStatus::Ready,
true,
@ -19933,6 +19997,7 @@ mod tests {
&roles,
&verification_done,
true,
true,
false,
);
assert_eq!(
@ -19956,6 +20021,7 @@ mod tests {
&reviewed,
false,
false,
false,
);
assert_eq!(
continue_implementation.action,