From fa86559e6b7b76fd2b3a7b513156b625ed744878 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 6 May 2026 11:42:05 +0100 Subject: [PATCH] Stop interrupting Epiphany through agent jobs --- state/ledgers.msgpack | Bin 47122 -> 47354 bytes state/map.yaml | 2 +- .../codex/codex-rs/core/src/codex_thread.rs | 70 +----------------- 3 files changed, 3 insertions(+), 69 deletions(-) diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 09415d1739510d047bbff8a6fad8096e11727315..9293446262a6ce71c3c3189206c6a554b2d67b75 100644 GIT binary patch delta 241 zcmZwCF-ikb5C&j&PhmM?C#>0oHATcm$PKJ)WcKZ_JF?DuzL_L!rG*C&g&aWe0HTOV z>4{8h<-^+U=ZEiy|M5Hj+2s%W`RCW`!8*%s-nQA<$KL(3>1I++rbT&Nl+*KZIjhFA zs(K3R!`qj6;LxEAaOG=YF^X{!48%k4rKOlU4dhJ0M{p>PdWD`^bOT^ZVwVXjM8DD# zU<20^MgAe&Ek*`LX1WHZx&~$;h6Yx~=2j*aQ2?kZ B4~hT) diff --git a/state/map.yaml b/state/map.yaml index a64b1613..b846fb2e 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -94,7 +94,7 @@ accepted_design: - GUI/client work must reflect or steer typed state rather than manufacture a second throne of truth. - The Aquarium operator UI now lives in sibling repo `E:\Projects\EpiphanyAquarium`, with its own `AGENTS.md`, `state/map.yaml`, `state/memory.json`, and interface doctrine. It remains a local Tauri v2 + React/WebGL client over EpiphanyAgent's app-server/tooling surfaces; app-server and typed Epiphany state remain authoritative. - EpiphanyAgent no longer carries the embedded `apps/epiphany-gui` source tree. Backend artifact directories and action tools still use the historical `.epiphany-gui` contract until that backend naming seam is deliberately renamed. - - Durable `job_bindings` now form a thin Epiphany-owned launcher seam: new specialist/reorient launches write heartbeat-backed bindings with launcher identity, authority scope, backend kind, and backend job id, and open matching typed runtime-spine job receipts under `state/runtime-spine.msgpack`. The older runtime-agent-job pointer remains schema compatibility only; new Epiphany launches do not create Codex `agent_jobs` rows. + - Durable `job_bindings` now form a thin Epiphany-owned launcher seam: new specialist/reorient launches write heartbeat-backed bindings with launcher identity, authority scope, backend kind, and backend job id, and open matching typed runtime-spine job receipts under `state/runtime-spine.msgpack`. Interrupt clears typed binding authority without inspecting or cancelling old Codex `agent_jobs` rows. The older runtime-agent-job pointer remains schema compatibility only; new Epiphany launches do not create Codex `agent_jobs` rows. - `thread/epiphany/jobs` is a read-only job/progress reflection: it derives indexing, remap, verification, and specialist slots from authoritative state and retrieval summaries, projects heartbeat-backed bindings as pending heartbeat turns, and only treats `agent_jobs` as a legacy read overlay for old bindings. It is not the scheduler, notification stream, or durable runtime job table. - `thread/epiphany/jobsUpdated` is legacy Codex evacuation telemetry only: it can still translate old runtime `agent_job_progress:{json}` background events for old bindings, but heartbeat-owned Epiphany activation is the live path. - `thread/epiphany/freshness` is the first read-only freshness surface: it derives retrieval and graph staleness from live retrieval summaries plus frontier/churn state, and for loaded threads reflects watcher-backed invalidation inputs with changed paths plus mapped graph/frontier hits, without mutating, scheduling, or performing automatic semantic invalidation. diff --git a/vendor/codex/codex-rs/core/src/codex_thread.rs b/vendor/codex/codex-rs/core/src/codex_thread.rs index 390be93d..8882d223 100644 --- a/vendor/codex/codex-rs/core/src/codex_thread.rs +++ b/vendor/codex/codex-rs/core/src/codex_thread.rs @@ -10,7 +10,6 @@ use crate::session::Codex; use crate::session::SessionSettingsUpdate; use crate::session::SteerInputError; use codex_features::Feature; -use codex_protocol::ThreadId; use codex_protocol::config_types::ApprovalsReviewer; use codex_protocol::config_types::CollaborationMode; use codex_protocol::config_types::Personality; @@ -605,62 +604,8 @@ impl CodexThread { request.binding_id ))); }; - let binding = current_state.job_bindings[binding_index].clone(); - - let mut interrupted_thread_ids = Vec::new(); - let mut cancel_requested = false; - if binding_backend_kind_core(&binding) == Some(EpiphanyJobBackendKind::AgentJobs) - && let Some(agent_job_id) = binding_agent_jobs_job_id_core(&binding) - && let Some(state_db) = self.epiphany_state_runtime().await - { - let running_items = state_db - .list_agent_job_items( - agent_job_id, - Some(codex_state::AgentJobItemStatus::Running), - Some(64), - ) - .await - .map_err(|err| { - CodexErr::Fatal(format!( - "failed to inspect running legacy Epiphany backend job items: {err}" - )) - })?; - for running_item in running_items { - let Some(assigned_thread_id) = running_item.assigned_thread_id else { - continue; - }; - let Ok(thread_id) = ThreadId::from_string(assigned_thread_id.as_str()) else { - continue; - }; - match self - .codex - .session - .services - .agent_control - .shutdown_live_agent(thread_id) - .await - { - Ok(_) | Err(CodexErr::ThreadNotFound(_)) | Err(CodexErr::InternalAgentDied) => { - interrupted_thread_ids.push(assigned_thread_id); - } - Err(err) => { - return Err(CodexErr::Fatal(format!( - "failed to interrupt Epiphany worker thread {assigned_thread_id}: {err}" - ))); - } - } - } - - cancel_requested = state_db - .mark_agent_job_cancelled( - agent_job_id, - request.reason.as_deref().unwrap_or( - "Epiphany launch authority requested an interrupt for a legacy bound backend job.", - ), - ) - .await - .unwrap_or(false); - } + let interrupted_thread_ids = Vec::new(); + let cancel_requested = false; let next_job_bindings = clear_epiphany_job_binding_backend( current_state.job_bindings.clone(), @@ -1011,10 +956,6 @@ fn clear_epiphany_job_binding_backend( bindings } -fn binding_backend_kind_core(binding: &EpiphanyJobBinding) -> Option { - binding.backend_kind -} - fn binding_backend_job_id_core(binding: &EpiphanyJobBinding) -> Option<&str> { binding .backend_job_id @@ -1022,13 +963,6 @@ fn binding_backend_job_id_core(binding: &EpiphanyJobBinding) -> Option<&str> { .or(binding.runtime_agent_job_id.as_deref()) } -fn binding_agent_jobs_job_id_core(binding: &EpiphanyJobBinding) -> Option<&str> { - match binding_backend_kind_core(binding) { - Some(EpiphanyJobBackendKind::AgentJobs) => binding_backend_job_id_core(binding), - Some(EpiphanyJobBackendKind::Heartbeat) | None => None, - } -} - fn epiphany_state_update_validation_errors( state: &EpiphanyThreadState, update: &EpiphanyStateUpdate,