Route operator Body Modeling without thread state

This commit is contained in:
Meta Vens 2026-08-17 20:31:36 +02:00
commit 587c56d2b3
4 changed files with 64 additions and 14 deletions

View file

@ -959,19 +959,37 @@ fn run_coordinator(args: &Args) -> Result<Value> {
} else {
None
};
let launch = launch_role(
&runtime_store,
&local_verse_store,
&thread_id,
role_id,
revision,
args.max_runtime_seconds,
if role_id == "modeling" {
proposal_modeling_request_id
} else {
None
},
)?;
let launch = if role_id == "modeling"
&& proposal_modeling_request_id.is_none()
&& status["currentWork"]["bodyModeling"].is_object()
{
let binding = epiphany_core::launch_current_body_modeling_work(
&runtime_store,
epiphany_core::EpiphanyBodyModelingLaunchOptions {
job_id: Uuid::new_v4().to_string(),
created_at: now(),
},
)?;
json!({
"bindingId": epiphany_core::EPIPHANY_MODELING_ROLE_BINDING_ID,
"backendJobId": binding.job_id,
"bodyModelingLaunchBinding": binding,
})
} else {
launch_role(
&runtime_store,
&local_verse_store,
&thread_id,
role_id,
revision,
args.max_runtime_seconds,
if role_id == "modeling" {
proposal_modeling_request_id
} else {
None
},
)?
};
let worker_job_id = worker_job_id_from_launch(&launch)?;
push_event(
&mut step,

View file

@ -496,7 +496,9 @@ fn run_native_status(args: &Args, include_auxiliary_status: bool) -> Result<Valu
epiphany_core::runtime_repo_frontier_planning_lifecycle(&runtime_store_path)
.context("failed to derive frontier planning lifecycle from runtime-spine state")?;
if frontier_planning.stage != current_work.frontier_planning_stage {
return Err(anyhow!("current-work frontier planning projection diverged"));
return Err(anyhow!(
"current-work frontier planning projection diverged"
));
}
let frontier_relinquishment =
epiphany_core::runtime_latest_repo_frontier_relinquishment(&runtime_store_path)
@ -548,6 +550,7 @@ fn run_native_status(args: &Args, include_auxiliary_status: bool) -> Result<Valu
research_continuation_action,
frontier_planning_stage: frontier_planning.stage,
proposal_modeling_request_ready: pending_proposal.is_some(),
body_modeling_work_ready: current_work.body_modeling.is_some(),
});
let coordinator_json = coordinator_status_json(&coordinator)?;
let tool_invocations = native_tool_invocation_surface(&runtime_store_path)?;

View file

@ -95,6 +95,7 @@ pub fn derive_coordinator_status(
research_continuation_action: input.research_continuation_action,
frontier_planning_stage: input.frontier_planning_stage,
proposal_modeling_request_ready: input.proposal_modeling_request_ready,
body_modeling_work_ready: input.body_modeling_work_ready,
});
EpiphanyCoordinatorStatus {
decision,
@ -705,6 +706,17 @@ pub fn recommend_coordinator_action(
);
}
if input.body_modeling_work_ready {
return build(
EpiphanyCoordinatorAction::LaunchModeling,
Some(EpiphanyCoordinatorRoleId::Modeling),
Some(EpiphanyCoordinatorSceneAction::RoleLaunch),
false,
true,
"The admitted repository Body has unresolved Modeling work; launch it from the keyed Mind obligation.",
);
}
if let Some(action) = input.research_continuation_action {
return match action {
RepoFrontierResearchContinuationAction::LaunchResearch => build(
@ -1365,6 +1377,7 @@ mod tests {
research_continuation_action: None,
frontier_planning_stage: RepoFrontierPlanningLifecycleStage::Unavailable,
proposal_modeling_request_ready: false,
body_modeling_work_ready: false,
}
}
@ -1454,6 +1467,20 @@ mod tests {
assert!(decision.can_auto_run);
}
#[test]
fn unresolved_body_work_routes_modeling_without_research_or_thread_state() {
let decision = recommend_coordinator_action(EpiphanyCoordinatorInput {
body_modeling_work_ready: true,
..input()
});
assert_eq!(decision.action, EpiphanyCoordinatorAction::LaunchModeling);
assert_eq!(
decision.target_role,
Some(EpiphanyCoordinatorRoleId::Modeling)
);
assert!(decision.can_auto_run);
}
fn finding(
runtime_result_id: &str,
runtime_job_id: &str,

View file

@ -166,6 +166,7 @@ pub struct EpiphanyCoordinatorInput {
pub frontier_planning_stage: RepoFrontierPlanningLifecycleStage,
/// True when an explicitly selected user proposal has no Modeling launch.
pub proposal_modeling_request_ready: bool,
pub body_modeling_work_ready: bool,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
@ -217,6 +218,7 @@ pub struct EpiphanyCoordinatorStatusInput {
pub research_continuation_action: Option<RepoFrontierResearchContinuationAction>,
pub frontier_planning_stage: RepoFrontierPlanningLifecycleStage,
pub proposal_modeling_request_ready: bool,
pub body_modeling_work_ready: bool,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]