Derive pending proposal routing in Self

This commit is contained in:
Meta Vens 2026-08-07 14:46:26 +01:00
commit 737f2b945b
8 changed files with 147 additions and 72 deletions

View file

@ -481,20 +481,10 @@ fn run_coordinator(args: &Args) -> Result<Value> {
.get("coordinator")
.cloned()
.unwrap_or_else(|| json!({"action": "regatherManually"}));
let explicit_proposal_launchable = args
.proposal_modeling_request_id
.as_deref()
.is_some_and(|request_id| {
status["findingSignals"]["modelingResultAccepted"].as_bool() != Some(true)
|| status["roleResults"]["modeling"]["finding"]["proposalModelingRequestId"]
.as_str()
!= Some(request_id)
});
let action = apply_explicit_proposal_routing(
&mut coordinator,
args.proposal_modeling_request_id.as_deref(),
explicit_proposal_launchable,
);
let action = coordinator["action"]
.as_str()
.unwrap_or("regatherManually")
.to_string();
let snapshot_name = format!("step-{index:02}-{action}.txt");
fs::write(
@ -810,6 +800,19 @@ fn run_coordinator(args: &Args) -> Result<Value> {
"launchResearch" | "launchModeling" | "launchVerification" => {
let role_id = role_id_for_coordinator_action(&action)
.ok_or_else(|| anyhow!("unsupported launch action {action}"))?;
let pending_proposal_request_id = if role_id == "modeling" {
status["findingSignals"]["pendingProposalModelingRequestId"].as_str()
} else {
None
};
let proposal_modeling_request_id = if role_id == "modeling" {
resolve_proposal_modeling_request_hint(
args.proposal_modeling_request_id.as_deref(),
pending_proposal_request_id,
)?
} else {
None
};
let launch = launch_role(
&runtime_store,
&local_verse_store,
@ -818,7 +821,7 @@ fn run_coordinator(args: &Args) -> Result<Value> {
revision,
args.max_runtime_seconds,
if role_id == "modeling" {
args.proposal_modeling_request_id.as_deref()
proposal_modeling_request_id
} else {
None
},
@ -1925,6 +1928,22 @@ fn final_action_reason(final_action: &Value) -> Option<String> {
.map(ToString::to_string)
}
fn resolve_proposal_modeling_request_hint<'a>(
explicit: Option<&'a str>,
derived: Option<&'a str>,
) -> Result<Option<&'a str>> {
match (explicit, derived) {
(Some(explicit), Some(derived)) if explicit == derived => Ok(Some(derived)),
(None, derived) => Ok(derived),
(Some(_), Some(_)) => Err(anyhow!(
"explicit proposal Modeling request does not match Self-derived pending authority"
)),
(Some(_), None) => Err(anyhow!(
"explicit proposal Modeling request has no Self-derived pending authority"
)),
}
}
fn sanitize_id(value: &str) -> String {
value
.chars()
@ -1944,28 +1963,6 @@ fn now() -> String {
chrono::Utc::now().to_rfc3339_opts(SecondsFormat::Secs, true)
}
fn apply_explicit_proposal_routing(
coordinator: &mut Value,
proposal_modeling_request_id: Option<&str>,
proposal_request_launchable: bool,
) -> String {
let action = coordinator["action"].as_str().unwrap_or("regatherManually");
if action == "awaitFrontierProposal"
&& proposal_modeling_request_id.is_some_and(|value| !value.trim().is_empty())
&& proposal_request_launchable
{
coordinator["action"] = json!("launchModeling");
coordinator["targetRole"] = json!("modeling");
coordinator["canAutoRun"] = json!(true);
coordinator["requiresReview"] = json!(false);
coordinator["reason"] = json!(
"A typed proposal Modeling request was supplied explicitly; launch Modeling through that request authority."
);
return "launchModeling".to_string();
}
action.to_string()
}
fn coordinator_runtime_identity_options(
runtime_id: &str,
created_at: String,
@ -2087,41 +2084,19 @@ mod tests {
use super::*;
#[test]
fn explicit_typed_proposal_turns_await_into_modeling_launch() {
let mut coordinator = json!({
"action": "awaitFrontierProposal",
"targetRole": "imagination",
"canAutoRun": false,
"requiresReview": true,
"reason": "Await a proposal."
});
fn proposal_cli_argument_is_only_an_assertion_over_self_derived_authority() {
let request = "repo-frontier-proposal-modeling-request";
assert_eq!(
apply_explicit_proposal_routing(
&mut coordinator,
Some("repo-frontier-proposal-modeling-request"),
true,
),
"launchModeling"
resolve_proposal_modeling_request_hint(None, Some(request)).unwrap(),
Some(request)
);
assert_eq!(coordinator["action"], "launchModeling");
assert_eq!(coordinator["targetRole"], "modeling");
assert_eq!(coordinator["canAutoRun"], true);
assert_eq!(coordinator["requiresReview"], false);
let mut idle = json!({"action": "awaitFrontierProposal"});
assert_eq!(
apply_explicit_proposal_routing(&mut idle, None, false),
"awaitFrontierProposal"
resolve_proposal_modeling_request_hint(Some(request), Some(request)).unwrap(),
Some(request)
);
let mut consumed = json!({"action": "awaitFrontierProposal"});
assert_eq!(
apply_explicit_proposal_routing(
&mut consumed,
Some("repo-frontier-proposal-modeling-request"),
false,
),
"awaitFrontierProposal"
assert!(resolve_proposal_modeling_request_hint(Some(request), None).is_err());
assert!(
resolve_proposal_modeling_request_hint(Some("wrong-request"), Some(request)).is_err()
);
}

View file

@ -467,6 +467,9 @@ fn run_native_status(args: &Args, include_auxiliary_status: bool) -> Result<Valu
let frontier_planning =
epiphany_core::runtime_repo_frontier_planning_lifecycle(&runtime_store_path)
.context("failed to derive frontier planning lifecycle from runtime-spine state")?;
let pending_proposal =
epiphany_core::runtime_pending_repo_frontier_proposal_modeling_request(&runtime_store_path)
.context("failed to derive pending proposal Modeling authority")?;
let coordinator = derive_coordinator_status(EpiphanyCoordinatorStatusInput {
state_status,
checkpoint_present: state_ref
@ -508,6 +511,7 @@ fn run_native_status(args: &Args, include_auxiliary_status: bool) -> Result<Valu
hands_frontier_ready,
eyes_frontier_ready,
frontier_planning_stage: frontier_planning.stage,
proposal_modeling_request_ready: pending_proposal.is_some(),
});
let coordinator_json = coordinator_status_json(&coordinator)?;
let tool_invocations = native_tool_invocation_surface(&runtime_store_path)?;
@ -595,6 +599,7 @@ fn run_native_status(args: &Args, include_auxiliary_status: bool) -> Result<Valu
"modelingResultProposalBound": modeling_result_proposal_bound,
"nativeHandsConsequenceAfterBoundary": native_hands_consequence_after_boundary,
"imaginationFrontierReady": imagination_frontier_ready,
"pendingProposalModelingRequestId": pending_proposal.as_ref().map(|request| request.request_id.as_str()),
"verificationResultAccepted": finding_signals.verification_result_accepted,
"verificationResultFailureReviewed": finding_signals.verification_result_failure_reviewed,
},

View file

@ -1064,6 +1064,7 @@ pub use runtime_spine::runtime_latest_hands_receipt_chain_after;
pub use runtime_spine::runtime_mind_gateway_review;
pub use runtime_spine::runtime_mind_state_commit_receipt;
pub use runtime_spine::runtime_modeling_semantic_projection_input;
pub use runtime_spine::runtime_pending_repo_frontier_proposal_modeling_request;
pub use runtime_spine::runtime_registered_document_types;
pub use runtime_spine::runtime_reorient_worker_result;
pub use runtime_spine::runtime_repo_frontier_planning_lifecycle;

View file

@ -6110,6 +6110,45 @@ pub fn runtime_has_actionable_imagination_frontier(
Ok(admission_count == 1 && actionable_imagination_frontier_item(&model, &challenges).is_some())
}
/// Returns the single selected user proposal that has not yet been claimed by
/// a Modeling launch. Selection is already an explicit Self authority; this
/// projection prevents the CLI from becoming a second routing owner.
pub fn runtime_pending_repo_frontier_proposal_modeling_request(
runtime_store: impl AsRef<Path>,
) -> Result<Option<RepoFrontierProposalModelingRequest>> {
let runtime_store = runtime_store.as_ref();
let mut cache = runtime_spine_cache(runtime_store)?;
cache.pull_all_backing_stores()?;
require_identity(&cache)?;
let launches = cache.get_all::<RepoFrontierProposalModelingLaunchBinding>()?;
let mut pending = cache
.get_all::<RepoFrontierProposalModelingRequest>()?
.into_iter()
.filter_map(|request| {
if validate_repo_frontier_proposal_modeling_request(&request).is_err()
|| launches
.iter()
.any(|launch| launch.proposal_modeling_request_id == request.request_id)
{
None
} else {
Some(request)
}
})
.collect::<Vec<_>>();
pending.sort_by(|a, b| {
a.selected_at
.cmp(&b.selected_at)
.then_with(|| a.request_id.cmp(&b.request_id))
});
if pending.len() > 1 {
return Err(anyhow!(
"Self found multiple unclaimed proposal Modeling requests"
));
}
Ok(pending.pop())
}
/// Read-only Self projection over the existing typed frontier-planning chain.
/// It never creates a request or decision; each mutating stage remains owned by
/// its established commit primitive.

View file

@ -168,6 +168,8 @@ pub struct EpiphanyCoordinatorInput {
/// Read-only projection of the single typed Imagination -> Mind planning
/// lifecycle. Self may advance it, but only Mind's result can decide adoption.
pub frontier_planning_stage: RepoFrontierPlanningLifecycleStage,
/// True when an explicitly selected user proposal has no Modeling launch.
pub proposal_modeling_request_ready: bool,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
@ -214,6 +216,7 @@ pub struct EpiphanyCoordinatorStatusInput {
pub hands_frontier_ready: bool,
pub eyes_frontier_ready: bool,
pub frontier_planning_stage: RepoFrontierPlanningLifecycleStage,
pub proposal_modeling_request_ready: bool,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
@ -318,6 +321,7 @@ pub fn derive_coordinator_status(
hands_frontier_ready: input.hands_frontier_ready,
eyes_frontier_ready: input.eyes_frontier_ready,
frontier_planning_stage: input.frontier_planning_stage,
proposal_modeling_request_ready: input.proposal_modeling_request_ready,
});
EpiphanyCoordinatorStatus {
decision,
@ -895,6 +899,17 @@ pub fn recommend_coordinator_action(
| RepoFrontierPlanningLifecycleStage::Terminal => {}
}
if input.proposal_modeling_request_ready {
return build(
EpiphanyCoordinatorAction::LaunchModeling,
Some(EpiphanyCoordinatorRoleId::Modeling),
Some(EpiphanyCoordinatorSceneAction::RoleLaunch),
false,
true,
"An explicitly selected typed user proposal is waiting for its single Modeling launch; route that authority before generic regather or stale lane repair.",
);
}
if input.signals.research_result_status == EpiphanyCoordinatorRoleResultStatus::Completed
&& !input.research_result_accepted
{
@ -1498,6 +1513,7 @@ mod tests {
hands_frontier_ready: false,
eyes_frontier_ready: false,
frontier_planning_stage: RepoFrontierPlanningLifecycleStage::Unavailable,
proposal_modeling_request_ready: false,
}
}
@ -1572,6 +1588,21 @@ mod tests {
}
}
#[test]
fn selected_user_proposal_preempts_generic_regather() {
let decision = recommend_coordinator_action(EpiphanyCoordinatorInput {
recommendation: recommendation(EpiphanyCrrcAction::RegatherManually),
proposal_modeling_request_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

@ -1153,6 +1153,15 @@ stages rather than remaining indistinguishable from running jobs. A terminal
Hold or Refuse suppresses immediate replanning of the same current authority.
This code path is locally proven but still requires exact packaged live proof.
Selected user proposals are also native Self input. The runtime projection
`runtime_pending_repo_frontier_proposal_modeling_request` returns the single
validated selection with no launch binding. Coordinator status routes that
authority before generic regather. The MVP no longer rewrites an
`awaitFrontierProposal` action from a CLI flag; an optional request ID is only
an equality assertion over Self's derived request. This cuts the split owner
exposed when exact `881b2b1a` saw the live v23 proposal but remained in manual
regather.
The autonomous proposal crossing is source-grounded in
`runtime_spine.rs`, `admitted_model_direction_consideration.rs`,
`coordinator_launch.rs`, and `repo_model_gateway.rs`. A deployment-configured

View file

@ -174,6 +174,21 @@ create legitimate live Imagination pressure through the existing proposal and
proposal-Modeling path. Prove the exact package advances v23 through Imagination
and dedicated Mind without overrides or a second planning substrate.
Exact `881b2b1a` was packaged and published as
`sha256-e41a428b97a9e67c18425cf0862f15cb9f1de87d03fd15c641dec7f835f0707c`
with witness
`sha256-56ecec1ce5f23256a25dd6d341f6ff73dcf931fcd590de208d3ab3f220bce365`.
Packaged proposal intake created `shakedown-v23-release-auth-seam-r1` and
selection `repo-frontier-proposal-modeling-2a98b0ad0d4f54bc72618ee8b75e20f347bfe3bdf898d3d7247ba9b89bc244c8`.
The first packaged Self pass exposed a surviving split owner: canonical status
returned manual regather, while the CLI could only rewrite
`awaitFrontierProposal`. No worker launched and v23 remained revision 17.
The current local repair makes pending proposal selection a native status
signal, routes it before regather, and demotes the CLI ID to an equality check.
Debug status over live v23 now derives `launchModeling` and that exact request.
Package and publish the repair before retrying; do not use `881b2b1a` to bypass
its own finding.
## Immediate re-entry
1. Run `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-state -- status`.

View file

@ -34,9 +34,9 @@ invariants:
- Evidence and git retain history; this map retains only state that changes future decisions.
current_status:
summary: Epiphany is a supervised engineering alpha on Starfire, not deployment-ready. Fresh v23 completed the typed proposal-to-Mind-to-Hands-to-Soul-to-Modeling circuit and accepted an Eyes packet from a challenged frontier. Exact 148d4527 proved packaged Self derives routing status in-process with heartbeat, Persona, and Void projections omitted. Exact 6f019cf8 proved the single-use Research-to-Modeling route. Native Self/MVP Imagination orchestration is now implemented locally as a typed read-only lifecycle over the existing planning, launch, result, Mind-request, and decision receipts. Focused adoption, Hold/Refuse, failure, coordinator, and MVP tests pass; exact packaged live proof remains open. Persona consequence, Continuity recovery, retention, long-duration pacing, and Linux/Yggdrasil cognition remain open.
summary: Epiphany is a supervised engineering alpha on Starfire, not deployment-ready. Exact 881b2b1a packaged and published the native Imagination lifecycle, then live v23 exposed a remaining split owner: a legitimate selected user proposal existed, but Self status stayed in manual regather because proposal routing lived in a narrow CLI rewrite. No worker launched. The local repair now derives the single unclaimed proposal Modeling request from CultCache, routes it before regather, and makes the CLI request ID assertion-only. Live debug status derives launchModeling for the exact pending request; 20 coordinator and 14 MVP tests pass. A new exact package and live proof remain open. Persona consequence, Continuity recovery, retention, long-duration pacing, and Linux/Yggdrasil cognition remain open.
operational_state:
local_worktree: native_imagination_orchestration_implemented_uncommitted
local_worktree: pending_proposal_native_status_repair_uncommitted
operator_wireguard: restored
yggdrasil: canonical_small_public_crossing_body
starfire: temporary_epiphany_cognition_body
@ -52,8 +52,8 @@ current_status:
bifrost_feedback_crossing: authenticated_transport_only
yggdrasil_epiphany_services: absent
resident_physiology: heartbeat_and_self_running
unresolved_authority: v23 holds accepted Eyes, reorientation, and causal Modeling evidence. The packet grounds topology fail-closure and the authenticated 2dd25341 Hands receipt, but not the current-body enforcement path that makes release authentication non-bypassable; the accepted Modeling result correctly preserved that wound. Exact 6f019cf8 closes the Research-to-Modeling routing gap. Native Imagination orchestration is implemented but not yet proven from an exact authenticated package on live v23. Persona consequence, Continuity crash/restart/closure, retention, long-duration behavior, and Linux/Yggdrasil cognition remain open.
next_action: Commit and package the native Imagination lifecycle pass, publish its authenticated release, then create legitimate v23 Imagination pressure through the existing typed proposal and proposal-Modeling path. Run packaged Self without overrides and prove planning selection, exclusive Imagination launch, dedicated Mind review, and atomic terminal decision. Do not create a new store or mutate v22.
unresolved_authority: v23 holds accepted Eyes, reorientation, causal Modeling evidence, and one legitimate unclaimed proposal Modeling request. Exact 881b2b1a is authenticated but cannot route that proposal from manual regather. The local native-status repair is test-proven but unpublished. Native Imagination live proof, Persona consequence, Continuity crash/restart/closure, retention, long-duration behavior, and Linux/Yggdrasil cognition remain open.
next_action: Commit, package, and publish the native pending-proposal routing repair. Retry packaged Self on v23 without using the CLI ID as a routing override; prove status itself launches the exact proposal-bound Modeling request, then continue through admitted Imagination and dedicated Mind decision. Do not recreate the proposal, inject a frontier, or mutate v22.
active_subgoals:
- Prove Persona, Self, Eyes, Modeling, Imagination, Hands, Soul, Mind, Continuity, and nervous-system behavior individually.