Run worker launches through OpenAI runtime

This commit is contained in:
Meta Vens 2026-05-13 08:24:29 +01:00
commit 86462e7b0b
5 changed files with 377 additions and 6 deletions

View file

@ -11,6 +11,7 @@ use epiphany_openai_adapter::EpiphanyOpenAiModelRequest;
use epiphany_openai_adapter::EpiphanyOpenAiStreamEvent;
use epiphany_openai_adapter::EpiphanyOpenAiStreamPayload;
use epiphany_openai_runtime::EpiphanyOpenAiRuntimeOptions;
use epiphany_openai_runtime::EpiphanyWorkerRuntimeOptions;
use epiphany_openai_runtime::OPENAI_RUNTIME_ROLE;
use epiphany_openai_runtime::assistant_text_from_openai_events;
use epiphany_openai_runtime::default_codex_home;
@ -18,6 +19,7 @@ use epiphany_openai_runtime::default_options;
use epiphany_openai_runtime::ensure_openai_runtime_ready;
use epiphany_openai_runtime::record_openai_events;
use epiphany_openai_runtime::run_openai_model_turn;
use epiphany_openai_runtime::run_worker_launch;
use serde_json::json;
use uuid::Uuid;
@ -47,6 +49,17 @@ async fn main() -> Result<()> {
}
print_json(&summary)?;
}
"run-worker" => {
let options = parse_run_worker_options(args.collect())?;
let summary = run_worker_launch(EpiphanyWorkerRuntimeOptions {
store_path: options.store_path,
codex_home: options.codex_home,
job_id: options.job_id,
model: options.model,
})
.await?;
print_json(&summary)?;
}
"smoke" => {
let options = parse_smoke_options(args.collect())?;
let mut request = EpiphanyOpenAiModelRequest::new(
@ -145,6 +158,13 @@ struct SmokeCliOptions {
codex_home: PathBuf,
}
struct RunWorkerCliOptions {
store_path: PathBuf,
codex_home: PathBuf,
job_id: String,
model: String,
}
fn parse_model_turn_options(args: Vec<String>) -> Result<ModelTurnCliOptions> {
let mut store_path = PathBuf::from(DEFAULT_STORE);
let mut codex_home = default_codex_home()?;
@ -185,6 +205,29 @@ fn parse_model_turn_options(args: Vec<String>) -> Result<ModelTurnCliOptions> {
})
}
fn parse_run_worker_options(args: Vec<String>) -> Result<RunWorkerCliOptions> {
let mut store_path = PathBuf::from(DEFAULT_STORE);
let mut codex_home = default_codex_home()?;
let mut job_id = None;
let mut model = "gpt-5.4".to_string();
let mut iter = args.into_iter();
while let Some(arg) = iter.next() {
match arg.as_str() {
"--store" => store_path = PathBuf::from(next_value(&mut iter, "--store")?),
"--codex-home" => codex_home = PathBuf::from(next_value(&mut iter, "--codex-home")?),
"--job-id" => job_id = Some(next_value(&mut iter, "--job-id")?),
"--model" | "--default-model" => model = next_value(&mut iter, "--model")?,
other => return Err(anyhow!("unknown run-worker argument: {other}")),
}
}
Ok(RunWorkerCliOptions {
store_path,
codex_home,
job_id: job_id.context("run-worker requires --job-id")?,
model,
})
}
fn parse_smoke_options(args: Vec<String>) -> Result<SmokeCliOptions> {
let mut store_path = PathBuf::from(format!(
".epiphany-dogfood/openai-runtime/smoke-{}.msgpack",
@ -220,5 +263,5 @@ fn now() -> String {
}
fn usage() -> &'static str {
"usage: epiphany-openai-runtime <model-turn|smoke> [--store path] [--codex-home path] [--request path] [--session-id id] [--job-id id] [--objective text] [--default-model model] [--output-last-message path]"
"usage: epiphany-openai-runtime <model-turn|run-worker|smoke> [--store path] [--codex-home path] [--request path] [--session-id id] [--job-id id] [--objective text] [--default-model model] [--output-last-message path]"
}

View file

@ -4,9 +4,12 @@ use std::sync::Arc;
use anyhow::Context;
use anyhow::Result;
use anyhow::anyhow;
use chrono::SecondsFormat;
use codex_login::AuthCredentialsStoreMode;
use codex_login::AuthManager;
use epiphany_core::EpiphanyRuntimeWorkerLaunchRequest;
use epiphany_core::EpiphanyWorkerLaunchDocument;
use epiphany_core::RuntimeSpineEventOptions;
use epiphany_core::RuntimeSpineInitOptions;
use epiphany_core::RuntimeSpineJobOptions;
@ -20,11 +23,13 @@ use epiphany_core::initialize_runtime_spine;
use epiphany_core::runtime_spine_cache;
use epiphany_core::runtime_spine_status;
use epiphany_openai_adapter::EpiphanyOpenAiAdapterStatus;
use epiphany_openai_adapter::EpiphanyOpenAiInputItem;
use epiphany_openai_adapter::EpiphanyOpenAiModelRequest;
use epiphany_openai_adapter::EpiphanyOpenAiStreamEvent;
use epiphany_openai_adapter::EpiphanyOpenAiStreamPayload;
use epiphany_openai_codex_spine::EpiphanyCodexOpenAiTransport;
use epiphany_openai_codex_spine::status_from_auth_manager;
use serde_json::Value;
pub const OPENAI_RUNTIME_ROLE: &str = "openai-model-adapter";
pub const OPENAI_RUNTIME_SOURCE: &str = "epiphany-openai-runtime";
@ -53,6 +58,27 @@ pub struct EpiphanyOpenAiRuntimeRunSummary {
pub receipt_id: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct EpiphanyWorkerRuntimeOptions {
pub store_path: PathBuf,
pub codex_home: PathBuf,
pub job_id: String,
pub model: String,
}
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize)]
#[serde(rename_all = "camelCase")]
pub struct EpiphanyWorkerRuntimeRunSummary {
pub store: String,
pub job_id: String,
pub binding_id: String,
pub role: String,
pub request_id: String,
pub openai_result_id: String,
pub worker_result_id: String,
pub verdict: String,
}
pub async fn run_openai_model_turn(
options: EpiphanyOpenAiRuntimeOptions,
request: EpiphanyOpenAiModelRequest,
@ -113,6 +139,47 @@ pub async fn run_openai_model_turn(
record_openai_events(&options.store_path, &options, &request, &events)
}
pub async fn run_worker_launch(
options: EpiphanyWorkerRuntimeOptions,
) -> Result<EpiphanyWorkerRuntimeRunSummary> {
let launch_request = load_worker_launch_request(&options.store_path, &options.job_id)?;
let model_request = build_worker_model_request(&launch_request, &options.model)?;
let openai_options = EpiphanyOpenAiRuntimeOptions {
store_path: options.store_path.clone(),
codex_home: options.codex_home,
session_id: format!("openai-worker-session-{}", launch_request.binding_id),
job_id: format!("openai-worker-{}", launch_request.job_id),
objective: format!(
"Run Epiphany worker {} for {}",
launch_request.job_id, launch_request.binding_id
),
coordinator_note: "Native worker runtime route; Codex is auth/model transport only."
.to_string(),
default_model: Some(options.model),
};
let openai_summary =
run_openai_model_turn(openai_options.clone(), model_request.clone()).await?;
let assistant_text =
assistant_text_from_openai_events(&openai_options.store_path, &model_request.request_id)?;
let worker_result = complete_worker_job_from_assistant_text(
&openai_options.store_path,
&launch_request,
&model_request.request_id,
&openai_summary,
&assistant_text,
)?;
Ok(EpiphanyWorkerRuntimeRunSummary {
store: openai_options.store_path.display().to_string(),
job_id: launch_request.job_id,
binding_id: launch_request.binding_id,
role: launch_request.role,
request_id: model_request.request_id,
openai_result_id: openai_summary.result_id,
worker_result_id: worker_result.result_id,
verdict: worker_result.verdict,
})
}
pub fn record_openai_events(
store_path: impl AsRef<Path>,
options: &EpiphanyOpenAiRuntimeOptions,
@ -209,6 +276,102 @@ pub fn record_openai_events(
})
}
pub fn load_worker_launch_request(
store_path: impl AsRef<Path>,
job_id: &str,
) -> Result<EpiphanyRuntimeWorkerLaunchRequest> {
let mut cache = runtime_spine_cache(store_path)?;
cache.pull_all_backing_stores()?;
cache
.get::<EpiphanyRuntimeWorkerLaunchRequest>(job_id)?
.ok_or_else(|| anyhow!("runtime worker launch request {job_id:?} does not exist"))
}
pub fn build_worker_model_request(
launch_request: &EpiphanyRuntimeWorkerLaunchRequest,
model: &str,
) -> Result<EpiphanyOpenAiModelRequest> {
let launch_document = launch_request.launch_document()?;
let request_id = format!(
"worker-{}-{}",
sanitize_request_id(&launch_request.job_id),
chrono::Utc::now().timestamp_millis()
);
let launch_document_text = serde_json::to_string_pretty(&launch_document)
.context("failed to render worker launch document for model input")?;
let mut request = EpiphanyOpenAiModelRequest::new(
request_id,
format!("worker-{}", launch_request.binding_id),
model.to_string(),
worker_instructions(launch_request, &launch_document),
);
request.input.push(EpiphanyOpenAiInputItem::UserText {
text: format!(
"Execute this Epiphany worker launch document.\n\n```json\n{launch_document_text}\n```"
),
});
request.output_contract_id = Some(launch_request.output_contract_id.clone());
Ok(request)
}
pub fn complete_worker_job_from_assistant_text(
store_path: impl AsRef<Path>,
launch_request: &EpiphanyRuntimeWorkerLaunchRequest,
openai_request_id: &str,
openai_summary: &EpiphanyOpenAiRuntimeRunSummary,
assistant_text: &str,
) -> Result<epiphany_core::EpiphanyRuntimeJobResult> {
let parsed = parse_assistant_json_object(assistant_text).ok();
let openai_failed = openai_summary.verdict != "pass";
let verdict = if openai_failed {
"failed".to_string()
} else {
parsed
.as_ref()
.and_then(|value| {
string_field(value, "verdict").or_else(|| string_field(value, "mode"))
})
.unwrap_or_else(|| "completed".to_string())
};
let summary = if openai_failed {
format!("Worker model request {openai_request_id} failed before producing usable output.")
} else {
parsed
.as_ref()
.and_then(|value| string_field(value, "summary"))
.unwrap_or_else(|| "Worker completed without a structured summary.".to_string())
};
let next_safe_move = parsed
.as_ref()
.and_then(|value| string_field(value, "nextSafeMove"))
.unwrap_or_else(|| {
"Review the typed worker runtime result before accepting state.".to_string()
});
let mut evidence_refs = parsed
.as_ref()
.map(|value| string_array_field(value, "evidenceIds"))
.unwrap_or_default();
evidence_refs.push(format!("openai-request:{openai_request_id}"));
let mut artifact_refs = parsed
.as_ref()
.map(|value| string_array_field(value, "artifactRefs"))
.unwrap_or_default();
artifact_refs.push(format!("openai-result:{}", openai_summary.result_id));
complete_runtime_job(
store_path,
RuntimeSpineJobResultOptions {
result_id: format!("result-worker-{}", launch_request.job_id),
job_id: launch_request.job_id.clone(),
completed_at: now(),
verdict,
summary,
next_safe_move,
evidence_refs,
artifact_refs,
},
)
}
pub fn ensure_openai_runtime_ready(options: &EpiphanyOpenAiRuntimeOptions) -> Result<()> {
let status = runtime_spine_status(&options.store_path)?;
if status.present {
@ -352,6 +515,82 @@ fn openai_event_summary(event: &EpiphanyOpenAiStreamEvent) -> String {
}
}
fn worker_instructions(
launch_request: &EpiphanyRuntimeWorkerLaunchRequest,
launch_document: &EpiphanyWorkerLaunchDocument,
) -> String {
let output_contract = worker_output_contract_text(launch_document);
format!(
"{}\n\nReturn only one JSON object. No Markdown, no commentary.\n\n{}",
launch_request.instruction, output_contract
)
}
fn worker_output_contract_text(document: &EpiphanyWorkerLaunchDocument) -> &'static str {
match document {
EpiphanyWorkerLaunchDocument::Role(_) => {
"Required role-result fields: roleId, verdict, summary, nextSafeMove, filesInspected. Modeling and Imagination workers must include their required statePatch. Use arrays for frontierNodeIds, evidenceIds, openQuestions, evidenceGaps, risks, and artifactRefs when present."
}
EpiphanyWorkerLaunchDocument::Reorient(_) => {
"Required reorient-result fields: mode, summary, nextSafeMove. Include checkpointStillValid, filesInspected, frontierNodeIds, evidenceIds, openQuestions, and continuityRisks when present."
}
}
}
fn parse_assistant_json_object(text: &str) -> Result<Value> {
let trimmed = text.trim();
let candidate = trimmed
.strip_prefix("```json")
.and_then(|value| value.strip_suffix("```"))
.or_else(|| {
trimmed
.strip_prefix("```")
.and_then(|value| value.strip_suffix("```"))
})
.unwrap_or(trimmed)
.trim();
let value: Value = serde_json::from_str(candidate).context("assistant text was not JSON")?;
if !value.is_object() {
return Err(anyhow!("assistant JSON result must be an object"));
}
Ok(value)
}
fn string_field(value: &Value, key: &str) -> Option<String> {
value
.get(key)
.and_then(Value::as_str)
.map(str::trim)
.filter(|value| !value.is_empty())
.map(ToString::to_string)
}
fn string_array_field(value: &Value, key: &str) -> Vec<String> {
value
.get(key)
.and_then(Value::as_array)
.into_iter()
.flatten()
.filter_map(Value::as_str)
.map(str::trim)
.filter(|value| !value.is_empty())
.map(ToString::to_string)
.collect()
}
fn sanitize_request_id(value: &str) -> String {
value
.chars()
.map(|ch| {
if ch.is_ascii_alphanumeric() || ch == '-' || ch == '_' {
ch
} else {
'-'
}
})
.collect()
}
fn now() -> String {
chrono::Utc::now().to_rfc3339_opts(SecondsFormat::Secs, true)
}
@ -359,6 +598,9 @@ fn now() -> String {
#[cfg(test)]
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 tempfile::tempdir;
@ -428,4 +670,84 @@ mod tests {
);
Ok(())
}
#[test]
fn completes_worker_job_from_model_json_without_codex_worker_runtime() -> Result<()> {
let temp = tempdir()?;
let store = temp.path().join("runtime.msgpack");
open_runtime_spine_heartbeat_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(),
job_id: "worker-job-1".to_string(),
role: "modeling".to_string(),
binding_id: "modeling-checkpoint-worker".to_string(),
authority_scope: "epiphany.role.modeling".to_string(),
instruction: "Return the required role-result JSON.".to_string(),
launch_document: EpiphanyWorkerLaunchDocument::Role(
epiphany_core::EpiphanyRoleWorkerLaunchDocument {
thread_id: "thread-1".to_string(),
role_id: "modeling".to_string(),
state_revision: 1,
objective: Some("Map the machine.".to_string()),
active_subgoal_id: None,
active_subgoals: Vec::new(),
active_graph_node_ids: Vec::new(),
investigation_checkpoint: None,
scratch: None,
invariants: Vec::new(),
graphs: None,
recent_evidence: Vec::new(),
recent_observations: Vec::new(),
graph_frontier: None,
graph_checkpoint: None,
planning: None,
churn: None,
},
),
output_contract_id: epiphany_core::ROLE_WORKER_OUTPUT_CONTRACT_ID.to_string(),
created_at: now(),
},
)?;
let launch_request = load_worker_launch_request(&store, "worker-job-1")?;
let model_request = build_worker_model_request(&launch_request, "gpt-5.4")?;
assert_eq!(
model_request.output_contract_id.as_deref(),
Some(epiphany_core::ROLE_WORKER_OUTPUT_CONTRACT_ID)
);
let openai_summary = EpiphanyOpenAiRuntimeRunSummary {
store: store.display().to_string(),
session_id: "openai-worker-session-modeling-checkpoint-worker".to_string(),
job_id: "openai-worker-worker-job-1".to_string(),
request_id: model_request.request_id.clone(),
event_count: 2,
verdict: "pass".to_string(),
result_id: "result-openai-worker-worker-job-1".to_string(),
receipt_id: Some(model_request.request_id.clone()),
};
let result = complete_worker_job_from_assistant_text(
&store,
&launch_request,
&model_request.request_id,
&openai_summary,
r#"{"roleId":"modeling","verdict":"checkpoint-ready","summary":"Mapped.","nextSafeMove":"Review the patch.","filesInspected":["src/lib.rs"],"evidenceIds":["ev-1"],"artifactRefs":["artifact:model"]}"#,
)?;
assert_eq!(result.job_id, "worker-job-1");
assert_eq!(result.verdict, "checkpoint-ready");
assert_eq!(result.summary, "Mapped.");
assert_eq!(result.next_safe_move, "Review the patch.");
assert!(result.evidence_refs.contains(&"ev-1".to_string()));
assert!(
runtime_job_snapshot(&store, "worker-job-1")?
.expect("snapshot")
.result
.is_some()
);
Ok(())
}
}

