From d2538d464153fdbd9d302361c0e54fa95b7e06a1 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 8 Aug 2026 18:04:57 +0100 Subject: [PATCH] fix: bind Soul provenance to frontier plan decisions --- epiphany-core/src/bin/epiphany-mind-repair.rs | 29 +++++++++- epiphany-core/src/coordinator_launch.rs | 11 ++++ .../src/coordinator_launch_context.rs | 53 +++++++++++++++++- epiphany-core/src/lib.rs | 1 + epiphany-core/src/runtime_spine.rs | 28 ++++----- notes/epiphany-current-algorithmic-map.md | 26 +++++++++ notes/fresh-workspace-handoff.md | 25 ++++++++- state/ledgers.msgpack | Bin 574516 -> 574878 bytes state/map.yaml | 4 +- 9 files changed, 156 insertions(+), 21 deletions(-) diff --git a/epiphany-core/src/bin/epiphany-mind-repair.rs b/epiphany-core/src/bin/epiphany-mind-repair.rs index 2bedc167..38f0d9a6 100644 --- a/epiphany-core/src/bin/epiphany-mind-repair.rs +++ b/epiphany-core/src/bin/epiphany-mind-repair.rs @@ -1,7 +1,8 @@ use anyhow::{Result, anyhow}; use epiphany_core::{ RepoFrontierExecutionAmendment, RepoFrontierRoute, amend_repo_frontier_execution, - apply_supervisor_modeling_acceptance_correction, runtime_spine_cache, + apply_supervisor_modeling_acceptance_correction, read_coordinator_state, + runtime_repo_model_admission_receipt, runtime_repo_model_admission_review, runtime_spine_cache, }; use sha2::{Digest, Sha256}; use std::{collections::BTreeMap, env, path::PathBuf}; @@ -12,6 +13,7 @@ fn main() -> Result<()> { let command = args.next().ok_or_else(|| anyhow!(usage()))?; if command != "amend-frontier-execution" && command != "inspect-frontier-execution" + && command != "inspect-thread-acceptances" && command != "supersede-modeling-acceptance" { return Err(anyhow!("unknown command {command}\n{}", usage())); @@ -31,6 +33,21 @@ fn main() -> Result<()> { .ok_or_else(|| anyhow!("missing {name}")) }; let store = PathBuf::from(take("--store")?); + if command == "inspect-thread-acceptances" { + let thread_id = take("--thread-id")?; + let state = read_coordinator_state(&store)? + .ok_or_else(|| anyhow!("coordinator state is absent"))?; + println!( + "{}", + serde_json::to_string_pretty(&serde_json::json!({ + "threadId": thread_id, + "revision": state.revision, + "lastUpdatedTurnId": state.last_updated_turn_id, + "acceptanceReceipts": state.acceptance_receipts, + }))? + ); + return Ok(()); + } if command == "supersede-modeling-acceptance" { let receipt = apply_supervisor_modeling_acceptance_correction( &store, @@ -62,12 +79,20 @@ fn main() -> Result<()> { let plan = route .adopted_plan .ok_or_else(|| anyhow!("route {route_id} has no adopted plan"))?; + let admission = runtime_repo_model_admission_receipt(&store, &route.admission_receipt_id)? + .ok_or_else(|| anyhow!("route {route_id} admission receipt is absent"))?; + let review = runtime_repo_model_admission_review(&store, &admission.review_id)? + .ok_or_else(|| anyhow!("route {route_id} admission review is absent"))?; println!( "{}", serde_json::to_string_pretty(&serde_json::json!({ "routeId": route.route_id, "modelRevision": route.model_revision, "modelHash": route.model_hash, + "admissionReceiptId": route.admission_receipt_id, + "admissionResultId": admission.result_id, + "admissionReviewId": admission.review_id, + "admissionSource": review.admission_source, "frontierItemId": route.frontier_item_id, "frontierItemHash": route.frontier_item_hash, "originalAction": plan.action, @@ -118,5 +143,5 @@ fn main() -> Result<()> { } fn usage() -> &'static str { - "usage: epiphany-mind-repair inspect-frontier-execution --store PATH --route-id ID\n epiphany-mind-repair amend-frontier-execution --store PATH --route-id ID --source-actor-id ID --command-id ID --admission-id ID --packet-sha256 SHA256 --previous-action TEXT --previous-command TEXT --action TEXT --replacement-command TEXT --rationale TEXT --amended-at RFC3339\n epiphany-mind-repair supersede-modeling-acceptance --store PATH --thread-id ID --expected-revision N --receipt-id ID --result-id ID --source-actor-id ID --reason missing-typed-future-frontier --corrected-at RFC3339" + "usage: epiphany-mind-repair inspect-thread-acceptances --store PATH --thread-id ID\n epiphany-mind-repair inspect-frontier-execution --store PATH --route-id ID\n epiphany-mind-repair amend-frontier-execution --store PATH --route-id ID --source-actor-id ID --command-id ID --admission-id ID --packet-sha256 SHA256 --previous-action TEXT --previous-command TEXT --action TEXT --replacement-command TEXT --rationale TEXT --amended-at RFC3339\n epiphany-mind-repair supersede-modeling-acceptance --store PATH --thread-id ID --expected-revision N --receipt-id ID --result-id ID --source-actor-id ID --reason missing-typed-future-frontier --corrected-at RFC3339" } diff --git a/epiphany-core/src/coordinator_launch.rs b/epiphany-core/src/coordinator_launch.rs index cc6105cf..103a6d33 100644 --- a/epiphany-core/src/coordinator_launch.rs +++ b/epiphany-core/src/coordinator_launch.rs @@ -2542,6 +2542,17 @@ pub(crate) mod tests { .map_err(|error| anyhow!("replay frontier plan decision: {error}"))?; assert_eq!(retry, decision); assert!(!decision.model_admission_receipt_id.is_empty()); + let admission = crate::runtime_repo_model_admission_receipt( + &store, + &decision.model_admission_receipt_id, + )? + .expect("plan decision admission"); + assert_eq!( + admission.admission_source, + Some(crate::RepoModelAdmissionSource::FrontierPlanDecision { + decision_id: decision.decision_id.clone(), + }) + ); let current = runtime_current_repo_model(&store)?.expect("admitted Adopt model"); assert_eq!(current.model_revision, before.model_revision + 1); let item = current diff --git a/epiphany-core/src/coordinator_launch_context.rs b/epiphany-core/src/coordinator_launch_context.rs index 901b9d92..326f27b8 100644 --- a/epiphany-core/src/coordinator_launch_context.rs +++ b/epiphany-core/src/coordinator_launch_context.rs @@ -193,8 +193,43 @@ pub fn append_verification_hands_receipt_context( .map_err(|error| format!("failed to load Mind RepoModel admission review for Soul: {error}"))? .ok_or_else(|| "Soul frontier admission receipt has no persisted Mind review".to_string())?; let mut modeling_chain = None; + let mut plan_decision_chain = None; let mut execution_amendment = None; - if let Some(admission_result_id) = admission_receipt.result_id.as_deref() { + if !admission_receipt.frontier_plan_decision_id.is_empty() { + let decision = crate::runtime_repo_frontier_plan_decision( + runtime_store_path, + &admission_receipt.frontier_plan_decision_id, + ) + .map_err(|error| format!("failed to load Soul frontier plan decision: {error}"))? + .ok_or_else(|| "Soul frontier admission has no persisted plan decision".to_string())?; + let source_matches = match decision.decision_source.as_ref() { + Some(crate::RepoFrontierPlanDecisionSource::MindWorker { result_id, job_id }) => { + admission_receipt.result_id.as_deref() == Some(result_id.as_str()) + && admission_review.result_id.as_deref() == Some(result_id.as_str()) + && admission_review.job_id.as_deref() == Some(job_id.as_str()) + } + Some(crate::RepoFrontierPlanDecisionSource::AuthenticatedOperatorReview { .. }) => { + admission_receipt.result_id.is_none() + && admission_review.result_id.is_none() + && admission_review.job_id.is_none() + } + None => false, + }; + if decision.decision != crate::RepoFrontierPlanDecision::Adopt + || decision.model_admission_receipt_id != admission_receipt.receipt_id + || decision.model_revision != admission_receipt.previous_revision + || decision.model_hash != admission_receipt.previous_hash + || decision.frontier_item_id != route.frontier_item_id + || decision.frontier_item_hash != route.frontier_item_hash + || !source_matches + { + return Err( + "Soul frontier plan decision does not exactly bind admission, route, and decision source" + .to_string(), + ); + } + plan_decision_chain = Some(decision); + } else if let Some(admission_result_id) = admission_receipt.result_id.as_deref() { let modeling_acceptances = state .acceptance_receipts .iter() @@ -319,6 +354,22 @@ pub fn append_verification_hands_receipt_context( state_commit.changed_fields.join(" | "), state_commit.committed_at, )); + } else if let Some(decision) = plan_decision_chain { + context.push_str(&format!( + "- frontierPlanDecision: schemaVersion={} decisionId={} planningRequestId={} candidateId={} candidateSha256={} modelRevision={} modelHash={} frontierItemId={} frontierItemHash={} decision={:?} modelAdmissionReceiptId={} decidedAt={}\n", + decision.schema_version, + decision.decision_id, + decision.planning_request_id, + decision.candidate_id, + decision.candidate_sha256, + decision.model_revision, + decision.model_hash, + decision.frontier_item_id, + decision.frontier_item_hash, + decision.decision, + decision.model_admission_receipt_id, + decision.decided_at, + )); } else if let Some(amendment) = execution_amendment { context.push_str(&format!( "- executionAmendment: schemaVersion={} amendmentId={} replacedRouteId={} sourceActorId={} commandId={} admissionId={} packetSha256={} previousRevision={} previousHash={} admittedRevision={} admittedHash={} replacementAction={} replacementCommand={} rationale={} amendedAt={}\n", diff --git a/epiphany-core/src/lib.rs b/epiphany-core/src/lib.rs index 195b90c3..cf197feb 100644 --- a/epiphany-core/src/lib.rs +++ b/epiphany-core/src/lib.rs @@ -1080,6 +1080,7 @@ pub use runtime_spine::runtime_pending_repo_frontier_proposal_modeling_request; pub use runtime_spine::runtime_registered_document_types; pub use runtime_spine::runtime_reorient_worker_result; pub use runtime_spine::runtime_repo_frontier_execution_amendment_for_admission; +pub use runtime_spine::runtime_repo_frontier_plan_decision; pub use runtime_spine::runtime_repo_frontier_planning_eligibility; pub use runtime_spine::runtime_repo_frontier_planning_lifecycle; pub use runtime_spine::runtime_repo_frontier_proposal_modeling_request; diff --git a/epiphany-core/src/runtime_spine.rs b/epiphany-core/src/runtime_spine.rs index 5e3f81e7..2dae6a2d 100644 --- a/epiphany-core/src/runtime_spine.rs +++ b/epiphany-core/src/runtime_spine.rs @@ -6056,21 +6056,11 @@ fn decision_evidence_reference<'a>( } fn repo_model_admission_source( - source: &crate::RepoFrontierPlanDecisionSource, + _source: &crate::RepoFrontierPlanDecisionSource, decision_id: &str, ) -> crate::RepoModelAdmissionSource { - match source { - crate::RepoFrontierPlanDecisionSource::MindWorker { result_id, job_id } => { - crate::RepoModelAdmissionSource::WorkerResult { - result_id: result_id.clone(), - job_id: job_id.clone(), - } - } - crate::RepoFrontierPlanDecisionSource::AuthenticatedOperatorReview { .. } => { - crate::RepoModelAdmissionSource::FrontierPlanDecision { - decision_id: decision_id.to_string(), - } - } + crate::RepoModelAdmissionSource::FrontierPlanDecision { + decision_id: decision_id.to_string(), } } @@ -7731,6 +7721,18 @@ pub fn runtime_repo_frontier_route( cache.get::(route_id) } +pub fn runtime_repo_frontier_plan_decision( + runtime_store: impl AsRef, + decision_id: &str, +) -> Result> { + let mut cache = runtime_spine_cache(runtime_store)?; + cache.pull_all_backing_stores()?; + Ok(cache + .get_all::()? + .into_iter() + .find(|receipt| receipt.decision_id == decision_id)) +} + pub fn runtime_repo_frontier_execution_amendment_for_admission( store_path: impl AsRef, admission_receipt_id: &str, diff --git a/notes/epiphany-current-algorithmic-map.md b/notes/epiphany-current-algorithmic-map.md index 5568cdda..9f77941f 100644 --- a/notes/epiphany-current-algorithmic-map.md +++ b/notes/epiphany-current-algorithmic-map.md @@ -1487,6 +1487,32 @@ may return to Hands, while an accepted pass or non-pass awaiting model incorporation routes Modeling. CRRC cannot mint a replacement Hands gate while Soul is running or after Soul has established the newer causal boundary. +## Soul provenance classification for adopted frontier plans + +Owner: the immutable `RepoFrontierPlanDecisionReceipt` owns the provenance of +an adopted plan. Its Mind-worker result ID is an audit reference, not an organ +classifier. All new plan-decision RepoModel admissions therefore carry +`RepoModelAdmissionSource::FrontierPlanDecision`, regardless of whether Mind or +an authenticated operator supplied the decision. + +Soul selects and verifies provenance by typed route anatomy. A non-empty +`frontier_plan_decision_id` requires the exact decision receipt, Adopt verdict, +admission receipt binding, base model revision/hash, frontier identity/hash, +and exact Mind-worker result/job or authenticated-operator source. Only an +ordinary worker-result admission may require the Modeling acceptance, +Mind-state-commit, and gateway-review chain. Execution amendments retain their +separate exact receipt chain. + +Derived state: `RepoModelAdmissionReceipt.result_id` remains inspectable but no +longer decides which organ admitted the model. Existing v53 evidence is not +rewritten: its explicit `frontier_plan_decision_id` selects the correct typed +validation path despite the legacy generic `WorkerResult` source tag. + +Forbidden writer: Soul cannot infer Modeling from result presence, and a plan +decision cannot bypass provenance merely because its admission and review +contain a model-produced result. Missing, substituted, non-Adopt, or +route-mismatched decisions fail closed before worker launch. + ## Exact release build cache ownership The root release-bundle manifest owns release profile policy. Measured on the diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 0372ca48..b3cddd95 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -7,7 +7,7 @@ machine at its current memory budget. ## Authoritative state - Branch: `codex/epiphany-shakedown-live` -- Pushed HEAD: `d910158fd05fb78825dabda40b2147217c012c30` +- Pushed HEAD before the active Soul provenance repair: `29797ab85a9025ee024a4485bb8b4cb043507056` - Authenticated cognition commit: `d910158fd05fb78825dabda40b2147217c012c30` - Release: `sha256-2d6672958cd59cae43bbbc17c8218eaf3d50f3acab3b7d6550cb6dfad5f72020` - Witness: `sha256-23d3f44ef0f632dfc52a607585469b7242ac77a489e1406d7b3e2f578979462d` @@ -51,7 +51,26 @@ recommendation: 2. completed Imagination job `2a5701fe-7fbe-4f29-b3a5-51d6e790acbd` and typed candidate `repo-frontier-plan-candidate-02c089eb385c27560252d1915b998efc7c800324971a7b915b6e9ff3d33e4646` at revision 54; 3. dedicated Mind request `repo-frontier-plan-mind-7c8f086d050fe458a298ea4d9f5202e446530e5e14fa10129f52b4ae72238bc3` at revision 55, without adoption or Hands authority. -The next live typed action is `launchMindPlanReview`. +Mind adopted the candidate, Self materialized the exact route and scoped Hands +authority, and Hands committed `29797ab8` with typed patch, command, and commit +receipts. The next live typed action is `launchVerification`. + +The first Soul launch failed before worker creation because +`append_verification_hands_receipt_context` treated every admission with a +`result_id` as Modeling. The route admission actually binds Mind plan result +`result-worker-c0815013-7c61-4872-8549-4b666ceb015a` and explicit decision +`repo-frontier-plan-decision-22de32456ea73d63f613e69e8fdca876f5068f06febdc04d9f847da18af65a6e`. +The fresh Modeling acceptance remains present exactly once; the runtime did not +need correction. Pre-repair snapshots are +`.epiphany-run/v53-live-thread-acceptances-pre-repair.json` (SHA-256 +`7f22d49b5b06fa84e5fdfce6066403fab88de6526cc82e4726e9d1343f400b46`) +and `.epiphany-run/v53-live-route-admission-pre-repair.json` (SHA-256 +`df9002fd97d0ecfaf0750c41f397b0f560062132564b8b677d51ca70344518ac`). + +The active source repair types all new plan admissions as +`FrontierPlanDecision`, makes Soul validate the immutable decision receipt, and +uses the already-persisted `frontier_plan_decision_id` as the compatibility +discriminator for v53. It does not rewrite evidence or weaken Soul. ## Build-time finding @@ -105,7 +124,7 @@ probe reported `Removed 0 files` and is rejected, not evidence. ## Open readiness work -- launch and adjudicate the committed Mind plan review; +- package the Soul provenance fix, replay `launchVerification`, and adjudicate the first valid result; - prove native Persona cognition and external speech consequence; - prove Continuity crash, restart, session closure, and bounded retention; - measure long-duration resource plateau; diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 2e1f79e8cbcbf6e42e1ade7d2b88d9ff934a6e31..325749a486d49fa187ebfd4a6b6526a29d8cb7ed 100644 GIT binary patch delta 373 zcmXw!ze)o^5Qn|fXe`p&h%l1Yh(aK6wqj)wVrL`c?j$#`*vpf^( zx-6^+4PjMSd!Oaar^Wp1x!G#$*ZcDYWn0tY#8n0iR#ufTL^f3*xWouPxCvRbieSu9 z8H|yKtT3^&J78S`cvmREm818IK7Q6@c3LL>h*{*~An&-k_DP*rGThjH{TY za8B?qmtnLTCTLiTLPIKpt41XZ$h)IIOB2}3vnGj=u6Cgxs1wK|2QZs;_Gr<^(j{4y=Sz&G+-Cc*o^NNn-`IJDQ~&?~ delta 67 zcmbQ&t-Pf}d4m`uuYr|;p_PGU)G-E*!-AWY84DR1y_=^pwNGVY1Y!`)48$xz%nHP8 NK+L{2g8-=<6g>a{ diff --git a/state/map.yaml b/state/map.yaml index 96738efe..4623043e 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -34,7 +34,7 @@ invariants: - Evidence and git retain history; this map retains only state that changes future decisions. current_status: - summary: Epiphany is a supervised engineering alpha on Starfire, not deployment-ready. A bounded receipted supervisor correction removed one obsolete Modeling acceptance while preserving immutable evidence. Fresh Modeling minted exactly one typed active Imagination frontier; Self routed it through completed Imagination and committed a dedicated Mind review request without granting Hands authority despite stale CRRC regather display state. The live typed Modeling-to-Imagination-to-Mind route is proven. Separate owner lock universes were rejected. The single-root-graph Self-policy split is authenticated and published; a real warm policy invalidation rebuilt only policy and coordinator in 6.02 seconds while all 20 stable packaged executables remained unchanged. Persona consequence, retention, endurance, restart closure, whole-store launch latency, and Linux/Yggdrasil cognition remain open. + summary: Epiphany is a supervised engineering alpha on Starfire, not deployment-ready. Fresh Modeling, Imagination, and Mind produced one adopted frontier plan; typed Hands then committed the bounded route-chain specification with exact patch, command, and commit receipts. Soul launch exposed a provenance-classification defect: a Mind-worker frontier-plan admission carried a result ID and Soul inferred Modeling from that incidental field. The repair makes FrontierPlanDecision the admission source for every plan decision and validates the immutable plan-decision receipt directly, while retaining compatibility with the already-persisted live admission through its explicit frontier_plan_decision_id. No live state rewrite is required. Persona consequence, retention, endurance, restart closure, whole-store launch latency, and Linux/Yggdrasil cognition remain open. operational_state: local_worktree: clean_at_authenticated_d910158f_policy_split operator_wireguard: restored @@ -53,7 +53,7 @@ current_status: yggdrasil_epiphany_services: absent resident_physiology: heartbeat_and_self_running unresolved_authority: Modeling job commit still costs about 52 seconds against the 76 MiB runtime store. The adopted Mind decision also carries a model-supplied 2025 timestamp; coordinator commit-time timestamp ownership remains open. Persona consequence, Continuity closure, retention, endurance, and Linux cognition remain unproven. - next_action: Resume the committed live Mind review request at revision 55 with launchMindPlanReview and adjudicate the first valid result. Then profile the Modeling whole-store commit transaction before proceeding to Persona consequence and Continuity crash/restart/closure. + next_action: Package and authenticate the Soul provenance fix, replay the existing v53 launchVerification action without overrides, accept the first valid Soul result, and inspect the next typed action. Then profile the Modeling whole-store commit transaction before Persona consequence and Continuity crash/restart/closure. active_subgoals: - Prove Persona, Self, Eyes, Modeling, Imagination, Hands, Soul, Mind, Continuity, and nervous-system behavior individually.