From bd96305e60428b8ea2af822f1e1a233405c09c43 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 9 Aug 2026 01:36:10 +0100 Subject: [PATCH] Derive Mind identity from authenticated launch --- .../src/bin/epiphany-openai-runtime.rs | 3 + epiphany-openai-runtime/src/lib.rs | 109 ++++++++++++++---- notes/epiphany-current-algorithmic-map.md | 27 +++++ notes/fresh-workspace-handoff.md | 36 ++++++ state/ledgers.msgpack | Bin 584828 -> 585250 bytes state/map.yaml | 18 +-- 6 files changed, 160 insertions(+), 33 deletions(-) diff --git a/epiphany-openai-runtime/src/bin/epiphany-openai-runtime.rs b/epiphany-openai-runtime/src/bin/epiphany-openai-runtime.rs index caaaa222..dac64218 100644 --- a/epiphany-openai-runtime/src/bin/epiphany-openai-runtime.rs +++ b/epiphany-openai-runtime/src/bin/epiphany-openai-runtime.rs @@ -1029,6 +1029,7 @@ mod tests { imagination_consideration_request_id: None, admitted_model_direction_consideration_request_id: None, repo_frontier_modeling_request_id: None, + repo_frontier_verdict_modeling_authority: None, created_at: now(), }, )?; @@ -1123,6 +1124,7 @@ mod tests { imagination_consideration_request_id: None, admitted_model_direction_consideration_request_id: None, repo_frontier_modeling_request_id: None, + repo_frontier_verdict_modeling_authority: None, created_at: now(), }, )?; @@ -1205,6 +1207,7 @@ mod tests { imagination_consideration_request_id: None, admitted_model_direction_consideration_request_id: None, repo_frontier_modeling_request_id: None, + repo_frontier_verdict_modeling_authority: None, created_at: now(), }, )?; diff --git a/epiphany-openai-runtime/src/lib.rs b/epiphany-openai-runtime/src/lib.rs index e59ac6f8..62aaf054 100644 --- a/epiphany-openai-runtime/src/lib.rs +++ b/epiphany-openai-runtime/src/lib.rs @@ -672,6 +672,7 @@ pub fn complete_worker_job_from_assistant_text( let typed_result = role_worker_result_from_ingress( launch_request, &document.role_id, + document.frontier_plan_mind_context.as_ref(), &result_id, parsed, evidence_refs.clone(), @@ -1451,7 +1452,6 @@ struct RoleWorkerResultIngress { claim_repair_request_id: Option, frontier_planning_request_id: Option, frontier_plan_candidate: Option, - frontier_plan_mind_request_id: Option, frontier_plan_mind_decision: Option, imagination_consideration_request_id: Option, imagination_consideration_candidate: Option, @@ -1464,11 +1464,6 @@ struct RoleWorkerResultIngress { #[derive(Debug, Clone, Default, serde::Deserialize)] #[serde(rename_all = "camelCase", default)] struct RepoFrontierPlanMindDecisionIngress { - mind_request_id: String, - planning_request_id: String, - imagination_result_id: String, - candidate_id: String, - candidate_sha256: String, decision: Option, rationale: String, decided_at: String, @@ -1618,6 +1613,7 @@ fn parse_worker_result_ingress( fn role_worker_result_from_ingress( launch_request: &EpiphanyRuntimeWorkerLaunchRequest, role_id: &str, + frontier_plan_mind_context: Option<&epiphany_core::RepoFrontierPlanMindContextProjection>, result_id: &str, result: &RoleWorkerResultIngress, runtime_evidence_ids: Vec, @@ -1666,19 +1662,27 @@ fn role_worker_result_from_ingress( let (frontier_plan_mind_decision_msgpack, frontier_plan_mind_decision_error) = if let Some(ingress) = result.frontier_plan_mind_decision.as_ref() { if let Some(decision) = ingress.decision { - encode_optional_document( - &Some(epiphany_core::RepoFrontierPlanMindDecision { - mind_request_id: ingress.mind_request_id.trim().into(), - planning_request_id: ingress.planning_request_id.trim().into(), - imagination_result_id: ingress.imagination_result_id.trim().into(), - candidate_id: ingress.candidate_id.trim().into(), - candidate_sha256: ingress.candidate_sha256.trim().into(), - decision, - rationale: ingress.rationale.trim().into(), - decided_at: ingress.decided_at.trim().into(), - }), - "frontierPlanMindDecision", - ) + match frontier_plan_mind_context { + Some(context) => encode_optional_document( + &Some(epiphany_core::RepoFrontierPlanMindDecision { + mind_request_id: context.request.request_id.clone(), + planning_request_id: context.planning_request.request_id.clone(), + imagination_result_id: context.request.imagination_result_id.clone(), + candidate_id: context.candidate.candidate_id.clone(), + candidate_sha256: context.request.candidate_sha256.clone(), + decision, + rationale: ingress.rationale.trim().into(), + decided_at: ingress.decided_at.trim().into(), + }), + "frontierPlanMindDecision", + ), + None => ( + None, + Some( + "frontierPlanMindDecision: launch lacks immutable Mind context".into(), + ), + ), + } } else { ( None, @@ -1836,9 +1840,8 @@ fn role_worker_result_from_ingress( result.frontier_planning_request_id.as_deref(), ), frontier_plan_candidate_msgpack, - frontier_plan_mind_request_id: clean_optional_string( - result.frontier_plan_mind_request_id.as_deref(), - ), + frontier_plan_mind_request_id: frontier_plan_mind_context + .map(|context| context.request.request_id.clone()), frontier_plan_mind_decision_msgpack, imagination_consideration_request_id: clean_optional_string( result.imagination_consideration_request_id.as_deref(), @@ -2083,6 +2086,7 @@ mod tests { let result = role_worker_result_from_ingress( &launch, "verification", + None, "verification-result-1", &parsed, vec!["openai-request:verification-request-1".to_string()], @@ -2157,6 +2161,7 @@ mod tests { let result = role_worker_result_from_ingress( &launch, "imagination", + None, "planning-result-1", &parsed, Vec::new(), @@ -2252,9 +2257,9 @@ mod tests { } #[test] - fn mind_ingress_preserves_exact_typed_judgment() -> Result<()> { + fn mind_ingress_derives_immutable_identity_from_launch_context() -> Result<()> { let parsed = parse_assistant_json::( - r#"{"roleId":"mindAdmissionReview","verdict":"adopt","summary":"bounded","nextSafeMove":"admit","filesInspected":[],"frontierPlanMindRequestId":"mind-request-1","frontierPlanMindDecision":{"mindRequestId":"mind-request-1","planningRequestId":"planning-request-1","imaginationResultId":"imagination-result-1","candidateId":"candidate-1","candidateSha256":"candidate-hash-1","decision":"adopt","rationale":"Exact candidate is bounded and falsifiable.","decidedAt":"2026-07-15T10:00:00Z"}}"#, + r#"{"roleId":"mindAdmissionReview","verdict":"adopt","summary":"bounded","nextSafeMove":"admit","filesInspected":[],"frontierPlanMindRequestId":"model-substituted-request","frontierPlanMindDecision":{"mindRequestId":"model-substituted-request","planningRequestId":"model-substituted-planning","imaginationResultId":"model-substituted-result","candidateId":"model-substituted-candidate","candidateSha256":"model-substituted-hash","decision":"adopt","rationale":"Exact candidate is bounded and falsifiable.","decidedAt":"2026-07-15T10:00:00Z"}}"#, )?; let launch = EpiphanyRuntimeWorkerLaunchRequest { schema_version: epiphany_core::RUNTIME_WORKER_LAUNCH_REQUEST_SCHEMA_VERSION.into(), @@ -2281,9 +2286,61 @@ mod tests { repo_frontier_modeling_request_id: None, repo_frontier_verdict_modeling_authority_msgpack: None, }; + let context = epiphany_core::RepoFrontierPlanMindContextProjection { + schema_version: epiphany_core::REPO_FRONTIER_PLAN_MIND_CONTEXT_SCHEMA_VERSION.into(), + contract: epiphany_core::REPO_FRONTIER_PLAN_MIND_CONTEXT_CONTRACT.into(), + request: epiphany_core::RepoFrontierPlanMindRequest { + schema_version: epiphany_core::REPO_FRONTIER_PLAN_MIND_REQUEST_SCHEMA_VERSION + .into(), + request_id: "mind-request-1".into(), + planning_request_id: "planning-request-1".into(), + imagination_result_id: "imagination-result-1".into(), + imagination_job_id: "imagination-job-1".into(), + candidate_id: "candidate-1".into(), + candidate_sha256: "candidate-hash-1".into(), + runtime_id: "runtime-1".into(), + thread_id: "thread-1".into(), + requested_at: "2026-07-15T09:59:00Z".into(), + contract: epiphany_core::REPO_FRONTIER_PLAN_MIND_REQUEST_CONTRACT.into(), + }, + planning_request: epiphany_core::RepoFrontierPlanningRequest { + schema_version: epiphany_core::REPO_FRONTIER_PLANNING_REQUEST_SCHEMA_VERSION.into(), + request_id: "planning-request-1".into(), + model_revision: 1, + model_hash: "model-hash-1".into(), + admission_receipt_id: "admission-1".into(), + frontier_item_id: "frontier-1".into(), + frontier_item_hash: "frontier-hash-1".into(), + selected_organ: "Imagination".into(), + source_scope: vec!["epiphany-openai-runtime".into()], + requested_at: "2026-07-15T09:58:00Z".into(), + contract: epiphany_core::REPO_FRONTIER_PLANNING_CONTRACT.into(), + runtime_id: "runtime-1".into(), + thread_id: "thread-1".into(), + }, + candidate: epiphany_core::RepoFrontierPlanCandidate { + schema_version: epiphany_core::REPO_FRONTIER_PLAN_CANDIDATE_SCHEMA_VERSION.into(), + candidate_id: "candidate-1".into(), + planning_request_id: "planning-request-1".into(), + model_revision: 1, + model_hash: "model-hash-1".into(), + frontier_item_id: "frontier-1".into(), + frontier_item_hash: "frontier-hash-1".into(), + safe_paths: vec!["epiphany-openai-runtime".into()], + action: "repair".into(), + command: "cargo test".into(), + checks: vec!["focused test".into()], + stop_conditions: vec!["identity mismatch".into()], + rollback_steps: vec!["revert".into()], + commit_message: "Derive Mind identity".into(), + proposed_at: "2026-07-15T09:59:00Z".into(), + contract: epiphany_core::REPO_FRONTIER_PLANNING_CONTRACT.into(), + }, + }; let result = role_worker_result_from_ingress( &launch, "mindAdmissionReview", + Some(&context), "mind-result-1", &parsed, Vec::new(), @@ -2301,6 +2358,10 @@ mod tests { epiphany_core::RepoFrontierPlanDecision::Adopt ); assert_eq!(decision.candidate_sha256, "candidate-hash-1"); + assert_eq!(decision.mind_request_id, "mind-request-1"); + assert_eq!(decision.planning_request_id, "planning-request-1"); + assert_eq!(decision.imagination_result_id, "imagination-result-1"); + assert_eq!(decision.candidate_id, "candidate-1"); assert!(result.state_patch_msgpack.is_none()); assert!(result.repo_model_patch_msgpack.is_none()); Ok(()) diff --git a/notes/epiphany-current-algorithmic-map.md b/notes/epiphany-current-algorithmic-map.md index ec550eab..c9be4a40 100644 --- a/notes/epiphany-current-algorithmic-map.md +++ b/notes/epiphany-current-algorithmic-map.md @@ -1797,3 +1797,30 @@ leaving only status, evidence references, gap, and update timestamp writable. The completed worker result is immutable invalid evidence and cannot be made valid by changing admission after the fact. Supersede it only when the corrected launch/schema boundary is ready, then run one new inference. + +## Launch-owned Mind decision identity (2026-08-09) + +Owner: the authenticated `RepoFrontierPlanMindContextProjection` in the worker +launch owns Mind request, planning request, Imagination result, candidate, and +candidate-digest identity. The Mind model owns only the judgment and rationale; +its JSON echoes are formatting cargo and cannot select executable identity. + +Current mechanism: `complete_worker_job_from_assistant_text` passes the exact +launch projection to `role_worker_result_from_ingress`. The adapter constructs +`RepoFrontierPlanMindDecision` identity fields and the outer request echo from +that projection. A decision without Mind launch context becomes a typed item +error. `put_runtime_role_worker_result` retains its exact persisted-request, +launch-binding, launch-document hash, role, runtime, thread, and candidate +validation; no admission check was weakened. + +Forbidden writer: `RoleWorkerResultIngress` no longer deserializes Mind identity +fields into authority. A model may print counterfeit IDs, but they are ignored. +This replaces the live failure mode where two validly launched resident Mind +attempts failed closed because the model imperfectly recopied long immutable +identities. The failed results remain sealed evidence and cannot be rewritten. + +Verification layer: `mind_ingress_derives_immutable_identity_from_launch_context` +feeds five substituted identities and proves the emitted typed decision carries +only the canonical launch identities. All 15 `epiphany-openai-runtime` library +tests pass. Exact Linux package and one explicitly authorized resident retry are +still required before this boundary is live-proven. diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index c8ad7f04..bf782c0e 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -1,5 +1,41 @@ # Fresh workspace handoff +## Packaged Body speed proof and resident Mind identity correction — 2026-08-09 + +Exact pushed source `217dd4b96746536e01dc8991b5e6f31c2c588af0` is packaged as +`sha256-3dab68c572519501c3401a8b737603e312349a4052f69f7f751478fa2631aaf3` +with witness +`sha256-2278ec15ed44a21e4bc4d20b4f64d67fb530c4bc2bc44cd1cd9d775b16838f74`. +The exact packaged observer reread the unchanged resident c005 Body as +generation 1/tree `4d1f8a23558d53622ed21be0bb51db456b532f48` in 94,521ms. This is +strong observer-boundary evidence against the old 160,183ms Modeling +`jobCommit`, but not a coordinator-to-coordinator replay because Self's typed +route had already advanced. Receipts are under +`.epiphany-run/linux-package-217dd/`; do not rebuild this release. + +The resident chain completed `startFrontierPlanning`, then native Imagination +job `f62738f1-a819-431a-a454-c0b2cff5a4d8` produced candidate +`repo-frontier-plan-candidate-28f597414331a67b71449bcf28317c42ddbd78566dbe92aa41b9f54302762be8`. +Self committed Mind request +`repo-frontier-plan-mind-90e8c1995805d94d05c9e065a117c54eb8993cd93c985b9daa2915746c32977f`. +Mind attempt `411e73bb-4906-4785-be92-2a72a9290691` failed identity validation, +was explicitly superseded, and authorized one retry. Retry +`8e5952fb-0db6-460c-b061-c75d32410cc2` failed with `Mind result request +disappeared`. Direct read-only binary inspection proved the exact canonical +request, planning request, and candidate keys remain in `runtime.cc`; the model +had substituted an unknown echo. Both failures are immutable evidence. + +The authority fault was in source: `RoleWorkerResultIngress` allowed model JSON +to author the outer Mind request echo plus five identities inside the typed +decision. `epiphany-openai-runtime/src/lib.rs` now derives request, planning, +Imagination-result, candidate, and candidate-digest identities exclusively from +the authenticated `RepoFrontierPlanMindContextProjection`. The model owns only +decision, rationale, and its proposed timestamp. A regression supplies five +counterfeit model identities and proves the runtime emits the canonical launch +identities; all 15 runtime library tests pass. Package once, explicitly review +and supersede failed retry `8e5952fb`, and launch only the newly authorized +attempt. Do not recreate Imagination or either failed Mind attempt. + ## Linux Eyes-to-Modeling acceptance and Body observation speed cut — 2026-08-09 The fresh tool-enabled resident circuit under `/state/eyes-tools` completed its diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 507a8ca5b5a9bfe4f1d5a77c49cca9fd7e4336ac..a8e68ad0a09f69f5eeea2993a0e895666aa0b90e 100644 GIT binary patch delta 438 zcmYk2y-EW?6ouWWNl+~8w2>=mcf%&pki=3f1Z~91Zk)NB4D8NqW@clof>>y;A(f3! zAXtbm;4@fQ*oojH2zu8)EI#J<+;i@If2>?TRc@BN`NmqO(L8vVD!+Z)R=mFFvD0zk zY+Ue&e4Qp{h*_dYl>@+S;u2x2a9XUYQl}dm?XCzv{ zVX7?(NVLE>V43S_Lr0k;nPZ1Bf)uEnbjN_ar_oknYsk1GeLq9%pdDh1*V=8mNSIV4 zO$}O-0E-+NNTiLC38}hZM&Fu1NXya`S#E^JXj6r~j7$;)t24t9ls*E1hSJ(!Cm+(7 zDMf{R*iKkiD(0kC^lY=(`M{YHQZR=;&<=#`=JEd0M@A>BkoT9j!|9)Zm}QFhfNSM& r=r*9XKJhla<;lW%sXXaC7v};Wq~dY*6+g;n$2A2-6QTT9`)4wr