Separate Soul verification from repo closure

This commit is contained in:
Meta Vens 2026-07-12 10:44:06 +01:00
commit 88f5dce697
7 changed files with 161 additions and 32 deletions

View file

@ -148,8 +148,8 @@ fn run_smoke(args: Args) -> Result<Value> {
],
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<Value> {
"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"],

View file

@ -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<Value> {
}))
}
fn run_verify(args: CloseArgs) -> Result<Value> {
run_closure_pipeline(args, ClosurePhase::SoulOnly)
}
fn run_close(args: CloseArgs) -> Result<Value> {
run_closure_pipeline(args, ClosurePhase::Full)
}
fn run_closure_pipeline(args: CloseArgs, phase: ClosurePhase) -> Result<Value> {
let workspace = args
.workspace
.canonicalize()
@ -11275,7 +11290,7 @@ fn run_close(args: CloseArgs) -> Result<Value> {
"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<Value> {
"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<Value> {
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<Value> {
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<Value> {
"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<Value> {
}
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<Value> {
} 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<Value> {
"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()));
}

View file

@ -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,

View file

@ -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.

View file

@ -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-<item>.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

Binary file not shown.

View file

@ -659,4 +659,4 @@ current_status:
- Service lifecycle receipt history is now event-only: `load_epiphany_cultmesh_daemon_service_lifecycle_receipts` filters out the `epiphany-local/daemon-service-lifecycle-receipt/latest` mirror, while `load_latest_epiphany_cultmesh_daemon_service_lifecycle_receipt` remains the latest-state reader. Focused unit test `service_lifecycle_receipt_history_excludes_latest_mirror` proves two per-receipt writes return exactly two history records and latest points at the second. Fresh smoke `verse-query-lifecycle-history-filter-smoke` and live overview/triage `local-20260618-145632-497-efac6f0d` / `local-20260618-145632-321-867947af` prove compact swarm sights still expose service lifecycle attention plus the present elevated runbook artifact without daemon pokes or service mutation. Do not use a broad unscoped cargo test filter for this check on Windows; it fans out across bin harnesses and hit a broken pipe during this pass.
- `epiphany-verse-query seed-compact` is the compact seed receipt for wrappers and read-only rites. The older `seed` command still prints the full local Verse context for explicit debugging, but compact wrapper modes now avoid full `seed`/final `query` readback after the combined overview proof exposed Windows debug stack overflow from full-context serialization pressure.
last_completed_repo_swarm_cut: Huginn live-fire has crossed the first real repo Body from Persona pressure to branch-local Hands commit and Soul/Mind closure, and now has repeatable closure and redacted-public-proof mouths. On `E:\Projects\Huginn` branch `epiphany/huginn/first-awakening`, `tools/epiphany_local_run.ps1 -Mode repo-persona-intake` accepted item `huginn-inspection-readback-livefire`, Weksa/Persona intake remained sealed, and `epiphany-work derive-plan` lowered it to model-authored safe family `repo.status_section` for `README.md` only. `tools/epiphany_local_run.ps1 -Mode repo-swarm-run` advanced four bounded pulses: run-from-plan, adopt-from-plan, execute-from-plan, and close-from-execute. Huginn commit `e9b07c38fceabbdc89ea35c2156326c80c0393a2` updated only `README.md`; closure receipt `.epiphany\work\work-close-huginn-inspection-readback-livefire.json` records status `closed`, Soul verdict `passed`, Mind state commit `repo-work-close-huginn-inspection-readback-livefire-mind-commit`, safe family `repo.status_section`, path scope `README.md`, Bifrost publication gate, and `privateStateExposed=false`. Verification also ran Huginn's TypeScript compiler through concrete Node path: `C:\Program Files\nodejs\node.exe E:\Projects\Huginn\node_modules\typescript\bin\tsc -p tsconfig.json` passed. Native verifier `epiphany-repo-livefire-closure-smoke --workspace E:\Projects\Huginn --item huginn-inspection-readback-livefire --expected-path README.md --expected-family repo.status_section --expected-gate awaiting-publication --expected-blocker bifrost-publication-missing` checks closure receipt, Mind map entry, overview gate/blocker, authority seals, and `git show` changed paths, returning `status=ok`, `soulVerdict=passed`, `publicationGate=Bifrost`, and `privateStateExposed=false`. Wrapper `tools/epiphany_local_run.ps1 -Mode repo-livefire-closure -Workspace E:\Projects\Huginn -RepoWorkItem huginn-inspection-readback-livefire -SkipBuild` exposes the same read-only proof through the local operator mouth; artifact `local-20260621-190156-803-2f85ba15` printed commit, path, gate, blocker, Soul verdict, Mind commit receipt, and `privateStateExposed=False` without push, merge, publication, or target mutation. New wrapper `tools/epiphany_local_run.ps1 -Mode repo-work-public-proof -Workspace E:\Projects\Huginn -RepoWorkItem huginn-inspection-readback-livefire -SkipBuild` exports the redacted proof bundle and repo-local Verse index without publishing; artifact `local-20260621-190645-345-4555b1dc` wrote `.epiphany\public\proof-bundles\repo-work-public-proof-huginn-inspection-readback-livefire.json`, proof id `repo-work-public-proof-huginn-inspection-readback-livefire`, SHA-256 `857545b199f3e37eb06c2e757e5cfc201958e46667bb1f8403fd333a22620f63`, nine artifact rows, zero publication rows, and `privateStateExposed=False`. Gjallar readback `local-20260621-190701-140-b9519ec6` sees the `REPO-WORK-PUBLIC-PROOF` row and action row from Huginn's repo-local Verse with the same SHA-256 while Bifrost publication remains missing. Launcher compact modes are now named compact operator-context modes instead of read-only modes, and `bifrost-public-proof` summaries print item, target public Verse, room, proof SHA-256, review receipts, and credit receipts so publication receipts are auditable without claiming upstream sync.
next_action: Split Soul verification from repo-work close so the scheduler can emit the new immutable `epiphany.modeling.repo_work_request.v0`, route it through the Modeling daemon, await the matching typed finding, and then invoke existing immutable Mind/map admission. Prove a fresh repo advances from `await-modeling` to the Bifrost gate while Self remains structurally unable to author the finding.
next_action: Route the persisted immutable `epiphany.modeling.repo_work_request.v0` through the real Modeling worker/daemon, consume its matching typed finding, and invoke existing immutable Mind/map admission. Soul verification is now a separate scheduler phase. Prove a fresh repo advances from `awaiting-modeling` to the Bifrost gate while Self remains structurally unable to author the finding.