Skip to content

[ALLEN Pi/Spark G3] Rebuild a workflow after a restart from the authoritative records - #62

Draft
aien-spark wants to merge 2 commits into
lane-g/g2-uncertain-statefrom
lane-g/g3-rebuild-from-records
Draft

aien-spark wants to merge 2 commits into
lane-g/g2-uncertain-statefrom
lane-g/g3-rebuild-from-records

Conversation

@aien-spark

Copy link
Copy Markdown
Collaborator

Closes #56

Stacked on #61 (G2). Base is the G2 branch so this diff shows G3 only.

What changed

  • New src/orchestration/recovery.rs:
    • AuthorityLookup (read-only async trait): effect_state(intent), grant(grant), receipt_present(receipt), keyed by the ids in docs/DELEGATED-DAG.md (effect intent id, grant id, receipt digest).
    • StoredPointers / TaskPointers: what AEGIS keeps (run id, cause id, objective id, spec digest; per task: effect class, intent id, grant id, receipt digest, no-effect result digest).
    • rebuild(spec, pointers, lookup) -> Result<WorkflowSnapshot, RecoveryRefusal>, pure (same records, same snapshot), never calls a task body.
  • Rules: DONE with receipt gives Completed; OPEN or UNRESOLVED gives Uncertain (G2); NOT_DONE gives Ready only under a still-valid grant, else WaitingForApproval (needs a newly issued grant); a spent grant whose intent nobody can name gives Uncertain; a no-effect task that never finished gives Ready once its prerequisites are Completed (Pending otherwise); DONE is terminal and never run again.
  • Named refusals (RECOVERY_*): spec mismatch, missing pointers (including an effect task with no grant), unknown task pointer, unreachable authority, missing effect record, unknown grant, intent mismatch between pointer and desk, DONE without receipt.
  • WorkflowSpec::dependencies() added (needed to read edges from outside workflow.rs). One sentence in docs/WORKFLOW-DAG.md so the restart boundary is not stale.

Tested commit

833b8a5 (host, 2026-10-16, sibling ../aien-protocols at main 4b76f7f).

Check Result
Red first: tests before the module FAIL as expected (aegis::orchestration::recovery unresolved)
AEGIS-TEST PASS, 177 passed, 0 failed (15 new in tests/workflow_recovery_tests.rs)
AEGIS-CLIPPY (-D warnings), AEGIS-FMT, AEGIS-CHECK PASS
AEGIS-ANTI-SLOP, AEGIS-ZERO-DISK-SECRETS, CRUMB-VERIFY PASS
Negative control (#56 item 4): fake lookup says DONE, no receipt PASS: refused RECOVERY_DONE_WITHOUT_RECEIPT, both with no receipt pointer and with a pointer the authority does not hold
Deliberate break: accept DONE without a receipt RED as required: negative_control_done_without_receipt_is_refused fails; restored, 15 of 15 green
Spark bundle for the PR head NOT_RUN: judged by the Spark pipeline, not run from this session
Real authority adapter (sovereign-core effect ledger, desk) NOT_RUN: outside the frozen first cut; needs aien-dev/aien-sovereign-core-mv#379 (durable objective record and resume)

Remaining gap

Nothing stores StoredPointers yet (no table; D2 in DELEGATED-DAG.md proposes the #379 objective record as their home). Pointer ids are opaque strings; their byte form follows PST1 once C4 lands. Objective and cause checks on resume are G4 row 4.

Next dependency

G4 (#57) stacks on this branch and drills it.

🤖 Generated with Claude Code

drakestapleton and others added 2 commits October 16, 2026 14:44
#56)

New src/orchestration/recovery.rs. AuthorityLookup is a read-only trait
for effect state, grant state and receipt presence, keyed by the ids
DELEGATED-DAG.md names (effect intent id, grant id, receipt digest).
rebuild() takes the spec, the stored pointers and the lookup and returns
a WorkflowSnapshot: DONE with receipt is Completed; OPEN or UNRESOLVED
is Uncertain (G2); NOT_DONE is Ready only under a still-valid grant,
else WaitingForApproval; a spent grant with no nameable intent is
Uncertain; a no-effect task that never finished is Ready once its
prerequisites are Completed. No task body is ever called.

Named refusals, never a silent fresh start: spec mismatch, missing or
unknown pointers, unreachable authority, missing effect record, unknown
grant, intent mismatch, DONE without receipt (negative control).
WorkflowSpec gains dependencies(). Tests use an in-memory fake; the
deliberate break (accept DONE without receipt) turns the negative
control red.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

⚖️ Sovereign Code Review & Alignment Gate

Greetings @aien-spark. I am AIEN, the automated review gate for the AIENOS project.

Your pull request #62 ("[ALLEN Pi/Spark G3] Rebuild a workflow after a restart from the authoritative records") has undergone automated auditing against the project standards.

✅ Doctrine Diff Audit: PASS

  • Telemetry Check: Clean (zero tracking or surveillance hooks detected).
  • Sovereign Voice & Formatting Check: Clean (zero em/en dashes, zero banned buzzwords).
  • Secrets & Credentials Check: Clean (zero plaintext secrets, hardware vault only).
  • Status: Project standards verified.

🌿 Sovereign Steward: Contributor Alignment Interview

Greetings @aien-spark. I am AIEN, the automated steward for the AIENOS project.

We welcome all contributors who share our commitment to open collaboration, global humanity, and disciplined systems craftsmanship. We build to expand computing capability, advance open-source intelligence, and share technology freely with the world.

Your pull request #62 ("[ALLEN Pi/Spark G3] Rebuild a workflow after a restart from the authoritative records") is ready for stewardship alignment.

Please respond directly to these four alignment inquiries:

  1. Long-Term Mission Alignment:
    This initiative is an enduring engineering commitment to open-source technology for humanity, not a vehicle for short-term hype, social media monetization, or get-rich-quick ventures. How does your contribution support global progress and the resilience of local communities?

  2. Telemetry & Integrity:
    Do you certify that this change introduces zero telemetry, zero surveillance, and zero artificial paywalls?

    "I certify that my contribution is submitted in service of human sovereignty and open collaboration. I affirm that this work maintains zero telemetry, contains no surveillance backdoors, and introduces no artificial barriers, and that I offer it under AGPL-3.0-or-later, the license that governs this project. I build so that intelligence is owned by the person who runs it, not rented."

  3. Downstream Heritage Preservation:
    Do you acknowledge and agree that any downstream branch, fork, or copy of this work remains under AGPL-3.0-or-later and retains the project's license and attribution notices, as the LICENSE file requires?

  4. Craftsmanship & Native Discipline:
    What architectural trade-offs did you make, and how did you verify that this code introduces zero regressions, zero unneeded dependencies, and complies with our pure native compiled standards?


Reply to this comment with your affirmation. Once verified against the project standards, I will grant the sovereign-interview-passed clearance. For direct sovereign coordination: Drake Stapleton ([email protected]) and AIEN ([email protected])

@github-actions github-actions Bot added needs-testimony Awaiting contributor oath testimony sovereign-audit-passed Diff clean: zero telemetry and unslop verified labels Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-testimony Awaiting contributor oath testimony sovereign-audit-passed Diff clean: zero telemetry and unslop verified

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants