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

@ -513,7 +513,7 @@ fn run_coordinator(args: &Args) -> Result<Value> {
let current = epiphany_core::project_current_work(&runtime_store)?
.proposal_modeling
.filter(|work| {
work.action == epiphany_core::EpiphanyModelingContinuationAction::Launch
work.action == epiphany_core::EpiphanyAgentPassContinuationAction::Launch
})
.ok_or_else(|| anyhow!("proposal Modeling request is not launchable"))?;
if current.request.request_id != request_id {
@ -836,6 +836,45 @@ fn run_coordinator(args: &Args) -> Result<Value> {
steps.push(step);
continue;
}
if role_id == "verification"
&& let Some(job_id) =
epiphany_core::current_frontier_verification_review_job_id(
&runtime_store,
)?
{
let result =
epiphany_core::runtime_role_worker_result(&runtime_store, &job_id)?
.ok_or_else(|| {
anyhow!("frontier Verification review lost its typed result")
})?;
push_event(
&mut step,
json!({"type": "frontierVerificationResult", "roleId": role_id, "result": result}),
);
if !args.auto_review {
final_action = json!({
"action": "reviewVerificationResult",
"reason": "The exact frontier Verification result awaits Soul admission.",
"runtimeJobId": job_id,
});
append_operator_step_jsonl(&steps_path, &step)?;
steps.push(step);
break;
}
let accepted = epiphany_core::accept_frontier_verification_result(
&runtime_store,
&job_id,
&now(),
)?;
push_event(
&mut step,
json!({"type": "frontierVerificationAccept", "roleId": role_id, "commit": accepted}),
);
final_status = collect_coordinator_status(&runtime_store, &thread_id)?;
append_operator_step_jsonl(&steps_path, &step)?;
steps.push(step);
continue;
}
if role_id == "modeling"
&& let Some(job_id) =
epiphany_core::current_proposal_modeling_review_job_id(&runtime_store)?
@ -1124,6 +1163,7 @@ fn run_coordinator(args: &Args) -> Result<Value> {
None
};
let thread_free_role = role_id == "research"
|| role_id == "verification"
|| (role_id == "modeling"
&& (proposal_modeling_request_id.is_some()
|| status["currentWork"]["bodyModeling"].is_object()
@ -1137,6 +1177,15 @@ fn run_coordinator(args: &Args) -> Result<Value> {
"bindingId": epiphany_core::EPIPHANY_RESEARCH_ROLE_BINDING_ID,
"backendJobId": job_id,
})
} else if role_id == "verification" {
let job_id = epiphany_core::launch_current_frontier_verification_work(
&runtime_store,
&now(),
)?;
json!({
"bindingId": epiphany_core::EPIPHANY_VERIFICATION_ROLE_BINDING_ID,
"backendJobId": job_id,
})
} else if role_id == "modeling"
&& let Some(request_id) = proposal_modeling_request_id
{
@ -1144,7 +1193,7 @@ fn run_coordinator(args: &Args) -> Result<Value> {
.proposal_modeling
.filter(|work| {
work.action
== epiphany_core::EpiphanyModelingContinuationAction::Launch
== epiphany_core::EpiphanyAgentPassContinuationAction::Launch
})
.ok_or_else(|| anyhow!("proposal Modeling work is not launchable"))?;
if current.request.request_id != request_id {
@ -1779,10 +1828,15 @@ fn launch_role(
"Research launch must use the keyed frontier Research current-work owner"
));
}
if role == epiphany_core::EpiphanyRoleResultRoleId::Verification {
return Err(anyhow!(
"Verification launch must use the keyed frontier Verification current-work owner"
));
}
let expected_revision = expected_revision.and_then(|value| u64::try_from(value).ok());
let focus =
epiphany_core::role_launch_context_focus(&state, epiphany_core::epiphany_role_label(role));
let mut context = if role == epiphany_core::EpiphanyRoleResultRoleId::Modeling {
let context = if role == epiphany_core::EpiphanyRoleResultRoleId::Modeling {
epiphany_core::render_modeling_launch_dynamic_prompt_context(
runtime_store,
local_verse_store,
@ -1799,14 +1853,6 @@ fn launch_role(
}
.map_err(anyhow::Error::msg)?;
let dynamic_context_rendered_ms = started.elapsed().as_millis();
if role == epiphany_core::EpiphanyRoleResultRoleId::Verification {
context = epiphany_core::append_verification_hands_receipt_context(
context,
runtime_store,
&state,
)
.map_err(anyhow::Error::msg)?;
}
let role_context_augmented_ms = started.elapsed().as_millis();
let request = epiphany_core::build_epiphany_role_launch_request_with_dynamic_context(
thread_id,
@ -1933,6 +1979,11 @@ fn accept_role(
.state()?
.ok_or_else(|| anyhow!("cannot accept role without native coordinator state"))?;
let role = parse_role_id(role_id)?;
if role == epiphany_core::EpiphanyRoleResultRoleId::Verification {
return Err(anyhow!(
"Verification acceptance must use the keyed frontier Verification current-work owner"
));
}
let accepted = service.accept_role(
thread_id,
&state,
@ -2889,7 +2940,6 @@ mod tests {
for required in [
"render_launch_dynamic_prompt_context",
"render_modeling_launch_dynamic_prompt_context",
"append_verification_hands_receipt_context",
".launch_job(",
".accept_role(",
] {
@ -2901,6 +2951,7 @@ mod tests {
for forbidden in [
concat!("append_modeling_work_loop_telemetry_", "context"),
concat!("accepted_research_is_newest_", "unmodeled_boundary"),
concat!("append_verification_hands_receipt_", "context"),
] {
assert!(!source.contains(forbidden));
}

View file

@ -471,16 +471,6 @@ fn run_native_status(args: &Args, include_auxiliary_status: bool) -> Result<Valu
.flatten()
})
.is_some_and(|result| result.proposal_modeling_request_id.is_some());
let native_hands_consequence_after_boundary = match state_ref {
Some(state) => {
epiphany_core::has_complete_hands_consequence_after_latest_accepted_boundary(
&runtime_store_path,
state,
)
.map_err(anyhow::Error::msg)?
}
None => false,
};
let hands_frontier_ready = current_work.hands_frontier_ready;
let research_continuation_action = current_work.research_continuation_action;
let frontier_planning_eligibility = epiphany_core::runtime_repo_frontier_planning_eligibility(
@ -534,8 +524,7 @@ fn run_native_status(args: &Args, include_auxiliary_status: bool) -> Result<Valu
modeling_result_accepted_after_verification: finding_signals
.modeling_result_accepted_after_verification,
implementation_evidence_after_verification: finding_signals
.implementation_evidence_after_verification
|| native_hands_consequence_after_boundary,
.implementation_evidence_after_verification,
verification_result_cites_implementation_evidence: finding_signals
.verification_result_cites_implementation_evidence,
verification_result_covers_current_modeling: finding_signals
@ -554,9 +543,10 @@ fn run_native_status(args: &Args, include_auxiliary_status: bool) -> Result<Valu
.frontier_verdict_modeling
.as_ref()
.map(|work| work.action),
verification_action: current_work.verification.as_ref().map(|work| work.action),
body_modeling_work_ready: current_work.body_modeling.is_some(),
body_modeling_review_ready: current_work.body_modeling_action
== Some(epiphany_core::EpiphanyModelingContinuationAction::Review),
== Some(epiphany_core::EpiphanyAgentPassContinuationAction::Review),
});
let coordinator_json = coordinator_status_json(&coordinator)?;
let tool_invocations = native_tool_invocation_surface(&runtime_store_path)?;
@ -648,10 +638,9 @@ fn run_native_status(args: &Args, include_auxiliary_status: bool) -> Result<Valu
"modelingResultReviewable": finding_signals.modeling_result_reviewable,
"modelingResultFailureReviewed": finding_signals.modeling_result_failure_reviewed,
"modelingResultProposalBound": modeling_result_proposal_bound,
"nativeHandsConsequenceAfterBoundary": native_hands_consequence_after_boundary,
"imaginationFrontierReady": imagination_frontier_ready,
"pendingProposalModelingRequestId": proposal_modeling_work
.filter(|work| work.action == epiphany_core::EpiphanyModelingContinuationAction::Launch)
.filter(|work| work.action == epiphany_core::EpiphanyAgentPassContinuationAction::Launch)
.map(|work| work.request.request_id.as_str()),
"verificationResultAccepted": finding_signals.verification_result_accepted,
"verificationResultFailureReviewed": finding_signals.verification_result_failure_reviewed,