Narrow runtime result host seam
This commit is contained in:
parent
4d80af280c
commit
65f66292e3
5 changed files with 23 additions and 22 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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<ThreadEpiphanyRoleFinding> {
|
||||
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<ThreadEpiphanyReorientFinding> {
|
||||
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!(
|
||||
|
|
|
|||
|
|
@ -42,9 +42,7 @@ pub async fn live_thread_epiphany_state(thread: &CodexThread) -> Option<Epiphany
|
|||
let thread_id = thread_state_mirror_id(thread);
|
||||
if let Err(err) = mirror_thread_state_to_workspace(config.cwd.as_path(), &thread_id, state)
|
||||
{
|
||||
warn!(
|
||||
"failed to mirror Epiphany thread state into native store: {err}"
|
||||
);
|
||||
warn!("failed to mirror Epiphany thread state into native store: {err}");
|
||||
}
|
||||
}
|
||||
epiphany_state
|
||||
|
|
|
|||
Reference in a new issue