From 8adaacb6d8a18779f017e3e1a41f374678d2f9c5 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 20 Jun 2026 19:50:23 +0100 Subject: [PATCH] Prove repo swarm gated stop cases --- ...piphany-swarm-stop-classification-smoke.rs | 255 +++++++++++++++++- epiphany-core/src/bin/epiphany-swarm.rs | 13 +- epiphany-core/src/bin/epiphany-work.rs | 1 + notes/epiphany-repo-swarm-mvp-contract.md | 22 +- notes/fresh-workspace-handoff.md | 2 +- state/ledgers.msgpack | Bin 347147 -> 348143 bytes state/map.yaml | 4 +- 7 files changed, 272 insertions(+), 25 deletions(-) diff --git a/epiphany-core/src/bin/epiphany-swarm-stop-classification-smoke.rs b/epiphany-core/src/bin/epiphany-swarm-stop-classification-smoke.rs index 60cb6d8d..f4ca8382 100644 --- a/epiphany-core/src/bin/epiphany-swarm-stop-classification-smoke.rs +++ b/epiphany-core/src/bin/epiphany-swarm-stop-classification-smoke.rs @@ -64,6 +64,9 @@ fn run_smoke(args: Args) -> Result { fs::create_dir_all(&smoke_dir) .with_context(|| format!("failed to create {}", smoke_dir.display()))?; + let origin = smoke_dir.join("origin.git"); + git(["init", "--bare", path_str(&origin)?], &smoke_dir)?; + let repo = smoke_dir.join("repo-body"); fs::create_dir_all(&repo).with_context(|| format!("failed to create {}", repo.display()))?; git(["init"], &repo)?; @@ -82,6 +85,9 @@ fn run_smoke(args: Args) -> Result { ["commit", "-m", "Seed swarm stop classification smoke"], &repo, )?; + git(["branch", "-M", "main"], &repo)?; + git(["remote", "add", "origin", path_str(&origin)?], &repo)?; + git(["push", "-u", "origin", "main"], &repo)?; let runtime_id = "swarm-stop-classification-smoke"; let local_verse = repo.join(".epiphany").join("local-verse.ccmp"); @@ -173,24 +179,24 @@ fn run_smoke(args: Args) -> Result { false, )?; - let item = "dry-run-preview"; + let item = "gate-proof"; cargo_json( &manifest, "epiphany-work", &[ - "accept", + "persona-intake", "--workspace", path_str(&repo)?, - "--from", - "persona", + "--epiphany-root", + path_str(&root)?, + "--runtime-id", + runtime_id, "--item", item, - "--summary", + "--message", "Prove a dry-run swarm pulse can classify a ready-to-run queue row without mutation.", - "--candidate-action-ref", - "candidate-action://swarm-stop-classification/dry-run-preview", - "--public-discussion-ref", - "eve://epiphany/persona/swarm-stop-classification", + "--topic", + "swarm-stop-classification", ], &root, )?; @@ -204,7 +210,7 @@ fn run_smoke(args: Args) -> Result { "--item", item, "--action-family", - "planning-note", + "repo-status-section", "--model-ref", "swarm-stop-classification-smoke-imagination-v1", "--model-authored", @@ -269,11 +275,230 @@ fn run_smoke(args: Args) -> Result { false, )?; + git( + [ + "checkout", + "-B", + "epiphany/swarm-stop-classification/gate-proof", + ], + &repo, + )?; + let publication_pipeline = cargo_json( + &manifest, + "epiphany-swarm", + &[ + "run", + "--workspace", + path_str(&repo)?, + "--epiphany-root", + path_str(&root)?, + "--runtime-id", + runtime_id, + "--local-verse-store", + path_str(&local_verse)?, + "--max-iterations", + "4", + "--max-items", + "1", + "--cooldown-seconds", + "0", + ], + &root, + )?; + require_eq( + &publication_pipeline, + &["stopClassification", "category"], + "iteration-limit", + )?; + let publication_gate_run = cargo_json( + &manifest, + "epiphany-swarm", + &[ + "run", + "--workspace", + path_str(&repo)?, + "--epiphany-root", + path_str(&root)?, + "--runtime-id", + runtime_id, + "--local-verse-store", + path_str(&local_verse)?, + "--max-iterations", + "1", + "--max-items", + "1", + "--cooldown-seconds", + "0", + ], + &root, + )?; + require_eq( + &publication_gate_run, + &["stopClassification", "category"], + "authority-gated", + )?; + require_eq( + &publication_gate_run, + &["stopClassification", "owner"], + "Bifrost", + )?; + require_eq( + &publication_gate_run, + &["stopClassification", "authorityGate"], + "awaiting-publication", + )?; + require_eq( + &publication_gate_run, + &["stopClassification", "blocker"], + "bifrost-publication-missing", + )?; + require_bool( + &publication_gate_run, + &["stopClassification", "mutatesState"], + false, + )?; + require_bool( + &publication_gate_run, + &["stopClassification", "requiresElevatedAuthority"], + false, + )?; + require_bool( + &publication_gate_run, + &["stopClassification", "privateStateExposed"], + false, + )?; + + let closure_receipt = repo + .join(".epiphany") + .join("work") + .join(format!("work-close-{item}.json")); + let publish = cargo_json( + &manifest, + "epiphany-work", + &[ + "publish", + "--workspace", + path_str(&repo)?, + "--epiphany-root", + path_str(&root)?, + "--item", + item, + "--closure-receipt", + path_str(&closure_receipt)?, + "--local-verse-store", + path_str(&local_verse)?, + "--change-summary", + "Swarm stop classification publication gate proof.", + "--justification", + "Disposable Bifrost proof for gated repo-swarm stop classification.", + "--ledger-entry-id", + "swarm-stop-classification-publication-ledger", + "--pull-request-url", + "https://example.invalid/GameCult/swarm-stop-classification/pull/1", + "--pull-request-number", + "1", + "--pull-request-title", + "Swarm stop classification publication gate proof", + ], + &root, + )?; + require_eq(&publish, &["status"], "publication-receipts-recorded")?; + cargo_json( + &manifest, + "epiphany-work", + &["overview", "--workspace", path_str(&repo)?, "--item", item], + &root, + )?; + let sync_gate_run = cargo_json( + &manifest, + "epiphany-swarm", + &[ + "run", + "--workspace", + path_str(&repo)?, + "--epiphany-root", + path_str(&root)?, + "--runtime-id", + runtime_id, + "--local-verse-store", + path_str(&local_verse)?, + "--max-iterations", + "1", + "--max-items", + "1", + "--cooldown-seconds", + "0", + ], + &root, + )?; + require_eq( + &sync_gate_run, + &["stopClassification", "category"], + "authority-gated", + )?; + require_eq( + &sync_gate_run, + &["stopClassification", "owner"], + "Bifrost/GitHub", + )?; + require_eq( + &sync_gate_run, + &["stopClassification", "authorityGate"], + "awaiting-upstream-sync", + )?; + require_eq( + &sync_gate_run, + &["stopClassification", "blocker"], + "merge-or-sync-receipt-missing", + )?; + require_bool( + &sync_gate_run, + &["stopClassification", "mutatesState"], + false, + )?; + require_bool( + &sync_gate_run, + &["stopClassification", "requiresElevatedAuthority"], + false, + )?; + require_bool( + &sync_gate_run, + &["stopClassification", "privateStateExposed"], + false, + )?; + + git(["push", "origin", "HEAD:main"], &repo)?; + git(["fetch", "origin", "main"], &repo)?; + let publish_receipt = repo + .join(".epiphany") + .join("work") + .join(format!("work-publish-{item}.json")); + let sync = cargo_json( + &manifest, + "epiphany-work", + &[ + "sync", + "--workspace", + path_str(&repo)?, + "--item", + item, + "--publish-receipt", + path_str(&publish_receipt)?, + "--upstream-ref", + "origin/main", + "--merge-receipt", + "maintainer-merge:swarm-stop-classification-smoke", + ], + &root, + )?; + require_eq(&sync, &["status"], "upstream-main-synced")?; + let summary = json!({ "schemaVersion": "epiphany.repo_swarm_stop_classification_smoke.v0", "status": "ok", "smokeDir": smoke_dir, "repo": repo, + "origin": origin, "emptyStopCategory": empty_run["stopClassification"]["category"], "emptyStopOwner": empty_run["stopClassification"]["owner"], "emptyStopGate": empty_run["stopClassification"]["authorityGate"], @@ -281,6 +506,16 @@ fn run_smoke(args: Args) -> Result { "dryRunStopOwner": dry_run["stopClassification"]["owner"], "dryRunStopGate": dry_run["stopClassification"]["authorityGate"], "dryRunSelectedItem": dry_run["stopClassification"]["selectedItem"], + "publicationStopCategory": publication_gate_run["stopClassification"]["category"], + "publicationStopOwner": publication_gate_run["stopClassification"]["owner"], + "publicationStopGate": publication_gate_run["stopClassification"]["authorityGate"], + "publicationStopBlocker": publication_gate_run["stopClassification"]["blocker"], + "syncStopCategory": sync_gate_run["stopClassification"]["category"], + "syncStopOwner": sync_gate_run["stopClassification"]["owner"], + "syncStopGate": sync_gate_run["stopClassification"]["authorityGate"], + "syncStopBlocker": sync_gate_run["stopClassification"]["blocker"], + "syncStatus": sync["status"], + "upstreamMainSynced": sync["authority"]["upstreamMainSynced"], "mutatesState": false, "requiresElevatedAuthority": false, "privateStateExposed": false, diff --git a/epiphany-core/src/bin/epiphany-swarm.rs b/epiphany-core/src/bin/epiphany-swarm.rs index 47f68e91..764819c2 100644 --- a/epiphany-core/src/bin/epiphany-swarm.rs +++ b/epiphany-core/src/bin/epiphany-swarm.rs @@ -414,6 +414,7 @@ fn run_swarm(args: RunArgs) -> Result { "queueRunStatus": queue_status, "actionableCount": actionable_count, "queueCount": queue_run["queueCount"], + "queueRows": queue_run["queueRows"], "selectedRows": queue_run["selectedRows"], "outputs": queue_run["outputs"], "receiptPath": queue_run["receiptPath"], @@ -542,7 +543,13 @@ fn classify_run_stop( let selected_row = final_iteration .and_then(|iteration| iteration.get("selectedRows")) .and_then(Value::as_array) - .and_then(|rows| rows.first()); + .and_then(|rows| rows.first()) + .or_else(|| { + final_iteration + .and_then(|iteration| iteration.get("queueRows")) + .and_then(Value::as_array) + .and_then(|rows| rows.first()) + }); let selected_output = final_iteration .and_then(|iteration| iteration.get("outputs")) .and_then(Value::as_array) @@ -616,7 +623,7 @@ fn classify_run_stop( "blocked-or-noop" if actionable_count == 0 => { let owner = match selected_gate.as_str() { "awaiting-publication" => "Bifrost", - "awaiting-sync" => "Bifrost/GitHub", + "awaiting-sync" | "awaiting-upstream-sync" => "Bifrost/GitHub", "awaiting-closure" => "Soul", "ready-to-run" | "ready-to-adopt" | "ready-to-execute" => "Self", _ => "Self", @@ -625,7 +632,7 @@ fn classify_run_stop( "awaiting-publication" => { "epiphany-work publish --workspace --closure-receipt " } - "awaiting-sync" => { + "awaiting-sync" | "awaiting-upstream-sync" => { "epiphany-work sync --workspace --publish-receipt " } "awaiting-closure" => { diff --git a/epiphany-core/src/bin/epiphany-work.rs b/epiphany-core/src/bin/epiphany-work.rs index 7c774dd4..0000a5a8 100644 --- a/epiphany-core/src/bin/epiphany-work.rs +++ b/epiphany-core/src/bin/epiphany-work.rs @@ -9068,6 +9068,7 @@ fn run_queue(args: QueueArgs) -> Result { "maxItems": receipt["maxItems"], "dryRun": receipt["dryRun"], "receiptPath": receipt_path, + "queueRows": receipt["queueRows"], "selectedRows": receipt["selectedRows"], "outputs": receipt["outputs"], "authority": receipt["authority"], diff --git a/notes/epiphany-repo-swarm-mvp-contract.md b/notes/epiphany-repo-swarm-mvp-contract.md index 3e9073ba..2b15be17 100644 --- a/notes/epiphany-repo-swarm-mvp-contract.md +++ b/notes/epiphany-repo-swarm-mvp-contract.md @@ -1464,9 +1464,10 @@ Build the remaining MVP in this order: `epiphany.repo_swarm_run_stop_classification.v0` into the run receipt so agents can see stop category, owner, authority gate, blocker, recommended command, mutability/elevation flags, queue status, and private-state seal - without parsing prose. Fresh proof now covers empty-queue and dry-run - planning-preview stops; remaining stop-depth work belongs to gated - publication/sync/service cases and safe-family depth. + without parsing prose. Fresh proof now covers empty-queue, dry-run + planning-preview, Bifrost publication, and Bifrost/GitHub upstream-sync + stops; remaining stop-depth work belongs to service lifecycle cases and + safe-family depth. 5. **Execute-to-close handoff.** Let the scheduler route from branch-local Hands execution into Soul/Modeling/Mind closure when the required execute receipts exist. The closure may be deterministic for mechanical work and @@ -1818,12 +1819,15 @@ Required organs before MVP: with category `iteration-limit`, owner `Self`, gate `self.scheduler-iteration-limit`, non-mutating/non-elevated flags, and `privateStateExposed=false`. Focused stop proof - `.epiphany-smoke\swarm-stop-classification-20260620-181606` now also proves - `queue-empty` / Gjallar / `repo.work.overview` for an empty repo queue and - `dry-run-preview` / Self / `ready-to-run` for a planning item preview, both - non-mutating, non-elevated, and private-state sealed. Remaining work is - gated publication/sync/service stop depth and richer closure depth rather - than basic safe-family planning cargo. + `.epiphany-smoke\swarm-stop-classification-20260620-184717` now also proves + `queue-empty` / Gjallar / `repo.work.overview` for an empty repo queue, + `dry-run-preview` / Self / `ready-to-run` for a planning item preview, + `authority-gated` / Bifrost / `awaiting-publication` for the publication + 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. Remaining + work is service lifecycle stop depth and 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 5cf52ac2..75ad8f22 100644 --- a/notes/fresh-workspace-handoff.md +++ b/notes/fresh-workspace-handoff.md @@ -109,7 +109,7 @@ remembers doctrine; the branch remembers the blade. - 2026-06-20: Typed Imagination action-item receipts are live in `epiphany-work derive-plan`. The command now writes `work-action-items-.json` with schema `epiphany.repo_work_imagination_action_items_receipt.v0` before writing `work-plan-.json`; the receipt carries model provenance, safe action family, requested paths, verification asks, stop conditions, escalation reasons, rollback hints, public/candidate refs, `operatorAuthoredShellDetails=false`, and no Hands/durable-state/publication/service/cross-repo authority. The plan derivation cites the action-item receipt, while command text remains deterministic safe-family lowering. Disposable proof `.epiphany-smoke\action-items-20260620-023240` wrote action receipt `repo-work-action-items-action-items-request` with `modelAuthored=true`, `safeActionFamily=repo.markdown_planning_note`, requested path `notes/epiphany-work/action-items-request.md`, plan citation present, and `privateStateExposed=false`. The next cut is deeper model-authored closure review, further non-planning action classes, or Idunn-owned queue-run service execution; not another basic action-item schema. - 2026-06-20: The first richer model-authored safe family is live. `epiphany-work derive-plan --action-family checklist-note` lowers accepted Persona/Bifrost pressure into a contained markdown checklist under `notes/epiphany-work/-checklist.md` with safe family `repo.checklist_note`, model provenance, candidate/public refs, branch-local checklist items, verification asks, rollback hints, and authority seals forbidding publication, merge, service lifecycle, cross-repo mutation, durable-state admission, and private-state exposure. Disposable proof `.epiphany-smoke\checklist-note-20260620-031347` ran accept -> derive-plan with `--model-ref smoke-imagination-v0 --model-authored` -> run -> adopt -> execute on an `epiphany/*` branch; the derivation and action-item receipt both reported `modelAuthored=true`, Hands created a branch-local commit, overview reported `awaiting-closure`, and `privateStateExposed=false`. - 2026-06-20: `epiphany-swarm run` is live as the bounded repo-swarm operator mouth over Self's queue/tick physiology. It requires the online receipt/local Verse queue, delegates queue selection to `epiphany-work queue-run`, delegates item actuation to `epiphany-work tick`, writes `epiphany.repo_swarm_run_receipt.v0` at `.epiphany\swarm-run\repo-swarm-run-receipt.json`, and keeps publication, merge, service lifecycle, elevation, cross-repo mutation, and private-state exposure sealed. Wrapper mode `tools/epiphany_local_run.ps1 -Mode repo-swarm-run` exposes the surface with brake preflight and compact pulse summaries. Disposable proof `.epiphany-smoke\swarm-run-20260620-024252` first returned dry-run preview `would-advance/run-from-plan`; wrapper artifact `local-20260620-024413-360-85548195` printed the same queue/tick delegation; a non-dry single pulse advanced `swarm-run-request` from `ready-to-run` to refreshed overview `ready-to-adopt` with `privateStateExposed=false`. The next cut is deeper model-authored closure review, further non-planning action classes, or Idunn-owned queue-run service execution; not another queue mouth. -- 2026-06-20: `epiphany-swarm run` stop classification is now typed. The run receipt/result embeds `epiphany.repo_swarm_run_stop_classification.v0` with status, stop reason, category, owner, authority gate, blocker, selected queue context, recommended command, mutability/elevation flags, and private-state seal. Fresh-repo proof `.epiphany-smoke\fresh-repo-mvp-20260620-180024` ran init -> online -> Persona intake -> model-authored repo-status plan -> swarm run -> close -> publish -> upstream-main sync -> export proof; the run stopped as `paused-at-iteration-limit` with stop category `iteration-limit`, owner `Self`, authority gate `self.scheduler-iteration-limit`, no state mutation/elevation in the stop packet, and `privateStateExposed=false`. Focused proof `.epiphany-smoke\swarm-stop-classification-20260620-181606` now also proves `queue-empty` / Gjallar / `repo.work.overview` for an empty repo queue and `dry-run-preview` / Self / `ready-to-run` for a planning item preview, both non-mutating, non-elevated, and `privateStateExposed=false`. Remaining repo-swarm work is gated publication/sync/service stop depth, deeper interpreter/closure semantics, more useful repo-owned configuration/action families, and Idunn-owned queue-run lifecycle under explicit operator authority. +- 2026-06-20: `epiphany-swarm run` stop classification is now typed. The run receipt/result embeds `epiphany.repo_swarm_run_stop_classification.v0` with status, stop reason, category, owner, authority gate, blocker, selected queue context, recommended command, mutability/elevation flags, and private-state seal. Fresh-repo proof `.epiphany-smoke\fresh-repo-mvp-20260620-180024` ran init -> online -> Persona intake -> model-authored repo-status plan -> swarm run -> close -> publish -> upstream-main sync -> export proof; the run stopped as `paused-at-iteration-limit` with stop category `iteration-limit`, owner `Self`, authority gate `self.scheduler-iteration-limit`, no state mutation/elevation in the stop packet, and `privateStateExposed=false`. Focused proof `.epiphany-smoke\swarm-stop-classification-20260620-184717` now also proves `queue-empty` / Gjallar / `repo.work.overview` for an empty repo queue, `dry-run-preview` / Self / `ready-to-run` for a planning item preview, `authority-gated` / Bifrost / `awaiting-publication` for the publication blocker, and `authority-gated` / Bifrost/GitHub / `awaiting-upstream-sync` for the upstream-main sync blocker. All stop packets are non-mutating, non-elevated, and `privateStateExposed=false`. Remaining repo-swarm work is service lifecycle stop depth, deeper interpreter/closure semantics, more useful repo-owned configuration/action families, and Idunn-owned queue-run lifecycle under explicit operator authority. - 2026-06-20: Execute-to-close scheduler handoff is live. `epiphany-work tick` now treats `awaiting-closure` as tick-actionable, delegates executed branch-local work to the existing `epiphany-work close` gate, writes Soul verdict plus Modeling summary plus Mind state-commit receipts, then stops at `awaiting-publication` with Bifrost as blocker. Disposable proof `.epiphany-smoke\tick-close-20260620-025526` ran `epiphany-swarm run --max-iterations 4` through `run-from-plan,adopt-from-plan,execute-from-plan,close-from-execute`; the final overview reported `awaiting-publication` / `bifrost-publication-missing`, and the close receipt was `closed`, Soul `passed`, Mind commit `repo-work-close-tick-close-request-mind-commit`, `durableStateAdmitted=true`, and `privateStateExposed=false` with publication/merge/service/cross-repo authority sealed. The next cut is deeper model-authored closure review, further non-planning action classes, or Idunn-owned queue-run service execution; not another scheduler handoff. - 2026-06-20: Local proof-bundle packaging is live. `epiphany-work overview` now embeds `epiphany.repo_work_proof_bundle.v0` with generated time, gate/blocker/next-safe-move, compact TUI rows, expected artifact paths, present/missing artifact status, document schema/status, SHA-256 receipt hashes, and `privateStateExposed=false`. Disposable proof `.epiphany-smoke\tick-close-20260620-025526\08-overview-proof-bundle.json` reported six present artifacts from accept through close with hashes, missing publish/sync rows, `awaiting-publication` / `bifrost-publication-missing`, and no private-state exposure. The next cut is deeper model-authored closure review, further non-planning action classes, or Idunn-owned queue-run service execution; not another local proof-bundle wrapper. - 2026-06-20: Published/credited proof-bundle rows are live. `epiphany-work overview` now adds `publicationRows` to `epiphany.repo_work_proof_bundle.v0`, lifting Bifrost intent/publication/GitHub/ledger/credit/PR fields, Hands commit/PR fields, and upstream-main ancestry fields from publish/sync receipts without granting publication, merge, scheduler, service lifecycle, cross-repo, or private-state authority. Disposable proof `.epiphany-smoke\checklist-note-20260620-031347\12-overview-published-proof.json` ran close -> publish -> sync -> overview after the checklist safe-family proof; overview reported `complete-or-awaiting-new-work`, `upstreamMainSynced=true` from `authority.upstreamMainSynced`, three publication rows, and `privateStateExposed=false`. The next cut is deeper model-authored closure review, further non-planning action classes, or Idunn-owned queue-run service execution; not basic Bifrost/GitHub/sync row visibility. diff --git a/state/ledgers.msgpack b/state/ledgers.msgpack index 4b4541486dad6c50f2402ec9e0c50a1bd6097e40..73a5a59cd379ea4c7d7e87fd446f54f43bc8bc23 100644 GIT binary patch delta 748 zcmbV~J#P~+7{|GAClD-1G!TXg3xq_ayXHlwG|2`MZ>hw9nAn`l)5PkX?fT`e5km(C z1||fN*-F0v0xv6j`h`WQ>9DMe# zoLRlItALIT83s4^6hjlNV2rpPr6j?MFp4l8Bh94}fU`)>Xo93-T&^SFgikS@MFkVv zXh(yFNN9>EE06%C1(nt6BUVUcYpW?BSzwW&jA=CumldkjTU>wyk;9+=5sHWcQS~Aq z0m79G%dT9#B*jvaEdl~%n4A4~{-wUV>o(aEOe(}vEfFp-QG`ySlN`%q&3i=M*CX@c zhu<*6&EUpb9Jktt3+9@EjH_9N5~8t~m6W#EoInwpmp}cB!;^)b#1NIP5|;54oXF6M zp;4xlMWK_X`+yYk(zi2;I8L@f8Gcx+uS&qFJ+=N