Move Epiphany interrupt job projection to bridge

This commit is contained in:
Meta Vens 2026-05-13 03:52:09 +01:00
commit 5e66f8004d
5 changed files with 24 additions and 12 deletions

View file

@ -83,6 +83,23 @@ pub fn map_launched_epiphany_job(
})
}
pub fn map_interrupted_epiphany_job(
state: &EpiphanyThreadState,
binding_id: &str,
) -> ThreadEpiphanyJob {
map_epiphany_jobs(Some(state), None)
.into_iter()
.find(|job| job.id == binding_id)
.unwrap_or_else(|| {
epiphany_blocked_state_job(
binding_id,
ThreadEpiphanyJobKind::Specialist,
"role-scoped specialist work",
"Interrupted job binding was not reflected in Epiphany state.",
)
})
}
fn map_core_epiphany_job_status(status: CoreEpiphanyJobStatus) -> ThreadEpiphanyJobStatus {
match status {
CoreEpiphanyJobStatus::Idle => ThreadEpiphanyJobStatus::Idle,

View file

@ -527,6 +527,10 @@ The twenty-sixth cut moved protocol `ThreadEpiphanyUpdatePatch` to core
`EpiphanyStateUpdate` projection into `epiphany-codex-bridge/src/mutation.rs`.
Role accept, promote, and update routes no longer hand-copy every patch field
into a core update struct. `epiphany_mutation_routes.rs` is about 1,087 lines.
The twenty-seventh cut moved interrupted-job fallback projection into
`epiphany-codex-bridge/src/jobs.rs`; job interrupt no longer hand-builds its
blocked fallback projection in the route. `epiphany_mutation_routes.rs` is
about 1,078 lines.
Also: MCP itself is allowed to be JSON. The target is not "replace MCP JSON";
the target is an Epiphany-owned boundary that speaks typed Epiphany

Binary file not shown.

View file

@ -278,5 +278,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, seventeen processor cuts, and now a real physical extraction: `epiphany-codex-bridge` lives outside `vendor/codex` and owns the Codex-facing Epiphany adapters for scene, jobs, context/planning/graph query, retrieval, result projection, runtime-spine result adaptation, launch/prompt doctrine, mutation document mechanics, 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 and mutation orchestration. The processor is about 10,339 lines, `epiphany_mutation_routes.rs` is about 1,087 lines, and `epiphany_state_helpers.rs` is down to a 19-line rollout-state loader after moving typed mutation helpers, reviewability checks, completed runtime-result acceptance loading, live-state projection, launched-job fallback projection, role/reorient acceptance update bundle construction, and protocol patch-to-core state-update projection out to the bridge. This is progress, not absolution: the bridge is still Codex-facing compatibility, not the final CultNet runtime, and route-level launch/update/promote/interrupt orchestration still lives inside the Codex processor. MCP itself is correctly JSON at its protocol edge; the target is typed Epiphany intent/result/receipt wrappers around MCP, not replacing MCP JSON.
summary: The Codex starvation pass has five typing receipts, seventeen processor cuts, and now a real physical extraction: `epiphany-codex-bridge` lives outside `vendor/codex` and owns the Codex-facing Epiphany adapters for scene, jobs, context/planning/graph query, retrieval, result projection, runtime-spine result adaptation, launch/prompt doctrine, mutation document mechanics, 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 and mutation orchestration. The processor is about 10,339 lines, `epiphany_mutation_routes.rs` is about 1,078 lines, and `epiphany_state_helpers.rs` is down to a 19-line rollout-state loader after moving typed mutation helpers, reviewability checks, completed runtime-result acceptance loading, live-state projection, launched/interrupted job fallback projection, role/reorient acceptance update bundle construction, and protocol patch-to-core state-update projection out to the bridge. This is progress, not absolution: the bridge is still Codex-facing compatibility, not the final CultNet runtime, and route-level launch/update/promote/interrupt orchestration still lives inside the Codex processor. MCP itself is correctly JSON at its protocol edge; the target is typed Epiphany intent/result/receipt wrappers around MCP, not replacing MCP JSON.
next_action: Continue Codex starvation by carving remaining route-level mutation orchestration into explicit outside-vendor service calls, starting with launch response/notification shaping and interrupt result projection. Do not resume app/skill/marketplace expansion.

View file

@ -11,6 +11,7 @@ use codex_protocol::error::CodexErr;
use codex_protocol::protocol::EpiphanyJobKind as CoreEpiphanyJobKind;
use epiphany_codex_bridge::jobs::epiphany_blocked_state_job;
use epiphany_codex_bridge::jobs::map_epiphany_jobs;
use epiphany_codex_bridge::jobs::map_interrupted_epiphany_job;
use epiphany_codex_bridge::jobs::map_launched_epiphany_job;
use epiphany_codex_bridge::launch::EPIPHANY_REORIENT_LAUNCH_BINDING_ID;
use epiphany_codex_bridge::launch::build_epiphany_reorient_launch_request;
@ -1047,17 +1048,7 @@ impl CodexMessageProcessor {
let epiphany_state =
client_visible_live_thread_epiphany_state(thread.as_ref(), interrupted.epiphany_state)
.await;
let job = map_epiphany_jobs(Some(&epiphany_state), None)
.into_iter()
.find(|job| job.id == binding_id)
.unwrap_or_else(|| {
epiphany_blocked_state_job(
&binding_id,
ThreadEpiphanyJobKind::Specialist,
"role-scoped specialist work",
"Interrupted job binding was not reflected in Epiphany state.",
)
});
let job = map_interrupted_epiphany_job(&epiphany_state, &binding_id);
self.outgoing
.send_response(