Add Epiphany MVP dogfood runner

This commit is contained in:
Meta Vens 2026-04-28 16:34:05 +01:00
commit f1771e11df
10 changed files with 439 additions and 16 deletions

View file

@ -4438,6 +4438,12 @@ impl CodexMessageProcessor {
result_status,
checkpoint_present,
finding.is_some(),
finding.as_ref().is_some_and(|finding| {
thread
.epiphany_state
.as_ref()
.is_some_and(|state| epiphany_reorient_finding_already_accepted(state, finding))
}),
);
let roles = map_epiphany_roles(
@ -5077,6 +5083,12 @@ impl CodexMessageProcessor {
.and_then(|state| state.investigation_checkpoint.as_ref())
.is_some(),
finding.is_some(),
finding.as_ref().is_some_and(|finding| {
thread
.epiphany_state
.as_ref()
.is_some_and(|state| epiphany_reorient_finding_already_accepted(state, finding))
}),
);
let note = format!(
"{} Result status: {:?}. {}",
@ -13170,6 +13182,7 @@ fn map_epiphany_crrc_recommendation(
result_status: ThreadEpiphanyReorientResultStatus,
checkpoint_present: bool,
finding_present: bool,
finding_accepted: bool,
) -> ThreadEpiphanyCrrcRecommendation {
let build = |action: ThreadEpiphanyCrrcAction,
recommended_scene_action: Option<ThreadEpiphanySceneAction>,
@ -13205,13 +13218,20 @@ fn map_epiphany_crrc_recommendation(
);
}
ThreadEpiphanyReorientResultStatus::Completed => {
if finding_present {
if finding_present && !finding_accepted {
return build(
ThreadEpiphanyCrrcAction::AcceptReorientResult,
Some(ThreadEpiphanySceneAction::ReorientAccept),
"A completed reorientation finding is available; review and explicitly accept it before continuing.",
);
}
if finding_accepted && decision.action == ThreadEpiphanyReorientAction::Regather {
return build(
ThreadEpiphanyCrrcAction::RegatherManually,
Some(ThreadEpiphanySceneAction::Reorient),
"The reorientation finding is already accepted; re-gather from the banked checkpoint before implementation continues.",
);
}
return build(
ThreadEpiphanyCrrcAction::ReviewReorientResult,
Some(ThreadEpiphanySceneAction::ReorientResult),
@ -13262,6 +13282,18 @@ fn map_epiphany_crrc_recommendation(
)
}
fn epiphany_reorient_finding_already_accepted(
state: &EpiphanyThreadState,
finding: &ThreadEpiphanyReorientFinding,
) -> bool {
let accepted_summary = reorient_finding_summary(finding);
state.recent_evidence.iter().any(|evidence| {
evidence.kind == "reorient_result"
&& evidence.status == "accepted"
&& evidence.summary == accepted_summary
})
}
fn map_epiphany_roles(
state: Option<&EpiphanyThreadState>,
jobs: &[ThreadEpiphanyJob],
@ -17491,6 +17523,7 @@ mod tests {
ThreadEpiphanyReorientResultStatus::MissingBinding,
true,
false,
false,
);
assert_eq!(recommendation.action, ThreadEpiphanyCrrcAction::Continue);
@ -17527,6 +17560,7 @@ mod tests {
ThreadEpiphanyReorientResultStatus::MissingBinding,
true,
false,
false,
);
assert_eq!(
@ -17566,6 +17600,7 @@ mod tests {
ThreadEpiphanyReorientResultStatus::Completed,
true,
true,
false,
);
assert_eq!(
@ -17578,6 +17613,46 @@ mod tests {
);
}
#[test]
fn map_epiphany_crrc_recommendation_does_not_reaccept_banked_finding() {
let pressure = map_epiphany_pressure(None);
let decision = ThreadEpiphanyReorientDecision {
action: ThreadEpiphanyReorientAction::Regather,
checkpoint_status: ThreadEpiphanyReorientCheckpointStatus::RegatherRequired,
checkpoint_id: Some("ix-accepted".to_string()),
pressure_level: pressure.level,
retrieval_status: ThreadEpiphanyRetrievalFreshnessStatus::Ready,
graph_status: ThreadEpiphanyGraphFreshnessStatus::Ready,
watcher_status: ThreadEpiphanyInvalidationStatus::Clean,
reasons: vec![ThreadEpiphanyReorientReason::CheckpointRequestedRegather],
checkpoint_dirty_paths: Vec::new(),
checkpoint_changed_paths: Vec::new(),
active_frontier_node_ids: Vec::new(),
next_action: "Regather from the accepted result.".to_string(),
note: "accepted".to_string(),
};
let recommendation = map_epiphany_crrc_recommendation(
true,
ThreadEpiphanyReorientStateStatus::Ready,
&pressure,
&decision,
ThreadEpiphanyReorientResultStatus::Completed,
true,
true,
true,
);
assert_eq!(
recommendation.action,
ThreadEpiphanyCrrcAction::RegatherManually
);
assert_eq!(
recommendation.recommended_scene_action,
Some(ThreadEpiphanySceneAction::Reorient)
);
}
#[test]
fn map_epiphany_roles_projects_mvp_ownership_lanes() {
let state = codex_protocol::protocol::EpiphanyThreadState {