Project result views from typed snapshots

This commit is contained in:
Meta Vens 2026-05-20 01:53:08 +01:00
commit 5043bb3b1d
5 changed files with 41 additions and 105 deletions

View file

@ -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<ThreadEpiphanyRoleFinding>,
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<ThreadEpiphanyReorientFinding>,
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<ThreadEpiphanyRoleFinding>,
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<ThreadEpiphanyReorientFinding>,
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);
}

View file

@ -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,
}
}

View file

@ -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.

Binary file not shown.

View file

@ -323,7 +323,8 @@ current_status:
protocol finding authority. Role/reorient acceptance now builds receipts
and evidence from core typed findings, mapping to protocol findings only for
legacy accept response cargo. The duplicate protocol-shaped result helper
layer has been deleted. The bridge still
layer has been deleted, and result view responses now project directly from
typed runtime result snapshots instead of protocol tuple wrappers. The bridge still
depends on vendored Codex for app-server protocol DTOs and absolute path
validation, so the purification is not done.
next_action: Continue Codex starvation and CultNet liberation by cutting bridge-internal `ThreadEpiphany*` authority. Prioritize role-result/reorient-result DTO coupling next: derive typed CultNet surfaces first, push JSON-RPC projection into app-server, and keep MCP/OpenAI JSON only at their true protocol/text edges. Do not add compatibility adapters unless they protect a named ownership invariant.