From d5b2ad5e3409c49e2719e5f9376f6d93998c51c5 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 18 May 2026 06:19:18 +0100 Subject: [PATCH] Remove graph replacement from update patch DTO --- epiphany-codex-bridge/src/mutation.rs | 8 ++------ epiphany-codex-bridge/src/mutation_service.rs | 16 +--------------- epiphany-codex-bridge/src/results.rs | 1 - notes/fresh-workspace-handoff.md | 2 +- state/ledgers.msgpack | Bin 142645 -> 143317 bytes state/map.yaml | 4 ++-- .../schema/json/ClientRequest.json | 12 +----------- .../codex_app_server_protocol.schemas.json | 12 +----------- .../codex_app_server_protocol.v2.schemas.json | 12 +----------- .../v2/ThreadEpiphanyUpdatePatch.ts | 3 +-- .../app-server-protocol/src/protocol/v2.rs | 3 --- 11 files changed, 10 insertions(+), 63 deletions(-) diff --git a/epiphany-codex-bridge/src/mutation.rs b/epiphany-codex-bridge/src/mutation.rs index 0d011548..01402769 100644 --- a/epiphany-codex-bridge/src/mutation.rs +++ b/epiphany-codex-bridge/src/mutation.rs @@ -59,7 +59,7 @@ pub fn core_state_patch_from_protocol( active_subgoal_id: patch.active_subgoal_id.clone(), subgoals: patch.subgoals.clone(), invariants: patch.invariants.clone(), - graphs: patch.graphs.clone(), + graphs: None, graph_frontier: patch.graph_frontier.clone(), graph_checkpoint: patch.graph_checkpoint.clone(), scratch: patch.scratch.clone(), @@ -85,7 +85,7 @@ pub fn state_update_from_thread_patch( active_subgoal_id: patch.active_subgoal_id, subgoals: patch.subgoals, invariants: patch.invariants, - graphs: patch.graphs, + graphs: None, graph_frontier: patch.graph_frontier, graph_checkpoint: patch.graph_checkpoint, scratch: patch.scratch, @@ -382,7 +382,6 @@ pub fn thread_epiphany_patch_has_state_replacements(patch: &ThreadEpiphanyUpdate || patch.active_subgoal_id.is_some() || patch.subgoals.is_some() || patch.invariants.is_some() - || patch.graphs.is_some() || patch.graph_frontier.is_some() || patch.graph_checkpoint.is_some() || patch.scratch.is_some() @@ -411,9 +410,6 @@ pub fn epiphany_update_patch_changed_fields( if patch.invariants.is_some() { fields.push(ThreadEpiphanyStateUpdatedField::Invariants); } - if patch.graphs.is_some() { - fields.push(ThreadEpiphanyStateUpdatedField::Graphs); - } if patch.graph_frontier.is_some() { fields.push(ThreadEpiphanyStateUpdatedField::GraphFrontier); } diff --git a/epiphany-codex-bridge/src/mutation_service.rs b/epiphany-codex-bridge/src/mutation_service.rs index 75343197..a042fa47 100644 --- a/epiphany-codex-bridge/src/mutation_service.rs +++ b/epiphany-codex-bridge/src/mutation_service.rs @@ -128,7 +128,6 @@ pub async fn apply_thread_epiphany_update( expected_revision: Option, patch: ThreadEpiphanyUpdatePatch, ) -> Result { - reject_graph_replacement_patch("thread/epiphany/update", &patch)?; let changed_fields = epiphany_update_patch_changed_fields(&patch); let update = state_update_from_thread_patch(expected_revision, patch); let epiphany_state = thread.epiphany_update_state(update).await?; @@ -146,13 +145,12 @@ pub async fn apply_thread_epiphany_promote( patch: ThreadEpiphanyUpdatePatch, verifier_evidence: EpiphanyEvidenceRecord, ) -> Result { - reject_graph_replacement_patch("thread/epiphany/promote", &patch)?; let decision = evaluate_promotion(EpiphanyPromotionInput { has_state_replacements: thread_epiphany_patch_has_state_replacements(&patch), active_subgoal_id: patch.active_subgoal_id.clone(), subgoals: patch.subgoals.clone(), invariants: patch.invariants.clone(), - graphs: patch.graphs.clone(), + graphs: None, graph_frontier: patch.graph_frontier.clone(), graph_checkpoint: patch.graph_checkpoint.clone(), investigation_checkpoint: patch.investigation_checkpoint.clone(), @@ -182,18 +180,6 @@ pub async fn apply_thread_epiphany_promote( )) } -fn reject_graph_replacement_patch( - surface: &str, - patch: &ThreadEpiphanyUpdatePatch, -) -> Result<(), CodexErr> { - if patch.graphs.is_some() { - return Err(CodexErr::InvalidRequest(format!( - "{surface} no longer accepts graph replacement patches; propose graph growth as typed memoryPatchCandidates and apply it through the memory graph reviewer" - ))); - } - Ok(()) -} - pub async fn apply_thread_epiphany_role_accept( thread: &CodexThread, role_id: ThreadEpiphanyRoleId, diff --git a/epiphany-codex-bridge/src/results.rs b/epiphany-codex-bridge/src/results.rs index e01a64a5..ac796fc4 100644 --- a/epiphany-codex-bridge/src/results.rs +++ b/epiphany-codex-bridge/src/results.rs @@ -73,7 +73,6 @@ fn map_protocol_update_patch(patch: EpiphanyRoleStatePatchDocument) -> ThreadEpi active_subgoal_id: patch.active_subgoal_id, subgoals: patch.subgoals, invariants: patch.invariants, - graphs: patch.graphs, graph_frontier: patch.graph_frontier, graph_checkpoint: patch.graph_checkpoint, scratch: patch.scratch, diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index e1e512a5..e1fa1473 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` reject `patch.graphs` at the bridge; native state-update validation and promotion policy reject 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 through `epiphany-codex-bridge::legacy_graph_compat`. `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. Public `ThreadEpiphanyUpdatePatch` no longer carries `graphs`; generic update/promote bridge mutation mapping cannot apply it, and native state-update validation plus promotion policy reject it as backstop. `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 through `epiphany-codex-bridge::legacy_graph_compat`. `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 9c06460f6a9b23daf63cc8d01e1077b0b4cc1a2b..ff5f5b2634dc11b10860ed92b2108f5555bf7169 100644 GIT binary patch delta 574 zcmZvaKWi016vdfWMNup?AOZ10uuAs*gBRipY7uKC5E~o0J9~F`$n4B8GyC?vDx!j| zBDjT}<_idl2=6;s*`)ESc-NH_Vl^;x?mfSAn6Kv>KYwk!*&d8Oe7^Huh!-!{;`LgH zZ)-7-J2zi_jN$uqJl#vivt+V=Jf6)b`}5hfefvY~v{$c*ty5z`TT_q+iQX#;;ObN> z357>j1_-jG3P%r*A9sSn9>Af^XbGuTSwT>{3?q%4x0Q_q6*{L(0me3fy1^B%!w`6D zzwX{6YiJiV;i8ij{yLlRVVhV&v=CR0ves=6Hm3p5WKdCM{i>e^PYXrO@PDc9&c}Q2 z9wfJKoi*sqnPHf7abI?*2{R>u{DOQt`6M>mlOu6?i(|=?o(?dNoZqumN7Y{8UM>xL z-~(v!NZdH>Yj~EcWvo5Ni4-D)sI-P0l@5@S#5xcZWXN+R8C+-^G!bG+K | null, invariants?: Array | null, graphs?: EpiphanyGraphs | null, graphFrontier?: EpiphanyGraphFrontier | null, graphCheckpoint?: EpiphanyGraphCheckpoint | null, scratch?: EpiphanyScratchPad | null, investigationCheckpoint?: EpiphanyInvestigationCheckpoint | null, jobBindings?: Array | null, acceptanceReceipts?: Array, runtimeLinks?: Array, observations?: Array, evidence?: Array, churn?: EpiphanyChurnState | null, mode?: EpiphanyModeState | null, planning?: EpiphanyPlanningState | null, }; +export type ThreadEpiphanyUpdatePatch = { objective?: string | null, activeSubgoalId?: string | null, subgoals?: Array | null, invariants?: Array | null, graphFrontier?: EpiphanyGraphFrontier | null, graphCheckpoint?: EpiphanyGraphCheckpoint | null, scratch?: EpiphanyScratchPad | null, investigationCheckpoint?: EpiphanyInvestigationCheckpoint | null, jobBindings?: Array | null, acceptanceReceipts?: Array, runtimeLinks?: Array, observations?: Array, evidence?: Array, churn?: EpiphanyChurnState | null, mode?: EpiphanyModeState | null, planning?: EpiphanyPlanningState | null, }; diff --git a/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs b/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs index 7d16704b..02095283 100644 --- a/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs +++ b/vendor/codex/codex-rs/app-server-protocol/src/protocol/v2.rs @@ -5073,9 +5073,6 @@ pub struct ThreadEpiphanyUpdatePatch { pub invariants: Option>, #[serde(default, skip_serializing_if = "Option::is_none")] #[ts(optional = nullable)] - pub graphs: Option, - #[serde(default, skip_serializing_if = "Option::is_none")] - #[ts(optional = nullable)] pub graph_frontier: Option, #[serde(default, skip_serializing_if = "Option::is_none")] #[ts(optional = nullable)]