Migrate Verification to keyed Mind authority

This commit is contained in:
Meta Vens 2026-08-18 01:34:31 +02:00
commit fc5d1a4a84
21 changed files with 1702 additions and 1288 deletions

View file

@ -1,7 +1,7 @@
use epiphany_core::EpiphanyAgentPassContinuationAction;
use epiphany_core::EpiphanyCrrcAction;
use epiphany_core::EpiphanyCrrcSceneAction;
use epiphany_core::EpiphanyCrrcStateStatus;
use epiphany_core::EpiphanyModelingContinuationAction;
use epiphany_core::EpiphanyReorientFindingInterpretation;
use epiphany_core::EpiphanyRoleBoardLane;
use epiphany_core::EpiphanyRoleFindingInterpretation;
@ -97,6 +97,7 @@ pub fn derive_coordinator_status(
frontier_planning_stage: input.frontier_planning_stage,
proposal_modeling_action: input.proposal_modeling_action,
frontier_verdict_modeling_action: input.frontier_verdict_modeling_action,
verification_action: input.verification_action,
body_modeling_work_ready: input.body_modeling_work_ready,
body_modeling_review_ready: input.body_modeling_review_ready,
});
@ -700,7 +701,7 @@ pub fn recommend_coordinator_action(
if let Some(action) = input.proposal_modeling_action {
return match action {
EpiphanyModelingContinuationAction::Launch => build(
EpiphanyAgentPassContinuationAction::Launch => build(
EpiphanyCoordinatorAction::LaunchModeling,
Some(EpiphanyCoordinatorRoleId::Modeling),
Some(EpiphanyCoordinatorSceneAction::RoleLaunch),
@ -708,7 +709,7 @@ pub fn recommend_coordinator_action(
true,
"The oldest unresolved proposal request is ready for its exact Modeling attempt.",
),
EpiphanyModelingContinuationAction::Wait => build(
EpiphanyAgentPassContinuationAction::Wait => build(
EpiphanyCoordinatorAction::WaitForModelingResult,
Some(EpiphanyCoordinatorRoleId::Modeling),
Some(EpiphanyCoordinatorSceneAction::RoleResult),
@ -716,7 +717,7 @@ pub fn recommend_coordinator_action(
false,
"The exact proposal Modeling attempt is still running.",
),
EpiphanyModelingContinuationAction::Review => build(
EpiphanyAgentPassContinuationAction::Review => build(
EpiphanyCoordinatorAction::ReviewModelingResult,
Some(EpiphanyCoordinatorRoleId::Modeling),
Some(EpiphanyCoordinatorSceneAction::RoleResult),
@ -751,7 +752,7 @@ pub fn recommend_coordinator_action(
if let Some(action) = input.frontier_verdict_modeling_action {
return match action {
EpiphanyModelingContinuationAction::Launch => build(
EpiphanyAgentPassContinuationAction::Launch => build(
EpiphanyCoordinatorAction::LaunchModeling,
Some(EpiphanyCoordinatorRoleId::Modeling),
Some(EpiphanyCoordinatorSceneAction::RoleLaunch),
@ -759,7 +760,7 @@ pub fn recommend_coordinator_action(
true,
"An exact Soul verdict has unresolved keyed frontier Modeling work.",
),
EpiphanyModelingContinuationAction::Wait => build(
EpiphanyAgentPassContinuationAction::Wait => build(
EpiphanyCoordinatorAction::WaitForModelingResult,
Some(EpiphanyCoordinatorRoleId::Modeling),
Some(EpiphanyCoordinatorSceneAction::RoleResult),
@ -767,7 +768,7 @@ pub fn recommend_coordinator_action(
false,
"The exact frontier verdict Modeling attempt is still running.",
),
EpiphanyModelingContinuationAction::Review => build(
EpiphanyAgentPassContinuationAction::Review => build(
EpiphanyCoordinatorAction::ReviewModelingResult,
Some(EpiphanyCoordinatorRoleId::Modeling),
Some(EpiphanyCoordinatorSceneAction::RoleResult),
@ -778,6 +779,35 @@ pub fn recommend_coordinator_action(
};
}
if let Some(action) = input.verification_action {
return match action {
EpiphanyAgentPassContinuationAction::Launch => build(
EpiphanyCoordinatorAction::LaunchVerification,
Some(EpiphanyCoordinatorRoleId::Verification),
Some(EpiphanyCoordinatorSceneAction::RoleLaunch),
false,
true,
"An exact Hands consequence has unresolved keyed Verification work.",
),
EpiphanyAgentPassContinuationAction::Wait => build(
EpiphanyCoordinatorAction::ReviewVerificationResult,
Some(EpiphanyCoordinatorRoleId::Verification),
Some(EpiphanyCoordinatorSceneAction::RoleResult),
false,
false,
"The exact frontier Verification attempt is still running.",
),
EpiphanyAgentPassContinuationAction::Review => build(
EpiphanyCoordinatorAction::ReviewVerificationResult,
Some(EpiphanyCoordinatorRoleId::Verification),
Some(EpiphanyCoordinatorSceneAction::RoleResult),
true,
false,
"The exact frontier Verification result awaits Soul admission.",
),
};
}
if let Some(action) = input.research_continuation_action {
return match action {
RepoFrontierResearchContinuationAction::LaunchResearch => build(
@ -799,26 +829,6 @@ pub fn recommend_coordinator_action(
};
}
if input.implementation_evidence_after_verification
&& matches!(
input.signals.verification_result_status,
EpiphanyCoordinatorRoleResultStatus::MissingBinding
| EpiphanyCoordinatorRoleResultStatus::BackendUnavailable
| EpiphanyCoordinatorRoleResultStatus::BackendMissing
| EpiphanyCoordinatorRoleResultStatus::Cancelled
| EpiphanyCoordinatorRoleResultStatus::Failed
)
{
return build(
EpiphanyCoordinatorAction::LaunchVerification,
Some(EpiphanyCoordinatorRoleId::Verification),
Some(EpiphanyCoordinatorSceneAction::RoleLaunch),
false,
true,
"A complete Hands consequence chain awaits Soul independently of any Eyes lifecycle.",
);
}
if input.signals.modeling_result_status == EpiphanyCoordinatorRoleResultStatus::Completed
&& !input.modeling_result_accepted
&& !(input.modeling_result_failure_reviewed && input.hands_frontier_ready)
@ -902,132 +912,6 @@ pub fn recommend_coordinator_action(
);
}
if input.signals.verification_result_status == EpiphanyCoordinatorRoleResultStatus::Completed
&& !input.verification_result_covers_current_modeling
{
return build(
EpiphanyCoordinatorAction::LaunchVerification,
Some(EpiphanyCoordinatorRoleId::Verification),
Some(EpiphanyCoordinatorSceneAction::RoleLaunch),
false,
true,
"The completed verification/review finding does not cover the currently accepted modeling evidence; relaunch verification before implementation continues.",
);
}
if input.signals.verification_result_status == EpiphanyCoordinatorRoleResultStatus::Completed
&& !input.verification_result_accepted
{
return build(
EpiphanyCoordinatorAction::ReviewVerificationResult,
Some(EpiphanyCoordinatorRoleId::Verification),
Some(EpiphanyCoordinatorSceneAction::RoleResult),
true,
false,
"A verification/review finding is complete and must be reviewed before continuation.",
);
}
if input.signals.verification_result_status == EpiphanyCoordinatorRoleResultStatus::Failed
&& !input.verification_result_accepted
&& input.verification_result_failure_reviewed
{
return build(
EpiphanyCoordinatorAction::LaunchVerification,
Some(EpiphanyCoordinatorRoleId::Verification),
Some(EpiphanyCoordinatorSceneAction::RoleLaunch),
false,
true,
"The failed verification/review result has a supersession review receipt; relaunch Soul against the current evidence.",
);
}
if input.signals.verification_result_status == EpiphanyCoordinatorRoleResultStatus::Failed
&& !input.verification_result_accepted
{
return build(
EpiphanyCoordinatorAction::ReviewVerificationResult,
Some(EpiphanyCoordinatorRoleId::Verification),
Some(EpiphanyCoordinatorSceneAction::RoleResult),
false,
false,
"The verification/review worker failed; inspect the failed Soul result before relaunching verification or continuing implementation.",
);
}
if input.verification_result_accepted && input.implementation_evidence_after_verification {
return build(
EpiphanyCoordinatorAction::LaunchVerification,
Some(EpiphanyCoordinatorRoleId::Verification),
Some(EpiphanyCoordinatorSceneAction::RoleLaunch),
false,
true,
"Implementation evidence was produced after the accepted verification/review finding; rerun verification before implementation continues.",
);
}
if matches!(
input.signals.verification_result_status,
EpiphanyCoordinatorRoleResultStatus::Pending | EpiphanyCoordinatorRoleResultStatus::Running
) {
return build(
EpiphanyCoordinatorAction::ReviewVerificationResult,
Some(EpiphanyCoordinatorRoleId::Verification),
Some(EpiphanyCoordinatorSceneAction::RoleResult),
false,
false,
"A verification/review specialist is already running; wait for its result.",
);
}
if input.signals.verification_result_status == EpiphanyCoordinatorRoleResultStatus::Completed
&& input.verification_result_accepted
&& !input.verification_result_allows_implementation
&& input.verification_result_needs_evidence
&& input.modeling_result_accepted
&& input.verification_result_covers_current_modeling
&& input.hands_frontier_ready
{
return build(
EpiphanyCoordinatorAction::ContinueImplementation,
Some(EpiphanyCoordinatorRoleId::Implementation),
None,
false,
false,
"The accepted verification/review finding asks for implementation evidence from the current modeling checkpoint; continue only the bounded evidence-gathering implementation step before re-verification.",
);
}
if input.signals.verification_result_status == EpiphanyCoordinatorRoleResultStatus::Completed
&& input.verification_result_accepted
&& !input.verification_result_allows_implementation
&& !input.modeling_result_accepted_after_verification
{
return build(
EpiphanyCoordinatorAction::LaunchModeling,
Some(EpiphanyCoordinatorRoleId::Modeling),
Some(EpiphanyCoordinatorSceneAction::RoleLaunch),
false,
true,
"The accepted verification/review finding did not pass; strengthen modeling/checkpoint evidence before implementation continues.",
);
}
if input.signals.verification_result_status == EpiphanyCoordinatorRoleResultStatus::Completed
&& input.verification_result_accepted
&& input.verification_result_allows_implementation
&& !input.modeling_result_accepted_after_verification
{
return build(
EpiphanyCoordinatorAction::LaunchModeling,
Some(EpiphanyCoordinatorRoleId::Modeling),
Some(EpiphanyCoordinatorSceneAction::RoleLaunch),
false,
true,
"Soul has accepted the Hands consequence evidence; route Modeling to update the machine model before another implementation turn.",
);
}
if input.hands_frontier_ready {
return build(
EpiphanyCoordinatorAction::ContinueImplementation,
@ -1076,34 +960,6 @@ pub fn recommend_coordinator_action(
);
}
if input.implementation_evidence_after_verification
&& role_status(&input.roles, EpiphanyCoordinatorRoleId::Verification).is_some_and(
|status| {
matches!(
status,
EpiphanyCoordinatorRoleStatus::Ready | EpiphanyCoordinatorRoleStatus::Needed
)
},
)
&& matches!(
input.signals.verification_result_status,
EpiphanyCoordinatorRoleResultStatus::MissingBinding
| EpiphanyCoordinatorRoleResultStatus::BackendUnavailable
| EpiphanyCoordinatorRoleResultStatus::BackendMissing
| EpiphanyCoordinatorRoleResultStatus::Cancelled
| EpiphanyCoordinatorRoleResultStatus::Failed
)
{
return build(
EpiphanyCoordinatorAction::LaunchVerification,
Some(EpiphanyCoordinatorRoleId::Verification),
Some(EpiphanyCoordinatorSceneAction::RoleLaunch),
false,
true,
"A complete Hands consequence chain is newer than the last accepted Soul boundary; launch Verification against its typed request and receipts.",
);
}
if input.recommendation.action == EpiphanyCrrcAction::RegatherManually {
return build(
EpiphanyCoordinatorAction::RegatherManually,
@ -1115,25 +971,6 @@ pub fn recommend_coordinator_action(
);
}
if input.signals.verification_result_status == EpiphanyCoordinatorRoleResultStatus::Completed
&& input.verification_result_accepted
&& !input.verification_result_allows_implementation
&& (input.verification_result_needs_evidence
|| input.verification_result_cites_implementation_evidence)
&& input.modeling_result_accepted
&& input.verification_result_covers_current_modeling
&& !input.hands_frontier_ready
{
return build(
EpiphanyCoordinatorAction::LaunchModeling,
Some(EpiphanyCoordinatorRoleId::Modeling),
Some(EpiphanyCoordinatorSceneAction::RoleLaunch),
false,
true,
"Soul requests another bounded consequence, but Self has no admitted actionable Hands frontier; reconcile the RepoModel before acting.",
);
}
if input.modeling_result_accepted && !input.hands_frontier_ready {
return build(
EpiphanyCoordinatorAction::AwaitFrontierProposal,
@ -1318,6 +1155,7 @@ mod tests {
frontier_planning_stage: RepoFrontierPlanningLifecycleStage::Unavailable,
proposal_modeling_action: None,
frontier_verdict_modeling_action: None,
verification_action: None,
body_modeling_work_ready: false,
body_modeling_review_ready: false,
}
@ -1398,7 +1236,7 @@ mod tests {
fn selected_user_proposal_preempts_generic_regather() {
let decision = recommend_coordinator_action(EpiphanyCoordinatorInput {
recommendation: recommendation(EpiphanyCrrcAction::RegatherManually),
proposal_modeling_action: Some(EpiphanyModelingContinuationAction::Launch),
proposal_modeling_action: Some(EpiphanyAgentPassContinuationAction::Launch),
..input()
});
assert_eq!(decision.action, EpiphanyCoordinatorAction::LaunchModeling);
@ -1823,7 +1661,8 @@ mod tests {
);
let exact_modeling_work = recommend_coordinator_action(EpiphanyCoordinatorInput {
frontier_verdict_modeling_action: Some(EpiphanyModelingContinuationAction::Launch),
frontier_verdict_modeling_action: Some(EpiphanyAgentPassContinuationAction::Launch),
verification_action: None,
..base.clone()
});
assert_eq!(

View file

@ -6,7 +6,7 @@ use super::EpiphanyPressure;
use super::EpiphanyPressureLevel;
use super::EpiphanyReorientAction;
use super::EpiphanyRoleBoardLane;
use crate::EpiphanyModelingContinuationAction;
use crate::EpiphanyAgentPassContinuationAction;
use crate::RepoFrontierPlanningLifecycleStage;
use crate::RepoFrontierResearchContinuationAction;
use serde::{Deserialize, Serialize};
@ -167,9 +167,12 @@ pub struct EpiphanyCoordinatorInput {
/// lifecycle. Self may advance it, but only Mind's result can decide adoption.
pub frontier_planning_stage: RepoFrontierPlanningLifecycleStage,
/// Exact current action for the oldest unresolved proposal Modeling request.
pub proposal_modeling_action: Option<EpiphanyModelingContinuationAction>,
pub proposal_modeling_action: Option<EpiphanyAgentPassContinuationAction>,
/// Exact current action for one Soul-verdict-bound Modeling request.
pub frontier_verdict_modeling_action: Option<EpiphanyModelingContinuationAction>,
pub frontier_verdict_modeling_action: Option<EpiphanyAgentPassContinuationAction>,
/// Exact current action for one Hands-consequence-bound Verification request.
/// Role lanes, timestamps, and latest-result slots are display-only.
pub verification_action: Option<EpiphanyAgentPassContinuationAction>,
pub body_modeling_work_ready: bool,
pub body_modeling_review_ready: bool,
}
@ -222,8 +225,9 @@ pub struct EpiphanyCoordinatorStatusInput {
pub hands_frontier_ready: bool,
pub research_continuation_action: Option<RepoFrontierResearchContinuationAction>,
pub frontier_planning_stage: RepoFrontierPlanningLifecycleStage,
pub proposal_modeling_action: Option<EpiphanyModelingContinuationAction>,
pub frontier_verdict_modeling_action: Option<EpiphanyModelingContinuationAction>,
pub proposal_modeling_action: Option<EpiphanyAgentPassContinuationAction>,
pub frontier_verdict_modeling_action: Option<EpiphanyAgentPassContinuationAction>,
pub verification_action: Option<EpiphanyAgentPassContinuationAction>,
pub body_modeling_work_ready: bool,
pub body_modeling_review_ready: bool,
}

View file

@ -133,9 +133,12 @@ pub use worker_launch::REPO_FRONTIER_PROPOSAL_MODELING_CONTEXT_CONTRACT;
pub use worker_launch::REPO_FRONTIER_PROPOSAL_MODELING_CONTEXT_SCHEMA_VERSION;
pub use worker_launch::REPO_FRONTIER_RESEARCH_CONTEXT_CONTRACT;
pub use worker_launch::REPO_FRONTIER_RESEARCH_CONTEXT_SCHEMA_VERSION;
pub use worker_launch::REPO_FRONTIER_VERIFICATION_CONTEXT_CONTRACT;
pub use worker_launch::REPO_FRONTIER_VERIFICATION_CONTEXT_SCHEMA_VERSION;
pub use worker_launch::ROLE_WORKER_OUTPUT_CONTRACT_ID;
pub use worker_launch::RepoFrontierPlanMindContextProjection;
pub use worker_launch::RepoFrontierPlanningContextProjection;
pub use worker_launch::RepoFrontierProposalModelingContextProjection;
pub use worker_launch::RepoFrontierResearchContextProjection;
pub use worker_launch::RepoFrontierVerificationContextProjection;
pub use worker_launch::build_reorient_job_launch_request;

View file

@ -38,6 +38,10 @@ pub const REPO_FRONTIER_RESEARCH_CONTEXT_SCHEMA_VERSION: &str =
"epiphany.worker.repo_frontier_research_context.v3";
pub const REPO_FRONTIER_RESEARCH_CONTEXT_CONTRACT: &str =
"epiphany.repo_frontier_research_context.v3";
pub const REPO_FRONTIER_VERIFICATION_CONTEXT_SCHEMA_VERSION: &str =
"epiphany.worker.repo_frontier_verification_context.v1";
pub const REPO_FRONTIER_VERIFICATION_CONTEXT_CONTRACT: &str =
"epiphany.repo_frontier_verification_context.v1";
pub const REPO_FRONTIER_PLAN_MIND_CONTEXT_SCHEMA_VERSION: &str =
"epiphany.worker.repo_frontier_plan_mind_context.v0";
pub const REPO_FRONTIER_PLAN_MIND_CONTEXT_CONTRACT: &str =
@ -112,6 +116,8 @@ pub struct EpiphanyRoleWorkerLaunchDocument {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub frontier_research_context: Option<RepoFrontierResearchContextProjection>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub frontier_verification_context: Option<RepoFrontierVerificationContextProjection>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub frontier_plan_mind_context: Option<RepoFrontierPlanMindContextProjection>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub imagination_consideration_context: Option<ImaginationConsiderationContextProjection>,
@ -317,6 +323,21 @@ pub struct ImaginationConsiderationContextProjection {
pub model: crate::EpiphanyRepoModelView,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RepoFrontierVerificationContextProjection {
pub schema_version: String,
pub request: crate::RepoFrontierVerificationRequest,
pub route: crate::RepoFrontierRoute,
pub hands_authority: crate::RepoFrontierHandsAuthority,
pub hands_intent: crate::HandsActionIntent,
pub hands_review: crate::HandsActionReview,
pub patch_receipt: crate::HandsPatchReceipt,
pub command_receipt: crate::HandsCommandReceipt,
pub commit_receipt: crate::HandsCommitReceipt,
pub contract: String,
}
impl ImaginationConsiderationContextProjection {
pub(crate) fn new(
request: &crate::ImaginationConsiderationRequest,
@ -427,6 +448,7 @@ pub fn build_reorient_job_launch_request(
admitted_model_direction_consideration_request_id: None,
repo_frontier_modeling_request_id: None,
repo_frontier_research_request_id: None,
repo_frontier_verification_request_id: None,
}
}