Bind Heartbeat braking to cognition

This commit is contained in:
Meta Vens 2026-08-10 11:27:21 +01:00
commit 8d92c8266b
5 changed files with 84 additions and 18 deletions

View file

@ -24,6 +24,7 @@ use epiphany_core::pulse_resident_self_heartbeat;
use epiphany_core::pump_heartbeat_store;
use epiphany_core::queue_heartbeat_pending_mention_store;
use epiphany_core::recover_stale_heartbeat_store;
use epiphany_core::resident_cognitive_runtime_id;
use epiphany_core::retain_heartbeat_pulse_artifacts;
use epiphany_core::run_void_routine_store;
use epiphany_core::tick_heartbeat_store;
@ -68,6 +69,7 @@ fn main() -> Result<()> {
let mut limit = 8_usize;
let mut agent_store: Option<PathBuf> = None;
let mut resident_self_store: Option<PathBuf> = None;
let mut resident_runtime_store: Option<PathBuf> = None;
let mut apply_rumination = false;
let mut profile = "epiphany".to_string();
let mut scene_id = "ghostlight.scene".to_string();
@ -146,6 +148,9 @@ fn main() -> Result<()> {
"--resident-self-store" => {
resident_self_store = Some(next_path(&mut args, "--resident-self-store")?)
}
"--resident-runtime-store" => {
resident_runtime_store = Some(next_path(&mut args, "--resident-runtime-store")?)
}
"--apply-rumination" => apply_rumination = true,
"--profile" => profile = next_value(&mut args, "--profile")?,
"--scene-id" => scene_id = next_value(&mut args, "--scene-id")?,
@ -521,6 +526,11 @@ fn main() -> Result<()> {
} else {
None
};
let brake_runtime_id = heartbeat_brake_runtime_id(
&resident_self_store,
&resident_runtime_store,
release_runtime_id.as_deref(),
)?;
if let Some(agent_store) = &agent_store {
let errors = validate_agent_memory_store(agent_store)?;
if !errors.is_empty() {
@ -572,13 +582,7 @@ fn main() -> Result<()> {
)?;
}
let iteration_dir = artifact_dir.join(format!("pulse-{iteration:06}"));
let brake = active_swarm_brake(
&local_verse_store,
provider_release
.as_ref()
.map(|release| release.runtime_id.as_str())
.or(release_runtime_id.as_deref()),
)?;
let brake = active_swarm_brake(&local_verse_store, brake_runtime_id.as_deref())?;
if let Some(resident_store) = resident_self_store.as_deref() {
let pulse = pulse_resident_self_heartbeat(
&store_path,
@ -817,7 +821,7 @@ fn usage() -> Result<()> {
" epiphany-heartbeat-store queue-mention --store <path> [options]\n",
" epiphany-heartbeat-store status --store <path> [--artifact-dir <path>]\n",
" epiphany-heartbeat-store routine --store <path> --artifact-dir <path> [options]\n",
" epiphany-heartbeat-store serve --store <path> --artifact-dir <path> [--local-verse-store <path>] [--agent-store <path>] [--source <source>] [--no-dream] [--interval-seconds <n>] [--max-iterations <n>]\n",
" epiphany-heartbeat-store serve --store <path> --artifact-dir <path> [--local-verse-store <path>] [--resident-self-store <path> --resident-runtime-store <path>] [--agent-store <path>] [--source <source>] [--no-dream] [--interval-seconds <n>] [--max-iterations <n>]\n",
" epiphany-heartbeat-store smoke [--agent-store <path>]"
)))
}
@ -839,6 +843,20 @@ fn assert_swarm_brake_allows_heartbeat(
Ok(())
}
fn heartbeat_brake_runtime_id(
resident_self_store: &Option<PathBuf>,
resident_runtime_store: &Option<PathBuf>,
release_runtime_id: Option<&str>,
) -> Result<Option<String>> {
if resident_self_store.is_some() {
let runtime_store = resident_runtime_store
.as_deref()
.ok_or_else(|| anyhow!("resident heartbeat serve requires --resident-runtime-store"))?;
return Ok(Some(resident_cognitive_runtime_id(runtime_store)?));
}
Ok(release_runtime_id.map(str::to_string))
}
fn active_swarm_brake(
local_verse_store: &Option<PathBuf>,
runtime_id: Option<&str>,
@ -849,9 +867,8 @@ fn active_swarm_brake(
if !local_verse_store.exists() {
return Ok(None);
}
let runtime_id = runtime_id.ok_or_else(|| {
anyhow!("heartbeat local Verse brake lookup requires --release-runtime-id")
})?;
let runtime_id = runtime_id
.ok_or_else(|| anyhow!("heartbeat local Verse brake lookup requires runtime identity"))?;
Ok(
load_epiphany_cultmesh_swarm_brake(local_verse_store, runtime_id)?
.filter(|brake| brake.status == "engaged"),
@ -863,7 +880,7 @@ mod brake_tests {
use super::*;
#[test]
fn heartbeat_uses_exact_release_runtime_brake_namespace() -> Result<()> {
fn heartbeat_brake_lookup_uses_the_exact_requested_namespace() -> Result<()> {
let temp = tempfile::tempdir()?;
let store = temp.path().join("verse.cc");
let store_arg = Some(store.clone());
@ -883,6 +900,27 @@ mod brake_tests {
Ok(())
}
#[test]
fn resident_heartbeat_uses_mounted_cognitive_runtime_for_braking() -> Result<()> {
let temp = tempfile::tempdir()?;
let runtime_store = temp.path().join("runtime.cc");
epiphany_core::initialize_runtime_spine(
&runtime_store,
epiphany_core::RuntimeSpineInitOptions {
runtime_id: "cognitive-runtime".into(),
display_name: "Cognitive runtime".into(),
created_at: "2026-08-10T00:00:00Z".into(),
},
)?;
let selected = heartbeat_brake_runtime_id(
&Some(temp.path().join("resident.cc")),
&Some(runtime_store),
Some("deployment-runtime"),
)?;
assert_eq!(selected.as_deref(), Some("cognitive-runtime"));
Ok(())
}
#[test]
fn retention_receipt_projection_names_operator_fields() {
let projection = retention_receipt_projection(&EpiphanyHeartbeatArtifactRetentionReceipt {

View file

@ -1320,9 +1320,10 @@ The live identity matrix is explicit:
- mounted runtime-store identity owns coordinator execution, request identity,
runtime mutation, and the coordinator's `--runtime-id`;
- mounted runtime-store identity also owns the local-Verse brake namespace for
resident Self and its coordinator child. `NativePorts` resolves that identity
once from the immutable runtime envelope; release/provider identity cannot
choose a second kill switch merely because it authenticated the binary;
Heartbeat scheduling, resident Self, and its coordinator child. Each resident
process resolves that identity from the immutable runtime envelope;
release/provider identity cannot choose a second kill switch merely because
it authenticated the binary;
- cognition readiness projects mounted cognition as `runtimeId`, authenticated
binary provenance separately as `releaseRuntimeId`, and reads the brake only
under mounted cognition. Operator sight and resident actuation therefore

View file

@ -1,5 +1,32 @@
# Fresh workspace handoff
## c006 recovery exposed Heartbeat identity and legacy-session residue — 2026-08-10
Exact `9bf985fc4ab5a7f75de26493ed6e122524c71775` packaged in 6m46s as
24-binary release `sha256-eedde4e6257dbf9ad700ad6a8793599504ae4b7bbf86147ced1275fa8596e9d3`
with witness `sha256-828949cd0a4ad865c5a43e68079f9b8db36d63b992a72d6f191b6c18bd241b73`.
Inspection passed and no warnings were emitted.
c006 first refused before cognition because the copied runtime retained one
legacy active session ID reused across 24 unbound starts and 22 receipts. A
proposed latest-timestamp repair was rejected: timestamps cannot bind a receipt
to an incarnation. The exact pre-intervention runtime
`sha256-8aace759c246bd45b86c32cf0f15ce518eab12e2b2aa91f57a8dc764f5d08c84`
is preserved under
`.epiphany-run/interventions/c006-ambiguous-legacy-receipts/`. The stopped-volume
intervention removed the entire unbound session/start/receipt family under a
full-snapshot fence; exact packaged runtime parsing passed and no remaining
envelope references the legacy session. External typed receipt
`quarantine-receipt.json` records the cut. No guessed completion was created.
c006 then started sleeping and stopped by SIGTERM with exit 0, but no Heartbeat
pulse was allowed: Heartbeat serve still selected the release runtime for its
brake. Current source requires `--resident-runtime-store`, resolves mounted
cognition for scheduling brake lookup, and retains release identity solely for
provider/binary authentication. Four Heartbeat binary tests pass, including a
deliberate deployment/cognitive identity split. Commit and package this final
identity cut before pulsing c006.
## Cognitive brake identity cut — 2026-08-10
Exact crash-atomic source `0e8cd91af1dae0b48c59a6c0985075279ee58a6b`

Binary file not shown.

View file

@ -36,9 +36,9 @@ invariants:
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, exact eea15e82 model-turn JSON ingress, exact b1e8c89a semantic unattempted-generation retention, exact 6bc3ec3f semantic physical-epoch retirement, and exact 44230a05 Persona conversation retention are proven. Gamecult-ops 059821f owns Yggdrasil stream retention and exact 6ee08a4 owns stable Starfire Persona-permit firewall ingress. Exact 16c4b19f genuine idle and exact a987d2f7 active cognition completed 900-pulse bounded plateaus. Runtime-owned typed fulfillment is accepted live under exact 6dd9b132. Yggdrasil is the small public crossing body, never the release forge.
latest_phase: Exact 0e8cd91a packages crash-atomic CultCache e8a9f2d as warning-free 24-binary release sha256-ff906f38 with witness sha256-ea099731; independent inspection passed. Recovery preflight then refused deployment because release/provider and mounted cognitive runtime identities still selected different brake namespaces. Current source makes NativePorts resolve mounted cognition once for actuation; readiness projects mounted cognition as runtimeId, authenticated binary provenance separately as releaseRuntimeId, and reads the same cognitive brake. Thirteen readiness tests and all nine swarm-binary tests pass with explicit deployment-runtime versus cognitive-runtime proofs. Recovery state is staged but inert in named volume epiphany-resident-c006-state from the authenticated c005-descended sleeping revision-6 snapshot; it retains two terminal historical grants and one typed pending model-direction pressure, and excludes the zero file. Commit and exact packaging of the identity correction remain open.
latest_phase: Exact 9bf985fc packages crash-atomic storage plus resident/readiness cognitive identity as warning-free 24-binary release sha256-eedde4e6 with witness sha256-828949cd. c006 recovery refused an unbound legacy family that reused one active session across 24 starts and 22 receipts. Timestamp inference was rejected as unsound; the whole family was quarantined under a full-snapshot fence with exact pre-state and typed external receipt preserved. c006 then ran sleeping and stopped SIGTERM exit 0. No pulse was allowed because packaged Heartbeat still selected release identity for its brake. Current source requires resident-runtime-store and resolves mounted cognition for the scheduling brake; four Heartbeat tests pass with deliberate differing identities. The named volume retains two terminal historical grants and one typed pending model-direction pressure without the zero file. Commit and package the Heartbeat cut before waking scheduling.
operational_state:
local_worktree: cognitive_brake_identity_cut_source_verified_pending_commit
local_worktree: heartbeat_cognitive_brake_cut_source_verified_pending_commit
operator_wireguard: restored
starfire_persona_permit_firewall: persistent_exact_gamecult_ops_6ee08a4
yggdrasil: canonical_small_public_crossing_body
@ -70,7 +70,7 @@ current_status:
yggdrasil_epiphany_service_contract: repaired_in_gamecult_ops_812b427_not_installed
resident_physiology: c005_exited_255_and_sealed_as_corruption_evidence
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, and normal coordinator lifecycle opening/error closure/legacy repair/archival are accepted live. Receipt-free hard-death recovery is source- and package-accepted but its live kill matrix remains unproven because the first copied run exposed non-atomic storage publication. A typed worker launch without valid terminal fulfillment deliberately remains active awaiting an owner for exact orphan-worker death and supersession; it is not retryable yet. 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 is not accepted as resident authority until the packaged CultCache repair and recovery replay pass. One completed Discord consequence remains blocked by the absent Yggdrasil credential.
next_action: Integrate bounded Modeling review of the cognitive brake identity cut, commit and push it, then package once from the persistent Starfire cache. Start c006 only from that exact release against staged named-volume authority. Require Heartbeat to consume the historical terminal acknowledgement without reissuing either old grant, issue one new grant for the sole pending typed pressure, complete it once, and pass SIGTERM/restart plus parseable-store checks. Then resume copied receipt-free death and orphan-worker Continuity. Yggdrasil never builds.
next_action: Commit and push the Heartbeat cognitive-brake cut, package once with the persistent Starfire cache, and publish it into c006. Start exact resident Self plus Heartbeat with the mounted runtime store. Require Heartbeat to consume the historical terminal acknowledgement without reissuing either old grant, issue one new grant for the sole pending typed pressure, complete it once, and pass SIGTERM/restart plus parseable-store checks. Then resume copied receipt-free death and orphan-worker Continuity. Yggdrasil never builds.
active_subgoals:
- Prove Persona, Self, Eyes, Modeling, Imagination, Hands, Soul, Mind, Continuity, and nervous-system behavior individually.