Route admitted Eyes frontiers to Research
This commit is contained in:
parent
b27b8f41c0
commit
d849b17e9d
4 changed files with 78 additions and 2 deletions
|
|
@ -40,6 +40,7 @@ use epiphany_core::read_accepted_coordinator_state;
|
|||
use epiphany_core::recommend_crrc_action;
|
||||
use epiphany_core::recommend_reorientation;
|
||||
use epiphany_core::runtime_has_actionable_hands_frontier;
|
||||
use epiphany_core::runtime_has_actionable_eyes_frontier;
|
||||
use epiphany_core::runtime_job_snapshot;
|
||||
use epiphany_state_model::EpiphanyThreadState;
|
||||
use serde_json::Value;
|
||||
|
|
@ -434,6 +435,8 @@ fn run_native_status(args: &Args) -> Result<Value> {
|
|||
};
|
||||
let hands_frontier_ready = runtime_has_actionable_hands_frontier(&runtime_store_path)
|
||||
.context("failed to derive actionable Hands frontier from runtime-spine state")?;
|
||||
let eyes_frontier_ready = runtime_has_actionable_eyes_frontier(&runtime_store_path)
|
||||
.context("failed to derive actionable Eyes frontier from runtime-spine state")?;
|
||||
let coordinator = derive_coordinator_status(EpiphanyCoordinatorStatusInput {
|
||||
state_status,
|
||||
checkpoint_present: state_ref
|
||||
|
|
@ -471,6 +474,7 @@ fn run_native_status(args: &Args) -> Result<Value> {
|
|||
verification_result_needs_evidence: finding_signals.verification_result_needs_evidence,
|
||||
reorient_finding_accepted: finding_signals.reorient_finding_accepted,
|
||||
hands_frontier_ready,
|
||||
eyes_frontier_ready,
|
||||
});
|
||||
let coordinator_json = coordinator_status_json(&coordinator)?;
|
||||
let tool_invocations = native_tool_invocation_surface(&runtime_store_path)?;
|
||||
|
|
|
|||
|
|
@ -1056,6 +1056,7 @@ pub use runtime_spine::runtime_hands_patch_receipt;
|
|||
pub use runtime_spine::runtime_hands_pr_receipt;
|
||||
pub use runtime_spine::runtime_hands_receipt_chain_after;
|
||||
pub use runtime_spine::runtime_has_actionable_hands_frontier;
|
||||
pub use runtime_spine::runtime_has_actionable_eyes_frontier;
|
||||
pub use runtime_spine::runtime_hello_frame;
|
||||
pub use runtime_spine::runtime_job_snapshot;
|
||||
pub use runtime_spine::runtime_latest_hands_receipt_chain_after;
|
||||
|
|
|
|||
|
|
@ -6028,6 +6028,14 @@ pub fn select_and_commit_repo_frontier_route(
|
|||
fn actionable_hands_frontier_item<'a>(
|
||||
model: &'a crate::EpiphanyMemoryGraphSnapshot,
|
||||
challenges: &[RepoModelClaimChallenge],
|
||||
) -> Option<&'a crate::RepoFrontierItem> {
|
||||
actionable_frontier_item_for_organ(model, challenges, "Hands")
|
||||
}
|
||||
|
||||
fn actionable_frontier_item_for_organ<'a>(
|
||||
model: &'a crate::EpiphanyMemoryGraphSnapshot,
|
||||
challenges: &[RepoModelClaimChallenge],
|
||||
organ: &str,
|
||||
) -> Option<&'a crate::RepoFrontierItem> {
|
||||
let terminal = |status: crate::RepoFrontierStatus| {
|
||||
matches!(
|
||||
|
|
@ -6039,7 +6047,7 @@ fn actionable_hands_frontier_item<'a>(
|
|||
};
|
||||
model.frontier.iter().find(|item| {
|
||||
item.status == crate::RepoFrontierStatus::Active
|
||||
&& item.recommended_next_organ == "Hands"
|
||||
&& item.recommended_next_organ == organ
|
||||
&& !item.source_scope.is_empty()
|
||||
&& safe_sorted_unique_paths(&item.source_scope)
|
||||
&& frontier_target_claims_unchallenged(item, challenges)
|
||||
|
|
@ -6058,6 +6066,20 @@ fn actionable_hands_frontier_item<'a>(
|
|||
/// Hands. Status projection must use this instead of assuming that a clear
|
||||
/// CRRC lane implies implementation authority.
|
||||
pub fn runtime_has_actionable_hands_frontier(runtime_store: impl AsRef<Path>) -> Result<bool> {
|
||||
runtime_has_actionable_frontier_for_organ(runtime_store, "Hands")
|
||||
}
|
||||
|
||||
/// Read-only Self signal for source gathering. It is true only when the
|
||||
/// canonical runtime model is admitted exactly once and contains an Active,
|
||||
/// dependency-ready Eyes frontier item.
|
||||
pub fn runtime_has_actionable_eyes_frontier(runtime_store: impl AsRef<Path>) -> Result<bool> {
|
||||
runtime_has_actionable_frontier_for_organ(runtime_store, "Eyes")
|
||||
}
|
||||
|
||||
fn runtime_has_actionable_frontier_for_organ(
|
||||
runtime_store: impl AsRef<Path>,
|
||||
organ: &str,
|
||||
) -> Result<bool> {
|
||||
let runtime_store = runtime_store.as_ref();
|
||||
let mut cache = runtime_spine_cache(runtime_store)?;
|
||||
cache.pull_all_backing_stores()?;
|
||||
|
|
@ -6080,7 +6102,8 @@ pub fn runtime_has_actionable_hands_frontier(runtime_store: impl AsRef<Path>) ->
|
|||
})
|
||||
.count();
|
||||
let challenges = current_repo_model_claim_challenges(&cache, &model, &model_hash)?;
|
||||
Ok(admission_count == 1 && actionable_hands_frontier_item(&model, &challenges).is_some())
|
||||
Ok(admission_count == 1
|
||||
&& actionable_frontier_item_for_organ(&model, &challenges, organ).is_some())
|
||||
}
|
||||
|
||||
pub fn put_runtime_reorient_worker_result(
|
||||
|
|
@ -11830,6 +11853,7 @@ pub(crate) mod tests {
|
|||
}],
|
||||
)?;
|
||||
assert!(runtime_has_actionable_hands_frontier(&active_store)?);
|
||||
assert!(!runtime_has_actionable_eyes_frontier(&active_store)?);
|
||||
assert!(
|
||||
select_and_commit_repo_frontier_route(&active_store, "2026-07-13T05:00:02Z").is_ok()
|
||||
);
|
||||
|
|
@ -11875,6 +11899,7 @@ pub(crate) mod tests {
|
|||
)?;
|
||||
assert!(select_and_commit_repo_frontier_route(&store, "2026-07-13T05:00:02Z").is_err());
|
||||
assert!(!runtime_has_actionable_hands_frontier(&store)?);
|
||||
assert!(runtime_has_actionable_eyes_frontier(&store)?);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -152,6 +152,9 @@ pub struct EpiphanyCoordinatorInput {
|
|||
/// True only when the canonical runtime RepoModel has exactly one current
|
||||
/// admission and an Active, dependency-ready Hands frontier item.
|
||||
pub hands_frontier_ready: bool,
|
||||
/// True only when the canonical runtime RepoModel has exactly one current
|
||||
/// admission and an Active, dependency-ready Eyes frontier item.
|
||||
pub eyes_frontier_ready: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
|
@ -195,6 +198,7 @@ pub struct EpiphanyCoordinatorStatusInput {
|
|||
pub verification_result_needs_evidence: bool,
|
||||
pub reorient_finding_accepted: bool,
|
||||
pub hands_frontier_ready: bool,
|
||||
pub eyes_frontier_ready: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
|
|
@ -295,6 +299,7 @@ pub fn derive_coordinator_status(
|
|||
verification_result_needs_evidence: input.verification_result_needs_evidence,
|
||||
reorient_finding_accepted: input.reorient_finding_accepted,
|
||||
hands_frontier_ready: input.hands_frontier_ready,
|
||||
eyes_frontier_ready: input.eyes_frontier_ready,
|
||||
});
|
||||
EpiphanyCoordinatorStatus {
|
||||
decision,
|
||||
|
|
@ -1159,6 +1164,27 @@ pub fn recommend_coordinator_action(
|
|||
);
|
||||
}
|
||||
|
||||
if input.eyes_frontier_ready
|
||||
&& !input.research_result_accepted
|
||||
&& matches!(
|
||||
input.signals.research_result_status,
|
||||
EpiphanyCoordinatorRoleResultStatus::MissingBinding
|
||||
| EpiphanyCoordinatorRoleResultStatus::BackendUnavailable
|
||||
| EpiphanyCoordinatorRoleResultStatus::BackendMissing
|
||||
| EpiphanyCoordinatorRoleResultStatus::Cancelled
|
||||
| EpiphanyCoordinatorRoleResultStatus::Failed
|
||||
)
|
||||
{
|
||||
return build(
|
||||
EpiphanyCoordinatorAction::LaunchResearch,
|
||||
Some(EpiphanyCoordinatorRoleId::Research),
|
||||
Some(EpiphanyCoordinatorSceneAction::RoleLaunch),
|
||||
false,
|
||||
true,
|
||||
"Mind has admitted an actionable Eyes frontier; launch Research against that source-gathering authority.",
|
||||
);
|
||||
}
|
||||
|
||||
if input.signals.verification_result_status == EpiphanyCoordinatorRoleResultStatus::Completed
|
||||
&& input.verification_result_accepted
|
||||
&& !input.verification_result_allows_implementation
|
||||
|
|
@ -1328,6 +1354,7 @@ mod tests {
|
|||
verification_result_needs_evidence: false,
|
||||
reorient_finding_accepted: false,
|
||||
hands_frontier_ready: false,
|
||||
eyes_frontier_ready: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2053,6 +2080,25 @@ mod tests {
|
|||
assert!(!no_frontier.can_auto_run);
|
||||
assert!(no_frontier.reason.contains("proposal selection"));
|
||||
|
||||
let eyes_frontier = recommend_coordinator_action(EpiphanyCoordinatorInput {
|
||||
signals: modeling_done,
|
||||
modeling_result_accepted: true,
|
||||
modeling_result_reviewable: true,
|
||||
hands_frontier_ready: false,
|
||||
eyes_frontier_ready: true,
|
||||
..input()
|
||||
});
|
||||
assert_eq!(
|
||||
eyes_frontier.action,
|
||||
EpiphanyCoordinatorAction::LaunchResearch
|
||||
);
|
||||
assert_eq!(
|
||||
eyes_frontier.target_role,
|
||||
Some(EpiphanyCoordinatorRoleId::Research)
|
||||
);
|
||||
assert!(eyes_frontier.can_auto_run);
|
||||
assert!(eyes_frontier.reason.contains("Eyes frontier"));
|
||||
|
||||
let consequences_exist = recommend_coordinator_action(EpiphanyCoordinatorInput {
|
||||
signals: modeling_done,
|
||||
modeling_result_accepted: true,
|
||||
|
|
|
|||
Reference in a new issue