From 1716ef95bbea142efd4c1412d574d0bf8c553c35 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 15 Jul 2026 19:03:44 +0100 Subject: [PATCH] Cut legacy graph freshness authority --- epiphany-core/src/surfaces/freshness.rs | 47 ++++++++++++++-------- epiphany-core/src/surfaces/jobs.rs | 8 ++-- notes/epiphany-current-algorithmic-map.md | 22 +++++----- notes/fresh-workspace-handoff.md | 22 +++++----- state/ledgers.msgpack | Bin 506736 -> 507118 bytes state/map.yaml | 6 +-- 6 files changed, 61 insertions(+), 44 deletions(-) diff --git a/epiphany-core/src/surfaces/freshness.rs b/epiphany-core/src/surfaces/freshness.rs index feb6a748..d314d839 100644 --- a/epiphany-core/src/surfaces/freshness.rs +++ b/epiphany-core/src/surfaces/freshness.rs @@ -202,32 +202,23 @@ pub(super) fn graph_freshness(state: Option<&EpiphanyThreadState>) -> EpiphanyGr .churn .as_ref() .and_then(|churn| churn.graph_freshness.clone()); - let freshness_hint_current = graph_freshness.as_deref().is_some_and(|freshness| { - matches!( - freshness.trim().to_ascii_lowercase().as_str(), - "fresh" | "ready" | "current" | "ok" - ) - }); let has_pressure = dirty_path_count > 0 || open_question_count > 0 || open_gap_count > 0; let checkpoint_id = state .graph_checkpoint .as_ref() .map(|checkpoint| checkpoint.checkpoint_id.clone()); - let status = if has_pressure || (graph_freshness.is_some() && !freshness_hint_current) { + let status = if has_pressure { EpiphanyGraphFreshnessStatus::Stale - } else if checkpoint_id.is_none() || graph_freshness.is_none() { - EpiphanyGraphFreshnessStatus::Missing } else { - EpiphanyGraphFreshnessStatus::Ready + EpiphanyGraphFreshnessStatus::Missing }; let note = if status == EpiphanyGraphFreshnessStatus::Stale { format!( "Graph freshness is stale; frontier has {dirty_path_count} dirty path(s), {open_question_count} open question id(s), and {open_gap_count} open gap id(s)." ) - } else if status == EpiphanyGraphFreshnessStatus::Missing { - "Graph freshness requires both an explicit current hint and a graph checkpoint.".to_string() } else { - "Graph freshness is ready.".to_string() + "Canonical RepoModel admission freshness is not available to this legacy thread projection; legacy checkpoint and churn hints cannot prove readiness." + .to_string() }; EpiphanyGraphFreshness { @@ -443,7 +434,7 @@ mod tests { } #[test] - fn graph_ready_requires_checkpoint_explicit_current_hint_and_no_pressure() { + fn legacy_checkpoint_and_current_hint_cannot_authorize_graph_ready() { let state = EpiphanyThreadState { graph_checkpoint: Some(EpiphanyGraphCheckpoint { checkpoint_id: "graph-1".to_string(), @@ -461,11 +452,12 @@ mod tests { watcher: None, }); - assert_eq!(view.graph.status, EpiphanyGraphFreshnessStatus::Ready); + assert_eq!(view.graph.status, EpiphanyGraphFreshnessStatus::Missing); + assert!(view.graph.note.contains("Canonical RepoModel admission")); } #[test] - fn graph_missing_checkpoint_or_hint_is_missing() { + fn legacy_checkpoint_or_hint_alone_is_missing() { let checkpoint_only = EpiphanyThreadState { graph_checkpoint: Some(EpiphanyGraphCheckpoint { checkpoint_id: "graph-1".to_string(), @@ -491,6 +483,29 @@ mod tests { } } + #[test] + fn legacy_noncurrent_hint_does_not_invent_staleness_without_pressure() { + let state = EpiphanyThreadState { + graph_checkpoint: Some(EpiphanyGraphCheckpoint { + checkpoint_id: "graph-1".to_string(), + ..Default::default() + }), + churn: Some(EpiphanyChurnState { + graph_freshness: Some("proposal-semantically-anchored".to_string()), + ..Default::default() + }), + ..Default::default() + }; + + let view = derive_freshness(EpiphanyFreshnessInput { + state: Some(&state), + retrieval_override: None, + watcher: None, + }); + + assert_eq!(view.graph.status, EpiphanyGraphFreshnessStatus::Missing); + } + #[test] fn graph_pressure_overrides_current_hint_and_checkpoint() { let state = EpiphanyThreadState { diff --git a/epiphany-core/src/surfaces/jobs.rs b/epiphany-core/src/surfaces/jobs.rs index ac36df42..bbe37f12 100644 --- a/epiphany-core/src/surfaces/jobs.rs +++ b/epiphany-core/src/surfaces/jobs.rs @@ -454,7 +454,7 @@ mod tests { } #[test] - fn remap_job_consumes_graph_freshness_authority() { + fn remap_job_refuses_legacy_graph_readiness_authority() { let incomplete = EpiphanyThreadState::default(); let jobs = derive_jobs(EpiphanyJobsInput { state: Some(&incomplete), @@ -468,7 +468,7 @@ mod tests { EpiphanyJobStatus::Needed ); - let ready = EpiphanyThreadState { + let forged_legacy_ready = EpiphanyThreadState { graph_checkpoint: Some(EpiphanyGraphCheckpoint { checkpoint_id: "graph-1".to_string(), ..Default::default() @@ -480,7 +480,7 @@ mod tests { ..Default::default() }; let jobs = derive_jobs(EpiphanyJobsInput { - state: Some(&ready), + state: Some(&forged_legacy_ready), retrieval_override: None, }); assert_eq!( @@ -488,7 +488,7 @@ mod tests { .find(|job| job.id == "graph-remap") .unwrap() .status, - EpiphanyJobStatus::Idle + EpiphanyJobStatus::Needed ); } diff --git a/notes/epiphany-current-algorithmic-map.md b/notes/epiphany-current-algorithmic-map.md index e31e000c..a2b476c4 100644 --- a/notes/epiphany-current-algorithmic-map.md +++ b/notes/epiphany-current-algorithmic-map.md @@ -722,15 +722,16 @@ cut or confirmed finding. ```text canonical retrieval state -----------------------> retrieval judgment --+ -graph checkpoint + churn assertion + frontier ---> graph judgment -------+--> reorientation decision --> CRRC/coordinator/launch +legacy graph checkpoint + churn + frontier -----> legacy graph judgment -+--> reorientation decision --> CRRC/coordinator/launch positive watcher changes ------------------------> watcher judgment -----+ durable investigation checkpoint ---------------------------------------+ ``` `derive_freshness` owns the first three judgments. Retrieval Ready becomes -Clean only with an empty dirty-path set; otherwise it derives Stale. Graph -Clean/Ready requires a checkpoint, a recognized-current assertion, and zero -dirty/question/gap pressure. Missing evidence stays Missing/Unknown. Watcher silence stays +Clean only with an empty dirty-path set; otherwise it derives Stale. The legacy +thread graph can prove Stale from explicit frontier pressure, but cannot prove +Clean/Ready because it has no legal Modeling writer and cannot see canonical +RepoModel admission. Missing authority stays Missing/Unknown. Watcher silence stays Unavailable/Unknown because no continuity receipt exists; Changed is positive evidence. `surfaces/jobs.rs` consumes the same graph judgment for remap work. @@ -741,12 +742,13 @@ watcher Dirty/Stale/Changed forces Regather. Path matches, status labels, worker-launch documents, coordinator rows, and CRRC recommendations are derived consumers and forbidden decision writers. -The remaining deletion line is architectural rather than behavioral: -`churn.graph_freshness` is a free string, and the typed graph checkpoint's -revision is not correlated with graph mutation. Replace both authorities with -one typed, revision-bearing Modeling freshness receipt. Until then the strict -conjunction prevents false readiness but must not be mistaken for final typed -ownership. +Canonical RepoModel is the Modeling-owned body. Its exact revision/hash and +Mind-issued `RepoModelAdmissionReceipt` are the only coherent identity boundary +for a future Ready projection; the snapshot's typed source/lifecycle freshness +is its pressure basis. `churn.graph_freshness`, the legacy graph checkpoint, +generic thread patches, and unrelated thread revisions are forbidden readiness +writers. Until canonical authority is supplied to a consumer, Unknown is the +truthful result. This map must change when ownership changes. Historical scars belong in git, evidence, or an explicitly archived note—not in the machine's Modeling state. diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 89247e7e..adca1bed 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -1575,10 +1575,11 @@ Qdrant and Ollama endpoints. The freshness surface no longer converts missing evidence into confidence. Retrieval `Ready` is Clean only when `dirty_paths` is empty; a Ready label with one or more dirty paths derives Stale and therefore cannot authorize Resume. -Graph `Ready` requires all of: a typed graph checkpoint, an explicitly -recognized current `churn.graph_freshness` value, and no dirty paths, open -questions, or open gaps. Missing checkpoint or freshness is unknown/missing, -not ready. A watcher with no buffered changes is also unknown/unavailable: +The legacy thread graph projection cannot produce `Ready`. Explicit frontier +dirty paths, open questions, or open gaps prove Stale; otherwise it is +Missing/Unknown because checkpoint and `churn.graph_freshness` values have no +legal Modeling writer and cannot see canonical RepoModel admission. A watcher +with no buffered changes is also unknown/unavailable: there is no watcher generation, cursor, start boundary, or continuity receipt from which silence could prove cleanliness. Observed changes remain valid positive evidence. @@ -1594,19 +1595,18 @@ freshness judgment for graph-remap work instead of maintaining a second churn string tribunal. Authority map: `derive_freshness` owns freshness judgment from canonical -retrieval state, graph checkpoint, churn assertion, frontier pressure, and +retrieval state, explicit legacy frontier pressure, and positive watcher observations. `recommend_reorientation` owns the action. Their outputs are derived read projections and one reorientation decision. Watcher silence, MVP mappings, jobs, worker launch, coordinator, and CRRC are forbidden readiness/action writers. All launch and operator paths share the same derivation and decision primitives. -The immediate invariant is repaired, but the final owner is not yet pure. -`churn.graph_freshness` remains an `Option`, while -`graph_checkpoint.graph_revision` is not authenticated against graph mutation. -Modeling must eventually replace that split opinion with one typed, -revision-bearing freshness receipt that binds the graph generation, checkpoint, -freshness verdict, and pressure basis. +`churn.graph_freshness` and `graph_checkpoint.graph_revision` remain legacy +data but own no readiness decision. Canonical RepoModel revision/hash plus its +exact Mind-issued `RepoModelAdmissionReceipt` is the future Ready identity +boundary; its typed source/lifecycle freshness supplies pressure. Do not build +a bridge unless the canonical model and receipt are actual projection inputs. The deployment next action is unchanged and permission-bound. Do not reboot without exact live operator approval. With that approval, run the real diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 73ea7c672dba22bfd1e73e2312d86ea9209ccb26..46033cf3a47a366d54f543743b1a9e140d93876d 100644 GIT binary patch delta 411 zcmW+yy-EW?5cU!^m5qX(VZhcTcadm_U=y&5;7_C7W^Z!4xS2ioN4+YDg)d;pYX}x9 zf~Ad*;5&$wVCP)(I%$MtBX+l$-1q;vkUP<#7)+Keuv=>2Y5xt~^| zfU;Ht76X<7mY=7U+SkkK!)rTk?=<4wM$$P=N{`vmS#@J_*!K<;W{ek*8I}t$$WlpY zEimtdHqsS6aH1Ro7sxMiEy=aG@PN&!3P!xNBH@T8rIv5#E zPR##V;LQO6kAclmBsW-Mf6+}k{rseLLFBM^gVW*}w(Vpbq# L+dh?v{q_z3$*vVu diff --git a/state/map.yaml b/state/map.yaml index 773ec72d..7942a3d8 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -126,7 +126,7 @@ active_subgoals: - Use `notes/continuity-cultnet-contracts.md` as the authority map for Continuity's CultNet contract surface. Continuity is the continuity protocol surface: compaction checkpoints, sleep distillation, recovery receipts, stale-turn repair, and continuity refusals preserve what survives rupture without pretending transcript residue is durable state. - Hands now has a first executable runtime-spine receipt artery: `HandsActionIntent`, `HandsActionReview`, `HandsPatchReceipt`, `HandsCommandReceipt`, and `HandsCommitReceipt` are typed CultCache documents in `epiphany-core::hands_gateway`, runtime-spine registers and persists/rereads them, `epiphany-hands-action-smoke` proves the chain without executing shell commands, editing files, or creating a real commit, and the repo-action launch proof profile now requires the full Hands intent/review/patch chain instead of only the patch receipt. `epiphany-mvp-coordinator` no longer treats `continueImplementation` as a passive stop action: it persists a scoped Substrate Gate grant, Hands action intent, and Hands action review into runtime-spine and exposes the receipt ids in the operator step. The gate also carries a structured `recordPassCommand` template for the post-edit/check/commit receipt call. `epiphany-hands-action` records real patch/command/commit receipts against a stored intent/review, refuses unapproved or mismatched gates, and enforces changed-path scope for patch/commit receipts. Its `record-pass` command can load `finalAction.handsActionGate` from `coordinator-summary.json` and emit patch, command, and commit receipts in one post-implementation call. The local MVP wrapper builds this recorder with the other operator binaries. `epiphany-mvp-coordinator-smoke` now includes a deterministic Hands pass proof: forced `continueImplementation`, gate emission, and `record-pass` receipts in the smoke runtime-spine store. Live model-backed verification can now be accepted as receipt-only truth when Soul returns `needs-evidence` without a statePatch; that acceptance advances the coordinator to a real Hands gate. Runtime-spine can detect and summarize a complete post-verification Hands patch/command/commit receipt chain; the coordinator treats that chain as implementation evidence after Soul. Bridge launch context now writes the latest chain into typed internal CultMesh state as `epiphany.cultmesh.work_loop_telemetry.v0`, renders that packet for Soul, and later enriches the same internal Verse packet with Soul acceptance receipt ids for Modeling/modeling. The telemetry packet now includes resolved patch/command/commit payload previews, artifact previews, commit diff preview, source proof notes, and verification assertions so Soul can judge the actual body without a separate evidence-gathering lane. Local Verse prompt context exposes only a sealed `latest_work_loop_summary` digest with telemetry id, Hands receipt ids, path/source/assertion counts, and Soul receipt ids; receipt payload previews, artifact previews, and commit diff previews remain internal telemetry. Tests prove the CultMesh round trip, local Verse digest projection without preview leakage, prompt rendering of the digest, Soul launch projection, receipt payload previews, artifact previews, and Modeling launch projection. Worker auto-tool continuation preserves real Soul evidence trails under an explicit hard ceiling while sealing repeated identical typed tool intent fingerprints as `tool-loop-stalled`. The work loop is dependency-shaped: Hands produces consequence receipts, Soul verifies those receipts and the changed body, Modeling updates the machine model from verified consequence, and only then should Self route the next Hands turn. - Soul result recovery is typed state, not manual broom work. Failed Verification/Soul results remain terminal reviewable lane results; a `roleFailureReview` acceptance receipt with status `superseded` records operator review and lets Self relaunch Soul against current evidence. Complete typed Hands receipt triplets (`hands-patch-*`, `hands-command-*`, `hands-commit-*`) count as implementation evidence for coordinator coverage, so a Soul finding that verifies the Hands chain routed through work-loop telemetry covers the current modeling context even when it does not repeat the accepted Modeling evidence id. - - Native MVP status must share the same typed inputs as live app-server status before it recommends coordinator actions. CRRC/reorientation in native status derives freshness through `derive_freshness` from `EpiphanyThreadState` instead of hand-filled unknowns, and native coordinator signals load typed runtime-spine role findings before deciding whether completed Modeling/Soul results are accepted or reviewable. Retrieval Ready is Clean only when its dirty-path set is empty; a Ready label carrying dirty paths derives Stale. Graph readiness requires a graph checkpoint, an explicitly recognized current `churn.graph_freshness` value, and zero frontier dirty paths, open questions, or open gaps. Missing checkpoint/freshness is unknown rather than ready. Watcher silence is unknown because the watcher has no continuity-bearing receipt; only observed changes are positive evidence. The status surface may seal long findings for operators, but Self must receive structured role truth from runtime-spine. + - Native MVP status must share the same typed inputs as live app-server status before it recommends coordinator actions. CRRC/reorientation in native status derives freshness through `derive_freshness` from `EpiphanyThreadState` instead of hand-filled unknowns, and native coordinator signals load typed runtime-spine role findings before deciding whether completed Modeling/Soul results are accepted or reviewable. Retrieval Ready is Clean only when its dirty-path set is empty; a Ready label carrying dirty paths derives Stale. The legacy thread graph projection cannot authorize Ready: explicit frontier dirty paths/questions/gaps prove Stale, while their absence remains Missing/Unknown because this projection has neither a legal Modeling writer nor canonical RepoModel admission authority. Watcher silence is unknown because the watcher has no continuity-bearing receipt; only observed changes are positive evidence. The status surface may seal long findings for operators, but Self must receive structured role truth from runtime-spine. - Runtime auto-tool continuation now has an executable proof seam. `ToolLoopGuard` owns repeated tool-request detection in `epiphany-openai-runtime`, the production repeated-loop path uses the same helper that tests call to fail the outer worker job, and tests prove changing tool requests do not stall while three identical consecutive pending tool sets return `tool-loop-stalled` and persist a failed worker result. Soul accepted the bounded proof for commit `ce20529e`; the remaining work-loop invariant is Modeling admission, not more Hands work. - Modeling must update the machine map before Self routes back to Hands. A completed Modeling/Modeling result with no reviewable `statePatch` is not a successful map update; it is an unreviewable lane result that must be superseded through typed review and relaunched with the role-specific output schema carried into the model request. This path is now live-proved: run `local-20260613-204521` accepted the Modeling `statePatch` for the Soul-verified `ToolLoopGuard`/Hands receipt-chain consequence and only then emitted a new `continueImplementation` Hands gate. - Aetheria task `019f3fe1-9f69-74e3-97fb-a18490d72119` is positive dogfood evidence for the Epiphany organ hypothesis, not merely for a persistent Modeling index: Modeling named migration bodies, Eyes changed the plan by finding substrate defects, Hands received bounded disjoint cuts, Soul rejected partial-index visibility after a plausible green fix, Imagination corrected roadmap mythology, and Self preserved dependency order across Aetheria/EveUnity/CultLib. The machine must preserve this causal organ loop in typed artifacts: findings alter plans, plans constrain Hands, Soul can falsify claimed completion, and Self routes from accepted evidence without collapsing the judgments into transcript memory. Modeling's typed searchable anatomy/freshness/frontier/index is connective tissue serving that loop, not the end state. Preserve the successful prompt shapes: exact compile boundary plus deletion line for research, hostile negative acceptance criteria for Hands, explicit permission to stop and name a missing primitive, and ownership review beyond green tests. @@ -192,7 +192,7 @@ accepted_design: - Durable `job_bindings` now form a thin Epiphany-owned launcher seam: new specialist/reorient launches write only binding id, kind, scope, owner role, authority scope, linked ids, and an optional blocking reason. Runtime lifecycle ids live in `runtime_links` and runtime-spine job/result records, not in durable job bindings. - The `jobs` view lens is a read-only job/progress reflection: it derives indexing, remap, verification, and specialist slots from authoritative state and retrieval summaries, then projects heartbeat-backed bindings as pending heartbeat turns. It is not the scheduler, notification stream, durable runtime job table, or SQLite reader. - `thread/epiphany/jobsUpdated` is sealed legacy Codex evacuation telemetry. The handler no longer emits Epiphany updates from old runtime `agent_job_progress:{json}` background events; heartbeat/runtime-spine is the live activation and result path. - - Native `derive_freshness` is the read-only freshness judgment: canonical retrieval state, graph checkpoint, churn freshness, frontier pressure, and positive watcher changes are its inputs; retrieval/graph/watcher judgments are its outputs. Watcher silence, MVP adapters, jobs, reorientation, CRRC, and launch projection are forbidden readiness writers. `surfaces/jobs.rs` consumes the same derived graph judgment for remap work instead of interpreting the churn string independently. The remaining authority scar is explicit: `churn.graph_freshness` is still a free string and `graph_checkpoint.graph_revision` is not correlated with graph mutation. They must later collapse into one typed, revision-bearing Modeling freshness receipt. + - Native `derive_freshness` is the read-only freshness judgment: canonical retrieval state, explicit legacy frontier pressure, and positive watcher changes are its inputs; retrieval/legacy-graph/watcher judgments are its outputs. Watcher silence, legacy graph checkpoints, `churn.graph_freshness`, MVP adapters, jobs, reorientation, CRRC, and launch projection are forbidden readiness writers. `surfaces/jobs.rs` consumes the same derived graph judgment and therefore keeps remap Needed when only legacy hints claim readiness. Canonical RepoModel revision/hash plus its exact Mind-issued `RepoModelAdmissionReceipt` is the only coherent identity boundary for a future Ready projection; typed snapshot source/lifecycle freshness is its pressure basis. - `thread/epiphany/context` is the targeted read-only state-shard surface: `epiphany-core` selects graph nodes/edges, active frontier, checkpoint, observations, and evidence from authoritative typed state while app-server only adapts protocol, without mutating or notifying. - `thread/epiphany/graphQuery` is the read-only graph traversal surface over authoritative typed state: `epiphany-core` returns explicit nodes, path/symbol matches, bounded neighbors, and frontier neighborhoods with architecture/dataflow links while app-server only adapts protocol, without mutating, notifying, indexing, scheduling, proposing, or promoting. - The `pressure` view lens derives context pressure from current context usage, not cumulative token spend, against auto-compact/context limits without compacting, scheduling, mutating, or notifying; compaction prep starts at 80% of the active limit. @@ -315,7 +315,7 @@ landed_baseline: - Use `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-phase6-scene-smoke` before modifying scene projection behavior. - Use focused `cargo test -p codex-app-server --lib map_epiphany_jobs` before modifying job/progress reflection behavior. - Use focused Codex Rust tests before modifying launch/interrupt authority over the thin job seam. - - Use `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-phase6-freshness-smoke` before modifying freshness reflection behavior. + - The retired `epiphany-phase6-freshness-smoke` binary does not exist and must not be summoned from stale doctrine. Verify freshness reflection with focused `surfaces::freshness`/consumer tests plus the full `epiphany-core` library suite until a new native smoke earns an actual runtime invariant. - Use focused Rust app-server invalidation/freshness tests before modifying watcher-backed invalidation behavior inside freshness reflection; add a native smoke before broadening that surface. - Use `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-phase6-context-smoke` before modifying targeted context-shard behavior. - Use `cargo run --manifest-path .\epiphany-core\Cargo.toml --bin epiphany-phase6-graph-query-smoke` before modifying graph traversal behavior.