Add fixed Eyes research lane

This commit is contained in:
Meta Vens 2026-05-30 01:02:16 +01:00
commit 2b3b446489
31 changed files with 593 additions and 57 deletions

View file

@ -8,10 +8,10 @@ use epiphany_core::epiphany_cultmesh_operator_snapshot_from_status_json;
use epiphany_core::load_epiphany_cultmesh_operator_status;
use epiphany_core::load_epiphany_cultmesh_status;
use epiphany_core::load_latest_epiphany_cultmesh_operator_snapshot;
use epiphany_core::write_epiphany_cultmesh_continuity_contracts;
use epiphany_core::write_epiphany_cultmesh_eyes_contracts;
use epiphany_core::write_epiphany_cultmesh_global_room_policies;
use epiphany_core::write_epiphany_cultmesh_hands_contracts;
use epiphany_core::write_epiphany_cultmesh_continuity_contracts;
use epiphany_core::write_epiphany_cultmesh_mind_contracts;
use epiphany_core::write_epiphany_cultmesh_operator_snapshot;
use epiphany_core::write_epiphany_cultmesh_operator_status;

View file

@ -52,6 +52,7 @@ 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: {}",
@ -332,9 +333,6 @@ fn sibling_exe(name: &str) -> Result<PathBuf> {
}
fn ensure_coordinator_built(root: &Path, coordinator: &Path) -> Result<()> {
if coordinator.exists() {
return Ok(());
}
let status = Command::new("cargo")
.current_dir(root)
.arg("build")
@ -353,6 +351,37 @@ fn ensure_coordinator_built(root: &Path, coordinator: &Path) -> Result<()> {
)
}
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(());
}
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

