From 88f5dce6971f4dea1b5746f0ed7ff868989eaad9 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 12 Jul 2026 10:44:06 +0100 Subject: [PATCH] Separate Soul verification from repo closure --- .../bin/epiphany-repo-closure-model-smoke.rs | 5 +- epiphany-core/src/bin/epiphany-work.rs | 151 +++++++++++++++--- notes/epiphany-current-algorithmic-map.md | 9 ++ notes/epiphany-fork-implementation-plan.md | 12 +- notes/fresh-workspace-handoff.md | 14 ++ state/ledgers.msgpack | Bin 419371 -> 419829 bytes state/map.yaml | 2 +- 7 files changed, 161 insertions(+), 32 deletions(-) diff --git a/epiphany-core/src/bin/epiphany-repo-closure-model-smoke.rs b/epiphany-core/src/bin/epiphany-repo-closure-model-smoke.rs index ca830b37..22e95d22 100644 --- a/epiphany-core/src/bin/epiphany-repo-closure-model-smoke.rs +++ b/epiphany-core/src/bin/epiphany-repo-closure-model-smoke.rs @@ -148,8 +148,8 @@ fn run_smoke(args: Args) -> Result { ], true, )?; - require_eq(&bad.close, &["status"], "verification-failed")?; - require_eq(&bad.close, &["soul", "verdict"], "failed")?; + require_eq(&bad.close, &["status"], "awaiting-modeling")?; + require_eq(&bad.close, &["soul", "verdict"], "passed")?; require_eq( &bad.close, &["closureReview", "modelingReview", "closureReview", "status"], @@ -186,6 +186,7 @@ fn run_smoke(args: Args) -> Result { "blockItem": bad.item, "blockCloseStatus": bad.close["status"], "blockSoulVerdict": bad.close["soul"]["verdict"], + "blockModelingRequestId": bad.close["modeling"]["requestId"], "blockModelStatus": bad.close["closureReview"]["modelingReview"]["closureReview"]["status"], "blockFamilyAssertionsStatus": bad.close["closureReview"]["familyAssertions"]["status"], "blockPathScopeMatched": bad.close["closureReview"]["sourceGrounding"]["pathScopeMatched"], diff --git a/epiphany-core/src/bin/epiphany-work.rs b/epiphany-core/src/bin/epiphany-work.rs index 401df864..1ab5ab9d 100644 --- a/epiphany-core/src/bin/epiphany-work.rs +++ b/epiphany-core/src/bin/epiphany-work.rs @@ -117,6 +117,7 @@ fn main() -> Result<()> { "run" => run_work(parse_run_args(args)?), "adopt" | "promote" => run_adopt(parse_adopt_args(args)?), "execute" | "exec" => run_execute(parse_execute_args(args)?), + "verify" | "soul-verify" => run_verify(parse_close_args(args)?), "close" | "closure" | "verify-close" => run_close(parse_close_args(args)?), "publish" => run_publish(parse_publish_args(args)?), "sync" | "sync-main" => run_sync(parse_sync_args(args)?), @@ -290,6 +291,12 @@ struct CloseArgs { state_revision: u64, } +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +enum ClosurePhase { + SoulOnly, + Full, +} + #[derive(Clone, Debug)] struct PublishArgs { workspace: PathBuf, @@ -11151,7 +11158,15 @@ fn run_execute(args: ExecuteArgs) -> Result { })) } +fn run_verify(args: CloseArgs) -> Result { + run_closure_pipeline(args, ClosurePhase::SoulOnly) +} + fn run_close(args: CloseArgs) -> Result { + run_closure_pipeline(args, ClosurePhase::Full) +} + +fn run_closure_pipeline(args: CloseArgs, phase: ClosurePhase) -> Result { let workspace = args .workspace .canonicalize() @@ -11275,7 +11290,7 @@ fn run_close(args: CloseArgs) -> Result { "workspace": workspace, "receiptId": closure_review_id, "item": item, - "owner": "Soul+Modeling", + "owner": "Soul", "stateGate": "Mind", "executeReceiptPath": execute_receipt_path, "runtimeStore": runtime_store, @@ -11327,15 +11342,14 @@ fn run_close(args: CloseArgs) -> Result { "nextSafeMove": "Soul may pass closure only when verification succeeds, actual git changed paths match the Hands-declared path scope, the accepted Mind adoption proof is present, safe-family assertions pass for known Imagination families, and any supplied or required model-authored closure verdict passes." }); write_json(&closure_review_path, &closure_review)?; - let verification_passed = verification.status.success() + let soul_verification_passed = verification.status.success() && path_scope_matched && verification_source_grounded && mind_adoption_passed - && family_assertions_passed - && model_closure_passed; + && family_assertions_passed; let soul_verdict_id = format!("repo-work-close-{item_slug}-soul-verdict"); let soul_summary = args.verification_summary.unwrap_or_else(|| { - if verification_passed { + if soul_verification_passed { format!("Soul verified branch-local commit {commit_sha} for repo work item {item}.") } else if !path_scope_matched { format!( @@ -11353,10 +11367,6 @@ fn run_close(args: CloseArgs) -> Result { format!( "Soul verification failed for branch-local commit {commit_sha}: safe-family assertions did not pass." ) - } else if !model_closure_passed { - format!( - "Soul verification failed for branch-local commit {commit_sha}: model-authored closure review did not pass." - ) } else { format!("Soul verification failed for branch-local commit {commit_sha}.") } @@ -11375,14 +11385,14 @@ fn run_close(args: CloseArgs) -> Result { receipt_id: soul_verdict_id.clone(), source_result_id: format!("repo-work-execute-{item_slug}"), source_job_id: format!("repo-work-close-{item_slug}"), - verdict: if verification_passed { + verdict: if soul_verification_passed { "passed".to_string() } else { "failed".to_string() }, summary: soul_summary.clone(), evidence_ids: evidence_ids.clone(), - risks: if verification_passed { + risks: if soul_verification_passed { Vec::new() } else if !path_scope_matched { vec![ @@ -11404,11 +11414,6 @@ fn run_close(args: CloseArgs) -> Result { "Closure refused because the committed content did not satisfy known safe-family assertions." .to_string(), ] - } else if !model_closure_passed { - vec![ - "Closure refused because the model-authored closure review was missing or non-passing." - .to_string(), - ] } else { vec!["Closure verification command failed; publication remains blocked.".to_string()] }, @@ -11430,7 +11435,7 @@ fn run_close(args: CloseArgs) -> Result { } let closure_receipt_path = artifact_dir.join(format!("work-close-{item_slug}.json")); - if !verification_passed { + if !soul_verification_passed { let failed_receipt = json!({ "schemaVersion": "epiphany.repo_work_closure_receipt.v0", "createdAt": now, @@ -11506,6 +11511,42 @@ fn run_close(args: CloseArgs) -> Result { } else { put_repo_work_modeling_request(&runtime_store, &modeling_request)?; } + if phase == ClosurePhase::SoulOnly || !model_closure_passed { + let awaiting_receipt = json!({ + "schemaVersion": "epiphany.repo_work_closure_receipt.v0", + "createdAt": now, + "workspace": workspace, + "runtimeStore": runtime_store, + "executeReceiptPath": execute_receipt_path, + "item": item, + "status": "awaiting-modeling", + "soul": { + "verdictReceiptId": soul_verdict.receipt_id, + "verdict": soul_verdict.verdict, + "summary": soul_verdict.summary, + "closureReviewReceiptId": closure_review_id, + "closureReviewPath": normalize_path_for_receipt(&closure_review_path) + }, + "closureReview": closure_review, + "modeling": { + "requestId": modeling_request.request_id, + "requester": modeling_request.requester, + "findingReceiptId": Value::Null + }, + "authority": { + "owner": "Self", + "routedSoulResult": true, + "authoredModelingFinding": false, + "publicationGateSatisfied": false, + "durableStateAdmitted": false, + "privateStateExposed": false + }, + "privateStateExposed": false, + "nextSafeMove": "Route the typed request to Modeling and resume closure only with its matching finding." + }); + write_json(&closure_receipt_path, &awaiting_receipt)?; + return Ok(awaiting_receipt); + } let modeling_finding_receipt_id = format!("repo-work-close-{item_slug}-modeling-finding"); let mut modeling_finding = RepoWorkModelingFinding { schema_version: REPO_WORK_MODELING_FINDING_SCHEMA_VERSION.to_string(), @@ -14457,20 +14498,61 @@ fn run_tick(args: TickArgs) -> Result { "publication receipt exists; scheduler stops before merge/sync authority".to_string(); next_safe_move = "Wait for maintainer/Bifrost merge receipt, then run epiphany-work sync.".to_string(); - } else if close_receipt_path.exists() { + } else if close_receipt_path.exists() + && read_json(&close_receipt_path)? + .get("status") + .and_then(Value::as_str) + == Some("closed") + { action = "none".to_string(); status = "noop".to_string(); reason = "Soul/Modeling/Mind closure is recorded; scheduler stops before Bifrost publication authority".to_string(); next_safe_move = "Route Bifrost/GitHub publication through epiphany-work publish --closure-receipt." .to_string(); - } else if execute_receipt_path.exists() { + } else if close_receipt_path.exists() { action = "await-modeling".to_string(); status = "blocked".to_string(); - reason = "executed work requires an explicit model-authored Modeling finding before Mind admission" + reason = "Soul passed and Self routed a typed Modeling request; no matching Modeling finding is admitted" .to_string(); - next_safe_move = "Run epiphany-work close with --model-authored, --closure-model-ref, --closure-model-verdict, and --closure-model-finding after Modeling reviews the Soul evidence." + next_safe_move = "Route the persisted Modeling request to the Modeling daemon, then resume epiphany-work close with its typed result." .to_string(); + } else if execute_receipt_path.exists() { + action = "soul-verify".to_string(); + if args.dry_run { + status = "would-advance".to_string(); + reason = "executed work is ready for Soul verification".to_string(); + next_safe_move = "Rerun without --dry-run to verify the Hands consequence and emit the typed Modeling request." + .to_string(); + } else { + advanced_result = run_verify(CloseArgs { + workspace: workspace.clone(), + item: Some(item.clone()), + execute_receipt: Some(execute_receipt_path.clone()), + runtime_store: args.runtime_store.clone(), + artifact_dir: Some(artifact_dir.clone()), + verification_command: None, + verification_summary: None, + modeling_summary: None, + closure_model_ref: None, + closure_model_verdict: None, + closure_model_finding: None, + require_source_grounding: false, + model_authored: false, + state_revision: 0, + })?; + status = advanced_result + .get("status") + .and_then(Value::as_str) + .unwrap_or("awaiting-modeling") + .to_string(); + reason = + "Soul verified the Hands consequence and Self routed the typed Modeling request" + .to_string(); + next_safe_move = + "Let the next scheduler pulse await or collect the matching Modeling finding." + .to_string(); + } } else if adopt_receipt_path.exists() { if !plan_receipt_path.exists() { status = "blocked".to_string(); @@ -15650,12 +15732,32 @@ fn repo_work_overview_gate( "merge-or-sync-receipt-missing", "After maintainer/Bifrost merge, run epiphany-work sync.", ) - } else if close.is_some() { + } else if close + .and_then(|receipt| receipt.get("status")) + .and_then(Value::as_str) + == Some("closed") + { ( "awaiting-publication", "bifrost-publication-missing", "Run epiphany-work publish --closure-receipt when publication is authorized.", ) + } else if close + .and_then(|receipt| receipt.get("status")) + .and_then(Value::as_str) + == Some("awaiting-modeling") + { + ( + "awaiting-modeling", + "modeling-finding-missing", + "Route the typed Modeling request and resume closure with its matching finding.", + ) + } else if close.is_some() { + ( + "verification-refused", + "soul-verdict-not-passed", + "Repair the Hands consequence or verification evidence before retrying Soul.", + ) } else if execute.is_some() { ( "awaiting-closure", @@ -16240,8 +16342,11 @@ mod authority_tests { .unwrap_or(source.len()); let tick = &source[tick_start..tick_end]; assert!(!tick.contains("run_close(CloseArgs")); + assert!(tick.contains("run_verify(CloseArgs")); assert!(tick.contains("await-modeling")); - assert!(tick.contains("explicit model-authored Modeling finding")); + assert!(tick.contains("typed Modeling request")); + assert!(!tick.contains("put_repo_work_modeling_finding")); + assert!(!tick.contains("commit_repo_work_map_admission")); assert!(!source.contains(&["RepoWork", "MapStore"].concat())); assert!(!source.contains(&["repo-work-map", ".msgpack"].concat())); } diff --git a/notes/epiphany-current-algorithmic-map.md b/notes/epiphany-current-algorithmic-map.md index 7d2830ac..83f8f32e 100644 --- a/notes/epiphany-current-algorithmic-map.md +++ b/notes/epiphany-current-algorithmic-map.md @@ -117,6 +117,15 @@ request and matches its verified consequence. The current close command writes both phase documents from explicit CLI cargo; scheduler launch and asynchronous result collection remain the next cut. +Soul verification is now an explicit phase of the shared closure pipeline. +`epiphany-work verify` and the first post-execution scheduler pulse run only +that phase: deterministic verification, immutable Soul verdict, and immutable +Self-to-Modeling request. Modeling absence or a non-passing Modeling verdict can +no longer make Soul report failure. The partial closure artifact is +`status=awaiting-modeling`; overview and later scheduler pulses preserve that +gate rather than mistaking file existence for Mind admission. The scheduler +source contains neither the Modeling finding writer nor map admission. + The accepted interpretation is persisted as `epiphany.modeling.repo_work_finding.v0`; it references the passing Soul verdict, diff --git a/notes/epiphany-fork-implementation-plan.md b/notes/epiphany-fork-implementation-plan.md index ed520350..207e577c 100644 --- a/notes/epiphany-fork-implementation-plan.md +++ b/notes/epiphany-fork-implementation-plan.md @@ -204,9 +204,9 @@ Delete or demote: ## Immediate Next Action -Split Soul verification from repo-work closure. Let Self emit the existing -typed, immutable `epiphany.modeling.repo_work_request.v0`, route it to the -Modeling daemon, and await the matching finding before the existing Mind/map -admission runs. Prove the fresh-repository path reaches Bifrost while Self -cannot synthesize Modeling evidence. The request/finding persistence boundary -and unsolicited-finding refusal already exist; do not add a parallel route. +Route the persisted `epiphany.modeling.repo_work_request.v0` through the real +Modeling worker/daemon and consume its matching typed finding before existing +Mind/map admission. Soul verification is already a separate scheduler phase; +do not rejoin it to Modeling or introduce CLI cargo as scheduler truth. Prove a +fresh-repository scheduler timeline reaches Bifrost while Self cannot author +Modeling evidence. diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 82003a96..7f080c05 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -2047,6 +2047,20 @@ tests prove unsolicited findings are refused; all 248 library tests pass. The close command still creates both documents from explicit CLI cargo, so the next cut is to split Soul verification from close and let the scheduler route this request through the Modeling daemon before immutable closure admission. +Soul is now structurally separated from that later admission. The shared +closure pipeline has a `SoulOnly` phase exposed as `epiphany-work verify`; the +first scheduler pulse after Hands execution runs it, persists a passing or +failing Soul verdict, emits the typed Modeling request only after a pass, and +stops. Modeling is no longer part of Soul's pass/fail equation. A non-passing +Modeling verdict leaves `work-close-.json` at `awaiting-modeling` with +Soul still `passed`; overview reports the same gate instead of treating any +close-shaped artifact as publication-ready. Disposable smoke +`.epiphany-smoke/closure-model-gate-20260712-094208` proved a passing Modeling +result closes and a `needs-work` result remains at the Modeling gate with +family/path checks passed and no private-state exposure. Authority tests pass +3/3 and all 248 library tests pass. Next route the persisted request through a +real Modeling worker/daemon and consume its typed result without CLI-supplied +finding cargo. ## Immediate Re-entry Instruction diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 33a494334b7af3767efc27d1b9aba6a49d55cf60..83fa317fbad555aba9d5d696fa84d2689a90443c 100644 GIT binary patch delta 496 zcmZXQy-or_6op+-8Y``&(A>n91qA$q)|Lt?yJ7b(J7ITbm^%wnQCRo_qKU6yV`5=^ z0V@*|-@!-F+6#gf7AJEvlXK7c=Ki(#`Br?`@irUv=3(RfWvvjsKkj=&&-=KX<*sHq zk2OE@taaAL(=1oG3AV4FYt`D3Up@8@YTfE-vr)g@`pWN4?>cCN6%IqNXtY1pb^sln zB``uOBN+%MwSvg%6xuq(M5=zJEma6XqA9ajhOP_-p!67QrU=Bs?Q4}xz{G+OMC8x{ zUSN>Tca^}PB}tCJ#Zv^CrkNAH1b<^g88{Fe;Ut1)7;g631XH5|2nz5Mv=7L;2~Ft_)|AjHX4UB_vR)2M9(G zaiN}e@dBUcc};~F(&FbT|F*Hm#nb|kxma82Cg2!>pkArZy?cW+{UI>h9*(R7}!!dHY+n0GBQ4Cp32ldm5C9EK{PWEvj8#c_Nh#4 G(~