Remove Epiphany state from Codex sessions
This commit is contained in:
parent
d5d16c677a
commit
86c6e0b450
13 changed files with 56 additions and 148 deletions
|
|
@ -2,6 +2,7 @@ use codex_app_server_protocol::*;
|
|||
use codex_core::CodexThread;
|
||||
use codex_protocol::ThreadId;
|
||||
use codex_protocol::protocol::EpiphanyRetrievalState;
|
||||
use super::epiphany_thread_host::load_authoritative_epiphany_state;
|
||||
use epiphany_codex_bridge::cultnet::EpiphanySurfaceSource;
|
||||
use epiphany_codex_bridge::invalidation::epiphany_freshness_watcher_snapshot;
|
||||
use epiphany_codex_bridge::launch::EPIPHANY_REORIENT_LAUNCH_BINDING_ID;
|
||||
|
|
@ -504,8 +505,7 @@ impl CodexMessageProcessor {
|
|||
}
|
||||
};
|
||||
|
||||
let expected_revision = thread
|
||||
.epiphany_state()
|
||||
let expected_revision = load_authoritative_epiphany_state(&thread)
|
||||
.await
|
||||
.map(|state| state.revision)
|
||||
.unwrap_or(0);
|
||||
|
|
@ -554,7 +554,7 @@ impl CodexMessageProcessor {
|
|||
}
|
||||
};
|
||||
|
||||
let state = match thread.epiphany_state().await {
|
||||
let state = match load_authoritative_epiphany_state(&thread).await {
|
||||
Some(state) => state,
|
||||
None => {
|
||||
self.send_invalid_request_error(
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ impl EpiphanyMutationHost for EpiphanyCodexThreadHost<'_> {
|
|||
let store = self.thread.epiphany_runtime_spine_store_path().await;
|
||||
match load_authoritative_accepted_state(&store) {
|
||||
Ok(Some(state)) => Some(state),
|
||||
Ok(None) => self.thread.epiphany_state().await,
|
||||
Ok(None) => load_legacy_rollout_state(self.thread).await,
|
||||
Err(error) => {
|
||||
tracing::error!(%error, store = %store.display(), "failed to read authoritative unified Epiphany acceptance state");
|
||||
None
|
||||
|
|
@ -98,7 +98,7 @@ pub(super) async fn load_authoritative_epiphany_state(
|
|||
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,
|
||||
Ok(None) => load_legacy_rollout_state(thread).await,
|
||||
Err(error) => {
|
||||
tracing::error!(%error, store = %store.display(), "failed to read unified Epiphany state");
|
||||
None
|
||||
|
|
@ -106,6 +106,17 @@ pub(super) async fn load_authoritative_epiphany_state(
|
|||
}
|
||||
}
|
||||
|
||||
async fn load_legacy_rollout_state(thread: &CodexThread) -> Option<EpiphanyThreadState> {
|
||||
let rollout_path = thread.rollout_path()?;
|
||||
match load_epiphany_state_from_rollout_path(&rollout_path).await {
|
||||
Ok(state) => state,
|
||||
Err(error) => {
|
||||
tracing::error!(%error, rollout = %rollout_path.display(), "failed to read legacy Epiphany rollout state");
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) async fn client_visible_live_thread_epiphany_state(
|
||||
thread: &CodexThread,
|
||||
fallback: EpiphanyThreadState,
|
||||
|
|
|
|||
|
|
@ -281,8 +281,7 @@ impl CodexMessageProcessor {
|
|||
&config_snapshot,
|
||||
session_configured.rollout_path.clone(),
|
||||
);
|
||||
thread.epiphany_state = codex_thread
|
||||
.epiphany_state()
|
||||
thread.epiphany_state = live_thread_epiphany_state(&codex_thread)
|
||||
.instrument(tracing::info_span!(
|
||||
"app_server.thread_start.epiphany_state",
|
||||
otel.name = "app_server.thread_start.epiphany_state",
|
||||
|
|
|
|||
Reference in a new issue