Mark Epiphany rollout state as legacy

This commit is contained in:
Meta Vens 2026-07-12 05:38:03 +01:00
commit df822e93f5
17 changed files with 40 additions and 28 deletions

View file

@ -1922,6 +1922,10 @@ native-state dependency in any dependency class, its giant state fixture is
gone, and a minimal opaque historical-envelope test remains. Next rename the
variant `LegacyEpiphanyState` while preserving serde tag `epiphany_state`, then
judge whether generic unknown-rollout cargo can remove its final named trace.
The rename is complete and tested: all Rust matches say
`LegacyEpiphanyState`, serde still emits/reads `epiphany_state`, and migration
behavior is unchanged. Next audit a generic unknown historical rollout carrier,
but reject it if it weakens strict decoding of live Codex history.
## Immediate Re-entry Instruction

View file

@ -326,3 +326,9 @@ giant `EpiphanyThreadState` fixture and native round-trip tests are replaced by
one minimal opaque-envelope preservation test. `codex-protocol` has no
`epiphany-state-model` dependency in production or dev configuration; native
state serialization is tested by its actual owner.
The opaque Rust variant is now named `LegacyEpiphanyState`, with an explicit
`#[serde(rename = "epiphany_state")]` preserving the historical wire/file tag.
Every remaining Codex match therefore declares that it handles quarantine
cargo rather than live Epiphany authority. Protocol shape and app-server
migration tests prove the rename did not change old-file compatibility.

Binary file not shown.

View file

@ -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: Rename the opaque protocol variant to `LegacyEpiphanyState` with `#[serde(rename = "epiphany_state")]` so every remaining core match states its quarantine status while preserving old JSON exactly. Then audit whether a generic unknown-rollout compatibility carrier can delete even that named core knowledge without weakening old-file recovery.
next_action: Audit whether `RolloutItem` can carry unknown historical item kinds generically, allowing `LegacyEpiphanyState` to leave codex-protocol/core entirely while app-server migration still recognizes `type=epiphany_state`. Do not adopt a generic blob carrier unless it preserves strict decoding for live Codex items and quarantines unknown cargo without turning malformed current rollouts into silent success.

View file

@ -233,7 +233,7 @@ impl ThreadHistoryBuilder {
RolloutItem::Compacted(payload) => self.handle_compacted(payload),
RolloutItem::ResponseItem(item) => self.handle_response_item(item),
RolloutItem::TurnContext(_)
| RolloutItem::EpiphanyState(_)
| RolloutItem::LegacyEpiphanyState(_)
| RolloutItem::SessionMeta(_) => {}
}
}

View file

