From b1e8c89a77024f6ce183f63c70c676e8bbbf575b Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 10 Aug 2026 04:26:35 +0100 Subject: [PATCH] Preserve attempted semantic epochs until physical retirement --- .../src/memory_graph/semantic_projector.rs | 107 ++++-------------- notes/epiphany-current-algorithmic-map.md | 31 +++-- notes/fresh-workspace-handoff.md | 32 ++++++ state/map.yaml | 10 +- 4 files changed, 81 insertions(+), 99 deletions(-) diff --git a/epiphany-core/src/memory_graph/semantic_projector.rs b/epiphany-core/src/memory_graph/semantic_projector.rs index 6c151fda..ebdfde34 100644 --- a/epiphany-core/src/memory_graph/semantic_projector.rs +++ b/epiphany-core/src/memory_graph/semantic_projector.rs @@ -2451,89 +2451,28 @@ where .iter() .filter(|attempt| attempt.obligation_id == obligation.obligation_id) .collect::>(); - for attempt in &obligation_attempts { - validate_memory_semantic_projection_attempt(attempt)?; - if attempt.status == "running" { - return Err(anyhow!( - "semantic projection retention refuses a running historical attempt" - )); - } - let authority_matches = grants.iter().any(|grant| { - grant.grant_id == attempt.authority_id - && grant.obligation_id == obligation.obligation_id - && grant.resulting_claim_id.as_deref() == Some(attempt.claim_id.as_str()) - && grant.resulting_claim_epoch == Some(attempt.claim_epoch) - }) || authorizations.iter().any(|authorization| { - authorization.authorization_id == attempt.authority_id - && authorization.obligation_id == obligation.obligation_id - && authorization.resulting_claim_id.as_deref() - == Some(attempt.claim_id.as_str()) - && authorization.resulting_claim_epoch == Some(attempt.claim_epoch) - }); - if !authority_matches { - return Err(anyhow!( - "semantic projection retention found an unauthenticated historical attempt" - )); - } - } let obligation_receipts = receipts .iter() .filter(|receipt| receipt.obligation_id == obligation.obligation_id) .collect::>(); - let stale_head = MemorySemanticProjectionSourceHead { - swarm_id: obligation.swarm_id.clone(), - partition: obligation.partition.clone(), - canonical_source_id: obligation.canonical_source_id.clone(), - source_commit_id: obligation.source_commit_id.clone(), - graph_id: obligation.graph_id.clone(), - source_generation: obligation.source_generation, - source_model_hash: obligation.source_model_hash.clone(), - canonical_content_set_hash: obligation.canonical_content_set_hash.clone(), - }; - for receipt in &obligation_receipts { - if !memory_semantic_projection_terminal_success(obligation, &stale_head, receipt) { - return Err(anyhow!( - "semantic projection retention found an invalid historical receipt" - )); - } - if !obligation_attempts.iter().any(|attempt| { - attempt.status == "succeeded" - && attempt.claim_id == receipt.claim_id - && attempt.claim_epoch == receipt.claim_epoch - }) { - return Err(anyhow!( - "semantic projection retention receipt lost its succeeded attempt" - )); - } - } - for grant in grants + let obligation_grants = grants .iter() .filter(|grant| grant.obligation_id == obligation.obligation_id) - { - validate_memory_semantic_projector_executor_grant(grant)?; - if grant.status != "consumed" || grant.consumed_at.is_none() { - return Err(anyhow!( - "semantic projection retention refuses unconsumed historical grant" - )); - } - } - for authorization in authorizations + .collect::>(); + let obligation_authorizations = authorizations .iter() .filter(|authorization| authorization.obligation_id == obligation.obligation_id) + .collect::>(); + if !obligation_attempts.is_empty() + || !obligation_receipts.is_empty() + || !obligation_grants.is_empty() + || !obligation_authorizations.is_empty() { - validate_memory_semantic_projector_recovery_authorization(authorization)?; + continue; } - let status = if !obligation_receipts.is_empty() { - "succeeded" - } else if obligation_attempts - .iter() - .any(|attempt| attempt.status == "failed") - { - "failed" - } else { - "superseded_unattempted" - }; - *retired_status_counts.entry(status.to_string()).or_default() += 1; + *retired_status_counts + .entry("superseded_unattempted".to_string()) + .or_default() += 1; retired_obligation_ids.insert(obligation.obligation_id.clone()); } if retired_obligation_ids.is_empty() { @@ -3274,26 +3213,26 @@ mod retention_tests { "2026-08-10T05:00:01Z", )? .expect("older semantic generations should retire"); - assert_eq!(head.retired_generation_count, 2); - assert_eq!(head.retired_status_counts.get("failed"), Some(&1)); + assert_eq!(head.retired_generation_count, 1); + assert_eq!(head.retired_status_counts.get("failed"), None); assert_eq!( head.retired_status_counts.get("superseded_unattempted"), Some(&1) ); let after = SingleFileMessagePackBackingStore::new(&store).pull_all()?; - for retired in [ - &older_failed.obligation_id, - &older_unattempted.obligation_id, - ] { - assert!(!after.iter().any(|entry| { - entry.r#type == MemorySemanticProjectionObligation::TYPE && &entry.key == retired - })); - } assert!(!after.iter().any(|entry| { + entry.r#type == MemorySemanticProjectionObligation::TYPE + && entry.key == older_unattempted.obligation_id + })); + assert!(after.iter().any(|entry| { + entry.r#type == MemorySemanticProjectionObligation::TYPE + && entry.key == older_failed.obligation_id + })); + assert!(after.iter().any(|entry| { entry.r#type == MemorySemanticProjectionAttempt::TYPE && entry.key == older_attempt.attempt_id })); - assert!(!after.iter().any(|entry| { + assert!(after.iter().any(|entry| { entry.r#type == MemorySemanticProjectorExecutorGrant::TYPE && entry.key == older_grant.grant_id })); diff --git a/notes/epiphany-current-algorithmic-map.md b/notes/epiphany-current-algorithmic-map.md index 80c78879..42c82417 100644 --- a/notes/epiphany-current-algorithmic-map.md +++ b/notes/epiphany-current-algorithmic-map.md @@ -2568,10 +2568,10 @@ deleter. the singleton scope claim; any running attempt; the grant or recovery authorization named by that claim; and the exact succeeded attempt/receipt admitted by the current query-readiness gate. -- Retirable inputs: older obligations whose source generation is no longer the - authenticated head, plus their terminal attempts, receipts, and consumed - grant/recovery documents, provided none is referenced by the current claim or - current readiness chain. +- Retirable inputs in the current safe cut: only older obligations whose source + generation is no longer the authenticated head and which have no attempt, + receipt, executor grant, or recovery authorization. Attempted generations + remain durable until physical retirement has its own crash-safe obligation. - Output: one typed per-scope retention head with cumulative type/status counts, retired generation count, and chained digest, replacing the exact old lifecycle envelopes under the source store's full-snapshot fence. It is @@ -2630,7 +2630,8 @@ extension of completed model-session archival. ### Semantic logical lifecycle implementation -`retain_memory_semantic_projection_lifecycles` now realizes the logical half of +`retain_memory_semantic_projection_lifecycles` now realizes the safe unattempted +portion of the logical half of the semantic retention map in each canonical source store. Its one snapshot is the authority basis for current-obligation equality, canonical authority equality, singleton claim/attempt authentication, historical lifecycle @@ -2650,11 +2651,11 @@ it would fall inside the configured recent window. This prevents a stale caller from blessing a future row through retention. Retirable state is limited to lower-generation obligations outside the -preservation set. Every associated attempt must be terminal and bound to an -exact grant or recovery authorization; every grant must be consumed; every -receipt must authenticate the obligation and a succeeded attempt. The one CAS -deletes only those exact lifecycle envelopes and replaces the singleton typed -retention head. Unknown families and the scope claim remain byte-identical. +preservation set that have no attempt, receipt, executor grant, or recovery +authorization. The one CAS deletes only those exact unattempted obligations and +replaces the singleton typed retention head. Unknown families and the scope +claim remain byte-identical. Attempted history remains intact because the +digest-only head cannot preserve the physical Qdrant namespace needed later. Retention faults are reported as degraded daemon physiology; they neither change projection completion nor suppress the health projection. @@ -2675,3 +2676,13 @@ refuse the entire store after the first successful retirement. Both canonical source catalogs now register the head as evidence-only. Projection-input tests persist a head and prove current Mind and Modeling derivation remains unchanged. This is schema legibility, not shared decision authority. + +The copied-live physical audit sharpened the next ownership boundary. A durable +physical-retirement obligation must be emitted before an attempted lifecycle can +retire. It must carry exact collection name, obligation ID, claim ID, claim +epoch, partition/swarm, and the canonical retention authorization that proved +the namespace inactive. The semantic executor alone may delete points matching +that entire namespace and then write a terminal receipt. Backend failure leaves +the obligation pending and cannot affect readiness. The logical retention owner +must preserve attempted lifecycle until that obligation exists; a cumulative +digest is evidence, not a retry address. diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index e1c3785b..3ac648a9 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -1719,3 +1719,35 @@ a retention head beside the canonical source family and still derive the exact current projection input. Both pass. Commit/push, repackage, and repeat the proof from a pristine copy; `6740fc2a` is evidence of the caught fault, not an accepted release. + +## Semantic live proof and physical cut correction — 2026-08-10 + +Exact `7e320b5d` packaged warning-free with 24 binaries as release +`sha256-0f0ff0883f1d84e07fb0485a1d5a4357036b49fad350a041c35a254a09c15441` +and witness +`sha256-96fbe50a32d915eaa23c4260b3c2734b71dc8341fc3248eff56151ae8fefcebc`. +On a pristine copy of `active-cognition6-a987d2f7` Eyes-tools state, window-one +retention retired three superseded unattempted Modeling obligations into a +revision-1 head with digest +`sha256:1cbb209d0cac9decf0715fd91faf07d1c0261805a04c0e6c0af9f3c3d7b5bb54`. +The comparator found zero missing or changed unrelated envelopes. Mind remained +byte-identical across all 20 envelopes and retained exact ready status, receipt, +hashes, generation, and 43-document count. The ordinary packaged semantic +consumer read both retained stores. Replay reported zero retention mutations; +the head remained revision 1. Receipts are under +`.epiphany-run/semantic-retention-7e320b5d`. + +The following physical audit found a cut error before final acceptance. A +digest/count head cannot tell a later Qdrant collector the exact collection, +obligation, claim, and epoch whose points are safe to delete. Deleting a failed +or succeeded attempt first would therefore strand physical garbage, especially +across crash or collection-config change. The source cut now preserves any old +obligation that has an attempt, receipt, executor grant, or recovery +authorization. Only genuinely unattempted superseded obligations compact. + +Attempted lifecycle retirement remains open until retention atomically emits a +durable physical-retirement obligation carrying the exact namespace and the +semantic executor writes a terminal deletion receipt. Backend failure may then +delay space recovery without losing retry identity or changing readiness. Four +focused tests pass after the fail-closed cut. Package that exact source and +repeat the same copied-state proof before accepting this phase. diff --git a/state/map.yaml b/state/map.yaml index ad3cc841..372eda3a 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -35,10 +35,10 @@ invariants: - Evidence and git retain history; this map retains only state that changes future decisions. current_status: - summary: Epiphany is a supervised engineering alpha on Starfire, not deployment-ready. Exact b8138a6b active-child SIGTERM and restart, exact 9f369528 deterministic warm packaging, exact c930f505 cross-container ownership, exact ed15f83a resident lifecycle retention, exact 16c4b19f coordinator receipt and Heartbeat artifact retention, exact cce2b8ac narrow model-generation retention, and exact eea15e82 model-turn JSON ingress are proven. Gamecult-ops 059821f makes journald the sole Yggdrasil supervisor/projector stream-retention owner. Exact 16c4b19f genuine idle and exact a987d2f7 active cognition completed 900-pulse bounded plateaus. Runtime-owned typed fulfillment is accepted live under exact 6dd9b132. Semantic logical lifecycle retention is source-green but not yet package/live accepted; physical semantic garbage collection and Persona conversation retention remain separate. Stable Starfire firewall ownership remains open. Yggdrasil is the small public crossing body, never the release forge. - latest_phase: Exact 6740fc2a packaged warning-free with 24 binaries as release sha256-38b9153d3cad5c2460522278c1e7ce863e5b9a35499611b1f6926cc2f6937d1c and witness sha256-092d9b0f4174131705aabdf77620b196ff69ddec1affcf4d58e9a2b7a1d54593. Its copied-live pulse retired one real semantic lifecycle family with zero retention faults, then the packaged semantic health consumer exposed a catalog fault: agent-memory and runtime-spine caches did not register the new evidence head and refused the retained stores as unknown schema. The source repair registers the evidence type in both canonical readers; focused Mind and Modeling projection-input tests now persist a head and still derive the exact current input. Repackage/replay is required before acceptance. + summary: Epiphany is a supervised engineering alpha on Starfire, not deployment-ready. Exact b8138a6b active-child SIGTERM and restart, exact 9f369528 deterministic warm packaging, exact c930f505 cross-container ownership, exact ed15f83a resident lifecycle retention, exact 16c4b19f coordinator receipt and Heartbeat artifact retention, exact cce2b8ac narrow model-generation retention, and exact eea15e82 model-turn JSON ingress are proven. Gamecult-ops 059821f makes journald the sole Yggdrasil supervisor/projector stream-retention owner. Exact 16c4b19f genuine idle and exact a987d2f7 active cognition completed 900-pulse bounded plateaus. Runtime-owned typed fulfillment is accepted live under exact 6dd9b132. Semantic unattempted-generation retention and consumer legibility are live-proven under exact 7e320b5d behavior, but the final fail-closed attempted-generation preservation cut is source-green and not yet packaged. Physical semantic retirement and Persona conversation retention remain separate. Stable Starfire firewall ownership remains open. Yggdrasil is the small public crossing body, never the release forge. + latest_phase: Exact 7e320b5d packaged warning-free with 24 binaries as release sha256-0f0ff0883f1d84e07fb0485a1d5a4357036b49fad350a041c35a254a09c15441 and witness sha256-96fbe50a32d915eaa23c4260b3c2734b71dc8341fc3248eff56151ae8fefcebc. On pristine copied Eyes-tools state it retired three superseded unattempted Modeling obligations into one revision-1 head, changed or removed zero unrelated envelopes, left the 20-envelope Mind store byte-identical, preserved exact Mind readiness, and replay reported zero retention mutations. The repaired packaged consumers read the head normally. Audit then found that deleting attempted generations would discard the collection/claim/epoch identities needed for crash-safe physical Qdrant cleanup. Source now preserves every obligation with any attempt, receipt, grant, or recovery authorization; only genuinely unattempted generations retire until a durable physical-retirement obligation exists. Four focused retention tests pass; exact packaging of this final cut remains open. operational_state: - local_worktree: semantic_retention_consumer_catalog_repair_green_uncommitted + local_worktree: semantic_unattempted_only_retention_cut_green_uncommitted operator_wireguard: restored yggdrasil: canonical_small_public_crossing_body starfire: temporary_epiphany_cognition_body @@ -68,8 +68,8 @@ current_status: starfire_linux_modeling_peak: 109887488_bytes_resident_body_plus_modeling_circuit yggdrasil_epiphany_service_contract: repaired_in_gamecult_ops_812b427_not_installed resident_physiology: authenticated_9b8df0b4_c005_bound_to_eyes_tools_nervous_system_with_217dd_and_bd96305e_helpers_running - unresolved_authority: Coordinator receipt, Heartbeat pulse-artifact, deployed supervisor/projector log retention, genuine-idle and active resource plateaus, exact-grant terminality, restart-persistent cooldown refusal, schedule/action issuance cardinality, runtime-owned typed fulfillment, narrow model-generation retention, and published model-turn JSON ingress are accepted. Semantic logical lifecycle retention is source-green but lacks exact packaged copied-live proof. Physical Qdrant epochs and conversation-wide runtime histories remain separate/unbounded. Repository Body observation still performs two authenticated full-tree Git index/manifest passes. Execute-mode workers require a persistent process body. Keyed storage has not earned live migration. One Discord consequence remains blocked by the absent Yggdrasil credential. - next_action: Commit and push the semantic retention consumer-catalog repair, package and authenticate that exact source from Starfire's persistent cache, then repeat the copied-state proof from a pristine copy. Require one real retirement, readable and identical current Mind/Modeling projection inputs after the head exists, zero-mutation stable replay, and no readiness/claim resurrection. Physical Qdrant epoch GC and cross-store Persona conversation retirement remain separate following cuts. Preserve active c005. Yggdrasil never builds. + unresolved_authority: Coordinator receipt, Heartbeat pulse-artifact, deployed supervisor/projector log retention, genuine-idle and active resource plateaus, exact-grant terminality, restart-persistent cooldown refusal, schedule/action issuance cardinality, runtime-owned typed fulfillment, narrow model-generation retention, and published model-turn JSON ingress are accepted. Semantic unattempted-generation retention is live-proven but the final attempted-generation preservation cut lacks exact packaging. Attempted semantic lifecycle and physical Qdrant epochs remain unbounded until a durable cleanup obligation preserves exact collection/claim/epoch identity across crash and backend failure. Conversation-wide runtime histories remain separate/unbounded. Repository Body observation still performs two authenticated full-tree Git index/manifest passes. Execute-mode workers require a persistent process body. Keyed storage has not earned live migration. One Discord consequence remains blocked by the absent Yggdrasil credential. + next_action: Commit, push, package, and inspect the fail-closed semantic cut that preserves every attempted generation. Re-run the copied-state window-one proof and require the same three unattempted retirements, revision-1 head, zero unrelated mutation, readable current health, and zero retention mutation on replay. Then map and implement a durable semantic physical-retirement obligation carrying exact collection, obligation, claim, and epoch identity before any attempted lifecycle may compact. Preserve active c005. Yggdrasil never builds. active_subgoals: - Prove Persona, Self, Eyes, Modeling, Imagination, Hands, Soul, Mind, Continuity, and nervous-system behavior individually.