Unify canonical state transactions
This commit is contained in:
parent
0d7c6c2b84
commit
9da553090b
12 changed files with 166 additions and 88 deletions
|
|
@ -139,6 +139,7 @@ pub fn accept_coordinator_reorient_finding(
|
|||
commit_state_with_mind_witness(
|
||||
store,
|
||||
thread_id,
|
||||
state,
|
||||
&next_state,
|
||||
&update.mind_review,
|
||||
&commit,
|
||||
|
|
@ -238,6 +239,7 @@ pub fn accept_coordinator_role_finding(
|
|||
commit_state_with_mind_witness(
|
||||
store,
|
||||
thread_id,
|
||||
state,
|
||||
&next_state,
|
||||
&update.mind_review,
|
||||
&commit,
|
||||
|
|
@ -486,9 +488,10 @@ pub enum EpiphanyAcceptancePrerequisite {
|
|||
Continuity(ContinuityRecoveryReceipt),
|
||||
}
|
||||
|
||||
pub fn commit_state_with_mind_witness(
|
||||
fn commit_state_with_mind_witness(
|
||||
store_path: &Path,
|
||||
thread_id: &str,
|
||||
expected_state: &EpiphanyThreadState,
|
||||
state: &EpiphanyThreadState,
|
||||
mind_review: &MindGatewayReview,
|
||||
commit_receipt: &MindStateCommitReceipt,
|
||||
|
|
@ -508,12 +511,13 @@ pub fn commit_state_with_mind_witness(
|
|||
state.revision
|
||||
));
|
||||
}
|
||||
let mut cache = coordinator_acceptance_cache(store_path)?;
|
||||
let state_entry = EpiphanyThreadStateEntry::from_state(thread_id, state)?;
|
||||
let (state_envelope, _) = cache.prepare_entry(THREAD_STATE_KEY, &state_entry)?;
|
||||
let mut cache = coordinator_state_transaction::open_coordinator_state_transaction(
|
||||
store_path,
|
||||
expected_state,
|
||||
)?;
|
||||
let (review_envelope, _) = cache.prepare_entry(&mind_review.gateway_id, mind_review)?;
|
||||
let (commit_envelope, _) = cache.prepare_entry(&commit_receipt.receipt_id, commit_receipt)?;
|
||||
let mut batch = vec![state_envelope, review_envelope, commit_envelope];
|
||||
let mut batch = vec![review_envelope, commit_envelope];
|
||||
for prerequisite in prerequisites {
|
||||
batch.push(match prerequisite {
|
||||
EpiphanyAcceptancePrerequisite::Eyes(document) => {
|
||||
|
|
@ -530,8 +534,9 @@ pub fn commit_state_with_mind_witness(
|
|||
}
|
||||
});
|
||||
}
|
||||
cache.put_prepared_batch(batch)?;
|
||||
Ok(state.clone())
|
||||
coordinator_state_transaction::commit_coordinator_state_transaction(
|
||||
&mut cache, thread_id, state, batch,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn build_native_role_acceptance_update(
|
||||
|
|
@ -777,7 +782,7 @@ mod tests {
|
|||
vec!["Objective".to_string()],
|
||||
"2026-07-11T00:00:00Z".to_string(),
|
||||
);
|
||||
commit_state_with_mind_witness(&store, "thread-7", &state, &review, &receipt, &[])?;
|
||||
commit_state_with_mind_witness(&store, "thread-7", &state, &state, &review, &receipt, &[])?;
|
||||
|
||||
let cache = coordinator_acceptance_cache(&store)?;
|
||||
assert_eq!(
|
||||
|
|
@ -826,8 +831,16 @@ mod tests {
|
|||
"2026-07-11T00:00:00Z".to_string(),
|
||||
);
|
||||
assert!(
|
||||
commit_state_with_mind_witness(&store, "thread-3", &state, &review, &receipt, &[])
|
||||
.is_err()
|
||||
commit_state_with_mind_witness(
|
||||
&store,
|
||||
"thread-3",
|
||||
&state,
|
||||
&state,
|
||||
&review,
|
||||
&receipt,
|
||||
&[],
|
||||
)
|
||||
.is_err()
|
||||
);
|
||||
assert!(!store.exists());
|
||||
Ok(())
|
||||
|
|
@ -877,6 +890,7 @@ mod tests {
|
|||
&store,
|
||||
"thread-9",
|
||||
&state,
|
||||
&state,
|
||||
&review,
|
||||
&commit,
|
||||
&[EpiphanyAcceptancePrerequisite::Eyes(eyes.clone())],
|
||||
|
|
|
|||
|
|
@ -21,14 +21,8 @@ pub fn commit_coordinator_job_launch(
|
|||
plan: &EpiphanyCoordinatorJobLaunchPlan,
|
||||
created_at: String,
|
||||
) -> Result<EpiphanyJobLaunchResult> {
|
||||
if let Some(persisted) = read_accepted_coordinator_state(store)?
|
||||
&& persisted != *current_state
|
||||
{
|
||||
return Err(anyhow!(
|
||||
"authoritative coordinator state changed before launch commit"
|
||||
));
|
||||
}
|
||||
let mut cache = coordinator_acceptance_cache(store)?;
|
||||
let mut cache =
|
||||
coordinator_state_transaction::open_coordinator_state_transaction(store, current_state)?;
|
||||
commit_coordinator_job_launch_in_cache(
|
||||
&mut cache,
|
||||
thread_id,
|
||||
|
|
@ -86,10 +80,13 @@ fn commit_coordinator_job_launch_in_cache(
|
|||
);
|
||||
batch.push(cache.prepare_entry(&grant.receipt_id, &grant)?.0);
|
||||
}
|
||||
let state_entry = EpiphanyThreadStateEntry::from_state(thread_id, &next_state)?;
|
||||
batch.push(cache.prepare_entry(THREAD_STATE_KEY, &state_entry)?.0);
|
||||
batch.extend(injected_envelopes);
|
||||
cache.put_prepared_batch(batch)?;
|
||||
coordinator_state_transaction::commit_coordinator_state_transaction(
|
||||
cache,
|
||||
thread_id,
|
||||
&next_state,
|
||||
batch,
|
||||
)?;
|
||||
Ok(EpiphanyJobLaunchResult {
|
||||
epiphany_state: next_state,
|
||||
binding_id: request.binding_id.clone(),
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
use crate::EpiphanyStateUpdate;
|
||||
use crate::EpiphanyStateUpdatedField;
|
||||
use crate::EpiphanyThreadStateEntry;
|
||||
use crate::THREAD_STATE_KEY;
|
||||
use crate::apply_epiphany_state_update;
|
||||
use crate::coordinator_acceptance_cache;
|
||||
use crate::coordinator_state_transaction::commit_coordinator_state_transaction;
|
||||
use crate::coordinator_state_transaction::open_coordinator_state_transaction;
|
||||
use crate::epiphany_state_update_validation_errors;
|
||||
use crate::read_accepted_coordinator_state;
|
||||
use anyhow::Result;
|
||||
|
|
@ -39,18 +38,10 @@ pub fn apply_coordinator_state_update_from_state(
|
|||
update: EpiphanyStateUpdate,
|
||||
reference_turn_id: Option<String>,
|
||||
) -> Result<EpiphanyCoordinatorStateApplied> {
|
||||
if let Some(persisted) = read_coordinator_state(store)?
|
||||
&& persisted != *current_state
|
||||
{
|
||||
return Err(anyhow!(
|
||||
"authoritative coordinator state changed before update commit"
|
||||
));
|
||||
}
|
||||
let mut cache = open_coordinator_state_transaction(store, current_state)?;
|
||||
let changed_fields = changed_fields(&update);
|
||||
let state = apply_coordinator_state_update_to_state(current_state, update, reference_turn_id)?;
|
||||
let mut cache = coordinator_acceptance_cache(store)?;
|
||||
let entry = EpiphanyThreadStateEntry::from_state(thread_id, &state)?;
|
||||
cache.put(THREAD_STATE_KEY, &entry)?;
|
||||
commit_coordinator_state_transaction(&mut cache, thread_id, &state, Vec::new())?;
|
||||
Ok(EpiphanyCoordinatorStateApplied {
|
||||
revision: state.revision,
|
||||
changed_fields,
|
||||
|
|
|
|||
89
epiphany-core/src/coordinator_state_transaction.rs
Normal file
89
epiphany-core/src/coordinator_state_transaction.rs
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
use crate::EpiphanyThreadStateEntry;
|
||||
use crate::THREAD_STATE_KEY;
|
||||
use crate::coordinator_acceptance_cache;
|
||||
use crate::read_accepted_coordinator_state;
|
||||
use anyhow::{Result, anyhow};
|
||||
use cultcache_rs::{CultCache, CultCacheEnvelope};
|
||||
use epiphany_state_model::EpiphanyThreadState;
|
||||
use std::path::Path;
|
||||
|
||||
pub(crate) fn open_coordinator_state_transaction(
|
||||
store: &Path,
|
||||
expected_state: &EpiphanyThreadState,
|
||||
) -> Result<CultCache> {
|
||||
if let Some(persisted) = read_accepted_coordinator_state(store)?
|
||||
&& persisted != *expected_state
|
||||
{
|
||||
return Err(anyhow!(
|
||||
"authoritative coordinator state changed before transaction commit"
|
||||
));
|
||||
}
|
||||
coordinator_acceptance_cache(store)
|
||||
}
|
||||
|
||||
pub(crate) fn commit_coordinator_state_transaction(
|
||||
cache: &mut CultCache,
|
||||
thread_id: &str,
|
||||
next_state: &EpiphanyThreadState,
|
||||
mut companion_envelopes: Vec<CultCacheEnvelope>,
|
||||
) -> Result<EpiphanyThreadState> {
|
||||
if companion_envelopes
|
||||
.iter()
|
||||
.any(|envelope| envelope.key == THREAD_STATE_KEY)
|
||||
{
|
||||
return Err(anyhow!(
|
||||
"coordinator state transaction companions cannot write the canonical state key"
|
||||
));
|
||||
}
|
||||
let state_entry = EpiphanyThreadStateEntry::from_state(thread_id, next_state)?;
|
||||
let (state_envelope, _) = cache.prepare_entry(THREAD_STATE_KEY, &state_entry)?;
|
||||
companion_envelopes.insert(0, state_envelope);
|
||||
cache.put_prepared_batch(companion_envelopes)?;
|
||||
Ok(next_state.clone())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::EpiphanyThreadStateEntry;
|
||||
|
||||
#[test]
|
||||
fn companion_cannot_impersonate_canonical_state() -> Result<()> {
|
||||
let temp = tempfile::tempdir()?;
|
||||
let store = temp.path().join("state.cc");
|
||||
let state = EpiphanyThreadState::default();
|
||||
let mut cache = coordinator_acceptance_cache(&store)?;
|
||||
let counterfeit = EpiphanyThreadStateEntry::from_state("counterfeit", &state)?;
|
||||
let envelope = cache.prepare_entry(THREAD_STATE_KEY, &counterfeit)?.0;
|
||||
let error =
|
||||
commit_coordinator_state_transaction(&mut cache, "thread-1", &state, vec![envelope])
|
||||
.expect_err("companion state writer must be refused");
|
||||
assert!(error.to_string().contains("canonical state key"));
|
||||
assert!(read_accepted_coordinator_state(&store)?.is_none());
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn canonical_state_key_has_no_second_production_writer() {
|
||||
for (name, source) in [
|
||||
("coordinator_state", include_str!("coordinator_state.rs")),
|
||||
("coordinator_launch", include_str!("coordinator_launch.rs")),
|
||||
(
|
||||
"coordinator_acceptance",
|
||||
include_str!("coordinator_acceptance.rs"),
|
||||
),
|
||||
("thread_state_store", include_str!("thread_state_store.rs")),
|
||||
] {
|
||||
let production = source.split("#[cfg(test)]").next().unwrap_or(source);
|
||||
assert!(
|
||||
!production.contains("prepare_entry(THREAD_STATE_KEY")
|
||||
&& !production.contains("put(THREAD_STATE_KEY"),
|
||||
"{name} regained canonical state write authority"
|
||||
);
|
||||
}
|
||||
let public_surface = include_str!("lib.rs");
|
||||
assert!(!public_surface.contains("write_thread_state_entry"));
|
||||
assert!(!public_surface.contains("write_thread_state;"));
|
||||
assert!(!public_surface.contains("commit_state_with_mind_witness"));
|
||||
}
|
||||
}
|
||||
|
|
@ -9,6 +9,7 @@ mod coordinator_launch_context;
|
|||
mod coordinator_results;
|
||||
mod coordinator_service;
|
||||
mod coordinator_state;
|
||||
mod coordinator_state_transaction;
|
||||
mod cultmesh_integration;
|
||||
mod distillation;
|
||||
mod eyes_gateway;
|
||||
|
|
@ -136,7 +137,6 @@ pub use coordinator_acceptance::accept_coordinator_role_finding;
|
|||
pub use coordinator_acceptance::acceptance_launch_contract_for_binding;
|
||||
pub use coordinator_acceptance::build_native_reorient_acceptance_update;
|
||||
pub use coordinator_acceptance::build_native_role_acceptance_update;
|
||||
pub use coordinator_acceptance::commit_state_with_mind_witness;
|
||||
pub use coordinator_acceptance::completed_reorient_finding;
|
||||
pub use coordinator_acceptance::completed_role_finding;
|
||||
pub use coordinator_acceptance::coordinator_acceptance_cache;
|
||||
|
|
@ -981,8 +981,6 @@ pub use thread_state_store::load_thread_state;
|
|||
pub use thread_state_store::load_thread_state_entry;
|
||||
pub use thread_state_store::thread_state_cache;
|
||||
pub use thread_state_store::validate_thread_state_entry;
|
||||
pub use thread_state_store::write_thread_state;
|
||||
pub use thread_state_store::write_thread_state_entry;
|
||||
pub use weksa_interlingua::WEKSA_INTERLINGUA_PACKET_SCHEMA_VERSION;
|
||||
pub use weksa_interlingua::WEKSA_TARGET_LOWERING_RECEIPT_SCHEMA_VERSION;
|
||||
pub use weksa_interlingua::WEKSA_TARGET_LOWERING_REQUEST_SCHEMA_VERSION;
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@ pub const EPIPHANY_LAUNCH_ORGAN_CONTRACT_SCHEMA_VERSION: &str = "epiphany.launch
|
|||
|
||||
pub const EPIPHANY_STANDING_ORGANS: [&str; 7] = [
|
||||
"self",
|
||||
"Persona",
|
||||
"persona",
|
||||
"imagination",
|
||||
"eyes",
|
||||
"Modeling",
|
||||
"modeling",
|
||||
"hands",
|
||||
"soul",
|
||||
];
|
||||
|
|
|
|||
|
|
@ -60,24 +60,6 @@ pub fn load_thread_state(store_path: impl AsRef<Path>) -> Result<Option<Epiphany
|
|||
Ok(Some(entry.state()?))
|
||||
}
|
||||
|
||||
pub fn write_thread_state_entry(
|
||||
store_path: impl AsRef<Path>,
|
||||
entry: &EpiphanyThreadStateEntry,
|
||||
) -> Result<EpiphanyThreadStateEntry> {
|
||||
validate_thread_state_entry(entry)?;
|
||||
let mut cache = thread_state_cache(store_path)?;
|
||||
cache.put(THREAD_STATE_KEY, entry)
|
||||
}
|
||||
|
||||
pub fn write_thread_state(
|
||||
store_path: impl AsRef<Path>,
|
||||
thread_id: impl Into<String>,
|
||||
state: &EpiphanyThreadState,
|
||||
) -> Result<EpiphanyThreadStateEntry> {
|
||||
let entry = EpiphanyThreadStateEntry::from_state(thread_id, state)?;
|
||||
write_thread_state_entry(store_path, &entry)
|
||||
}
|
||||
|
||||
pub fn validate_thread_state_entry(entry: &EpiphanyThreadStateEntry) -> Result<()> {
|
||||
if entry.schema_version != THREAD_STATE_SCHEMA_VERSION {
|
||||
return Err(anyhow!(
|
||||
|
|
@ -120,7 +102,8 @@ mod tests {
|
|||
..Default::default()
|
||||
};
|
||||
|
||||
write_thread_state(&store, "thread-1", &state)?;
|
||||
let entry = EpiphanyThreadStateEntry::from_state("thread-1", &state)?;
|
||||
thread_state_cache(&store)?.put(THREAD_STATE_KEY, &entry)?;
|
||||
let loaded = load_thread_state(&store)?.expect("thread state should load");
|
||||
|
||||
assert_eq!(loaded.revision, 7);
|
||||
|
|
|
|||
|
|
@ -17,10 +17,11 @@ scheduler, route, notification, or interface contract.
|
|||
| Owner | Inputs | Outputs | Invariant |
|
||||
|---|---|---|---|
|
||||
| `epiphany-state-model` | typed state fields | `EpiphanyThreadState` and prompt projection | State is typed; rendering is not authority. |
|
||||
| `coordinator_state.rs` | current state plus validated ordinary update | durable native thread state | Owns the ordinary update transaction, but not all state commits. |
|
||||
| `coordinator_launch.rs` | validated launch plan, state, runtime envelopes | atomic state-plus-launch transaction | Launch writes `THREAD_STATE_KEY` beside runtime records. |
|
||||
| `coordinator_acceptance.rs` | reviewed finding, Mind review, commit receipt | atomic state-plus-Mind-witness transaction | Acceptance and its witnesses land together. |
|
||||
| `thread_state_store.rs` | raw typed state entry | low-level CultCache read/write | Substrate, not policy; its public writers are a current authority wound. |
|
||||
| `coordinator_state_transaction.rs` | expected state, next state, typed companion envelopes | one atomic canonical-state transaction | Sole production writer of `THREAD_STATE_KEY`; companions cannot impersonate state. |
|
||||
| `coordinator_state.rs` | current state plus validated ordinary update | proposed next state and transaction request | Owns update meaning, not persistence. |
|
||||
| `coordinator_launch.rs` | validated launch plan, state, runtime envelopes | state-plus-launch transaction request | Launch constructs runtime companions; the transaction owner commits them. |
|
||||
| `coordinator_acceptance.rs` | reviewed finding, Mind review, commit receipt | state-plus-Mind-witness transaction request | Acceptance owns admission meaning; the transaction owner commits its witnesses. |
|
||||
| `thread_state_store.rs` | typed state entry | low-level CultCache codec/read access | Substrate, not policy; it exposes no production writer. |
|
||||
| `coordinator_service.rs` | state/runtime store paths and typed commands | state update, launch, accept, interrupt results | Facade routes typed work; it contains no policy or protocol mapping. |
|
||||
| `surfaces/*` | native state, runtime snapshots, pressure/freshness inputs | scene, jobs, roles, planning, context, graph, CRRC, coordinator recommendations | Read surfaces derive; they do not mutate. |
|
||||
| `runtime_spine.rs` | typed launch/result/receipt documents | CultCache runtime records | Runtime lifecycle and evidence are durable typed documents. |
|
||||
|
|
@ -48,21 +49,16 @@ flowchart LR
|
|||
P --> O["Coordinator / operator / Eve projections"]
|
||||
```
|
||||
|
||||
There are currently three state transaction authorities:
|
||||
|
||||
1. ordinary updates through
|
||||
`coordinator_state::{apply_coordinator_state_update,
|
||||
apply_coordinator_state_update_from_state,
|
||||
apply_coordinator_state_update_to_state}`;
|
||||
2. launch transactions through
|
||||
`coordinator_launch::commit_coordinator_job_launch_in_cache`;
|
||||
3. acceptance transactions through
|
||||
`coordinator_acceptance::commit_state_with_mind_witness`.
|
||||
|
||||
They share typed state and validation primitives, but not one commit primitive.
|
||||
`thread_state_store::{write_thread_state_entry, write_thread_state}` are public
|
||||
raw writers underneath them. This is a live authority defect, not an intended
|
||||
invariant. `EpiphanyCoordinatorService` is the narrow caller-facing facade.
|
||||
`coordinator_state_transaction::{open_coordinator_state_transaction,
|
||||
commit_coordinator_state_transaction}` is the single persistence owner.
|
||||
Ordinary updates, launch transactions, and accepted findings construct their
|
||||
domain-specific next state or companion documents, then submit them to that
|
||||
owner. It rejects stale expected state, refuses companion envelopes that target
|
||||
the canonical key, and commits state plus companions in one prepared batch.
|
||||
`thread_state_store.rs` retains typed codec/read access only; its production raw
|
||||
writers and their public exports are deleted. A source guard rejects any second
|
||||
production `THREAD_STATE_KEY` writer. `EpiphanyCoordinatorService` is the narrow
|
||||
caller-facing facade.
|
||||
|
||||
Forbidden writers:
|
||||
|
||||
|
|
@ -221,10 +217,7 @@ Cut or correct next:
|
|||
- wrapper arguments named for Codex when they no longer cross a Codex boundary;
|
||||
- compatibility-shaped JSON field names inside native-only operator artifacts
|
||||
when no external contract requires them;
|
||||
- split canonical-state transaction authority and misleading state/runtime
|
||||
store path names;
|
||||
- public raw thread-state writers that bypass the intended coordinator/Mind
|
||||
transaction boundary;
|
||||
- misleading state/runtime store path names;
|
||||
- any remaining full-context serializer or summary that duplicates typed owner
|
||||
state instead of projecting it narrowly.
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,11 @@ earned OpenAI-compatible authentication or model-transport capability.
|
|||
|
||||
### 0. Unify Canonical State Transactions
|
||||
|
||||
Status: complete. `coordinator_state_transaction.rs` is the sole production
|
||||
writer of `THREAD_STATE_KEY`; ordinary updates, launches, and Mind acceptance
|
||||
share it, raw storage writers are deleted, and negative source guards prevent a
|
||||
second owner.
|
||||
|
||||
- Define one transaction owner for canonical state revision changes.
|
||||
- Make ordinary update, launch, and Mind-witness acceptance call that owner.
|
||||
- Preserve operation-specific atomic companions: launch runtime envelopes and
|
||||
|
|
@ -183,8 +188,7 @@ Delete or demote:
|
|||
|
||||
## Immediate Next Action
|
||||
|
||||
Map and unify the three canonical state transaction writers:
|
||||
`coordinator_state`, `commit_coordinator_job_launch_in_cache`, and
|
||||
`commit_state_with_mind_witness`. Decide the explicit store contract before
|
||||
editing: one unified cache is currently suggested by atomic launch/acceptance
|
||||
requirements, but the owner and invariant must be named first.
|
||||
Normalize native operator contracts. Begin with an inventory of
|
||||
compatibility-shaped `epiphanyState` JSON and misleading `runtime_spine_store`
|
||||
path names, identify each living consumer, and either rename the native
|
||||
contract or record a bounded migration with an expiry.
|
||||
|
|
|
|||
|
|
@ -1983,6 +1983,15 @@ deleted instead of moved. The `epiphany-codex-bridge` crate and Codex dependency
|
|||
edges are now gone. Native coordinator path selection also no longer reads
|
||||
`/read/thread/epiphanyState`; scene/native state is the sole source. Next rewrite
|
||||
the stale canonical algorithmic map around the live native pipeline.
|
||||
The canonical map rewrite exposed three durable state writers. That split is now
|
||||
cut: `coordinator_state_transaction.rs` alone writes `THREAD_STATE_KEY`, while
|
||||
ordinary updates, launch, and Mind acceptance submit typed state plus atomic
|
||||
companions. Raw store writers and the public acceptance commit surface are
|
||||
deleted; negative tests reject a second writer and companion-state
|
||||
impersonation. The full core library passes 248 tests. That sweep also repaired
|
||||
mixed-case `Persona`/`Modeling` dependency ids that made the renamed organs
|
||||
depend on themselves. Next inventory native compatibility-shaped operator JSON
|
||||
and the misleading `runtime_spine_store` name before renaming either.
|
||||
|
||||
## Immediate Re-entry Instruction
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -155,7 +155,7 @@ accepted_design:
|
|||
- Eyes' evidence contract surface is named beside Substrate Gate and Mind: `epiphany-core::eyes_gateway` defines evidence requests, evidence reviews, source lookup receipts, evidence packets, and evidence refusal receipts; runtime-spine advertises those contracts; CultMesh persists matching `EpiphanyCultMeshEyesContractEntry` policy documents so retrieved snippets and source reads are not confused with inspected evidence.
|
||||
- Hands, Soul, and Continuity now have first-class contract catalogs beside Mind/Substrate Gate/Eyes. `epiphany-core::hands_gateway` defines action intents, reviews, command/patch/commit/PR/rollback/refusal receipts; `epiphany-core::soul_gateway` defines verification requests, invariant checks, verdict/regression/review/refusal receipts; `epiphany-core::continuity_gateway` defines continuity packets, compaction checkpoints, sleep distillation, recovery, stale-turn repair, and continuity refusal receipts. Runtime-spine advertises them and CultMesh persists matching Verse-scoped contract policy documents.
|
||||
- Worker launch packets now carry `EpiphanyLaunchOrganContract` beside the typed launch document. The contract derives from authority scope, document kind, and output contract id; carries the full standing sub-agent dependency matrix, a receipt document catalogue, and effect-specific receipt proof profiles for state admission, evidence promotion, repo action, verification, and continuity recovery. Runtime-spine validates and persists this contract on `EpiphanyRuntimeWorkerLaunchRequest`; bridge role/reorient/generic launch builders populate it. Role/reorient acceptance now refuses completed runtime-spine findings if their original worker launch request is missing, mismatched by document kind, or lacks a state-admission proof profile requiring Mind review. Acceptance computes claimed effects from the role/reorient state change and rereads persisted receipt documents from runtime-spine before proof admission. The first executable Mind proof is landed: acceptance persists `epiphany.mind.gateway_review` before state admission and `epiphany.mind.state_commit_receipt` after admission with the resulting revision. The Research evidence-promotion proof chain is executable: Research launches persist typed Substrate Gate read/snapshot access grants, accepted Research findings emit typed Eyes evidence packets from their Eyes-shaped statePatch, runtime-spine persists/verifies both, and Research acceptance enforces Substrate Gate grant + Eyes packet + Mind review before evidence-shaped state admission. The Verification proof chain is executable too: accepted Verification findings emit typed Soul verdict receipts, runtime-spine persists/verifies them, and Verification acceptance enforces Soul verdict + Mind review before verification-shaped state admission. The Continuity recovery proof chain is executable: accepted reorient findings emit typed Continuity recovery receipts, runtime-spine persists/verifies them, and reorient acceptance enforces Continuity recovery + Mind review before recovery-shaped state admission.
|
||||
- `notes/perfect-machine-audit-roadmap.md` is the current architectural audit. The main finding is that organ contracts are now named, launch-carried, and acceptance-gated against naked runtime jobs, while Mind admission has the first persisted review/commit receipt chain. The old all-receipts list is now only a catalogue; proof profiles say which receipts are required for each effect type. Substrate Gate, Eyes, Soul, and Continuity now have live enforced receipt chains where their producers exist; Hands receipts remain expectations until action-lane producers become live. The current Mind receipt write is not transactional across state mutation and receipt persistence; future state admission should collapse mutation plus post-commit receipt into one owner when the storage layer supports it. The Rust dependency body repair is landed: the missing `E:\Projects\CultLib\crates\*` paths were replaced with repo-contained vendored CultCache/CultNet/CultMesh crates, and `cargo test --manifest-path .\epiphany-core\Cargo.toml --lib` passes.
|
||||
- Canonical thread-state persistence has one production owner: `coordinator_state_transaction.rs`. Ordinary updates, launches, and Mind acceptance construct typed state or companions but commit through the same stale-checked atomic batch primitive. Raw `thread_state_store` writers and the public acceptance commit export are deleted; source guards reject a second production `THREAD_STATE_KEY` writer or companion-state impersonation. Full `epiphany-core` library proof passes 248 tests. The same sweep repaired stale mixed-case Persona/Modeling organ ids that caused each renamed organ to depend on itself.
|
||||
- `notes/codex-starvation-and-cultnet-liberation-plan.md` is the active foundation directive. It supersedes outward product/bridge/dogfood work and supersedes the weaker goal of merely making Codex app-server a cleaner adapter. Epiphany must become a native CultCache/CultNet runtime; Codex remains only as an OpenAI subscription auth/model-transport reliquary until that too can be replaced or minimized.
|
||||
- `notes/codex-auth-spine-inventory.md` is the current source-grounded inventory of the Codex organ that may survive. Corrected compliance invariant: Codex-compatible auth identity should remain anchored in retained vendored Codex-derived auth machinery, while Epiphany owns typed request/status/event/runtime surfaces around it. Codex app-server, apps, skills, marketplace, plugin UX, MCP OAuth handlers, and collaboration-mode surfaces are not part of the keeper spine.
|
||||
- `epiphany-openai-runtime` worker result ingress now parses assistant output directly into launch-kind-specific typed documents and stores typed nested `statePatch` / `selfPatch` payloads as MessagePack inside `EpiphanyRuntimeRoleWorkerResult`; generic `serde_json::Value` no longer mediates role/reorient worker results in that crate. JSON still exists at the OpenAI text edge because the model's output is text, but the runtime boundary after parsing is typed.
|
||||
|
|
@ -659,4 +659,4 @@ current_status:
|
|||
- Service lifecycle receipt history is now event-only: `load_epiphany_cultmesh_daemon_service_lifecycle_receipts` filters out the `epiphany-local/daemon-service-lifecycle-receipt/latest` mirror, while `load_latest_epiphany_cultmesh_daemon_service_lifecycle_receipt` remains the latest-state reader. Focused unit test `service_lifecycle_receipt_history_excludes_latest_mirror` proves two per-receipt writes return exactly two history records and latest points at the second. Fresh smoke `verse-query-lifecycle-history-filter-smoke` and live overview/triage `local-20260618-145632-497-efac6f0d` / `local-20260618-145632-321-867947af` prove compact swarm sights still expose service lifecycle attention plus the present elevated runbook artifact without daemon pokes or service mutation. Do not use a broad unscoped cargo test filter for this check on Windows; it fans out across bin harnesses and hit a broken pipe during this pass.
|
||||
- `epiphany-verse-query seed-compact` is the compact seed receipt for wrappers and read-only rites. The older `seed` command still prints the full local Verse context for explicit debugging, but compact wrapper modes now avoid full `seed`/final `query` readback after the combined overview proof exposed Windows debug stack overflow from full-context serialization pressure.
|
||||
last_completed_repo_swarm_cut: Huginn live-fire has crossed the first real repo Body from Persona pressure to branch-local Hands commit and Soul/Mind closure, and now has repeatable closure and redacted-public-proof mouths. On `E:\Projects\Huginn` branch `epiphany/huginn/first-awakening`, `tools/epiphany_local_run.ps1 -Mode repo-persona-intake` accepted item `huginn-inspection-readback-livefire`, Weksa/Persona intake remained sealed, and `epiphany-work derive-plan` lowered it to model-authored safe family `repo.status_section` for `README.md` only. `tools/epiphany_local_run.ps1 -Mode repo-swarm-run` advanced four bounded pulses: run-from-plan, adopt-from-plan, execute-from-plan, and close-from-execute. Huginn commit `e9b07c38fceabbdc89ea35c2156326c80c0393a2` updated only `README.md`; closure receipt `.epiphany\work\work-close-huginn-inspection-readback-livefire.json` records status `closed`, Soul verdict `passed`, Mind state commit `repo-work-close-huginn-inspection-readback-livefire-mind-commit`, safe family `repo.status_section`, path scope `README.md`, Bifrost publication gate, and `privateStateExposed=false`. Verification also ran Huginn's TypeScript compiler through concrete Node path: `C:\Program Files\nodejs\node.exe E:\Projects\Huginn\node_modules\typescript\bin\tsc -p tsconfig.json` passed. Native verifier `epiphany-repo-livefire-closure-smoke --workspace E:\Projects\Huginn --item huginn-inspection-readback-livefire --expected-path README.md --expected-family repo.status_section --expected-gate awaiting-publication --expected-blocker bifrost-publication-missing` checks closure receipt, Mind map entry, overview gate/blocker, authority seals, and `git show` changed paths, returning `status=ok`, `soulVerdict=passed`, `publicationGate=Bifrost`, and `privateStateExposed=false`. Wrapper `tools/epiphany_local_run.ps1 -Mode repo-livefire-closure -Workspace E:\Projects\Huginn -RepoWorkItem huginn-inspection-readback-livefire -SkipBuild` exposes the same read-only proof through the local operator mouth; artifact `local-20260621-190156-803-2f85ba15` printed commit, path, gate, blocker, Soul verdict, Mind commit receipt, and `privateStateExposed=False` without push, merge, publication, or target mutation. New wrapper `tools/epiphany_local_run.ps1 -Mode repo-work-public-proof -Workspace E:\Projects\Huginn -RepoWorkItem huginn-inspection-readback-livefire -SkipBuild` exports the redacted proof bundle and repo-local Verse index without publishing; artifact `local-20260621-190645-345-4555b1dc` wrote `.epiphany\public\proof-bundles\repo-work-public-proof-huginn-inspection-readback-livefire.json`, proof id `repo-work-public-proof-huginn-inspection-readback-livefire`, SHA-256 `857545b199f3e37eb06c2e757e5cfc201958e46667bb1f8403fd333a22620f63`, nine artifact rows, zero publication rows, and `privateStateExposed=False`. Gjallar readback `local-20260621-190701-140-b9519ec6` sees the `REPO-WORK-PUBLIC-PROOF` row and action row from Huginn's repo-local Verse with the same SHA-256 while Bifrost publication remains missing. Launcher compact modes are now named compact operator-context modes instead of read-only modes, and `bifrost-public-proof` summaries print item, target public Verse, room, proof SHA-256, review receipts, and credit receipts so publication receipts are auditable without claiming upstream sync.
|
||||
next_action: Map and unify canonical state transaction authority. Ordinary updates write through `coordinator_state`, launches through `commit_coordinator_job_launch_in_cache`, and accepted findings through `commit_state_with_mind_witness`; raw `thread_state_store` writers are public, and launch/acceptance write `THREAD_STATE_KEY` through the path named `runtime_spine_store`. Name the unified store/transaction owner, preserve atomic companion receipts, demote raw writers, and add negative source guards before resuming operator-contract cleanup.
|
||||
next_action: Normalize native operator contracts. Inventory compatibility-shaped `epiphanyState` JSON and misleading `runtime_spine_store` path names, identify living consumers, then rename native contracts or define bounded typed migrations without recreating Codex authority.
|
||||
|
|
|
|||
Reference in a new issue