From 951dee9d456bdd6bfb333e666de60c6b80a0cd17 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 7 Aug 2026 22:10:57 +0100 Subject: [PATCH] Add typed manual regather consent --- .../src/bin/epiphany-mvp-coordinator.rs | 61 +++++++++++++++++- notes/fresh-workspace-handoff.md | 15 ++++- state/ledgers.msgpack | Bin 559507 -> 559920 bytes state/map.yaml | 8 +-- 4 files changed, 77 insertions(+), 7 deletions(-) diff --git a/epiphany-core/src/bin/epiphany-mvp-coordinator.rs b/epiphany-core/src/bin/epiphany-mvp-coordinator.rs index 87008581..d322da8f 100644 --- a/epiphany-core/src/bin/epiphany-mvp-coordinator.rs +++ b/epiphany-core/src/bin/epiphany-mvp-coordinator.rs @@ -88,6 +88,7 @@ struct Args { ephemeral: bool, auto_review: bool, supersede_failed_results: bool, + approve_manual_regather: bool, auto_tools: bool, proposal_modeling_request_id: Option, imagination_consideration_request_id: Option, @@ -128,6 +129,7 @@ impl Args { ephemeral: true, auto_review: false, supersede_failed_results: false, + approve_manual_regather: false, auto_tools: true, proposal_modeling_request_id: None, imagination_consideration_request_id: None, @@ -223,6 +225,7 @@ impl Args { "--no-ephemeral" => parsed.ephemeral = false, "--auto-review" => parsed.auto_review = true, "--supersede-failed-results" => parsed.supersede_failed_results = true, + "--approve-manual-regather" => parsed.approve_manual_regather = true, "--auto-tools" => parsed.auto_tools = true, "--no-auto-tools" => parsed.auto_tools = false, "--test-complete-backend" => { @@ -475,16 +478,21 @@ fn run_coordinator(args: &Args) -> Result { })); } + let mut manual_regather_approval = args.approve_manual_regather; for index in 0..args.max_steps { let status = collect_coordinator_status(&runtime_store, &thread_id)?; let mut coordinator = status .get("coordinator") .cloned() .unwrap_or_else(|| json!({"action": "regatherManually"})); - let action = coordinator["action"] + let mut action = coordinator["action"] .as_str() .unwrap_or("regatherManually") .to_string(); + if manual_regather_approval { + action = apply_manual_regather_approval(&action, &mut coordinator)?; + manual_regather_approval = false; + } let snapshot_name = format!("step-{index:02}-{action}.txt"); fs::write( @@ -1912,6 +1920,23 @@ fn first_string_at(value: &Value, paths: &[&[&str]]) -> Option { None } +fn apply_manual_regather_approval(action: &str, coordinator: &mut Value) -> Result { + if action != "regatherManually" { + return Err(anyhow!( + "--approve-manual-regather requires Self to derive regatherManually, got {action}" + )); + } + coordinator["action"] = Value::String("launchResearch".to_string()); + coordinator["canAutoRun"] = Value::Bool(true); + coordinator["requiresReview"] = Value::Bool(false); + coordinator["recommendedSceneAction"] = Value::String("roleLaunch".to_string()); + coordinator["reason"] = Value::String( + "Operator approved the Self-derived manual regather boundary; launch Eyes once through the typed Research lane." + .to_string(), + ); + Ok("launchResearch".to_string()) +} + fn coordinator_receipt_status(mode: &str, final_action: &Value) -> String { if mode == "plan" { return "planned".to_string(); @@ -2363,7 +2388,10 @@ mod tests { gate["routeId"].as_str() ); assert_eq!(intent.plan_candidate_sha256, "coordinator-plan-hash-test"); - assert_eq!(intent.plan_action, "Implement the bounded coordinator gate test."); + assert_eq!( + intent.plan_action, + "Implement the bounded coordinator gate test." + ); assert_eq!( gate.pointer("/recordPassCommand/executable") .and_then(serde_json::Value::as_str), @@ -2380,6 +2408,35 @@ mod tests { Ok(()) } + #[test] + fn operator_can_approve_only_a_self_derived_manual_regather() -> Result<()> { + let mut coordinator = json!({ + "action": "regatherManually", + "canAutoRun": false, + "requiresReview": true, + "recommendedSceneAction": "roleResult", + }); + assert_eq!( + apply_manual_regather_approval("regatherManually", &mut coordinator)?, + "launchResearch" + ); + assert_eq!(coordinator["action"], "launchResearch"); + assert_eq!(coordinator["canAutoRun"], true); + assert_eq!(coordinator["requiresReview"], false); + assert_eq!(coordinator["recommendedSceneAction"], "roleLaunch"); + + let mut unrelated = json!({"action": "launchModeling"}); + let error = apply_manual_regather_approval("launchModeling", &mut unrelated) + .expect_err("operator approval must not override another Self decision"); + assert!( + error + .to_string() + .contains("requires Self to derive regatherManually") + ); + assert_eq!(unrelated["action"], "launchModeling"); + Ok(()) + } + fn seed_hands_frontier(store: &Path) -> Result<()> { let mut item = epiphany_core::RepoFrontierItem { id: "coordinator-hands-frontier-test".to_string(), diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 5739ae7c..64435760 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -90,9 +90,22 @@ f9dfd93a, local Verse was seeded for `repo:F:/Projects/Epiphany`, and the exact release was published into v29's physically separate `release.ccmp`. v28 remains unchanged sealed failure evidence. +Live v29 then proved native initial and proposal-bound Modeling, accepted Eyes, +accepted Reorientation, and the single-use Research-to-Modeling route. After +causal Modeling acceptance, Self derived `regatherManually`: accepted evidence +grounds the Hands authority shape but still lacks the concrete deliberate +worker-failure to continuity-receipt to restart-consumption path. This exposed +a control-plane gap: the coordinator had no typed operator actuator for its +intentional manual Eyes boundary. The current worktree adds +`--approve-manual-regather`. It is single-use, valid only when Self already +derived `regatherManually`, and launches only the fixed Research lane; it fails +closed for any other Self action. All fifteen coordinator tests pass. It is not +yet packaged or replayed. + ## Next action -Without overrides in clean v29, prove: +Package the bounded manual-regather consent surface into a clean successor, +approve the current Self-derived boundary once, then prove: 1. Self derives proposal-bound Modeling and canonical Imagination. 2. Self selects and launches canonical Imagination. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 6f72003f55d293a46197b9a9ac81542437601ee5..2204d28f6d26cfe671e93691ae4f965086e9ddaf 100644 GIT binary patch delta 441 zcmYk2Jx;?w5QVY%Nt%c*^(b`68*D55g^GfXG(Z!&kv&N)ZFbFiZIUVl5=gWm7mL|$|;O62BpDHQ@+(Hnd)K6Ca@YL<|^V7!wixM zJ1(Y_aaU0r&f}OH{}_e9wAxmT`&GPHPxGKanQ*@1iToXg6VWm=qgH$+Gp}B4KEOnZ ZNLJhElJ!2x=nR+^f