From ba6602f647525e78ba51f836b6e4bc6d6d1304e7 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 18 May 2026 06:00:28 +0100 Subject: [PATCH] Reject graph replacement in state updates --- epiphany-core/src/state_update.rs | 20 +++++++++++++++++--- notes/fresh-workspace-handoff.md | 2 +- state/ledgers.msgpack | Bin 141770 -> 142044 bytes state/map.yaml | 4 ++-- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/epiphany-core/src/state_update.rs b/epiphany-core/src/state_update.rs index 358f8da0..87314837 100644 --- a/epiphany-core/src/state_update.rs +++ b/epiphany-core/src/state_update.rs @@ -173,6 +173,12 @@ pub fn epiphany_state_update_validation_errors( if let Some(planning) = update.planning.as_ref() { errors.extend(validate_epiphany_planning_state(planning)); } + if update.graphs.is_some() { + errors.push( + "patch.graphs is no longer accepted; graph growth belongs in typed memoryPatchCandidates" + .to_string(), + ); + } errors.extend(epiphany_state_replacement_validation_errors(state, update)); errors @@ -195,9 +201,6 @@ pub fn apply_epiphany_state_update( if let Some(invariants) = update.invariants { state.invariants = invariants; } - if let Some(graphs) = update.graphs { - state.graphs = graphs; - } if let Some(graph_frontier) = update.graph_frontier { state.graph_frontier = Some(graph_frontier); } @@ -667,6 +670,17 @@ mod tests { }, ..Default::default() }; + let graph_update = EpiphanyStateUpdate { + graphs: Some(EpiphanyGraphs::default()), + ..Default::default() + }; + let errors = epiphany_state_update_validation_errors(&state, &graph_update); + assert!( + errors + .iter() + .any(|error| error.contains("patch.graphs is no longer accepted")) + ); + let frontier_update = EpiphanyStateUpdate { graph_frontier: Some(EpiphanyGraphFrontier { active_node_ids: vec!["missing".to_string()], diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index d197c077..b5ea613c 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -39,7 +39,7 @@ remembers doctrine; the branch remembers the blade. - `epiphany-openai-runtime` worker result ingress now parses assistant output directly into typed role/reorient ingress structs selected from the durable launch document, stores nested `statePatch` and `selfPatch` as typed MessagePack in `EpiphanyRuntimeRoleWorkerResult`, and no longer passes worker result data through generic `serde_json::Value`. JSON survives there only as the OpenAI text-output edge before typed deserialization. - Agent self-memory review/application now has typed `AgentSelfPatch` core APIs. JSON-value selfPatch functions are compatibility wrappers for CLI/artifact ingress; native callers should parse once at the edge and then call `review_agent_self_patch_document` / `apply_agent_self_patch_document`. Role-result self-persistence no longer exports a JSON-value reviewer; the live API is `review_role_self_patch_document`. - `epiphany-openai-codex-spine` no longer uses Codex's Responses client, model-provider layer, `codex-api`, `codex-model-provider`, `codex-model-provider-info`, or `codex-protocol` for outbound model requests. It reaches `codex-login` only through `epiphany-openai-auth-spine` so credential loading/refresh stays Codex-compatible while request/status/event/runtime surfaces stay typed Epiphany documents. -- `notes/epiphany-memory-graph-unified-plan.md` is the current memory architecture direction drawn from `Fractal Domains And The Cache That Bites` plus the VoidBot memory scar tissue. The repo semantic architecture/dataflow graph and agent memory are one `EpiphanyMemoryGraph` substrate with repo, role, short-term, incubation, agency, candidate-intervention, and evidence profiles. The first native skeleton is landed: `epiphany-state-model` owns shared graph document types, `epiphany-core::memory_graph` owns stable ids, validation, freshness, context cuts, and CultCache persistence, and `epiphany-memory-graph` can status/validate/context/semantic-context/smoke/index the store. `epiphany-core::semantic_cache` now owns the shared Qdrant/Ollama transport used by workspace retrieval and memory graph indexing, so Qdrant remains a rebuildable contribution cache for typed graph documents, not truth. Runtime role results expose typed `memoryPatchCandidates`; Modeling `roleAccept` applies them to `state/memory-graph.msgpack`; native role/reorientation launches now prefer that persisted memory graph for bounded typed `memoryContext` cuts and only fall back to legacy accepted thread graphs for bootstrap. Reorientation launch no longer carries full `graphs` cargo. The old `thread/epiphany/propose` read route no longer returns replacement `graphs`; it exposes graph growth as typed `memoryPatchCandidates` and withholds frontier updates that depend on unapplied memory growth. Generic `thread/epiphany/update` and `thread/epiphany/promote` now reject `patch.graphs` at the bridge. `thread/epiphany/view`, `thread/epiphany/freshness`, `thread/epiphany/context`, and `thread/epiphany/graphQuery` now prefer the persisted memory graph for loaded threads through one read-route store adapter and project back into legacy graph-shaped response lenses only at the bridge edge. `notes/repo-fractal-dataflow-cache-plan.md` and `notes/agent-memory-fractal-cache-plan.md` are profile plans, not rival organs. +- `notes/epiphany-memory-graph-unified-plan.md` is the current memory architecture direction drawn from `Fractal Domains And The Cache That Bites` plus the VoidBot memory scar tissue. The repo semantic architecture/dataflow graph and agent memory are one `EpiphanyMemoryGraph` substrate with repo, role, short-term, incubation, agency, candidate-intervention, and evidence profiles. The first native skeleton is landed: `epiphany-state-model` owns shared graph document types, `epiphany-core::memory_graph` owns stable ids, validation, freshness, context cuts, and CultCache persistence, and `epiphany-memory-graph` can status/validate/context/semantic-context/smoke/index the store. `epiphany-core::semantic_cache` now owns the shared Qdrant/Ollama transport used by workspace retrieval and memory graph indexing, so Qdrant remains a rebuildable contribution cache for typed graph documents, not truth. Runtime role results expose typed `memoryPatchCandidates`; Modeling `roleAccept` applies them to `state/memory-graph.msgpack`; native role/reorientation launches now prefer that persisted memory graph for bounded typed `memoryContext` cuts and only fall back to legacy accepted thread graphs for bootstrap. Reorientation launch no longer carries full `graphs` cargo. The old `thread/epiphany/propose` read route no longer returns replacement `graphs`; it exposes graph growth as typed `memoryPatchCandidates` and withholds frontier updates that depend on unapplied memory growth. Generic `thread/epiphany/update` and `thread/epiphany/promote` reject `patch.graphs` at the bridge, and native state-update validation rejects it too. `thread/epiphany/view`, `thread/epiphany/freshness`, `thread/epiphany/context`, and `thread/epiphany/graphQuery` now prefer the persisted memory graph for loaded threads through one read-route store adapter and project back into legacy graph-shaped response lenses only at the bridge edge. `notes/repo-fractal-dataflow-cache-plan.md` and `notes/agent-memory-fractal-cache-plan.md` are profile plans, not rival organs. - Durable Epiphany state types now live in root crate `epiphany-state-model`. `codex-protocol` re-exports them only so old rollout/API callers keep compiling; do not add new durable `Epiphany*` state structs under `vendor/codex`. `epiphany-core` imports the native model directly and no longer depends on `codex-protocol`. Pressure derives from native `EpiphanyTokenUsageSnapshot`; Codex token telemetry is mapped at the bridge. Codex rollout/event reconstruction now lives in `codex-core::epiphany_rollout`, where the Codex `RolloutItem` / `EventMsg` types belong. Exact retrieval path matching is native to `epiphany-core`, so `epiphany-core` has no direct vendored Codex crate dependency. - State-update contract proof and job launch/interrupt DTO ownership now live in native `epiphany-core`. The old giant `codex_thread.rs` Epiphany state-update test fixture was cut, and `epiphany-codex-bridge` no longer imports Epiphany job launch request types from `codex_core`; vendored `CodexThread` may call the native mutation/launch law for compatibility, but it must not regain ownership of state-update semantics, heartbeat launch-plan policy, or Epiphany DTOs. - MCP remains JSON because MCP is a JSON protocol. The latest processor cut only moved MCP refresh/OAuth/status/resource/tool-call route handling into `codex_message_processor/mcp_routes.rs`, reducing the root processor to about 8,977 lines; it did not claim MCP payloads are CultNet or make MCP an Epiphany-owned runtime contract. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 4e86c52e5617b2fd29d07f06c36fbd133caaa0a0..712a980f2bf9f4e1d27defe8537f6ebfa91b7a5e 100644 GIT binary patch delta 269 zcmY+9ze)o^7{u8$<`FC`27(B|g!LdIY5h~$sEys1+t0g|%kHwfM$@REU@HjP=M4ga z2v=CAu@E~O-@?+3+StrYF*ER+y){4Ho42h-doo?V7vlV?7B{sJPqk=#tt?(oVtCGE zw%(Dw&f3Pl?DeJW%k1v+rM>mKOHq#)+fKWZ%y=(S*;Sh_G4l{E!>3{U1K0by=`#Z?50pH2F473Dl+6QKhJ$#hJn|rU~rP|<>No5g