Stop interrupting Epiphany through agent jobs
This commit is contained in:
parent
7e962ed796
commit
fa86559e6b
3 changed files with 3 additions and 69 deletions
Binary file not shown.
|
|
@ -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.
|
||||
|
|
|
|||
70
vendor/codex/codex-rs/core/src/codex_thread.rs
vendored
70
vendor/codex/codex-rs/core/src/codex_thread.rs
vendored
|
|
@ -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<EpiphanyJobBackendKind> {
|
||||
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,
|
||||
|
|
|
|||
Reference in a new issue