From f0cd7538a3642d457bfdafc7ec0c6b8125302004 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 13 May 2026 03:54:50 +0100 Subject: [PATCH] Move reorient accept state update to bridge --- epiphany-codex-bridge/src/mutation.rs | 21 +++++++++--------- notes/fresh-workspace-handoff.md | 4 ++++ state/ledgers.msgpack | Bin 79039 -> 79408 bytes state/map.yaml | 2 +- .../epiphany_mutation_routes.rs | 12 ++-------- 5 files changed, 18 insertions(+), 21 deletions(-) diff --git a/epiphany-codex-bridge/src/mutation.rs b/epiphany-codex-bridge/src/mutation.rs index 6e9dd821..6b5b0ef2 100644 --- a/epiphany-codex-bridge/src/mutation.rs +++ b/epiphany-codex-bridge/src/mutation.rs @@ -33,11 +33,7 @@ pub struct RoleAcceptanceUpdate { } pub struct ReorientAcceptanceUpdate { - pub scratch: Option, - pub investigation_checkpoint: Option, - pub receipt: codex_protocol::protocol::EpiphanyAcceptanceReceipt, - pub observation: codex_protocol::protocol::EpiphanyObservation, - pub evidence: codex_protocol::protocol::EpiphanyEvidenceRecord, + pub state_update: EpiphanyStateUpdate, pub changed_fields: Vec, pub accepted_receipt_id: String, pub accepted_observation_id: String, @@ -209,6 +205,7 @@ pub fn build_role_acceptance_update( } pub fn build_reorient_acceptance_update( + expected_revision: Option, binding_id: &str, finding: &ThreadEpiphanyReorientFinding, accepted_evidence_id: String, @@ -254,11 +251,15 @@ pub fn build_reorient_acceptance_update( } Ok(ReorientAcceptanceUpdate { - scratch, - investigation_checkpoint, - receipt: acceptance_bundle.receipt, - observation: acceptance_bundle.observation, - evidence: acceptance_bundle.evidence, + state_update: EpiphanyStateUpdate { + expected_revision, + scratch, + investigation_checkpoint, + acceptance_receipts: vec![acceptance_bundle.receipt], + observations: vec![acceptance_bundle.observation], + evidence: vec![acceptance_bundle.evidence], + ..Default::default() + }, changed_fields, accepted_receipt_id, accepted_observation_id, diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 0e253bdc..eb6979a0 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -531,6 +531,10 @@ 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. +The twenty-eighth cut made reorient acceptance return its core +`EpiphanyStateUpdate` from the bridge, so the route no longer assembles the +scratch/checkpoint/receipt/evidence update fields after receiving the bridge +bundle. `epiphany_mutation_routes.rs` is about 1,070 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 dee61620dc44a6587594e3ff19b685e729f2c427..a8a8c01888916b79ed9c070bae87e89fea70e6fd 100644 GIT binary patch delta 222 zcmdo0l4ZjimI=yCrr$QIPGe*|-@J!$`yNKdw?@+)j2T6kO{`2N8=lr-)SZ4&l~HVR z!%xxrqRf=^RE5%ll*E!$g}nT7g`(7w(xSX#g_4X^h2;FAR0Y?9%z})>yvpDbppsCC z!j#OS)Z~(!N*#sbe6Y%*{8F%fg`E7n^wc7S#Ny)A+@ze;Vuj-5qQsKq4E^Mc)a2}f z{LH)(eW2dd%z_gA)Ur(Bl+?UrxczCFsW~ad(=Qk?YBHG{OwTuDbe+D^gi(+c=x~E5 E0BoO7>Hq)$ delta 37 tcmdn+hGqXtmI=yCCaoJ)r!g{~Yu>}SeGen!TchbxW{iTYMpgz!Q2-rR4DkQ} diff --git a/state/map.yaml b/state/map.yaml index 0ba76e76..2e7a1072 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,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. + 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,070 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 including its core state update, 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 e3ce1488..4fce1d6f 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 @@ -4,7 +4,6 @@ use codex_app_server_protocol::*; use codex_core::EpiphanyJobInterruptRequest; use codex_core::EpiphanyJobLaunchRequest; use codex_core::EpiphanyPromotionInput; -use codex_core::EpiphanyStateUpdate; use codex_core::evaluate_promotion; use codex_protocol::ThreadId; use codex_protocol::error::CodexErr; @@ -573,6 +572,7 @@ impl CodexMessageProcessor { let accepted_evidence_id = format!("ev-reorient-{}", Uuid::new_v4()); let accepted_observation_id = format!("obs-reorient-{}", Uuid::new_v4()); let acceptance_update = match build_reorient_acceptance_update( + expected_revision, &binding_id, &finding, accepted_evidence_id, @@ -594,15 +594,7 @@ impl CodexMessageProcessor { let changed_fields = acceptance_update.changed_fields.clone(); let epiphany_state = match loaded_thread - .epiphany_update_state(EpiphanyStateUpdate { - expected_revision, - scratch: acceptance_update.scratch, - investigation_checkpoint: acceptance_update.investigation_checkpoint, - acceptance_receipts: vec![acceptance_update.receipt], - observations: vec![acceptance_update.observation], - evidence: vec![acceptance_update.evidence], - ..Default::default() - }) + .epiphany_update_state(acceptance_update.state_update) .await { Ok(state) => {