diff --git a/epiphany-core/src/bin/epiphany-daemon-supervisor.rs b/epiphany-core/src/bin/epiphany-daemon-supervisor.rs index a8d275b1..fcfbab82 100644 --- a/epiphany-core/src/bin/epiphany-daemon-supervisor.rs +++ b/epiphany-core/src/bin/epiphany-daemon-supervisor.rs @@ -32,7 +32,7 @@ use sha2::Digest; use sha2::Sha256; use std::env; use std::fs; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use std::process::Command; use std::process::Stdio; @@ -48,6 +48,9 @@ fn main() -> Result<()> { "service-plan" | "install-service" => service_plan(args), "service-launch" | "launch-service" | "start-service" => service_launch(args), "service-runbook" | "runbook-service" => service_runbook(args), + "repo-work-service-audit" + | "repo-work-service-readiness" + | "repo-work-queue-runner-audit" => repo_work_service_audit(args), "cluster-service-runbook" | "cluster-daemon-runbook" => cluster_daemon_runbook(args), "cluster-windows-service-install" | "cluster-service-install-plan" @@ -98,7 +101,7 @@ fn main() -> Result<()> { "windows-service-stop" | "service-stop" => windows_service_control(args, "stop"), "policy" | "write-policy" => write_policy(args), other => anyhow::bail!( - "unknown command {other:?}; use reconcile, tick, serve, service-plan, service-launch, service-runbook, cluster-service-runbook, cluster-service-install-plan, cluster-service-audit, cluster-service-start, cluster-service-stop, cluster-service-execution-readiness, cluster-service-execution-runbook, cluster-service-execution-audit, windows-service-install, windows-service-execution-readiness, windows-service-execution-runbook, windows-service-execution-audit, service-execution-audit-smoke, windows-service-reconcile, windows-service-status, windows-service-start, windows-service-stop, or policy" + "unknown command {other:?}; use reconcile, tick, serve, service-plan, service-launch, service-runbook, repo-work-service-audit, cluster-service-runbook, cluster-service-install-plan, cluster-service-audit, cluster-service-start, cluster-service-stop, cluster-service-execution-readiness, cluster-service-execution-runbook, cluster-service-execution-audit, windows-service-install, windows-service-execution-readiness, windows-service-execution-runbook, windows-service-execution-audit, service-execution-audit-smoke, windows-service-reconcile, windows-service-status, windows-service-start, windows-service-stop, or policy" ), } } @@ -343,6 +346,201 @@ fn service_runbook(args: Args) -> Result<()> { Ok(()) } +fn repo_work_service_audit(args: Args) -> Result<()> { + seed_epiphany_local_verse_context( + &args.store, + args.runtime_id.clone(), + Utc::now().to_rfc3339(), + )?; + let context = query_epiphany_local_verse_context(&args.store, args.runtime_id.clone())?; + assert_swarm_brake_allows_service_lifecycle(&context)?; + let started_at = Utc::now(); + let receipts = load_epiphany_cultmesh_daemon_service_lifecycle_receipts( + &args.store, + &args.runtime_id, + )?; + let service_receipts = receipts + .iter() + .filter(|receipt| receipt.service_id == args.service_id) + .collect::>(); + let plan = latest_service_lifecycle_receipt(&service_receipts, "install-plan"); + let runbook = latest_service_lifecycle_receipt(&service_receipts, "runbook"); + let launch = latest_service_lifecycle_receipt(&service_receipts, "launch"); + + let mut missing_checks = Vec::new(); + let mut failed_checks = Vec::new(); + + let plan_status = receipt_status_or_missing(plan); + if plan.is_none() { + missing_checks.push("install-plan".to_string()); + } else if plan_status != "planned" { + failed_checks.push(format!("install-plan status {plan_status}")); + } + + let runbook_status = receipt_status_or_missing(runbook); + if runbook.is_none() { + missing_checks.push("runbook".to_string()); + } else if runbook_status != "written" { + failed_checks.push(format!("runbook status {runbook_status}")); + } + let runbook_ref = runbook + .map(|receipt| receipt.operator_artifact_ref.as_str()) + .unwrap_or("none"); + let runbook_artifact_status = service_artifact_status(runbook_ref); + let runbook_sha256 = local_file_sha256(runbook_ref).unwrap_or_else(|| "none".to_string()); + if runbook.is_some() && runbook_artifact_status != "present" { + failed_checks.push(format!("runbook artifact {runbook_artifact_status}")); + } + + let launch_status = receipt_status_or_missing(launch); + let launch_exit_code = launch.and_then(|receipt| receipt.exit_code); + if launch.is_none() { + missing_checks.push("launch".to_string()); + } else { + if launch_status != "completed" { + failed_checks.push(format!("launch status {launch_status}")); + } + if launch_exit_code != Some(0) { + failed_checks.push(format!( + "launch exit code {}", + launch_exit_code + .map(|code| code.to_string()) + .unwrap_or_else(|| "none".to_string()) + )); + } + } + + let private_state_exposed = service_receipts + .iter() + .any(|receipt| receipt.private_state_exposed); + if private_state_exposed { + failed_checks.push("private state exposed".to_string()); + } + + let status = if missing_checks.is_empty() && failed_checks.is_empty() { + "complete" + } else { + "incomplete" + }; + let next_safe_move = if missing_checks.iter().any(|check| check == "install-plan") + || failed_checks + .iter() + .any(|check| check.starts_with("install-plan ")) + { + "tools/epiphany_local_run.ps1 -Mode repo-work-service-plan" + } else if missing_checks.iter().any(|check| check == "runbook") + || failed_checks.iter().any(|check| check.starts_with("runbook ")) + { + "tools/epiphany_local_run.ps1 -Mode repo-work-service-runbook" + } else if missing_checks.iter().any(|check| check == "launch") + || failed_checks.iter().any(|check| check.starts_with("launch ")) + { + "tools/epiphany_local_run.ps1 -Mode repo-work-service-launch" + } else { + "continue repo-swarm MVP planner/interpreter hardening" + }; + + let receipt = service_lifecycle_receipt( + &args, + "repo-work-service-audit", + status, + "repo-work-service-audit".to_string(), + vec![ + format!("plan={plan_status}"), + format!("runbook={runbook_status}"), + format!("runbookArtifact={runbook_artifact_status}"), + format!("launch={launch_status}"), + format!( + "launchExitCode={}", + launch_exit_code + .map(|code| code.to_string()) + .unwrap_or_else(|| "none".to_string()) + ), + format!("missing={}", missing_checks.len()), + format!("failed={}", failed_checks.len()), + ], + None, + None, + started_at, + Some(Utc::now()), + Some(format!( + "service://{}/repo-work-service-audit", + sanitize_id(&args.service_id) + )), + ); + let written = write_epiphany_cultmesh_daemon_service_lifecycle_receipt( + &args.store, + args.runtime_id.clone(), + receipt, + )?; + println!( + "{}", + serde_json::to_string_pretty(&json!({ + "schemaVersion": "epiphany.repo_work_service_audit.v0", + "status": status, + "store": args.store, + "runtimeId": args.runtime_id, + "serviceId": written.service_id, + "schedulerId": written.scheduler_id, + "receiptId": written.receipt_id, + "planStatus": plan_status, + "runbookStatus": runbook_status, + "runbookArtifactStatus": runbook_artifact_status, + "runbookArtifactRef": runbook_ref, + "runbookSha256": runbook_sha256, + "launchStatus": launch_status, + "launchExitCode": launch_exit_code, + "missingChecks": missing_checks, + "failedChecks": failed_checks, + "lifecycleOwner": "Idunn", + "hostedBody": "repo-work", + "mutatesServiceManager": false, + "requiresElevatedAuthority": false, + "privateStateExposed": private_state_exposed, + "nextSafeMove": next_safe_move, + }))? + ); + Ok(()) +} + +fn latest_service_lifecycle_receipt<'a>( + receipts: &'a [&EpiphanyCultMeshDaemonServiceLifecycleReceiptEntry], + action: &str, +) -> Option<&'a EpiphanyCultMeshDaemonServiceLifecycleReceiptEntry> { + receipts + .iter() + .copied() + .filter(|receipt| receipt.action == action) + .max_by_key(|receipt| { + receipt + .completed_at_utc + .as_deref() + .unwrap_or(&receipt.started_at_utc) + }) +} + +fn receipt_status_or_missing( + receipt: Option<&EpiphanyCultMeshDaemonServiceLifecycleReceiptEntry>, +) -> String { + receipt + .map(|receipt| receipt.status.clone()) + .unwrap_or_else(|| "missing".to_string()) +} + +fn service_artifact_status(artifact_ref: &str) -> &'static str { + if artifact_ref.trim().is_empty() || artifact_ref == "none" { + return "none"; + } + let path = Path::new(artifact_ref); + if path.is_file() { + return "present"; + } + if artifact_ref.contains("://") { + return "external-ref"; + } + "missing" +} + fn cluster_daemon_runbook(args: Args) -> Result<()> { seed_epiphany_local_verse_context( &args.store, @@ -3171,6 +3369,9 @@ impl Args { | "start-service" | "service-runbook" | "runbook-service" + | "repo-work-service-audit" + | "repo-work-service-readiness" + | "repo-work-queue-runner-audit" | "cluster-service-runbook" | "cluster-daemon-runbook" | "cluster-windows-service-install" diff --git a/epiphany-core/src/bin/epiphany-repo-work-service-lifecycle-smoke.rs b/epiphany-core/src/bin/epiphany-repo-work-service-lifecycle-smoke.rs index f2e69859..86d4838b 100644 --- a/epiphany-core/src/bin/epiphany-repo-work-service-lifecycle-smoke.rs +++ b/epiphany-core/src/bin/epiphany-repo-work-service-lifecycle-smoke.rs @@ -195,38 +195,9 @@ fn run_smoke(args: Args) -> Result { ], &service_args, )?; - - require_eq(&plan, &["status"], "planned")?; - require_eq(&runbook, &["status"], "written")?; - require_eq(&launch, &["status"], "completed")?; - require_eq(&plan, &["serviceId"], service_id)?; - require_eq(&runbook, &["serviceId"], service_id)?; - require_eq(&launch, &["serviceId"], service_id)?; - require_bool(&plan, &["privateStateExposed"], false)?; - require_bool(&runbook, &["privateStateExposed"], false)?; - require_bool(&launch, &["privateStateExposed"], false)?; - require_i64(&launch, &["exitCode"], 0)?; - require_text_array_contains(&plan, &["args"], "queue-run")?; - require_text_array_contains(&plan, &["args"], "--dry-run")?; - require_text_array_contains(&plan, &["args"], path_str(&repo)?)?; - require_text_array_contains(&runbook, &["args"], "queue-run")?; - require_text_array_contains(&runbook, &["args"], "--dry-run")?; - - let runbook_text = fs::read_to_string(&runbook_path) - .with_context(|| format!("failed to read {}", runbook_path.display()))?; - require_text( - &runbook_text, - "Generated by epiphany-daemon-supervisor service-runbook", - )?; - require_text(&runbook_text, "Start-Process")?; - require_text(&runbook_text, "-WindowStyle Hidden")?; - require_text(&runbook_text, "queue-run")?; - require_text(&runbook_text, "--dry-run")?; - let runbook_sha256 = sha256_file(&runbook_path)?; - - let receipts = receipt_directory(&manifest, &root, &local_verse, runtime_id)?; - let receipt_rows = rows(&receipts); - let launch_row = receipt_rows.iter().find(|row| { + let launch_receipts = receipt_directory(&manifest, &root, &local_verse, runtime_id)?; + let launch_rows = rows(&launch_receipts); + let launch_row = launch_rows.iter().find(|row| { row.get("family").and_then(Value::as_str) == Some("service-lifecycle") && row.get("serviceId").and_then(Value::as_str) == Some(service_id) && row @@ -241,6 +212,85 @@ fn run_smoke(args: Args) -> Result { }; require_eq(launch_row, &["status"], "completed")?; + let audit = daemon_supervisor( + &manifest, + &root, + &local_verse, + &[ + "repo-work-service-audit", + "--store", + path_str(&local_verse)?, + "--runtime-id", + runtime_id, + "--daemon-id", + daemon_id, + "--scheduler-id", + scheduler_id, + "--service-id", + service_id, + "--service-command", + path_str(&epiphany_work_bin)?, + "--reason", + "Idunn-owned readiness audit for Self-owned repo work queue-run pulse.", + "--cwd", + path_str(&root)?, + ], + &service_args, + )?; + + require_eq(&plan, &["status"], "planned")?; + require_eq(&runbook, &["status"], "written")?; + require_eq(&launch, &["status"], "completed")?; + require_eq(&audit, &["status"], "complete")?; + require_eq(&plan, &["serviceId"], service_id)?; + require_eq(&runbook, &["serviceId"], service_id)?; + require_eq(&launch, &["serviceId"], service_id)?; + require_eq(&audit, &["serviceId"], service_id)?; + require_bool(&plan, &["privateStateExposed"], false)?; + require_bool(&runbook, &["privateStateExposed"], false)?; + require_bool(&launch, &["privateStateExposed"], false)?; + require_bool(&audit, &["privateStateExposed"], false)?; + require_i64(&launch, &["exitCode"], 0)?; + require_i64(&audit, &["launchExitCode"], 0)?; + require_text_array_contains(&plan, &["args"], "queue-run")?; + require_text_array_contains(&plan, &["args"], "--dry-run")?; + require_text_array_contains(&plan, &["args"], path_str(&repo)?)?; + require_text_array_contains(&runbook, &["args"], "queue-run")?; + require_text_array_contains(&runbook, &["args"], "--dry-run")?; + require_eq(&audit, &["planStatus"], "planned")?; + require_eq(&audit, &["runbookStatus"], "written")?; + require_eq(&audit, &["runbookArtifactStatus"], "present")?; + require_eq(&audit, &["launchStatus"], "completed")?; + + let runbook_text = fs::read_to_string(&runbook_path) + .with_context(|| format!("failed to read {}", runbook_path.display()))?; + require_text( + &runbook_text, + "Generated by epiphany-daemon-supervisor service-runbook", + )?; + require_text(&runbook_text, "Start-Process")?; + require_text(&runbook_text, "-WindowStyle Hidden")?; + require_text(&runbook_text, "queue-run")?; + require_text(&runbook_text, "--dry-run")?; + let runbook_sha256 = sha256_file(&runbook_path)?; + + let audit_receipts = receipt_directory(&manifest, &root, &local_verse, runtime_id)?; + let audit_rows = rows(&audit_receipts); + let audit_row = audit_rows.iter().find(|row| { + row.get("family").and_then(Value::as_str) == Some("service-lifecycle") + && row.get("serviceId").and_then(Value::as_str) == Some(service_id) + && row + .get("serviceRoute") + .and_then(Value::as_str) + == Some("epiphany-repo-work-queue-runner::repo-work-service-audit") + }); + let Some(audit_row) = audit_row else { + return Err(anyhow!( + "receipt directory did not expose audit service-lifecycle row for {service_id}" + )); + }; + require_eq(audit_row, &["status"], "complete")?; + let summary = json!({ "schemaVersion": "epiphany.repo_work_service_lifecycle_smoke.v0", "status": "ok", @@ -259,6 +309,13 @@ fn run_smoke(args: Args) -> Result { "launchStatus": launch["status"], "launchReceiptId": launch["receiptId"], "launchExitCode": launch["exitCode"], + "auditStatus": audit["status"], + "auditReceiptId": audit["receiptId"], + "auditPlanStatus": audit["planStatus"], + "auditRunbookStatus": audit["runbookStatus"], + "auditRunbookArtifactStatus": audit["runbookArtifactStatus"], + "auditLaunchStatus": audit["launchStatus"], + "auditLaunchExitCode": audit["launchExitCode"], "serviceCommand": plan["command"], "serviceArgs": plan["args"], "lifecycleOwner": "Idunn", diff --git a/notes/epiphany-repo-swarm-mvp-contract.md b/notes/epiphany-repo-swarm-mvp-contract.md index 2cc7fca8..2f7dc580 100644 --- a/notes/epiphany-repo-swarm-mvp-contract.md +++ b/notes/epiphany-repo-swarm-mvp-contract.md @@ -1730,7 +1730,7 @@ temptation wearing clean robes. | Local Verse online | `epiphany-swarm online` seeds repo-local CultMesh, standing-faculty SoA, topology, liveness, Eve, and tool sight. | Keep private Verse sealed while exposing operator-safe repo status. | | Persona/Bifrost intake | `epiphany-work accept` records pressure and candidate action refs without Hands authority. `epiphany-work persona-intake` now invokes the Persona bubble speech-audit path, records public discussion and candidate-action refs, then delegates to `accept`; wrapper mode `repo-persona-intake` exposes the operator mouth. | Deepen the intake-to-Imagination interpreter so richer model-authored action items can be proposed without granting Hands, publication, or durable-state authority at the mouth edge. | | Imagination planning | `derive-plan` now writes a typed `epiphany.repo_work_imagination_action_items_receipt.v0` before the executable plan receipt. The action-item receipt can carry model provenance, allowed safe family, requested paths, verification asks, stop conditions, escalation reasons, planning facets (assumptions, constraints, non-goals, open questions, decision points, and evidence needs), and private-state seals; command text remains deterministic safe-family lowering for `append-worklog`, `planning-note`, `checklist-note`, `section-note` / `repo.markdown_managed_section`, `repo-status-section` / `repo.status_section`, `task-card` / `repo.task_card`, `repo-manifest` / `repo.body_manifest`, `repo-tool-capabilities` / `repo.tool_capabilities`, `repo-tool-request` / `repo.tool_request`, `repo-eve-surface` / `repo.eve_surface`, `repo-collaboration-policy` / `repo.collaboration_policy`, `repo-collaboration-topic` / `repo.collaboration_topic`, `repo-consensus-brief` / `repo.consensus_brief`, `repo-planning-brief` / `repo.planning_brief`, `repo-objective-draft` / `repo.objective_draft`, `repo-adoption-request` / `repo.adoption_request`, `repo-scheduling-request` / `repo.scheduling_request`, `repo-work-order` / `repo.work_order`, `repo-verification-request` / `repo.verification_request`, `repo-publication-request` / `repo.publication_request`, `repo-sync-request` / `repo.sync_request`, `repo-maintainer-review-request` / `repo.maintainer_review_request`, `repo-pr-request` / `repo.pr_request`, `repo-credit-request` / `repo.credit_request`, `repo-artifact-acceptance-request` / `repo.artifact_acceptance_request`, `repo-metrics-request` / `repo.metrics_request`, `repo-doctrine-update-request` / `repo.doctrine_update_request`, `repo-secret-policy-request` / `repo.secret_policy_request`, `repo-deployment-config` / `repo.deployment_config`, and `repo-deployment-request` / `repo.deployment_request`. `repo.planning_brief` is the rough-pressure decomposition family: it names candidate next safe families, requested-path / verification-ask / evidence-need requirements, and Mind/Self/Substrate/Hands/Soul/Bifrost/Idunn gates while granting no action authority; Soul closure now emits `epiphany.repo_work_safe_family_planning_readback.v0` for that family with candidate-family counts, gate/readiness flags, authority denials, and private-state seal. `adopt` writes `epiphany.repo_work_mind_adoption_decision.v0` before the main adoption receipt cites the decision and grants branch-local Hands authority, and refuses plan-derived items that lack explicit verification asks or planning evidence needs. `plan` remains manual quarantine scaffolding. | Deepen further interpreter behavior and semantic closure/map readback without turning model text into arbitrary shell authority. | -| Self scheduling | `tick` and `serve` prove one-step branch-local advancement, brake refusal, active-turn refusal, cooldown, and stale-turn recovery; `tick` now routes executed branch-local work through the existing Soul/Modeling/Mind `close` gate; `queue-run` selects tick-actionable rows from the typed repo-work queue and delegates to `tick`; `epiphany-swarm run` is the bounded operator mouth over that queue/tick physiology; `repo-work-service-plan` and `repo-work-service-runbook` write Idunn lifecycle receipts/artifacts for the same queue-run command without launching it. | Keep any future queue-run service launch/install behind Idunn and explicit operator authority. | +| Self scheduling | `tick` and `serve` prove one-step branch-local advancement, brake refusal, active-turn refusal, cooldown, and stale-turn recovery; `tick` now routes executed branch-local work through the existing Soul/Modeling/Mind `close` gate; `queue-run` selects tick-actionable rows from the typed repo-work queue and delegates to `tick`; `epiphany-swarm run` is the bounded operator mouth over that queue/tick physiology; `repo-work-service-plan`, `repo-work-service-runbook`, `repo-work-service-launch`, and `repo-work-service-audit` write Idunn lifecycle receipts/artifacts for the same queue-run command and prove non-mutating launch/readiness closure. | Keep any future queue-run service install/start mutation behind Idunn and explicit elevated operator authority. | | Branch-local Hands work | `adopt` and `execute` create approved Hands gates, run planned commands, stage declared paths, commit on `epiphany/*`, and write receipts. | Keep mutation branch-contained and receipt-backed; broaden only through typed plan families, not ad hoc shell freedom. | | Soul/Modeling/Mind closure | `close` verifies the Hands commit, writes `epiphany.repo_work_closure_review.v0`, refuses path-scope mismatches, refuses missing/tampered/non-affirmative Mind adoption proof, runs known safe-family content assertions, optionally gates on model-authored closure verdicts, can require verification output to cite declared changed paths with `--require-source-grounding`, writes Soul/Modeling/Mind receipts, admits a compact typed repo map entry into `.epiphany/state/repo-work-map.msgpack`, and mirrors that admitted fact into local Verse as `epiphany.cultmesh.repo_work_map_entry.v0`. | Keep extending closure toward source-grounded semantic review and richer semantic map lenses, while preserving deterministic local closure for simple mechanical work. | | Repo work sight | `overview` emits compact proof rows and mirrors typed `epiphany.cultmesh.repo_work_overview.v0` event documents plus a latest key; `close` mirrors Mind-admitted map facts as `epiphany.cultmesh.repo_work_map_entry.v0`; Gjallar enumerates overview history, map rows, family lens rows, path lens rows, branch lens rows, and public-proof rows without private-state exposure; Persona's Eve surface and Eve connection readbacks expose peer-readable gate/blocker/next-action rows; `queue-run` consumes the same overview queue for branch-local scheduler pulses. | Deepen the Persona-to-plan loop and semantic map readback without moving action authority out of Hands/Self/Bifrost. | @@ -1752,16 +1752,19 @@ Build the remaining MVP in this order: 1. **Idunn-hosted queue-run lifecycle.** Keep `epiphany-work queue-run` as the Self-owned branch-local pulse, but let Idunn publish the service plan, runbook, audit, and optional elevated installation/start path for that same - pulse. The first cut should be non-mutating plan/runbook receipts. Only the - operator may grant service mutation. Self must not become the daemon keeper. - This first cut is landed through `tools/epiphany_local_run.ps1 -Mode + pulse. The non-mutating plan/runbook/launch/audit artery is landed; only the + operator may grant service-manager mutation or elevated startup. Self must + not become the daemon keeper. This first cut is landed through + `tools/epiphany_local_run.ps1 -Mode repo-work-service-plan`, `-Mode repo-work-service-runbook`, and `-Mode - repo-work-service-launch`, and now has a native repeatable smoke at - `.epiphany-smoke\repo-work-service-lifecycle-20260621-002707` proving the - exact queue-run command vector with `--dry-run`, a written runbook receipt, - receipt-directory readback before launch, a bounded `service-launch - --wait-child` receipt with exit code 0, no service-manager mutation, no - elevation, and `privateStateExposed=false`. + repo-work-service-launch`, plus `-Mode repo-work-service-audit`. Native + smoke `.epiphany-smoke\repo-work-service-lifecycle-20260621-004202` proves + the exact queue-run command vector with `--dry-run`, a written runbook + receipt, receipt-directory readback before launch, a bounded + `service-launch --wait-child` receipt with exit code 0, then a + `repo-work-service-audit` receipt with `auditStatus=complete`, + `auditRunbookArtifactStatus=present`, no missing or failed checks, no + service-manager mutation, no elevation, and `privateStateExposed=false`. 2. **Persona-to-Imagination action items.** The first repo Persona intake mouth is landed: `epiphany-work persona-intake` routes work-shaped speech through the Persona bubble speech-audit path, records public discussion refs and @@ -1978,28 +1981,35 @@ The chain is typed and sealed enough to be useful: relies on per-pulse tick receipts, and zero-interval unbounded polling is refused. - `tools/epiphany_local_run.ps1 -Mode repo-work-service-plan`, `-Mode - repo-work-service-runbook`, and `-Mode repo-work-service-launch` are the + repo-work-service-runbook`, `-Mode repo-work-service-launch`, and `-Mode + repo-work-service-audit` are the first Idunn-hosted lifecycle artifacts for the repo-work queue pulse. They call `epiphany-daemon-supervisor service-plan` / `service-runbook` / - `service-launch --wait-child` with `--service-command ` and - explicit `--service-arg` values for `queue-run --workspace + `service-launch --wait-child` / `repo-work-service-audit` with + `--service-command ` and explicit `--service-arg` values for + `queue-run --workspace --epiphany-root --local-verse-store \.epiphany\local-verse.ccmp --runtime-id --max-items `. The receipts and runbook describe or - launch the real queue-run command, but do not install a Windows service, - publish, merge, cross repo boundaries, elevate, or expose private state. - Native smoke `.epiphany-smoke\repo-work-service-lifecycle-20260621-002707` - now proves the same Idunn plan/runbook/launch artery without wrapper trust: + launch the real queue-run command and then audit the typed lifecycle trail, + but do not install a Windows service, publish, merge, cross repo boundaries, + elevate, or expose private state. Native smoke + `.epiphany-smoke\repo-work-service-lifecycle-20260621-004202` now proves the + same Idunn plan/runbook/launch/audit artery without wrapper trust: plan status `planned`, runbook status `written`, launch status `completed`, - launch exit code `0`, service id `epiphany-repo-work-queue-runner`, + launch exit code `0`, audit status `complete`, audit runbook artifact status + `present`, service id `epiphany-repo-work-queue-runner`, runbook receipt-directory readback before launch, launch receipt-directory readback after launch, service args containing `queue-run` and `--dry-run`, runbook SHA-256 - `50c3776c7d763a67634cdcefc1b1ed17d700107958bf7c5e221f6c03ce49f2a6`, + `19af4154a19e41563a1a9e717b36e4db2a959db42892bef176c4493698d4b84a`, `lifecycleOwner=Idunn`, `hostedBody=repo-work`, `mutatesServiceManager=false`, `launchesService=true`, `waitChild=true`, `requiresElevatedAuthority=false`, and `privateStateExposed=false`. Wrapper - proof `local-20260621-012741-653-dd4fdae2` exercised - `repo-work-service-launch` and printed `status=completed`, `exitCode=0`, + proofs `local-20260621-014302-362-31bbef47`, + `local-20260621-014337-108-cbd99615`, + `local-20260621-014413-125-09e183c5`, and + `local-20260621-014558-197-f6951806` exercised plan/runbook/launch/audit; + final audit printed `status=complete`, `missing=none`, `failed=none`, `owner=Idunn`, `hostedBody=repo-work`, and `serviceManagerMutation=false`. - `epiphany-work persona-intake` is the first repo Persona mouth over accepted work pressure. It requires an online repo swarm receipt, writes a Persona @@ -2043,9 +2053,10 @@ Required organs before MVP: `epiphany-work serve` adds bounded/unbounded cadence around that pulse, and `epiphany-swarm run` plus wrapper expose the bounded repo-swarm run mouth over the typed queue. Idunn-owned non-mutating queue-run service plan/runbook - receipts also exist, and the queue/tick path now hands branch-local execution - into `close-from-execute`. Remaining work is any later Idunn service - launch/install under explicit operator authority. + receipts plus bounded launch/audit readiness receipts also exist, and the + queue/tick path now hands branch-local execution into `close-from-execute`. + Remaining Idunn service work is optional elevated install/start execution + under explicit operator authority. - Persona-to-plan depth: deterministic `append-worklog` and `planning-note` derivations exist for accepted Persona/Bifrost pressure, `persona-intake` gives the project Persona a speech-audited mouth into that @@ -2231,11 +2242,11 @@ Required organs before MVP: blocker, and `authority-gated` / Bifrost/GitHub / `awaiting-upstream-sync` for the upstream-main sync blocker. All stop packets are non-mutating, non-elevated, and private-state sealed. Native - service lifecycle plan/runbook proof for the queue-run pulse now exists at - `.epiphany-smoke\repo-work-service-lifecycle-20260620-185853`; remaining - service lifecycle work is optional elevated install/start execution proof - under explicit operator authority plus richer closure depth rather than basic - safe-family planning cargo. + service lifecycle plan/runbook/launch/audit proof for the queue-run pulse now + exists at `.epiphany-smoke\repo-work-service-lifecycle-20260621-004202`; + remaining service lifecycle work is optional elevated install/start execution + proof under explicit operator authority plus richer closure depth rather than + basic safe-family planning cargo. - Proof bundle depth: maintainers and future agents can inspect local operator-safe receipt chains, artifact schema/status rows, SHA-256 receipt hashes, compact TUI rows, commit refs, verification verdicts, map admission, diff --git a/notes/fresh-workspace-handoff.md b/notes/fresh-workspace-handoff.md index 807ba7bc..81d4e870 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -161,6 +161,7 @@ remembers doctrine; the branch remembers the blade. - 2026-06-20: Gjallar repo-work map sight now includes per-entry semantic readback rows. `epiphany-verse-query gjallar`, swarm overview, and swarm triage expose `repoWorkMapSemanticRows` plus `REPO-WORK-MAP-SEMANTIC` rows derived from Mind-admitted local Verse map entries, combining durable modeling summary, safe family, stage owner, publication gate owner, latest commit, and Mind commit receipt for each accepted item. Focused smoke `.epiphany-smoke\repo-close-mind-adoption-guard-20260620-234131` proves accepted `repo.markdown_planning_note` work reports `stage=imagination-planning`, `stageOwner=Imagination`, `gateOwner=Bifrost`, the durable modeling summary, `sightOnly=true`, `publicationAuthorized=false`, and `privateStateExposed=false` while counterfeit Mind adoption is still refused. This is compact meaning readback only; Gjallar still does not schedule, publish, merge, deploy, keep daemons alive, or admit Mind state. - 2026-06-21: The local wrapper mouth now forwards Rust-owned repo-work map rows for `gjallar` and `swarm-triage` from an explicit repo-local Verse target. `tools/epiphany_local_run.ps1` accepts `-LocalVerseStore` and `-LocalVerseRuntimeId`; operator run intent/receipt documents still write to the operator local Verse, while the readback modes target the requested store/runtime. Live wrapper proofs `local-20260621-011151-541-70056545` and `local-20260621-011207-755-d65e5c7e` pointed at `.epiphany-smoke\repo-planning-brief-family-20260620-235939\repo-body\.epiphany\local-verse.ccmp` with runtime `repo-planning-brief-family-smoke` and printed actual `repoWorkMapRows`, `repoWorkSemanticRows`, family/path/branch/stage/gate lens rows, and `privateStateExposed=false`. Earlier wrapper proofs that rendered `none` were aimed at the wrong operator store/runtime; PowerShell only lowers existing Rust TUI arrays and does not reinterpret repo-work truth or gain scheduler/publication/Mind/Idunn authority. - 2026-06-21: Idunn-hosted repo-work queue-run lifecycle now has bounded launch proof. `tools/epiphany_local_run.ps1 -Mode repo-work-service-launch` reuses the `epiphany-repo-work-queue-runner` service id and launches the exact `epiphany-work queue-run --workspace --local-verse-store \.epiphany\local-verse.ccmp --runtime-id --max-items ` command through `epiphany-daemon-supervisor service-launch --wait-child`; it writes an Idunn service lifecycle receipt and does not install a Windows service, elevate, publish, merge, cross repos, or expose private state. Native smoke `.epiphany-smoke\repo-work-service-lifecycle-20260621-002707` proves plan/runbook/launch with launch exit code `0`, runbook receipt-directory readback before launch, launch readback after launch, `mutatesServiceManager=false`, `launchesService=true`, `waitChild=true`, and `privateStateExposed=false`. Wrapper proof `local-20260621-012741-653-dd4fdae2` prints `status=completed`, `exitCode=0`, `owner=Idunn`, `hostedBody=repo-work`, and `serviceManagerMutation=false`. +- 2026-06-21: Idunn-hosted repo-work queue-run lifecycle now has audit/readiness closure. `epiphany-daemon-supervisor repo-work-service-audit` reads the typed service lifecycle receipts for `epiphany-repo-work-queue-runner`, requires planned install-plan, written local runbook artifact, completed launch with exit code `0`, and no private-state exposure, then writes a `repo-work-service-audit` receipt. Native smoke `.epiphany-smoke\repo-work-service-lifecycle-20260621-004202` proves plan/runbook/launch/audit with `auditStatus=complete`, `auditRunbookArtifactStatus=present`, `auditLaunchExitCode=0`, `mutatesServiceManager=false`, `requiresElevatedAuthority=false`, and `privateStateExposed=false`. Wrapper proofs `local-20260621-014302-362-31bbef47`, `local-20260621-014337-108-cbd99615`, `local-20260621-014413-125-09e183c5`, and `local-20260621-014558-197-f6951806` prove plan/runbook/launch/audit ergonomics; the final audit summary reports `missing=none`, `failed=none`, and `nextSafeMove=continue repo-swarm MVP planner/interpreter hardening`. Remaining Idunn service work is optional elevated install/start execution under explicit operator authority, not Self scheduling. - 2026-06-20: Mind now has explicit repo-work safe-family and requested-path guards before branch-local Hands authority. `adopt --from-plan` treats unsupported plan-derived safe-family labels as refused interpreter decisions, writes `epiphany.repo_work_mind_adoption_decision.v0` with `status=refused-unsupported-safe-family`, keeps `actionItemAccepted=false` and `safeFamilyRecognized=false`, grants no Hands/durable-state/service/publication/cross-body/private-state authority, and writes no normal adoption receipt. It also compares the sorted action-item `requestedPaths` against the sorted plan action `changedPaths`; mismatches write `status=refused-requested-path-mismatch`, keep `safeFamilyRecognized=true` but `requestedPathsMatchPlan=false`, point the next gate at `imagination.replan_with_matching_requested_paths`, and grant no Hands/durable-state/service/publication/cross-body/private-state authority. Focused smokes `.epiphany-smoke\repo-mind-safe-family-guard-20260620-194425` and `.epiphany-smoke\repo-mind-path-guard-20260620-194239` prove both refusal paths; earlier positive smokes `.epiphany-smoke\repo-planning-facets-20260620-190916` and `.epiphany-smoke\closure-model-gate-20260620-190916` prove recognized planning facets and closure model gates still pass. Current remaining repo-swarm MVP organs are deeper interpreter semantics beyond adoption refusal, more useful repo-owned configuration/action families, richer closure depth, and Idunn-owned queue-run service lifecycle under explicit operator authority. - 2026-06-20: Mind now also refuses plan-derived repo work that is not evidence-ready. `derive-plan` embeds verification asks in the Imagination action-item receipt, `adopt --from-plan` records verification asks and planning evidence needs in `epiphany.repo_work_mind_interpretation.v0`, and empty verification asks or evidence needs write `status=refused-missing-evidence-needs` with next gate `imagination.replan_with_explicit_soul_evidence_needs`. The refusal grants no Hands, durable-state, service, publication, cross-body, or private-state authority and writes no adoption receipt. Focused proof `.epiphany-smoke\repo-mind-evidence-guard-20260620-224426` tampers both arrays empty and proves the refusal; regression `.epiphany-smoke\repo-planning-facets-20260620-224428` proves normal planning facets still close through Soul/Modeling/Mind. - 2026-06-20: `repo-eve-surface` is now live as repo-owned Eve/CultUI surface contract cargo. `epiphany-work derive-plan --action-family repo-eve-surface` writes `.epiphany/eve-surfaces/.toml` with safe family `repo.eve_surface`, compact agent TUI and GUI lowering contracts, local/public Verse routing, Odin discovery, provider-owned surface identity, Persona/human collaboration flags, feedback routing to Imagination, and denials for renderer ownership, rendering/state/publication/service/cross-body authority, private Verse rummaging, and private-state exposure. Soul closure assertions inspect schema, family, summary, surface routing, Verse routing, CultUI contracts, collaboration route, authority seals, and private-state seal. Focused smoke `.epiphany-smoke\repo-eve-surface-family-20260620-165927` ran init -> online -> accept -> repo-eve-surface derive-plan -> tick run/adopt/execute/close; Hands committed only `.epiphany/eve-surfaces/repo-eve-surface-family.toml`, Soul passed with `pathScopeMatched=true`, `familyAssertions.status=passed`, `hasCultUiContracts=true`, `hasVerseRouting=true`, `odinDiscoverable=true`, `feedbackRoutesToImagination=true`, `rendererOwnsTruth=false`, `renderingAuthority=false`, `stateAuthority=false`, `publicationAuthority=false`, `serviceLifecycleAuthority=false`, `crossBodyMutationAuthority=false`, `privateVerseRummaging=false`, and `privateStateExposed=false`. Current remaining repo-swarm MVP organs are deeper interpreter/adoption semantics, more useful repo-owned configuration/action families, and Idunn-owned queue-run service lifecycle under explicit operator authority. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index c94fa6d2..e848675e 100644 Binary files a/state/ledgers.msgpack and b/state/ledgers.msgpack differ diff --git a/state/map.yaml b/state/map.yaml index 3a309fc0..41f1460d 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -89,6 +89,7 @@ active_subgoals: - Preserve the Ghostlight-derived heartbeat initiative seam: every lane, including coordinator/Self and Persona, has a organ-state record and competes for heartbeat slots through readiness/reaction timing; initiative heat can raise or cool global, group, arena, role, and agent tempo through typed heartbeat policy; active thinking freezes initiative until completion, so heat never queues a lane already mid-turn; idle winners ruminate instead of inventing project work, and sleep windows distill the accumulated thought pressure into reviewed self-memory or doctrine. - Use `notes/epiphany-swarm-readiness-plan.md` as the live-fire direction gate. The local run path is a compass, not launch clearance: before unattended swarm operation, Epiphany needs typed pause/brake enforcement, one initiative scheduler, completion-gated cooldown, stale active-turn recovery receipts, parent-side Persona speech eligibility, memory lifecycle operations, and CultNet-first operator snapshots/intents/receipts. The local Verse brake document exists, `epiphany-verse-query swarm-brake` can engage/release it, `tools/epiphany_local_run.ps1` refuses live `plan`/`run`/`mvp` modes when the brake is engaged while leaving `status` readable, `epiphany-mvp-coordinator` checks the local Verse brake before app-server startup, and `epiphany-heartbeat-store` guards tick/pump/heat/queue-mention/routine when given `--local-verse-store`. Daemon liveness is now a typed local Verse authority: `epiphany-verse-query daemon-status` writes one daemon status without repainting the table, local Verse seeding preserves existing daemon statuses and swarm brakes, `invoke-tool` refuses when the host daemon is not ready or lacks `submitTypedToolIntent`, and both daemon tool invocation and lifecycle poke fail closed under an engaged matching brake. `epiphany-daemon-supervisor policy` writes durable per-daemon restart policy with command/args/cwd/cooldown/backoff/attempt state plus reconcile cadence and stale-heartbeat threshold; `epiphany-daemon-supervisor reconcile` loads that policy when no override command is supplied, refuses under a matching lifecycle brake, refuses during cooldown/backoff, writes daemon poke intent/receipt, updates daemon status, and updates policy attempt state; `epiphany-daemon-supervisor tick` is an explicit scheduler pulse that scans durable policies, records ready/noop pulses, skips before the configured reconcile interval, marks stale heartbeat status degraded, routes restarts through the same brake/cooldown/poke receipt path, and writes a latest `epiphany.cultmesh.daemon_scheduler_receipt.v0`; `epiphany-daemon-supervisor serve` runs that same pulse on a configurable cadence with bounded `--max-iterations` proof mode or unbounded service mode. `epiphany-daemon-supervisor service-plan`/`install-service` now writes a planned `epiphany.cultmesh.daemon_service_lifecycle_receipt.v0` for the `serve` command, while `service-launch`/`start-service` spawns that `serve` loop through the current executable or `--service-command`, can `--wait-child` for bounded proof, and records command/args/cwd, scheduler id, daemon selector, pid/exit/status, artifact ref, and private-state guard. `service-runbook`, `windows-service-install`/`service-install-plan`, `windows-service-status`, `windows-service-reconcile`, `windows-service-execution-readiness`, and `windows-service-start`/`stop` now record service lifecycle receipts through the same local Verse; the read-only status path has been proved against the real Windows `EventLog` service with receipt `daemon-service-lifecycle-receipt-windows-eventlog-proof-windows-service-status`, status `running`, exit code `0`, and `privateStateExposed=false`; the read-only service-policy reconciliation path has been proved for missing service, real-service drift against `EventLog`, lifecycle-brake refusal, and wrapper/local-Verse receipt `daemon-service-lifecycle-receipt-windows-eventlog-reconcile-proof-windows-service-reconcile`; execution readiness has been proved as a non-mutating `not-elevated` receipt through direct and wrapper paths; start/stop now produce non-mutating `start-planned`/`stop-planned` receipts unless `--execute-control`/`--execute-service-control` is passed, and wrapper `service-start-plan`/`service-stop-plan` proves those receipts against `EventLog`; explicit install/control execution now refuses as `execution-refused-not-elevated` with `executed=false` when the shell lacks Windows administrator authority, and wrapper `service-install-execute`, `service-start-execute`, and `service-stop-execute` prove those refusal receipts without mutation. Service lifecycle actions check the local Verse swarm brake before process launch, artifact writes, service-manager queries, service-policy reconciliation, execution-readiness checks, control planning, elevation-gated execution, or start/stop execution. The local wrapper builds/checks this binary. - Use `notes/epiphany-repo-swarm-mvp-contract.md` as the repo-swarm autonomy authority map. Autonomous branch-local work inside an Epiphany-owned repo Body is in scope and desired; the safety boundary is typed authority, branch containment, interruption, receipts, private-state sealing, and Bifrost-gated publication/merge/escalation, not asking a human before every local edit. Current safe-family cargo includes repo manifest, tool capability manifest, daemon-hosted tool request cargo, Eve/CultUI surface contract, repo collaboration policy, collaboration topics, consensus/objective/adoption/scheduling/work-order/verification/publication/sync/review/PR/credit/artifact/metrics/doctrine-update/secret-policy/deployment requests, repo deployment config, action-item receipts, Mind adoption interpretation/decision receipts, explicit Mind safe-family refusal proof `.epiphany-smoke\repo-mind-safe-family-guard-20260620-194425`, explicit Mind requested-path/plan changed-path refusal proof `.epiphany-smoke\repo-mind-path-guard-20260620-194239`, overview/public-proof/Gjallar/Eve readbacks, typed swarm-run stop classification, Idunn non-mutating queue-run lifecycle receipts, and fresh-repo upstream-main proof. Latest deployment proof `.epiphany-smoke\repo-deployment-config-family-20260620-221205` shows `repo.deployment_config` closes through Soul, `deployment-config-audit` reports `ready-for-idunn-review`, `deployment-execution-runbook` reports `ready-for-operator-git-push`, and `deployment-aftercare-audit` ingests local Verse/CultMesh Idunn deployment/aftercare receipt refs with source `cultmesh`, status `complete`, `deploymentComplete=true`, `daemonOwnsExecution=true`, no repo-agent execution/deployment/SSH/git-push/service/Hands/publication/merge/cross-body authority, and `privateStateExposed=false`; explicit Idunn receipt files remain only compatibility reliquaries. Latest deployment request proof `.epiphany-smoke\repo-deployment-request-family-20260620-195605` shows `repo.deployment_request` closes through Soul while requesting reviewed git-push-observed-by-Idunn deployment with script/host/secret/rollback/aftercare requirements and no deployment/SSH/git-push/service authority. Latest security cargo proof `.epiphany-smoke\repo-secret-policy-request-family-20260620-193046` shows `repo.secret_policy_request` closes through Soul while requesting reviewed secret/write/export/deployment policy without exposing secrets or granting write/deployment/publication authority. Governance proof `.epiphany-smoke\repo-doctrine-update-request-family-20260620-192140` shows `repo.doctrine_update_request` closes through Soul while requesting reviewed `AGENTS.md` doctrine work without mutating doctrine or granting Hands/service/publication authority. Swarm-run stop proofs now include `.epiphany-smoke\fresh-repo-mvp-20260620-180024` for `iteration-limit` / Self / `self.scheduler-iteration-limit` with upstream-main sync and public-proof export, plus `.epiphany-smoke\swarm-stop-classification-20260620-184717` for `queue-empty` / Gjallar / `repo.work.overview`, `dry-run-preview` / Self / `ready-to-run`, `authority-gated` / Bifrost / `awaiting-publication`, and `authority-gated` / Bifrost/GitHub / `awaiting-upstream-sync`; all stop packets are non-mutating, non-elevated, and `privateStateExposed=false`. Native proof `.epiphany-smoke\repo-work-service-lifecycle-20260620-185853` now proves Idunn-owned non-mutating repo-work queue-run service plan/runbook receipts for exact service id `epiphany-repo-work-queue-runner`, receipt-directory readback, runbook SHA-256 `f2ec67c4f8243a3ebc2f9e915b6b9f5ae2ac2d99d2cdb86905b54667adc456f8`, `hostedBody=repo-work`, no service-manager mutation, no launch, no elevation, and `privateStateExposed=false`. + - Idunn-hosted repo-work queue-run lifecycle now has plan/runbook/launch/audit closure under explicit operator authority. `epiphany-daemon-supervisor repo-work-service-audit` reads all typed service lifecycle receipts for `epiphany-repo-work-queue-runner`, requires planned install-plan, written local runbook artifact, completed launch with exit code `0`, and no private-state exposure, then writes a `repo-work-service-audit` receipt with `status=complete` or `incomplete`. Native proof `.epiphany-smoke\repo-work-service-lifecycle-20260621-004202` proves plan/runbook/launch/audit with `auditStatus=complete`, `auditRunbookArtifactStatus=present`, `auditLaunchExitCode=0`, `mutatesServiceManager=false`, `requiresElevatedAuthority=false`, and `privateStateExposed=false`. Wrapper proofs `local-20260621-014302-362-31bbef47`, `local-20260621-014337-108-cbd99615`, `local-20260621-014413-125-09e183c5`, and `local-20260621-014558-197-f6951806` prove operator plan/runbook/launch/audit ergonomics, with audit reporting no missing or failed checks. Basic queue-run service lifecycle readiness is sealed; remaining Idunn work is optional elevated install/start execution under explicit operator authority, not Self scheduling authority. - Gjallar/Odin sight now exposes Idunn deployment receipt refs without taking Idunn's execution throne. `EpiphanyLocalVerseContext`, `receipt-directory`, `swarm-overview`, `swarm-triage`, and `gjallar` surface latest `gamecult.idunn.deployment_receipt.v0` and `gamecult.idunn.deployment_aftercare_audit.v0` as compact `idunnDeploymentReceiptRows` / `IDUNN-DEPLOYMENT` rows with owner `Idunn`, watched/checked refs, source/result refs, aftercare ids, follow-up readback command, and `privateStateExposed=false`. Smoke `.epiphany-smoke\repo-deployment-config-family-20260620-223203` proves the aftercare audit still ingests CultMesh refs and Gjallar reports `gjallarIdunnDeploymentReceiptCount=2`, latest deployment receipt `fixture-idunn-deployment`, latest aftercare receipt `fixture-idunn-aftercare`, and no private-state exposure. This is citeable discovery only; deployment still happens by explicit operator `git push` observed by Idunn. - Mind adoption now has an explicit evidence-readiness refusal gate for plan-derived repo work. `derive-plan` carries verification asks into the Imagination action-item receipt; `adopt --from-plan` records verification asks and planning evidence needs in `epiphany.repo_work_mind_interpretation.v0` and refuses empty verification asks or evidence needs as `refused-missing-evidence-needs`, with next gate `imagination.replan_with_explicit_soul_evidence_needs`. Proof `.epiphany-smoke\repo-mind-evidence-guard-20260620-224426` grants no Hands/durable/service/publication/cross-body/private authority and writes no adoption receipt after tampering both arrays empty; regression `.epiphany-smoke\repo-planning-facets-20260620-224428` shows normal planning facets still close through Soul/Modeling/Mind. - Soul closure can now require verification-output source grounding. `epiphany-work close` records `epiphany.repo_work_verification_source_grounding_review.v0` in the closure review and `--require-source-grounding` refuses verifier output that does not cite every declared changed path appearing in the commit stat. Proof `.epiphany-smoke\repo-closure-source-grounding-20260620-230626` closes the default `git show --stat` path with source grounding required, then blocks custom `Write-Output 'ok'` verification as `verification-failed` while `pathScopeMatched=true`, `familyAssertions.status=passed`, Soul `failed`, and `privateStateExposed=false`. @@ -643,4 +644,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: Idunn-hosted repo-work queue-run lifecycle now includes bounded launch proof, not only plan/runbook artifacts. `tools/epiphany_local_run.ps1 -Mode repo-work-service-launch` routes the same `epiphany-work queue-run` command vector through `epiphany-daemon-supervisor service-launch --wait-child`, records an Idunn service lifecycle launch receipt, and does not install a Windows service, elevate, publish, merge, cross repos, or expose private state. Native proof `.epiphany-smoke\repo-work-service-lifecycle-20260621-002707` shows plan `planned`, runbook `written`, launch `completed`, launch exit code `0`, runbook directory readback before launch, launch directory readback after launch, `mutatesServiceManager=false`, `launchesService=true`, `waitChild=true`, and `privateStateExposed=false`; wrapper proof `local-20260621-012741-653-dd4fdae2` printed the same bounded launch mouth with owner `Idunn` and hosted body `repo-work`. - next_action: Continue repo-swarm MVP work from the documented Epiphany Online cut order in `notes/epiphany-repo-swarm-mvp-contract.md`. The next useful cut is deeper interpreter/closure depth, another useful repo-owned safe action family, or service-lifecycle audit/readiness around the repo-work queue runner under explicit operator authority. Preserve Idunn service lifecycle ownership, Bifrost publication/upstream-main ownership, Mind durable-state admission, and existing CultMesh/Odin/Eve tool directories; Windows service install/start/deployment execution still requires explicit elevated operator authority. + next_action: Continue repo-swarm MVP work from the documented Epiphany Online cut order in `notes/epiphany-repo-swarm-mvp-contract.md`. The next useful cut is deeper Persona-to-Imagination interpreter behavior, richer Soul/Modeling/Mind closure depth and map readback, or another useful repo-owned safe action family. The repo-work queue-run plan/runbook/launch/audit lifecycle is sealed; preserve Idunn service lifecycle ownership, Bifrost publication/upstream-main ownership, Mind durable-state admission, and existing CultMesh/Odin/Eve tool directories. Windows service install/start/deployment execution still requires explicit elevated operator authority. diff --git a/tools/epiphany_local_run.ps1 b/tools/epiphany_local_run.ps1 index 52c1bb21..0f075540 100644 --- a/tools/epiphany_local_run.ps1 +++ b/tools/epiphany_local_run.ps1 @@ -1,5 +1,5 @@ param( - [ValidateSet("status", "plan", "smoke", "run", "mvp", "agent-state-soa", "swarm-status", "swarm-poke-down", "swarm-triage", "cluster-topology", "eve-surfaces", "eve-connect", "collaboration-feedback", "bifrost-publication", "bifrost-public-proof", "bifrost-ledger", "receipt-directory", "tool-directory", "tool-invoke", "swarm-overview", "gjallar", "repo-persona-intake", "repo-swarm-run", "repo-work-queue-run", "repo-work-service-plan", "repo-work-service-runbook", "repo-work-service-launch", "swarm-online-runbook", "service-policy-directory", "service-plan", "service-launch", "service-runbook", "cluster-service-runbook", "cluster-service-install-plan", "cluster-service-install-execute", "cluster-service-audit", "cluster-service-start-plan", "cluster-service-stop-plan", "cluster-service-start-execute", "cluster-service-stop-execute", "cluster-service-execution-readiness", "cluster-service-execution-runbook", "cluster-service-execution-audit", "service-execution-runbook", "service-install-plan", "service-install-execute", "service-tick", "service-status", "service-reconcile", "service-execution-readiness", "service-execution-audit", "service-start-plan", "service-stop-plan", "service-start-execute", "service-stop-execute")] + [ValidateSet("status", "plan", "smoke", "run", "mvp", "agent-state-soa", "swarm-status", "swarm-poke-down", "swarm-triage", "cluster-topology", "eve-surfaces", "eve-connect", "collaboration-feedback", "bifrost-publication", "bifrost-public-proof", "bifrost-ledger", "receipt-directory", "tool-directory", "tool-invoke", "swarm-overview", "gjallar", "repo-persona-intake", "repo-swarm-run", "repo-work-queue-run", "repo-work-service-plan", "repo-work-service-runbook", "repo-work-service-launch", "repo-work-service-audit", "swarm-online-runbook", "service-policy-directory", "service-plan", "service-launch", "service-runbook", "cluster-service-runbook", "cluster-service-install-plan", "cluster-service-install-execute", "cluster-service-audit", "cluster-service-start-plan", "cluster-service-stop-plan", "cluster-service-start-execute", "cluster-service-stop-execute", "cluster-service-execution-readiness", "cluster-service-execution-runbook", "cluster-service-execution-audit", "service-execution-runbook", "service-install-plan", "service-install-execute", "service-tick", "service-status", "service-reconcile", "service-execution-readiness", "service-execution-audit", "service-start-plan", "service-stop-plan", "service-start-execute", "service-stop-execute")] [string]$Mode = "smoke", [string]$Root = (Resolve-Path ".").Path, [string]$Workspace = "", @@ -348,7 +348,7 @@ $runtimeStore = Join-Path $Workspace "state\runtime-spine.msgpack" $liveRuntimeMode = @("run", "mvp") -contains $Mode if (-not $SkipBuild) { - if ($Mode -ne "status" -and $Mode -ne "agent-state-soa" -and $Mode -ne "swarm-status" -and $Mode -ne "swarm-poke-down" -and $Mode -ne "swarm-triage" -and $Mode -ne "cluster-topology" -and $Mode -ne "eve-surfaces" -and $Mode -ne "eve-connect" -and $Mode -ne "collaboration-feedback" -and $Mode -ne "bifrost-publication" -and $Mode -ne "bifrost-public-proof" -and $Mode -ne "bifrost-ledger" -and $Mode -ne "receipt-directory" -and $Mode -ne "tool-directory" -and $Mode -ne "tool-invoke" -and $Mode -ne "swarm-overview" -and $Mode -ne "gjallar" -and $Mode -ne "repo-persona-intake" -and $Mode -ne "repo-swarm-run" -and $Mode -ne "repo-work-queue-run" -and $Mode -ne "repo-work-service-plan" -and $Mode -ne "repo-work-service-runbook" -and $Mode -ne "repo-work-service-launch" -and $Mode -ne "swarm-online-runbook" -and $Mode -ne "service-policy-directory" -and $Mode -ne "service-plan" -and $Mode -ne "service-launch" -and $Mode -ne "service-runbook" -and $Mode -ne "cluster-service-runbook" -and $Mode -ne "cluster-service-install-plan" -and $Mode -ne "cluster-service-install-execute" -and $Mode -ne "cluster-service-audit" -and $Mode -ne "cluster-service-start-plan" -and $Mode -ne "cluster-service-stop-plan" -and $Mode -ne "cluster-service-start-execute" -and $Mode -ne "cluster-service-stop-execute" -and $Mode -ne "cluster-service-execution-readiness" -and $Mode -ne "cluster-service-execution-runbook" -and $Mode -ne "cluster-service-execution-audit" -and $Mode -ne "service-execution-runbook" -and $Mode -ne "service-install-plan" -and $Mode -ne "service-install-execute" -and $Mode -ne "service-tick" -and $Mode -ne "service-status" -and $Mode -ne "service-reconcile" -and $Mode -ne "service-execution-readiness" -and $Mode -ne "service-execution-audit" -and $Mode -ne "service-start-plan" -and $Mode -ne "service-stop-plan" -and $Mode -ne "service-start-execute" -and $Mode -ne "service-stop-execute") { + if ($Mode -ne "status" -and $Mode -ne "agent-state-soa" -and $Mode -ne "swarm-status" -and $Mode -ne "swarm-poke-down" -and $Mode -ne "swarm-triage" -and $Mode -ne "cluster-topology" -and $Mode -ne "eve-surfaces" -and $Mode -ne "eve-connect" -and $Mode -ne "collaboration-feedback" -and $Mode -ne "bifrost-publication" -and $Mode -ne "bifrost-public-proof" -and $Mode -ne "bifrost-ledger" -and $Mode -ne "receipt-directory" -and $Mode -ne "tool-directory" -and $Mode -ne "tool-invoke" -and $Mode -ne "swarm-overview" -and $Mode -ne "gjallar" -and $Mode -ne "repo-persona-intake" -and $Mode -ne "repo-swarm-run" -and $Mode -ne "repo-work-queue-run" -and $Mode -ne "repo-work-service-plan" -and $Mode -ne "repo-work-service-runbook" -and $Mode -ne "repo-work-service-launch" -and $Mode -ne "repo-work-service-audit" -and $Mode -ne "swarm-online-runbook" -and $Mode -ne "service-policy-directory" -and $Mode -ne "service-plan" -and $Mode -ne "service-launch" -and $Mode -ne "service-runbook" -and $Mode -ne "cluster-service-runbook" -and $Mode -ne "cluster-service-install-plan" -and $Mode -ne "cluster-service-install-execute" -and $Mode -ne "cluster-service-audit" -and $Mode -ne "cluster-service-start-plan" -and $Mode -ne "cluster-service-stop-plan" -and $Mode -ne "cluster-service-start-execute" -and $Mode -ne "cluster-service-stop-execute" -and $Mode -ne "cluster-service-execution-readiness" -and $Mode -ne "cluster-service-execution-runbook" -and $Mode -ne "cluster-service-execution-audit" -and $Mode -ne "service-execution-runbook" -and $Mode -ne "service-install-plan" -and $Mode -ne "service-install-execute" -and $Mode -ne "service-tick" -and $Mode -ne "service-status" -and $Mode -ne "service-reconcile" -and $Mode -ne "service-execution-readiness" -and $Mode -ne "service-execution-audit" -and $Mode -ne "service-start-plan" -and $Mode -ne "service-stop-plan" -and $Mode -ne "service-start-execute" -and $Mode -ne "service-stop-execute") { Invoke-Checked ` -Label "build Codex app-server compatibility organ" ` -FilePath $cargoExe ` @@ -405,7 +405,7 @@ if (-not $SkipBuild) { } $requiredBinaries = @($statusExe, $operatorRunExe, $operatorSnapshotExe, $verseQueryExe, $swarmExe, $repoWorkExe, $daemonSupervisorExe, $handsActionExe) -if ($Mode -ne "status" -and $Mode -ne "agent-state-soa" -and $Mode -ne "swarm-status" -and $Mode -ne "swarm-poke-down" -and $Mode -ne "swarm-triage" -and $Mode -ne "cluster-topology" -and $Mode -ne "eve-surfaces" -and $Mode -ne "eve-connect" -and $Mode -ne "collaboration-feedback" -and $Mode -ne "bifrost-publication" -and $Mode -ne "bifrost-public-proof" -and $Mode -ne "bifrost-ledger" -and $Mode -ne "receipt-directory" -and $Mode -ne "tool-directory" -and $Mode -ne "tool-invoke" -and $Mode -ne "swarm-overview" -and $Mode -ne "gjallar" -and $Mode -ne "repo-persona-intake" -and $Mode -ne "repo-swarm-run" -and $Mode -ne "repo-work-queue-run" -and $Mode -ne "repo-work-service-plan" -and $Mode -ne "repo-work-service-runbook" -and $Mode -ne "repo-work-service-launch" -and $Mode -ne "swarm-online-runbook" -and $Mode -ne "service-policy-directory" -and $Mode -ne "service-plan" -and $Mode -ne "service-launch" -and $Mode -ne "service-runbook" -and $Mode -ne "cluster-service-runbook" -and $Mode -ne "cluster-service-install-plan" -and $Mode -ne "cluster-service-install-execute" -and $Mode -ne "cluster-service-audit" -and $Mode -ne "cluster-service-start-plan" -and $Mode -ne "cluster-service-stop-plan" -and $Mode -ne "cluster-service-start-execute" -and $Mode -ne "cluster-service-stop-execute" -and $Mode -ne "cluster-service-execution-readiness" -and $Mode -ne "cluster-service-execution-runbook" -and $Mode -ne "cluster-service-execution-audit" -and $Mode -ne "service-execution-runbook" -and $Mode -ne "service-install-plan" -and $Mode -ne "service-install-execute" -and $Mode -ne "service-tick" -and $Mode -ne "service-status" -and $Mode -ne "service-reconcile" -and $Mode -ne "service-execution-readiness" -and $Mode -ne "service-execution-audit" -and $Mode -ne "service-start-plan" -and $Mode -ne "service-stop-plan" -and $Mode -ne "service-start-execute" -and $Mode -ne "service-stop-execute") { +if ($Mode -ne "status" -and $Mode -ne "agent-state-soa" -and $Mode -ne "swarm-status" -and $Mode -ne "swarm-poke-down" -and $Mode -ne "swarm-triage" -and $Mode -ne "cluster-topology" -and $Mode -ne "eve-surfaces" -and $Mode -ne "eve-connect" -and $Mode -ne "collaboration-feedback" -and $Mode -ne "bifrost-publication" -and $Mode -ne "bifrost-public-proof" -and $Mode -ne "bifrost-ledger" -and $Mode -ne "receipt-directory" -and $Mode -ne "tool-directory" -and $Mode -ne "tool-invoke" -and $Mode -ne "swarm-overview" -and $Mode -ne "gjallar" -and $Mode -ne "repo-persona-intake" -and $Mode -ne "repo-swarm-run" -and $Mode -ne "repo-work-queue-run" -and $Mode -ne "repo-work-service-plan" -and $Mode -ne "repo-work-service-runbook" -and $Mode -ne "repo-work-service-launch" -and $Mode -ne "repo-work-service-audit" -and $Mode -ne "swarm-online-runbook" -and $Mode -ne "service-policy-directory" -and $Mode -ne "service-plan" -and $Mode -ne "service-launch" -and $Mode -ne "service-runbook" -and $Mode -ne "cluster-service-runbook" -and $Mode -ne "cluster-service-install-plan" -and $Mode -ne "cluster-service-install-execute" -and $Mode -ne "cluster-service-audit" -and $Mode -ne "cluster-service-start-plan" -and $Mode -ne "cluster-service-stop-plan" -and $Mode -ne "cluster-service-start-execute" -and $Mode -ne "cluster-service-stop-execute" -and $Mode -ne "cluster-service-execution-readiness" -and $Mode -ne "cluster-service-execution-runbook" -and $Mode -ne "cluster-service-execution-audit" -and $Mode -ne "service-execution-runbook" -and $Mode -ne "service-install-plan" -and $Mode -ne "service-install-execute" -and $Mode -ne "service-tick" -and $Mode -ne "service-status" -and $Mode -ne "service-reconcile" -and $Mode -ne "service-execution-readiness" -and $Mode -ne "service-execution-audit" -and $Mode -ne "service-start-plan" -and $Mode -ne "service-stop-plan" -and $Mode -ne "service-start-execute" -and $Mode -ne "service-stop-execute") { $requiredBinaries += @($codexAppServer, $coordinatorExe) } function Assert-SwarmBrakeAllowsLiveRun { @@ -478,7 +478,7 @@ function Assert-SwarmBrakeAllowsLiveRun { } } -if (@("plan", "run", "mvp", "repo-persona-intake", "repo-swarm-run", "repo-work-queue-run", "repo-work-service-plan", "repo-work-service-runbook", "repo-work-service-launch", "service-plan", "service-launch", "service-runbook", "cluster-service-runbook", "cluster-service-install-plan", "cluster-service-install-execute", "cluster-service-audit", "cluster-service-start-plan", "cluster-service-stop-plan", "cluster-service-start-execute", "cluster-service-stop-execute", "cluster-service-execution-readiness", "cluster-service-execution-runbook", "cluster-service-execution-audit", "service-execution-runbook", "service-install-plan", "service-install-execute", "service-tick", "service-status", "service-reconcile", "service-execution-readiness", "service-execution-audit", "service-start-plan", "service-stop-plan", "service-start-execute", "service-stop-execute") -contains $Mode) { +if (@("plan", "run", "mvp", "repo-persona-intake", "repo-swarm-run", "repo-work-queue-run", "repo-work-service-plan", "repo-work-service-runbook", "repo-work-service-launch", "repo-work-service-audit", "service-plan", "service-launch", "service-runbook", "cluster-service-runbook", "cluster-service-install-plan", "cluster-service-install-execute", "cluster-service-audit", "cluster-service-start-plan", "cluster-service-stop-plan", "cluster-service-start-execute", "cluster-service-stop-execute", "cluster-service-execution-readiness", "cluster-service-execution-runbook", "cluster-service-execution-audit", "service-execution-runbook", "service-install-plan", "service-install-execute", "service-tick", "service-status", "service-reconcile", "service-execution-readiness", "service-execution-audit", "service-start-plan", "service-stop-plan", "service-start-execute", "service-stop-execute") -contains $Mode) { if (-not (Test-Path -LiteralPath $verseQueryExe)) { throw "required binary not found for swarm brake preflight: $verseQueryExe" } @@ -1949,7 +1949,7 @@ if ($Mode -eq "repo-work-queue-run") { -StderrPath (Join-Path $artifactRoot "repo-work-queue-run.stderr.log") } -if ($Mode -eq "repo-work-service-plan" -or $Mode -eq "repo-work-service-runbook" -or $Mode -eq "repo-work-service-launch") { +if ($Mode -eq "repo-work-service-plan" -or $Mode -eq "repo-work-service-runbook" -or $Mode -eq "repo-work-service-launch" -or $Mode -eq "repo-work-service-audit") { $repoWorkServiceId = $ServiceId if ($repoWorkServiceId -eq "epiphany-daemon-supervisor-service") { $repoWorkServiceId = "epiphany-repo-work-queue-runner" @@ -2004,7 +2004,7 @@ if ($Mode -eq "repo-work-service-plan" -or $Mode -eq "repo-work-service-runbook" -WorkingDirectory $Root ` -StdoutPath $resultPath ` -StderrPath (Join-Path $artifactRoot "repo-work-service-runbook.stderr.log") - } else { + } elseif ($Mode -eq "repo-work-service-launch") { $resultPath = Join-Path $artifactRoot "repo-work-service-launch.stdout.json" Invoke-Checked ` -Label "launch Idunn repo-work queue-run lifecycle proof" ` @@ -2013,6 +2013,15 @@ if ($Mode -eq "repo-work-service-plan" -or $Mode -eq "repo-work-service-runbook" -WorkingDirectory $Root ` -StdoutPath $resultPath ` -StderrPath (Join-Path $artifactRoot "repo-work-service-launch.stderr.log") + } else { + $resultPath = Join-Path $artifactRoot "repo-work-service-audit.stdout.json" + Invoke-Checked ` + -Label "audit Idunn repo-work queue-run lifecycle proof" ` + -FilePath $daemonSupervisorExe ` + -Arguments (@("repo-work-service-audit") + $serviceCommandArgs) ` + -WorkingDirectory $Root ` + -StdoutPath $resultPath ` + -StderrPath (Join-Path $artifactRoot "repo-work-service-audit.stderr.log") } } @@ -2550,6 +2559,16 @@ if ($resultPath -ne "" -and (Test-Path -LiteralPath $resultPath)) { Write-Host "Repo work service runbook: service=$($result.serviceId), status=$($result.status), receipt=$($result.receiptId), command=$($result.command), args=$plannedArgs, owner=Idunn, hostedBody=repo-work, artifactSha256=$artifactSha256, elevatedRequired=false, aftercare=tools/epiphany_local_run.ps1 -Mode repo-work-queue-run -RepoWorkDryRun, path=$($result.runbookPath), privateStateExposed=$($result.privateStateExposed)" } elseif ($Mode -eq "repo-work-service-launch") { Write-Host "Repo work service launch: service=$($result.serviceId), status=$($result.status), processId=$($result.processId), exitCode=$($result.exitCode), receipt=$($result.receiptId), owner=Idunn, hostedBody=repo-work, waitChild=true, serviceManagerMutation=false, aftercare=tools/epiphany_local_run.ps1 -Mode repo-work-queue-run -RepoWorkDryRun, privateStateExposed=$($result.privateStateExposed)" + } elseif ($Mode -eq "repo-work-service-audit") { + $missing = "none" + if ($null -ne $result.missingChecks -and @($result.missingChecks).Count -gt 0) { + $missing = (@($result.missingChecks) -join ",") + } + $failed = "none" + if ($null -ne $result.failedChecks -and @($result.failedChecks).Count -gt 0) { + $failed = (@($result.failedChecks) -join ",") + } + Write-Host "Repo work service audit: service=$($result.serviceId), status=$($result.status), receipt=$($result.receiptId), plan=$($result.planStatus), runbook=$($result.runbookStatus), runbookArtifact=$($result.runbookArtifactStatus), launch=$($result.launchStatus), exitCode=$($result.launchExitCode), missing=$missing, failed=$failed, owner=Idunn, hostedBody=repo-work, serviceManagerMutation=false, nextSafeMove=$($result.nextSafeMove), privateStateExposed=$($result.privateStateExposed)" } elseif ($Mode -eq "swarm-online-runbook") { $aftercare = "none" if ($null -ne $result.aftercareCommands -and $result.aftercareCommands.Count -gt 0) {