From 2646c1c77502eeabaf72700d347a8880de83c1d5 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 30 Apr 2026 06:50:56 +0100 Subject: [PATCH] Harden supervised Epiphany dogfood loop --- apps/epiphany-gui/src-tauri/src/lib.rs | 41 ++ apps/epiphany-gui/src/App.tsx | 86 ++- apps/epiphany-gui/src/styles.css | 25 +- apps/epiphany-gui/src/types.ts | 8 + epiphany-core/src/rollout.rs | 67 ++- notes/fresh-workspace-handoff.md | 32 +- state/evidence.jsonl | 4 + state/map.yaml | 5 +- tools/epiphany_agent_telemetry.py | 52 ++ tools/epiphany_gui_action.py | 365 +++++++++++- tools/epiphany_mvp_coordinator.py | 119 +++- tools/epiphany_phase6_job_control_smoke.py | 68 +++ .../app-server/src/bespoke_event_handling.rs | 17 +- .../app-server/src/codex_message_processor.rs | 523 +++++++++++++----- .../src/prompts/epiphany_specialists.toml | 2 + .../codex-rs/app-server/src/thread_state.rs | 1 + .../src/session/rollout_reconstruction.rs | 36 +- .../session/rollout_reconstruction_tests.rs | 52 ++ .../core/src/tools/handlers/agent_jobs.rs | 52 +- .../codex-rs/state/src/runtime/agent_jobs.rs | 116 +++- 20 files changed, 1482 insertions(+), 189 deletions(-) diff --git a/apps/epiphany-gui/src-tauri/src/lib.rs b/apps/epiphany-gui/src-tauri/src/lib.rs index 3a54611b..27da1cf2 100644 --- a/apps/epiphany-gui/src-tauri/src/lib.rs +++ b/apps/epiphany-gui/src-tauri/src/lib.rs @@ -32,9 +32,19 @@ struct ArtifactBundle { summary_path: Option, final_status_path: Option, comparison_path: Option, + implementation_audit: Option, modified_millis: Option, } +#[derive(Debug, Serialize)] +#[serde(rename_all = "camelCase")] +struct ImplementationAudit { + result_path: String, + workspace_changed: bool, + tracked_diff_present: bool, + changed_files: Vec, +} + #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] struct OperatorSnapshot { @@ -72,9 +82,11 @@ fn run_operator_action( | "acceptModeling" | "launchVerification" | "readVerificationResult" + | "acceptVerification" | "launchReorient" | "readReorientResult" | "acceptReorient" + | "continueImplementation" | "prepareCheckpoint" => run_gui_action_bridge(&repo_root, request, action), _ => Err(format!("unknown operator action: {action}")), } @@ -371,6 +383,7 @@ fn collect_artifact_root( final_status_path: existing_path(&path, "epiphany-final-status.json") .or_else(|| existing_path(&path, "after-status.json")), comparison_path: existing_path(&path, "comparison.md"), + implementation_audit: read_implementation_audit(&path), files, modified_millis, }); @@ -384,6 +397,34 @@ fn existing_path(root: &Path, name: &str) -> Option { path.exists().then(|| path.display().to_string()) } +fn read_implementation_audit(root: &Path) -> Option { + let result_path = root.join("implementation-result.json"); + let text = fs::read_to_string(&result_path).ok()?; + let value: Value = serde_json::from_str(&text).ok()?; + Some(ImplementationAudit { + result_path: result_path.display().to_string(), + workspace_changed: value + .get("workspaceChanged") + .and_then(Value::as_bool) + .unwrap_or(false), + tracked_diff_present: value + .get("trackedDiffPresent") + .and_then(Value::as_bool) + .unwrap_or(false), + changed_files: value + .get("changedFiles") + .and_then(Value::as_array) + .map(|items| { + items + .iter() + .filter_map(Value::as_str) + .map(ToString::to_string) + .collect() + }) + .unwrap_or_default(), + }) +} + fn repo_root() -> Result { let manifest_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); manifest_dir diff --git a/apps/epiphany-gui/src/App.tsx b/apps/epiphany-gui/src/App.tsx index bb281b20..964e70dc 100644 --- a/apps/epiphany-gui/src/App.tsx +++ b/apps/epiphany-gui/src/App.tsx @@ -23,7 +23,9 @@ const actionButtons: Array<{ requiresThread?: boolean; requiresReadyState?: boolean; requiresModelingPatch?: boolean; + requiresVerificationResult?: boolean; requiresReorientResult?: boolean; + requiresContinueImplementation?: boolean; icon: "file" | "check" | "play" | "eye" | "accept"; }> = [ { @@ -47,6 +49,16 @@ const actionButtons: Array<{ title: "Seed durable Epiphany state for this GUI operator thread", icon: "accept", }, + { + action: "continueImplementation", + label: "Continue Implementation", + runningLabel: "Implementing", + title: "Run a bounded implementation turn when the coordinator has cleared specialist lanes", + requiresThread: true, + requiresReadyState: true, + requiresContinueImplementation: true, + icon: "play", + }, { action: "launchModeling", label: "Launch Modeling", @@ -91,6 +103,16 @@ const actionButtons: Array<{ requiresThread: true, icon: "eye", }, + { + action: "acceptVerification", + label: "Accept Verification", + runningLabel: "Accepting", + title: "Accept a reviewed verification finding into Epiphany state", + requiresThread: true, + requiresReadyState: true, + requiresVerificationResult: true, + icon: "accept", + }, { action: "launchReorient", label: "Launch Reorient", @@ -219,12 +241,22 @@ export function App() { const jobs: any[] = Array.isArray(status?.jobs?.jobs) ? status.jobs.jobs : []; const roleResults = status?.roleResults ?? {}; const reorientResult = status?.reorientResult ?? {}; + const latestArtifact = snapshot?.artifacts?.[0]; + const latestImplementationArtifact = useMemo( + () => (snapshot?.artifacts ?? []).find((artifact) => artifact.implementationAudit), + [snapshot?.artifacts], + ); + const latestImplementationAudit = latestImplementationArtifact?.implementationAudit; + const implementationNoDiffPending = + Boolean(latestArtifact?.implementationAudit) && latestArtifact?.implementationAudit?.workspaceChanged === false; const readyState = scene.stateStatus === "ready"; const currentThreadId = request.threadId; const modelingFinding = roleResults?.modeling?.finding; const canAcceptModeling = text(roleResults?.modeling?.status).toLowerCase() === "completed" && Boolean(modelingFinding?.statePatch); + const canAcceptVerification = text(roleResults?.verification?.status).toLowerCase() === "completed"; const canAcceptReorient = text(reorientResult?.status).toLowerCase() === "completed"; + const canContinueImplementation = text(coordinator.action).toLowerCase() === "continueimplementation"; return (
@@ -263,17 +295,34 @@ export function App() { const needsThread = button.requiresThread && !currentThreadId; const needsState = button.requiresReadyState && !readyState; const needsModeling = button.requiresModelingPatch && !canAcceptModeling; + const needsVerification = button.requiresVerificationResult && !canAcceptVerification; const needsReorient = button.requiresReorientResult && !canAcceptReorient; - const disabled = runningAction !== null || needsThread || needsState || needsModeling || needsReorient; + const needsImplementation = button.requiresContinueImplementation && !canContinueImplementation; + const needsNoDiffReview = button.requiresContinueImplementation && implementationNoDiffPending; + const disabled = + runningAction !== null || + needsThread || + needsState || + needsModeling || + needsVerification || + needsReorient || + needsImplementation || + needsNoDiffReview; const title = needsThread ? "Prepare a checkpoint or enter a persisted thread id first" : needsState ? "Prepare Epiphany state before launching this lane" : needsModeling ? "Read a completed modeling result with a state patch before accepting it" - : needsReorient - ? "Read a completed reorient result before accepting it" - : button.title; + : needsVerification + ? "Read a completed verification result before accepting it" + : needsReorient + ? "Read a completed reorient result before accepting it" + : needsImplementation + ? "Run the coordinator and clear review gates before continuing implementation" + : needsNoDiffReview + ? "Review the latest no-diff implementation artifact or run another lane before retrying" + : button.title; return (