From 22b343202faa169a2d01802ddc013ef7c623ed7c Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 13 Jul 2026 17:03:35 +0100 Subject: [PATCH] Separate heartbeat state and scheduler status --- .../src/bin/epiphany-heartbeat-store.rs | 5 +++++ .../heartbeat_state/heartbeat_projection.rs | 17 ++++++++++++++++- ...onceptual-substitution-audit-2026-07-12.md | 15 +++++++++++++++ notes/fresh-workspace-handoff.md | 8 ++++++++ state/ledgers.msgpack | Bin 480610 -> 480980 bytes state/map.yaml | 2 +- 6 files changed, 45 insertions(+), 2 deletions(-) diff --git a/epiphany-core/src/bin/epiphany-heartbeat-store.rs b/epiphany-core/src/bin/epiphany-heartbeat-store.rs index aa348e0f..f46b420f 100644 --- a/epiphany-core/src/bin/epiphany-heartbeat-store.rs +++ b/epiphany-core/src/bin/epiphany-heartbeat-store.rs @@ -699,6 +699,11 @@ fn run_smoke(agent_store: &Path) -> Result { let validation_errors = validate_agent_memory_store(&temp_agent_store)?; let status = heartbeat_status_projection(&store_path, &artifact_dir, 1.0, 8)?; + if status["status"] != "loaded" || status["schedulerStatus"] != "active" { + anyhow::bail!( + "heartbeat status must distinguish loaded state from active scheduler physiology" + ); + } let routine = run_void_routine_store( &store_path, &artifact_dir, diff --git a/epiphany-core/src/heartbeat_state/heartbeat_projection.rs b/epiphany-core/src/heartbeat_state/heartbeat_projection.rs index 318e9e23..d648780a 100644 --- a/epiphany-core/src/heartbeat_state/heartbeat_projection.rs +++ b/epiphany-core/src/heartbeat_state/heartbeat_projection.rs @@ -34,6 +34,7 @@ pub fn heartbeat_status_projection( "schema_version": HEARTBEAT_STATUS_SCHEMA_VERSION, "ok": true, "status": "missing", + "schedulerStatus": "missing", "stateFile": null, "storeFile": store_path, "cultCacheStore": cultcache_status(store_path), @@ -48,6 +49,19 @@ pub fn heartbeat_status_projection( })); }; let cognition = load_heartbeat_cognition_entry(store_path)?; + let scheduler_status = if state.participants.is_empty() { + "unconfigured" + } else if state.participants.iter().all(|participant| { + participant.status == "active" + && participant + .pending_turn + .as_ref() + .is_none_or(|turn| turn.status == "running") + }) { + "active" + } else { + "attention" + }; let history: Vec<_> = state .history .iter() @@ -62,7 +76,8 @@ pub fn heartbeat_status_projection( Ok(serde_json::json!({ "schema_version": HEARTBEAT_STATUS_SCHEMA_VERSION, "ok": true, - "status": "ready", + "status": "loaded", + "schedulerStatus": scheduler_status, "stateFile": null, "storeFile": store_path, "cultCacheStore": cultcache_status(store_path), diff --git a/notes/conceptual-substitution-audit-2026-07-12.md b/notes/conceptual-substitution-audit-2026-07-12.md index 91ce9320..a66ac3e2 100644 --- a/notes/conceptual-substitution-audit-2026-07-12.md +++ b/notes/conceptual-substitution-audit-2026-07-12.md @@ -1449,3 +1449,18 @@ cost ref or unavailable reason, review duration, and review-event count. Fields are optional on the stored v0 shape so older receipts remain readable, but missing legacy dimensions make `receiptProof=incomplete`. Receipt IDs and a free-text metrics summary can no longer counterfeit measurement completeness. + +## Readable heartbeat state is not scheduler readiness + +The heartbeat status projection returned `status=ready` whenever the state +document could be loaded. That proved storage presence and deserialization, not +that any participant was configured, active, or free of a non-running pending +turn. The cache had quietly inherited the scheduler's authority. + +The projection now reports `status=loaded` for readable state and exposes a +separate `schedulerStatus`. Missing state is `missing`; an empty participant set +is `unconfigured`; active participants whose pending turns are running are +`active`; all other loaded physiology is `attention`. The native heartbeat +smoke asserts the distinction at the emitted projection layer. State loading +owns readability. Participant physiology derives scheduler status. Presence +alone owns no readiness verdict. diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 0ce56c57..b6cd68fc 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -547,3 +547,11 @@ four typed dimensions; old receipts deserialize with absent optional fields but remain incomplete. A negative projection test proves a receipt with IDs and summary but no token evidence cannot report complete proof. Continue with scheduler/cache projections that derive consequential status from presence. + +The first scheduler substitution is cut. `heartbeat_status_projection` no +longer translates a readable state document into `status=ready`. It reports +store state as `missing` or `loaded` and derives separate scheduler physiology +as `unconfigured`, `active`, or `attention` from participants and pending-turn +state. The focused library suite, all-bin check, and native heartbeat smoke pass. +Continue through cache/freshness projections; do not let existence, successful +decode, or a latest mirror impersonate current consequence authority. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 0cb78644e309523ca085f9075b68a9868f01099a..56b70a59baac236e4addb5cd12ff9410e9056f2a 100644 GIT binary patch delta 404 zcmYLFu}T9$5cQ(*s$gd!91PefT!KbaJUcoug#$An709%vZwe_mA!1E(jj(XRXIs zD`3>`Dr1e&W~_hCTH)8_^Y>QRY46v&PaE@SdUio*eM;!TdGwWo(wbWmUKtIJO0?+7 zfhClf=G2e~2G$hd#E@i_lZA3PamwT-nvCx^EE?1{l3sXr} zjoGJA&MBS6P-$WGKxLIB83S^jF~wjkp!cMkbWI2j=#@|ziJp&( delta 63 zcmcbzR`$^<*$rZhyrx#B7FLFqQO6kAL+m#zGZr#3wlq&=YM;u)2*e