Archive completed model generations

This commit is contained in:
Meta Vens 2026-08-10 01:51:52 +01:00
commit c137e16ba5
8 changed files with 1262 additions and 115 deletions

View file

@ -13,10 +13,10 @@ use epiphany_core::{
load_resident_self_state, observe_process_instance, pending_resident_self_acks,
prepare_resident_self_launch, publish_resident_provider_readiness,
resident_prepared_launch_thread_id, resident_self_child_claim,
resident_self_local_provider_status, retain_coordinator_run_receipts,
retain_resident_self_lifecycles, settle_resident_self_exited_coordinator,
terminate_process_instance, validate_persona_feedback_store_separation,
validate_resident_self_store_separation,
resident_self_local_provider_status, retain_completed_model_sessions,
retain_coordinator_run_receipts, retain_resident_self_lifecycles,
settle_resident_self_exited_coordinator, terminate_process_instance,
validate_persona_feedback_store_separation, validate_resident_self_store_separation,
};
use serde_json::json;
use std::collections::{BTreeMap, BTreeSet};
@ -141,6 +141,11 @@ fn retain_runtime_receipts(args: &Args, state: &ResidentSelfState) -> Result<()>
&preserved,
&Utc::now().to_rfc3339(),
)?;
retain_completed_model_sessions(
&args.policy.runtime_store,
args.retained_completed_model_sessions,
&Utc::now().to_rfc3339(),
)?;
Ok(())
}
@ -449,6 +454,7 @@ struct Args {
provider_freshness_seconds: u64,
retained_closed_lifecycles: usize,
retained_coordinator_receipts: usize,
retained_completed_model_sessions: usize,
persona_feedback_source_store: PathBuf,
persona_feedback_store: PathBuf,
bifrost_feedback_trust_anchor: PathBuf,
@ -556,6 +562,9 @@ impl Args {
retained_coordinator_receipts: u64v("--retained-coordinator-receipts", 256)?
.try_into()
.context("--retained-coordinator-receipts exceeds platform size")?,
retained_completed_model_sessions: u64v("--retained-completed-model-sessions", 256)?
.try_into()
.context("--retained-completed-model-sessions exceeds platform size")?,
persona_feedback_source_store: path("--persona-feedback-source-store")?,
persona_feedback_store: path("--persona-feedback-store")?,
bifrost_feedback_trust_anchor: path("--bifrost-feedback-trust-anchor")?,

View file

@ -970,8 +970,11 @@ pub use repository_body_observer::*;
pub use repository_readiness::*;
pub use resident_readiness::*;
pub use resident_self::*;
pub use runtime_spine::ARCHIVED_RUNTIME_SESSION_SCHEMA_VERSION;
pub use runtime_spine::ARCHIVED_RUNTIME_SESSION_TYPE;
pub use runtime_spine::COORDINATOR_RUN_RECEIPT_SCHEMA_VERSION;
pub use runtime_spine::COORDINATOR_RUN_RECEIPT_TYPE;
pub use runtime_spine::EpiphanyArchivedRuntimeSession;
pub use runtime_spine::EpiphanyCoordinatorRunReceipt;
pub use runtime_spine::EpiphanyCoordinatorRunReceiptRetentionHead;
pub use runtime_spine::EpiphanyJobInterruptRequest;
@ -985,13 +988,13 @@ pub use runtime_spine::EpiphanyRuntimeJobResult;
pub use runtime_spine::EpiphanyRuntimeJobSnapshot;
pub use runtime_spine::EpiphanyRuntimeJobStatus;
pub use runtime_spine::EpiphanyRuntimeModelExecutionBinding;
pub use runtime_spine::EpiphanyRuntimeToolExecutionBinding;
pub use runtime_spine::EpiphanyRuntimeReorientWorkerResult;
pub use runtime_spine::EpiphanyRuntimeRoleWorkerResult;
pub use runtime_spine::EpiphanyRuntimeSession;
pub use runtime_spine::EpiphanyRuntimeSessionStatus;
pub use runtime_spine::EpiphanyRuntimeSpineStatus;
pub use runtime_spine::EpiphanyRuntimeSwarmBinding;
pub use runtime_spine::EpiphanyRuntimeToolExecutionBinding;
pub use runtime_spine::EpiphanyRuntimeWorkerLaunchRequest;
pub use runtime_spine::EpiphanyToolInvocationStatus;
pub use runtime_spine::PreparedRuntimeSpineHeartbeatJob;
@ -1002,8 +1005,6 @@ pub use runtime_spine::RUNTIME_JOB_RESULT_TYPE;
pub use runtime_spine::RUNTIME_JOB_TYPE;
pub use runtime_spine::RUNTIME_MODEL_EXECUTION_BINDING_SCHEMA_VERSION;
pub use runtime_spine::RUNTIME_MODEL_EXECUTION_BINDING_TYPE;
pub use runtime_spine::RUNTIME_TOOL_EXECUTION_BINDING_SCHEMA_VERSION;
pub use runtime_spine::RUNTIME_TOOL_EXECUTION_BINDING_TYPE;
pub use runtime_spine::RUNTIME_REORIENT_WORKER_RESULT_SCHEMA_VERSION;
pub use runtime_spine::RUNTIME_REORIENT_WORKER_RESULT_TYPE;
pub use runtime_spine::RUNTIME_ROLE_WORKER_RESULT_SCHEMA_VERSION;
@ -1012,6 +1013,8 @@ pub use runtime_spine::RUNTIME_SESSION_TYPE;
pub use runtime_spine::RUNTIME_SPINE_SCHEMA_VERSION;
pub use runtime_spine::RUNTIME_SWARM_BINDING_KEY;
pub use runtime_spine::RUNTIME_SWARM_BINDING_SCHEMA_VERSION;
pub use runtime_spine::RUNTIME_TOOL_EXECUTION_BINDING_SCHEMA_VERSION;
pub use runtime_spine::RUNTIME_TOOL_EXECUTION_BINDING_TYPE;
pub use runtime_spine::RUNTIME_WORKER_LAUNCH_REQUEST_SCHEMA_VERSION;
pub use runtime_spine::RUNTIME_WORKER_LAUNCH_REQUEST_TYPE;
pub use runtime_spine::RepoFrontierVerdictModelingLaunchAuthority;
@ -1029,6 +1032,7 @@ pub use runtime_spine::RuntimeTypedFulfillmentEvidence;
pub use runtime_spine::RuntimeTypedRequestRef;
pub use runtime_spine::amend_repo_frontier_execution;
pub use runtime_spine::append_runtime_event;
pub use runtime_spine::archive_completed_model_session;
pub use runtime_spine::bind_runtime_repository_domain;
pub use runtime_spine::bind_runtime_to_agent_memory_swarm;
pub use runtime_spine::canonical_repo_frontier_plan_candidate_id;
@ -1051,12 +1055,12 @@ pub use runtime_spine::ensure_runtime_session;
pub use runtime_spine::initialize_runtime_spine;
pub use runtime_spine::intake_user_repo_frontier_proposal;
pub use runtime_spine::migrate_legacy_repo_model_projection_obligation;
pub use runtime_spine::open_runtime_model_execution;
pub use runtime_spine::open_runtime_spine_heartbeat_job;
pub use runtime_spine::operator_repo_frontier_plan_review_is_current;
pub use runtime_spine::pending_repo_frontier_plan_reviews;
pub use runtime_spine::plan_runtime_spine_heartbeat_launch;
pub use runtime_spine::prepare_runtime_spine_heartbeat_job;
pub use runtime_spine::retain_coordinator_run_receipts;
pub use runtime_spine::promote_autonomous_direction_options_for_modeling;
pub use runtime_spine::put_continuity_recovery_receipt;
pub use runtime_spine::put_coordinator_run_receipt;
@ -1075,15 +1079,16 @@ pub use runtime_spine::put_repo_frontier_verification_request;
pub use runtime_spine::put_repo_frontier_work_proposal;
pub use runtime_spine::put_runtime_reorient_worker_result;
pub use runtime_spine::put_runtime_role_worker_result;
pub use runtime_spine::open_runtime_model_execution;
pub use runtime_spine::put_runtime_tool_execution_intent;
pub use runtime_spine::put_runtime_tool_execution_receipt;
pub use runtime_spine::put_soul_verdict_receipt;
pub use runtime_spine::put_substrate_gate_repo_access_grant_receipt;
pub use runtime_spine::relinquish_repo_frontier_hands_route;
pub use runtime_spine::replace_or_append_epiphany_job_binding;
pub use runtime_spine::runtime_continuity_recovery_receipt;
pub use runtime_spine::require_runtime_tool_execution_binding;
pub use runtime_spine::retain_completed_model_sessions;
pub use runtime_spine::retain_coordinator_run_receipts;
pub use runtime_spine::runtime_continuity_recovery_receipt;
pub use runtime_spine::runtime_current_repo_model;
pub use runtime_spine::runtime_eyes_evidence_packet;
pub use runtime_spine::runtime_hands_action_intent;

File diff suppressed because it is too large Load diff

View file

@ -2438,6 +2438,26 @@ semantic/Mind/consequence families remain untouched. The tombstone must retain
the exact session, job/result, model-request, and tool-intent identities as an
ID-reuse barrier plus counts and a digest of bulky retired envelopes.
That narrow owner now exists in source as
`EpiphanyArchivedRuntimeSession` and `archive_completed_model_session`.
Runtime spine admits only the closed model-generation shape above, verifies the
native/provider terminal streams and receipts plus every bound tool receipt,
and refuses outer worker/coordinator membership. One full-snapshot-fenced
replacement writes the exact-ID tombstone and deletes only its enumerated inner
execution envelopes. Tombstone IDs block later session, job, model-request, or
tool-intent aliasing; the tombstone itself is never enumerated as runnable
authority. Stale-snapshot, missing-tool-receipt, byte-identity, idempotence, and
ID-reuse negatives pass.
`retain_completed_model_sessions` selects only completed generations whose
jobs are all model-adapter jobs with explicit model bindings, orders them by
session closure time, and keeps at least the newest even when configured zero.
Resident Self invokes it beside coordinator-receipt retention only after the
shared no-active/no-prepared authority gate. The default retained window is
256. A two-generation test proves the older generation becomes a tombstone and
the newest remains live. Exact package and copied-state proof remain required;
conversation-wide sessions and semantic history remain separate owners.
The coordinator receipt accumulator is implemented in source. Runtime owns the
typed head, cumulative status counts, chained digest, and full-snapshot-fenced
replacement/deletion. Resident Self supplies the cross-store preservation set

View file

@ -1512,3 +1512,29 @@ Six OpenAI CLI and 15 library tests pass, including terminal receipt/session
assertions. The next cut is the narrow archived model-session tombstone; it
must retain exact IDs and delete only inner execution envelopes, never outer
worker or semantic authority.
## Narrow model-generation archive — source-proven 2026-08-10
Runtime spine now owns `EpiphanyArchivedRuntimeSession`. Archive admission is
deliberately narrow: the session is Completed; every member job is an
`openai-model-adapter` job with exactly one model-execution binding and terminal
job result; native and OpenAI requests, streams, and receipts agree and are
terminal; and every bound tool intent has one authenticated terminal receipt.
Outer worker launches/results, coordinator receipts, semantic/Mind/consequence
documents, unknown rows, and unrelated runtime envelopes are not members.
One full-snapshot-fenced replacement writes a tombstone containing the exact
session/job/result/request/intent IDs, terminal counts, retired-family counts,
and chained envelope digest while deleting only that inner execution family.
Those retained IDs are the permanent reuse barrier. A stale snapshot refuses;
an unreceipted tool refuses; exact replay is idempotent; and unrelated envelopes
remain byte-identical. Resident Self calls the bounded owner only while neither
active nor prepared launch authority exists. The configurable default window
is 256 and at least the newest completed model generation always survives.
The exact archive test and two-generation retention-window test pass, as do all
eight `epiphany-swarm` tests and `cargo check`. The schema and CultNet catalog
parse. This cut is not yet committed, packaged, or exercised on copied live
state. Next commit/push it, package only that exact commit with Starfire's
persistent Linux cache, then prove tombstone non-resurrection and byte identity
on copied state. Active c005 remains untouchable. Yggdrasil never builds.

View file

@ -0,0 +1,36 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://gamecult.dev/epiphany/cultnet/epiphany.runtime.archived-session.schema.json",
"title": "Epiphany Archived Runtime Session",
"description": "Permanent tombstone and evidence accumulator for one fully closed model-session execution generation.",
"type": "object",
"additionalProperties": false,
"properties": {
"schemaVersion": { "type": "string", "const": "epiphany.runtime.archived_session.v0" },
"archiveId": { "type": "string", "minLength": 1 },
"sessionId": { "type": "string", "minLength": 1 },
"archivedAt": { "type": "string", "format": "date-time" },
"jobIds": { "type": "array", "items": { "type": "string", "minLength": 1 }, "uniqueItems": true },
"jobResultIds": { "type": "array", "items": { "type": "string", "minLength": 1 }, "uniqueItems": true },
"modelRequestIds": { "type": "array", "items": { "type": "string", "minLength": 1 }, "uniqueItems": true },
"toolIntentIds": { "type": "array", "items": { "type": "string", "minLength": 1 }, "uniqueItems": true },
"terminalJobStatusCounts": { "type": "object", "additionalProperties": { "type": "integer", "minimum": 0 } },
"retiredTypeCounts": { "type": "object", "additionalProperties": { "type": "integer", "minimum": 0 } },
"retiredEnvelopeCount": { "type": "integer", "minimum": 1 },
"retiredChainDigest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
},
"required": [
"schemaVersion",
"archiveId",
"sessionId",
"archivedAt",
"jobIds",
"jobResultIds",
"modelRequestIds",
"toolIntentIds",
"terminalJobStatusCounts",
"retiredTypeCounts",
"retiredEnvelopeCount",
"retiredChainDigest"
]
}

View file

@ -59,6 +59,17 @@
"title": "Epiphany Runtime Tool Execution Binding",
"path": "epiphany.runtime.tool-execution-binding.schema.json"
},
{
"schemaId": "https://gamecult.dev/epiphany/cultnet/epiphany.runtime.archived-session.schema.json",
"kind": "document_payload",
"wireContracts": [
"cultnet.schema.v0"
],
"schemaVersion": "epiphany.runtime.archived_session.v0",
"documentType": "epiphany.runtime.archived_session",
"title": "Epiphany Archived Runtime Session",
"path": "epiphany.runtime.archived-session.schema.json"
},
{
"schemaId": "https://gamecult.dev/epiphany/cultnet/epiphany.runtime.job.schema.json",
"kind": "document_payload",

View file

@ -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, and exact 16c4b19f coordinator receipt and Heartbeat artifact retention are proven. Gamecult-ops 059821f makes journald the sole Yggdrasil supervisor/projector stream-retention owner. Exact 16c4b19f genuine idle and exact a987d2f7 active cognition both completed 900-pulse bounded plateaus with clean direct-PID exits. The active run proves restart-persistent cooldown, exact-grant terminality under deliberate missing-ack and marker-regression corruption, multiple later terminal grants without resurrection, bounded artifact retention, and flat terminal resource state. Runtime-owned typed fulfillment is now accepted live: c1b461b2 falsified mutable Body/admission coupling, c9738fdb repaired the owner split, and exact 6dd9b132 packaging completed one autonomous Eyes continuation through coordinator exit, awaiting-fulfillment, one authenticated result, one planned acknowledgement, grant terminality, and clean shutdown. All 50 runtime-spine and 24 resident focused tests pass. Broad session/model/event/tool retention and stable Starfire firewall ownership remain open. Yggdrasil is the small public crossing body, never the release forge.
latest_phase: Exact 6dd9b132 fulfillment remains accepted. Runtime spine owns atomic model/tool execution membership and immutable tool receipts. Retained-reference inspection then falsified the proposed archive unit: worker model sessions were role-long and could never close while future workers remained possible. Worker sessions now derive from exact outer job_id, contain that worker's initial/followup model jobs, and close on success. Loop-stall/round-limit paths terminalize unexecuted intents, fail the outer worker, and close the unique inner session. Six OpenAI CLI and 15 library tests pass. Semantic/outer-worker families remain outside the archive unit; no deletion exists yet.
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, and exact 16c4b19f coordinator receipt and Heartbeat artifact retention are proven. Gamecult-ops 059821f makes journald the sole Yggdrasil supervisor/projector stream-retention owner. Exact 16c4b19f genuine idle and exact a987d2f7 active cognition both completed 900-pulse bounded plateaus with clean direct-PID exits. Runtime-owned typed fulfillment is accepted live under exact 6dd9b132. Runtime spine now owns source-proven model/tool execution membership and a narrow completed-model-session tombstone; exact packaging and copied-state archive proof remain open. Stable Starfire firewall ownership also remains open. Yggdrasil is the small public crossing body, never the release forge.
latest_phase: The narrow runtime archive owner is implemented in source. A completed model-generation session can retire only when every model-adapter job has one binding and terminal result, native/provider streams agree and are terminal, and every bound tool intent has an immutable terminal receipt. One full-snapshot transaction replaces those exact inner execution envelopes with an ID-bearing digest tombstone; outer worker, semantic, coordinator, unknown, and unrelated runtime rows are excluded. Resident Self invokes bounded retention only with no active or prepared launch and keeps at least the newest generation. Focused archive, retention-window, and all eight swarm tests pass; packaging/live proof is next.
operational_state:
local_worktree: coordinator_receipt_retention_packaged_proven
local_worktree: archived_model_session_source_proven_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, and runtime-owned typed fulfillment are accepted. Broader semantic/runtime session, job, event, model, and tool histories remain unbounded pending a typed archived-session owner. 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: Implement the narrow archived model-session tombstone. Admit only a Completed session containing model-adapter jobs where every job has one explicit model binding and terminal result, every native/provider stream is terminal, and every tool binding has an immutable receipt. Retain exact session/job/result/request/intent IDs plus counts and chained digest as an ID-reuse barrier; delete only exact inner session/job/event/model/tool envelopes under a full-snapshot fence. Refuse legacy unbound rows, nonterminal families, stale snapshots, semantic/outer-worker deletion, and session recreation. 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, and runtime-owned typed fulfillment are accepted. Narrow model-generation retention is source-proven but not yet packaged or exercised against copied live state; semantic and conversation-wide runtime histories remain outside its authority. 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 narrow archived-model-session owner, package that exact commit using Starfire's persistent Linux cache, authenticate all 24 binaries and witness, then exercise bounded retention only on copied state. Prove the older fully closed generation becomes one exact tombstone, the newest survives, unrelated/outer/semantic envelopes remain byte-identical, ID reuse and work resurrection fail, and replay is stable. Preserve active c005. Yggdrasil never builds.
active_subgoals:
- Prove Persona, Self, Eyes, Modeling, Imagination, Hands, Soul, Mind, Continuity, and nervous-system behavior individually.