Liberate coordinator from Codex host

This commit is contained in:
Meta Vens 2026-07-12 00:31:43 +01:00
commit 5853a500d3
11 changed files with 220 additions and 199 deletions

View file

@ -8,8 +8,6 @@ use std::fs;
use std::path::{Path, PathBuf};
use std::process::Command;
const DEFAULT_APP_SERVER: &str = r"C:\Users\Meta\.cargo-target-codex\debug\codex-app-server.exe";
fn main() -> Result<()> {
let args = Args::parse()?;
let result = run_smoke(&args)?;
@ -19,7 +17,6 @@ fn main() -> Result<()> {
#[derive(Debug)]
struct Args {
app_server: PathBuf,
artifact_root: PathBuf,
coordinator_exe: Option<PathBuf>,
}
@ -28,14 +25,15 @@ impl Args {
fn parse() -> Result<Self> {
let root = env::current_dir().context("failed to resolve current dir")?;
let mut parsed = Self {
app_server: PathBuf::from(DEFAULT_APP_SERVER),
artifact_root: root.join(".epiphany-dogfood").join("coordinator-smoke"),
coordinator_exe: None,
};
let mut args = env::args().skip(1);
while let Some(arg) = args.next() {
match arg.as_str() {
"--app-server" => parsed.app_server = take_path(&mut args, "--app-server")?,
"--app-server" => {
let _ = take_path(&mut args, "--app-server")?;
}
"--artifact-root" => {
parsed.artifact_root = take_path(&mut args, "--artifact-root")?;
}
@ -51,14 +49,6 @@ impl Args {
fn run_smoke(args: &Args) -> Result<Value> {
let root = env::current_dir().context("failed to resolve current dir")?;
let app_server = absolute_path(&args.app_server)?;
ensure_default_app_server_built(&root, &app_server)?;
if !app_server.exists() {
return Err(anyhow!(
"codex app-server binary not found: {}",
app_server.display()
));
}
let artifact_root = absolute_path(&args.artifact_root)?;
reset_artifact_root(&root, &artifact_root)?;
let coordinator = match &args.coordinator_exe {
@ -72,7 +62,6 @@ fn run_smoke(args: &Args) -> Result<Value> {
let cold = run_coordinator(
&root,
&coordinator,
&app_server,
&artifact_root,
RunOptions {
name: "cold",
@ -95,7 +84,6 @@ fn run_smoke(args: &Args) -> Result<Value> {
let local = run_coordinator(
&root,
&coordinator,
&app_server,
&artifact_root,
RunOptions {
name: "local-bootstrap",
@ -118,7 +106,6 @@ fn run_smoke(args: &Args) -> Result<Value> {
let pressure = run_coordinator(
&root,
&coordinator,
&app_server,
&artifact_root,
RunOptions {
name: "pressure",
@ -149,7 +136,6 @@ fn run_smoke(args: &Args) -> Result<Value> {
let hands_gate = run_coordinator(
&root,
&coordinator,
&app_server,
&artifact_root,
RunOptions {
name: "hands-gate",
@ -233,7 +219,6 @@ struct RunOptions {
fn run_coordinator(
root: &Path,
coordinator: &Path,
app_server: &Path,
artifact_root: &Path,
options: RunOptions,
) -> Result<Value> {
@ -241,8 +226,6 @@ fn run_coordinator(
let mut command = Command::new(coordinator);
command
.current_dir(root)
.arg("--app-server")
.arg(app_server)
.arg("--artifact-dir")
.arg(&artifact_dir)
.arg("--runtime-store")
@ -301,6 +284,13 @@ fn record_hands_pass(hands_action: &Path, summary: &Value) -> Result<Value> {
let stderr_artifact = artifact_dir.join("hands-pass-command.stderr.log");
fs::write(&stdout_artifact, "hands pass smoke command output\n")?;
fs::write(&stderr_artifact, "")?;
let commit = Command::new("git")
.args(["log", "-1", "--format=%H", "--", "tools/epiphany_local_run.ps1"])
.output()
.context("failed to locate a real commit for the Hands smoke path")?;
require(commit.status.success(), "failed to resolve Hands smoke commit")?;
let commit_sha = String::from_utf8(commit.stdout)?.trim().to_string();
require(!commit_sha.is_empty(), "Hands smoke path has no commit history")?;
let output = Command::new(hands_action)
.arg("--store")
.arg(artifact_dir.join("runtime-spine.msgpack"))
@ -320,9 +310,9 @@ fn record_hands_pass(hands_action: &Path, summary: &Value) -> Result<Value> {
.arg("--stderr-artifact")
.arg(&stderr_artifact)
.arg("--commit-sha")
.arg("dry-run-smoke")
.arg(commit_sha)
.arg("--branch")
.arg("coordinator-smoke")
.arg("main")
.output()
.context("failed to run Hands action recorder")?;
if !output.status.success() {
@ -348,8 +338,6 @@ fn require_artifacts(summary: &Value) -> Result<()> {
"coordinator-final-status.json",
"coordinator-final-status.txt",
"coordinator-final-action.txt",
"epiphany-transcript.jsonl",
"epiphany-server.stderr.log",
"agent-function-telemetry.json",
"runtime-spine-status.json",
] {
@ -373,6 +361,14 @@ fn require_artifacts(summary: &Value) -> Result<()> {
runtime_status["sessions"].as_u64().unwrap_or(0) >= 1,
"native runtime spine should record a session",
)?;
let telemetry: Value = serde_json::from_str(&fs::read_to_string(
artifact_dir.join("agent-function-telemetry.json"),
)?)?;
require(
telemetry["appServerCalls"].as_u64() == Some(0)
&& telemetry["transport"].as_str() == Some("cultcache"),
"native coordinator telemetry must prove zero app-server calls",
)?;
Ok(())
}
@ -454,40 +450,6 @@ fn ensure_epiphany_bin_built(root: &Path, binary: &Path, bin_name: &str) -> Resu
)
}
fn ensure_default_app_server_built(root: &Path, app_server: &Path) -> Result<()> {
let default_app_server = PathBuf::from(DEFAULT_APP_SERVER);
if app_server != default_app_server {
return Ok(());
}
if app_server.exists() {
return Ok(());
}
let status = Command::new("cargo")
.current_dir(root)
.env("CARGO_TARGET_DIR", r"C:\Users\Meta\.cargo-target-codex")
.arg("build")
.arg("--manifest-path")
.arg(
root.join("vendor")
.join("codex")
.join("codex-rs")
.join("Cargo.toml"),
)
.arg("-p")
.arg("codex-app-server")
.arg("--bin")
.arg("codex-app-server")
.status()
.context("failed to build default codex-app-server")?;
require(
status.success() && app_server.exists(),
&format!(
"default codex-app-server binary was not built: {}",
app_server.display()
),
)
}
fn absolute_path(path: &Path) -> Result<PathBuf> {
if path.is_absolute() {
Ok(path.to_path_buf())

View file

@ -50,7 +50,6 @@ const DETACHED_PROCESS: u32 = 0x0000_0008;
#[path = "epiphany-mvp-status.rs"]
mod status_cli;
const DEFAULT_APP_SERVER: &str = r"C:\Users\Meta\.cargo-target-codex\debug\codex-app-server.exe";
const DEFAULT_MODEL_RUNTIME_BIN: &str = "epiphany-model-runtime";
const DEFAULT_TOOL_ADAPTER_BIN: &str = "epiphany-tool-codex-mcp-spine";
const WORKER_AUTO_TOOL_MAX_ROUNDS: usize = 24;
@ -66,7 +65,6 @@ fn main() -> Result<()> {
#[derive(Debug)]
struct Args {
app_server: PathBuf,
model_runtime_bin: PathBuf,
tool_adapter_bin: PathBuf,
model_provider: String,
@ -100,7 +98,6 @@ impl Args {
let root = env::current_dir().context("failed to resolve current dir")?;
let mut args = env::args().skip(1);
let mut parsed = Args {
app_server: PathBuf::from(DEFAULT_APP_SERVER),
model_runtime_bin: PathBuf::from(DEFAULT_MODEL_RUNTIME_BIN),
tool_adapter_bin: PathBuf::from(DEFAULT_TOOL_ADAPTER_BIN),
model_provider: "openai-codex".to_string(),
@ -135,7 +132,9 @@ impl Args {
};
while let Some(arg) = args.next() {
match arg.as_str() {
"--app-server" => parsed.app_server = take_path(&mut args, "--app-server")?,
"--app-server" => {
let _ = take_path(&mut args, "--app-server")?;
}
"--model-runtime-bin" => {
parsed.model_runtime_bin = take_path(&mut args, "--model-runtime-bin")?;
}
@ -210,7 +209,6 @@ fn run_coordinator(args: &Args) -> Result<Value> {
let root = env::current_dir().context("failed to resolve current dir")?;
let local_verse_store = status_cli::absolute_path(&args.local_verse_store)?;
assert_local_verse_brake_released(&local_verse_store, "epiphany-mvp-coordinator")?;
let app_server = status_cli::absolute_path(&args.app_server)?;
let mut cwd = status_cli::absolute_path(&args.cwd)?;
let model_runtime_bin = resolve_model_runtime_bin(&root, &args.model_runtime_bin)?;
let tool_adapter_bin = resolve_model_runtime_bin(&root, &args.tool_adapter_bin)?;
@ -225,8 +223,6 @@ fn run_coordinator(args: &Args) -> Result<Value> {
prepare_workspace(&cwd)?;
}
let transcript_path = artifact_dir.join("epiphany-transcript.jsonl");
let stderr_path = artifact_dir.join("epiphany-server.stderr.log");
let telemetry_path = artifact_dir.join("agent-function-telemetry.json");
let steps_path = artifact_dir.join("coordinator-steps.jsonl");
let mut steps = Vec::new();
@ -235,39 +231,16 @@ fn run_coordinator(args: &Args) -> Result<Value> {
let mut final_status = Value::Null;
let mut final_action = Value::Null;
let mut client = status_cli::AppServerClient::start(
&app_server,
&codex_home,
&transcript_path,
&stderr_path,
)?;
client.send(
"initialize",
Some(json!({
"clientInfo": {
"name": "epiphany-mvp-coordinator",
"title": "Epiphany MVP Coordinator",
"version": "0.1.0",
},
"capabilities": {"experimentalApi": true},
})),
true,
)?;
client.send("initialized", None, false)?;
let thread_id = if let Some(thread_id) = &args.thread_id {
let resumed = client.send("thread/resume", Some(json!({"threadId": thread_id})), true)?;
startup_events.push(thread_lifecycle_event("threadResume", &resumed));
thread_id.clone()
} else {
let started = client.send(
"thread/start",
Some(json!({"cwd": cwd, "ephemeral": args.ephemeral})),
true,
)?;
startup_events.push(thread_lifecycle_event("threadStart", &started));
text_at(&started, &["thread", "id"])?
};
let thread_id = args
.thread_id
.clone()
.unwrap_or_else(|| format!("epiphany-native-{}", Uuid::new_v4()));
startup_events.push(json!({
"type": "nativeCoordinatorThread",
"threadId": thread_id,
"ephemeral": args.ephemeral,
"workspace": cwd,
}));
let runtime_session_id = format!("coordinator-{thread_id}");
let runtime_identity = initialize_runtime_spine(
&runtime_store,
@ -321,17 +294,8 @@ fn run_coordinator(args: &Args) -> Result<Value> {
}));
if args.bootstrap_smoke_state {
client.send(
"thread/epiphany/update",
Some(json!({"threadId": thread_id, "expectedRevision": 0, "patch": reorient_patch()})),
true,
)?;
apply_bootstrap_patch(&runtime_store, &thread_id, reorient_patch())?;
if args.simulate_source_drift {
let _ = client.send(
"thread/epiphany/freshness",
Some(json!({"threadId": thread_id})),
true,
);
fs::write(
cwd.join(WATCHED_RELATIVE_PATH),
"pub fn reorient_target() -> &'static str {\n \"after\"\n}\n",
@ -339,14 +303,10 @@ fn run_coordinator(args: &Args) -> Result<Value> {
thread::sleep(Duration::from_millis(500));
}
} else if args.bootstrap_local_state {
client.send(
"thread/epiphany/update",
Some(json!({
"threadId": thread_id,
"expectedRevision": 0,
"patch": local_mvp_checkpoint_patch(&cwd, args.bootstrap_objective.as_deref()),
})),
true,
apply_bootstrap_patch(
&runtime_store,
&thread_id,
local_mvp_checkpoint_patch(&cwd, args.bootstrap_objective.as_deref()),
)?;
}
@ -427,8 +387,13 @@ fn run_coordinator(args: &Args) -> Result<Value> {
}
if args.supersede_failed_results && role_result_needs_supersession(role_id, &result)
{
let superseded =
supersede_role_result(&mut client, &thread_id, role_id, revision, &result)?;
let superseded = supersede_role_result(
&runtime_store,
&thread_id,
role_id,
revision,
&result,
)?;
push_event(
&mut step,
json!({"type": "roleFailureReview", "roleId": role_id, "superseded": status_cli::sanitize_for_operator(superseded)}),
@ -572,8 +537,12 @@ fn run_coordinator(args: &Args) -> Result<Value> {
}
}
"launchReorientWorker" => {
let launch =
launch_reorient(&mut client, &thread_id, revision, args.max_runtime_seconds)?;
let launch = launch_reorient(
&runtime_store,
&thread_id,
revision,
args.max_runtime_seconds,
)?;
let worker_job_id = worker_job_id_from_launch(&launch)?;
push_event(
&mut step,
@ -655,10 +624,7 @@ fn run_coordinator(args: &Args) -> Result<Value> {
"agent-function-telemetry.json".to_string(),
"runtime-spine-status.json".to_string(),
];
let sealed_artifact_manifest = vec![
"epiphany-transcript.jsonl".to_string(),
"epiphany-server.stderr.log".to_string(),
];
let sealed_artifact_manifest = Vec::new();
let receipt_created_at = now();
let coordinator_run_receipt = EpiphanyCoordinatorRunReceipt {
schema_version: COORDINATOR_RUN_RECEIPT_SCHEMA_VERSION.to_string(),
@ -699,7 +665,7 @@ fn run_coordinator(args: &Args) -> Result<Value> {
};
put_coordinator_run_receipt(&runtime_store, &coordinator_run_receipt)?;
let summary = json!({
"objective": "Coordinate the Epiphany MVP lanes over existing app-server APIs.",
"objective": "Coordinate the Epiphany MVP lanes through native typed state and runtime organs.",
"artifactDir": artifact_dir,
"modelRuntimeBin": model_runtime_bin,
"toolAdapterBin": tool_adapter_bin,
@ -722,10 +688,7 @@ fn run_coordinator(args: &Args) -> Result<Value> {
"store": runtime_store,
},
"artifactManifest": artifact_manifest,
"sealedArtifactManifest": [
{"path": "epiphany-transcript.jsonl", "reason": "sealed JSON-RPC audit trail; do not read during normal supervision"},
{"path": "epiphany-server.stderr.log", "reason": "sealed app-server diagnostics; inspect only for explicit debugging"}
]
"sealedArtifactManifest": []
});
write_json(&artifact_dir.join("coordinator-summary.json"), &summary)?;
write_json(
@ -747,7 +710,15 @@ fn run_coordinator(args: &Args) -> Result<Value> {
serde_json::to_string_pretty(&summary["finalAction"])?
),
)?;
status_cli::write_transcript_telemetry(&transcript_path, &telemetry_path)?;
write_json(
&telemetry_path,
&json!({
"source": "epiphany-native-coordinator",
"transport": "cultcache",
"appServerCalls": 0,
"rawTextExposed": false,
}),
)?;
Ok(summary)
}
@ -787,6 +758,22 @@ fn collect_coordinator_status(runtime_store: &Path, thread_id: &str) -> Result<V
],
)
}
fn apply_bootstrap_patch(runtime_store: &Path, thread_id: &str, patch: Value) -> Result<Value> {
let patch: epiphany_core::EpiphanyRoleStatePatchDocument =
serde_json::from_value(patch).context("failed to decode typed bootstrap state patch")?;
let service = epiphany_core::EpiphanyCoordinatorService::new(runtime_store, runtime_store);
let applied = service.apply_state_update(
thread_id,
epiphany_core::state_update_from_role_patch(Some(0), patch),
None,
)?;
Ok(json!({
"revision": applied.revision,
"changedFields": applied.changed_fields.iter().map(|field| format!("{field:?}")).collect::<Vec<_>>(),
"epiphanyState": applied.state,
}))
}
fn resolve_model_runtime_bin(root: &Path, configured: &Path) -> Result<PathBuf> {
if configured.components().count() != 1 {
return status_cli::absolute_path(configured);
@ -1148,7 +1135,7 @@ fn role_result_needs_supersession(role_id: &str, result: &Value) -> bool {
}
fn supersede_role_result(
client: &mut status_cli::AppServerClient,
runtime_store: &Path,
thread_id: &str,
role_id: &str,
expected_revision: Option<i64>,
@ -1162,27 +1149,35 @@ fn supersede_role_result(
.unwrap_or_else(|| default_binding_id_for_role(role_id));
let summary = first_string_at(result, &[&["finding", "summary"], &["note"]])
.unwrap_or_else(|| "Role result reviewed and superseded.".to_string());
let receipt = json!({
"id": format!("role-failure-review-{}", Uuid::new_v4()),
"result_id": result_id,
"job_id": job_id,
"binding_id": binding_id,
"surface": "roleFailureReview",
"role_id": role_id,
"status": "superseded",
"accepted_at": now(),
"summary": summary,
});
let mut payload = json!({
"threadId": thread_id,
"patch": {
"acceptanceReceipts": [receipt],
let receipt = epiphany_state_model::EpiphanyAcceptanceReceipt {
id: format!("role-failure-review-{}", Uuid::new_v4()),
result_id,
job_id,
binding_id,
surface: "roleFailureReview".to_string(),
role_id: role_id.to_string(),
status: "superseded".to_string(),
accepted_at: now(),
accepted_observation_id: None,
accepted_evidence_id: None,
summary: Some(summary),
};
let service = epiphany_core::EpiphanyCoordinatorService::new(runtime_store, runtime_store);
let applied = service.apply_state_update(
thread_id,
epiphany_core::EpiphanyStateUpdate {
expected_revision: expected_revision.and_then(|value| u64::try_from(value).ok()),
acceptance_receipts: vec![receipt.clone()],
..Default::default()
},
});
if let Some(revision) = expected_revision {
payload["expectedRevision"] = json!(revision);
}
client.send("thread/epiphany/update", Some(payload), true)
None,
)?;
Ok(json!({
"revision": applied.revision,
"changedFields": applied.changed_fields.iter().map(|field| format!("{field:?}")).collect::<Vec<_>>(),
"epiphanyState": applied.state,
"receipt": receipt,
}))
}
fn default_binding_id_for_role(role_id: &str) -> String {
@ -1196,16 +1191,55 @@ fn default_binding_id_for_role(role_id: &str) -> String {
}
fn launch_reorient(
client: &mut status_cli::AppServerClient,
runtime_store: &Path,
thread_id: &str,
expected_revision: Option<i64>,
max_runtime_seconds: u64,
) -> Result<Value> {
let mut payload = json!({"threadId": thread_id, "maxRuntimeSeconds": max_runtime_seconds});
if let Some(revision) = expected_revision {
payload["expectedRevision"] = json!(revision);
}
client.send("thread/epiphany/reorientLaunch", Some(payload), true)
let service = epiphany_core::EpiphanyCoordinatorService::new(runtime_store, runtime_store);
let state = service
.state()?
.ok_or_else(|| anyhow!("cannot launch reorientation without native coordinator state"))?;
let checkpoint = state
.investigation_checkpoint
.as_ref()
.ok_or_else(|| anyhow!("cannot launch reorientation without a durable checkpoint"))?;
let status = collect_coordinator_status(runtime_store, thread_id)?;
let decision: epiphany_core::EpiphanyReorientDecision =
serde_json::from_value(status["reorient"]["decision"].clone())
.context("native reorientation status did not contain a typed decision")?;
let context = epiphany_core::render_launch_dynamic_prompt_context(
runtime_store,
&state,
epiphany_core::reorient_launch_context_focus(&state, &decision.next_action),
)
.map_err(anyhow::Error::msg)?;
let expected_revision = expected_revision.and_then(|value| u64::try_from(value).ok());
let request = epiphany_core::build_epiphany_reorient_launch_request_with_dynamic_context(
thread_id,
expected_revision,
Some(max_runtime_seconds),
&state,
checkpoint,
&decision,
Some(context),
);
let launched = service.launch_job(
thread_id,
&state,
&request,
format!("epiphany-heartbeat-launch-{}", Uuid::new_v4()),
Uuid::new_v4().to_string(),
now(),
)?;
Ok(json!({
"bindingId": launched.binding_id,
"launcherJobId": launched.launcher_job_id,
"backendJobId": launched.backend_job_id,
"revision": launched.epiphany_state.revision,
"epiphanyState": launched.epiphany_state,
"decision": decision,
}))
}
fn worker_job_id_from_launch(launch: &Value) -> Result<String> {
@ -1684,16 +1718,6 @@ fn state_revision(status: &Value) -> Option<i64> {
})
}
fn thread_lifecycle_event(kind: &str, response: &Value) -> Value {
json!({
"type": kind,
"threadId": response.pointer("/thread/id"),
"status": response.pointer("/thread/status"),
"cwd": response.pointer("/thread/cwd"),
"ephemeral": response.pointer("/thread/ephemeral"),
})
}
fn push_event(step: &mut Value, event: Value) {
step["events"].as_array_mut().unwrap().push(event);
}
@ -1741,17 +1765,6 @@ fn append_operator_step_jsonl(path: &Path, step: &Value) -> Result<()> {
append_jsonl(path, &status_cli::sanitize_for_operator(step.clone()))
}
fn text_at(value: &Value, path: &[&str]) -> Result<String> {
let mut cursor = value;
for key in path {
cursor = &cursor[*key];
}
cursor
.as_str()
.map(ToString::to_string)
.ok_or_else(|| anyhow!("missing string at {}", path.join(".")))
}
fn take_string(args: &mut impl Iterator<Item = String>, name: &str) -> Result<String> {
args.next()
.ok_or_else(|| anyhow!("{name} requires a value"))
@ -1772,6 +1785,18 @@ fn home_dir() -> PathBuf {
mod tests {
use super::*;
#[test]
fn coordinator_binary_has_no_codex_host_or_epiphany_json_rpc_dependency() {
let source = include_str!("epiphany-mvp-coordinator.rs");
let production = source.split("#[cfg(test)]").next().unwrap_or(source);
for forbidden in ["AppServerClient", "thread/epiphany/", "codex-app-server"] {
assert!(
!production.contains(forbidden),
"native coordinator regrew host dependency {forbidden:?}"
);
}
}
#[test]
fn coordinator_status_and_result_reads_are_native() {
let source = include_str!("epiphany-mvp-coordinator.rs");

View file

@ -37,7 +37,7 @@ use epiphany_core::derive_pressure_view;
use epiphany_core::derive_role_board;
use epiphany_core::derive_scene;
use epiphany_core::interpret_runtime_role_worker_result;
use epiphany_core::load_thread_state_entry;
use epiphany_core::read_accepted_coordinator_state;
use epiphany_core::recommend_crrc_action;
use epiphany_core::recommend_reorientation;
use epiphany_core::runtime_job_snapshot;
@ -253,8 +253,8 @@ fn run_native_status(args: &Args) -> Result<Value> {
let cwd = absolute_path(&args.cwd)?;
let store_path = absolute_path(&args.thread_state_store)?;
let runtime_store_path = absolute_path(&args.runtime_store)?;
let state_entry = if store_path.exists() {
load_thread_state_entry(&store_path)
let state = if store_path.exists() {
read_accepted_coordinator_state(&store_path)
.with_context(|| format!("failed to load {}", store_path.display()))?
} else {
None
@ -262,13 +262,7 @@ fn run_native_status(args: &Args) -> Result<Value> {
let thread_id = args
.thread_id
.clone()
.or_else(|| state_entry.as_ref().map(|entry| entry.thread_id.clone()))
.unwrap_or_else(|| "native-local".to_string());
let state = state_entry
.as_ref()
.map(|entry| entry.state())
.transpose()
.context("failed to decode native Epiphany thread state")?;
let state_ref = state.as_ref();
let loaded = state_ref.is_some();
@ -1801,11 +1795,16 @@ pub fn write_transcript_telemetry(transcript: &Path, output: &Path) -> Result<()
}
pub fn native_json(bin_name: &str, args: &[&str]) -> Result<Value> {
let exe = PathBuf::from(
let sibling = env::current_exe()
.ok()
.and_then(|path| path.parent().map(Path::to_path_buf))
.map(|path| path.join(format!("{bin_name}.exe")));
let configured = PathBuf::from(
env::var("CARGO_TARGET_DIR").unwrap_or_else(|_| DEFAULT_CARGO_TARGET_DIR.to_string()),
)
.join("debug")
.join(format!("{bin_name}.exe"));
let exe = sibling.filter(|path| path.exists()).unwrap_or(configured);
let output = if exe.exists() {
Command::new(&exe).args(args).output()
} else {

View file

@ -464,7 +464,6 @@ pub fn reorient_acceptance_claimed_effects() -> Vec<EpiphanyReceiptEffectKind> {
pub fn coordinator_acceptance_cache(store_path: &Path) -> anyhow::Result<CultCache> {
let mut cache = runtime_spine_cache(store_path)?;
cache.register_entry_type::<EpiphanyThreadStateEntry>()?;
cache.pull_all_backing_stores()?;
Ok(cache)
}
@ -706,6 +705,13 @@ fn state_update_from_patch(
}
}
pub fn state_update_from_role_patch(
expected_revision: Option<u64>,
patch: EpiphanyRoleStatePatchDocument,
) -> EpiphanyStateUpdate {
state_update_from_patch(expected_revision, patch)
}
fn changed_fields_from_patch(
patch: &EpiphanyRoleStatePatchDocument,
) -> Vec<EpiphanyStateUpdatedField> {

View file

@ -1,9 +1,11 @@
use crate::EpiphanyStateUpdate;
use crate::EpiphanyStateUpdatedField;
use crate::EpiphanyThreadStateEntry;
use crate::THREAD_STATE_KEY;
use crate::apply_epiphany_state_update;
use crate::coordinator_acceptance_cache;
use crate::epiphany_state_update_validation_errors;
use crate::load_thread_state;
use crate::write_thread_state;
use crate::read_accepted_coordinator_state;
use anyhow::Result;
use anyhow::anyhow;
use epiphany_state_model::EpiphanyThreadState;
@ -17,7 +19,7 @@ pub struct EpiphanyCoordinatorStateApplied {
}
pub fn read_coordinator_state(store: &Path) -> Result<Option<EpiphanyThreadState>> {
load_thread_state(store)
read_accepted_coordinator_state(store)
}
pub fn apply_coordinator_state_update(
@ -32,7 +34,9 @@ pub fn apply_coordinator_state_update(
update,
reference_turn_id,
)?;
write_thread_state(store, thread_id, &state)?;
let mut cache = coordinator_acceptance_cache(store)?;
let entry = EpiphanyThreadStateEntry::from_state(thread_id, &state)?;
cache.put(THREAD_STATE_KEY, &entry)?;
Ok(EpiphanyCoordinatorStateApplied {
revision: state.revision,
changed_fields,

View file

@ -145,6 +145,7 @@ pub use coordinator_acceptance::read_accepted_coordinator_state;
pub use coordinator_acceptance::reorient_acceptance_claimed_effects;
pub use coordinator_acceptance::role_acceptance_claimed_effects;
pub use coordinator_acceptance::role_acceptance_enforceable_receipts;
pub use coordinator_acceptance::state_update_from_role_patch;
pub use coordinator_launch::EpiphanyCoordinatorJobLaunchPlan;
pub use coordinator_launch::commit_coordinator_job_launch;
pub use coordinator_launch::plan_coordinator_job_launch;

View file

@ -711,6 +711,7 @@ pub struct EpiphanyRuntimeJobSnapshot {
pub fn runtime_spine_cache(store_path: impl AsRef<Path>) -> Result<CultCache> {
let store_path = store_path.as_ref();
let mut cache = CultCache::new();
cache.register_entry_type::<crate::EpiphanyThreadStateEntry>()?;
cache.register_entry_type::<EpiphanyRuntimeIdentity>()?;
cache.register_entry_type::<EpiphanyRuntimeSession>()?;
cache.register_entry_type::<EpiphanyRuntimeJob>()?;

View file

@ -1861,9 +1861,20 @@ Codex view/result calls were deleted and a source test rejects AppServerClient o
Verse/memory context, appends Verification Hands evidence or Modeling work-loop
telemetry, builds the typed request, and calls the atomic service launch.
`accept_role` calls the service acceptance actuator directly. A source test
guards every required context seam and rejects AppServerClient/routes. Five
production routes remain: bootstrap update/freshness, supersession update, and
reorientation launch.
guards every required context seam and rejects AppServerClient/routes.
The coordinator liberation cut is now complete at runtime. Reorientation launch,
bootstrap, and supersession use typed native service operations; the binary
starts no app-server and contains no production Epiphany JSON-RPC route. Native
status and runtime caches now share the heterogeneous state/runtime schema, and
native binary lookup prefers the current executable's siblings instead of a
stale global Cargo target. `epiphany-mvp-coordinator-smoke` no longer builds or
requires codex-app-server; live proof at
`.epiphany-dogfood/native-coordinator-liberation` passed cold, local-bootstrap,
pressure, Hands gate, and real historical commit receipt checks with telemetry
`appServerCalls=0`. The next visible lie is role-board `authorityScopes` still
naming old `thread/epiphany/*` methods; replace them with native/CultNet typed
capability identifiers.
## Immediate Re-entry Instruction

View file

@ -244,5 +244,17 @@ Role mutation has now crossed too. `epiphany-mvp-coordinator` builds role launch
requests from native state plus the full native Verse/memory/work-loop context,
publishes them through `EpiphanyCoordinatorService::launch_job`, and dispatches
auto-review through `accept_role`. The role launch and role acceptance routes
are gone. Bootstrap/freshness, supersession update, and reorientation launch are
the five remaining production route strings.
are gone.
`epiphany-mvp-coordinator` is now fully native. Reorientation launch consumes
the typed native status decision, preserves native prompt context, and uses the
same atomic launch actuator. Bootstrap and supersession use typed state updates.
The binary starts no app-server, contains no production `thread/epiphany/*`
strings, and emits telemetry with `appServerCalls=0`. Its smoke harness no
longer builds or requires codex-app-server and passes cold, local bootstrap,
pressure, Hands gate, and real commit-receipt scenarios.
The live output still advertises old JSON-RPC method names in role-board
`authorityScopes`. Those strings are presentation residue, not callable
coordinator authority, but they now lie about the native body and must be
replaced by typed native/CultNet capability identifiers.

Binary file not shown.

View file

@ -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: Replace the five remaining `epiphany-mvp-coordinator` mutation routes: bootstrap update/freshness, failure supersession update, and reorientation launch. Status/results plus role launch/acceptance are native and preserve full Verse/memory/work-loop context. Remove AppServerClient startup after these final routes are cut.
next_action: Purge stale `thread/epiphany/*` authority labels from native role-board/status projections and replace them with typed native/CultNet capability identifiers. `epiphany-mvp-coordinator` itself is fully native, starts no app-server, has zero production route strings, and passes its multi-scenario smoke with `appServerCalls=0`.