diff --git a/epiphany-core/src/bin/epiphany-daemon-supervisor.rs b/epiphany-core/src/bin/epiphany-daemon-supervisor.rs index d251d9af..1f5b8971 100644 --- a/epiphany-core/src/bin/epiphany-daemon-supervisor.rs +++ b/epiphany-core/src/bin/epiphany-daemon-supervisor.rs @@ -834,18 +834,19 @@ fn require_supervisor_bootstrap(args: &Args) -> Result<()> { fn reconcile(args: Args) -> Result<()> { require_supervisor_bootstrap(&args)?; - let context = query_epiphany_local_verse_context(&args.store, args.runtime_id.clone())?; - let daemon_status = context - .daemon_statuses - .iter() - .find(|status| status.daemon_id == args.daemon_id) + let daemon_status = load_epiphany_cultmesh_daemon_status( + &args.store, + args.runtime_id.clone(), + &args.daemon_id, + )? .with_context(|| format!("local Verse has no daemon status for {:?}", args.daemon_id))?; + let brake = load_epiphany_cultmesh_swarm_brake(&args.store, args.runtime_id.clone())?; - let mut policy = load_policy_or_override(&args, daemon_status)?; + let mut policy = load_policy_or_override(&args, &daemon_status)?; let output = reconcile_daemon_status( &args, - &context, - daemon_status, + brake.as_ref(), + &daemon_status, &mut policy, args.force, false, @@ -3509,7 +3510,7 @@ fn run_tick(args: &Args, iteration: u64, next_wake_utc: Option) -> Resul match reconcile_daemon_status( &args, - &context, + context.swarm_brake.as_ref(), &scheduled_status, &mut policy, forced, @@ -3697,14 +3698,14 @@ fn load_policy_or_override( fn reconcile_daemon_status( args: &Args, - context: &EpiphanyLocalVerseContext, + brake: Option<&EpiphanyCultMeshSwarmBrakeEntry>, daemon_status: &EpiphanyCultMeshDaemonStatusEntry, policy: &mut EpiphanyCultMeshDaemonRestartPolicyEntry, force: bool, scheduled: bool, observed_heartbeat_stale: bool, ) -> Result { - assert_swarm_brake_allows_daemon_poke(context, daemon_status)?; + assert_swarm_brake_allows_daemon_poke(brake, daemon_status)?; let now = Utc::now(); let needs_restart = force || daemon_status.status != "ready"; if !needs_restart { @@ -4281,10 +4282,10 @@ fn run_restart_command( } fn assert_swarm_brake_allows_daemon_poke( - context: &EpiphanyLocalVerseContext, + brake: Option<&EpiphanyCultMeshSwarmBrakeEntry>, daemon: &EpiphanyCultMeshDaemonStatusEntry, ) -> Result<()> { - let Some(brake) = context.swarm_brake.as_ref() else { + let Some(brake) = brake else { return Ok(()); }; if brake.status != "engaged" { @@ -4449,6 +4450,23 @@ mod service_lifecycle_brake_authority_tests { } } + fn daemon() -> EpiphanyCultMeshDaemonStatusEntry { + EpiphanyCultMeshDaemonStatusEntry { + schema_version: "epiphany.cultmesh.daemon_status.v0".into(), + daemon_id: "epiphany-daemon-hands".into(), + cluster_id: "local".into(), + body_domain: "repo:F:/Projects/Epiphany".into(), + daemon_surface_id: "cultmesh://daemon/hands".into(), + eve_surface_id: "eve://daemon/hands".into(), + status: "degraded".into(), + last_heartbeat_utc: "2026-08-11T00:00:00Z".into(), + supported_actions: vec!["pokeDaemon".into()], + operator_action: "pokeDaemon".into(), + private_state_exposed: false, + notes: Vec::new(), + } + } + #[test] fn cognitive_scheduler_brake_does_not_claim_service_physiology() { let cognitive = brake(&[ @@ -4463,6 +4481,17 @@ mod service_lifecycle_brake_authority_tests { assert!(assert_swarm_brake_allows_service_lifecycle_entry(Some(&lifecycle)).is_err()); } } + + #[test] + fn daemon_poke_reads_the_narrow_brake_without_weakening_scope() { + let daemon = daemon(); + let cognitive = brake(&["heartbeat.scheduler", "coordinator.run"]); + assert!(assert_swarm_brake_allows_daemon_poke(Some(&cognitive), &daemon).is_ok()); + for surface in ["daemon.lifecycle_poke", "daemon.*", "*"] { + let lifecycle = brake(&[surface]); + assert!(assert_swarm_brake_allows_daemon_poke(Some(&lifecycle), &daemon).is_err()); + } + } } #[cfg(test)] @@ -4637,6 +4666,19 @@ mod semantic_projector_authority_tests { assert!(!body.contains("query_epiphany_local_verse_context")); } + #[test] + fn direct_reconcile_reads_only_exact_status_policy_and_brake_families() { + let source = include_str!("epiphany-daemon-supervisor.rs"); + let start = source.find("fn reconcile(").unwrap(); + let tail = &source[start..]; + let end = tail.find("\nfn ").unwrap(); + let body = &tail[..end]; + assert!(body.contains("load_epiphany_cultmesh_daemon_status")); + assert!(body.contains("load_policy_or_override")); + assert!(body.contains("load_epiphany_cultmesh_swarm_brake")); + assert!(!body.contains("query_epiphany_local_verse_context")); + } + #[test] fn workspace_coverage_launch_uses_only_specialized_process_authority() { let source = include_str!("epiphany-daemon-supervisor.rs"); diff --git a/notes/epiphany-current-algorithmic-map.md b/notes/epiphany-current-algorithmic-map.md index 99d5f42d..87f86c5e 100644 --- a/notes/epiphany-current-algorithmic-map.md +++ b/notes/epiphany-current-algorithmic-map.md @@ -3680,3 +3680,10 @@ depends on several state families. - Verification: the exact loader returns only the requested typed envelope and remains non-creating on an absent store; a source-boundary test refuses aggregate-query regression in `write_policy`. + +Direct `reconcile` also reads only one exact daemon status, one exact policy, +and the canonical brake. Its consequence helper accepts the brake itself, not +an aggregate context. Scheduler tick and cluster runbook keep aggregate context +because their output enumerates multiple daemon policies, statuses, topology +rows, and brake scope. Focused tests prove the direct source boundary and that +the narrow brake input preserves lifecycle-poke refusal semantics. diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index d793c75a..7d08d6da 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -15,6 +15,14 @@ topology, policies, statuses, and brake state. The exact loader test and the negative source-boundary test pass. Continue classifying aggregate consumers; do not package until a meaningful bounded batch earns a live body. +Direct single-daemon reconciliation now uses the same narrow anatomy: one exact +daemon status, its exact policy, and the canonical brake. The brake helper no +longer accepts an aggregate context; focused tests prove protected +`daemon.lifecycle_poke` scope still refuses while the cognitive scheduler brake +does not claim service physiology. Scheduler tick and cluster runbook retain +aggregate reads because they genuinely enumerate several state families. The +remaining supervisor aggregate consumers are therefore classified. + ## Actual receipt-bound turnover accepted - 2026-08-11 Exact pushed `c9a2a979` is now the active actual c006 body. Under a bounded diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 246b35b1..bc91efce 100644 Binary files a/state/ledgers.msgpack and b/state/ledgers.msgpack differ diff --git a/state/map.yaml b/state/map.yaml index 5eb964c4..934a4442 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -36,7 +36,7 @@ invariants: current_status: summary: Epiphany is a supervised engineering alpha on Starfire, not deployment-ready. Exact b8138a6b active-child SIGTERM and restart, exact 9f369528 deterministic warm packaging, exact c930f505 cross-container ownership, exact ed15f83a resident lifecycle retention, exact 16c4b19f coordinator receipt and Heartbeat artifact retention, exact cce2b8ac narrow model-generation retention, exact eea15e82 model-turn JSON ingress, exact b1e8c89a semantic unattempted-generation retention, exact 6bc3ec3f semantic physical-epoch retirement, and exact 44230a05 Persona conversation retention are proven. Gamecult-ops 059821f owns Yggdrasil stream retention and exact 6ee08a4 owns stable Starfire Persona-permit firewall ingress. Exact 16c4b19f genuine idle and exact a987d2f7 active cognition completed 900-pulse bounded plateaus. Runtime-owned typed fulfillment is accepted live under exact 6dd9b132. Yggdrasil is the small public crossing body, never the release forge. - latest_phase: Exact c9a2a979 is live and braked on actual c006 after accepted two-grant receipt-bound turnover at resident revision 34. The subsequent nervous-system source cut makes one exact daemon-status envelope own restart-policy identity; the policy writer no longer reads unrelated aggregate local-Verse state, and focused positive/negative tests pass. + latest_phase: Exact c9a2a979 is live and braked on actual c006 after accepted two-grant receipt-bound turnover at resident revision 34. The subsequent nervous-system source cut gives restart-policy writing and direct single-daemon reconciliation exact status/policy/brake inputs. Scheduler tick and cluster runbook retain aggregate context because they enumerate multiple owning families. Focused source and brake-semantics tests pass. operational_state: local_worktree: exact_c9a2a979_actual_internal_turnover_accepted_next_organ_audit operator_wireguard: restored @@ -70,7 +70,7 @@ current_status: yggdrasil_epiphany_service_contract: repaired_in_gamecult_ops_812b427_not_installed resident_physiology: c006_exact_c9a2a979_alive_braked_revision_34_after_two_receipt_bound_continuation_grants unresolved_authority: Coordinator receipt, Heartbeat pulse-artifact, genuine-idle and active resource plateaus, exact-grant terminality, restart-persistent cooldown refusal, schedule/action issuance cardinality, runtime-owned typed fulfillment, all three packaged fulfilled-before-receipt lanes, narrow model-generation retention, published model-turn JSON ingress, semantic logical/physical retention, Persona conversation retention, stable Starfire firewall ownership, completed model-adapter session archival, normal coordinator lifecycle opening/error closure/legacy repair/archival, co-resident resident lifecycle retention, authenticated outer-worker attempt retention, deployed supervisor/projector journald ownership, and Docker named-volume atomic snapshot visibility are accepted live. Starfire's Docker Desktop F: bind is rejected for mutable authority after an exact packaged lockless reader observed an empty published snapshot during writer interruption. Historical migrated semantic attempts without recorded physical namespace remain durable and non-retirable. One completed Discord consequence remains blocked by the absent Yggdrasil credential. - next_action: Keep actual c006 exact c9a2a979 alive under its cognitive brake. Continue the narrow local-Verse consumer audit at direct single-daemon reconciliation: it needs one exact daemon status, its exact restart policy, and the canonical brake, not Persona, Hands, receipt, or unrelated telemetry families. Preserve aggregate context for scheduler tick and cluster runbook enumeration. Yggdrasil never builds. + next_action: Keep actual c006 exact c9a2a979 alive under its cognitive brake. Continue the narrow local-Verse consumer audit at `epiphany-verse-query poke-daemon`: a single target needs one exact status, the canonical brake, and its exact written intent, not two aggregate Verse projections. Preserve aggregate reads for poke-all, triage, and operator reports that genuinely enumerate daemon state. Yggdrasil never builds. active_subgoals: - Prove Persona, Self, Eyes, Modeling, Imagination, Hands, Soul, Mind, Continuity, and nervous-system behavior individually. diff --git a/state/scratch.md b/state/scratch.md index 63eabaaa..47b8faa5 100644 --- a/state/scratch.md +++ b/state/scratch.md @@ -4,8 +4,8 @@ Disposable working memory for one bounded rite. ## Current Subgoal -Cut direct single-daemon reconciliation away from the aggregate local Verse -projection. +Cut single-target `epiphany-verse-query poke-daemon` away from the aggregate +local Verse projection. ## Accepted actual finding @@ -15,20 +15,19 @@ refused stale action with no consequence. Resident state is idle at revision 34, protected consequence families are byte-identical, readiness is active, and the cognitive brake is engaged. -## Authority map for direct reconciliation input +## Authority map for single-target poke input -- Owner: the requested daemon's exact status and restart policy own direct - reconciliation; the canonical brake owns consequence refusal. -- Inputs: one daemon status, one exact policy or explicit override, one brake, - and explicit CLI force/reason fields. -- Outputs: one bounded daemon-poke attempt or a typed no-op/refusal. -- Derived state: aggregate local Verse context is not direct reconciliation - authority. +- Owner: the requested daemon's exact status owns target identity; the canonical + brake owns poke refusal; the exact written intent owns post-write existence. +- Inputs: one daemon ID/status, one brake, and explicit operator reason/intent + fields. +- Outputs: one typed daemon-poke intent and pending-lifecycle-owner projection. +- Derived state: aggregate local Verse context is not single-target authority. - Forbidden writers: Persona, Hands, unrelated receipts, telemetry, and other daemon rows cannot influence or be read by this command. -- Shared paths: direct `reconcile` and its action helper must consume the same - narrow brake input; scheduler enumeration remains separate. -- Cut line: replace direct reconcile's whole-context query and context-shaped - brake helper without weakening scope/surface checks. -- Verification: source-boundary negative, engaged/released brake behavior, and - exact-status absence refusal. +- Shared paths: single poke uses the same narrow brake predicate as bulk poke; + bulk enumeration remains separate. +- Cut line: remove both aggregate queries from the single-target command and + verify the exact intent by key after its write. +- Verification: source-boundary negative, brake scope preservation, missing + daemon refusal, and exact intent round trip.