@ -68,7 +68,7 @@ pub(super) fn latest_legacy_epiphany_state(
RolloutItem::ResponseItem(ResponseItem::Message { role, .. }) if role == "user" => {
segment.get_or_insert_with(LegacySegment::default).user_turn = true;
}
RolloutItem::EpiphanyState(payload) => {
RolloutItem::LegacyEpiphanyState(payload) => {
let item: epiphany_state_model::EpiphanyStateItem =
serde_json::from_value(payload.clone()).map_err(|error| {
format!("invalid legacy Epiphany rollout payload: {error}")
@ -137,7 +137,7 @@ mod tests {
local_images: Vec::new(),
text_elements: Vec::new(),
})),
RolloutItem::EpiphanyState(
RolloutItem::LegacyEpiphanyState(
serde_json::to_value(EpiphanyStateItem {
turn_id: Some(id.to_string()),
state,
@ -176,7 +176,7 @@ mod tests {
#[test]
fn rejects_malformed_legacy_state_payload() {
let items = vec![RolloutItem::EpiphanyState(serde_json::json!({
let items = vec![RolloutItem::LegacyEpiphanyState(serde_json::json!({
"turn_id": "not-the-legacy-shape"
}))];

View file

@ -119,7 +119,7 @@ fn keep_forked_rollout_item(item: &RolloutItem) -> bool {
// A forked child gets its own runtime config, including spawned-agent
// instructions, so it must establish a fresh context diff baseline.
RolloutItem::TurnContext(_) => false,
RolloutItem::EpiphanyState(_) => true,
RolloutItem::LegacyEpiphanyState(_) => true,
RolloutItem::Compacted(_) | RolloutItem::EventMsg(_) | RolloutItem::SessionMeta(_) => true,
}
}

View file

@ -182,7 +182,7 @@ impl Session {
}
}
}
RolloutItem::EpiphanyState(_) => {}
RolloutItem::LegacyEpiphanyState(_) => {}
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| {
@ -275,7 +275,7 @@ impl Session {
}
RolloutItem::EventMsg(_)
| RolloutItem::TurnContext(_)
| RolloutItem::EpiphanyState(_)
| RolloutItem::LegacyEpiphanyState(_)
| RolloutItem::SessionMeta(_) => {}
}
}

View file

@ -15,7 +15,7 @@ use pretty_assertions::assert_eq;
use std::path::PathBuf;
fn legacy_epiphany_state(item: EpiphanyStateItem) -> RolloutItem {
RolloutItem::EpiphanyState(
RolloutItem::LegacyEpiphanyState(
serde_json::to_value(item).expect("serialize legacy Epiphany rollout payload"),
)
}

View file

@ -148,7 +148,7 @@ use std::time::Duration as StdDuration;
mod guardian_tests;
fn legacy_epiphany_state(item: EpiphanyStateItem) -> RolloutItem {
RolloutItem::EpiphanyState(
RolloutItem::LegacyEpiphanyState(
serde_json::to_value(item).expect("serialize legacy Epiphany rollout payload"),
)
}
@ -169,7 +169,8 @@ fn codex_session_has_no_epiphany_state_custody() {
assert!(!codex_thread.contains("pub async fn epiphany_"));
assert!(!core_lib.contains("epiphany_rollout"));
assert!(!protocol.contains("pub use epiphany_state_model::"));
assert!(protocol.contains("EpiphanyState(serde_json::Value)"));
assert!(protocol.contains("LegacyEpiphanyState(serde_json::Value)"));
assert!(protocol.contains("#[serde(rename = \"epiphany_state\")]"));
assert!(!protocol_manifest.contains("epiphany-state-model"));
}
@ -5198,7 +5199,7 @@ async fn record_context_updates_does_not_persist_epiphany_state() {
!resumed
.history
.iter()
.any(|item| matches!(item, RolloutItem::EpiphanyState(_)))
.any(|item| matches!(item, RolloutItem::LegacyEpiphanyState(_)))
);
}
@ -5244,7 +5245,7 @@ async fn record_context_updates_and_set_reference_context_item_skips_epiphany_st
!resumed
.history
.iter()
.any(|item| matches!(item, RolloutItem::EpiphanyState(_))),
.any(|item| matches!(item, RolloutItem::LegacyEpiphanyState(_))),
"epiphany state should not be persisted when session state is empty"
);
}

View file

@ -2943,7 +2943,8 @@ pub enum RolloutItem {
ResponseItem(ResponseItem),
Compacted(CompactedItem),
TurnContext(TurnContextItem),
EpiphanyState(serde_json::Value),
#[serde(rename = "epiphany_state")]
LegacyEpiphanyState(serde_json::Value),
EventMsg(EventMsg),
}
@ -5111,13 +5112,13 @@ mod tests {
"objective": "historical compatibility only"
}
});
let item = RolloutItem::EpiphanyState(payload.clone());
let item = RolloutItem::LegacyEpiphanyState(payload.clone());
let encoded = serde_json::to_value(&item)?;
assert_eq!(encoded["type"], "epiphany_state");
assert_eq!(encoded["payload"], payload);
let reparsed: RolloutItem = serde_json::from_value(encoded)?;
let RolloutItem::EpiphanyState(reparsed_payload) = reparsed else {
let RolloutItem::LegacyEpiphanyState(reparsed_payload) = reparsed else {
panic!("expected opaque legacy Epiphany rollout payload");
};
assert_eq!(reparsed_payload, payload);

View file

@ -1127,7 +1127,7 @@ async fn read_head_summary(path: &Path, head_limit: usize) -> io::Result<HeadTai
RolloutItem::TurnContext(_) => {
// Not included in `head`; skip.
}
RolloutItem::EpiphanyState(_) => {
RolloutItem::LegacyEpiphanyState(_) => {
// Not included in `head`; skip.
}
RolloutItem::Compacted(_) => {
@ -1186,7 +1186,7 @@ pub async fn read_head_for_summary(path: &Path) -> io::Result<Vec<serde_json::Va
}
RolloutItem::Compacted(_)
| RolloutItem::TurnContext(_)
| RolloutItem::EpiphanyState(_)
| RolloutItem::LegacyEpiphanyState(_)
| RolloutItem::EventMsg(_) => {}
}
}

View file

@ -73,7 +73,7 @@ pub fn builder_from_items(
RolloutItem::ResponseItem(_)
| RolloutItem::Compacted(_)
| RolloutItem::TurnContext(_)
| RolloutItem::EpiphanyState(_)
| RolloutItem::LegacyEpiphanyState(_)
| RolloutItem::EventMsg(_) => None,
}) && let Some(builder) = builder_from_session_meta(session_meta, rollout_path)
{
@ -128,7 +128,7 @@ pub async fn extract_metadata_from_rollout(
RolloutItem::ResponseItem(_)
| RolloutItem::Compacted(_)
| RolloutItem::TurnContext(_)
| RolloutItem::EpiphanyState(_)
| RolloutItem::LegacyEpiphanyState(_)
| RolloutItem::EventMsg(_) => None,
}),
parse_errors,

View file

@ -18,7 +18,7 @@ pub fn is_persisted_response_item(item: &RolloutItem, mode: EventPersistenceMode
// Persist Codex executive markers so we can analyze flows (e.g., compaction, API turns).
RolloutItem::Compacted(_)
| RolloutItem::TurnContext(_)
| RolloutItem::EpiphanyState(_)
| RolloutItem::LegacyEpiphanyState(_)
| RolloutItem::SessionMeta(_) => true,
}
}

View file

@ -880,8 +880,8 @@ impl RolloutRecorder {
RolloutItem::TurnContext(item) => {
items.push(RolloutItem::TurnContext(item));
}
RolloutItem::EpiphanyState(item) => {
items.push(RolloutItem::EpiphanyState(item));
RolloutItem::LegacyEpiphanyState(item) => {
items.push(RolloutItem::LegacyEpiphanyState(item));
}
RolloutItem::EventMsg(_ev) => {
items.push(RolloutItem::EventMsg(_ev));
@ -1846,7 +1846,7 @@ async fn resume_candidate_matches_cwd(
RolloutItem::SessionMeta(_)
| RolloutItem::ResponseItem(_)
| RolloutItem::Compacted(_)
| RolloutItem::EpiphanyState(_)
| RolloutItem::LegacyEpiphanyState(_)
| RolloutItem::EventMsg(_) => None,
})
{

View file

@ -22,7 +22,7 @@ pub fn apply_rollout_item(
RolloutItem::TurnContext(turn_ctx) => apply_turn_context(metadata, turn_ctx),
RolloutItem::EventMsg(event) => apply_event_msg(metadata, event),
RolloutItem::ResponseItem(item) => apply_response_item(metadata, item),
RolloutItem::Compacted(_) | RolloutItem::EpiphanyState(_) => {}
RolloutItem::Compacted(_) | RolloutItem::LegacyEpiphanyState(_) => {}
}
if metadata.model_provider.is_empty() {
metadata.model_provider = default_provider.to_string();
@ -39,7 +39,7 @@ pub fn rollout_item_affects_thread_metadata(item: &RolloutItem) -> bool {
RolloutItem::EventMsg(_)
| RolloutItem::ResponseItem(_)
| RolloutItem::Compacted(_)
| RolloutItem::EpiphanyState(_) => false,
| RolloutItem::LegacyEpiphanyState(_) => false,
}
}

View file

@ -973,7 +973,7 @@ pub(super) fn extract_dynamic_tools(items: &[RolloutItem]) -> Option<Option<Vec<
RolloutItem::ResponseItem(_)
| RolloutItem::Compacted(_)
| RolloutItem::TurnContext(_)
| RolloutItem::EpiphanyState(_)
| RolloutItem::LegacyEpiphanyState(_)
| RolloutItem::EventMsg(_) => None,
})
}
@ -984,7 +984,7 @@ pub(super) fn extract_memory_mode(items: &[RolloutItem]) -> Option<String> {
RolloutItem::ResponseItem(_)
| RolloutItem::Compacted(_)
| RolloutItem::TurnContext(_)
| RolloutItem::EpiphanyState(_)
| RolloutItem::LegacyEpiphanyState(_)
| RolloutItem::EventMsg(_) => None,
})
}