From 0eff8506ff0c636bd36096c7d7f910ba3c420272 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 7 Aug 2026 06:19:50 +0100 Subject: [PATCH] Route rejected Soul premises through Modeling --- .../src/bin/epiphany-mvp-coordinator.rs | 27 +++++++++++++-- .../src/coordinator_launch_context.rs | 11 +++++++ epiphany-core/src/surfaces/coordinator.rs | 33 +++++++++---------- 3 files changed, 51 insertions(+), 20 deletions(-) diff --git a/epiphany-core/src/bin/epiphany-mvp-coordinator.rs b/epiphany-core/src/bin/epiphany-mvp-coordinator.rs index a840bb11..964837f8 100644 --- a/epiphany-core/src/bin/epiphany-mvp-coordinator.rs +++ b/epiphany-core/src/bin/epiphany-mvp-coordinator.rs @@ -481,9 +481,19 @@ fn run_coordinator(args: &Args) -> Result { .get("coordinator") .cloned() .unwrap_or_else(|| json!({"action": "regatherManually"})); + let explicit_proposal_launchable = args + .proposal_modeling_request_id + .as_deref() + .is_some_and(|request_id| { + status["findingSignals"]["modelingResultAccepted"].as_bool() != Some(true) + || status["roleResults"]["modeling"]["finding"]["proposalModelingRequestId"] + .as_str() + != Some(request_id) + }); let action = apply_explicit_proposal_routing( &mut coordinator, args.proposal_modeling_request_id.as_deref(), + explicit_proposal_launchable, ); let snapshot_name = format!("step-{index:02}-{action}.txt"); @@ -1735,12 +1745,14 @@ fn now() -> String { fn apply_explicit_proposal_routing( coordinator: &mut Value, proposal_modeling_request_id: Option<&str>, + proposal_request_launchable: bool, ) -> String { let action = coordinator["action"] .as_str() .unwrap_or("regatherManually"); if action == "awaitFrontierProposal" && proposal_modeling_request_id.is_some_and(|value| !value.trim().is_empty()) + && proposal_request_launchable { coordinator["action"] = json!("launchModeling"); coordinator["targetRole"] = json!("modeling"); @@ -1883,7 +1895,8 @@ mod tests { assert_eq!( apply_explicit_proposal_routing( &mut coordinator, - Some("repo-frontier-proposal-modeling-request") + Some("repo-frontier-proposal-modeling-request"), + true, ), "launchModeling" ); @@ -1894,7 +1907,17 @@ mod tests { let mut idle = json!({"action": "awaitFrontierProposal"}); assert_eq!( - apply_explicit_proposal_routing(&mut idle, None), + apply_explicit_proposal_routing(&mut idle, None, false), + "awaitFrontierProposal" + ); + + let mut consumed = json!({"action": "awaitFrontierProposal"}); + assert_eq!( + apply_explicit_proposal_routing( + &mut consumed, + Some("repo-frontier-proposal-modeling-request"), + false, + ), "awaitFrontierProposal" ); } diff --git a/epiphany-core/src/coordinator_launch_context.rs b/epiphany-core/src/coordinator_launch_context.rs index bd8cc6a8..1bc3341e 100644 --- a/epiphany-core/src/coordinator_launch_context.rs +++ b/epiphany-core/src/coordinator_launch_context.rs @@ -328,7 +328,9 @@ pub fn append_verification_hands_receipt_context( 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", @@ -342,6 +344,9 @@ pub fn append_verification_hands_receipt_context( 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", ); @@ -628,13 +633,16 @@ fn work_loop_telemetry_from_hands_chain( "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(), ], soul_receipt_ids, summary: chain.summary.clone(), @@ -1640,6 +1648,9 @@ mod tests { assert!(context.contains("resolvedReceiptPayloadPreviews")); assert!(context.contains("test result: ok")); assert!(context.contains("sourcePathProof")); + assert!(context.contains("epiphany-core/src/coordinator_launch.rs")); + assert!(context.contains("epiphany-core/src/surfaces/coordinator.rs")); + assert!(context.contains("exact failure-review supersession receipt")); assert!(context.contains("verificationAssertions")); let telemetry = load_latest_epiphany_cultmesh_work_loop_telemetry( local_verse_store_path(&runtime_store), diff --git a/epiphany-core/src/surfaces/coordinator.rs b/epiphany-core/src/surfaces/coordinator.rs index 170934dc..49e0e2c0 100644 --- a/epiphany-core/src/surfaces/coordinator.rs +++ b/epiphany-core/src/surfaces/coordinator.rs @@ -1042,24 +1042,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_cites_implementation_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 failed against concrete implementation evidence from the current model; continue only the bounded repair step before re-verification.", - ); - } - if input.signals.verification_result_status == EpiphanyCoordinatorRoleResultStatus::Completed && input.verification_result_accepted && !input.verification_result_allows_implementation @@ -1959,6 +1941,21 @@ mod tests { EpiphanyCoordinatorAction::ContinueImplementation ); + let rejected_current_model = recommend_coordinator_action(EpiphanyCoordinatorInput { + signals: verification_done, + modeling_result_accepted: true, + modeling_result_reviewable: true, + verification_result_accepted: true, + verification_result_cites_implementation_evidence: true, + verification_result_covers_current_modeling: true, + hands_frontier_ready: true, + ..input() + }); + assert_eq!( + rejected_current_model.action, + EpiphanyCoordinatorAction::LaunchModeling + ); + let implementation_after_verification = recommend_coordinator_action(EpiphanyCoordinatorInput { signals: verification_done,