@ -366,12 +366,9 @@ fn run_coordinator(args: &Args) -> Result<Value> {
let revision = state_revision(&status);
match action.as_str() {
"reviewModelingResult" | "reviewVerificationResult" => {
let role_id = if action == "reviewModelingResult" {
"modeling"
} else {
"verification"
};
"reviewResearchResult" | "reviewModelingResult" | "reviewVerificationResult" => {
let role_id = role_id_for_coordinator_action(&action)
.ok_or_else(|| anyhow!("unsupported review action {action}"))?;
let result = client.send(
"thread/epiphany/roleResult",
Some(json!({"threadId": thread_id, "roleId": role_id})),
@ -386,7 +383,7 @@ fn run_coordinator(args: &Args) -> Result<Value> {
Some("completed" | "failed" | "cancelled")
) {
final_action = json!({
"action": if role_id == "modeling" { "waitForModelingResult" } else { "waitForVerificationResult" },
"action": wait_action_for_role(role_id),
"reason": result["note"],
});
append_jsonl(&steps_path, &step)?;
@ -398,7 +395,7 @@ fn run_coordinator(args: &Args) -> Result<Value> {
&& revision.is_some();
if !can_accept {
final_action = json!({
"action": if role_id == "modeling" { "reviewModelingResult" } else { "reviewVerificationResult" },
"action": review_action_for_role(role_id),
"reason": result["note"]
});
append_jsonl(&steps_path, &step)?;
@ -446,12 +443,9 @@ fn run_coordinator(args: &Args) -> Result<Value> {
steps.push(step);
break;
}
"launchModeling" | "launchVerification" => {
let role_id = if action == "launchModeling" {
"modeling"
} else {
"verification"
};
"launchResearch" | "launchModeling" | "launchVerification" => {
let role_id = role_id_for_coordinator_action(&action)
.ok_or_else(|| anyhow!("unsupported launch action {action}"))?;
let launch = launch_role(
&mut client,
&thread_id,
@ -493,7 +487,7 @@ fn run_coordinator(args: &Args) -> Result<Value> {
Some("completed" | "failed" | "cancelled")
) {
final_action = json!({
"action": if role_id == "modeling" { "waitForModelingResult" } else { "waitForVerificationResult" },
"action": wait_action_for_role(role_id),
"reason": result["note"],
});
append_jsonl(&steps_path, &step)?;
@ -502,7 +496,7 @@ fn run_coordinator(args: &Args) -> Result<Value> {
}
if !args.auto_review {
final_action = json!({
"action": if role_id == "modeling" { "reviewModelingResult" } else { "reviewVerificationResult" },
"action": review_action_for_role(role_id),
"reason": result["note"],
});
append_jsonl(&steps_path, &step)?;
@ -723,6 +717,7 @@ fn collect_coordinator_status(
let planning = view.get("planning").cloned().unwrap_or_else(|| json!(null));
let role_results = json!({
"imagination": client.send("thread/epiphany/roleResult", Some(json!({"threadId": thread_id, "roleId": "imagination"})), true)?,
"research": client.send("thread/epiphany/roleResult", Some(json!({"threadId": thread_id, "roleId": "research"})), true)?,
"modeling": client.send("thread/epiphany/roleResult", Some(json!({"threadId": thread_id, "roleId": "modeling"})), true)?,
"verification": client.send("thread/epiphany/roleResult", Some(json!({"threadId": thread_id, "roleId": "verification"})), true)?,
});
@ -827,6 +822,33 @@ fn launch_role(
client.send("thread/epiphany/roleLaunch", Some(payload), true)
}
fn role_id_for_coordinator_action(action: &str) -> Option<&'static str> {
match action {
"launchResearch" | "reviewResearchResult" => Some("research"),
"launchModeling" | "reviewModelingResult" => Some("modeling"),
"launchVerification" | "reviewVerificationResult" => Some("verification"),
_ => None,
}
}
fn wait_action_for_role(role_id: &str) -> &'static str {
match role_id {
"research" => "waitForResearchResult",
"modeling" => "waitForModelingResult",
"verification" => "waitForVerificationResult",
_ => "waitForRoleResult",
}
}
fn review_action_for_role(role_id: &str) -> &'static str {
match role_id {
"research" => "reviewResearchResult",
"modeling" => "reviewModelingResult",
"verification" => "reviewVerificationResult",
_ => "reviewRoleResult",
}
}
fn launch_reorient(
client: &mut status_cli::AppServerClient,
thread_id: &str,

View file

@ -245,11 +245,12 @@ fn validate_status(status: &Value, rendered: &str) -> Result<()> {
== [
"implementation",
"imagination",
"research",
"modeling",
"verification",
"reorientation",
],
"roles surface should expose the five MVP role lanes",
"roles surface should expose the six MVP role lanes",
)?;
require(
status
@ -283,6 +284,10 @@ fn validate_status(status: &Value, rendered: &str) -> Result<()> {
.pointer("/roleResults/imagination/status")
.and_then(Value::as_str)
== Some("missingState")
&& status
.pointer("/roleResults/research/status")
.and_then(Value::as_str)
== Some("missingState")
&& status
.pointer("/roleResults/modeling/status")
.and_then(Value::as_str)

View file

@ -56,6 +56,7 @@ const DEFAULT_THREAD_STATE_STORE: &str = "state/thread-state.msgpack";
const DEFAULT_RUNTIME_STORE: &str = "state/runtime-spine.msgpack";
const REORIENT_BINDING_ID: &str = "reorient-worker";
const IMAGINATION_BINDING_ID: &str = "imagination-synthesis-worker";
const RESEARCH_BINDING_ID: &str = "research-source-gather-worker";
const MODELING_BINDING_ID: &str = "modeling-checkpoint-worker";
const VERIFICATION_BINDING_ID: &str = "verification-review-worker";
const SEALED_DIRECT_THOUGHT_KEYS: &[&str] = &[
@ -253,6 +254,8 @@ fn run_native_status(args: &Args) -> Result<Value> {
native_reorient_result_status(state_ref, &runtime_store_path, REORIENT_BINDING_ID);
let modeling_result_status =
native_role_result_status(state_ref, &runtime_store_path, MODELING_BINDING_ID);
let research_result_status =
native_role_result_status(state_ref, &runtime_store_path, RESEARCH_BINDING_ID);
let verification_result_status =
native_role_result_status(state_ref, &runtime_store_path, VERIFICATION_BINDING_ID);
let recommendation = recommend_crrc_action(EpiphanyCrrcInput {
@ -308,12 +311,14 @@ fn run_native_status(args: &Args) -> Result<Value> {
.find(|job| job.id == REORIENT_BINDING_ID)
.cloned(),
imagination_binding_id: IMAGINATION_BINDING_ID.to_string(),
research_binding_id: RESEARCH_BINDING_ID.to_string(),
modeling_binding_id: MODELING_BINDING_ID.to_string(),
verification_binding_id: VERIFICATION_BINDING_ID.to_string(),
reorient_owner_role: "epiphany-reorienter".to_string(),
imagination_owner_role: "epiphany-imagination".to_string(),
research_owner_role: "epiphany-eyes".to_string(),
});
let finding_signals = derive_coordinator_finding_signals(state_ref, None, None, None);
let finding_signals = derive_coordinator_finding_signals(state_ref, None, None, None, None);
let coordinator = derive_coordinator_status(EpiphanyCoordinatorStatusInput {
state_status,
checkpoint_present: state_ref
@ -323,9 +328,13 @@ fn run_native_status(args: &Args) -> Result<Value> {
recommendation: recommendation.clone(),
roles: roles.clone(),
reorient_action: reorient_decision.action,
research_result_status,
modeling_result_status,
verification_result_status,
reorient_result_status: result_status,
research_result_accepted: finding_signals.research_result_accepted,
research_result_reviewable: finding_signals.research_result_reviewable,
modeling_result_requests_regather: finding_signals.modeling_result_requests_regather,
modeling_result_accepted: finding_signals.modeling_result_accepted,
modeling_result_reviewable: finding_signals.modeling_result_reviewable,
modeling_result_accepted_after_verification: finding_signals
@ -409,6 +418,7 @@ fn run_native_status(args: &Args) -> Result<Value> {
"planning": planning,
"roleResults": {
"imagination": native_role_result(state_ref, &runtime_store_path, IMAGINATION_BINDING_ID),
"research": native_role_result(state_ref, &runtime_store_path, RESEARCH_BINDING_ID),
"modeling": native_role_result(state_ref, &runtime_store_path, MODELING_BINDING_ID),
"verification": native_role_result(state_ref, &runtime_store_path, VERIFICATION_BINDING_ID),
},
@ -503,6 +513,7 @@ fn run_codex_status(args: &Args) -> Result<Value> {
let planning = view.get("planning").cloned().unwrap_or_else(|| json!(null));
let role_results = json!({
"imagination": client.send("thread/epiphany/roleResult", Some(json!({"threadId": thread_id, "roleId": "imagination"})), true)?,
"research": client.send("thread/epiphany/roleResult", Some(json!({"threadId": thread_id, "roleId": "research"})), true)?,
"modeling": client.send("thread/epiphany/roleResult", Some(json!({"threadId": thread_id, "roleId": "modeling"})), true)?,
"verification": client.send("thread/epiphany/roleResult", Some(json!({"threadId": thread_id, "roleId": "verification"})), true)?,
});
@ -1338,6 +1349,7 @@ pub fn render_status(status: &Value) -> String {
lines.extend([String::new(), "Role Findings".to_string()]);
for (role_id, label) in [
("imagination", "Imagination / Planning"),
("research", "Eyes / Research"),
("modeling", "Modeling / Checkpoint"),
("verification", "Verification / Review"),
] {