diff --git a/epiphany-core/src/lib.rs b/epiphany-core/src/lib.rs index 05b56896..7b875e9f 100644 --- a/epiphany-core/src/lib.rs +++ b/epiphany-core/src/lib.rs @@ -291,7 +291,6 @@ pub use runtime_spine::coordinator_run_receipts; pub use runtime_spine::coordinator_run_session_id; pub use runtime_spine::create_runtime_job; pub use runtime_spine::create_runtime_session; -pub use runtime_spine::ensure_runtime_session; pub use runtime_spine::finalize_coordinator_run; pub use runtime_spine::initialize_runtime_spine; pub use runtime_spine::model_pass_failure_for_request; diff --git a/epiphany-core/src/runtime_spine.rs b/epiphany-core/src/runtime_spine.rs index eac820bf..2cf781ed 100644 --- a/epiphany-core/src/runtime_spine.rs +++ b/epiphany-core/src/runtime_spine.rs @@ -1077,42 +1077,6 @@ pub fn create_runtime_session( Ok(session) } -pub fn ensure_runtime_session( - store_path: impl AsRef, - options: RuntimeSpineSessionOptions, -) -> Result { - validate_non_empty(&options.session_id, "session id")?; - validate_non_empty(&options.objective, "objective")?; - validate_non_empty(&options.created_at, "created at")?; - let mut cache = runtime_spine_cache(store_path.as_ref())?; - cache.pull_all_backing_stores()?; - require_identity(&cache)?; - require_runtime_identity_not_archived(&cache, "session", &options.session_id)?; - if let Some(existing) = cache.get::(&options.session_id)? { - if matches!( - existing.status, - EpiphanyRuntimeSessionStatus::Completed | EpiphanyRuntimeSessionStatus::Archived - ) { - return Err(anyhow!( - "runtime session {:?} is terminal and cannot accept jobs", - options.session_id - )); - } - return Ok(existing); - } - let session = EpiphanyRuntimeSession { - schema_version: RUNTIME_SPINE_SCHEMA_VERSION.to_string(), - session_id: options.session_id.clone(), - objective: options.objective, - status: EpiphanyRuntimeSessionStatus::Active, - created_at: options.created_at.clone(), - updated_at: options.created_at, - coordinator_note: options.coordinator_note, - }; - cache.put(&options.session_id, &session)?; - Ok(session) -} - pub fn close_runtime_session( store_path: impl AsRef, options: RuntimeSpineSessionClosureOptions, diff --git a/epiphany-openai-runtime/src/bin/epiphany-openai-runtime.rs b/epiphany-openai-runtime/src/bin/epiphany-openai-runtime.rs index 797cf4a1..475eb7ef 100644 --- a/epiphany-openai-runtime/src/bin/epiphany-openai-runtime.rs +++ b/epiphany-openai-runtime/src/bin/epiphany-openai-runtime.rs @@ -1204,7 +1204,7 @@ mod tests { created_at: options.created_at.clone(), }, )?; - epiphany_core::ensure_runtime_session( + epiphany_core::create_runtime_session( store, epiphany_core::RuntimeSpineSessionOptions { session_id: options.session_id.clone(), diff --git a/epiphany-openai-runtime/src/lib.rs b/epiphany-openai-runtime/src/lib.rs index 96b393a7..3fb908bc 100644 --- a/epiphany-openai-runtime/src/lib.rs +++ b/epiphany-openai-runtime/src/lib.rs @@ -2463,7 +2463,7 @@ mod tests { created_at: options.created_at.clone(), }, )?; - epiphany_core::ensure_runtime_session( + epiphany_core::create_runtime_session( store, epiphany_core::RuntimeSpineSessionOptions { session_id: options.session_id.clone(),