Require Proprioception map admission

This commit is contained in:
Meta Vens 2026-06-13 20:55:14 +01:00
commit 712d67bf96
10 changed files with 161 additions and 17 deletions

View file

@ -419,8 +419,9 @@ fn run_coordinator(args: &Args) -> Result<Value> {
steps.push(step);
break;
}
if result["status"].as_str() == Some("failed") && args.supersede_failed_results {
let superseded = supersede_failed_role_result(
if args.supersede_failed_results && role_result_needs_supersession(role_id, &result)
{
let superseded = supersede_role_result(
&mut client,
&thread_id,
role_id,
@ -1107,7 +1108,17 @@ fn role_result_auto_acceptable(role_id: &str, result: &Value) -> bool {
}
}
fn supersede_failed_role_result(
fn role_result_needs_supersession(role_id: &str, result: &Value) -> bool {
match result["status"].as_str() {
Some("failed") => true,
Some("completed") if matches!(role_id, "research" | "modeling" | "imagination") => {
!role_result_auto_acceptable(role_id, result)
}
_ => false,
}
}
fn supersede_role_result(
client: &mut status_cli::AppServerClient,
thread_id: &str,
role_id: &str,
@ -1121,7 +1132,7 @@ fn supersede_failed_role_result(
let binding_id = first_string_at(result, &[&["bindingId"]])
.unwrap_or_else(|| default_binding_id_for_role(role_id));
let summary = first_string_at(result, &[&["finding", "summary"], &["note"]])
.unwrap_or_else(|| "Failed role result reviewed and superseded.".to_string());
.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,
@ -1792,6 +1803,37 @@ mod tests {
assert!(!role_result_auto_acceptable("modeling", &errored));
}
#[test]
fn supersession_includes_unreviewable_modeling_results() {
let unreviewable = json!({
"status": "completed",
"finding": {
"verdict": "checkpoint-update-needed",
"summary": "Mapped in prose only.",
"runtimeResultId": "result-modeling-1",
"runtimeJobId": "job-modeling-1",
"itemError": "modeling result is not reviewable: missing required statePatch"
}
});
let reviewable = json!({
"status": "completed",
"finding": {
"verdict": "checkpoint-update-needed",
"summary": "Mapped with state.",
"runtimeResultId": "result-modeling-2",
"runtimeJobId": "job-modeling-2",
"statePatch": {"scratch": {"summary": "mapped"}}
}
});
assert!(role_result_needs_supersession("modeling", &unreviewable));
assert!(!role_result_needs_supersession("modeling", &reviewable));
assert!(!role_result_needs_supersession(
"verification",
&unreviewable
));
}
#[test]
fn implementation_requested_paths_use_checkpoint_and_frontier_scope() {
let status = json!({

View file

@ -16,14 +16,14 @@ use epiphany_core::EpiphanyReorientAction;
use epiphany_core::EpiphanyReorientFreshnessStatus;
use epiphany_core::EpiphanyReorientInput;
use epiphany_core::EpiphanyReorientPressureLevel;
use epiphany_core::EpiphanyRoleFindingInterpretation;
use epiphany_core::EpiphanyRoleResultRoleId;
use epiphany_core::EpiphanyRetrievalFreshnessStatus;
use epiphany_core::EpiphanyRoleBoardCheckpointSummary;
use epiphany_core::EpiphanyRoleBoardInput;
use epiphany_core::EpiphanyRoleBoardJob;
use epiphany_core::EpiphanyRoleBoardJobStatus;
use epiphany_core::EpiphanyRoleBoardPlanningSummary;
use epiphany_core::EpiphanyRoleFindingInterpretation;
use epiphany_core::EpiphanyRoleResultRoleId;
use epiphany_core::EpiphanyRuntimeJobSnapshot;
use epiphany_core::EpiphanyRuntimeJobStatus;
use epiphany_core::EpiphanySceneInput;
@ -431,6 +431,7 @@ fn run_native_status(args: &Args) -> Result<Value> {
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_failure_reviewed: finding_signals.modeling_result_failure_reviewed,
modeling_result_accepted_after_verification: finding_signals
.modeling_result_accepted_after_verification,
implementation_evidence_after_verification: finding_signals
@ -898,9 +899,7 @@ fn reorient_retrieval_status(
) -> EpiphanyReorientFreshnessStatus {
match status {
EpiphanyRetrievalFreshnessStatus::Missing
| EpiphanyRetrievalFreshnessStatus::Unavailable => {
EpiphanyReorientFreshnessStatus::Unknown
}
| EpiphanyRetrievalFreshnessStatus::Unavailable => EpiphanyReorientFreshnessStatus::Unknown,
EpiphanyRetrievalFreshnessStatus::Ready => EpiphanyReorientFreshnessStatus::Clean,
EpiphanyRetrievalFreshnessStatus::Stale => EpiphanyReorientFreshnessStatus::Stale,
EpiphanyRetrievalFreshnessStatus::Indexing => EpiphanyReorientFreshnessStatus::Dirty,

View file

@ -136,6 +136,7 @@ pub struct EpiphanyCoordinatorInput {
pub modeling_result_requests_regather: bool,
pub modeling_result_accepted: bool,
pub modeling_result_reviewable: bool,
pub modeling_result_failure_reviewed: bool,
pub modeling_result_accepted_after_verification: bool,
pub implementation_evidence_after_verification: bool,
pub verification_result_cites_implementation_evidence: bool,
@ -175,6 +176,7 @@ pub struct EpiphanyCoordinatorStatusInput {
pub modeling_result_requests_regather: bool,
pub modeling_result_accepted: bool,
pub modeling_result_reviewable: bool,
pub modeling_result_failure_reviewed: bool,
pub modeling_result_accepted_after_verification: bool,
pub implementation_evidence_after_verification: bool,
pub verification_result_cites_implementation_evidence: bool,
@ -201,6 +203,7 @@ pub struct EpiphanyCoordinatorFindingSignals {
pub modeling_result_requests_regather: bool,
pub modeling_result_accepted: bool,
pub modeling_result_reviewable: bool,
pub modeling_result_failure_reviewed: bool,
pub modeling_result_accepted_after_verification: bool,
pub implementation_evidence_after_verification: bool,
pub verification_result_cites_implementation_evidence: bool,
@ -264,6 +267,7 @@ pub fn derive_coordinator_status(
modeling_result_requests_regather: input.modeling_result_requests_regather,
modeling_result_accepted: input.modeling_result_accepted,
modeling_result_reviewable: input.modeling_result_reviewable,
modeling_result_failure_reviewed: input.modeling_result_failure_reviewed,
modeling_result_accepted_after_verification: input
.modeling_result_accepted_after_verification,
implementation_evidence_after_verification: input
@ -308,6 +312,11 @@ pub fn derive_coordinator_finding_signals(
modeling_finding.is_some_and(modeling_finding_has_reviewable_state_patch);
let modeling_result_requests_regather =
modeling_finding.is_some_and(modeling_finding_requests_regather);
let modeling_result_failure_reviewed = modeling_finding.as_ref().is_some_and(|finding| {
state.is_some_and(|state| {
role_finding_failure_reviewed(state, EpiphanyCoordinatorRoleId::Modeling, finding)
})
});
let verification_result_accepted = verification_finding.as_ref().is_some_and(|finding| {
state.is_some_and(|state| {
role_finding_already_accepted(state, EpiphanyCoordinatorRoleId::Verification, finding)
@ -364,6 +373,7 @@ pub fn derive_coordinator_finding_signals(
modeling_result_requests_regather,
modeling_result_accepted,
modeling_result_reviewable,
modeling_result_failure_reviewed,
modeling_result_accepted_after_verification,
implementation_evidence_after_verification,
verification_result_cites_implementation_evidence,
@ -775,6 +785,16 @@ pub fn recommend_coordinator_action(
&& !input.modeling_result_accepted
{
if !input.modeling_result_reviewable {
if input.modeling_result_failure_reviewed {
return build(
EpiphanyCoordinatorAction::LaunchModeling,
Some(EpiphanyCoordinatorRoleId::Modeling),
Some(EpiphanyCoordinatorSceneAction::RoleLaunch),
false,
true,
"The completed modeling/checkpoint result was reviewed as unreviewable and superseded; relaunch Proprioception so it can emit the required statePatch before Hands continues.",
);
}
if input.modeling_result_requests_regather
&& !input.research_result_accepted
&& matches!(
@ -817,6 +837,16 @@ pub fn recommend_coordinator_action(
if input.signals.modeling_result_status == EpiphanyCoordinatorRoleResultStatus::Failed
&& !input.modeling_result_accepted
{
if input.modeling_result_failure_reviewed {
return build(
EpiphanyCoordinatorAction::LaunchModeling,
Some(EpiphanyCoordinatorRoleId::Modeling),
Some(EpiphanyCoordinatorSceneAction::RoleLaunch),
false,
true,
"The failed modeling/checkpoint result was reviewed and superseded; relaunch Proprioception before verification or implementation continues.",
);
}
return build(
EpiphanyCoordinatorAction::ReviewModelingResult,
Some(EpiphanyCoordinatorRoleId::Modeling),
@ -1212,6 +1242,7 @@ mod tests {
modeling_result_requests_regather: false,
modeling_result_accepted: false,
modeling_result_reviewable: false,
modeling_result_failure_reviewed: false,
modeling_result_accepted_after_verification: false,
implementation_evidence_after_verification: false,
verification_result_cites_implementation_evidence: false,
@ -1609,6 +1640,22 @@ mod tests {
);
assert!(!review_unreviewable_modeling.can_auto_run);
let relaunch_superseded_modeling = recommend_coordinator_action(EpiphanyCoordinatorInput {
signals: EpiphanyCoordinatorSignals {
research_result_status: EpiphanyCoordinatorRoleResultStatus::MissingBinding,
modeling_result_status: EpiphanyCoordinatorRoleResultStatus::Completed,
verification_result_status: EpiphanyCoordinatorRoleResultStatus::MissingBinding,
},
modeling_result_failure_reviewed: true,
..input()
});
assert_eq!(
relaunch_superseded_modeling.action,
EpiphanyCoordinatorAction::LaunchModeling
);
assert!(relaunch_superseded_modeling.can_auto_run);
assert!(relaunch_superseded_modeling.reason.contains("statePatch"));
let launch_verification = recommend_coordinator_action(EpiphanyCoordinatorInput {
signals: EpiphanyCoordinatorSignals {
research_result_status: EpiphanyCoordinatorRoleResultStatus::MissingBinding,