Remove Codex Epiphany state mirror
This commit is contained in:
parent
899ad45783
commit
d5d16c677a
14 changed files with 60 additions and 359 deletions
|
|
@ -26,6 +26,7 @@ use tracing::warn;
|
|||
use super::epiphany_thread_host::EpiphanyCodexThreadHost;
|
||||
use super::epiphany_thread_host::client_visible_live_thread_epiphany_state;
|
||||
use super::epiphany_thread_host::epiphany_token_usage_snapshot;
|
||||
use super::epiphany_thread_host::load_authoritative_epiphany_state;
|
||||
use crate::outgoing_message::ThreadScopedOutgoingMessageSender;
|
||||
use crate::thread_state::ThreadState;
|
||||
|
||||
|
|
@ -37,7 +38,7 @@ pub(crate) async fn maybe_run_epiphany_coordinator_automation_for_turn_boundary(
|
|||
force_checkpoint_compaction: bool,
|
||||
) {
|
||||
let thread_id_text = thread_id.to_string();
|
||||
let Some(state) = thread.epiphany_state().await else {
|
||||
let Some(state) = load_authoritative_epiphany_state(thread.as_ref()).await else {
|
||||
return;
|
||||
};
|
||||
|
||||
|
|
@ -119,7 +120,10 @@ pub(crate) async fn maybe_run_epiphany_pre_compaction_checkpoint_intervention_fo
|
|||
if !should_run_epiphany_pre_compaction_checkpoint_intervention(&pressure) {
|
||||
return;
|
||||
}
|
||||
if thread.epiphany_state().await.is_none() {
|
||||
if load_authoritative_epiphany_state(thread.as_ref())
|
||||
.await
|
||||
.is_none()
|
||||
{
|
||||
return;
|
||||
}
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@ use codex_core::latest_epiphany_state_from_rollout_items;
|
|||
use codex_protocol::protocol::EpiphanyThreadState;
|
||||
use codex_protocol::protocol::InitialHistory;
|
||||
use codex_protocol::protocol::TokenUsageInfo;
|
||||
use epiphany_codex_bridge::error::EpiphanyBridgeError;
|
||||
use epiphany_codex_bridge::error::Result as BridgeResult;
|
||||
use epiphany_codex_bridge::mutation_service::EpiphanyMutationHost;
|
||||
use epiphany_codex_bridge::mutation_service::load_authoritative_accepted_state;
|
||||
use epiphany_codex_bridge::pressure::EpiphanyTokenUsageSnapshot;
|
||||
|
|
@ -45,16 +43,6 @@ impl EpiphanyMutationHost for EpiphanyCodexThreadHost<'_> {
|
|||
self.thread.epiphany_reference_turn_id().await
|
||||
}
|
||||
|
||||
async fn epiphany_persist_state(
|
||||
&self,
|
||||
next_state: EpiphanyThreadState,
|
||||
) -> BridgeResult<EpiphanyThreadState> {
|
||||
self.thread
|
||||
.epiphany_persist_state(next_state)
|
||||
.await
|
||||
.map_err(|err| EpiphanyBridgeError::Fatal(err.to_string()))
|
||||
}
|
||||
|
||||
async fn epiphany_runtime_spine_store_path(&self) -> std::path::PathBuf {
|
||||
self.thread.epiphany_runtime_spine_store_path().await
|
||||
}
|
||||
|
|
@ -88,7 +76,7 @@ pub(super) async fn load_epiphany_state_from_rollout_path(
|
|||
pub(super) async fn live_thread_epiphany_state(
|
||||
thread: &CodexThread,
|
||||
) -> Option<EpiphanyThreadState> {
|
||||
let state = thread.epiphany_state().await?;
|
||||
let state = load_authoritative_epiphany_state(thread).await?;
|
||||
let config = thread.config_snapshot().await;
|
||||
let codex_home = thread.codex_home().await;
|
||||
let rollout_path = thread.rollout_path();
|
||||
|
|
@ -104,6 +92,20 @@ pub(super) async fn live_thread_epiphany_state(
|
|||
)
|
||||
}
|
||||
|
||||
pub(super) async fn load_authoritative_epiphany_state(
|
||||
thread: &CodexThread,
|
||||
) -> Option<EpiphanyThreadState> {
|
||||
let store = thread.epiphany_runtime_spine_store_path().await;
|
||||
match load_authoritative_accepted_state(&store) {
|
||||
Ok(Some(state)) => Some(state),
|
||||
Ok(None) => thread.epiphany_state().await,
|
||||
Err(error) => {
|
||||
tracing::error!(%error, store = %store.display(), "failed to read unified Epiphany state");
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) async fn client_visible_live_thread_epiphany_state(
|
||||
thread: &CodexThread,
|
||||
fallback: EpiphanyThreadState,
|
||||
|
|
|
|||
Reference in a new issue