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 62c917fd..ca830b37 100644 --- a/epiphany-core/src/bin/epiphany-repo-closure-model-smoke.rs +++ b/epiphany-core/src/bin/epiphany-repo-closure-model-smoke.rs @@ -272,7 +272,6 @@ fn drive_item( "--closure-model-ref", "closure-model-gate-smoke-soul-v1", "--model-authored", - "--require-closure-model-verdict", "--closure-model-verdict", model_verdict, "--closure-model-finding", diff --git a/epiphany-core/src/bin/epiphany-work.rs b/epiphany-core/src/bin/epiphany-work.rs index 38773e26..3676d4c9 100644 --- a/epiphany-core/src/bin/epiphany-work.rs +++ b/epiphany-core/src/bin/epiphany-work.rs @@ -311,7 +311,6 @@ struct CloseArgs { closure_model_ref: Option, closure_model_verdict: Option, closure_model_finding: Option, - require_closure_model_verdict: bool, require_source_grounding: bool, model_authored: bool, state_revision: u64, @@ -916,7 +915,6 @@ fn parse_close_args(args: impl Iterator) -> Result { let mut closure_model_ref = None; let mut closure_model_verdict = None; let mut closure_model_finding = None; - let mut require_closure_model_verdict = false; let mut require_source_grounding = false; let mut model_authored = false; let mut state_revision = 0_u64; @@ -949,9 +947,6 @@ fn parse_close_args(args: impl Iterator) -> Result { "--closure-model-finding" | "--model-finding" => { closure_model_finding = Some(take_string(&mut args, "--closure-model-finding")?); } - "--require-closure-model-verdict" | "--require-model-verdict" => { - require_closure_model_verdict = true; - } "--require-source-grounding" => require_source_grounding = true, "--model-authored" => model_authored = true, "--state-revision" => state_revision = take_u64(&mut args, "--state-revision")?, @@ -970,7 +965,6 @@ fn parse_close_args(args: impl Iterator) -> Result { closure_model_ref, closure_model_verdict, closure_model_finding, - require_closure_model_verdict, require_source_grounding, model_authored, state_revision, @@ -10064,7 +10058,6 @@ fn closure_model_review( model_ref: Option<&str>, verdict: Option<&str>, finding: Option<&str>, - required: bool, ) -> Result<(Value, bool)> { let normalized_verdict = verdict .map(|value| value.trim().to_ascii_lowercase()) @@ -10080,20 +10073,22 @@ fn closure_model_review( } } - let gate_enforced = required || normalized_verdict.is_some(); + let has_typed_modeling_finding = model_authored + && model_ref.is_some_and(|value| !value.trim().is_empty()) + && finding.is_some_and(|value| !value.trim().is_empty()); + let gate_enforced = true; let passed = match normalized_verdict.as_deref() { - Some("passed") => true, + Some("passed") => has_typed_modeling_finding, Some("failed" | "needs-work" | "blocked") => false, Some(_) => unreachable!(), - None => !required, + None => false, }; let status = match normalized_verdict.as_deref() { - Some("passed") => "passed", + Some("passed") if has_typed_modeling_finding => "passed", + Some("passed") => "missing-modeling-finding", Some("failed" | "needs-work" | "blocked") => "failed", Some(_) => unreachable!(), - None if required => "missing-required-verdict", - None if model_authored || model_ref.is_some() => "provenance-only", - None => "deterministic-fallback", + None => "missing-required-verdict", }; let reason = match status { "passed" => "model-authored closure verdict passed", @@ -10101,8 +10096,10 @@ fn closure_model_review( "missing-required-verdict" => { "closure required a model-authored verdict but none was supplied" } - "provenance-only" => "model provenance was recorded without making it a hard closure gate", - _ => "deterministic closure checks are the active gate", + "missing-modeling-finding" => { + "a passing verdict lacked explicit model authorship, model reference, or finding" + } + _ => "model-authored Modeling finding refused closure", }; Ok(( @@ -10110,9 +10107,10 @@ fn closure_model_review( "schemaVersion": "epiphany.repo_work_model_closure_review.v0", "status": status, "passed": passed, - "required": required, + "required": true, "gateEnforced": gate_enforced, - "modelAuthored": model_authored || model_ref.is_some(), + "modelAuthored": model_authored, + "typedFindingPresent": has_typed_modeling_finding, "modelRef": model_ref, "verdict": normalized_verdict, "finding": finding.map(compact_line), @@ -11309,7 +11307,6 @@ fn run_close(args: CloseArgs) -> Result { args.closure_model_ref.as_deref(), args.closure_model_verdict.as_deref(), args.closure_model_finding.as_deref(), - args.require_closure_model_verdict, )?; let closure_review_id = format!("repo-work-close-{item_slug}-closure-review"); let closure_review_path = artifact_dir.join(format!("work-close-{item_slug}-review.json")); @@ -14417,45 +14414,12 @@ fn run_tick(args: TickArgs) -> Result { "Route Bifrost/GitHub publication through epiphany-work publish --closure-receipt." .to_string(); } else if execute_receipt_path.exists() { - if args.dry_run { - action = "close-from-execute".to_string(); - status = "would-advance".to_string(); - reason = - "branch-local execution receipt exists and Soul/Modeling/Mind closure is missing" - .to_string(); - next_safe_move = - "Rerun without --dry-run to close the executed branch-local work before publication." - .to_string(); - } else { - action = "close-from-execute".to_string(); - advanced_result = run_close(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: Some(format!( - "Scheduler pulse closed executed repo work item {item}." - )), - modeling_summary: Some(format!( - "Modeling records scheduler-closed repo work item {item}; publication remains gated by Bifrost." - )), - closure_model_ref: None, - closure_model_verdict: None, - closure_model_finding: None, - require_closure_model_verdict: false, - require_source_grounding: false, - model_authored: false, - state_revision: 0, - })?; - status = "advanced".to_string(); - reason = "closed executed branch-local work through Soul, Modeling, and Mind receipts" - .to_string(); - next_safe_move = - "Route Bifrost/GitHub publication through epiphany-work publish --closure-receipt." - .to_string(); - } + action = "await-modeling".to_string(); + status = "blocked".to_string(); + reason = "executed work requires an explicit model-authored Modeling finding before Mind admission" + .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." + .to_string(); } else if adopt_receipt_path.exists() { if !plan_receipt_path.exists() { status = "blocked".to_string(); @@ -16189,6 +16153,47 @@ fn default_if_empty(values: Vec, defaults: Vec) -> Vec { if values.is_empty() { defaults } else { values } } +#[cfg(test)] +mod authority_tests { + use super::*; + + #[test] + fn modeling_finding_is_mandatory_for_closure_admission() -> Result<()> { + let (_, missing) = closure_model_review(false, None, None, None)?; + assert!(!missing); + + let (counterfeit, passed) = + closure_model_review(true, Some("modeling-job-1"), Some("passed"), None)?; + assert!(!passed); + assert_eq!(counterfeit["status"], "missing-modeling-finding"); + + let (review, passed) = closure_model_review( + true, + Some("modeling-job-1"), + Some("passed"), + Some("Modeling grounded the map update in Soul-verified consequence."), + )?; + assert!(passed); + assert_eq!(review["status"], "passed"); + assert_eq!(review["typedFindingPresent"], true); + Ok(()) + } + + #[test] + fn scheduler_cannot_impersonate_modeling_or_mind() { + let source = include_str!("epiphany-work.rs"); + let tick_start = source.find("fn run_tick").expect("run_tick"); + let tick_end = source[tick_start..] + .find("fn run_queue") + .map(|offset| tick_start + offset) + .unwrap_or(source.len()); + let tick = &source[tick_start..tick_end]; + assert!(!tick.contains("run_close(CloseArgs")); + assert!(tick.contains("await-modeling")); + assert!(tick.contains("explicit model-authored Modeling finding")); + } +} + fn adopted_action_item_from_plan(plan: &Value) -> Value { let action_item = plan .get("derivation") @@ -16425,7 +16430,7 @@ fn print_usage() { run --workspace [--item ] [--accept-receipt ] [--runtime-store ] [--requested-path ]\n\ adopt --workspace [--item ] [--run-receipt ] [--from-plan ] [--plan-summary ] [--adoption-evidence-ref ] [--mind-adoption-rationale ]\n\ execute --workspace [--item ] [--from-plan ] [--command ] [--changed-path ] [--commit-message ]\n\ - close --workspace [--item ] [--execute-receipt ] [--verification-command ] [--closure-model-ref ] [--model-authored] [--closure-model-verdict passed|failed|needs-work|blocked] [--closure-model-finding ] [--require-closure-model-verdict] [--require-source-grounding]\n\ + close --workspace [--item ] [--execute-receipt ] [--verification-command ] --closure-model-ref --model-authored --closure-model-verdict passed|failed|needs-work|blocked --closure-model-finding [--require-source-grounding]\n\ publish --workspace [--item ] --change-summary --justification --verification-receipt --review-receipt --ledger-entry-id --pull-request-url --pull-request-title \n\ sync --workspace [--item ] [--publish-receipt ] [--upstream-ref origin/main] --merge-receipt \n\ overview --workspace [--item ] [--accept-receipt ] [--no-write]\n\ diff --git a/notes/epiphany-current-algorithmic-map.md b/notes/epiphany-current-algorithmic-map.md index f46c8847..52683d78 100644 --- a/notes/epiphany-current-algorithmic-map.md +++ b/notes/epiphany-current-algorithmic-map.md @@ -103,6 +103,12 @@ plurality no longer pretends to be an authority boundary. 7. `coordinator_acceptance.rs` commits an admitted proposal with its Mind review/commit witnesses before Self routes another Hands turn. +The repo-work scheduler obeys the same order. After a branch-local execute +receipt it stops at `await-modeling`; it cannot invoke closure or manufacture +Modeling/Mind evidence. `epiphany-work close` requires explicit model +authorship, model reference, verdict, and finding before it can admit a map. +Deterministic checks remain Soul evidence, not a substitute for Modeling. + Manual edits and programmatic actions converge at the same receipt and Mind admission boundaries. A later action cannot retroactively make an unrecorded consequence valid. diff --git a/notes/epiphany-fork-implementation-plan.md b/notes/epiphany-fork-implementation-plan.md index f554e0e4..fca1dd7a 100644 --- a/notes/epiphany-fork-implementation-plan.md +++ b/notes/epiphany-fork-implementation-plan.md @@ -114,6 +114,12 @@ Exit evidence: ### 3. Close The Organ Loop +Status: active. The scheduler can no longer impersonate Modeling/Mind after +Hands execution, and closure refuses deterministic fallback or a passing +verdict without an explicit model-authored finding. The remaining cut is to +persist that Modeling finding as its own typed runtime document and make Mind +admission consume it rather than accepting CLI fields directly. + - Prove Hands → Soul → Modeling → Mind → Self on a fresh repository without supervisor implementation or direct worker-thought inspection. - Ensure every consequence has Substrate Gate scope, Hands receipts, Soul diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 6123fe45..8c3d641d 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -2000,6 +2000,17 @@ flags. The actual status executable ran successfully against `state/runtime-spine.msgpack`. Next audit current proof of the full Hands -> Soul -> Modeling -> Mind -> Self loop instead of trusting historical victory prose. +That audit found `epiphany-work tick` directly invoking closure and thereby +playing Soul, Modeling, and Mind after Hands execution. The scheduler path is +now cut: it stops at `await-modeling`. Closure always requires explicit model +authorship, model reference, verdict, and finding; deterministic fallback and +provenance-only admission are gone. Negative unit tests prove a passing verdict +without a finding is refused and the scheduler contains no closure call. The +detached disposable-repo smoke under +`.epiphany-smoke/closure-model-current/stdout.json` passed both explicit +Modeling admission and Modeling refusal paths. Next persist the Modeling +finding as a first-class typed runtime document so Mind consumes a receipt, not +CLI-shaped evidence. ## Immediate Re-entry Instruction diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index dc370d25..e9e21b33 100644 Binary files a/state/ledgers.msgpack and b/state/ledgers.msgpack differ diff --git a/state/map.yaml b/state/map.yaml index 47f617ff..f1939e04 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -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: Audit the live Hands -> Soul -> Modeling -> Mind -> Self loop against its fresh-repository exit evidence. Verify each required receipt, admission, and negative-bypass proof from current artifacts/source, then close the first missing proof without adding route or summary authority. + next_action: Separate repo-work Modeling evidence from closure orchestration. Persist the explicit model-authored closure finding as a typed runtime document, make Mind/map admission consume that document, and prove CLI fields or scheduler code cannot fabricate or bypass it.