From 5e66f8004de506e847c5f01b8f1981d7e10fb04d Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 13 May 2026 03:52:09 +0100 Subject: [PATCH] Move Epiphany interrupt job projection to bridge --- epiphany-codex-bridge/src/jobs.rs | 17 +++++++++++++++++ notes/fresh-workspace-handoff.md | 4 ++++ state/ledgers.msgpack | Bin 78678 -> 79039 bytes state/map.yaml | 2 +- .../epiphany_mutation_routes.rs | 13 ++----------- 5 files changed, 24 insertions(+), 12 deletions(-) diff --git a/epiphany-codex-bridge/src/jobs.rs b/epiphany-codex-bridge/src/jobs.rs index a514fed8..13aac18e 100644 --- a/epiphany-codex-bridge/src/jobs.rs +++ b/epiphany-codex-bridge/src/jobs.rs @@ -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, diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index f86b3297..0e253bdc 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -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 diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index de86d152e3c2d1889bed1242cd75faabb67a2508..dee61620dc44a6587594e3ff19b685e729f2c427 100644 GIT binary patch delta 165 zcmccijAj2zmI=yCCaoJ)r!g{~Yu>}SeGemJi{W$y14dz1QzI(_qsflp+Kj5xFRC(% zac1U~q!tyG7L-g^(`WSZ$;waigo!8=<(HPED&*xWB<7{)CY5I9q!cTZ zWTYx2<>V)4r=}>RCFbNLB_?Mp0Cg)A6y;~7CYNO9=S{z0#Hh(+ZZSRIkkNIzgE6B3 I8`%0N0KOnN4*&oF delta 38 ucmdo0lI7YnmI=yC#xfgKr!g{~ZQjGUeGemJi{bQ@CX51XCYDwvmQesBwG9sd diff --git a/state/map.yaml b/state/map.yaml index b85620b6..0ba76e76 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -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. diff --git a/vendor/codex/codex-rs/app-server/src/codex_message_processor/epiphany_mutation_routes.rs b/vendor/codex/codex-rs/app-server/src/codex_message_processor/epiphany_mutation_routes.rs index 9e6c1560..e3ce1488 100644 --- a/vendor/codex/codex-rs/app-server/src/codex_message_processor/epiphany_mutation_routes.rs +++ b/vendor/codex/codex-rs/app-server/src/codex_message_processor/epiphany_mutation_routes.rs @@ -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(