View file

@ -586,9 +586,15 @@ outside-vendor `epiphany-openai-runtime` crate writes typed model-turn
requests, stream events, terminal receipts, runtime sessions, jobs, job
results, and runtime events into the native runtime spine. Its `model-turn`
command calls the Codex-backed typed transport; its `smoke` command proves the
storage route without network. The next cut is to move live callers from
Codex app-server JSON-RPC onto this runtime route, then carve down the
`codex-api` dependency weight.
storage route without network. Its `run-worker` command now reads a durable
`EpiphanyRuntimeWorkerLaunchRequest` by runtime job id, builds a typed OpenAI
model request, calls the native runtime route, and completes the original
heartbeat/specialist runtime job without Codex worker execution. The remaining
result wound is deliberate and named: rich role/reorient output is still parsed
from model-edge JSON into generic job-result fields. The next cut is a
first-class typed runtime worker result document plus roleResult/reorientResult
readback through that document, then carving down the `codex-api` dependency
weight.
The runtime-spine job-opening mechanism for heartbeat/specialist launches has
also been pulled into `epiphany-core` as `open_runtime_spine_heartbeat_job`.

Binary file not shown.

View file

@ -279,5 +279,5 @@ rejected_paths:
reason: making Epiphany cleaner inside Codex still preserves the wrong organ; Codex must be starved down to OpenAI subscription auth/model transport, while Epiphany data and subsystem communication move to typed CultCache/CultNet.
current_status:
summary: The Codex starvation pass has five typing receipts, eighteen processor cuts, a real physical extraction in `epiphany-codex-bridge`, a source-grounded Codex auth spine inventory, the native `epiphany-openai-adapter` document boundary, a buildable Codex auth/model wrapper in `epiphany-openai-codex-spine`, the first native runtime caller in `epiphany-openai-runtime`, native heartbeat launch planning/job opening in `epiphany-core`, native state-update contract/validation/application in `epiphany-core`, and the route-facing mutation service in `epiphany-codex-bridge`. The bridge owns Codex-facing Epiphany adapters for scene, jobs, context/planning/graph query, retrieval/indexing projection, result projection, runtime-spine result adaptation, launch/prompt doctrine, mutation document mechanics, mutation service update/promote/role-accept/reorient-accept/role-launch/reorient-launch/job-launch/job-interrupt application, live-state projection, pressure/pre-compaction rendering, freshness/reorientation projection, CRRC/coordinator/role-board projection, and acceptance/evidence signal helpers. Vendored app-server now retains only `epiphany_invalidation.rs` as a root Epiphany module because watcher lifecycle is still app-server machinery; `codex_message_processor.rs` still contains route dispatch, JSON-RPC response shaping, watcher registration/snapshotting, and notification emission. The processor is about 10,339 lines, `epiphany_mutation_routes.rs` is about 691 lines after the route-load/notification helper cut and index projection move, `epiphany_state_helpers.rs` is down to a 19-line rollout-state loader, and `codex_thread.rs` is about 1,425 lines after state-update law moved native. `epiphany-openai-adapter` defines CultCache `DatabaseEntry` request/event/receipt/auth-status documents with no Codex app-server or generic JSON dependency. `epiphany-openai-codex-spine` projects `AuthManager` / `CodexAuth` into typed `EpiphanyOpenAiAdapterStatus`, maps typed `EpiphanyOpenAiModelRequest` into Codex API `ResponsesApiRequest`, resolves auth/provider through keeper Codex crates, opens HTTP Responses streams through `codex-api`, maps deltas / completion into typed stream events and receipts, and no longer directly depends on `codex-app-server-protocol` just to name auth mode. `epiphany-openai-runtime` writes OpenAI status/request/stream-event/receipt records plus runtime sessions/jobs/results/events into `epiphany-core::runtime_spine_cache`, can emit the assistant text artifact for legacy result consumers, and is now the default executor for startup-only repo birth specialists; `codex exec` survives there only as explicit fallback. `epiphany-core::plan_runtime_spine_heartbeat_launch` validates launch contracts/conflicts and projects durable job bindings/runtime links; `epiphany-core::open_runtime_spine_heartbeat_job` owns the initialize-runtime/ensure-session/create-job sequence and now persists `EpiphanyRuntimeWorkerLaunchRequest` CultCache records keyed by runtime job id, with indexed kind/contract fields plus MessagePack-encoded typed launch documents instead of discarding work intent after queue receipt creation; `epiphany-core::EpiphanyStateUpdate`, `epiphany_state_update_validation_errors`, and `apply_epiphany_state_update` own state-update document shape and mutation law while `codex-core` calls them for compatibility. Vendored `CodexThread::epiphany_launch_job` is now mostly revision check, persistence validation, launch request handoff, and rollout/session writeback for the compatibility route. `epiphany-runtime-spine` advertises OpenAI adapter status/model-request/stream-event/receipt CultNet schemas and mutation contracts, so the native caller now has a real storage route instead of only JSON-RPC. MCP itself is correctly JSON at its protocol edge; the target is typed Epiphany intent/result/receipt wrappers around MCP, not replacing MCP JSON. The current OpenAI spine still pulls `codex-api` and a large transport dependency stack, so its next cut is dependency starvation after more live callers move.
next_action: Move the remaining live model-turn callers, especially heartbeat/specialist execution, onto `epiphany-openai-runtime` or the same native CultNet contract, then shrink the surviving Codex dependency surface to credential refresh, provider/model routing, and the smallest OpenAI Responses call required for Codex subscription compatibility.
summary: The Codex starvation pass has five typing receipts, eighteen processor cuts, a real physical extraction in `epiphany-codex-bridge`, a source-grounded Codex auth spine inventory, the native `epiphany-openai-adapter` document boundary, a buildable Codex auth/model wrapper in `epiphany-openai-codex-spine`, the first native runtime caller in `epiphany-openai-runtime`, native heartbeat launch planning/job opening in `epiphany-core`, native state-update contract/validation/application in `epiphany-core`, and the route-facing mutation service in `epiphany-codex-bridge`. The bridge owns Codex-facing Epiphany adapters for scene, jobs, context/planning/graph query, retrieval/indexing projection, result projection, runtime-spine result adaptation, launch/prompt doctrine, mutation document mechanics, mutation service update/promote/role-accept/reorient-accept/role-launch/reorient-launch/job-launch/job-interrupt application, live-state projection, pressure/pre-compaction rendering, freshness/reorientation projection, CRRC/coordinator/role-board projection, and acceptance/evidence signal helpers. Vendored app-server now retains only `epiphany_invalidation.rs` as a root Epiphany module because watcher lifecycle is still app-server machinery; `codex_message_processor.rs` still contains route dispatch, JSON-RPC response shaping, watcher registration/snapshotting, and notification emission. The processor is about 10,339 lines, `epiphany_mutation_routes.rs` is about 691 lines after the route-load/notification helper cut and index projection move, `epiphany_state_helpers.rs` is down to a 19-line rollout-state loader, and `codex_thread.rs` is about 1,425 lines after state-update law moved native. `epiphany-openai-adapter` defines CultCache `DatabaseEntry` request/event/receipt/auth-status documents with no Codex app-server or generic JSON dependency. `epiphany-openai-codex-spine` projects `AuthManager` / `CodexAuth` into typed `EpiphanyOpenAiAdapterStatus`, maps typed `EpiphanyOpenAiModelRequest` into Codex API `ResponsesApiRequest`, resolves auth/provider through keeper Codex crates, opens HTTP Responses streams through `codex-api`, maps deltas / completion into typed stream events and receipts, and no longer directly depends on `codex-app-server-protocol` just to name auth mode. `epiphany-openai-runtime` writes OpenAI status/request/stream-event/receipt records plus runtime sessions/jobs/results/events into `epiphany-core::runtime_spine_cache`, can emit the assistant text artifact for legacy result consumers, is now the default executor for startup-only repo birth specialists, and now has `run-worker` to load a durable `EpiphanyRuntimeWorkerLaunchRequest`, call the typed OpenAI runtime, and complete the original heartbeat/specialist runtime job without Codex worker execution; `codex exec` survives only as explicit fallback in repo-birth startup. `epiphany-core::plan_runtime_spine_heartbeat_launch` validates launch contracts/conflicts and projects durable job bindings/runtime links; `epiphany-core::open_runtime_spine_heartbeat_job` owns the initialize-runtime/ensure-session/create-job sequence and now persists `EpiphanyRuntimeWorkerLaunchRequest` CultCache records keyed by runtime job id, with indexed kind/contract fields plus MessagePack-encoded typed launch documents instead of discarding work intent after queue receipt creation; `epiphany-core::EpiphanyStateUpdate`, `epiphany_state_update_validation_errors`, and `apply_epiphany_state_update` own state-update document shape and mutation law while `codex-core` calls them for compatibility. Vendored `CodexThread::epiphany_launch_job` is now mostly revision check, persistence validation, launch request handoff, and rollout/session writeback for the compatibility route. `epiphany-runtime-spine` advertises OpenAI adapter status/model-request/stream-event/receipt CultNet schemas and mutation contracts, so the native caller now has a real storage route instead of only JSON-RPC. MCP itself is correctly JSON at its protocol edge; the target is typed Epiphany intent/result/receipt wrappers around MCP, not replacing MCP JSON. The current OpenAI spine still pulls `codex-api` and a large transport dependency stack, so its next cut is dependency starvation after richer live callers move.
next_action: Promote worker role/reorient outputs from model-edge JSON into first-class typed runtime worker result CultCache documents, teach roleResult/reorientResult to read those documents instead of lossy generic runtime job summaries, then shrink the surviving Codex dependency surface to credential refresh, provider/model routing, and the smallest OpenAI Responses call required for Codex subscription compatibility.