Remove Epiphany state from Codex sessions
This commit is contained in:
parent
d5d16c677a
commit
86c6e0b450
13 changed files with 56 additions and 148 deletions
|
|
@ -1893,6 +1893,12 @@ automation prefer unified CultCache and fail closed on corrupt native state,
|
|||
while `stateUpdated` notifications carry the native commit result directly.
|
||||
Historical rollout reconstruction remains migration-only. Next audit whether
|
||||
the remaining session fallback and compatibility routes can be narrowed further.
|
||||
That audit removed Codex session custody entirely: `SessionState`, `Session`, and
|
||||
`CodexThread` no longer cache or expose Epiphany state, and normal Codex rollout
|
||||
reconstruction ignores legacy Epiphany items. The app-server reads unified
|
||||
CultCache first and invokes the legacy rollout parser directly only when native
|
||||
state is absent. Next move that parser out of `codex-core` into the compatibility
|
||||
boundary if the protocol seam permits it.
|
||||
|
||||
## Immediate Re-entry Instruction
|
||||
|
||||
|
|
|
|||
|
|
@ -285,3 +285,10 @@ document is corrupt; session state is only an empty-store migration seed.
|
|||
`stateUpdated` notifications carry the exact native commit result directly.
|
||||
Historical rollout reconstruction remains a compatibility reader, not an owner
|
||||
or a writer.
|
||||
|
||||
Codex session custody is deleted as well. `SessionState`, `Session`, and
|
||||
`CodexThread` carry no Epiphany state cache or accessor; normal Codex rollout
|
||||
reconstruction ignores historical Epiphany items. The app-server compatibility
|
||||
host reads unified CultCache first and, only when it is empty, invokes the
|
||||
legacy rollout reader directly at the boundary. A source guard rejects renewed
|
||||
session custody.
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -659,4 +659,4 @@ current_status:
|
|||
- Service lifecycle receipt history is now event-only: `load_epiphany_cultmesh_daemon_service_lifecycle_receipts` filters out the `epiphany-local/daemon-service-lifecycle-receipt/latest` mirror, while `load_latest_epiphany_cultmesh_daemon_service_lifecycle_receipt` remains the latest-state reader. Focused unit test `service_lifecycle_receipt_history_excludes_latest_mirror` proves two per-receipt writes return exactly two history records and latest points at the second. Fresh smoke `verse-query-lifecycle-history-filter-smoke` and live overview/triage `local-20260618-145632-497-efac6f0d` / `local-20260618-145632-321-867947af` prove compact swarm sights still expose service lifecycle attention plus the present elevated runbook artifact without daemon pokes or service mutation. Do not use a broad unscoped cargo test filter for this check on Windows; it fans out across bin harnesses and hit a broken pipe during this pass.
|
||||
- `epiphany-verse-query seed-compact` is the compact seed receipt for wrappers and read-only rites. The older `seed` command still prints the full local Verse context for explicit debugging, but compact wrapper modes now avoid full `seed`/final `query` readback after the combined overview proof exposed Windows debug stack overflow from full-context serialization pressure.
|
||||
last_completed_repo_swarm_cut: Huginn live-fire has crossed the first real repo Body from Persona pressure to branch-local Hands commit and Soul/Mind closure, and now has repeatable closure and redacted-public-proof mouths. On `E:\Projects\Huginn` branch `epiphany/huginn/first-awakening`, `tools/epiphany_local_run.ps1 -Mode repo-persona-intake` accepted item `huginn-inspection-readback-livefire`, Weksa/Persona intake remained sealed, and `epiphany-work derive-plan` lowered it to model-authored safe family `repo.status_section` for `README.md` only. `tools/epiphany_local_run.ps1 -Mode repo-swarm-run` advanced four bounded pulses: run-from-plan, adopt-from-plan, execute-from-plan, and close-from-execute. Huginn commit `e9b07c38fceabbdc89ea35c2156326c80c0393a2` updated only `README.md`; closure receipt `.epiphany\work\work-close-huginn-inspection-readback-livefire.json` records status `closed`, Soul verdict `passed`, Mind state commit `repo-work-close-huginn-inspection-readback-livefire-mind-commit`, safe family `repo.status_section`, path scope `README.md`, Bifrost publication gate, and `privateStateExposed=false`. Verification also ran Huginn's TypeScript compiler through concrete Node path: `C:\Program Files\nodejs\node.exe E:\Projects\Huginn\node_modules\typescript\bin\tsc -p tsconfig.json` passed. Native verifier `epiphany-repo-livefire-closure-smoke --workspace E:\Projects\Huginn --item huginn-inspection-readback-livefire --expected-path README.md --expected-family repo.status_section --expected-gate awaiting-publication --expected-blocker bifrost-publication-missing` checks closure receipt, Mind map entry, overview gate/blocker, authority seals, and `git show` changed paths, returning `status=ok`, `soulVerdict=passed`, `publicationGate=Bifrost`, and `privateStateExposed=false`. Wrapper `tools/epiphany_local_run.ps1 -Mode repo-livefire-closure -Workspace E:\Projects\Huginn -RepoWorkItem huginn-inspection-readback-livefire -SkipBuild` exposes the same read-only proof through the local operator mouth; artifact `local-20260621-190156-803-2f85ba15` printed commit, path, gate, blocker, Soul verdict, Mind commit receipt, and `privateStateExposed=False` without push, merge, publication, or target mutation. New wrapper `tools/epiphany_local_run.ps1 -Mode repo-work-public-proof -Workspace E:\Projects\Huginn -RepoWorkItem huginn-inspection-readback-livefire -SkipBuild` exports the redacted proof bundle and repo-local Verse index without publishing; artifact `local-20260621-190645-345-4555b1dc` wrote `.epiphany\public\proof-bundles\repo-work-public-proof-huginn-inspection-readback-livefire.json`, proof id `repo-work-public-proof-huginn-inspection-readback-livefire`, SHA-256 `857545b199f3e37eb06c2e757e5cfc201958e46667bb1f8403fd333a22620f63`, nine artifact rows, zero publication rows, and `privateStateExposed=False`. Gjallar readback `local-20260621-190701-140-b9519ec6` sees the `REPO-WORK-PUBLIC-PROOF` row and action row from Huginn's repo-local Verse with the same SHA-256 while Bifrost publication remains missing. Launcher compact modes are now named compact operator-context modes instead of read-only modes, and `bifrost-public-proof` summaries print item, target public Verse, room, proof SHA-256, review receipts, and credit receipts so publication receipts are auditable without claiming upstream sync.
|
||||
next_action: Audit the remaining Codex session-state reconstruction fallback and compatibility routes. Historical rollout state may seed an empty unified CultCache store, but no live Codex prompt, per-turn rollout writer, mutation mirror, read path, or automation path may treat it as authority.
|
||||
next_action: Move the remaining historical Epiphany rollout parser out of `codex-core` and into the compatibility bridge/app-server boundary if its protocol dependencies permit. Codex session state and normal rollout reconstruction now carry no Epiphany custody; unified CultCache is authoritative and the boundary-only legacy reader may seed an empty store.
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ use codex_protocol::models::ResponseInputItem;
|
|||
use codex_protocol::models::ResponseItem;
|
||||
use codex_protocol::openai_models::ReasoningEffort;
|
||||
use codex_protocol::protocol::AskForApproval;
|
||||
use codex_protocol::protocol::EpiphanyThreadState;
|
||||
use codex_protocol::protocol::Event;
|
||||
use codex_protocol::protocol::Op;
|
||||
use codex_protocol::protocol::SandboxPolicy;
|
||||
|
|
@ -316,10 +315,6 @@ impl CodexThread {
|
|||
self.codex.thread_config_snapshot().await
|
||||
}
|
||||
|
||||
pub async fn epiphany_state(&self) -> Option<EpiphanyThreadState> {
|
||||
self.codex.session.epiphany_state().await
|
||||
}
|
||||
|
||||
pub async fn epiphany_reference_turn_id(&self) -> Option<String> {
|
||||
self.codex
|
||||
.session
|
||||
|
|
|
|||
13
vendor/codex/codex-rs/core/src/session/mod.rs
vendored
13
vendor/codex/codex-rs/core/src/session/mod.rs
vendored
|
|
@ -86,7 +86,6 @@ use codex_protocol::models::format_allow_prefixes;
|
|||
use codex_protocol::openai_models::ModelInfo;
|
||||
use codex_protocol::permissions::FileSystemSandboxPolicy;
|
||||
use codex_protocol::permissions::NetworkSandboxPolicy;
|
||||
use codex_protocol::protocol::EpiphanyThreadState;
|
||||
use codex_protocol::protocol::FileChange;
|
||||
use codex_protocol::protocol::HasLegacyEvent;
|
||||
use codex_protocol::protocol::InterAgentCommunication;
|
||||
|
|
@ -1111,8 +1110,6 @@ impl Session {
|
|||
reconstructed_rollout.reference_context_item,
|
||||
)
|
||||
.await;
|
||||
self.set_epiphany_state(reconstructed_rollout.epiphany_state)
|
||||
.await;
|
||||
self.set_previous_turn_settings(previous_turn_settings.clone())
|
||||
.await;
|
||||
previous_turn_settings
|
||||
|
|
@ -1138,16 +1135,6 @@ impl Session {
|
|||
state.set_previous_turn_settings(previous_turn_settings);
|
||||
}
|
||||
|
||||
pub(crate) async fn epiphany_state(&self) -> Option<EpiphanyThreadState> {
|
||||
let state = self.state.lock().await;
|
||||
state.epiphany_state()
|
||||
}
|
||||
|
||||
pub(crate) async fn set_epiphany_state(&self, epiphany_state: Option<EpiphanyThreadState>) {
|
||||
let mut state = self.state.lock().await;
|
||||
state.set_epiphany_state(epiphany_state);
|
||||
}
|
||||
|
||||
fn maybe_refresh_shell_snapshot_for_cwd(
|
||||
&self,
|
||||
previous_cwd: &AbsolutePathBuf,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ pub(super) struct RolloutReconstruction {
|
|||
pub(super) history: Vec<ResponseItem>,
|
||||
pub(super) previous_turn_settings: Option<PreviousTurnSettings>,
|
||||
pub(super) reference_context_item: Option<TurnContextItem>,
|
||||
pub(super) epiphany_state: Option<EpiphanyThreadState>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
|
|
@ -33,7 +32,6 @@ struct ActiveReplaySegment<'a> {
|
|||
counts_as_user_turn: bool,
|
||||
previous_turn_settings: Option<PreviousTurnSettings>,
|
||||
reference_context_item: TurnReferenceContextItem,
|
||||
epiphany_state: Option<EpiphanyThreadState>,
|
||||
base_replacement_history: Option<&'a [ResponseItem]>,
|
||||
}
|
||||
|
||||
|
|
@ -47,7 +45,6 @@ fn finalize_active_segment<'a>(
|
|||
base_replacement_history: &mut Option<&'a [ResponseItem]>,
|
||||
previous_turn_settings: &mut Option<PreviousTurnSettings>,
|
||||
reference_context_item: &mut TurnReferenceContextItem,
|
||||
epiphany_state: &mut Option<EpiphanyThreadState>,
|
||||
pending_rollback_turns: &mut usize,
|
||||
) {
|
||||
// Thread rollback drops the newest surviving real user-message boundaries. In replay, that
|
||||
|
|
@ -71,13 +68,6 @@ fn finalize_active_segment<'a>(
|
|||
*previous_turn_settings = active_segment.previous_turn_settings;
|
||||
}
|
||||
|
||||
if epiphany_state.is_none()
|
||||
&& (active_segment.counts_as_user_turn
|
||||
|| (active_segment.turn_id.is_none() && active_segment.epiphany_state.is_some()))
|
||||
{
|
||||
*epiphany_state = active_segment.epiphany_state;
|
||||
}
|
||||
|
||||
// `reference_context_item` comes from the newest surviving user turn baseline, or
|
||||
// from a surviving compaction that explicitly cleared that baseline.
|
||||
if matches!(reference_context_item, TurnReferenceContextItem::NeverSet)
|
||||
|
|
@ -91,18 +81,6 @@ fn finalize_active_segment<'a>(
|
|||
}
|
||||
}
|
||||
|
||||
fn is_out_of_band_epiphany_segment(active_segment: &ActiveReplaySegment<'_>) -> bool {
|
||||
active_segment.turn_id.is_none()
|
||||
&& !active_segment.counts_as_user_turn
|
||||
&& active_segment.epiphany_state.is_some()
|
||||
&& active_segment.previous_turn_settings.is_none()
|
||||
&& active_segment.base_replacement_history.is_none()
|
||||
&& matches!(
|
||||
active_segment.reference_context_item,
|
||||
TurnReferenceContextItem::NeverSet
|
||||
)
|
||||
}
|
||||
|
||||
impl Session {
|
||||
pub(super) async fn reconstruct_history_from_rollout(
|
||||
&self,
|
||||
|
|
@ -117,7 +95,6 @@ impl Session {
|
|||
let mut base_replacement_history: Option<&[ResponseItem]> = None;
|
||||
let mut previous_turn_settings = None;
|
||||
let mut reference_context_item = TurnReferenceContextItem::NeverSet;
|
||||
let mut epiphany_state = None;
|
||||
// Rollback is "drop the newest N user turns". While scanning in reverse, that becomes
|
||||
// "skip the next N user-turn segments we finalize".
|
||||
let mut pending_rollback_turns = 0usize;
|
||||
|
|
@ -129,24 +106,6 @@ impl Session {
|
|||
let mut active_segment: Option<ActiveReplaySegment<'_>> = None;
|
||||
|
||||
for (index, item) in rollout_items.iter().enumerate().rev() {
|
||||
if active_segment
|
||||
.as_ref()
|
||||
.is_some_and(is_out_of_band_epiphany_segment)
|
||||
&& let Some(active_segment) = active_segment.take()
|
||||
{
|
||||
finalize_active_segment(
|
||||
active_segment,
|
||||
&mut base_replacement_history,
|
||||
&mut previous_turn_settings,
|
||||
&mut reference_context_item,
|
||||
&mut epiphany_state,
|
||||
&mut pending_rollback_turns,
|
||||
);
|
||||
}
|
||||
if epiphany_state.is_some() {
|
||||
break;
|
||||
}
|
||||
|
||||
match item {
|
||||
RolloutItem::Compacted(compacted) => {
|
||||
let active_segment =
|
||||
|
|
@ -223,20 +182,7 @@ impl Session {
|
|||
}
|
||||
}
|
||||
}
|
||||
RolloutItem::EpiphanyState(item) => {
|
||||
let active_segment =
|
||||
active_segment.get_or_insert_with(ActiveReplaySegment::default);
|
||||
if active_segment.turn_id.is_none() {
|
||||
active_segment.turn_id = item.turn_id.clone();
|
||||
}
|
||||
if turn_ids_are_compatible(
|
||||
active_segment.turn_id.as_deref(),
|
||||
item.turn_id.as_deref(),
|
||||
) && active_segment.epiphany_state.is_none()
|
||||
{
|
||||
active_segment.epiphany_state = Some(item.state.clone());
|
||||
}
|
||||
}
|
||||
RolloutItem::EpiphanyState(_) => {}
|
||||
RolloutItem::EventMsg(EventMsg::TurnStarted(event)) => {
|
||||
// `TurnStarted` is the oldest boundary of the active reverse segment.
|
||||
if active_segment.as_ref().is_some_and(|active_segment| {
|
||||
|
|
@ -251,7 +197,6 @@ impl Session {
|
|||
&mut base_replacement_history,
|
||||
&mut previous_turn_settings,
|
||||
&mut reference_context_item,
|
||||
&mut epiphany_state,
|
||||
&mut pending_rollback_turns,
|
||||
);
|
||||
}
|
||||
|
|
@ -267,7 +212,6 @@ impl Session {
|
|||
if base_replacement_history.is_some()
|
||||
&& previous_turn_settings.is_some()
|
||||
&& !matches!(reference_context_item, TurnReferenceContextItem::NeverSet)
|
||||
&& epiphany_state.is_some()
|
||||
{
|
||||
// At this point we have both eager resume metadata values and the replacement-
|
||||
// history base for the surviving tail, so older rollout items cannot affect this
|
||||
|
|
@ -282,7 +226,6 @@ impl Session {
|
|||
&mut base_replacement_history,
|
||||
&mut previous_turn_settings,
|
||||
&mut reference_context_item,
|
||||
&mut epiphany_state,
|
||||
&mut pending_rollback_turns,
|
||||
);
|
||||
}
|
||||
|
|
@ -353,7 +296,6 @@ impl Session {
|
|||
history: history.raw_items().to_vec(),
|
||||
previous_turn_settings,
|
||||
reference_context_item,
|
||||
epiphany_state,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use codex_protocol::models::ContentItem;
|
|||
use codex_protocol::models::ResponseItem;
|
||||
use codex_protocol::protocol::CompactedItem;
|
||||
use codex_protocol::protocol::EpiphanyStateItem;
|
||||
use codex_protocol::protocol::EpiphanyThreadState;
|
||||
use codex_protocol::protocol::InitialHistory;
|
||||
use codex_protocol::protocol::InterAgentCommunication;
|
||||
use codex_protocol::protocol::ResumedHistory;
|
||||
|
|
@ -108,7 +109,7 @@ async fn record_initial_history_resumed_bare_turn_context_does_not_hydrate_previ
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn record_initial_history_resumed_hydrates_epiphany_state_from_latest_surviving_turn() {
|
||||
async fn record_initial_history_resumed_accepts_legacy_epiphany_state_items() {
|
||||
let (session, turn_context) = make_session_and_context().await;
|
||||
let first_context_item = turn_context.to_turn_context_item();
|
||||
let first_turn_id = first_context_item
|
||||
|
|
@ -189,11 +190,11 @@ async fn record_initial_history_resumed_hydrates_epiphany_state_from_latest_surv
|
|||
}))
|
||||
.await;
|
||||
|
||||
assert_eq!(session.epiphany_state().await, Some(second_epiphany));
|
||||
let _ = second_epiphany;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn record_initial_history_resumed_hydrates_out_of_band_epiphany_state_before_first_turn() {
|
||||
async fn record_initial_history_resumed_accepts_out_of_band_epiphany_state_before_first_turn() {
|
||||
let (session, _turn_context) = make_session_and_context().await;
|
||||
let epiphany_state = sample_epiphany_state("control-plane-update");
|
||||
|
||||
|
|
@ -208,11 +209,11 @@ async fn record_initial_history_resumed_hydrates_out_of_band_epiphany_state_befo
|
|||
}))
|
||||
.await;
|
||||
|
||||
assert_eq!(session.epiphany_state().await, Some(epiphany_state));
|
||||
let _ = epiphany_state;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn record_initial_history_resumed_hydrates_out_of_band_epiphany_state_after_completed_turn() {
|
||||
async fn record_initial_history_resumed_accepts_out_of_band_epiphany_state_after_completed_turn() {
|
||||
let (session, _turn_context) = make_session_and_context().await;
|
||||
let turn_id = "turn-before-control-plane-update".to_string();
|
||||
let turn_state = sample_epiphany_state("turn-before-control-plane-update");
|
||||
|
|
@ -260,7 +261,7 @@ async fn record_initial_history_resumed_hydrates_out_of_band_epiphany_state_afte
|
|||
}))
|
||||
.await;
|
||||
|
||||
assert_eq!(session.epiphany_state().await, Some(control_plane_state));
|
||||
let _ = control_plane_state;
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
|
@ -445,11 +446,10 @@ async fn reconstruct_history_rollback_keeps_history_and_metadata_in_sync_for_com
|
|||
serde_json::to_value(Some(first_context_item))
|
||||
.expect("serialize expected reference context item")
|
||||
);
|
||||
assert_eq!(reconstructed.epiphany_state, None);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn reconstruct_history_rollback_drops_epiphany_state_from_rolled_back_turn() {
|
||||
async fn reconstruct_history_ignores_legacy_epiphany_items_during_rollback() {
|
||||
let (session, turn_context) = make_session_and_context().await;
|
||||
let first_context_item = turn_context.to_turn_context_item();
|
||||
let first_turn_id = first_context_item
|
||||
|
|
@ -527,10 +527,7 @@ async fn reconstruct_history_rollback_drops_epiphany_state_from_rolled_back_turn
|
|||
.reconstruct_history_from_rollout(&turn_context, &rollout_items)
|
||||
.await;
|
||||
|
||||
assert_eq!(
|
||||
reconstructed.epiphany_state,
|
||||
Some(sample_epiphany_state("turn-1"))
|
||||
);
|
||||
assert!(reconstructed.previous_turn_settings.is_some());
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
|
@ -1269,7 +1266,7 @@ async fn record_initial_history_resumed_turn_context_after_compaction_reestablis
|
|||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn reconstruct_history_compaction_keeps_latest_surviving_epiphany_state() {
|
||||
async fn reconstruct_history_ignores_legacy_epiphany_items_during_compaction() {
|
||||
let (session, turn_context) = make_session_and_context().await;
|
||||
let previous_context_item = turn_context.to_turn_context_item();
|
||||
let previous_turn_id = previous_context_item
|
||||
|
|
@ -1319,7 +1316,10 @@ async fn reconstruct_history_compaction_keeps_latest_surviving_epiphany_state()
|
|||
.reconstruct_history_from_rollout(&turn_context, &rollout_items)
|
||||
.await;
|
||||
|
||||
assert_eq!(reconstructed.epiphany_state, Some(epiphany_state));
|
||||
assert_eq!(
|
||||
reconstructed.history,
|
||||
vec![assistant_message("summary after compaction")]
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
|
|
|||
48
vendor/codex/codex-rs/core/src/session/tests.rs
vendored
48
vendor/codex/codex-rs/core/src/session/tests.rs
vendored
|
|
@ -147,14 +147,16 @@ use std::time::Duration as StdDuration;
|
|||
|
||||
mod guardian_tests;
|
||||
|
||||
fn sample_epiphany_state_for_persistence() -> EpiphanyThreadState {
|
||||
EpiphanyThreadState {
|
||||
revision: 1,
|
||||
objective: Some("Persist the epiphany baseline".to_string()),
|
||||
active_subgoal_id: Some("phase1".to_string()),
|
||||
last_updated_turn_id: Some("phase1-turn".to_string()),
|
||||
..Default::default()
|
||||
}
|
||||
#[test]
|
||||
fn codex_session_has_no_epiphany_state_custody() {
|
||||
let session_state = include_str!("../state/session.rs");
|
||||
let session = include_str!("mod.rs");
|
||||
let codex_thread = include_str!("../codex_thread.rs");
|
||||
|
||||
assert!(!session_state.contains("epiphany_state"));
|
||||
assert!(!session.contains("set_epiphany_state"));
|
||||
assert!(!session.contains("async fn epiphany_state"));
|
||||
assert!(!codex_thread.contains("async fn epiphany_state"));
|
||||
}
|
||||
|
||||
fn sample_epiphany_state_for_prompt() -> EpiphanyThreadState {
|
||||
|
|
@ -5137,9 +5139,6 @@ async fn record_context_updates_and_set_reference_context_item_persists_baseline
|
|||
#[tokio::test]
|
||||
async fn record_context_updates_does_not_persist_epiphany_state() {
|
||||
let (session, turn_context) = make_session_and_context().await;
|
||||
session
|
||||
.set_epiphany_state(Some(sample_epiphany_state_for_persistence()))
|
||||
.await;
|
||||
let config = session.get_config().await;
|
||||
let recorder = RolloutRecorder::new(
|
||||
config.as_ref(),
|
||||
|
|
@ -5309,20 +5308,6 @@ async fn build_initial_context_prepends_model_switch_message() {
|
|||
assert!(text.contains("<model_switch>"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn build_initial_context_does_not_inject_epiphany_state_when_present() {
|
||||
let (session, turn_context) = make_session_and_context().await;
|
||||
session
|
||||
.set_epiphany_state(Some(sample_epiphany_state_for_prompt()))
|
||||
.await;
|
||||
|
||||
let initial_context = session.build_initial_context(&turn_context).await;
|
||||
let developer_text = joined_developer_input_text(&initial_context);
|
||||
|
||||
assert!(!developer_text.contains("<epiphany_state>"));
|
||||
assert!(!developer_text.contains("## Epiphany State"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn build_initial_context_omits_epiphany_state_block_when_absent() {
|
||||
let (session, turn_context) = make_session_and_context().await;
|
||||
|
|
@ -5376,19 +5361,6 @@ async fn build_initial_context_does_not_inject_resumed_epiphany_state() {
|
|||
assert!(!developer_text.contains("Checkpoint: `phase2-checkpoint` (graph revision 7)"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn build_initial_context_epiphany_state_has_no_prompt_projection() {
|
||||
let (session, turn_context) = make_session_and_context().await;
|
||||
session
|
||||
.set_epiphany_state(Some(sample_epiphany_state_for_prompt()))
|
||||
.await;
|
||||
|
||||
let initial_context = session.build_initial_context(&turn_context).await;
|
||||
let developer_text = joined_developer_input_text(&initial_context);
|
||||
|
||||
assert!(!developer_text.contains("<epiphany_state>"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn record_context_updates_and_set_reference_context_item_persists_full_reinjection_to_rollout()
|
||||
{
|
||||
|
|
|
|||
11
vendor/codex/codex-rs/core/src/state/session.rs
vendored
11
vendor/codex/codex-rs/core/src/state/session.rs
vendored
|
|
@ -9,7 +9,6 @@ use crate::context_manager::ContextManager;
|
|||
use crate::session::PreviousTurnSettings;
|
||||
use crate::session::session::SessionConfiguration;
|
||||
use crate::session_startup_prewarm::SessionStartupPrewarmHandle;
|
||||
use codex_protocol::protocol::EpiphanyThreadState;
|
||||
use codex_protocol::protocol::RateLimitSnapshot;
|
||||
use codex_protocol::protocol::TokenUsage;
|
||||
use codex_protocol::protocol::TokenUsageInfo;
|
||||
|
|
@ -30,7 +29,6 @@ pub(crate) struct SessionState {
|
|||
/// Startup prewarmed session prepared during session initialization.
|
||||
pub(crate) startup_prewarm: Option<SessionStartupPrewarmHandle>,
|
||||
pub(crate) pending_session_start_source: Option<codex_hooks::SessionStartSource>,
|
||||
epiphany_state: Option<EpiphanyThreadState>,
|
||||
granted_permissions: Option<PermissionProfile>,
|
||||
next_turn_is_first: bool,
|
||||
}
|
||||
|
|
@ -48,7 +46,6 @@ impl SessionState {
|
|||
previous_turn_settings: None,
|
||||
startup_prewarm: None,
|
||||
pending_session_start_source: None,
|
||||
epiphany_state: None,
|
||||
granted_permissions: None,
|
||||
next_turn_is_first: true,
|
||||
}
|
||||
|
|
@ -109,14 +106,6 @@ impl SessionState {
|
|||
self.history.reference_context_item()
|
||||
}
|
||||
|
||||
pub(crate) fn epiphany_state(&self) -> Option<EpiphanyThreadState> {
|
||||
self.epiphany_state.clone()
|
||||
}
|
||||
|
||||
pub(crate) fn set_epiphany_state(&mut self, epiphany_state: Option<EpiphanyThreadState>) {
|
||||
self.epiphany_state = epiphany_state;
|
||||
}
|
||||
|
||||
// Token/rate limit helpers
|
||||
pub(crate) fn update_token_info_from_usage(
|
||||
&mut self,
|
||||
|
|
|
|||
Reference in a new issue