diff --git a/epiphany-codex-bridge/src/mutation_service.rs b/epiphany-codex-bridge/src/mutation_service.rs index b4cd01ec..c8844cbe 100644 --- a/epiphany-codex-bridge/src/mutation_service.rs +++ b/epiphany-codex-bridge/src/mutation_service.rs @@ -351,7 +351,13 @@ pub async fn apply_thread_epiphany_role_accept( })?; validate_expected_revision(expected_revision, state.revision)?; - let finding = load_completed_epiphany_role_finding(thread, &state, role_id, binding_id).await?; + let runtime_store_path = thread.epiphany_runtime_spine_store_path().await; + let finding = load_completed_epiphany_role_finding( + Some(runtime_store_path.as_path()), + &state, + role_id, + binding_id, + )?; let accepted_prefix = epiphany_role_label(role_id); let acceptance_update = build_role_acceptance_update( role_id, @@ -370,10 +376,7 @@ pub async fn apply_thread_epiphany_role_accept( let applied_patch = acceptance_update.patch.clone(); let epiphany_state = apply_epiphany_state_update_to_thread( thread, - state_update_from_thread_patch( - expected_revision, - acceptance_update.patch, - ), + state_update_from_thread_patch(expected_revision, acceptance_update.patch), ) .await?; let epiphany_state = client_visible_live_thread_epiphany_state(thread, epiphany_state).await; @@ -411,7 +414,12 @@ pub async fn apply_thread_epiphany_reorient_accept( )); } - let finding = load_completed_epiphany_reorient_finding(thread, &state, binding_id).await?; + let runtime_store_path = thread.epiphany_runtime_spine_store_path().await; + let finding = load_completed_epiphany_reorient_finding( + Some(runtime_store_path.as_path()), + &state, + binding_id, + )?; let acceptance_update = build_reorient_acceptance_update( expected_revision, binding_id, diff --git a/epiphany-codex-bridge/src/results.rs b/epiphany-codex-bridge/src/results.rs index 0a1e6a93..df93748a 100644 --- a/epiphany-codex-bridge/src/results.rs +++ b/epiphany-codex-bridge/src/results.rs @@ -88,9 +88,7 @@ fn map_protocol_update_patch(patch: EpiphanyRoleStatePatchDocument) -> ThreadEpi } } -pub fn map_core_role_result_role_id( - role_id: ThreadEpiphanyRoleId, -) -> EpiphanyRoleResultRoleId { +pub fn map_core_role_result_role_id(role_id: ThreadEpiphanyRoleId) -> EpiphanyRoleResultRoleId { match role_id { ThreadEpiphanyRoleId::Implementation => EpiphanyRoleResultRoleId::Implementation, ThreadEpiphanyRoleId::Imagination => EpiphanyRoleResultRoleId::Imagination, diff --git a/epiphany-codex-bridge/src/retrieve.rs b/epiphany-codex-bridge/src/retrieve.rs index 854add32..9e8da28b 100644 --- a/epiphany-codex-bridge/src/retrieve.rs +++ b/epiphany-codex-bridge/src/retrieve.rs @@ -7,7 +7,6 @@ use codex_app_server_protocol::ThreadEpiphanyRetrieveShardSummary; use codex_core::CodexThread; use codex_protocol::protocol::EpiphanyRetrievalState; use codex_utils_absolute_path::AbsolutePathBuf; -use std::path::PathBuf; use epiphany_core::EpiphanyRetrieveQuery; use epiphany_core::EpiphanyRetrieveResponse as CoreEpiphanyRetrieveResponse; use epiphany_core::EpiphanyRetrieveResult as CoreEpiphanyRetrieveResult; @@ -16,6 +15,7 @@ use epiphany_core::index_workspace; use epiphany_core::normalize_epiphany_retrieve_query; use epiphany_core::retrieval_state_for_workspace; use epiphany_core::retrieve_workspace; +use std::path::PathBuf; pub fn map_epiphany_retrieve_response( response: CoreEpiphanyRetrieveResponse, diff --git a/epiphany-codex-bridge/src/runtime_results.rs b/epiphany-codex-bridge/src/runtime_results.rs index 05cd3c5d..b4137426 100644 --- a/epiphany-codex-bridge/src/runtime_results.rs +++ b/epiphany-codex-bridge/src/runtime_results.rs @@ -5,7 +5,6 @@ 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 codex_core::CodexThread; use codex_protocol::error::CodexErr; use codex_protocol::error::Result as CodexResult; use codex_protocol::protocol::EpiphanyRuntimeLink; @@ -269,17 +268,16 @@ pub async fn load_epiphany_role_result_snapshot( ) } -pub async fn load_completed_epiphany_role_finding( - thread: &CodexThread, +pub fn load_completed_epiphany_role_finding( + runtime_store_path: Option<&Path>, state: &EpiphanyThreadState, role_id: ThreadEpiphanyRoleId, binding_id: &str, ) -> CodexResult { if let Some(link) = latest_epiphany_runtime_link_for_binding(state, binding_id) { - let runtime_store_path = thread.epiphany_runtime_spine_store_path().await; let (status, finding, _note) = load_epiphany_role_result_from_runtime_spine_job( link.runtime_job_id.as_str(), - Some(runtime_store_path.as_path()), + runtime_store_path, role_id, ); if status != ThreadEpiphanyRoleResultStatus::Completed { @@ -354,16 +352,15 @@ pub async fn load_epiphany_reorient_result_snapshot( ) } -pub async fn load_completed_epiphany_reorient_finding( - thread: &CodexThread, +pub fn load_completed_epiphany_reorient_finding( + runtime_store_path: Option<&Path>, state: &EpiphanyThreadState, binding_id: &str, ) -> CodexResult { if let Some(link) = latest_epiphany_runtime_link_for_binding(state, binding_id) { - let runtime_store_path = thread.epiphany_runtime_spine_store_path().await; let (status, finding, _note) = load_epiphany_reorient_result_from_runtime_spine_job( link.runtime_job_id.as_str(), - Some(runtime_store_path.as_path()), + runtime_store_path, ); if status != ThreadEpiphanyReorientResultStatus::Completed { return Err(CodexErr::InvalidRequest(format!( diff --git a/epiphany-codex-bridge/src/state.rs b/epiphany-codex-bridge/src/state.rs index 8a81e3fc..286e7c2f 100644 --- a/epiphany-codex-bridge/src/state.rs +++ b/epiphany-codex-bridge/src/state.rs @@ -42,9 +42,7 @@ pub async fn live_thread_epiphany_state(thread: &CodexThread) -> Option