Migrate Verification to keyed Mind authority
This commit is contained in:
parent
edfa1dab8b
commit
fc5d1a4a84
21 changed files with 1702 additions and 1288 deletions
|
|
@ -561,10 +561,6 @@ pub fn epiphany_role_launch_output_schema(role_id: EpiphanyRoleResultRoleId) ->
|
|||
"additionalProperties": false
|
||||
}
|
||||
});
|
||||
if role_id == EpiphanyRoleResultRoleId::Verification {
|
||||
properties["verificationRequestId"] = serde_json::json!({"type": "string", "minLength": 1});
|
||||
properties["frontierRouteId"] = serde_json::json!({"type": "string", "minLength": 1});
|
||||
}
|
||||
let mut required = vec![
|
||||
"roleId",
|
||||
"verdict",
|
||||
|
|
@ -572,10 +568,6 @@ pub fn epiphany_role_launch_output_schema(role_id: EpiphanyRoleResultRoleId) ->
|
|||
"nextSafeMove",
|
||||
"filesInspected",
|
||||
];
|
||||
if role_id == EpiphanyRoleResultRoleId::Verification {
|
||||
required.push("verificationRequestId");
|
||||
required.push("frontierRouteId");
|
||||
}
|
||||
if role_id == EpiphanyRoleResultRoleId::Imagination {
|
||||
if let Some(map) = properties.as_object_mut() {
|
||||
map.insert(
|
||||
|
|
@ -1095,6 +1087,7 @@ pub fn build_epiphany_frontier_plan_mind_launch_request(
|
|||
frontier_verdict_modeling_context: None,
|
||||
frontier_planning_context: None,
|
||||
frontier_research_context: None,
|
||||
frontier_verification_context: None,
|
||||
frontier_plan_mind_context: None,
|
||||
imagination_consideration_context: None,
|
||||
admitted_model_direction_consideration_context: None,
|
||||
|
|
@ -1146,6 +1139,7 @@ pub fn build_epiphany_frontier_plan_mind_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,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -1197,6 +1191,7 @@ pub fn build_epiphany_role_launch_request_with_dynamic_context(
|
|||
frontier_verdict_modeling_context: None,
|
||||
frontier_planning_context: None,
|
||||
frontier_research_context: None,
|
||||
frontier_verification_context: None,
|
||||
frontier_plan_mind_context: None,
|
||||
imagination_consideration_context: None,
|
||||
admitted_model_direction_consideration_context: None,
|
||||
|
|
@ -1247,6 +1242,7 @@ pub fn build_epiphany_role_launch_request_with_dynamic_context(
|
|||
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,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -1411,6 +1407,7 @@ pub fn build_epiphany_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,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -182,6 +182,11 @@ pub fn accept_coordinator_role_finding(
|
|||
"generic role acceptance cannot admit Research; the exact frontier Research current-work owner must commit it"
|
||||
));
|
||||
}
|
||||
if role_id == EpiphanyRoleResultRoleId::Verification {
|
||||
return Err(anyhow::anyhow!(
|
||||
"generic role acceptance cannot admit Verification; the exact frontier Verification current-work owner must commit it"
|
||||
));
|
||||
}
|
||||
let snapshot = read_role_result_snapshot(Some(state), Some(store), role_id, binding_id);
|
||||
if snapshot.status != EpiphanyCoordinatorRoleResultStatus::Completed {
|
||||
return Err(anyhow::anyhow!(
|
||||
|
|
@ -205,47 +210,8 @@ pub fn accept_coordinator_role_finding(
|
|||
.map_err(anyhow::Error::msg)?;
|
||||
let contract = acceptance_launch_contract_for_binding(store, state, binding_id, "role")
|
||||
.map_err(|error| anyhow::anyhow!(error.to_string()))?;
|
||||
let mut available = vec![MIND_GATEWAY_REVIEW_TYPE.to_string()];
|
||||
let mut prerequisites = Vec::new();
|
||||
if role_id == EpiphanyRoleResultRoleId::Verification {
|
||||
let request_id = finding
|
||||
.verification_request_id
|
||||
.as_deref()
|
||||
.ok_or_else(|| anyhow::anyhow!("Verification finding omitted verificationRequestId"))?;
|
||||
finding
|
||||
.frontier_route_id
|
||||
.as_deref()
|
||||
.ok_or_else(|| anyhow::anyhow!("Verification finding omitted frontierRouteId"))?;
|
||||
let request = crate::runtime_repo_frontier_verification_request(store, request_id)?
|
||||
.ok_or_else(|| anyhow::anyhow!("Verification finding names a missing request"))?;
|
||||
crate::put_repo_frontier_verification_request(store, &request)?;
|
||||
validate_verification_finding_binding(&finding, &request)?;
|
||||
if request.hands_intent_id.trim().is_empty()
|
||||
|| request.hands_patch_receipt_id.trim().is_empty()
|
||||
|| request.hands_command_receipt_id.trim().is_empty()
|
||||
|| request.hands_commit_receipt_id.trim().is_empty()
|
||||
{
|
||||
return Err(anyhow::anyhow!(
|
||||
"Verification finding does not echo its exact frontier request and route"
|
||||
));
|
||||
}
|
||||
let verdict = soul_verdict_receipt_from_verification_finding(
|
||||
format!(
|
||||
"soul-verdict-{}",
|
||||
finding.runtime_result_id.as_deref().unwrap_or_default()
|
||||
),
|
||||
&finding,
|
||||
accepted_at.clone(),
|
||||
);
|
||||
let cache = coordinator_acceptance_cache(store)?;
|
||||
let modeling_request =
|
||||
crate::runtime_spine::derive_repo_frontier_modeling_request(&cache, &verdict)?;
|
||||
available.push(SOUL_VERDICT_RECEIPT_TYPE.to_string());
|
||||
prerequisites.push(EpiphanyAcceptancePrerequisite::SoulFrontierVerdict {
|
||||
verdict,
|
||||
modeling_request,
|
||||
});
|
||||
}
|
||||
let available = vec![MIND_GATEWAY_REVIEW_TYPE.to_string()];
|
||||
let prerequisites = Vec::new();
|
||||
enforce_acceptance_receipt_proofs(
|
||||
&contract,
|
||||
&role_acceptance_claimed_effects(role_id, &update.changed_fields),
|
||||
|
|
@ -324,20 +290,6 @@ pub fn accept_coordinator_role_finding(
|
|||
})
|
||||
}
|
||||
|
||||
fn validate_verification_finding_binding(
|
||||
finding: &EpiphanyRoleFindingInterpretation,
|
||||
request: &RepoFrontierVerificationRequest,
|
||||
) -> anyhow::Result<()> {
|
||||
if finding.verification_request_id.as_deref() != Some(request.request_id.as_str())
|
||||
|| finding.frontier_route_id.as_deref() != Some(request.route_id.as_str())
|
||||
{
|
||||
return Err(anyhow::anyhow!(
|
||||
"Verification finding does not echo its exact frontier request and route"
|
||||
));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn completed_role_finding(
|
||||
runtime_store_path: Option<&Path>,
|
||||
state: &EpiphanyThreadState,
|
||||
|
|
@ -568,10 +520,6 @@ pub fn read_accepted_coordinator_state(
|
|||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum EpiphanyAcceptancePrerequisite {
|
||||
SoulFrontierVerdict {
|
||||
verdict: SoulVerdictReceipt,
|
||||
modeling_request: crate::RepoFrontierModelingRequest,
|
||||
},
|
||||
Continuity(ContinuityRecoveryReceipt),
|
||||
}
|
||||
|
||||
|
|
@ -602,35 +550,11 @@ fn commit_state_with_mind_witness(
|
|||
store_path,
|
||||
expected_state,
|
||||
)?;
|
||||
for prerequisite in prerequisites {
|
||||
if let EpiphanyAcceptancePrerequisite::SoulFrontierVerdict {
|
||||
verdict,
|
||||
modeling_request,
|
||||
} = prerequisite
|
||||
&& crate::runtime_spine::derive_repo_frontier_modeling_request(&cache, verdict)?
|
||||
!= *modeling_request
|
||||
{
|
||||
return Err(anyhow::anyhow!(
|
||||
"Soul verdict and frontier Modeling request lost exact typed causality"
|
||||
));
|
||||
}
|
||||
}
|
||||
let (review_envelope, _) = cache.prepare_entry(&mind_review.gateway_id, mind_review)?;
|
||||
let (commit_envelope, _) = cache.prepare_entry(&commit_receipt.receipt_id, commit_receipt)?;
|
||||
let mut batch = vec![review_envelope, commit_envelope];
|
||||
for prerequisite in prerequisites {
|
||||
let envelope = match prerequisite {
|
||||
EpiphanyAcceptancePrerequisite::SoulFrontierVerdict {
|
||||
verdict,
|
||||
modeling_request,
|
||||
} => {
|
||||
batch.push(
|
||||
cache
|
||||
.prepare_entry(&modeling_request.request_id, modeling_request)?
|
||||
.0,
|
||||
);
|
||||
cache.prepare_entry(&verdict.receipt_id, verdict)?.0
|
||||
}
|
||||
EpiphanyAcceptancePrerequisite::Continuity(document) => {
|
||||
cache.prepare_entry(&document.receipt_id, document)?.0
|
||||
}
|
||||
|
|
@ -848,66 +772,6 @@ fn role_label_lower(role_id: EpiphanyRoleResultRoleId) -> &'static str {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use sha2::Digest;
|
||||
|
||||
#[test]
|
||||
fn verification_finding_refuses_swapped_request_or_route() {
|
||||
let request = RepoFrontierVerificationRequest {
|
||||
schema_version: REPO_FRONTIER_VERIFICATION_REQUEST_SCHEMA_VERSION.to_string(),
|
||||
request_id: "verification-request-1".to_string(),
|
||||
route_id: "frontier-route-1".to_string(),
|
||||
model_projection_digest: format!("sha256:{}", "a".repeat(64)),
|
||||
model_source_documents: vec![crate::EpiphanyMindDocumentVersion {
|
||||
store_id: "epiphany-mind".into(),
|
||||
document_type: "epiphany.mind.repo_model.identity.v1".into(),
|
||||
document_key: crate::REPO_MODEL_IDENTITY_KEY.into(),
|
||||
schema_id: Some("EpiphanyRepoModelIdentityDocument".into()),
|
||||
payload_msgpack: vec![1],
|
||||
payload_sha256: format!("sha256:{:x}", sha2::Sha256::digest([1])),
|
||||
}],
|
||||
frontier_item_id: "frontier-1".to_string(),
|
||||
frontier_item_hash: "frontier-hash".to_string(),
|
||||
hands_intent_id: "intent-1".to_string(),
|
||||
hands_review_id: "review-1".to_string(),
|
||||
hands_patch_receipt_id: "patch-1".to_string(),
|
||||
hands_command_receipt_id: "command-1".to_string(),
|
||||
hands_commit_receipt_id: "commit-1".to_string(),
|
||||
requested_at: "2026-07-13T00:00:00Z".to_string(),
|
||||
contract: REPO_FRONTIER_VERIFICATION_REQUEST_CONTRACT.to_string(),
|
||||
};
|
||||
let mut finding = EpiphanyRoleFindingInterpretation {
|
||||
verdict: Some("pass".to_string()),
|
||||
summary: Some("verified".to_string()),
|
||||
next_safe_move: None,
|
||||
checkpoint_summary: None,
|
||||
scratch_summary: None,
|
||||
files_inspected: Vec::new(),
|
||||
frontier_node_ids: Vec::new(),
|
||||
evidence_ids: Vec::new(),
|
||||
artifact_refs: Vec::new(),
|
||||
runtime_result_id: Some("result-1".to_string()),
|
||||
runtime_job_id: Some("job-1".to_string()),
|
||||
open_questions: Vec::new(),
|
||||
evidence_gaps: Vec::new(),
|
||||
risks: Vec::new(),
|
||||
state_patch: None,
|
||||
repo_model_mutation_proposal: None,
|
||||
self_patch: None,
|
||||
self_persistence: None,
|
||||
job_error: None,
|
||||
item_error: None,
|
||||
verification_request_id: Some(request.request_id.clone()),
|
||||
frontier_route_id: Some(request.route_id.clone()),
|
||||
proposal_modeling_request_id: None,
|
||||
};
|
||||
validate_verification_finding_binding(&finding, &request).expect("exact binding");
|
||||
|
||||
finding.frontier_route_id = Some("frontier-route-2".to_string());
|
||||
assert!(validate_verification_finding_binding(&finding, &request).is_err());
|
||||
finding.frontier_route_id = Some(request.route_id.clone());
|
||||
finding.verification_request_id = Some("verification-request-2".to_string());
|
||||
assert!(validate_verification_finding_binding(&finding, &request).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn completed_finding_admission_refuses_missing_binding() {
|
||||
|
|
|
|||
|
|
@ -301,6 +301,9 @@ fn commit_coordinator_job_launch_in_cache(
|
|||
.clone(),
|
||||
repo_frontier_modeling_request_id: request.repo_frontier_modeling_request_id.clone(),
|
||||
repo_frontier_research_request_id: request.repo_frontier_research_request_id.clone(),
|
||||
repo_frontier_verification_request_id: request
|
||||
.repo_frontier_verification_request_id
|
||||
.clone(),
|
||||
created_at: created_at.clone(),
|
||||
},
|
||||
)?;
|
||||
|
|
|
|||
|
|
@ -1,32 +1,18 @@
|
|||
use crate::EPIPHANY_CULTMESH_INTERNAL_VERSE_ID;
|
||||
use crate::EPIPHANY_CULTMESH_WORK_LOOP_TELEMETRY_SCHEMA_VERSION;
|
||||
use crate::EpiphanyCultMeshWorkLoopTelemetryEntry;
|
||||
use crate::EpiphanyMemoryContextPacket;
|
||||
use crate::EpiphanyMemoryContextQuery;
|
||||
use crate::EpiphanyMemoryProfile;
|
||||
use crate::EpiphanyPromptContextInput;
|
||||
use crate::EpiphanyRepoModelView;
|
||||
use crate::RuntimeHandsReceiptChainSummary;
|
||||
use crate::assemble_repo_model_view;
|
||||
use crate::load_epiphany_cultmesh_cluster_topology;
|
||||
use crate::load_epiphany_cultmesh_status;
|
||||
use crate::plan_memory_graph_context_cut;
|
||||
use crate::query_epiphany_local_verse_context;
|
||||
use crate::render_epiphany_prompt_context;
|
||||
use crate::runtime_hands_command_receipt;
|
||||
use crate::runtime_hands_commit_receipt;
|
||||
use crate::runtime_hands_patch_receipt;
|
||||
use crate::runtime_latest_hands_receipt_chain_after;
|
||||
use crate::write_epiphany_cultmesh_work_loop_telemetry;
|
||||
use chrono::SecondsFormat;
|
||||
use chrono::Utc;
|
||||
use epiphany_state_model::EpiphanyThreadState;
|
||||
use sha2::Digest;
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
use uuid::Uuid;
|
||||
|
||||
pub const EPIPHANY_LOCAL_VERSE_RUNTIME_ID: &str = "epiphany-local";
|
||||
|
||||
|
|
@ -155,215 +141,6 @@ fn render_launch_dynamic_prompt_context_with_snapshot(
|
|||
))
|
||||
}
|
||||
|
||||
pub fn append_verification_hands_receipt_context(
|
||||
mut context: String,
|
||||
runtime_store_path: &Path,
|
||||
state: &EpiphanyThreadState,
|
||||
) -> Result<String, String> {
|
||||
let accepted_at = latest_accepted_modeling_or_verification_timestamp(state).ok_or_else(|| {
|
||||
"Soul launch requires an accepted Modeling or Verification boundary before Hands consequence review".to_string()
|
||||
})?;
|
||||
let chain = runtime_latest_hands_receipt_chain_after(runtime_store_path, accepted_at)
|
||||
.map_err(|error| format!("failed to load Hands receipt chain for Soul: {error}"))?
|
||||
.ok_or_else(|| {
|
||||
"Soul launch requires a complete Hands patch, command, and commit receipt chain after the latest accepted Modeling or Verification boundary".to_string()
|
||||
})?;
|
||||
let verification_request = crate::commit_repo_frontier_verification_request_for_chain(
|
||||
runtime_store_path,
|
||||
&chain,
|
||||
&Utc::now().to_rfc3339_opts(SecondsFormat::Millis, true),
|
||||
)
|
||||
.map_err(|error| format!("failed to commit Soul frontier verification request: {error}"))?;
|
||||
let route =
|
||||
crate::runtime_repo_frontier_route(runtime_store_path, &verification_request.route_id)
|
||||
.map_err(|error| format!("failed to reload Soul frontier route: {error}"))?
|
||||
.ok_or_else(|| "Soul frontier route disappeared after request commit".to_string())?;
|
||||
let current_model = assemble_repo_model_view(runtime_store_path)
|
||||
.map_err(|error| format!("failed to load current keyed RepoModel for Soul: {error}"))?;
|
||||
let current_item =
|
||||
validate_current_frontier_route(&route, ¤t_model, Some(&verification_request))?;
|
||||
let (plan_decision, execution_amendment) =
|
||||
load_route_plan_authority(runtime_store_path, &route, ¤t_model)?;
|
||||
let telemetry = work_loop_telemetry_from_hands_chain(
|
||||
&chain,
|
||||
runtime_store_path,
|
||||
state,
|
||||
accepted_at,
|
||||
Vec::new(),
|
||||
);
|
||||
let telemetry_store = local_verse_store_path(runtime_store_path);
|
||||
write_epiphany_cultmesh_work_loop_telemetry(&telemetry_store, telemetry.clone()).map_err(
|
||||
|error| {
|
||||
format!(
|
||||
"failed to write work-loop telemetry to internal CultMesh store {}: {error}",
|
||||
telemetry_store.display()
|
||||
)
|
||||
},
|
||||
)?;
|
||||
context.push_str("\n\n<verification_work_loop_telemetry>\n");
|
||||
context.push_str(&format!(
|
||||
"verificationRequestId: {}\nfrontierRouteId: {}\nfrontierItemId: {}\nrouteQuestion: {}\nrouteGap: {}\n",
|
||||
verification_request.request_id,
|
||||
route.route_id,
|
||||
route.frontier_item_id,
|
||||
route.question,
|
||||
route.gap,
|
||||
));
|
||||
context.push_str("modelAuthorityChain:\n");
|
||||
context.push_str(&format!(
|
||||
"- currentKeyedView: projectionDigest={} sourceDocuments={}\n",
|
||||
current_model.projection_digest,
|
||||
render_repo_model_source_documents(¤t_model.source_documents),
|
||||
));
|
||||
context.push_str(&format!(
|
||||
"- frontierRoute: schemaVersion={} routeId={} modelProjectionDigest={} modelSourceDocuments={} frontierItemId={} frontierItemHash={} selectedAt={}\n",
|
||||
route.schema_version,
|
||||
route.route_id,
|
||||
route.model_projection_digest,
|
||||
render_repo_model_source_documents(&route.model_source_documents),
|
||||
route.frontier_item_id,
|
||||
route.frontier_item_hash,
|
||||
route.selected_at,
|
||||
));
|
||||
context.push_str(&format!(
|
||||
"- verificationRequestBasis: modelProjectionDigest={} modelSourceDocuments={}\n",
|
||||
verification_request.model_projection_digest,
|
||||
render_repo_model_source_documents(&verification_request.model_source_documents),
|
||||
));
|
||||
context.push_str(&format!(
|
||||
"- currentFrontierItem: id={} question={} gap={} sourceScope={}\n",
|
||||
current_item.id,
|
||||
current_item.question,
|
||||
current_item.gap,
|
||||
current_item.source_scope.join(" | "),
|
||||
));
|
||||
if let Some(decision) = plan_decision {
|
||||
context.push_str(&format!(
|
||||
"- frontierPlanDecision: schemaVersion={} decisionId={} planningRequestId={} candidateId={} candidateSha256={} modelProjectionDigest={} modelSourceDocuments={} frontierItemId={} frontierItemHash={} decision={:?} decisionSource={:?} decidedAt={}\n",
|
||||
decision.schema_version,
|
||||
decision.decision_id,
|
||||
decision.planning_request_id,
|
||||
decision.candidate_id,
|
||||
decision.candidate_sha256,
|
||||
decision.model_projection_digest,
|
||||
render_repo_model_source_documents(&decision.model_source_documents),
|
||||
decision.frontier_item_id,
|
||||
decision.frontier_item_hash,
|
||||
decision.decision,
|
||||
decision.decision_source,
|
||||
decision.decided_at,
|
||||
));
|
||||
}
|
||||
if let Some(amendment) = execution_amendment {
|
||||
context.push_str(&format!(
|
||||
"- executionAmendment: schemaVersion={} amendmentId={} replacedRouteId={} sourceActorId={} commandId={} admissionId={} packetSha256={} previousModelProjectionDigest={} previousModelSourceDocuments={} admittedModelProjectionDigest={} admittedModelSourceDocuments={} replacementAction={} replacementCommand={} rationale={} amendedAt={}\n",
|
||||
amendment.schema_version,
|
||||
amendment.amendment_id,
|
||||
amendment.replaced_route_id,
|
||||
amendment.source_actor_id,
|
||||
amendment.command_id,
|
||||
amendment.admission_id,
|
||||
amendment.packet_sha256,
|
||||
amendment.previous_model_projection_digest,
|
||||
render_repo_model_source_documents(&amendment.previous_model_source_documents),
|
||||
amendment.admitted_model_projection_digest,
|
||||
render_repo_model_source_documents(&amendment.admitted_model_source_documents),
|
||||
amendment.replacement_action,
|
||||
amendment.replacement_command,
|
||||
amendment.rationale,
|
||||
amendment.amended_at,
|
||||
));
|
||||
}
|
||||
if let Some(plan) = route.adopted_plan.as_ref() {
|
||||
context.push_str(&format!(
|
||||
"adoptedCandidateSha256: {}\nadoptedAction: {}\nadoptedCommand: {}\neffectiveAction: {}\neffectiveCommand: {}\nexecutionAmendmentId: {}\nadoptedChecks: {}\nadoptedStopConditions: {}\nadoptedRollbackSteps: {}\nadoptedCommitMessage: {}\n",
|
||||
plan.candidate_sha256,
|
||||
plan.action,
|
||||
plan.command,
|
||||
plan.effective_action(),
|
||||
plan.effective_command(),
|
||||
plan.execution_amendment
|
||||
.as_ref()
|
||||
.map(|amendment| amendment.amendment_id.as_str())
|
||||
.unwrap_or(""),
|
||||
plan.checks.join(" | "),
|
||||
plan.stop_conditions.join(" | "),
|
||||
plan.rollback_steps.join(" | "),
|
||||
plan.commit_message,
|
||||
));
|
||||
}
|
||||
context.push_str(
|
||||
"Soul is reviewing typed internal CultMesh telemetry for concrete Hands consequence evidence produced after the latest accepted Verification finding.\n",
|
||||
);
|
||||
context.push_str(&render_work_loop_telemetry(&telemetry));
|
||||
context.push_str("- resolvedReceiptPayloads:\n");
|
||||
context.push_str(&format!(
|
||||
" - patch: schemaVersion={} changedPaths={}\n",
|
||||
chain.patch_schema_version,
|
||||
chain.changed_paths.join(", ")
|
||||
));
|
||||
context.push_str(&format!(
|
||||
" - command: schemaVersion={} command=`{}` exitCode={} stdoutArtifact={} stderrArtifact={}\n",
|
||||
chain.command_schema_version,
|
||||
chain.command,
|
||||
chain.exit_code,
|
||||
chain.stdout_artifact,
|
||||
chain.stderr_artifact
|
||||
));
|
||||
context.push_str(&format!(
|
||||
" - commit: schemaVersion={} commitSha={} branch={} changedPaths={}\n",
|
||||
chain.commit_schema_version,
|
||||
chain.commit_sha,
|
||||
chain.branch,
|
||||
chain.changed_paths.join(", ")
|
||||
));
|
||||
context.push_str("- artifactPreviews:\n");
|
||||
context.push_str(&format!(
|
||||
" - stdout: {}\n",
|
||||
artifact_preview(&chain.stdout_artifact)
|
||||
));
|
||||
context.push_str(&format!(
|
||||
" - stderr: {}\n",
|
||||
artifact_preview(&chain.stderr_artifact)
|
||||
));
|
||||
if !chain.changed_paths.is_empty() {
|
||||
context.push_str("- changedPaths:\n");
|
||||
for path in chain.changed_paths {
|
||||
context.push_str(&format!(" - {path}\n"));
|
||||
}
|
||||
}
|
||||
context.push_str(&format!("- summary: {}\n", chain.summary));
|
||||
context.push_str("- sourceRefs:\n");
|
||||
context.push_str(" - epiphany-core/src/bin/epiphany-hands-action.rs\n");
|
||||
context.push_str(" - epiphany-core/src/hands_gateway.rs\n");
|
||||
context.push_str(" - epiphany-core/src/runtime_spine.rs\n");
|
||||
context.push_str(" - epiphany-core/src/bin/epiphany-mvp-coordinator.rs\n");
|
||||
context.push_str(" - epiphany-core/src/coordinator_launch.rs\n");
|
||||
context.push_str(" - epiphany-core/src/coordinator_launch_context.rs\n");
|
||||
context.push_str(" - epiphany-core/src/surfaces/coordinator.rs\n");
|
||||
context.push_str("- sourcePathProof:\n");
|
||||
context.push_str(
|
||||
" - epiphany-hands-action `record-pass` records patch, command, and commit receipts through runtime-spine put functions.\n",
|
||||
);
|
||||
context.push_str(
|
||||
" - runtime_spine registers Hands receipt document types, persists/rereads them through the shared CultCache runtime-spine store, and exposes latest-chain readback.\n",
|
||||
);
|
||||
context.push_str(
|
||||
" - native coordinator launch context appends this packet only for Verification role launches after dynamic context assembly.\n",
|
||||
);
|
||||
context.push_str(
|
||||
" - coordinator treats a complete post-verification Hands chain as implementation evidence that requires a fresh Soul pass.\n",
|
||||
);
|
||||
context.push_str(
|
||||
" - coordinator routing requires a failed Verification result to receive an exact failure-review supersession receipt before launching a fresh Soul attempt; immutable verification-request identity remains separate from worker-attempt lifecycle.\n",
|
||||
);
|
||||
context.push_str(
|
||||
"Use these typed internal Verse receipts, artifacts, and source references as the concrete Hands evidence under review. Do not ask for generic receipt-path evidence without first judging this packet.\n",
|
||||
);
|
||||
context.push_str("</verification_work_loop_telemetry>");
|
||||
Ok(context)
|
||||
}
|
||||
|
||||
pub fn validate_frontier_plan_decision_chain(
|
||||
decision: &crate::RepoFrontierPlanDecisionReceipt,
|
||||
route: &crate::RepoFrontierRoute,
|
||||
|
|
@ -485,141 +262,6 @@ fn validate_current_frontier_route<'a>(
|
|||
Ok(current_item)
|
||||
}
|
||||
|
||||
fn load_route_plan_authority(
|
||||
runtime_store_path: &Path,
|
||||
route: &crate::RepoFrontierRoute,
|
||||
current_model: &EpiphanyRepoModelView,
|
||||
) -> Result<
|
||||
(
|
||||
Option<crate::RepoFrontierPlanDecisionReceipt>,
|
||||
Option<crate::RepoFrontierExecutionAmendmentReceipt>,
|
||||
),
|
||||
String,
|
||||
> {
|
||||
let Some(plan) = route.adopted_plan.as_ref() else {
|
||||
return Ok((None, None));
|
||||
};
|
||||
let mut cache = crate::runtime_spine_cache(runtime_store_path)
|
||||
.map_err(|error| format!("failed to open Mind receipt store for Soul: {error}"))?;
|
||||
cache
|
||||
.pull_all_backing_stores()
|
||||
.map_err(|error| format!("failed to refresh Mind receipt store for Soul: {error}"))?;
|
||||
let mut decisions = cache
|
||||
.get_all::<crate::RepoFrontierPlanDecisionReceipt>()
|
||||
.map_err(|error| format!("failed to load frontier plan decisions for Soul: {error}"))?
|
||||
.into_iter()
|
||||
.filter(|decision| decision.planning_request_id == plan.planning_request_id)
|
||||
.collect::<Vec<_>>();
|
||||
if decisions.len() != 1 {
|
||||
return Err(
|
||||
"Soul adopted frontier route requires exactly one typed plan decision".to_string(),
|
||||
);
|
||||
}
|
||||
let decision = decisions.pop().expect("one decision checked above");
|
||||
validate_frontier_plan_decision_chain(&decision, route, current_model)?;
|
||||
|
||||
let Some(plan_amendment) = plan.execution_amendment.as_ref() else {
|
||||
return Ok((Some(decision), None));
|
||||
};
|
||||
let mut amendments = cache
|
||||
.get_all::<crate::RepoFrontierExecutionAmendmentReceipt>()
|
||||
.map_err(|error| format!("failed to load execution amendments for Soul: {error}"))?
|
||||
.into_iter()
|
||||
.filter(|receipt| receipt.amendment_id == plan_amendment.amendment_id)
|
||||
.collect::<Vec<_>>();
|
||||
if amendments.len() != 1 {
|
||||
return Err(
|
||||
"Soul amended frontier route requires exactly one typed execution amendment"
|
||||
.to_string(),
|
||||
);
|
||||
}
|
||||
let amendment = amendments.pop().expect("one amendment checked above");
|
||||
let previous_basis = crate::EpiphanyRepoModelBasis {
|
||||
projection_digest: amendment.previous_model_projection_digest.clone(),
|
||||
source_documents: amendment.previous_model_source_documents.clone(),
|
||||
};
|
||||
previous_basis
|
||||
.validate()
|
||||
.map_err(|error| format!("execution amendment has an invalid previous basis: {error}"))?;
|
||||
let admitted_basis = crate::EpiphanyRepoModelBasis {
|
||||
projection_digest: amendment.admitted_model_projection_digest.clone(),
|
||||
source_documents: amendment.admitted_model_source_documents.clone(),
|
||||
};
|
||||
admitted_basis
|
||||
.validate()
|
||||
.map_err(|error| format!("execution amendment has an invalid admitted basis: {error}"))?;
|
||||
let replaced_route = cache
|
||||
.get::<crate::RepoFrontierRoute>(&amendment.replaced_route_id)
|
||||
.map_err(|error| format!("failed to load replaced frontier route for Soul: {error}"))?
|
||||
.ok_or_else(|| "execution amendment lost its replaced frontier route".to_string())?;
|
||||
if amendment.schema_version != crate::REPO_FRONTIER_EXECUTION_AMENDMENT_RECEIPT_SCHEMA_VERSION
|
||||
|| amendment.contract != crate::REPO_FRONTIER_EXECUTION_AMENDMENT_RECEIPT_CONTRACT
|
||||
|| amendment.replaced_route_id != plan_amendment.replaces_route_id
|
||||
|| amendment.frontier_item_id != route.frontier_item_id
|
||||
|| amendment.previous_frontier_item_hash != replaced_route.frontier_item_hash
|
||||
|| previous_basis
|
||||
!= (crate::EpiphanyRepoModelBasis {
|
||||
projection_digest: replaced_route.model_projection_digest.clone(),
|
||||
source_documents: replaced_route.model_source_documents.clone(),
|
||||
})
|
||||
|| admitted_basis != current_model.reasoning_basis()
|
||||
|| admitted_basis
|
||||
!= (crate::EpiphanyRepoModelBasis {
|
||||
projection_digest: route.model_projection_digest.clone(),
|
||||
source_documents: route.model_source_documents.clone(),
|
||||
})
|
||||
|| amendment.source_actor_id != plan_amendment.source_actor_id
|
||||
|| amendment.command_id != plan_amendment.command_id
|
||||
|| amendment.admission_id != plan_amendment.admission_id
|
||||
|| amendment.packet_sha256 != plan_amendment.packet_sha256
|
||||
|| amendment.replacement_action != plan_amendment.action
|
||||
|| amendment.replacement_command != plan_amendment.command
|
||||
|| amendment.rationale != plan_amendment.rationale
|
||||
|| amendment.amended_at != plan_amendment.amended_at
|
||||
{
|
||||
return Err(
|
||||
"Soul execution amendment does not exactly bind previous/current keyed routes and the effective plan"
|
||||
.to_string(),
|
||||
);
|
||||
}
|
||||
Ok((Some(decision), Some(amendment)))
|
||||
}
|
||||
|
||||
fn render_repo_model_source_documents(documents: &[crate::EpiphanyMindDocumentVersion]) -> String {
|
||||
documents
|
||||
.iter()
|
||||
.map(|document| {
|
||||
format!(
|
||||
"{}/{}/{}@{}#{}",
|
||||
document.store_id,
|
||||
document.document_type,
|
||||
document.document_key,
|
||||
document.schema_id.as_deref().unwrap_or("<none>"),
|
||||
document.payload_sha256,
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join(" | ")
|
||||
}
|
||||
|
||||
pub fn has_complete_hands_consequence_after_latest_accepted_boundary(
|
||||
runtime_store_path: &Path,
|
||||
state: &EpiphanyThreadState,
|
||||
) -> Result<bool, String> {
|
||||
let Some(accepted_at) = latest_accepted_modeling_or_verification_timestamp(state) else {
|
||||
return Ok(false);
|
||||
};
|
||||
let chain = runtime_latest_hands_receipt_chain_after(runtime_store_path, accepted_at).map_err(
|
||||
|error| format!("failed to load Hands receipt chain for coordinator routing: {error}"),
|
||||
)?;
|
||||
let Some(chain) = chain else {
|
||||
return Ok(false);
|
||||
};
|
||||
crate::runtime_hands_receipt_chain_matches_current_model(runtime_store_path, &chain).map_err(
|
||||
|error| format!("failed to validate Hands receipt route against current model: {error}"),
|
||||
)
|
||||
}
|
||||
|
||||
pub fn append_modeling_repo_model_shape_context(
|
||||
context: String,
|
||||
runtime_store_path: &Path,
|
||||
|
|
@ -815,333 +457,6 @@ fn debug_variant_snake_case(value: impl std::fmt::Debug) -> String {
|
|||
output
|
||||
}
|
||||
|
||||
fn latest_accepted_modeling_or_verification_timestamp(state: &EpiphanyThreadState) -> Option<&str> {
|
||||
state
|
||||
.acceptance_receipts
|
||||
.iter()
|
||||
.filter(|receipt| {
|
||||
matches!(receipt.role_id.as_str(), "modeling" | "verification")
|
||||
&& receipt.surface == "roleAccept"
|
||||
&& receipt.status == "accepted"
|
||||
})
|
||||
.map(|receipt| receipt.accepted_at.as_str())
|
||||
.max()
|
||||
}
|
||||
|
||||
fn work_loop_telemetry_from_hands_chain(
|
||||
chain: &RuntimeHandsReceiptChainSummary,
|
||||
runtime_store_path: &Path,
|
||||
state: &EpiphanyThreadState,
|
||||
lower_bound_receipt_at: &str,
|
||||
soul_receipt_ids: Vec<String>,
|
||||
) -> EpiphanyCultMeshWorkLoopTelemetryEntry {
|
||||
EpiphanyCultMeshWorkLoopTelemetryEntry {
|
||||
schema_version: EPIPHANY_CULTMESH_WORK_LOOP_TELEMETRY_SCHEMA_VERSION.to_string(),
|
||||
runtime_id: EPIPHANY_LOCAL_VERSE_RUNTIME_ID.to_string(),
|
||||
verse_id: EPIPHANY_CULTMESH_INTERNAL_VERSE_ID.to_string(),
|
||||
telemetry_id: format!(
|
||||
"work-loop-telemetry-{}-{}",
|
||||
state.revision,
|
||||
Uuid::new_v4()
|
||||
),
|
||||
thread_id: state.last_updated_turn_id.clone().unwrap_or_default(),
|
||||
produced_at_utc: Utc::now().to_rfc3339_opts(SecondsFormat::Secs, true),
|
||||
source_stage: "hands".to_string(),
|
||||
target_stages: vec!["soul".to_string(), "modeling".to_string()],
|
||||
lower_bound_receipt_at: lower_bound_receipt_at.to_string(),
|
||||
hands_intent_id: chain.intent_id.clone(),
|
||||
hands_review_id: chain.review_id.clone(),
|
||||
hands_runtime_job_id: chain.runtime_job_id.clone(),
|
||||
substrate_gate_grant_receipt_id: chain.substrate_gate_grant_receipt_id.clone(),
|
||||
hands_patch_receipt_id: chain.patch_receipt_id.clone(),
|
||||
hands_command_receipt_id: chain.command_receipt_id.clone(),
|
||||
hands_commit_receipt_id: chain.commit_receipt_id.clone(),
|
||||
command: chain.command.clone(),
|
||||
exit_code: chain.exit_code.clone(),
|
||||
stdout_artifact: chain.stdout_artifact.clone(),
|
||||
stderr_artifact: chain.stderr_artifact.clone(),
|
||||
commit_sha: chain.commit_sha.clone(),
|
||||
branch: chain.branch.clone(),
|
||||
changed_paths: chain.changed_paths.clone(),
|
||||
artifact_previews: vec![
|
||||
format!("stdout: {}", artifact_preview(&chain.stdout_artifact)),
|
||||
format!("stderr: {}", artifact_preview(&chain.stderr_artifact)),
|
||||
],
|
||||
source_refs: vec![
|
||||
"epiphany-core/src/bin/epiphany-hands-action.rs".to_string(),
|
||||
"epiphany-core/src/hands_gateway.rs".to_string(),
|
||||
"epiphany-core/src/runtime_spine.rs".to_string(),
|
||||
"epiphany-core/src/bin/epiphany-mvp-coordinator.rs".to_string(),
|
||||
"epiphany-core/src/coordinator_launch.rs".to_string(),
|
||||
"epiphany-core/src/coordinator_launch_context.rs".to_string(),
|
||||
"epiphany-core/src/surfaces/coordinator.rs".to_string(),
|
||||
],
|
||||
source_path_proof: vec![
|
||||
"epiphany-hands-action `record-pass` records patch, command, and commit receipts through runtime-spine put functions.".to_string(),
|
||||
"runtime_spine registers Hands receipt document types, persists/rereads them through the shared CultCache runtime-spine store, and exposes latest-chain readback.".to_string(),
|
||||
"native coordinator launch context writes this typed packet to the internal CultMesh Verse before Soul receives the rendered projection.".to_string(),
|
||||
"coordinator treats a complete post-verification Hands chain as implementation evidence that requires a fresh Soul pass.".to_string(),
|
||||
"coordinator routing requires exact failed-Verification review and supersession before a fresh Soul attempt while immutable request identity remains separate from attempt lifecycle.".to_string(),
|
||||
"runtime_spine admission causally binds one verdict-incorporation result to its exact route, verification request, Soul verdict, Modeling request, and final frontier disposition; idempotent replay returns the same receipt and leaves no actionable Hands frontier.".to_string(),
|
||||
],
|
||||
soul_receipt_ids,
|
||||
summary: chain.summary.clone(),
|
||||
receipt_payload_previews: receipt_payload_previews(runtime_store_path, chain),
|
||||
commit_diff_preview: commit_diff_preview(runtime_store_path, chain),
|
||||
verification_assertions: vec![
|
||||
"cultmesh_integration::tests::work_loop_telemetry_round_trips_as_internal_cultmesh_document asserts the typed internal Verse document round-trips and is registered.".to_string(),
|
||||
"launch_context::tests::verification_launch_context_includes_hands_receipt_chain seeds real runtime-spine Hands receipts, asserts Soul launch renders the packet, and asserts Modeling launch enriches the typed packet with Soul receipt ids.".to_string(),
|
||||
"runtime_spine::tests::repo_model_incorporates_pass_and_nonpass_soul_verdicts_causally admits the first valid result, replays it idempotently to the same receipt, verifies exact causal ids and final frontier state, and proves no actionable Hands frontier remains.".to_string(),
|
||||
"epiphany-mvp-coordinator binary tests keep the Hands gate and coordinator routing surface compiling under the executable coordinator harness.".to_string(),
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
fn render_work_loop_telemetry(telemetry: &EpiphanyCultMeshWorkLoopTelemetryEntry) -> String {
|
||||
let mut rendered = String::new();
|
||||
rendered.push_str(&format!("- schemaVersion: {}\n", telemetry.schema_version));
|
||||
rendered.push_str(&format!("- verseId: {}\n", telemetry.verse_id));
|
||||
rendered.push_str(&format!("- telemetryId: {}\n", telemetry.telemetry_id));
|
||||
rendered.push_str(&format!("- sourceStage: {}\n", telemetry.source_stage));
|
||||
rendered.push_str(&format!(
|
||||
"- targetStages: {}\n",
|
||||
telemetry.target_stages.join(", ")
|
||||
));
|
||||
rendered.push_str(&format!(
|
||||
"- lowerBoundAcceptedVerificationAt: {}\n",
|
||||
telemetry.lower_bound_receipt_at
|
||||
));
|
||||
rendered.push_str(&format!("- intentId: {}\n", telemetry.hands_intent_id));
|
||||
rendered.push_str(&format!("- reviewId: {}\n", telemetry.hands_review_id));
|
||||
rendered.push_str(&format!(
|
||||
"- runtimeJobId: {}\n",
|
||||
telemetry.hands_runtime_job_id
|
||||
));
|
||||
rendered.push_str(&format!(
|
||||
"- substrateGateGrantReceiptId: {}\n",
|
||||
telemetry.substrate_gate_grant_receipt_id
|
||||
));
|
||||
rendered.push_str(&format!(
|
||||
"- receiptIds: patch={}, command={}, commit={}\n",
|
||||
telemetry.hands_patch_receipt_id,
|
||||
telemetry.hands_command_receipt_id,
|
||||
telemetry.hands_commit_receipt_id
|
||||
));
|
||||
if !telemetry.soul_receipt_ids.is_empty() {
|
||||
rendered.push_str(&format!(
|
||||
"- soulReceiptIds: {}\n",
|
||||
telemetry.soul_receipt_ids.join(", ")
|
||||
));
|
||||
}
|
||||
rendered.push_str(&format!(
|
||||
"- command: `{}` exitCode={} stdoutArtifact={} stderrArtifact={}\n",
|
||||
telemetry.command,
|
||||
telemetry.exit_code,
|
||||
telemetry.stdout_artifact,
|
||||
telemetry.stderr_artifact
|
||||
));
|
||||
rendered.push_str(&format!(
|
||||
"- commit: sha={} branch={}\n",
|
||||
telemetry.commit_sha, telemetry.branch
|
||||
));
|
||||
if !telemetry.changed_paths.is_empty() {
|
||||
rendered.push_str("- changedPaths:\n");
|
||||
for path in &telemetry.changed_paths {
|
||||
rendered.push_str(&format!(" - {path}\n"));
|
||||
}
|
||||
}
|
||||
if !telemetry.artifact_previews.is_empty() {
|
||||
rendered.push_str("- artifactPreviews:\n");
|
||||
for preview in &telemetry.artifact_previews {
|
||||
rendered.push_str(&format!(" - {preview}\n"));
|
||||
}
|
||||
}
|
||||
if !telemetry.receipt_payload_previews.is_empty() {
|
||||
rendered.push_str("- resolvedReceiptPayloadPreviews:\n");
|
||||
for payload in &telemetry.receipt_payload_previews {
|
||||
rendered.push_str(&format!(" - {}\n", payload.replace('\n', "\n ")));
|
||||
}
|
||||
}
|
||||
if !telemetry.commit_diff_preview.trim().is_empty() {
|
||||
rendered.push_str("- commitDiffPreview:\n");
|
||||
rendered.push_str(&format!(
|
||||
" {}\n",
|
||||
telemetry.commit_diff_preview.replace('\n', "\n ")
|
||||
));
|
||||
}
|
||||
if !telemetry.source_refs.is_empty() {
|
||||
rendered.push_str("- sourceRefs:\n");
|
||||
for source_ref in &telemetry.source_refs {
|
||||
rendered.push_str(&format!(" - {source_ref}\n"));
|
||||
}
|
||||
}
|
||||
if !telemetry.source_path_proof.is_empty() {
|
||||
rendered.push_str("- sourcePathProof:\n");
|
||||
for proof in &telemetry.source_path_proof {
|
||||
rendered.push_str(&format!(" - {proof}\n"));
|
||||
}
|
||||
}
|
||||
if !telemetry.verification_assertions.is_empty() {
|
||||
rendered.push_str("- verificationAssertions:\n");
|
||||
for assertion in &telemetry.verification_assertions {
|
||||
rendered.push_str(&format!(" - {assertion}\n"));
|
||||
}
|
||||
}
|
||||
rendered.push_str(&format!("- summary: {}\n", telemetry.summary));
|
||||
rendered
|
||||
}
|
||||
|
||||
fn receipt_payload_previews(
|
||||
runtime_store_path: &Path,
|
||||
chain: &RuntimeHandsReceiptChainSummary,
|
||||
) -> Vec<String> {
|
||||
let patch = runtime_hands_patch_receipt(runtime_store_path, chain.patch_receipt_id.as_str())
|
||||
.ok()
|
||||
.flatten()
|
||||
.map(|receipt| {
|
||||
format!(
|
||||
"patch: schemaVersion={} receiptId={} intentId={} reviewId={} runtimeJobId={} changedPaths={} emittedAt={} summary={} contract={}",
|
||||
receipt.schema_version,
|
||||
receipt.receipt_id,
|
||||
receipt.intent_id,
|
||||
receipt.review_id,
|
||||
receipt.runtime_job_id,
|
||||
receipt.changed_paths.join(", "),
|
||||
receipt.emitted_at,
|
||||
receipt.summary,
|
||||
receipt.contract
|
||||
)
|
||||
})
|
||||
.unwrap_or_else(|| {
|
||||
format!(
|
||||
"patch: receipt {} could not be resolved from runtime-spine",
|
||||
chain.patch_receipt_id
|
||||
)
|
||||
});
|
||||
let command =
|
||||
runtime_hands_command_receipt(runtime_store_path, chain.command_receipt_id.as_str())
|
||||
.ok()
|
||||
.flatten()
|
||||
.map(|receipt| {
|
||||
format!(
|
||||
"command: schemaVersion={} receiptId={} intentId={} reviewId={} runtimeJobId={} command=`{}` exitCode={} stdoutArtifact={} stderrArtifact={} emittedAt={} summary={} contract={}",
|
||||
receipt.schema_version,
|
||||
receipt.receipt_id,
|
||||
receipt.intent_id,
|
||||
receipt.review_id,
|
||||
receipt.runtime_job_id,
|
||||
receipt.command,
|
||||
receipt.exit_code,
|
||||
receipt.stdout_artifact,
|
||||
receipt.stderr_artifact,
|
||||
receipt.emitted_at,
|
||||
receipt.summary,
|
||||
receipt.contract
|
||||
)
|
||||
})
|
||||
.unwrap_or_else(|| {
|
||||
format!(
|
||||
"command: receipt {} could not be resolved from runtime-spine",
|
||||
chain.command_receipt_id
|
||||
)
|
||||
});
|
||||
let commit = runtime_hands_commit_receipt(runtime_store_path, chain.commit_receipt_id.as_str())
|
||||
.ok()
|
||||
.flatten()
|
||||
.map(|receipt| {
|
||||
format!(
|
||||
"commit: schemaVersion={} receiptId={} intentId={} reviewId={} runtimeJobId={} commitSha={} branch={} changedPaths={} emittedAt={} summary={} contract={}",
|
||||
receipt.schema_version,
|
||||
receipt.receipt_id,
|
||||
receipt.intent_id,
|
||||
receipt.review_id,
|
||||
receipt.runtime_job_id,
|
||||
receipt.commit_sha,
|
||||
receipt.branch,
|
||||
receipt.changed_paths.join(", "),
|
||||
receipt.emitted_at,
|
||||
receipt.summary,
|
||||
receipt.contract
|
||||
)
|
||||
})
|
||||
.unwrap_or_else(|| {
|
||||
format!(
|
||||
"commit: receipt {} could not be resolved from runtime-spine",
|
||||
chain.commit_receipt_id
|
||||
)
|
||||
});
|
||||
vec![patch, command, commit]
|
||||
}
|
||||
|
||||
fn commit_diff_preview(
|
||||
runtime_store_path: &Path,
|
||||
chain: &RuntimeHandsReceiptChainSummary,
|
||||
) -> String {
|
||||
let Some(repo_root) = runtime_store_path
|
||||
.parent()
|
||||
.and_then(Path::parent)
|
||||
.filter(|path| path.join(".git").exists())
|
||||
else {
|
||||
return "<commit diff preview unavailable: runtime store is not under a git workspace>"
|
||||
.to_string();
|
||||
};
|
||||
if chain.commit_sha.trim().is_empty() {
|
||||
return "<commit diff preview unavailable: empty commit sha>".to_string();
|
||||
}
|
||||
let output = Command::new("git")
|
||||
.current_dir(repo_root)
|
||||
.arg("show")
|
||||
.arg("--stat")
|
||||
.arg("--patch")
|
||||
.arg("--format=medium")
|
||||
.arg(chain.commit_sha.as_str())
|
||||
.arg("--")
|
||||
.args(chain.changed_paths.iter().map(String::as_str))
|
||||
.output();
|
||||
let Ok(output) = output else {
|
||||
return "<commit diff preview unavailable: git show failed to start>".to_string();
|
||||
};
|
||||
if !output.status.success() {
|
||||
let stderr = String::from_utf8_lossy(&output.stderr);
|
||||
return compact_preview(
|
||||
&format!(
|
||||
"<commit diff preview unavailable: git show exited {:?}: {}>",
|
||||
output.status.code(),
|
||||
stderr
|
||||
),
|
||||
1600,
|
||||
);
|
||||
}
|
||||
compact_preview(&String::from_utf8_lossy(&output.stdout), 3200)
|
||||
}
|
||||
|
||||
fn artifact_preview(path: &str) -> String {
|
||||
let path = Path::new(path);
|
||||
let text = fs::read_to_string(path)
|
||||
.or_else(|_| {
|
||||
path.strip_prefix("./")
|
||||
.map(Path::to_path_buf)
|
||||
.map_err(|_| std::io::Error::from(std::io::ErrorKind::NotFound))
|
||||
.and_then(fs::read_to_string)
|
||||
})
|
||||
.unwrap_or_else(|_| "<artifact not readable from launch context>".to_string());
|
||||
compact_preview(&text, 1200)
|
||||
}
|
||||
|
||||
fn compact_preview(text: &str, limit: usize) -> String {
|
||||
let compact = text
|
||||
.lines()
|
||||
.map(str::trim)
|
||||
.filter(|line| !line.is_empty())
|
||||
.collect::<Vec<_>>()
|
||||
.join(" | ");
|
||||
if compact.len() <= limit {
|
||||
compact
|
||||
} else {
|
||||
format!("{} ...<truncated>", &compact[..limit])
|
||||
}
|
||||
}
|
||||
|
||||
fn launch_memory_context(
|
||||
runtime_store_path: &Path,
|
||||
_state: &EpiphanyThreadState,
|
||||
|
|
@ -1190,7 +505,6 @@ mod tests {
|
|||
use crate::open_runtime_spine_heartbeat_job;
|
||||
use crate::runtime_worker_launch_request;
|
||||
use crate::seed_epiphany_local_verse_context;
|
||||
use epiphany_state_model::EpiphanyAcceptanceReceipt;
|
||||
use std::fs;
|
||||
use uuid::Uuid;
|
||||
|
||||
|
|
@ -1428,6 +742,7 @@ mod tests {
|
|||
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,
|
||||
created_at: "2026-06-02T00:00:00Z".to_string(),
|
||||
},
|
||||
)?;
|
||||
|
|
@ -1472,46 +787,4 @@ mod tests {
|
|||
assert!(!local_verse_store.exists());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn verification_launch_refuses_to_invent_a_pre_hands_request() -> anyhow::Result<()> {
|
||||
let temp = std::env::temp_dir().join(format!(
|
||||
"epiphany-verification-without-hands-{}",
|
||||
Uuid::new_v4()
|
||||
));
|
||||
fs::create_dir(&temp)?;
|
||||
let runtime_store = temp.join("runtime-spine.msgpack");
|
||||
initialize_runtime_spine(
|
||||
&runtime_store,
|
||||
RuntimeSpineInitOptions {
|
||||
runtime_id: "epiphany-verification-without-hands".to_string(),
|
||||
display_name: "Epiphany Verification Without Hands".to_string(),
|
||||
created_at: "2026-08-06T00:00:00Z".to_string(),
|
||||
},
|
||||
)?;
|
||||
let state = EpiphanyThreadState {
|
||||
acceptance_receipts: vec![EpiphanyAcceptanceReceipt {
|
||||
id: "accept-modeling-without-hands".to_string(),
|
||||
result_id: "result-modeling-without-hands".to_string(),
|
||||
job_id: "job-modeling-without-hands".to_string(),
|
||||
binding_id: "modeling-checkpoint-worker".to_string(),
|
||||
surface: "roleAccept".to_string(),
|
||||
role_id: "modeling".to_string(),
|
||||
status: "accepted".to_string(),
|
||||
accepted_at: "2026-08-06T00:00:01Z".to_string(),
|
||||
..Default::default()
|
||||
}],
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let error = append_verification_hands_receipt_context(
|
||||
"context".to_string(),
|
||||
&runtime_store,
|
||||
&state,
|
||||
)
|
||||
.expect_err("Soul must not launch before a complete Hands consequence chain exists");
|
||||
assert!(error.contains("complete Hands patch, command, and commit receipt chain"));
|
||||
fs::remove_dir_all(temp)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -229,8 +229,6 @@ pub use coordinator_launch::commit_coordinator_job_launch;
|
|||
pub use coordinator_launch::plan_coordinator_job_launch;
|
||||
pub use coordinator_launch_context::EPIPHANY_LOCAL_VERSE_RUNTIME_ID;
|
||||
pub use coordinator_launch_context::append_modeling_repo_model_shape_context;
|
||||
pub use coordinator_launch_context::append_verification_hands_receipt_context;
|
||||
pub use coordinator_launch_context::has_complete_hands_consequence_after_latest_accepted_boundary;
|
||||
pub use coordinator_launch_context::local_verse_store_path;
|
||||
pub use coordinator_launch_context::memory_graph_store_path;
|
||||
pub use coordinator_launch_context::render_launch_dynamic_prompt_context;
|
||||
|
|
@ -1320,11 +1318,14 @@ pub use surfaces::REPO_FRONTIER_PROPOSAL_MODELING_CONTEXT_CONTRACT;
|
|||
pub use surfaces::REPO_FRONTIER_PROPOSAL_MODELING_CONTEXT_SCHEMA_VERSION;
|
||||
pub use surfaces::REPO_FRONTIER_RESEARCH_CONTEXT_CONTRACT;
|
||||
pub use surfaces::REPO_FRONTIER_RESEARCH_CONTEXT_SCHEMA_VERSION;
|
||||
pub use surfaces::REPO_FRONTIER_VERIFICATION_CONTEXT_CONTRACT;
|
||||
pub use surfaces::REPO_FRONTIER_VERIFICATION_CONTEXT_SCHEMA_VERSION;
|
||||
pub use surfaces::ROLE_WORKER_OUTPUT_CONTRACT_ID;
|
||||
pub use surfaces::RepoFrontierPlanMindContextProjection;
|
||||
pub use surfaces::RepoFrontierPlanningContextProjection;
|
||||
pub use surfaces::RepoFrontierProposalModelingContextProjection;
|
||||
pub use surfaces::RepoFrontierResearchContextProjection;
|
||||
pub use surfaces::RepoFrontierVerificationContextProjection;
|
||||
pub use surfaces::build_reorient_acceptance_bundle;
|
||||
pub use surfaces::build_reorient_job_launch_request;
|
||||
pub use surfaces::build_role_acceptance_bundle;
|
||||
|
|
|
|||
|
|
@ -138,6 +138,68 @@ pub struct EpiphanyMindEvidenceDocument {
|
|||
pub value: EpiphanyEvidenceRecord,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
|
||||
#[cultcache(
|
||||
type = "epiphany.mind.verification_audit.v1",
|
||||
schema = "EpiphanyMindVerificationAuditDocument"
|
||||
)]
|
||||
pub struct EpiphanyMindVerificationAuditDocument {
|
||||
#[cultcache(key = 0)]
|
||||
pub audit_id: String,
|
||||
#[cultcache(key = 1)]
|
||||
pub verification_request_id: String,
|
||||
#[cultcache(key = 2)]
|
||||
pub frontier_route_id: String,
|
||||
#[cultcache(key = 3)]
|
||||
pub job_id: String,
|
||||
#[cultcache(key = 4)]
|
||||
pub result_id: String,
|
||||
#[cultcache(key = 5)]
|
||||
pub decision_context_id: String,
|
||||
#[cultcache(key = 6)]
|
||||
pub verdict: String,
|
||||
#[cultcache(key = 7)]
|
||||
pub summary: String,
|
||||
#[cultcache(key = 8)]
|
||||
pub evidence_ids: Vec<String>,
|
||||
#[cultcache(key = 9)]
|
||||
pub risks: Vec<String>,
|
||||
#[cultcache(key = 10)]
|
||||
pub audited_at: String,
|
||||
}
|
||||
|
||||
impl EpiphanyMindVerificationAuditDocument {
|
||||
pub fn validate(&self) -> Result<()> {
|
||||
if [
|
||||
self.audit_id.as_str(),
|
||||
self.verification_request_id.as_str(),
|
||||
self.frontier_route_id.as_str(),
|
||||
self.job_id.as_str(),
|
||||
self.result_id.as_str(),
|
||||
self.decision_context_id.as_str(),
|
||||
self.verdict.as_str(),
|
||||
self.summary.as_str(),
|
||||
]
|
||||
.into_iter()
|
||||
.any(str::is_empty)
|
||||
|| !matches!(
|
||||
self.verdict.trim().to_ascii_lowercase().as_str(),
|
||||
"pass" | "needs-review" | "needs-evidence" | "fail"
|
||||
)
|
||||
|| chrono::DateTime::parse_from_rfc3339(&self.audited_at).is_err()
|
||||
{
|
||||
return Err(anyhow!("Verification audit document is invalid"));
|
||||
}
|
||||
let mut evidence_ids = self.evidence_ids.clone();
|
||||
evidence_ids.sort();
|
||||
evidence_ids.dedup();
|
||||
if evidence_ids != self.evidence_ids {
|
||||
return Err(anyhow!("Verification audit evidence ids are not canonical"));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DatabaseEntry)]
|
||||
#[cultcache(
|
||||
type = "epiphany.mind.investigation_checkpoint.v1",
|
||||
|
|
@ -200,6 +262,7 @@ pub struct EpiphanyMindView {
|
|||
pub invariants: Vec<EpiphanyInvariant>,
|
||||
pub observations: Vec<EpiphanyObservation>,
|
||||
pub evidence: Vec<EpiphanyEvidenceRecord>,
|
||||
pub verification_audits: Vec<EpiphanyMindVerificationAuditDocument>,
|
||||
pub investigation_checkpoint: Option<EpiphanyInvestigationCheckpoint>,
|
||||
pub mode: Option<EpiphanyModeState>,
|
||||
pub planning: EpiphanyPlanningState,
|
||||
|
|
@ -216,6 +279,7 @@ pub(crate) fn register_mind_document_types(cache: &mut CultCache) -> Result<()>
|
|||
cache.register_entry_type::<EpiphanyMindInvariantDocument>()?;
|
||||
cache.register_entry_type::<EpiphanyMindObservationDocument>()?;
|
||||
cache.register_entry_type::<EpiphanyMindEvidenceDocument>()?;
|
||||
cache.register_entry_type::<EpiphanyMindVerificationAuditDocument>()?;
|
||||
cache.register_entry_type::<EpiphanyMindInvestigationCheckpointDocument>()?;
|
||||
cache.register_entry_type::<EpiphanyMindPlanningCaptureDocument>()?;
|
||||
cache.register_entry_type::<EpiphanyMindBacklogItemDocument>()?;
|
||||
|
|
@ -329,6 +393,11 @@ pub(crate) fn validate_mind_write_envelope(envelope: &CultCacheEnvelope) -> Resu
|
|||
rmp_serde::from_slice::<EpiphanyMindEvidenceDocument>(&envelope.payload)?
|
||||
.value
|
||||
.id
|
||||
} else if envelope.r#type == EpiphanyMindVerificationAuditDocument::TYPE {
|
||||
let value: EpiphanyMindVerificationAuditDocument =
|
||||
rmp_serde::from_slice(&envelope.payload)?;
|
||||
value.validate()?;
|
||||
value.audit_id
|
||||
} else if envelope.r#type == EpiphanyMindInvestigationCheckpointDocument::TYPE {
|
||||
rmp_serde::from_slice::<EpiphanyMindInvestigationCheckpointDocument>(&envelope.payload)?
|
||||
.value
|
||||
|
|
@ -392,6 +461,7 @@ pub fn assemble_mind_view(store_path: impl AsRef<Path>) -> Result<EpiphanyMindVi
|
|||
let mut observations =
|
||||
values::<EpiphanyMindObservationDocument, _>(&cache, |value| value.value)?;
|
||||
let mut evidence = values::<EpiphanyMindEvidenceDocument, _>(&cache, |value| value.value)?;
|
||||
let mut verification_audits = cache.get_all::<EpiphanyMindVerificationAuditDocument>()?;
|
||||
let checkpoints =
|
||||
values::<EpiphanyMindInvestigationCheckpointDocument, _>(&cache, |value| value.value)?;
|
||||
let mut captures =
|
||||
|
|
@ -432,6 +502,7 @@ pub fn assemble_mind_view(store_path: impl AsRef<Path>) -> Result<EpiphanyMindVi
|
|||
invariants.sort_by(|left, right| left.id.cmp(&right.id));
|
||||
observations.sort_by(|left, right| left.id.cmp(&right.id));
|
||||
evidence.sort_by(|left, right| left.id.cmp(&right.id));
|
||||
verification_audits.sort_by(|left, right| left.audit_id.cmp(&right.audit_id));
|
||||
captures.sort_by(|left, right| left.id.cmp(&right.id));
|
||||
backlog_items.sort_by(|left, right| left.id.cmp(&right.id));
|
||||
roadmap_streams.sort_by(|left, right| left.id.cmp(&right.id));
|
||||
|
|
@ -473,6 +544,7 @@ pub fn assemble_mind_view(store_path: impl AsRef<Path>) -> Result<EpiphanyMindVi
|
|||
invariants,
|
||||
observations,
|
||||
evidence,
|
||||
verification_audits,
|
||||
investigation_checkpoint,
|
||||
mode,
|
||||
planning: EpiphanyPlanningState {
|
||||
|
|
@ -510,6 +582,7 @@ fn canonical_mind_versions(
|
|||
| EpiphanyMindInvariantDocument::TYPE
|
||||
| EpiphanyMindObservationDocument::TYPE
|
||||
| EpiphanyMindEvidenceDocument::TYPE
|
||||
| EpiphanyMindVerificationAuditDocument::TYPE
|
||||
| EpiphanyMindInvestigationCheckpointDocument::TYPE
|
||||
| EpiphanyMindPlanningCaptureDocument::TYPE
|
||||
| EpiphanyMindBacklogItemDocument::TYPE
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ pub struct EpiphanyRolePassAuthorityProjection {
|
|||
Option<crate::RepoFrontierVerdictModelingLaunchAuthority>,
|
||||
pub frontier_planning_context: Option<crate::RepoFrontierPlanningContextProjection>,
|
||||
pub frontier_research_context: Option<crate::RepoFrontierResearchContextProjection>,
|
||||
pub frontier_verification_context: Option<crate::RepoFrontierVerificationContextProjection>,
|
||||
pub frontier_plan_mind_context: Option<crate::RepoFrontierPlanMindContextProjection>,
|
||||
pub imagination_consideration_context: Option<crate::ImaginationConsiderationContextProjection>,
|
||||
pub admitted_model_direction_consideration_context:
|
||||
|
|
@ -51,6 +52,7 @@ impl From<EpiphanyRoleWorkerLaunchDocument> for EpiphanyRolePassAuthorityProject
|
|||
frontier_verdict_modeling_context: value.frontier_verdict_modeling_context,
|
||||
frontier_planning_context: value.frontier_planning_context,
|
||||
frontier_research_context: value.frontier_research_context,
|
||||
frontier_verification_context: value.frontier_verification_context,
|
||||
frontier_plan_mind_context: value.frontier_plan_mind_context,
|
||||
imagination_consideration_context: value.imagination_consideration_context,
|
||||
admitted_model_direction_consideration_context: value
|
||||
|
|
@ -107,6 +109,7 @@ pub struct EpiphanyMindPromptProjection {
|
|||
pub invariants: Vec<epiphany_state_model::EpiphanyInvariant>,
|
||||
pub observations: Vec<epiphany_state_model::EpiphanyObservation>,
|
||||
pub evidence: Vec<epiphany_state_model::EpiphanyEvidenceRecord>,
|
||||
pub verification_audits: Vec<crate::EpiphanyMindVerificationAuditDocument>,
|
||||
pub investigation_checkpoint: Option<epiphany_state_model::EpiphanyInvestigationCheckpoint>,
|
||||
pub mode: Option<epiphany_state_model::EpiphanyModeState>,
|
||||
pub planning: epiphany_state_model::EpiphanyPlanningState,
|
||||
|
|
@ -126,6 +129,7 @@ impl From<crate::EpiphanyMindView> for EpiphanyMindPromptProjection {
|
|||
invariants: value.invariants,
|
||||
observations: value.observations,
|
||||
evidence: value.evidence,
|
||||
verification_audits: value.verification_audits,
|
||||
investigation_checkpoint: value.investigation_checkpoint,
|
||||
mode: value.mode,
|
||||
planning: value.planning,
|
||||
|
|
@ -1254,6 +1258,7 @@ mod tests {
|
|||
frontier_verdict_modeling_context: None,
|
||||
frontier_planning_context: None,
|
||||
frontier_research_context: None,
|
||||
frontier_verification_context: None,
|
||||
frontier_plan_mind_context: None,
|
||||
imagination_consideration_context: None,
|
||||
admitted_model_direction_consideration_context: None,
|
||||
|
|
@ -1298,6 +1303,7 @@ mod tests {
|
|||
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,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -1327,6 +1333,7 @@ mod tests {
|
|||
invariants: Vec::new(),
|
||||
observations: Vec::new(),
|
||||
evidence: Vec::new(),
|
||||
verification_audits: Vec::new(),
|
||||
investigation_checkpoint: None,
|
||||
mode: None,
|
||||
planning: Default::default(),
|
||||
|
|
|
|||
|
|
@ -1201,7 +1201,7 @@ pub fn ingest_resident_self_domain_pressure(
|
|||
}
|
||||
if let Some(work) = crate::project_current_work(runtime_store)?
|
||||
.frontier_verdict_modeling
|
||||
.filter(|work| work.action == crate::EpiphanyModelingContinuationAction::Launch)
|
||||
.filter(|work| work.action == crate::EpiphanyAgentPassContinuationAction::Launch)
|
||||
{
|
||||
inserted += usize::from(enqueue_resident_self_pressure_idempotent(
|
||||
resident_store,
|
||||
|
|
@ -1233,7 +1233,7 @@ pub fn ingest_resident_self_domain_pressure(
|
|||
// the next one on a later ingestion cycle.
|
||||
if let Some(selection) = crate::project_current_work(runtime_store)?
|
||||
.proposal_modeling
|
||||
.filter(|work| work.action == crate::EpiphanyModelingContinuationAction::Launch)
|
||||
.filter(|work| work.action == crate::EpiphanyAgentPassContinuationAction::Launch)
|
||||
.map(|work| work.request)
|
||||
{
|
||||
inserted += usize::from(enqueue_resident_self_pressure_idempotent(
|
||||
|
|
@ -1348,12 +1348,6 @@ fn resident_continuation_launch_was_overtaken(
|
|||
crate::EpiphanyRoleResultRoleId::Modeling,
|
||||
crate::EPIPHANY_MODELING_ROLE_BINDING_ID,
|
||||
),
|
||||
"launchVerification" => role_projection_is_terminal_for_continuation(
|
||||
runtime_store,
|
||||
thread_id,
|
||||
crate::EpiphanyRoleResultRoleId::Verification,
|
||||
crate::EPIPHANY_VERIFICATION_ROLE_BINDING_ID,
|
||||
),
|
||||
_ => Ok(false),
|
||||
}
|
||||
}
|
||||
|
|
@ -1381,11 +1375,11 @@ pub(crate) fn resident_self_safe_continuation_action(
|
|||
crate::body_modeling_continuation_action_for_job(runtime_store, job_id)?
|
||||
{
|
||||
return Ok(match action {
|
||||
crate::EpiphanyModelingContinuationAction::Launch => {
|
||||
crate::EpiphanyAgentPassContinuationAction::Launch => {
|
||||
Some("launchModeling".to_string())
|
||||
}
|
||||
crate::EpiphanyModelingContinuationAction::Wait => None,
|
||||
crate::EpiphanyModelingContinuationAction::Review => {
|
||||
crate::EpiphanyAgentPassContinuationAction::Wait => None,
|
||||
crate::EpiphanyAgentPassContinuationAction::Review => {
|
||||
Some("reviewModelingResult".to_string())
|
||||
}
|
||||
});
|
||||
|
|
@ -1394,11 +1388,11 @@ pub(crate) fn resident_self_safe_continuation_action(
|
|||
crate::proposal_modeling_continuation_action_for_job(runtime_store, job_id)?
|
||||
{
|
||||
return Ok(match action {
|
||||
crate::EpiphanyModelingContinuationAction::Launch => {
|
||||
crate::EpiphanyAgentPassContinuationAction::Launch => {
|
||||
Some("launchModeling".to_string())
|
||||
}
|
||||
crate::EpiphanyModelingContinuationAction::Wait => None,
|
||||
crate::EpiphanyModelingContinuationAction::Review => {
|
||||
crate::EpiphanyAgentPassContinuationAction::Wait => None,
|
||||
crate::EpiphanyAgentPassContinuationAction::Review => {
|
||||
Some("reviewModelingResult".to_string())
|
||||
}
|
||||
});
|
||||
|
|
@ -1407,21 +1401,38 @@ pub(crate) fn resident_self_safe_continuation_action(
|
|||
crate::frontier_verdict_modeling_continuation_action_for_job(runtime_store, job_id)?
|
||||
{
|
||||
return Ok(match action {
|
||||
crate::EpiphanyModelingContinuationAction::Launch => {
|
||||
crate::EpiphanyAgentPassContinuationAction::Launch => {
|
||||
Some("launchModeling".to_string())
|
||||
}
|
||||
crate::EpiphanyModelingContinuationAction::Wait => None,
|
||||
crate::EpiphanyModelingContinuationAction::Review => {
|
||||
crate::EpiphanyAgentPassContinuationAction::Wait => None,
|
||||
crate::EpiphanyAgentPassContinuationAction::Review => {
|
||||
Some("reviewModelingResult".to_string())
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
if matches!(
|
||||
receipt.final_action.as_str(),
|
||||
"launchVerification" | "waitForVerificationResult" | "reviewVerificationResult"
|
||||
) {
|
||||
return Ok(crate::project_current_work(runtime_store)?
|
||||
.verification
|
||||
.map(|work| match work.action {
|
||||
crate::EpiphanyAgentPassContinuationAction::Launch => {
|
||||
"launchVerification".to_string()
|
||||
}
|
||||
crate::EpiphanyAgentPassContinuationAction::Wait => {
|
||||
"waitForVerificationResult".to_string()
|
||||
}
|
||||
crate::EpiphanyAgentPassContinuationAction::Review => {
|
||||
"reviewVerificationResult".to_string()
|
||||
}
|
||||
}));
|
||||
}
|
||||
let direct = matches!(
|
||||
receipt.final_action.as_str(),
|
||||
"launchModeling"
|
||||
| "launchVerification"
|
||||
| "startFrontierPlanning"
|
||||
| "launchImagination"
|
||||
| "requestMindPlanReview"
|
||||
|
|
@ -1449,16 +1460,6 @@ pub(crate) fn resident_self_safe_continuation_action(
|
|||
{
|
||||
Some("reviewModelingResult")
|
||||
}
|
||||
"reviewVerificationResult"
|
||||
if role_projection_is_terminal_for_continuation(
|
||||
runtime_store,
|
||||
&receipt.thread_id,
|
||||
crate::EpiphanyRoleResultRoleId::Verification,
|
||||
crate::EPIPHANY_VERIFICATION_ROLE_BINDING_ID,
|
||||
)? =>
|
||||
{
|
||||
Some("reviewVerificationResult")
|
||||
}
|
||||
"waitForModelingResult"
|
||||
if role_projection_is_terminal_for_continuation(
|
||||
runtime_store,
|
||||
|
|
@ -1469,16 +1470,6 @@ pub(crate) fn resident_self_safe_continuation_action(
|
|||
{
|
||||
Some("reviewModelingResult")
|
||||
}
|
||||
"waitForVerificationResult"
|
||||
if role_projection_is_terminal_for_continuation(
|
||||
runtime_store,
|
||||
&receipt.thread_id,
|
||||
crate::EpiphanyRoleResultRoleId::Verification,
|
||||
crate::EPIPHANY_VERIFICATION_ROLE_BINDING_ID,
|
||||
)? =>
|
||||
{
|
||||
Some("reviewVerificationResult")
|
||||
}
|
||||
"waitForImaginationResult" => {
|
||||
match crate::runtime_repo_frontier_planning_lifecycle(runtime_store)?.stage {
|
||||
crate::RepoFrontierPlanningLifecycleStage::ImaginationResultReady => {
|
||||
|
|
@ -1568,13 +1559,13 @@ fn resident_self_failed_receipt_typed_continuation_action(
|
|||
_ => None,
|
||||
};
|
||||
Ok(match action {
|
||||
Some(crate::EpiphanyModelingContinuationAction::Review) => {
|
||||
Some(crate::EpiphanyAgentPassContinuationAction::Review) => {
|
||||
Some("reviewModelingResult".to_string())
|
||||
}
|
||||
Some(crate::EpiphanyModelingContinuationAction::Launch) => {
|
||||
Some(crate::EpiphanyAgentPassContinuationAction::Launch) => {
|
||||
Some("launchModeling".to_string())
|
||||
}
|
||||
Some(crate::EpiphanyModelingContinuationAction::Wait) | None => None,
|
||||
Some(crate::EpiphanyAgentPassContinuationAction::Wait) | None => None,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -447,6 +447,8 @@ pub struct EpiphanyRuntimeWorkerLaunchRequest {
|
|||
pub organ_launch_contract: EpiphanyLaunchOrganContract,
|
||||
#[cultcache(key = 11, default)]
|
||||
pub proposal_modeling_request_id: Option<String>,
|
||||
#[cultcache(key = 12, default)]
|
||||
pub repo_frontier_verification_request_id: Option<String>,
|
||||
#[cultcache(key = 13, default)]
|
||||
pub frontier_planning_request_id: Option<String>,
|
||||
#[cultcache(key = 14, default)]
|
||||
|
|
@ -1012,6 +1014,7 @@ pub struct RuntimeSpineHeartbeatJobOptions {
|
|||
pub admitted_model_direction_consideration_request_id: Option<String>,
|
||||
pub repo_frontier_modeling_request_id: Option<String>,
|
||||
pub repo_frontier_research_request_id: Option<String>,
|
||||
pub repo_frontier_verification_request_id: Option<String>,
|
||||
pub created_at: String,
|
||||
}
|
||||
|
||||
|
|
@ -1066,6 +1069,7 @@ pub struct EpiphanyJobLaunchRequest {
|
|||
pub admitted_model_direction_consideration_request_id: Option<String>,
|
||||
pub repo_frontier_modeling_request_id: Option<String>,
|
||||
pub repo_frontier_research_request_id: Option<String>,
|
||||
pub repo_frontier_verification_request_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
|
|
@ -3135,6 +3139,12 @@ pub fn open_runtime_spine_heartbeat_job(
|
|||
options.repo_frontier_research_request_id.as_deref(),
|
||||
&options.launch_document,
|
||||
)?;
|
||||
validate_frontier_verification_launch_carrier(
|
||||
&options.role,
|
||||
&options.binding_id,
|
||||
options.repo_frontier_verification_request_id.as_deref(),
|
||||
&options.launch_document,
|
||||
)?;
|
||||
validate_imagination_consideration_launch_carrier(
|
||||
&options.role,
|
||||
&options.binding_id,
|
||||
|
|
@ -3237,6 +3247,7 @@ pub fn open_runtime_spine_heartbeat_job(
|
|||
.admitted_model_direction_consideration_request_id,
|
||||
repo_frontier_modeling_request_id: options.repo_frontier_modeling_request_id,
|
||||
repo_frontier_research_request_id: options.repo_frontier_research_request_id,
|
||||
repo_frontier_verification_request_id: options.repo_frontier_verification_request_id,
|
||||
};
|
||||
cache.put(&job_id, &request)?;
|
||||
Ok(job)
|
||||
|
|
@ -3271,6 +3282,12 @@ pub fn prepare_runtime_spine_heartbeat_job(
|
|||
options.repo_frontier_research_request_id.as_deref(),
|
||||
&options.launch_document,
|
||||
)?;
|
||||
validate_frontier_verification_launch_carrier(
|
||||
&options.role,
|
||||
&options.binding_id,
|
||||
options.repo_frontier_verification_request_id.as_deref(),
|
||||
&options.launch_document,
|
||||
)?;
|
||||
validate_imagination_consideration_launch_carrier(
|
||||
&options.role,
|
||||
&options.binding_id,
|
||||
|
|
@ -3399,6 +3416,7 @@ pub fn prepare_runtime_spine_heartbeat_job(
|
|||
.admitted_model_direction_consideration_request_id,
|
||||
repo_frontier_modeling_request_id: options.repo_frontier_modeling_request_id,
|
||||
repo_frontier_research_request_id: options.repo_frontier_research_request_id,
|
||||
repo_frontier_verification_request_id: options.repo_frontier_verification_request_id,
|
||||
};
|
||||
let envelopes = vec![
|
||||
cache.prepare_entry(RUNTIME_IDENTITY_KEY, &identity)?.0,
|
||||
|
|
@ -3753,6 +3771,45 @@ fn validate_frontier_research_launch_carrier(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn validate_frontier_verification_launch_carrier(
|
||||
role: &str,
|
||||
binding_id: &str,
|
||||
verification_request_id: Option<&str>,
|
||||
launch_document: &EpiphanyWorkerLaunchDocument,
|
||||
) -> Result<()> {
|
||||
let projection = match launch_document {
|
||||
EpiphanyWorkerLaunchDocument::Role(document) => {
|
||||
document.frontier_verification_context.as_ref()
|
||||
}
|
||||
EpiphanyWorkerLaunchDocument::Reorient(_) => None,
|
||||
};
|
||||
let Some(request_id) = verification_request_id else {
|
||||
if projection.is_some() {
|
||||
return Err(anyhow!(
|
||||
"frontier Verification context requires its typed request id"
|
||||
));
|
||||
}
|
||||
return Ok(());
|
||||
};
|
||||
validate_non_empty(request_id, "frontier Verification request id")?;
|
||||
if role != crate::EPIPHANY_VERIFICATION_OWNER_ROLE
|
||||
|| binding_id != crate::EPIPHANY_VERIFICATION_ROLE_BINDING_ID
|
||||
{
|
||||
return Err(anyhow!(
|
||||
"frontier Verification request may only be transported by the Verification role launch"
|
||||
));
|
||||
}
|
||||
let projection = projection
|
||||
.ok_or_else(|| anyhow!("frontier Verification request requires its typed context"))?;
|
||||
if projection.request.request_id != request_id
|
||||
|| projection.schema_version != crate::REPO_FRONTIER_VERIFICATION_CONTEXT_SCHEMA_VERSION
|
||||
|| projection.contract != crate::REPO_FRONTIER_VERIFICATION_CONTEXT_CONTRACT
|
||||
{
|
||||
return Err(anyhow!("frontier Verification context/request mismatch"));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn put_runtime_requested_public_source_intents(
|
||||
store_path: impl AsRef<Path>,
|
||||
worker_job_id: &str,
|
||||
|
|
@ -3894,6 +3951,48 @@ pub(crate) fn frontier_research_request_for_launch(
|
|||
Ok(Some(request))
|
||||
}
|
||||
|
||||
pub(crate) fn frontier_verification_request_for_launch(
|
||||
cache: &CultCache,
|
||||
launch: &EpiphanyRuntimeWorkerLaunchRequest,
|
||||
) -> Result<Option<RepoFrontierVerificationRequest>> {
|
||||
let document: EpiphanyWorkerLaunchDocument =
|
||||
rmp_serde::from_slice(&launch.launch_document_msgpack)?;
|
||||
validate_frontier_verification_launch_carrier(
|
||||
&launch.role,
|
||||
&launch.binding_id,
|
||||
launch.repo_frontier_verification_request_id.as_deref(),
|
||||
&document,
|
||||
)?;
|
||||
let Some(request_id) = launch.repo_frontier_verification_request_id.as_deref() else {
|
||||
return Ok(None);
|
||||
};
|
||||
let request = cache
|
||||
.get::<RepoFrontierVerificationRequest>(request_id)?
|
||||
.ok_or_else(|| anyhow!("frontier Verification launch lost its typed request"))?;
|
||||
validate_repo_frontier_verification_request_intrinsic(&request)?;
|
||||
let carried = match document {
|
||||
EpiphanyWorkerLaunchDocument::Role(document) => document.frontier_verification_context,
|
||||
EpiphanyWorkerLaunchDocument::Reorient(_) => None,
|
||||
}
|
||||
.ok_or_else(|| anyhow!("frontier Verification launch lost its typed context"))?;
|
||||
if carried.request != request
|
||||
|| carried.route.route_id != request.route_id
|
||||
|| carried.hands_authority.route_id != request.route_id
|
||||
|| carried.hands_authority.hands_intent_id != request.hands_intent_id
|
||||
|| carried.hands_authority.hands_review_id != request.hands_review_id
|
||||
|| carried.hands_intent.intent_id != request.hands_intent_id
|
||||
|| carried.hands_review.review_id != request.hands_review_id
|
||||
|| carried.patch_receipt.receipt_id != request.hands_patch_receipt_id
|
||||
|| carried.command_receipt.receipt_id != request.hands_command_receipt_id
|
||||
|| carried.commit_receipt.receipt_id != request.hands_commit_receipt_id
|
||||
{
|
||||
return Err(anyhow!(
|
||||
"frontier Verification launch context diverges from its request and Hands receipts"
|
||||
));
|
||||
}
|
||||
Ok(Some(request))
|
||||
}
|
||||
|
||||
pub fn runtime_authenticated_public_source_lookups_for_worker(
|
||||
store_path: impl AsRef<Path>,
|
||||
worker_job_id: &str,
|
||||
|
|
@ -4601,6 +4700,25 @@ pub fn put_runtime_role_worker_result(
|
|||
return Err(anyhow!("Research result substituted its typed request"));
|
||||
}
|
||||
}
|
||||
let is_frontier_verification = worker_launch
|
||||
.repo_frontier_verification_request_id
|
||||
.is_some();
|
||||
if is_verification != is_frontier_verification {
|
||||
return Err(anyhow!(
|
||||
"Verification result and launch must share one exact frontier request"
|
||||
));
|
||||
}
|
||||
if is_frontier_verification {
|
||||
let request = frontier_verification_request_for_launch(&cache, &worker_launch)?
|
||||
.ok_or_else(|| anyhow!("Verification result lost its typed request"))?;
|
||||
if result.verification_request_id.as_deref() != Some(request.request_id.as_str())
|
||||
|| result.frontier_route_id.as_deref() != Some(request.route_id.as_str())
|
||||
{
|
||||
return Err(anyhow!(
|
||||
"Verification result substituted its exact request or route"
|
||||
));
|
||||
}
|
||||
}
|
||||
if is_modeling
|
||||
&& (result.verification_request_id.is_some() || result.frontier_route_id.is_some())
|
||||
{
|
||||
|
|
@ -5431,6 +5549,7 @@ pub fn runtime_typed_request_fulfillment(
|
|||
}
|
||||
RuntimeTypedRequestRef::FrontierVerdictModeling(_) => {}
|
||||
RuntimeTypedRequestRef::FrontierResearch(_) => {}
|
||||
RuntimeTypedRequestRef::FrontierVerification(_) => {}
|
||||
RuntimeTypedRequestRef::ImaginationConsideration(_) => {
|
||||
let candidate = result
|
||||
.imagination_consideration_candidate()?
|
||||
|
|
@ -8712,16 +8831,29 @@ fn validate_repo_frontier_hands_authority_chain(
|
|||
let route = cache
|
||||
.get::<RepoFrontierRoute>(&authority.route_id)?
|
||||
.ok_or_else(|| anyhow!("Hands authority requires its persisted route"))?;
|
||||
let current = require_keyed_repo_model_basis(
|
||||
cache,
|
||||
&authority.model_projection_digest,
|
||||
&authority.model_source_documents,
|
||||
)?;
|
||||
let current_item = current
|
||||
.frontier
|
||||
let frontier_source = route
|
||||
.model_source_documents
|
||||
.iter()
|
||||
.find(|item| item.id == route.frontier_item_id)
|
||||
.find(|source| {
|
||||
source.document_type == crate::EpiphanyRepoModelFrontierDocument::TYPE
|
||||
&& source.document_key == route.frontier_item_id
|
||||
})
|
||||
.ok_or_else(|| anyhow!("Hands authority route lost its exact frontier version"))?;
|
||||
let current_frontier_envelope = cache
|
||||
.get_envelope::<crate::EpiphanyRepoModelFrontierDocument>(&route.frontier_item_id)?
|
||||
.ok_or_else(|| anyhow!("Hands authority lost its model frontier"))?;
|
||||
if crate::EpiphanyMindDocumentVersion::from_envelope(
|
||||
"epiphany-mind",
|
||||
¤t_frontier_envelope,
|
||||
)? != *frontier_source
|
||||
{
|
||||
return Err(anyhow!(
|
||||
"Hands authority frontier version is no longer current"
|
||||
));
|
||||
}
|
||||
let current_item: crate::EpiphanyRepoModelFrontierDocument =
|
||||
rmp_serde::from_slice(¤t_frontier_envelope.payload)?;
|
||||
let current_item = current_item.value()?;
|
||||
let intent = cache
|
||||
.get::<HandsActionIntent>(&authority.hands_intent_id)?
|
||||
.ok_or_else(|| anyhow!("Hands authority requires its persisted intent"))?;
|
||||
|
|
@ -8829,11 +8961,6 @@ pub fn put_repo_frontier_hands_authority(
|
|||
let route = cache
|
||||
.get::<RepoFrontierRoute>(&authority.route_id)?
|
||||
.ok_or_else(|| anyhow!("repo frontier Hands authority requires its persisted route"))?;
|
||||
require_keyed_repo_model_basis(
|
||||
&cache,
|
||||
&authority.model_projection_digest,
|
||||
&authority.model_source_documents,
|
||||
)?;
|
||||
let intent = cache
|
||||
.get::<HandsActionIntent>(&authority.hands_intent_id)?
|
||||
.ok_or_else(|| anyhow!("repo frontier Hands authority requires its persisted intent"))?;
|
||||
|
|
@ -8875,11 +9002,23 @@ pub fn put_repo_frontier_hands_authority(
|
|||
}
|
||||
let (envelope, _) = cache.prepare_entry(&authority.authority_id, authority)?;
|
||||
let backing = SingleFileMessagePackBackingStore::new(store_path);
|
||||
let basis = crate::EpiphanyRepoModelBasis {
|
||||
projection_digest: authority.model_projection_digest.clone(),
|
||||
source_documents: authority.model_source_documents.clone(),
|
||||
};
|
||||
let expected = keyed_repo_model_basis_envelopes(&cache, &basis)?;
|
||||
let expected = vec![
|
||||
cache
|
||||
.get_envelope::<RepoFrontierRoute>(&route.route_id)?
|
||||
.ok_or_else(|| anyhow!("repo frontier Hands authority lost its route envelope"))?,
|
||||
cache
|
||||
.get_envelope::<HandsActionIntent>(&intent.intent_id)?
|
||||
.ok_or_else(|| anyhow!("repo frontier Hands authority lost its intent envelope"))?,
|
||||
cache
|
||||
.get_envelope::<HandsActionReview>(&review.review_id)?
|
||||
.ok_or_else(|| anyhow!("repo frontier Hands authority lost its review envelope"))?,
|
||||
cache
|
||||
.get_envelope::<SubstrateGateRepoAccessGrantReceipt>(&grant.receipt_id)?
|
||||
.ok_or_else(|| anyhow!("repo frontier Hands authority lost its grant envelope"))?,
|
||||
cache
|
||||
.get_envelope::<crate::EpiphanyRepoModelFrontierDocument>(&authority.frontier_item_id)?
|
||||
.ok_or_else(|| anyhow!("repo frontier Hands authority lost its frontier envelope"))?,
|
||||
];
|
||||
let mut writes = expected.clone();
|
||||
writes.push(envelope);
|
||||
if backing.compare_and_swap_batch(&expected, writes)? {
|
||||
|
|
@ -9100,6 +9239,11 @@ fn worker_result_has_keyed_mind_commit(
|
|||
| crate::EpiphanyMindObservationDocument::TYPE
|
||||
)
|
||||
})
|
||||
} else if result.role_id.eq_ignore_ascii_case("verification") {
|
||||
receipt.invariant_owner == "Soul.verification"
|
||||
&& receipt.writes.iter().any(|write| {
|
||||
write.document_type == crate::EpiphanyMindVerificationAuditDocument::TYPE
|
||||
})
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
|
@ -9224,31 +9368,95 @@ pub fn amend_repo_frontier_execution(
|
|||
}
|
||||
}
|
||||
|
||||
pub fn put_repo_frontier_verification_request(
|
||||
store_path: impl AsRef<Path>,
|
||||
pub(crate) fn validate_repo_frontier_verification_request_intrinsic(
|
||||
request: &RepoFrontierVerificationRequest,
|
||||
) -> Result<()> {
|
||||
let store_path = store_path.as_ref();
|
||||
) -> Result<crate::RepoFrontierItem> {
|
||||
if request.schema_version != REPO_FRONTIER_VERIFICATION_REQUEST_SCHEMA_VERSION
|
||||
|| request.contract != REPO_FRONTIER_VERIFICATION_REQUEST_CONTRACT
|
||||
|| chrono::DateTime::parse_from_rfc3339(&request.requested_at).is_err()
|
||||
|| request.request_id.trim().is_empty()
|
||||
|| [
|
||||
request.request_id.as_str(),
|
||||
request.route_id.as_str(),
|
||||
request.frontier_item_id.as_str(),
|
||||
request.frontier_item_hash.as_str(),
|
||||
request.hands_intent_id.as_str(),
|
||||
request.hands_review_id.as_str(),
|
||||
request.hands_patch_receipt_id.as_str(),
|
||||
request.hands_command_receipt_id.as_str(),
|
||||
request.hands_commit_receipt_id.as_str(),
|
||||
]
|
||||
.into_iter()
|
||||
.any(str::is_empty)
|
||||
|| request.frontier_authority_documents.len() != 1
|
||||
{
|
||||
return Err(anyhow!(
|
||||
"invalid repo frontier verification request contract"
|
||||
));
|
||||
}
|
||||
crate::EpiphanyRepoModelBasis {
|
||||
projection_digest: request.model_projection_digest.clone(),
|
||||
source_documents: request.model_source_documents.clone(),
|
||||
}
|
||||
.validate()?;
|
||||
let source = &request.frontier_authority_documents[0];
|
||||
source.validate()?;
|
||||
if source.store_id != "epiphany-mind"
|
||||
|| source.document_type != crate::EpiphanyRepoModelFrontierDocument::TYPE
|
||||
|| source.document_key != request.frontier_item_id
|
||||
{
|
||||
return Err(anyhow!(
|
||||
"Verification request frontier authority has the wrong identity"
|
||||
));
|
||||
}
|
||||
let frontier: crate::EpiphanyRepoModelFrontierDocument =
|
||||
rmp_serde::from_slice(&source.payload_msgpack)?;
|
||||
let frontier = frontier.value()?;
|
||||
let frontier_hash = format!("{:x}", Sha256::digest(rmp_serde::to_vec_named(&frontier)?));
|
||||
if frontier.id != request.frontier_item_id || frontier_hash != request.frontier_item_hash {
|
||||
return Err(anyhow!(
|
||||
"Verification request frontier authority does not bind its exact item"
|
||||
));
|
||||
}
|
||||
Ok(frontier)
|
||||
}
|
||||
|
||||
pub(crate) fn verification_frontier_is_current(
|
||||
cache: &CultCache,
|
||||
request: &RepoFrontierVerificationRequest,
|
||||
) -> Result<bool> {
|
||||
validate_repo_frontier_verification_request_intrinsic(request)?;
|
||||
let source = &request.frontier_authority_documents[0];
|
||||
Ok(cache
|
||||
.snapshot_envelopes()
|
||||
.iter()
|
||||
.find(|envelope| {
|
||||
envelope.r#type == source.document_type && envelope.key == source.document_key
|
||||
})
|
||||
.map(|envelope| {
|
||||
crate::EpiphanyMindDocumentVersion::from_envelope("epiphany-mind", envelope)
|
||||
.map(|current| current == *source)
|
||||
})
|
||||
.transpose()?
|
||||
.unwrap_or(false))
|
||||
}
|
||||
|
||||
pub fn put_repo_frontier_verification_request(
|
||||
store_path: impl AsRef<Path>,
|
||||
request: &RepoFrontierVerificationRequest,
|
||||
) -> Result<()> {
|
||||
let store_path = store_path.as_ref();
|
||||
validate_repo_frontier_verification_request_intrinsic(request)?;
|
||||
let mut cache = runtime_spine_cache(store_path)?;
|
||||
cache.pull_all_backing_stores()?;
|
||||
require_identity(&cache)?;
|
||||
let route = cache
|
||||
.get::<RepoFrontierRoute>(&request.route_id)?
|
||||
.ok_or_else(|| anyhow!("verification request requires its exact frontier route"))?;
|
||||
require_keyed_repo_model_basis(
|
||||
&cache,
|
||||
&request.model_projection_digest,
|
||||
&request.model_source_documents,
|
||||
)?;
|
||||
if !verification_frontier_is_current(&cache, request)? {
|
||||
return Err(anyhow!(
|
||||
"verification request frontier authority is no longer current"
|
||||
));
|
||||
}
|
||||
let authorities = cache
|
||||
.get_all::<RepoFrontierHandsAuthority>()?
|
||||
.into_iter()
|
||||
|
|
@ -9331,11 +9539,41 @@ pub fn put_repo_frontier_verification_request(
|
|||
}
|
||||
let (envelope, _) = cache.prepare_entry(&request.request_id, request)?;
|
||||
let backing = SingleFileMessagePackBackingStore::new(store_path);
|
||||
let basis = crate::EpiphanyRepoModelBasis {
|
||||
projection_digest: request.model_projection_digest.clone(),
|
||||
source_documents: request.model_source_documents.clone(),
|
||||
};
|
||||
let expected = keyed_repo_model_basis_envelopes(&cache, &basis)?;
|
||||
let mut expected = Vec::new();
|
||||
for (document_type, document_key) in [
|
||||
(RepoFrontierRoute::TYPE, request.route_id.as_str()),
|
||||
(
|
||||
RepoFrontierHandsAuthority::TYPE,
|
||||
authority.authority_id.as_str(),
|
||||
),
|
||||
(HandsActionIntent::TYPE, request.hands_intent_id.as_str()),
|
||||
(HandsActionReview::TYPE, request.hands_review_id.as_str()),
|
||||
(
|
||||
HandsPatchReceipt::TYPE,
|
||||
request.hands_patch_receipt_id.as_str(),
|
||||
),
|
||||
(
|
||||
HandsCommandReceipt::TYPE,
|
||||
request.hands_command_receipt_id.as_str(),
|
||||
),
|
||||
(
|
||||
HandsCommitReceipt::TYPE,
|
||||
request.hands_commit_receipt_id.as_str(),
|
||||
),
|
||||
(
|
||||
crate::EpiphanyRepoModelFrontierDocument::TYPE,
|
||||
request.frontier_item_id.as_str(),
|
||||
),
|
||||
] {
|
||||
expected.push(
|
||||
cache
|
||||
.snapshot_envelopes()
|
||||
.iter()
|
||||
.find(|value| value.r#type == document_type && value.key == document_key)
|
||||
.cloned()
|
||||
.ok_or_else(|| anyhow!("verification request lost an exact authority"))?,
|
||||
);
|
||||
}
|
||||
let mut writes = expected.clone();
|
||||
writes.push(envelope);
|
||||
if backing.compare_and_swap_batch(&expected, writes)? {
|
||||
|
|
@ -9358,6 +9596,85 @@ pub fn runtime_repo_frontier_verification_request(
|
|||
cache.get::<RepoFrontierVerificationRequest>(request_id)
|
||||
}
|
||||
|
||||
pub(crate) fn repo_frontier_verification_context(
|
||||
cache: &CultCache,
|
||||
request: &RepoFrontierVerificationRequest,
|
||||
) -> Result<crate::RepoFrontierVerificationContextProjection> {
|
||||
repo_frontier_verification_context_with_commit(cache, request, None)
|
||||
}
|
||||
|
||||
fn repo_frontier_verification_context_with_commit(
|
||||
cache: &CultCache,
|
||||
request: &RepoFrontierVerificationRequest,
|
||||
prospective_commit: Option<&HandsCommitReceipt>,
|
||||
) -> Result<crate::RepoFrontierVerificationContextProjection> {
|
||||
validate_repo_frontier_verification_request_intrinsic(request)?;
|
||||
if !verification_frontier_is_current(cache, request)? {
|
||||
return Err(anyhow!(
|
||||
"Verification context cannot be projected from stale frontier authority"
|
||||
));
|
||||
}
|
||||
let route = cache
|
||||
.get::<RepoFrontierRoute>(&request.route_id)?
|
||||
.ok_or_else(|| anyhow!("Verification context lost its route"))?;
|
||||
let authorities = cache
|
||||
.get_all::<RepoFrontierHandsAuthority>()?
|
||||
.into_iter()
|
||||
.filter(|authority| {
|
||||
authority.route_id == request.route_id
|
||||
&& authority.hands_intent_id == request.hands_intent_id
|
||||
&& authority.hands_review_id == request.hands_review_id
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
let [hands_authority] = authorities.as_slice() else {
|
||||
return Err(anyhow!(
|
||||
"Verification context requires one exact Hands authority"
|
||||
));
|
||||
};
|
||||
validate_repo_frontier_hands_authority_chain(cache, hands_authority)?;
|
||||
let hands_intent = cache
|
||||
.get::<HandsActionIntent>(&request.hands_intent_id)?
|
||||
.ok_or_else(|| anyhow!("Verification context lost its Hands intent"))?;
|
||||
let hands_review = cache
|
||||
.get::<HandsActionReview>(&request.hands_review_id)?
|
||||
.ok_or_else(|| anyhow!("Verification context lost its Hands review"))?;
|
||||
let patch_receipt = cache
|
||||
.get::<HandsPatchReceipt>(&request.hands_patch_receipt_id)?
|
||||
.ok_or_else(|| anyhow!("Verification context lost its patch receipt"))?;
|
||||
let command_receipt = cache
|
||||
.get::<HandsCommandReceipt>(&request.hands_command_receipt_id)?
|
||||
.ok_or_else(|| anyhow!("Verification context lost its command receipt"))?;
|
||||
let commit_receipt = match prospective_commit {
|
||||
Some(receipt)
|
||||
if receipt.receipt_id == request.hands_commit_receipt_id
|
||||
&& receipt.intent_id == request.hands_intent_id
|
||||
&& receipt.review_id == request.hands_review_id =>
|
||||
{
|
||||
receipt.clone()
|
||||
}
|
||||
Some(_) => {
|
||||
return Err(anyhow!(
|
||||
"prospective Hands commit does not exactly bind its Verification request"
|
||||
));
|
||||
}
|
||||
None => cache
|
||||
.get::<HandsCommitReceipt>(&request.hands_commit_receipt_id)?
|
||||
.ok_or_else(|| anyhow!("Verification context lost its commit receipt"))?,
|
||||
};
|
||||
Ok(crate::RepoFrontierVerificationContextProjection {
|
||||
schema_version: crate::REPO_FRONTIER_VERIFICATION_CONTEXT_SCHEMA_VERSION.into(),
|
||||
request: request.clone(),
|
||||
route,
|
||||
hands_authority: hands_authority.clone(),
|
||||
hands_intent,
|
||||
hands_review,
|
||||
patch_receipt,
|
||||
command_receipt,
|
||||
commit_receipt,
|
||||
contract: crate::REPO_FRONTIER_VERIFICATION_CONTEXT_CONTRACT.into(),
|
||||
})
|
||||
}
|
||||
|
||||
pub fn runtime_repo_frontier_route(
|
||||
store_path: impl AsRef<Path>,
|
||||
route_id: &str,
|
||||
|
|
@ -9566,13 +9883,11 @@ fn consequence_paths_within_authority(
|
|||
})
|
||||
}
|
||||
|
||||
pub fn commit_repo_frontier_verification_request_for_chain(
|
||||
store_path: impl AsRef<Path>,
|
||||
fn derive_repo_frontier_verification_request_for_chain(
|
||||
cache: &CultCache,
|
||||
chain: &RuntimeHandsReceiptChainSummary,
|
||||
requested_at: &str,
|
||||
) -> Result<RepoFrontierVerificationRequest> {
|
||||
let mut cache = runtime_spine_cache(store_path.as_ref())?;
|
||||
cache.pull_all_backing_stores()?;
|
||||
let authorities = cache
|
||||
.get_all::<RepoFrontierHandsAuthority>()?
|
||||
.into_iter()
|
||||
|
|
@ -9586,6 +9901,13 @@ pub fn commit_repo_frontier_verification_request_for_chain(
|
|||
));
|
||||
}
|
||||
let authority = &authorities[0];
|
||||
let frontier_envelope = cache
|
||||
.get_envelope::<crate::EpiphanyRepoModelFrontierDocument>(&authority.frontier_item_id)?
|
||||
.ok_or_else(|| anyhow!("Hands authority lost its exact frontier document"))?;
|
||||
let frontier_authority_documents = vec![crate::EpiphanyMindDocumentVersion::from_envelope(
|
||||
"epiphany-mind",
|
||||
&frontier_envelope,
|
||||
)?];
|
||||
let request_id = format!(
|
||||
"frontier-verification-{}-{}",
|
||||
authority.route_id, chain.commit_receipt_id
|
||||
|
|
@ -9609,7 +9931,20 @@ pub fn commit_repo_frontier_verification_request_for_chain(
|
|||
hands_commit_receipt_id: chain.commit_receipt_id.clone(),
|
||||
requested_at,
|
||||
contract: REPO_FRONTIER_VERIFICATION_REQUEST_CONTRACT.to_string(),
|
||||
frontier_authority_documents,
|
||||
};
|
||||
Ok(request)
|
||||
}
|
||||
|
||||
pub fn commit_repo_frontier_verification_request_for_chain(
|
||||
store_path: impl AsRef<Path>,
|
||||
chain: &RuntimeHandsReceiptChainSummary,
|
||||
requested_at: &str,
|
||||
) -> Result<RepoFrontierVerificationRequest> {
|
||||
let store_path = store_path.as_ref();
|
||||
let mut cache = runtime_spine_cache(store_path)?;
|
||||
cache.pull_all_backing_stores()?;
|
||||
let request = derive_repo_frontier_verification_request_for_chain(&cache, chain, requested_at)?;
|
||||
put_repo_frontier_verification_request(store_path, &request)?;
|
||||
Ok(request)
|
||||
}
|
||||
|
|
@ -9882,16 +10217,103 @@ pub fn put_hands_commit_receipt(
|
|||
let mut cache = runtime_spine_cache(store_path)?;
|
||||
cache.pull_all_backing_stores()?;
|
||||
require_identity(&cache)?;
|
||||
let (envelope, _) = cache.prepare_entry(&receipt.receipt_id, receipt)?;
|
||||
let patch = cache
|
||||
.get_all::<HandsPatchReceipt>()?
|
||||
.into_iter()
|
||||
.filter(|patch| {
|
||||
patch.intent_id == receipt.intent_id
|
||||
&& patch.review_id == receipt.review_id
|
||||
&& patch.runtime_job_id == receipt.runtime_job_id
|
||||
&& patch.emitted_at <= receipt.emitted_at
|
||||
})
|
||||
.max_by(|left, right| left.emitted_at.cmp(&right.emitted_at))
|
||||
.ok_or_else(|| anyhow!("Hands commit requires its exact patch receipt"))?;
|
||||
let command = cache
|
||||
.get_all::<HandsCommandReceipt>()?
|
||||
.into_iter()
|
||||
.filter(|command| {
|
||||
command.intent_id == receipt.intent_id
|
||||
&& command.review_id == receipt.review_id
|
||||
&& command.runtime_job_id == receipt.runtime_job_id
|
||||
&& command.exit_code == "0"
|
||||
&& command.emitted_at <= receipt.emitted_at
|
||||
})
|
||||
.max_by(|left, right| left.emitted_at.cmp(&right.emitted_at))
|
||||
.ok_or_else(|| anyhow!("Hands commit requires its successful command receipt"))?;
|
||||
let chain = RuntimeHandsReceiptChainSummary {
|
||||
patch_schema_version: patch.schema_version.clone(),
|
||||
patch_receipt_id: patch.receipt_id.clone(),
|
||||
command_schema_version: command.schema_version.clone(),
|
||||
command_receipt_id: command.receipt_id.clone(),
|
||||
commit_schema_version: receipt.schema_version.clone(),
|
||||
commit_receipt_id: receipt.receipt_id.clone(),
|
||||
intent_id: receipt.intent_id.clone(),
|
||||
review_id: receipt.review_id.clone(),
|
||||
runtime_job_id: receipt.runtime_job_id.clone(),
|
||||
substrate_gate_grant_receipt_id: command.substrate_gate_grant_receipt_id.clone(),
|
||||
changed_paths: receipt.changed_paths.clone(),
|
||||
command: command.command.clone(),
|
||||
exit_code: command.exit_code.clone(),
|
||||
stdout_artifact: command.stdout_artifact.clone(),
|
||||
stderr_artifact: command.stderr_artifact.clone(),
|
||||
commit_sha: receipt.commit_sha.clone(),
|
||||
branch: receipt.branch.clone(),
|
||||
summary: receipt.summary.clone(),
|
||||
emitted_at: receipt.emitted_at.clone(),
|
||||
};
|
||||
let request =
|
||||
derive_repo_frontier_verification_request_for_chain(&cache, &chain, &receipt.emitted_at)?;
|
||||
let context = repo_frontier_verification_context_with_commit(&cache, &request, Some(receipt))?;
|
||||
let snapshot = cache.snapshot_envelopes();
|
||||
let mut expected = Vec::new();
|
||||
for (document_type, document_key) in [
|
||||
(RepoFrontierRoute::TYPE, request.route_id.as_str()),
|
||||
(
|
||||
RepoFrontierHandsAuthority::TYPE,
|
||||
context.hands_authority.authority_id.as_str(),
|
||||
),
|
||||
(HandsActionIntent::TYPE, request.hands_intent_id.as_str()),
|
||||
(HandsActionReview::TYPE, request.hands_review_id.as_str()),
|
||||
(
|
||||
HandsPatchReceipt::TYPE,
|
||||
request.hands_patch_receipt_id.as_str(),
|
||||
),
|
||||
(
|
||||
HandsCommandReceipt::TYPE,
|
||||
request.hands_command_receipt_id.as_str(),
|
||||
),
|
||||
(
|
||||
crate::EpiphanyRepoModelFrontierDocument::TYPE,
|
||||
request.frontier_item_id.as_str(),
|
||||
),
|
||||
] {
|
||||
expected.push(
|
||||
snapshot
|
||||
.iter()
|
||||
.find(|value| value.r#type == document_type && value.key == document_key)
|
||||
.cloned()
|
||||
.ok_or_else(|| anyhow!("Hands commit lost exact Verification authority"))?,
|
||||
);
|
||||
}
|
||||
let mut writes = expected.clone();
|
||||
writes.push(cache.prepare_entry(&receipt.receipt_id, receipt)?.0);
|
||||
writes.push(cache.prepare_entry(&request.request_id, &request)?.0);
|
||||
if SingleFileMessagePackBackingStore::new(store_path)
|
||||
.compare_and_swap_batch(&[], vec![envelope])?
|
||||
.compare_and_swap_batch(&expected, writes)?
|
||||
{
|
||||
return Ok(());
|
||||
}
|
||||
let mut reloaded = runtime_spine_cache(store_path)?;
|
||||
reloaded.pull_all_backing_stores()?;
|
||||
match reloaded.get::<HandsCommitReceipt>(&receipt.receipt_id)? {
|
||||
Some(existing) if existing == *receipt => Ok(()),
|
||||
match (
|
||||
reloaded.get::<HandsCommitReceipt>(&receipt.receipt_id)?,
|
||||
reloaded.get::<RepoFrontierVerificationRequest>(&request.request_id)?,
|
||||
) {
|
||||
(Some(existing), Some(existing_request))
|
||||
if existing == *receipt && existing_request == request =>
|
||||
{
|
||||
Ok(())
|
||||
}
|
||||
_ => Err(anyhow!("Hands commit receipt ids are immutable")),
|
||||
}
|
||||
}
|
||||
|
|
@ -10066,12 +10488,7 @@ pub fn runtime_hands_receipt_chain_matches_current_model(
|
|||
let route = cache
|
||||
.get::<RepoFrontierRoute>(&authority.route_id)?
|
||||
.ok_or_else(|| anyhow!("Hands receipt chain lost its persisted route"))?;
|
||||
let current = require_keyed_repo_model_basis(
|
||||
&cache,
|
||||
&route.model_projection_digest,
|
||||
&route.model_source_documents,
|
||||
)
|
||||
.is_ok();
|
||||
let current = validate_repo_frontier_hands_authority_chain(&cache, authority).is_ok();
|
||||
Ok(authority.hands_review_id == chain.review_id
|
||||
&& authority.substrate_grant_receipt_id == chain.substrate_gate_grant_receipt_id
|
||||
&& authority.route_id == route.route_id
|
||||
|
|
@ -10542,6 +10959,7 @@ where
|
|||
RuntimeTypedRequestRef::FrontierVerdictModeling(request_id)
|
||||
}
|
||||
"frontier-research" => RuntimeTypedRequestRef::FrontierResearch(request_id),
|
||||
"frontier-verification" => RuntimeTypedRequestRef::FrontierVerification(request_id),
|
||||
"imagination-consideration" => {
|
||||
RuntimeTypedRequestRef::ImaginationConsideration(request_id)
|
||||
}
|
||||
|
|
@ -10563,7 +10981,10 @@ where
|
|||
}
|
||||
if matches!(
|
||||
request_kind,
|
||||
"proposal-modeling" | "frontier-verdict-modeling" | "frontier-research"
|
||||
"proposal-modeling"
|
||||
| "frontier-verdict-modeling"
|
||||
| "frontier-research"
|
||||
| "frontier-verification"
|
||||
) && !worker_result_has_keyed_mind_commit(
|
||||
&cache,
|
||||
role_result
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ pub enum RuntimeTypedRequestRef<'a> {
|
|||
ProposalModeling(&'a str),
|
||||
FrontierVerdictModeling(&'a str),
|
||||
FrontierResearch(&'a str),
|
||||
FrontierVerification(&'a str),
|
||||
ImaginationConsideration(&'a str),
|
||||
AdmittedModelDirection(&'a str),
|
||||
}
|
||||
|
|
@ -69,6 +70,7 @@ impl<'a> RuntimeTypedRequestRef<'a> {
|
|||
Self::ProposalModeling(id)
|
||||
| Self::FrontierVerdictModeling(id)
|
||||
| Self::FrontierResearch(id)
|
||||
| Self::FrontierVerification(id)
|
||||
| Self::ImaginationConsideration(id)
|
||||
| Self::AdmittedModelDirection(id) => id,
|
||||
}
|
||||
|
|
@ -79,6 +81,7 @@ impl<'a> RuntimeTypedRequestRef<'a> {
|
|||
Self::ProposalModeling(_) => "proposal-modeling",
|
||||
Self::FrontierVerdictModeling(_) => "frontier-verdict-modeling",
|
||||
Self::FrontierResearch(_) => "frontier-research",
|
||||
Self::FrontierVerification(_) => "frontier-verification",
|
||||
Self::ImaginationConsideration(_) => "imagination-consideration",
|
||||
Self::AdmittedModelDirection(_) => "admitted-model-direction",
|
||||
}
|
||||
|
|
@ -95,6 +98,9 @@ impl<'a> RuntimeTypedRequestRef<'a> {
|
|||
Self::FrontierResearch(id) => {
|
||||
launch.repo_frontier_research_request_id.as_deref() == Some(id)
|
||||
}
|
||||
Self::FrontierVerification(id) => {
|
||||
launch.repo_frontier_verification_request_id.as_deref() == Some(id)
|
||||
}
|
||||
Self::ImaginationConsideration(id) => {
|
||||
launch.imagination_consideration_request_id.as_deref() == Some(id)
|
||||
}
|
||||
|
|
@ -118,6 +124,7 @@ impl<'a> RuntimeTypedRequestRef<'a> {
|
|||
Self::FrontierResearch(id) => {
|
||||
result.repo_frontier_research_request_id.as_deref() == Some(id)
|
||||
}
|
||||
Self::FrontierVerification(id) => result.verification_request_id.as_deref() == Some(id),
|
||||
Self::ImaginationConsideration(id) => {
|
||||
result.imagination_consideration_request_id.as_deref() == Some(id)
|
||||
}
|
||||
|
|
@ -143,6 +150,9 @@ impl crate::EpiphanyRuntimeWorkerLaunchRequest {
|
|||
self.repo_frontier_research_request_id
|
||||
.as_deref()
|
||||
.map(RuntimeTypedRequestRef::FrontierResearch),
|
||||
self.repo_frontier_verification_request_id
|
||||
.as_deref()
|
||||
.map(RuntimeTypedRequestRef::FrontierVerification),
|
||||
self.imagination_consideration_request_id
|
||||
.as_deref()
|
||||
.map(RuntimeTypedRequestRef::ImaginationConsideration),
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ pub const SOUL_VERIFICATION_REQUEST_SCHEMA_VERSION: &str = "epiphany.soul.verifi
|
|||
pub const REPO_FRONTIER_VERIFICATION_REQUEST_TYPE: &str =
|
||||
"epiphany.soul.repo_frontier_verification_request";
|
||||
pub const REPO_FRONTIER_VERIFICATION_REQUEST_SCHEMA_VERSION: &str =
|
||||
"epiphany.soul.repo_frontier_verification_request.v1";
|
||||
"epiphany.soul.repo_frontier_verification_request.v2";
|
||||
pub const REPO_FRONTIER_VERIFICATION_REQUEST_CONTRACT: &str =
|
||||
"epiphany.repo_frontier_verification_request.v1";
|
||||
"epiphany.repo_frontier_verification_request.v2";
|
||||
pub const SOUL_INVARIANT_CHECK_SCHEMA_VERSION: &str = "epiphany.soul.invariant_check.v0";
|
||||
pub const SOUL_VERDICT_RECEIPT_SCHEMA_VERSION: &str = "epiphany.soul.verdict_receipt.v1";
|
||||
pub const SOUL_REGRESSION_RECEIPT_SCHEMA_VERSION: &str = "epiphany.soul.regression_receipt.v0";
|
||||
|
|
@ -87,6 +87,8 @@ pub struct RepoFrontierVerificationRequest {
|
|||
pub requested_at: String,
|
||||
#[cultcache(key = 13)]
|
||||
pub contract: String,
|
||||
#[cultcache(key = 14)]
|
||||
pub frontier_authority_documents: Vec<crate::EpiphanyMindDocumentVersion>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
|
|
|||
|
|
@ -300,6 +300,7 @@ mod tests {
|
|||
frontier_verdict_modeling_context: None,
|
||||
frontier_planning_context: None,
|
||||
frontier_research_context: None,
|
||||
frontier_verification_context: None,
|
||||
frontier_plan_mind_context: None,
|
||||
imagination_consideration_context: None,
|
||||
admitted_model_direction_consideration_context: None,
|
||||
|
|
@ -332,6 +333,7 @@ mod tests {
|
|||
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,
|
||||
};
|
||||
let grant = substrate_gate_repo_access_grant_for_launch(
|
||||
"grant-1".to_string(),
|
||||
|
|
|
|||
|
|
@ -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!(
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue