From 5043bb3b1db1af4d12352ce9471cc1fd5773b420 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 20 May 2026 01:53:08 +0100 Subject: [PATCH] Project result views from typed snapshots --- epiphany-codex-bridge/src/runtime_results.rs | 114 ++++--------------- epiphany-codex-bridge/src/view.rs | 28 +++-- notes/fresh-workspace-handoff.md | 1 + state/ledgers.msgpack | Bin 135981 -> 136212 bytes state/map.yaml | 3 +- 5 files changed, 41 insertions(+), 105 deletions(-) diff --git a/epiphany-codex-bridge/src/runtime_results.rs b/epiphany-codex-bridge/src/runtime_results.rs index f1e3adae..f093c66f 100644 --- a/epiphany-codex-bridge/src/runtime_results.rs +++ b/epiphany-codex-bridge/src/runtime_results.rs @@ -1,8 +1,6 @@ use std::path::Path; -use codex_app_server_protocol::ThreadEpiphanyReorientFinding; use codex_app_server_protocol::ThreadEpiphanyReorientResultStatus; -use codex_app_server_protocol::ThreadEpiphanyRoleFinding; use codex_app_server_protocol::ThreadEpiphanyRoleId; use codex_app_server_protocol::ThreadEpiphanyRoleResultStatus; use epiphany_core::EpiphanyCoordinatorRoleResultStatus as CoreEpiphanyCoordinatorRoleResultStatus; @@ -22,8 +20,6 @@ use epiphany_state_model::EpiphanyThreadState; use crate::error::EpiphanyBridgeError; use crate::error::Result as BridgeResult; use crate::results::map_core_role_result_role_id; -use crate::results::map_protocol_reorient_finding; -use crate::results::map_protocol_role_finding; use crate::results::render_core_reorient_result_note; use crate::results::render_core_role_result_note; @@ -114,26 +110,6 @@ pub fn load_core_epiphany_role_result_from_runtime_spine_job( } } -pub fn load_epiphany_role_result_from_runtime_spine_job( - job_id: &str, - runtime_store_path: Option<&Path>, - role_id: ThreadEpiphanyRoleId, -) -> ( - ThreadEpiphanyRoleResultStatus, - Option, - String, -) { - let snapshot = - load_core_epiphany_role_result_from_runtime_spine_job(job_id, runtime_store_path, role_id); - ( - map_protocol_role_result_status(snapshot.status), - snapshot - .finding - .map(|finding| map_protocol_role_finding(role_id, finding)), - snapshot.note, - ) -} - pub fn load_core_epiphany_reorient_result_from_runtime_spine_job( job_id: &str, runtime_store_path: Option<&Path>, @@ -205,23 +181,6 @@ pub fn load_core_epiphany_reorient_result_from_runtime_spine_job( } } -pub fn load_epiphany_reorient_result_from_runtime_spine_job( - job_id: &str, - runtime_store_path: Option<&Path>, -) -> ( - ThreadEpiphanyReorientResultStatus, - Option, - String, -) { - let snapshot = - load_core_epiphany_reorient_result_from_runtime_spine_job(job_id, runtime_store_path); - ( - map_protocol_reorient_result_status(snapshot.status), - snapshot.finding.map(map_protocol_reorient_finding), - snapshot.note, - ) -} - fn map_runtime_role_result_status( snapshot: &EpiphanyRuntimeJobSnapshot, ) -> CoreEpiphanyCoordinatorRoleResultStatus { @@ -314,28 +273,6 @@ pub fn map_protocol_reorient_result_status( } } -pub async fn load_epiphany_role_result_snapshot( - state: &EpiphanyThreadState, - runtime_store_path: Option<&Path>, - role_id: ThreadEpiphanyRoleId, - binding_id: &str, -) -> ( - ThreadEpiphanyRoleResultStatus, - Option, - String, -) { - let snapshot = - load_core_epiphany_role_result_snapshot(state, runtime_store_path, role_id, binding_id) - .await; - ( - map_protocol_role_result_status(snapshot.status), - snapshot - .finding - .map(|finding| map_protocol_role_finding(role_id, finding)), - snapshot.note, - ) -} - pub async fn load_core_epiphany_role_result_snapshot( state: &EpiphanyThreadState, runtime_store_path: Option<&Path>, @@ -411,24 +348,6 @@ pub fn load_completed_core_epiphany_role_finding( )) } -pub async fn load_epiphany_reorient_result_snapshot( - state: Option<&EpiphanyThreadState>, - runtime_store_path: Option<&Path>, - binding_id: &str, -) -> ( - ThreadEpiphanyReorientResultStatus, - Option, - String, -) { - let snapshot = - load_core_epiphany_reorient_result_snapshot(state, runtime_store_path, binding_id).await; - ( - map_protocol_reorient_result_status(snapshot.status), - snapshot.finding.map(map_protocol_reorient_finding), - snapshot.note, - ) -} - pub async fn load_core_epiphany_reorient_result_snapshot( state: Option<&EpiphanyThreadState>, runtime_store_path: Option<&Path>, @@ -523,9 +442,9 @@ mod tests { use std::path::Path; use std::path::PathBuf; - use codex_app_server_protocol::ThreadEpiphanyReorientResultStatus; use codex_app_server_protocol::ThreadEpiphanyRoleId; - use codex_app_server_protocol::ThreadEpiphanyRoleResultStatus; + use epiphany_core::EpiphanyCoordinatorRoleResultStatus as CoreEpiphanyCoordinatorRoleResultStatus; + use epiphany_core::EpiphanyCrrcResultStatus as CoreEpiphanyCrrcResultStatus; use epiphany_core::RuntimeSpineInitOptions; use epiphany_core::RuntimeSpineJobOptions; use epiphany_core::RuntimeSpineJobResultOptions; @@ -544,15 +463,22 @@ mod tests { let store = temp_store_path(); seed_completed_lifecycle_result(&store, "role-job", "modeling"); - let (status, finding, note) = load_epiphany_role_result_from_runtime_spine_job( + let result = load_core_epiphany_role_result_from_runtime_spine_job( "role-job", Some(store.as_path()), ThreadEpiphanyRoleId::Modeling, ); - assert_eq!(status, ThreadEpiphanyRoleResultStatus::BackendUnavailable); - assert!(finding.is_none()); - assert!(note.contains("EpiphanyRuntimeRoleWorkerResult typed document")); + assert_eq!( + result.status, + CoreEpiphanyCoordinatorRoleResultStatus::BackendUnavailable + ); + assert!(result.finding.is_none()); + assert!( + result + .note + .contains("EpiphanyRuntimeRoleWorkerResult typed document") + ); let _ = fs::remove_file(store); } @@ -562,17 +488,21 @@ mod tests { let store = temp_store_path(); seed_completed_lifecycle_result(&store, "reorient-job", "reorientation"); - let (status, finding, note) = load_epiphany_reorient_result_from_runtime_spine_job( + let result = load_core_epiphany_reorient_result_from_runtime_spine_job( "reorient-job", Some(store.as_path()), ); assert_eq!( - status, - ThreadEpiphanyReorientResultStatus::BackendUnavailable + result.status, + CoreEpiphanyCrrcResultStatus::BackendUnavailable + ); + assert!(result.finding.is_none()); + assert!( + result + .note + .contains("EpiphanyRuntimeReorientWorkerResult typed document") ); - assert!(finding.is_none()); - assert!(note.contains("EpiphanyRuntimeReorientWorkerResult typed document")); let _ = fs::remove_file(store); } diff --git a/epiphany-codex-bridge/src/view.rs b/epiphany-codex-bridge/src/view.rs index 1469ad40..337616f7 100644 --- a/epiphany-codex-bridge/src/view.rs +++ b/epiphany-codex-bridge/src/view.rs @@ -35,9 +35,9 @@ use crate::reorient::map_protocol_reorient_decision; use crate::reorient::map_protocol_reorient_state_status; use crate::results::map_protocol_reorient_finding; use crate::runtime_results::load_core_epiphany_reorient_result_snapshot; -use crate::runtime_results::load_epiphany_reorient_result_snapshot; -use crate::runtime_results::load_epiphany_role_result_snapshot; +use crate::runtime_results::load_core_epiphany_role_result_snapshot; use crate::runtime_results::map_protocol_reorient_result_status; +use crate::runtime_results::map_protocol_role_result_status; use crate::scene::map_core_epiphany_scene_action; use crate::scene::map_epiphany_scene; @@ -477,8 +477,9 @@ pub async fn map_epiphany_role_result_response( let job = map_epiphany_jobs(Some(state), None) .into_iter() .find(|job| job.id == binding_id); - let (status, finding, note) = - load_epiphany_role_result_snapshot(state, runtime_store_path, role_id, &binding_id).await; + let result = + load_core_epiphany_role_result_snapshot(state, runtime_store_path, role_id, &binding_id) + .await; ThreadEpiphanyRoleResultResponse { thread_id, @@ -487,10 +488,12 @@ pub async fn map_epiphany_role_result_response( state_status: ThreadEpiphanyReorientStateStatus::Ready, state_revision: Some(state.revision), binding_id, - status, + status: map_protocol_role_result_status(result.status), job, - finding, - note, + finding: result + .finding + .map(|finding| crate::results::map_protocol_role_finding(role_id, finding)), + note: result.note, } } @@ -529,8 +532,9 @@ pub async fn map_epiphany_reorient_result_response( let job = map_epiphany_jobs(Some(state), None) .into_iter() .find(|job| job.id == binding_id); - let (status, finding, note) = - load_epiphany_reorient_result_snapshot(Some(state), runtime_store_path, &binding_id).await; + let result = + load_core_epiphany_reorient_result_snapshot(Some(state), runtime_store_path, &binding_id) + .await; ThreadEpiphanyReorientResultResponse { thread_id, @@ -538,10 +542,10 @@ pub async fn map_epiphany_reorient_result_response( state_status: ThreadEpiphanyReorientStateStatus::Ready, state_revision: Some(state.revision), binding_id, - status, + status: map_protocol_reorient_result_status(result.status), job, - finding, - note, + finding: result.finding.map(map_protocol_reorient_finding), + note: result.note, } } diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index b17b285c..f2981d47 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -54,6 +54,7 @@ remembers doctrine; the branch remembers the blade. - Coordinator result gating now consumes typed runtime result snapshots and core finding interpretations directly. `ThreadEpiphanyRoleFinding` / `ThreadEpiphanyReorientFinding` remain in legacy runtime wrapper/view/mutation response paths; the next cut is acceptance/mutation so protocol findings stop being the accepted-result authority. - Acceptance/mutation now builds role/reorient receipts, evidence, observations, scratch, and checkpoint updates from core typed finding interpretations. Protocol findings remain as legacy response payloads and helper residue; delete those wrappers once view/result responses are also typed internally. - The old protocol-shaped result helper layer is deleted: no protocol finding runtime-id helpers, no protocol result-note renderers, and no dead protocol reorient scratch/checkpoint builders remain in the bridge. Legacy view/result/accept responses may still carry `ThreadEpiphany*Finding`, but they are projections, not bridge policy input. +- Runtime result view responses now project directly from typed result snapshots; the old protocol tuple wrappers in `runtime_results.rs` are gone, and runtime-result tests assert core typed statuses. - MCP remains JSON because MCP is a JSON protocol. The latest processor cut only moved MCP refresh/OAuth/status/resource/tool-call route handling into `codex_message_processor/mcp_routes.rs`, reducing the root processor to about 8,977 lines; it did not claim MCP payloads are CultNet or make MCP an Epiphany-owned runtime contract. - Codex account auth route handling remains in vendored Codex but now lives in `codex_message_processor/auth_routes.rs`: API-key login, ChatGPT browser/device-code/external-token login, logout, auth status, account, rate limits, and add-credits nudge handling. This preserves Codex ownership of subscription auth while cutting the root processor to about 8,094 lines. - One-off command execution and command stream write/resize/terminate route handling now live in `codex_message_processor/command_routes.rs`; `CommandExecManager` remains the lifecycle owner, while the root processor is about 7,800 lines. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index c552baf57457e6760d3341d976e94dbb414b2bc4..9df73780dbf72dd185283f36ced99277f1e34ea3 100644 GIT binary patch delta 245 zcmZ9Gu}T9$6h)a-X;rXL0uRJ8G7QFI{R+j(ZrHgdE3-4>yti4l5)rf&4DKI@jYS}! zeu{pL30PU(;+}iB@2|tf+wkdNu=BG#yiw}mzE_XEQXjn<+-+?yzKk{}V?7xgeW7(R zG0$hbKl=VWZ-P`cD1#d>)MlF!GL?-KFMDeDc3z>~lqm)VQ;0349IsIdxhk*2cXX9w zP0}Se%6~czHt{S9pOVMamfdD0v5cOiNgm{*b;wLMI1;e%8UQ2Dt1u;*p{5oYG;;6| NxTDqo|HZMn`~}5)RyhCw delta 52 zcmbQTf@AG6jtR<4LZ3IP7BVunHcw}4pU%j*eL5pkqoC*(BLgEdT?12HBZCkF11l3V ID