Delete non-atomic worker launch path

This commit is contained in:
Meta Vens 2026-08-23 15:46:03 +02:00
commit a319146be7
6 changed files with 59 additions and 166 deletions

View file

@ -1184,7 +1184,6 @@ pub fn launch_current_frontier_planning_work(
&cache,
crate::RuntimeSpineHeartbeatJobOptions {
runtime_id: identity.runtime_id.clone(),
display_name: "Epiphany Local".into(),
session_id: crate::EPIPHANY_RUNTIME_ROOT_SESSION_ID.into(),
objective: "Propose one bounded plan for the exact frontier authority".into(),
coordinator_note: "Planning current-work launch transaction opened this session."
@ -1371,7 +1370,6 @@ pub fn launch_current_frontier_plan_mind_work(
&cache,
crate::RuntimeSpineHeartbeatJobOptions {
runtime_id: identity.runtime_id.clone(),
display_name: "Epiphany Local".into(),
session_id: crate::EPIPHANY_RUNTIME_ROOT_SESSION_ID.into(),
objective: "Adjudicate one exact Imagination plan candidate".into(),
coordinator_note: "Plan Mind current-work launch transaction opened this session."
@ -1552,7 +1550,6 @@ pub fn launch_current_frontier_verification_work(
&cache,
crate::RuntimeSpineHeartbeatJobOptions {
runtime_id: identity.runtime_id,
display_name: "Epiphany Local".into(),
session_id: crate::EPIPHANY_RUNTIME_ROOT_SESSION_ID.into(),
objective: "Audit one exact Hands consequence against its routed invariant".into(),
coordinator_note:
@ -1725,7 +1722,6 @@ pub fn launch_current_frontier_research_work(
&cache,
crate::RuntimeSpineHeartbeatJobOptions {
runtime_id: identity.runtime_id,
display_name: "Epiphany Local".into(),
session_id: crate::EPIPHANY_RUNTIME_ROOT_SESSION_ID.into(),
objective: "Gather evidence for one exact external-evidence obligation".into(),
coordinator_note: "Research current-work launch transaction opened this session."
@ -2879,7 +2875,6 @@ fn launch_consideration_work(
&cache,
crate::RuntimeSpineHeartbeatJobOptions {
runtime_id: identity.runtime_id,
display_name: "Epiphany Local".into(),
session_id: crate::EPIPHANY_RUNTIME_ROOT_SESSION_ID.into(),
objective: "Consider one exact typed proposal-only obligation".into(),
coordinator_note: "Consideration current-work launch opened this attempt.".into(),
@ -3104,7 +3099,6 @@ pub fn launch_current_body_modeling_work(
&cache,
crate::RuntimeSpineHeartbeatJobOptions {
runtime_id: work.runtime_id.clone(),
display_name: "Epiphany Local".into(),
session_id: crate::EPIPHANY_RUNTIME_ROOT_SESSION_ID.into(),
objective: "Model the admitted repository Body".into(),
coordinator_note: "Keyed Mind current-work launch transaction opened this session."
@ -3279,7 +3273,6 @@ pub fn launch_current_proposal_modeling_work(
&cache,
crate::RuntimeSpineHeartbeatJobOptions {
runtime_id: identity.runtime_id.clone(),
display_name: "Epiphany Local".into(),
session_id: crate::EPIPHANY_RUNTIME_ROOT_SESSION_ID.into(),
objective: "Model one admitted proposal against keyed Mind".into(),
coordinator_note: "Proposal current-work launch transaction opened this session."
@ -3448,7 +3441,6 @@ pub fn launch_current_frontier_verdict_modeling_work(
&cache,
crate::RuntimeSpineHeartbeatJobOptions {
runtime_id: identity.runtime_id,
display_name: "Epiphany Local".into(),
session_id: crate::EPIPHANY_RUNTIME_ROOT_SESSION_ID.into(),
objective: "Incorporate one exact Soul verdict into its routed frontier".into(),
coordinator_note:

View file

@ -328,7 +328,6 @@ pub use runtime_spine::intake_user_repo_frontier_proposal;
pub use runtime_spine::model_pass_failure_for_request;
pub use runtime_spine::open_coordinator_run;
pub use runtime_spine::open_runtime_model_execution;
pub use runtime_spine::open_runtime_spine_heartbeat_job;
pub use runtime_spine::prepare_runtime_spine_heartbeat_job;
pub use runtime_spine::promote_autonomous_direction_options_for_modeling;
pub use runtime_spine::put_coordinator_run_receipt;

View file

@ -429,7 +429,6 @@ pub fn launch_current_reorientation_work(
&cache,
crate::RuntimeSpineHeartbeatJobOptions {
runtime_id: work.request.runtime_id.clone(),
display_name: "Epiphany Local".into(),
session_id: crate::EPIPHANY_RUNTIME_ROOT_SESSION_ID.into(),
objective: "Reorient from one exact keyed Mind projection".into(),
coordinator_note: "Reorientation current-work owner opened this pass.".into(),

View file

@ -937,7 +937,6 @@ pub struct RuntimeSpineJobResultOptions {
#[derive(Clone, Debug, PartialEq)]
pub struct RuntimeSpineHeartbeatJobOptions {
pub runtime_id: String,
pub display_name: String,
pub session_id: String,
pub objective: String,
pub coordinator_note: String,
@ -2679,147 +2678,11 @@ where
Ok(archive)
}
pub fn open_runtime_spine_heartbeat_job(
store_path: impl AsRef<Path>,
options: RuntimeSpineHeartbeatJobOptions,
) -> Result<EpiphanyRuntimeJob> {
validate_non_empty(&options.runtime_id, "runtime id")?;
validate_non_empty(&options.display_name, "display name")?;
validate_non_empty(&options.session_id, "session id")?;
validate_non_empty(&options.objective, "objective")?;
validate_non_empty(&options.job_id, "job id")?;
validate_non_empty(&options.role, "role")?;
validate_repository_body_launch_carrier(&options.role, &options.launch_document)?;
validate_proposal_modeling_launch_carrier(
&options.role,
&options.binding_id,
options.proposal_modeling_request_id.as_deref(),
&options.launch_document,
)?;
validate_frontier_planning_launch_carrier(
&options.role,
&options.binding_id,
options.frontier_planning_request_id.as_deref(),
&options.launch_document,
)?;
validate_frontier_research_launch_carrier(
&options.role,
&options.binding_id,
options.repo_frontier_research_request_id.as_deref(),
&options.launch_document,
)?;
validate_frontier_verification_launch_carrier(
&options.role,
&options.binding_id,
options.repo_frontier_verification_request_id.as_deref(),
&options.launch_document,
)?;
validate_imagination_consideration_launch_carrier(
&options.role,
&options.binding_id,
options.imagination_consideration_request_id.as_deref(),
&options.launch_document,
)?;
validate_repo_frontier_verdict_modeling_launch_authority(
&options.role,
options.repo_frontier_modeling_request_id.as_deref(),
&options.launch_document,
)?;
validate_non_empty(&options.binding_id, "binding id")?;
validate_non_empty(&options.authority_scope, "authority scope")?;
validate_non_empty(&options.instruction, "instruction")?;
validate_non_empty(
options.launch_document.thread_id(),
"worker launch document thread id",
)?;
validate_non_empty(&options.output_contract_id, "output contract id")?;
if options.output_contract_id != options.launch_document.output_contract_id() {
return Err(anyhow!(
"worker launch output_contract_id must match the typed launch document"
));
}
validate_non_empty(&options.created_at, "created at")?;
let store_path = store_path.as_ref();
let job_id = options.job_id.clone();
let binding_id = options.binding_id.clone();
let role = options.role.clone();
let authority_scope = options.authority_scope.clone();
let instruction = options.instruction.clone();
let output_contract_id = options.output_contract_id.clone();
let launch_document = options.launch_document.clone();
initialize_runtime_spine(
store_path,
RuntimeSpineInitOptions {
runtime_id: options.runtime_id,
display_name: options.display_name,
created_at: options.created_at.clone(),
},
)?;
ensure_runtime_session(
store_path,
RuntimeSpineSessionOptions {
session_id: options.session_id.clone(),
objective: options.objective,
created_at: options.created_at.clone(),
coordinator_note: options.coordinator_note,
},
)?;
let job = create_runtime_job(
store_path,
RuntimeSpineJobOptions {
job_id: options.job_id,
session_id: options.session_id,
role: options.role,
created_at: options.created_at,
summary: format!(
"Heartbeat activation queued for binding {} with authority {}.",
options.binding_id, options.authority_scope
),
artifact_refs: Vec::new(),
},
)?;
let mut cache = runtime_spine_cache(store_path)?;
cache.pull_all_backing_stores()?;
if cache
.get::<EpiphanyRuntimeWorkerLaunchRequest>(&job_id)?
.is_some()
{
return Err(anyhow!(
"runtime worker launch request {:?} already exists",
job_id
));
}
let request = EpiphanyRuntimeWorkerLaunchRequest {
schema_version: RUNTIME_WORKER_LAUNCH_REQUEST_SCHEMA_VERSION.to_string(),
job_id: job_id.clone(),
binding_id,
role,
authority_scope,
instruction,
output_contract_id,
document_kind: worker_launch_document_kind(&launch_document).to_string(),
launch_document_msgpack: encode_worker_launch_document(&launch_document)?,
metadata: BTreeMap::new(),
proposal_modeling_request_id: options.proposal_modeling_request_id,
frontier_planning_request_id: options.frontier_planning_request_id,
frontier_plan_mind_request_id: options.frontier_plan_mind_request_id,
imagination_consideration_request_id: options.imagination_consideration_request_id,
admitted_model_direction_consideration_request_id: options
.admitted_model_direction_consideration_request_id,
repo_frontier_modeling_request_id: options.repo_frontier_modeling_request_id,
repo_frontier_research_request_id: options.repo_frontier_research_request_id,
repo_frontier_verification_request_id: options.repo_frontier_verification_request_id,
};
cache.put(&job_id, &request)?;
Ok(job)
}
pub fn prepare_runtime_spine_heartbeat_job(
cache: &CultCache,
options: RuntimeSpineHeartbeatJobOptions,
) -> Result<PreparedRuntimeSpineHeartbeatJob> {
validate_non_empty(&options.runtime_id, "runtime id")?;
validate_non_empty(&options.display_name, "display name")?;
validate_non_empty(&options.session_id, "session id")?;
validate_non_empty(&options.objective, "objective")?;
validate_non_empty(&options.job_id, "job id")?;

View file

@ -1273,19 +1273,37 @@ mod tests {
use epiphany_core::EpiphanyRuntimeJobStatus;
use epiphany_core::EpiphanyWorkerLaunchDocument;
use epiphany_core::RuntimeSpineHeartbeatJobOptions;
use epiphany_core::open_runtime_spine_heartbeat_job;
use epiphany_core::runtime_job_snapshot;
use epiphany_core::runtime_worker_launch_request;
use epiphany_tool_adapter::EpiphanyToolInvocationIntent;
use tempfile::tempdir;
#[test]
fn packaged_runtime_exposes_read_only_decision_discovery_and_exact_audit() {
let source = include_str!("epiphany-openai-runtime.rs");
assert!(source.contains("\"list-decisions\" =>"));
assert!(source.contains("list_auditable_decision_contexts"));
assert!(source.contains("\"audit-decision\" =>"));
assert!(!source.contains(concat!("put_decision_", "context")));
fn seed_test_runtime_job(
store: &Path,
options: RuntimeSpineHeartbeatJobOptions,
) -> Result<()> {
epiphany_core::initialize_runtime_spine(
store,
epiphany_core::RuntimeSpineInitOptions {
runtime_id: options.runtime_id.clone(),
display_name: "Epiphany Test".into(),
created_at: options.created_at.clone(),
},
)?;
epiphany_core::ensure_runtime_session(
store,
epiphany_core::RuntimeSpineSessionOptions {
session_id: options.session_id.clone(),
objective: options.objective.clone(),
created_at: options.created_at.clone(),
coordinator_note: options.coordinator_note.clone(),
},
)?;
let mut cache = epiphany_core::runtime_spine_cache(store)?;
cache.pull_all_backing_stores()?;
let prepared = epiphany_core::prepare_runtime_spine_heartbeat_job(&cache, options)?;
cache.put_prepared_batch(prepared.envelopes)?;
Ok(())
}
fn assert_typed_model_pass_failure(
@ -1615,11 +1633,10 @@ mod tests {
fn repeated_tool_loop_seals_outer_worker_job() -> Result<()> {
let temp = tempdir()?;
let store = temp.path().join("runtime.msgpack");
open_runtime_spine_heartbeat_job(
seed_test_runtime_job(
&store,
RuntimeSpineHeartbeatJobOptions {
runtime_id: "epiphany-test".to_string(),
display_name: "Epiphany Test".to_string(),
session_id: "epiphany-main".to_string(),
objective: "Run typed worker.".to_string(),
coordinator_note: "test".to_string(),
@ -1728,11 +1745,10 @@ mod tests {
fn bounded_runtime_error_seals_outer_worker_job() -> Result<()> {
let temp = tempdir()?;
let store = temp.path().join("runtime.msgpack");
open_runtime_spine_heartbeat_job(
seed_test_runtime_job(
&store,
RuntimeSpineHeartbeatJobOptions {
runtime_id: "epiphany-test".to_string(),
display_name: "Epiphany Test".to_string(),
session_id: "epiphany-main".to_string(),
objective: "Run typed worker.".to_string(),
coordinator_note: "test".to_string(),
@ -1863,11 +1879,10 @@ mod tests {
fn tool_round_limit_seals_outer_worker_job_without_stall_status() -> Result<()> {
let temp = tempdir()?;
let store = temp.path().join("runtime.msgpack");
open_runtime_spine_heartbeat_job(
seed_test_runtime_job(
&store,
RuntimeSpineHeartbeatJobOptions {
runtime_id: "epiphany-test".to_string(),
display_name: "Epiphany Test".to_string(),
session_id: "epiphany-main".to_string(),
objective: "Run typed worker.".to_string(),
coordinator_note: "test".to_string(),

View file

@ -2460,12 +2460,39 @@ mod tests {
use super::*;
use epiphany_core::EpiphanyWorkerLaunchDocument;
use epiphany_core::RuntimeSpineHeartbeatJobOptions;
use epiphany_core::open_runtime_spine_heartbeat_job;
use epiphany_core::runtime_job_snapshot;
use epiphany_openai_adapter::EpiphanyOpenAiModelReceipt;
use sha2::{Digest, Sha256};
use tempfile::tempdir;
fn seed_test_runtime_job(
store: &Path,
options: RuntimeSpineHeartbeatJobOptions,
) -> Result<()> {
epiphany_core::initialize_runtime_spine(
store,
epiphany_core::RuntimeSpineInitOptions {
runtime_id: options.runtime_id.clone(),
display_name: "Epiphany Test".into(),
created_at: options.created_at.clone(),
},
)?;
epiphany_core::ensure_runtime_session(
store,
epiphany_core::RuntimeSpineSessionOptions {
session_id: options.session_id.clone(),
objective: options.objective.clone(),
created_at: options.created_at.clone(),
coordinator_note: options.coordinator_note.clone(),
},
)?;
let mut cache = epiphany_core::runtime_spine_cache(store)?;
cache.pull_all_backing_stores()?;
let prepared = epiphany_core::prepare_runtime_spine_heartbeat_job(&cache, options)?;
cache.put_prepared_batch(prepared.envelopes)?;
Ok(())
}
fn run_git(repo: &std::path::Path, args: &[&str]) -> Result<()> {
let output = std::process::Command::new("git")
.arg("-C")
@ -3776,11 +3803,10 @@ mod tests {
authority_cache.put(&soul_verdict.receipt_id, &soul_verdict)?;
let frontier_request =
epiphany_core::commit_repo_frontier_modeling_request(&store, &soul_verdict)?;
open_runtime_spine_heartbeat_job(
seed_test_runtime_job(
&store,
RuntimeSpineHeartbeatJobOptions {
runtime_id: "epiphany-test".to_string(),
display_name: "Epiphany Test".to_string(),
session_id: "epiphany-main".to_string(),
objective: "Run typed worker.".to_string(),
coordinator_note: "test".to_string(),
@ -4091,11 +4117,10 @@ mod tests {
fn verification_worker_request_advertises_read_only_source_tools() -> Result<()> {
let temp = tempdir()?;
let store = temp.path().join("runtime.msgpack");
open_runtime_spine_heartbeat_job(
seed_test_runtime_job(
&store,
RuntimeSpineHeartbeatJobOptions {
runtime_id: "epiphany-test".to_string(),
display_name: "Epiphany Test".to_string(),
session_id: "epiphany-main".to_string(),
objective: "Verify the machine.".to_string(),
coordinator_note: "test".to_string(),