Archive failed typed worker attempts
This commit is contained in:
parent
909cb25ffb
commit
380ba8ca42
8 changed files with 273 additions and 4 deletions
|
|
@ -10,13 +10,15 @@ use epiphany_core::{
|
|||
coordinator_run_receipts, derive_resident_cognition_readiness,
|
||||
enqueue_resident_self_pressure, import_bifrost_persona_feedback_deliveries,
|
||||
ingest_resident_self_domain_pressure, load_epiphany_cultmesh_swarm_brake,
|
||||
load_resident_self_state, observe_process_instance, pending_resident_self_acks,
|
||||
live_resident_self_typed_request_ids, load_resident_self_state, observe_process_instance,
|
||||
pending_resident_self_acks,
|
||||
prepare_resident_self_launch, publish_resident_provider_readiness,
|
||||
resident_cognitive_runtime_id,
|
||||
resident_prepared_launch_thread_id, resident_self_child_claim,
|
||||
resident_self_local_provider_status,
|
||||
retain_completed_runtime_sessions,
|
||||
retain_coordinator_run_receipts, retain_resident_self_lifecycles,
|
||||
retain_coordinator_run_receipts, retain_failed_runtime_worker_attempts,
|
||||
retain_resident_self_lifecycles,
|
||||
settle_resident_self_exited_coordinator,
|
||||
settle_resident_self_receipt_free_dead_coordinator, terminate_process_instance,
|
||||
validate_persona_feedback_store_separation,
|
||||
|
|
@ -88,6 +90,7 @@ fn main() -> Result<()> {
|
|||
args.retained_closed_lifecycles,
|
||||
Utc::now().timestamp_millis().max(0) as u64,
|
||||
)?;
|
||||
retain_runtime_worker_attempts(&args)?;
|
||||
publish_self_readiness(&args)?;
|
||||
println!(
|
||||
"{}",
|
||||
|
|
@ -105,6 +108,7 @@ fn main() -> Result<()> {
|
|||
args.retained_closed_lifecycles,
|
||||
Utc::now().timestamp_millis().max(0) as u64,
|
||||
)?;
|
||||
retain_runtime_worker_attempts(&args)?;
|
||||
publish_self_readiness(&args)?;
|
||||
println!(
|
||||
"{}",
|
||||
|
|
@ -156,6 +160,16 @@ fn retain_runtime_receipts(args: &Args, state: &ResidentSelfState) -> Result<()>
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn retain_runtime_worker_attempts(args: &Args) -> Result<()> {
|
||||
retain_failed_runtime_worker_attempts(
|
||||
&args.policy.runtime_store,
|
||||
args.retained_failed_runtime_worker_attempts,
|
||||
&live_resident_self_typed_request_ids(&args.state_store)?,
|
||||
&Utc::now().to_rfc3339(),
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn runtime_receipt_retention_allowed(has_active_turn: bool, has_prepared_launch: bool) -> bool {
|
||||
!has_active_turn && !has_prepared_launch
|
||||
}
|
||||
|
|
@ -445,6 +459,7 @@ struct Args {
|
|||
retained_closed_lifecycles: usize,
|
||||
retained_coordinator_receipts: usize,
|
||||
retained_completed_runtime_sessions: usize,
|
||||
retained_failed_runtime_worker_attempts: usize,
|
||||
persona_feedback_source_store: PathBuf,
|
||||
persona_feedback_store: PathBuf,
|
||||
bifrost_feedback_trust_anchor: PathBuf,
|
||||
|
|
@ -558,6 +573,12 @@ impl Args {
|
|||
)?
|
||||
.try_into()
|
||||
.context("--retained-completed-runtime-sessions exceeds platform size")?,
|
||||
retained_failed_runtime_worker_attempts: u64v(
|
||||
"--retained-failed-runtime-worker-attempts",
|
||||
256,
|
||||
)?
|
||||
.try_into()
|
||||
.context("--retained-failed-runtime-worker-attempts 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")?,
|
||||
|
|
|
|||
|
|
@ -1006,6 +1006,7 @@ pub use runtime_spine::EpiphanyRuntimeSwarmBinding;
|
|||
pub use runtime_spine::EpiphanyRuntimeToolExecutionBinding;
|
||||
pub use runtime_spine::EpiphanyRuntimeWorkerLaunchRequest;
|
||||
pub use runtime_spine::EpiphanyRuntimeWorkerProcessClaim;
|
||||
pub use runtime_spine::EpiphanyArchivedRuntimeWorkerAttempt;
|
||||
pub use runtime_spine::EpiphanyToolInvocationStatus;
|
||||
pub use runtime_spine::PreparedRuntimeSpineHeartbeatJob;
|
||||
pub use runtime_spine::RUNTIME_EVENT_TYPE;
|
||||
|
|
@ -1029,6 +1030,8 @@ pub use runtime_spine::RUNTIME_WORKER_LAUNCH_REQUEST_SCHEMA_VERSION;
|
|||
pub use runtime_spine::RUNTIME_WORKER_LAUNCH_REQUEST_TYPE;
|
||||
pub use runtime_spine::RUNTIME_WORKER_PROCESS_CLAIM_SCHEMA_VERSION;
|
||||
pub use runtime_spine::RUNTIME_WORKER_PROCESS_CLAIM_TYPE;
|
||||
pub use runtime_spine::ARCHIVED_RUNTIME_WORKER_ATTEMPT_SCHEMA_VERSION;
|
||||
pub use runtime_spine::ARCHIVED_RUNTIME_WORKER_ATTEMPT_TYPE;
|
||||
pub use runtime_spine::RepoFrontierVerdictModelingLaunchAuthority;
|
||||
pub use runtime_spine::RuntimeHandsReceiptChainSummary;
|
||||
pub use runtime_spine::RuntimeSpineEventOptions;
|
||||
|
|
@ -1048,6 +1051,7 @@ pub use runtime_spine::abandon_unactivated_runtime_worker_process;
|
|||
pub use runtime_spine::activate_runtime_worker_process;
|
||||
pub use runtime_spine::archive_completed_coordinator_session;
|
||||
pub use runtime_spine::archive_completed_model_session;
|
||||
pub use runtime_spine::archive_failed_runtime_worker_attempt;
|
||||
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;
|
||||
|
|
@ -1108,6 +1112,7 @@ pub use runtime_spine::replace_or_append_epiphany_job_binding;
|
|||
pub use runtime_spine::require_runtime_tool_execution_binding;
|
||||
pub use runtime_spine::retain_completed_runtime_sessions;
|
||||
pub use runtime_spine::retain_coordinator_run_receipts;
|
||||
pub use runtime_spine::retain_failed_runtime_worker_attempts;
|
||||
pub use runtime_spine::runtime_continuity_recovery_receipt;
|
||||
pub use runtime_spine::runtime_current_repo_model;
|
||||
pub use runtime_spine::runtime_eyes_evidence_packet;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use cultcache_rs::{
|
|||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sha2::{Digest, Sha256};
|
||||
use std::collections::HashSet;
|
||||
use std::collections::{BTreeSet, HashSet};
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
pub const RESIDENT_SELF_STATE_KEY: &str = "resident-self";
|
||||
|
|
@ -1208,6 +1208,24 @@ pub fn resident_self_pressures(path: &Path) -> Result<Vec<ResidentSelfPressure>>
|
|||
Ok(pressure)
|
||||
}
|
||||
|
||||
/// Runtime retention consumes this resident-owned projection as its
|
||||
/// cross-store liveness fence.
|
||||
pub fn live_resident_self_typed_request_ids(path: &Path) -> Result<BTreeSet<String>> {
|
||||
let cache = state_cache(path)?;
|
||||
let mut request_ids = BTreeSet::new();
|
||||
for grant in cache.get_all::<ResidentSelfHeartbeatGrant>()? {
|
||||
if let Some(request) = resident_self_typed_request_ref(&grant)? {
|
||||
let request_id = match request {
|
||||
crate::RuntimeTypedRequestRef::ProposalModeling(id)
|
||||
| crate::RuntimeTypedRequestRef::ImaginationConsideration(id)
|
||||
| crate::RuntimeTypedRequestRef::AdmittedModelDirection(id) => id,
|
||||
};
|
||||
request_ids.insert(request_id.to_string());
|
||||
}
|
||||
}
|
||||
Ok(request_ids)
|
||||
}
|
||||
|
||||
pub fn verify_resident_self_grant_fulfillment(
|
||||
resident_store: &Path,
|
||||
runtime_store: &Path,
|
||||
|
|
|
|||
|
|
@ -168,6 +168,8 @@ pub const ARCHIVED_RUNTIME_SESSION_TYPE: &str = "epiphany.runtime.archived_sessi
|
|||
pub const RUNTIME_WORKER_LAUNCH_REQUEST_TYPE: &str = "epiphany.runtime.worker_launch_request";
|
||||
pub const RUNTIME_WORKER_PROCESS_CLAIM_TYPE: &str =
|
||||
"epiphany.runtime.worker_process_claim.v0";
|
||||
pub const ARCHIVED_RUNTIME_WORKER_ATTEMPT_TYPE: &str =
|
||||
"epiphany.runtime.archived_worker_attempt.v0";
|
||||
pub const RUNTIME_ROLE_WORKER_RESULT_TYPE: &str = "epiphany.runtime.role_worker_result";
|
||||
pub const RUNTIME_REORIENT_WORKER_RESULT_TYPE: &str = "epiphany.runtime.reorient_worker_result";
|
||||
pub const RUNTIME_JOB_RESULT_TYPE: &str = "epiphany.runtime.job_result";
|
||||
|
|
@ -201,6 +203,8 @@ pub const RUNTIME_WORKER_LAUNCH_REQUEST_SCHEMA_VERSION: &str =
|
|||
"epiphany.runtime.worker_launch_request.v1";
|
||||
pub const RUNTIME_WORKER_PROCESS_CLAIM_SCHEMA_VERSION: &str =
|
||||
"epiphany.runtime.worker_process_claim.v0";
|
||||
pub const ARCHIVED_RUNTIME_WORKER_ATTEMPT_SCHEMA_VERSION: &str =
|
||||
"epiphany.runtime.archived_worker_attempt.v0";
|
||||
pub const RUNTIME_ROLE_WORKER_RESULT_SCHEMA_VERSION: &str =
|
||||
"epiphany.runtime.role_worker_result.v3";
|
||||
pub const RUNTIME_REORIENT_WORKER_RESULT_SCHEMA_VERSION: &str =
|
||||
|
|
@ -487,6 +491,25 @@ pub struct EpiphanyRuntimeWorkerProcessClaim {
|
|||
pub terminal_authority_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, DatabaseEntry)]
|
||||
#[cultcache(
|
||||
type = "epiphany.runtime.archived_worker_attempt.v0",
|
||||
schema = "EpiphanyArchivedRuntimeWorkerAttempt"
|
||||
)]
|
||||
pub struct EpiphanyArchivedRuntimeWorkerAttempt {
|
||||
#[cultcache(key = 0)] pub schema_version: String,
|
||||
#[cultcache(key = 1)] pub archive_id: String,
|
||||
#[cultcache(key = 2)] pub job_id: String,
|
||||
#[cultcache(key = 3)] pub request_kind: String,
|
||||
#[cultcache(key = 4)] pub request_id: String,
|
||||
#[cultcache(key = 5)] pub terminal_process_status: String,
|
||||
#[cultcache(key = 6, default)] pub result_id: Option<String>,
|
||||
#[cultcache(key = 7)] pub archived_at: String,
|
||||
#[cultcache(key = 8)] pub retired_type_counts: BTreeMap<String, u64>,
|
||||
#[cultcache(key = 9)] pub retired_envelope_count: u64,
|
||||
#[cultcache(key = 10)] pub retired_chain_digest: String,
|
||||
}
|
||||
|
||||
fn worker_process_claim_id(job_id: &str) -> String {
|
||||
format!("runtime-worker-process-{job_id}")
|
||||
}
|
||||
|
|
@ -1085,6 +1108,7 @@ pub fn runtime_spine_cache(store_path: impl AsRef<Path>) -> Result<CultCache> {
|
|||
cache.register_entry_type::<EpiphanyArchivedRuntimeSession>()?;
|
||||
cache.register_entry_type::<EpiphanyRuntimeWorkerLaunchRequest>()?;
|
||||
cache.register_entry_type::<EpiphanyRuntimeWorkerProcessClaim>()?;
|
||||
cache.register_entry_type::<EpiphanyArchivedRuntimeWorkerAttempt>()?;
|
||||
cache.register_entry_type::<EpiphanyRuntimeRoleWorkerResult>()?;
|
||||
cache.register_entry_type::<crate::EpiphanyMemoryGraphEntry>()?;
|
||||
cache.register_entry_type::<RepoModelAdmissionReview>()?;
|
||||
|
|
@ -10479,6 +10503,140 @@ pub fn runtime_typed_request_attempt_exists(
|
|||
}))
|
||||
}
|
||||
|
||||
pub fn archive_failed_runtime_worker_attempt(
|
||||
store_path: impl AsRef<Path>,
|
||||
job_id: &str,
|
||||
live_resident_request_ids: &BTreeSet<String>,
|
||||
archived_at: &str,
|
||||
) -> Result<EpiphanyArchivedRuntimeWorkerAttempt> {
|
||||
validate_non_empty(job_id, "archived worker attempt job id")?;
|
||||
chrono::DateTime::parse_from_rfc3339(archived_at)
|
||||
.map_err(|error| anyhow!("worker attempt archive timestamp is invalid: {error}"))?;
|
||||
let store_path = store_path.as_ref();
|
||||
let mut cache = runtime_spine_cache(store_path)?;
|
||||
cache.pull_all_backing_stores()?;
|
||||
require_identity(&cache)?;
|
||||
if let Some(existing) = cache.get::<EpiphanyArchivedRuntimeWorkerAttempt>(job_id)? {
|
||||
if existing.schema_version != ARCHIVED_RUNTIME_WORKER_ATTEMPT_SCHEMA_VERSION
|
||||
|| existing.archive_id != job_id
|
||||
|| existing.job_id != job_id
|
||||
|| !existing.retired_chain_digest.starts_with("sha256:")
|
||||
{
|
||||
return Err(anyhow!("archived worker attempt tombstone is invalid"));
|
||||
}
|
||||
if cache.get::<EpiphanyRuntimeWorkerLaunchRequest>(job_id)?.is_some()
|
||||
|| cache.get::<EpiphanyRuntimeWorkerProcessClaim>(&worker_process_claim_id(job_id))?.is_some()
|
||||
|| cache.get::<EpiphanyRuntimeRoleWorkerResult>(job_id)?.is_some()
|
||||
{
|
||||
return Err(anyhow!("archived worker attempt retained live attempt authority"));
|
||||
}
|
||||
return Ok(existing);
|
||||
}
|
||||
let launch = cache.get::<EpiphanyRuntimeWorkerLaunchRequest>(job_id)?
|
||||
.ok_or_else(|| anyhow!("worker attempt archive requires its immutable launch"))?;
|
||||
let typed = [
|
||||
("proposal-modeling", launch.proposal_modeling_request_id.as_deref()),
|
||||
("imagination-consideration", launch.imagination_consideration_request_id.as_deref()),
|
||||
("admitted-model-direction", launch.admitted_model_direction_consideration_request_id.as_deref()),
|
||||
].into_iter().filter_map(|(kind, id)| id.map(|id| (kind, id))).collect::<Vec<_>>();
|
||||
if typed.len() != 1 {
|
||||
return Err(anyhow!("worker attempt archive requires exactly one supported typed request"));
|
||||
}
|
||||
let (request_kind, request_id) = typed[0];
|
||||
if live_resident_request_ids.contains(request_id) {
|
||||
return Err(anyhow!("worker attempt archive refuses resident-live typed request"));
|
||||
}
|
||||
if cache.get::<EpiphanyRuntimeRoleWorkerResult>(job_id)?.is_some() {
|
||||
return Err(anyhow!("failed worker attempt archive refuses terminal fulfillment authority"));
|
||||
}
|
||||
let claim_id = worker_process_claim_id(job_id);
|
||||
let claim = cache.get::<EpiphanyRuntimeWorkerProcessClaim>(&claim_id)?
|
||||
.ok_or_else(|| anyhow!("worker attempt archive requires its process claim"))?;
|
||||
if !matches!(claim.status.as_str(), "terminal-death" | "terminal-unactivated" | "terminal-failure")
|
||||
|| claim.terminal_at.is_none() || claim.terminal_authority_id.is_none()
|
||||
{
|
||||
return Err(anyhow!("failed worker attempt archive requires exact terminal process authority"));
|
||||
}
|
||||
let job = cache.get::<EpiphanyRuntimeJob>(job_id)?
|
||||
.ok_or_else(|| anyhow!("worker attempt archive requires its runtime job"))?;
|
||||
if !matches!(job.status, EpiphanyRuntimeJobStatus::Failed | EpiphanyRuntimeJobStatus::Cancelled) {
|
||||
return Err(anyhow!("failed worker attempt archive requires a failed or cancelled runtime job"));
|
||||
}
|
||||
let snapshot = cache.snapshot_envelopes();
|
||||
let proposal_bindings = cache.get_all::<RepoFrontierProposalModelingLaunchBinding>()?.into_iter()
|
||||
.filter(|item| item.job_id == job_id).map(|item| item.binding_record_id).collect::<BTreeSet<_>>();
|
||||
let imagination_bindings = cache.get_all::<crate::ImaginationConsiderationLaunchBinding>()?.into_iter()
|
||||
.filter(|item| item.job_id == job_id).map(|item| item.binding_record_id).collect::<BTreeSet<_>>();
|
||||
let job_results = cache.get_all::<EpiphanyRuntimeJobResult>()?.into_iter()
|
||||
.filter(|item| item.job_id == job_id).map(|item| item.result_id).collect::<BTreeSet<_>>();
|
||||
let events = cache.get_all::<EpiphanyRuntimeEvent>()?.into_iter()
|
||||
.filter(|item| item.job_id.as_deref() == Some(job_id)).map(|item| item.event_id).collect::<BTreeSet<_>>();
|
||||
let mut deletions = snapshot.iter().filter(|entry| {
|
||||
(entry.r#type == EpiphanyRuntimeWorkerLaunchRequest::TYPE && entry.key == job_id)
|
||||
|| (entry.r#type == EpiphanyRuntimeWorkerProcessClaim::TYPE && entry.key == claim_id)
|
||||
|| (entry.r#type == EpiphanyRuntimeJob::TYPE && entry.key == job_id)
|
||||
|| (entry.r#type == EpiphanyRuntimeJobResult::TYPE && job_results.contains(&entry.key))
|
||||
|| (entry.r#type == EpiphanyRuntimeEvent::TYPE && events.contains(&entry.key))
|
||||
|| (entry.r#type == RepoFrontierProposalModelingLaunchBinding::TYPE && proposal_bindings.contains(&entry.key))
|
||||
|| (entry.r#type == crate::ImaginationConsiderationLaunchBinding::TYPE && imagination_bindings.contains(&entry.key))
|
||||
}).cloned().collect::<Vec<_>>();
|
||||
deletions.sort_by(|a, b| a.r#type.cmp(&b.r#type).then(a.key.cmp(&b.key)));
|
||||
if !deletions.iter().any(|e| e.r#type == EpiphanyRuntimeWorkerLaunchRequest::TYPE && e.key == job_id)
|
||||
|| !deletions.iter().any(|e| e.r#type == EpiphanyRuntimeWorkerProcessClaim::TYPE && e.key == claim_id)
|
||||
|| !deletions.iter().any(|e| e.r#type == EpiphanyRuntimeJob::TYPE && e.key == job_id)
|
||||
{
|
||||
return Err(anyhow!("worker attempt archive lost its exact core family"));
|
||||
}
|
||||
let mut counts = BTreeMap::new();
|
||||
let mut digest = Sha256::new();
|
||||
digest.update(b"epiphany-archived-worker-attempt-root");
|
||||
for entry in &deletions {
|
||||
*counts.entry(entry.r#type.clone()).or_default() += 1;
|
||||
for bytes in [entry.r#type.as_bytes(), entry.key.as_bytes(), entry.payload.as_slice()] {
|
||||
digest.update((bytes.len() as u64).to_le_bytes());
|
||||
digest.update(bytes);
|
||||
}
|
||||
}
|
||||
let tombstone = EpiphanyArchivedRuntimeWorkerAttempt {
|
||||
schema_version: ARCHIVED_RUNTIME_WORKER_ATTEMPT_SCHEMA_VERSION.into(), archive_id: job_id.into(),
|
||||
job_id: job_id.into(), request_kind: request_kind.into(), request_id: request_id.into(),
|
||||
terminal_process_status: claim.status, result_id: None, archived_at: archived_at.into(),
|
||||
retired_type_counts: counts, retired_envelope_count: deletions.len() as u64,
|
||||
retired_chain_digest: format!("sha256:{:x}", digest.finalize()),
|
||||
};
|
||||
let replacement = cache.prepare_entry(job_id, &tombstone)?.0;
|
||||
if !runtime_spine_backing_store(store_path)?.replace_and_delete_if_snapshot_unchanged(
|
||||
&snapshot, vec![replacement], &deletions,
|
||||
)? {
|
||||
return Err(anyhow!("worker attempt archive lost its full snapshot fence"));
|
||||
}
|
||||
Ok(tombstone)
|
||||
}
|
||||
|
||||
pub fn retain_failed_runtime_worker_attempts(
|
||||
store_path: impl AsRef<Path>, retain_recent: usize,
|
||||
live_resident_request_ids: &BTreeSet<String>, archived_at: &str,
|
||||
) -> Result<Vec<EpiphanyArchivedRuntimeWorkerAttempt>> {
|
||||
let store_path = store_path.as_ref();
|
||||
let mut cache = runtime_spine_cache(store_path)?;
|
||||
cache.pull_all_backing_stores()?;
|
||||
require_identity(&cache)?;
|
||||
let launches = cache.get_all::<EpiphanyRuntimeWorkerLaunchRequest>()?.into_iter()
|
||||
.map(|launch| (launch.job_id.clone(), launch)).collect::<BTreeMap<_, _>>();
|
||||
let mut candidates = cache.get_all::<EpiphanyRuntimeWorkerProcessClaim>()?.into_iter()
|
||||
.filter(|claim| matches!(claim.status.as_str(), "terminal-death" | "terminal-unactivated" | "terminal-failure"))
|
||||
.filter_map(|claim| {
|
||||
let launch = launches.get(&claim.job_id)?;
|
||||
let request_id = [launch.proposal_modeling_request_id.as_deref(), launch.imagination_consideration_request_id.as_deref(), launch.admitted_model_direction_consideration_request_id.as_deref()]
|
||||
.into_iter().flatten().next()?;
|
||||
(!live_resident_request_ids.contains(request_id)).then_some(claim)
|
||||
}).collect::<Vec<_>>();
|
||||
candidates.sort_by(|a, b| b.terminal_at.cmp(&a.terminal_at).then(b.job_id.cmp(&a.job_id)));
|
||||
candidates.into_iter().skip(retain_recent.max(1)).map(|claim| {
|
||||
archive_failed_runtime_worker_attempt(store_path, &claim.job_id, live_resident_request_ids, archived_at)
|
||||
}).collect()
|
||||
}
|
||||
|
||||
fn coordinator_completion_event(receipt: &EpiphanyCoordinatorRunReceipt) -> EpiphanyRuntimeEvent {
|
||||
EpiphanyRuntimeEvent {
|
||||
schema_version: RUNTIME_SPINE_SCHEMA_VERSION.to_string(),
|
||||
|
|
@ -19719,4 +19877,39 @@ pub(crate) mod tests {
|
|||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn failed_typed_worker_attempt_archive_refuses_resident_liveness_and_cannot_resurrect() -> Result<()> {
|
||||
let root = tempfile::tempdir()?;
|
||||
let (store, result, _) = proposal_admission_fixture(root.path(), "failed-archive")?;
|
||||
let job_id = result.job_id.clone();
|
||||
let request_id = result.proposal_modeling_request_id.clone().expect("request echo");
|
||||
let process = crate::capture_process_instance(std::process::id())?;
|
||||
let token = "failed-archive-token";
|
||||
claim_runtime_worker_process(&store, &job_id, &process,
|
||||
&format!("{:x}", Sha256::digest(token.as_bytes())), "2026-08-10T20:00:00Z")?;
|
||||
activate_runtime_worker_process(&store, &job_id, &process, token, "2026-08-10T20:00:01Z")?;
|
||||
complete_runtime_job(&store, RuntimeSpineJobResultOptions {
|
||||
result_id: format!("generic-failure-{job_id}"), job_id: job_id.clone(),
|
||||
completed_at: "2026-08-10T20:00:02Z".into(), verdict: "failed".into(),
|
||||
summary: "Typed worker attempt failed.".into(), next_safe_move: "Retry after resident closure.".into(),
|
||||
evidence_refs: Vec::new(), artifact_refs: Vec::new(),
|
||||
})?;
|
||||
let before = std::fs::read(&store)?;
|
||||
assert!(archive_failed_runtime_worker_attempt(&store, &job_id,
|
||||
&BTreeSet::from([request_id.clone()]), "2026-08-10T20:00:03Z").is_err());
|
||||
assert_eq!(std::fs::read(&store)?, before);
|
||||
let tombstone = archive_failed_runtime_worker_attempt(
|
||||
&store, &job_id, &BTreeSet::new(), "2026-08-10T20:00:03Z")?;
|
||||
assert_eq!(tombstone.request_id, request_id);
|
||||
assert_eq!(tombstone.terminal_process_status, "terminal-failure");
|
||||
assert!(tombstone.retired_envelope_count >= 5);
|
||||
assert!(runtime_worker_launch_request(&store, &job_id)?.is_none());
|
||||
assert!(runtime_worker_process_claim(&store, &job_id)?.is_none());
|
||||
assert!(!runtime_typed_request_attempt_exists(
|
||||
&store, RuntimeTypedRequestRef::ProposalModeling(&request_id))?);
|
||||
assert_eq!(archive_failed_runtime_worker_attempt(
|
||||
&store, &job_id, &BTreeSet::new(), "2026-08-10T20:00:03Z")?, tombstone);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3321,6 +3321,26 @@ cannot truthfully be minted under a Windows path and rebound later.
|
|||
|
||||
## Outer worker-attempt retention authority map
|
||||
|
||||
### Implemented failure-family cut
|
||||
|
||||
`resident_self::live_resident_self_typed_request_ids` is the cross-store
|
||||
liveness owner: every surviving typed grant preserves its request. After
|
||||
resident lifecycle compaction, `epiphany-swarm` passes that set to
|
||||
`retain_failed_runtime_worker_attempts`. Runtime spine then retains the newest
|
||||
configured failed attempts and may atomically replace an older exact family
|
||||
with `EpiphanyArchivedRuntimeWorkerAttempt`. The archive accepts only one of
|
||||
the three resident typed request echoes, a failed/cancelled runtime job, and an
|
||||
exact terminal-death, terminal-unactivated, or terminal-failure claim with its
|
||||
terminal authority. It deletes only the matching launch, claim, lane binding,
|
||||
job, generic result, and job events under the full physical snapshot fence.
|
||||
The request and all unrelated envelopes remain live.
|
||||
|
||||
This cut deliberately refuses `terminal-result`: successful result/binding
|
||||
authority still answers `runtime_typed_request_fulfillment`, so deleting it
|
||||
without a fulfillment-capable tombstone would create false Pending state. That
|
||||
reader migration, stale-CAS proof, and all-lane production retention proof are
|
||||
the next cut.
|
||||
|
||||
- Owner: runtime spine owns archival of one immutable outer worker attempt.
|
||||
Resident Self supplies cross-store liveness but cannot delete runtime rows.
|
||||
- Inputs: exact typed request identity; worker launch; lane-specific launch
|
||||
|
|
|
|||
|
|
@ -2659,3 +2659,15 @@ consult tombstones before treating missing claims/results as live or pending.
|
|||
Next implement the archive and hostile/non-resurrection tests before packaging.
|
||||
Direct packaged proposal Modeling construction remains a later Linux-native
|
||||
evidence task. Actual c006 stays braked.
|
||||
## Failed outer-worker attempt retention cut in source — 2026-08-10
|
||||
|
||||
Runtime spine now owns `EpiphanyArchivedRuntimeWorkerAttempt` for failed or
|
||||
cancelled typed attempts. Resident Self projects every typed request still
|
||||
named by a durable grant; serve/once compacts resident lifecycles first, then
|
||||
passes that surviving set into runtime retention. The runtime refuses a live
|
||||
request byte-identically and otherwise replaces the exact launch, terminal
|
||||
claim, lane binding, terminal job/result/events with one snapshot-fenced
|
||||
tombstone. A focused proposal-Modeling test proves refusal, retirement,
|
||||
idempotence, and that deletion cannot recreate retry suppression. Successful
|
||||
attempt retirement remains open because its tombstone must preserve the same
|
||||
authenticated fulfillment answer currently owned by the result/binding chain.
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -70,7 +70,7 @@ current_status:
|
|||
yggdrasil_epiphany_service_contract: repaired_in_gamecult_ops_812b427_not_installed
|
||||
resident_physiology: c006_exact_c693aaea_settled_braked_no_active_lease_no_attempt_three_old_processes_stopped
|
||||
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, published model-turn JSON ingress, semantic logical/physical retention, Persona conversation retention, stable Starfire firewall ownership, completed model-adapter session archival, normal coordinator lifecycle opening/error closure/legacy repair/archival, packaged admitted-model-direction and Imagination fulfilled-before-receipt settlement, and packaged co-resident resident lifecycle retention are accepted live. Proposal Modeling fulfilled-before-receipt plus runtime retention of terminal worker attempts remain open. Historical migrated semantic attempts without recorded physical namespace remain durable and non-retirable. Repository Body observation still performs two authenticated full-tree Git index/manifest passes. Execute-mode workers require a persistent process body. Mutable Starfire bind storage still needs the packaged randomized interruption/read-loop proof before recovered c005 authority may be trusted. One completed Discord consequence remains blocked by the absent Yggdrasil credential.
|
||||
next_action: Implement a typed runtime worker-attempt archive owned by runtime spine: require exact terminal claim and immutable attempt family plus explicit absence of resident cross-store authority, atomically replace that family with a per-attempt tombstone, and make retry/fulfillment readers treat the tombstone as terminal evidence so deletion cannot revive a launch or erase settled fulfillment. Prove stale-CAS refusal and all three typed lanes before packaging. Keep actual c006 braked. Yggdrasil never builds.
|
||||
next_action: Complete typed runtime worker-attempt retention. The source cut now archives failed/cancelled proposal-Modeling, Imagination, and admitted-model-direction attempts only after resident Self's surviving grants prove no cross-store liveness; one full-snapshot CAS replaces launch, terminal claim, lane binding, job/result/event family with a per-attempt tombstone, and replay cannot resurrect retry suppression. Next make successful tombstones answer authenticated fulfillment without retaining live result/binding authority, add stale-CAS and production enumeration tests across all three lanes, then package and prove copied-state retention. Keep actual c006 braked. Yggdrasil never builds.
|
||||
|
||||
active_subgoals:
|
||||
- Prove Persona, Self, Eyes, Modeling, Imagination, Hands, Soul, Mind, Continuity, and nervous-system behavior individually.
|
||||
|
|
|
|||
Reference in a new issue