Return failed resident pressure to heartbeat
This commit is contained in:
parent
b81092b20a
commit
c5f99c4635
5 changed files with 123 additions and 18 deletions
|
|
@ -1413,6 +1413,16 @@ pub fn cancel_resident_self_turn(
|
|||
let grant = cache
|
||||
.get::<ResidentSelfHeartbeatGrant>(&lease.grant_id)?
|
||||
.ok_or_else(|| anyhow!("resident Self cancellation grant missing"))?;
|
||||
let mut pressure = cache
|
||||
.get::<ResidentSelfPressure>(&grant.pressure_id)?
|
||||
.ok_or_else(|| anyhow!("resident Self cancellation pressure missing"))?;
|
||||
if pressure.status != "consumed"
|
||||
|| pressure.consumed_by_grant_id.as_deref() != Some(&grant.grant_id)
|
||||
{
|
||||
return Err(anyhow!(
|
||||
"resident Self cancellation pressure authority changed"
|
||||
));
|
||||
}
|
||||
let ack = ResidentSelfTerminalAck {
|
||||
schema_version: RESIDENT_SELF_ACK_SCHEMA_VERSION.into(),
|
||||
ack_id: format!("resident-self-cancel-{}-{status}", lease.grant_id),
|
||||
|
|
@ -1426,22 +1436,35 @@ pub fn cancel_resident_self_turn(
|
|||
consumed_by_heartbeat_at_millis: None,
|
||||
private_state_exposed: false,
|
||||
};
|
||||
let expected = cache
|
||||
.snapshot_envelopes()
|
||||
.into_iter()
|
||||
let envelopes = cache.snapshot_envelopes();
|
||||
let expected_state = envelopes
|
||||
.iter()
|
||||
.find(|entry| {
|
||||
entry.r#type == <ResidentSelfState as DatabaseEntry>::TYPE
|
||||
&& entry.key == RESIDENT_SELF_STATE_KEY
|
||||
})
|
||||
.cloned()
|
||||
.ok_or_else(|| anyhow!("resident Self cancellation state envelope missing"))?;
|
||||
let expected_pressure = envelopes
|
||||
.iter()
|
||||
.find(|entry| {
|
||||
entry.r#type == <ResidentSelfPressure as DatabaseEntry>::TYPE
|
||||
&& entry.key == pressure.pressure_id
|
||||
})
|
||||
.cloned()
|
||||
.ok_or_else(|| anyhow!("resident Self cancellation pressure envelope missing"))?;
|
||||
state.active_turn = None;
|
||||
state.revision += 1;
|
||||
state.consecutive_failures += u64::from(status != "brake-cancelled");
|
||||
pressure.status = "pending".into();
|
||||
pressure.consumed_by_grant_id = None;
|
||||
let (state_entry, _) = cache.prepare_entry(RESIDENT_SELF_STATE_KEY, &state)?;
|
||||
let (pressure_entry, _) = cache.prepare_entry(&pressure.pressure_id, &pressure)?;
|
||||
let (ack_entry, _) = cache.prepare_entry(&ack.ack_id, &ack)?;
|
||||
if !SingleFileMessagePackBackingStore::new(path)
|
||||
.compare_and_swap_batch(&[expected], vec![state_entry, ack_entry])?
|
||||
{
|
||||
if !SingleFileMessagePackBackingStore::new(path).compare_and_swap_batch(
|
||||
&[expected_state, expected_pressure],
|
||||
vec![state_entry, pressure_entry, ack_entry],
|
||||
)? {
|
||||
return Err(anyhow!("resident Self lost cancellation CAS"));
|
||||
}
|
||||
Ok(ack)
|
||||
|
|
@ -1878,6 +1901,62 @@ mod tests {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn failed_resident_turn_atomically_returns_exact_pressure_to_heartbeat() -> Result<()> {
|
||||
let temp = tempfile::tempdir()?;
|
||||
let store = temp.path().join("resident-self.cc");
|
||||
let coordinator = temp.path().join("epiphany-mvp-coordinator");
|
||||
std::fs::write(&coordinator, b"witnessed executable")?;
|
||||
let mut policy = policy();
|
||||
policy.coordinator_bin = coordinator.clone();
|
||||
enqueue_resident_self_pressure(
|
||||
&store,
|
||||
&ResidentSelfPressure {
|
||||
schema_version: RESIDENT_SELF_PRESSURE_SCHEMA_VERSION.into(),
|
||||
pressure_id: "pressure-retry-1".into(),
|
||||
kind: "admitted-model-direction-consideration".into(),
|
||||
provenance_ref:
|
||||
"cultcache://admitted-model-direction-consideration/request-retry-1".into(),
|
||||
objective: "Launch exact typed model direction request.".into(),
|
||||
created_at_millis: 1,
|
||||
status: "pending".into(),
|
||||
consumed_by_grant_id: None,
|
||||
private_state_exposed: false,
|
||||
},
|
||||
)?;
|
||||
let first_grant =
|
||||
heartbeat_issue_resident_self_grant(&store, "heartbeat-1", "action-1", 2)?
|
||||
.expect("first grant");
|
||||
let prepared = prepare_resident_self_launch(&store, &policy, 3)?.expect("preparation");
|
||||
let process = LaunchedCoordinator {
|
||||
process_id: 44,
|
||||
process_creation_token: 55,
|
||||
process_executable_path: coordinator,
|
||||
};
|
||||
claim_resident_self_preparation_as_child(&store, &prepared.preparation_id, &process, 4)?;
|
||||
let lease =
|
||||
acknowledge_resident_self_launch(&store, &prepared.preparation_id, &process, 5)?;
|
||||
let ack = cancel_resident_self_turn(
|
||||
&store,
|
||||
&lease,
|
||||
"process-failed",
|
||||
"coordinator rejected its startup configuration",
|
||||
6,
|
||||
)?;
|
||||
assert_eq!(ack.grant_id, first_grant.grant_id);
|
||||
let pressure = state_cache(&store)?
|
||||
.get::<ResidentSelfPressure>("pressure-retry-1")?
|
||||
.expect("requeued pressure");
|
||||
assert_eq!(pressure.status, "pending");
|
||||
assert_eq!(pressure.consumed_by_grant_id, None);
|
||||
let retry_grant =
|
||||
heartbeat_issue_resident_self_grant(&store, "heartbeat-2", "action-2", 7)?
|
||||
.expect("retry grant");
|
||||
assert_eq!(retry_grant.pressure_id, first_grant.pressure_id);
|
||||
assert_ne!(retry_grant.grant_id, first_grant.grant_id);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn autonomous_frontier_pressure_launches_exact_modeling_selection_without_objective()
|
||||
-> Result<()> {
|
||||
|
|
|
|||
|
|
@ -1242,6 +1242,15 @@ admitted-model direction, autonomous proposal Modeling, and Imagination
|
|||
consideration pressure. Verification replays after timestamp change and after
|
||||
heartbeat consumption, and retains a hostile changed-objective collision.
|
||||
|
||||
Resident cancellation owns retry admission for a failed bounded coordinator
|
||||
turn. In the same CAS that clears the exact active lease and writes its typed
|
||||
terminal acknowledgement, cancellation verifies the grant still owns the
|
||||
source pressure and returns that pressure from `consumed` to `pending`. It does
|
||||
not mint the retry grant. The standard heartbeat remains the sole scheduler and
|
||||
may issue a new grant with a new identity for the same exact pressure after it
|
||||
has reconciled the terminal turn. A failed launch can therefore recover without
|
||||
operator pressure duplication or an authority-bypassing coordinator call.
|
||||
|
||||
## Exact release build cache ownership
|
||||
|
||||
Release construction has two serialized cache authorities. The graph cache is
|
||||
|
|
|
|||
|
|
@ -23,24 +23,41 @@ failed before launch because replay recreated the same producer pressure ID
|
|||
with a later `created_at_millis`; full document equality misclassified that
|
||||
ordinary replay as an identity collision.
|
||||
|
||||
The current worktree repairs ownership in `resident_self.rs`: producer replay
|
||||
Pushed commit `b81092b2` repairs ownership in `resident_self.rs`: producer replay
|
||||
compares immutable producer identity, while timestamp and pressure lifecycle
|
||||
remain derived/mutable. Changed objective, provenance, kind, schema, identity,
|
||||
or privacy authority still collide. All 15 resident-Self tests pass, and the
|
||||
autonomous promotion integration proves ingestion after heartbeat consumption
|
||||
returns zero without recreating work.
|
||||
|
||||
Exact `b81092b2` packages as
|
||||
`sha256-da343dcfe478720320f94c582eebcef2804aac41ac136a9c6a504cd248f495fa`
|
||||
with witness
|
||||
`sha256-41f081ce260467325a759bf6c888b30cf7d57faff1b1fdcfab398191323cf333`.
|
||||
The authenticated replay clone `live-20260808-v32-replay` crossed the original
|
||||
collision and launched the resident coordinator. The child correctly refused
|
||||
an operator-supplied artifact root outside `.epiphany-dogfood`. Its typed
|
||||
cancellation then exposed a second continuity wound: the source pressure stayed
|
||||
`consumed`, so heartbeat could never grant an exact retry.
|
||||
|
||||
The current worktree makes cancellation atomically return the exact pressure to
|
||||
`pending` while writing the failed terminal acknowledgement. Heartbeat remains
|
||||
the sole retry scheduler and issues a new grant identity. All 16 resident-Self
|
||||
tests pass, including exact failed-turn pressure recovery.
|
||||
|
||||
## Next action
|
||||
|
||||
1. Commit and push the resident-pressure replay repair.
|
||||
2. Package and independently authenticate the exact commit through the stable
|
||||
caches; preserve v31 as failure evidence and publish into fresh v32.
|
||||
3. Re-run pressure ingestion twice, heartbeat selection, and resident launch.
|
||||
1. Commit, push, package, and authenticate the failed-turn retry repair.
|
||||
2. Preserve v31 and v32-replay as failure evidence; clone the recovered boundary
|
||||
into a new replay runtime using an approved `.epiphany-dogfood` artifact root.
|
||||
3. Re-run heartbeat selection and resident launch, including exact retry after
|
||||
one deliberate failed launch.
|
||||
4. In a fresh runtime, re-run pressure ingestion twice and resident launch.
|
||||
Prove autonomous direction consideration, proposal-bound Modeling,
|
||||
canonical Imagination, dedicated Mind adoption, and exact Hands authority.
|
||||
4. Deliberately fail one bounded worker and prove typed terminalization,
|
||||
5. Deliberately fail one bounded worker and prove typed terminalization,
|
||||
restart/recovery, Reorientation, and Soul-verifiable closure.
|
||||
5. Continue through Persona consequence, retention, endurance/resource
|
||||
6. Continue through Persona consequence, retention, endurance/resource
|
||||
plateau, and Linux/Yggdrasil cognition.
|
||||
|
||||
Do not execute v31's direct Hands gate, read raw worker transcripts, mutate
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -34,15 +34,15 @@ 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 15a740f2 packages 21 independently authenticated binaries as sha256-c3dbcc6bc2f4dced43253e517415548cf87d1a131b4bf3441d07fec89e444ccd with witness sha256-42ed5d0bfb652520290c868a0dfd13271a1743adf53c1ed7fa95d0117fff509d. Stable graph and exact-source caches reduce a documentation/state-only successor package to 1.24 seconds. Fresh v31 proved initial and proposal-bound Modeling, then exposed a resident-Self replay defect before autonomous Imagination launch: producer pressure identity incorrectly included mutable timestamp and lifecycle state. The current worktree repairs replay identity and passes all 15 resident-Self tests plus the autonomous promotion integration. Exact packaging and a fresh v32 live replay remain required before resuming the implementation chain. Persona consequence, retention, endurance, and Linux/Yggdrasil cognition remain open.
|
||||
summary: Epiphany is a supervised engineering alpha on Starfire, not deployment-ready. Exact b81092b2 packages 21 independently authenticated binaries as sha256-da343dcfe478720320f94c582eebcef2804aac41ac136a9c6a504cd248f495fa with witness sha256-41f081ce260467325a759bf6c888b30cf7d57faff1b1fdcfab398191323cf333. Stable graph and exact-source caches reduced this core successor to a 6m59s release build; core fan-out remains materially slower than state-only packaging. v32-replay proved the producer-replay repair live by crossing the original collision and launching the coordinator. A deliberate bad artifact root then exposed that failed-turn cancellation left its source pressure permanently consumed. The current worktree atomically returns cancelled pressure to heartbeat scheduling and passes all 16 resident-Self tests. Exact packaging and live retry remain required before resuming the implementation chain. Persona consequence, retention, endurance, and Linux/Yggdrasil cognition remain open.
|
||||
operational_state:
|
||||
local_worktree: resident_pressure_replay_repair_verified_pending_commit
|
||||
local_worktree: failed_resident_turn_retry_repair_verified_pending_commit
|
||||
operator_wireguard: restored
|
||||
yggdrasil: canonical_small_public_crossing_body
|
||||
starfire: temporary_epiphany_cognition_body
|
||||
starfire_runtime_identity: epiphany-starfire
|
||||
starfire_swarm_brake: released
|
||||
starfire_release: authenticated_15a740f2_v31_release; replay_repair_successor_pending
|
||||
starfire_release: authenticated_b81092b2_replay_repair; cancellation_retry_successor_pending
|
||||
starfire_repository_body: bound_and_observed
|
||||
starfire_verse_topology: bound_to_current_repository_body
|
||||
starfire_native_status: supervised_shakedown_active
|
||||
|
|
@ -52,8 +52,8 @@ current_status:
|
|||
bifrost_feedback_crossing: authenticated_transport_only
|
||||
yggdrasil_epiphany_services: absent
|
||||
resident_physiology: heartbeat_and_self_running
|
||||
unresolved_authority: v31's generic user proposal produced a lawful direct Hands gate, but the active objective requires the autonomous Imagination-origin path and dedicated Mind adoption, so that gate remains inert. Resident ingestion committed the correct admitted-model direction request and heartbeat selected its pressure, but the next resident cycle failed because replay compared a newly observed timestamp and mutable lifecycle as producer identity. The repair is locally verified but not yet packaged or proven live. Canonical Imagination, dedicated Mind adoption, exact Hands binding, deliberate worker failure/restart/closure, Persona consequence, retention, endurance, and Linux/Yggdrasil cognition remain open.
|
||||
next_action: Commit and package the resident-pressure replay repair, preserve v31 as failure evidence, and prove repeated ingestion plus heartbeat-to-resident launch in fresh v32. Then continue the autonomous Imagination-to-Modeling-to-Mind-to-Hands chain and deliberate failure/restart/Soul closure.
|
||||
unresolved_authority: v31's generic user proposal produced a lawful direct Hands gate, but the active objective requires the autonomous Imagination-origin path and dedicated Mind adoption, so that gate remains inert. v32-replay proved identical producer replay no longer collides and resident Self launches from the heartbeat grant. The deliberately invalid artifact root produced a typed failed lease and exposed that cancellation did not return the exact source pressure to heartbeat. The retry repair is locally verified but not yet packaged or proven live. Canonical Imagination, dedicated Mind adoption, exact Hands binding, deliberate worker failure/restart/closure, Persona consequence, retention, endurance, and Linux/Yggdrasil cognition remain open.
|
||||
next_action: Commit and package the failed-turn pressure retry repair, preserve v31/v32-replay as failure evidence, and prove heartbeat issues a new exact retry grant into an approved dogfood artifact root. Then continue the autonomous Imagination-to-Modeling-to-Mind-to-Hands chain and deliberate failure/restart/Soul closure.
|
||||
|
||||
active_subgoals:
|
||||
- Prove Persona, Self, Eyes, Modeling, Imagination, Hands, Soul, Mind, Continuity, and nervous-system behavior individually.
|
||||
|
|
|
|||
Reference in a new issue