interplane.Get Omega
Read in your language

aegis-runtime-mv

Native Rust agent runtime: Axum WebSocket/SSE/REST gateway, heartbeat scheduler, dependency-aware task workflow, SQLite storage. Attachment of AienOS. Pre-alpha.

Brought by drakestapleton

GitHub aien-dev/aegis-runtime-mv#61 (code only)

closed derived 2271558e5614a1e2 #61

Imported from GitHub aien-dev/aegis-runtime-mv#61 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base 7a8b0b9981598f6745d552c007f678d63642292f · Head c1776dbe01c4d031d5b80589a278e369ea617190

github-actions[bot] wrote on 2026-10-16 19:41 UTC

⚖️ Sovereign Code Review & Alignment Gate

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

Your pull request #61 ("[ALLEN Pi/Spark G2] Report "not known whether it happened" as its own task state") 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 #61 ("[ALLEN Pi/Spark G2] Report "not known whether it happened" as its own task state") 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."

  1. 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?
  2. 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 (drake@aienos.com) and AIEN (aien@aienos.com)

Fetch it

A git bundle of the pull request's head, 15551 bytes.

curl -fsSL https://interplane.io/drakestapleton/aegis-runtime-mv/patches/2271558e5614a1e2.bundle -o 2271558e5614a1e2.bundle
git fetch 2271558e5614a1e2.bundle refs/pull/61/head

Raw bundle · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/aegis-runtime-mv
61
c1776dbe01c4d031d5b80589a278e369ea617190
{"kind":"github-import","owner":"aien-dev","repo":"aegis-runtime-mv","number":61,"url":"https://github.com/aien-dev/aegis-runtime-mv/pull/61","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:39:37Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/docs/DELEGATED-DAG.md b/docs/DELEGATED-DAG.md
new file mode 100644
index 0000000..b89dcfb
--- /dev/null
+++ b/docs/DELEGATED-DAG.md
@@ -0,0 +1,98 @@
+# Delegated DAG: one authority per fact (issue #54, lane G1)
+
+**Status:** DRAFT. Sections 3 and 4 hold decisions that are **proposed, awaiting owner acknowledgement** from the aien-sovereign-core#379 owner and the AIENOS owner. Until both acknowledge on the PR, nothing here is accepted and no recovery code may treat it as settled.
+
+Parent: aien-dev/aegis-runtime-mv#53 (lane G of aien-dev/aien-architecture-mv#231). Wire format: PST1 Draft v0, aien-protocols `specs/pi-spark-task/SPEC.md` (aien-dev/aien-protocols-mv#34, branch `integ/allen-pispark-lane-c`).
+
+## In plain words
+
+When the Pi hands the Spark a job made of several steps, many facts describe it: what the user asked for, which steps exist and in what order, whether each step is done, whether each real-world change happened, who approved it and where the proof is. Each fact gets exactly one owner. AEGIS keeps only pointers to those owners, so after a crash there is no second copy that can disagree with the real one.
+
+## 1. Ground truth read for this document
+
+Read on 2026-10-16. Each line names what the code says, not what a plan says.
+
+| Source | What it says |
+|---|---|
+| aegis `README.md` line 3 | AEGIS is not part of the WHOLE-SYSTEM-E2E v1 release. The production runtime in aien-sovereign-core carries the capability checks, the approval desk, effect authorization and fail-closed behaviour. |
+| aegis `docs/WORKFLOW-DAG.md`, `src/orchestration/workflow.rs` (`971d450`) | The DAG is memory only. `WorkflowSnapshot` serializes; nothing stores or reloads it. |
+| aegis `src/persistence/sqlite/schema.rs` | Tables for sessions, messages, runs, actions, approvals, audit events, turns, heartbeats, single queued `tasks` (id, type, payload, status, result), memory crumbs, skills. None holds a workflow id, a dependency edge or an effect pointer. |
+| aien-sovereign-core `crates/aien-runtime/src/objective.rs` | Objective id = SHA-256 of `AIEN_E2E_OBJECTIVE_V1`, LF, the objective text (64 lowercase hex). The record `objectives/<id>.json` lives under the provenance root on the Spark. The operator tool (`aien-cli objective record`) writes it; the daemon only reads it. |
+| aien-sovereign-core `crates/aien-runtime/src/effects.rs` | Durable effect intents on the compose home's Cortex journal, states OPEN, DONE, NOT_DONE, UNRESOLVED. The world decides the state. An effect is never re-run by that module; a retry after NOT_DONE needs a new authorization. Grants are journal records (`approved_grant`, `minted_grant`) and, since sovereign-core #408, may be bound to an objective record (`GrantObjective`), re-checked before every intent. Refusals by name: `NotAuthorized`, `AlreadySpent`, `ReconciliationRequired`, `Stopped`, `ObjectiveMissing`, `ObjectiveMismatch`. |
+| aien-sovereign-core `crates/aien-mcp/src/approval.rs` | A second desk, `ApprovalDesk`, for the MCP effect lane. Grants are bound to an intent digest, idempotency key, world and J-node, and live in memory only: a restart forgets every grant. |
+| aien-dev/aien-sovereign-core-mv#379 (open) | No durable objective record with its planned effects, no `resume-objective` command. Its text says "grants live in memory only"; that is true of the MCP desk, not of the compose ledger grants above (finding F1 below). |
+| AIENOS `docs/adr/0018-allen-subject-state-object.md` | The subject's standing intents are 96-byte rows with a `kind` and a payload of two u64 values. v0 defines one kind, `GOAL_LATENCY`. At most one ACTIVE intent per (kind, payload[0]) slot. |
+| aien-architecture `docs/hardening/causal-id-join-v0.md` sections 2.1 and 2.3 (DRAFT) | One 32-byte cause id, minted where the outside request enters AIEN, copied across every handoff and never minted again. |
+| PST1 Draft v0 sections 4, 5, 8 | Header carries `cause_id`, `origin_run_id`, `objective_id`, `subject_id`, `parent_task_id`, `task_id`, `idempotence_key`, `effect_class`. Status comes from authoritative state on the Spark. Uncertain effects are reconciled against the sovereign-core effect ledger before any retry. |
+
+**Finding F1.** There are two grant authorities in aien-sovereign-core today. The compose effect ledger's grants are durable (Cortex journal) and can be objective-bound (#408). The MCP `ApprovalDesk` grants are memory only. aegis-runtime-mv#59 (G6) and aien-sovereign-core-mv#379 both name the MCP desk. Section 3, decision D3, proposes which one a delegated task uses.
+
+## 2. One authority per fact
+
+AEGIS stores **pointers only**: ids and digests that name a record held elsewhere. `WorkflowSnapshot` and workflow events are hints for display, never a source for recovery.
+
+| Fact | The one authority | Id that names it | What AEGIS stores |
+|---|---|---|---|
+| Cause of the work | The Pi, at the user's turn (causal id join 2.1, 2.3) | `cause_id`, 32 bytes (PST1 header) | The cause id, copied. AEGIS never mints one; work without it is refused (PST1 `PST_NO_CAUSE`). |
+| User objective | aien-sovereign-core objective record on the Spark (`objective.rs`), with the Pi as requester (D1) | `objective_id`, 64 hex = 32 bytes (PST1 header) | The objective id. |
+| Task list and dependency edges | The aien-sovereign-core#379 durable objective record ("the planned effects, their grant ids and states"), extended with one row per AEGIS task and its predecessors (D2) | `objective_id` plus AEGIS `TaskId` per row; PST1 `task_id` and `parent_task_id` | A SHA-256 digest of the submitted spec (task ids and edges, sorted), so a rebuilt spec that differs is refused. |
+| Each task's state | Nobody stores it. It is derived on demand from the effect state and receipt of that task (section 3, rebuild rule) | AEGIS `RunId` plus `TaskId` | Nothing durable. The in-memory `TaskState` is a cache. |
+| Each effect's state | aien-sovereign-core effect ledger (`effects.rs`): OPEN, DONE, NOT_DONE, UNRESOLVED | Effect intent record id (Cortex host record id) in one compose home | Task id to effect intent id. |
+| Each approval | aien-sovereign-core compose ledger grant, objective-bound (#408) (D3) | Grant record id; it names the objective id and the proposal digest | Task id to grant id. Never the grant itself, never an approval decision. |
+| Each receipt | aien-sovereign-core: the terminal effect record (ack or reconcile) for an effectful task; the `WorkflowSnapshot.results` digest for a no-effect result | Receipt digest, 32 bytes (PST1 `receipt_reference` payload) | Task id to receipt digest. |
+| Idempotence of a request | The Pi, which picks the key once per request (PST1 section 8) | `idempotence_key`, 16 bytes, with `task_id` | Request key to `RunId`, so a repeated request maps to the same run. |
+
+Every pointer AEGIS keeps can be thrown away and rebuilt from the authorities. If AEGIS's pointers and an authority disagree, the authority wins and the disagreement is reported.
+
+## 3. Rebuild rule after a restart, fact by fact
+
+The recovery code (G3, aegis-runtime-mv#56) follows these rules. A missing pointer or an unreachable authority is a named refusal, never a fresh start.
+
+| Fact | Rule |
+|---|---|
+| Cause id | Taken from the Pi's `resume_request`. If it differs from the stored cause id: refuse. |
+| Objective | Re-read the objective record. Missing: refuse (`ObjectiveMissing`). Text changed: refuse (`ObjectiveMismatch`). |
+| Task list and edges | Rebuilt from the durable objective record. Its digest must equal the stored spec digest; otherwise refuse. Until aien-sovereign-core#379 lands, no such record exists, so the host stand-in in G3 is the only source and the physical rebuild is NOT_RUN. |
+| Effectful task | Ask the effect ledger by intent id. DONE with a receipt: Completed, never run again. DONE without a receipt: refuse (negative control). OPEN or UNRESOLVED: the uncertain state from G2, dependents blocked, nothing retried until reconciled. NOT_DONE: may run again only under a grant that is still valid or newly issued. No intent recorded and no grant spent: not started. |
+| No-effect task | Never finished: Ready again (re-running it changes nothing outside). Finished with a result digest: Completed. |
+| Approval | Re-checked against the desk before any effect. Stale, foreign or forged: refuse with a named reason (G6). |
+| Receipt | Must exist at the authority for every Completed effectful task. |
+
+## 4. Proposed decisions (awaiting owner acknowledgement)
+
+Each decision is **proposed, awaiting owner acknowledgement**. Acknowledgement requests: aien-dev/aien-sovereign-core-mv#379 (sovereign-core owner, D1 to D4) and aien-dev/aienos-mv#399 (AIENOS owner, D1).
+
+### D1. Where the Pi-side objective lives (proposed)
+
+**Proposal:** the sovereign-core objective record on the Spark is the one authority, with the Pi as the requester. The Pi keeps only the cause id and the objective id as pointers. No new ADR 0018 standing-intent kind.
+
+Reasons:
+1. Grants and effect intents already bind to this record (#408) and are re-checked against it before every intent. A second objective store on the Pi would be a second source of truth for the same fact.
+2. The objective id is a pure function of the text (`objective.rs`). The Pi can compute and check it without trusting the Spark, which gives the Pi ownership of *what was asked* without holding the record.
+3. ADR 0018 standing intents describe what the subject continuously intends, one ACTIVE row per (kind, payload[0]) slot, with a 16-byte payload. A per-request user task is short-lived, many may be open at once, and its 32-byte objective id does not fit the payload. Fitting it would change the frozen-pending format of kind 24.
+
+Gap stated plainly: today only the operator tool writes objective records. A path where a Pi request causes the record to be written belongs to aien-sovereign-core#379, not to AEGIS.
+
+### D2. Where the task list and edges live (proposed)
+
+**Proposal:** inside the aien-sovereign-core#379 durable objective record, one row per planned task (AEGIS `TaskId`, predecessors, effect class, grant id, effect intent id). AEGIS submits the spec; it does not store it durably.
+
+Reason: #379 already plans "the planned effects, their grant ids and states" in that record. Adding the edges there keeps one record per objective instead of a parallel workflow table in AEGIS's SQLite.
+
+### D3. Which grant a delegated effect uses (proposed)
+
+**Proposal:** the compose effect ledger grant (durable, objective-bound, #408), not the in-memory MCP `ApprovalDesk` grant.
+
+Reason: a delegated task must survive a Spark restart between approval and effect (parent item 5). An in-memory grant is forgotten on restart, so the task could never finish without a new human approval, and AEGIS could not tell a forgotten grant from a forged one. G6's fake desk uses an opaque grant id so either choice fits the same wrapper.
+
+### D4. Whether the delegated DAG stays in AEGIS (proposed)
+
+**Proposal:** the host first cuts G2 to G6 stay in AEGIS, written as pure functions behind traits (`EffectLookup`, `GrantDesk`) with no store, no network and no authority. Before the physical run of lane H (aien-dev/aien-architecture-mv#232), the DAG moves next to the sovereign-core runtime that serves the Pi on the Spark.
+
+Reasons:
+1. README line 3: the desk, effect authorization and fail-closed behaviour live in aien-sovereign-core, and AEGIS is outside release v1. A delegated DAG that runs real effects must sit beside them.
+2. The existing DAG (`workflow.rs`, 1022 lines at `971d450`, and 25 tests in `tests/workflow_dag_tests.rs`) lives here. Moving it first would add a port to every child issue without changing what they prove. The trait seams make the later move a change of host, not of rules.
+
+## 5. What is not here
+
+No code, no schema, no wire bytes. The fire-drill table is added by G4 (aegis-runtime-mv#57). The physical Pi and Spark run belongs to lane H.
diff --git a/docs/WORKFLOW-DAG.md b/docs/WORKFLOW-DAG.md
index 023cb82..bc581ae 100644
--- a/docs/WORKFLOW-DAG.md
+++ b/docs/WORKFLOW-DAG.md
@@ -25,7 +25,7 @@ Absent before this change: prerequisite edges between tasks, readiness tracking,
 ## Model
 
 - `TaskId` newtype. `WorkflowSpec::builder().add_task(id, &[deps], runner)...build()` rejects empty ids, duplicate tasks, duplicate edges, self dependency, unknown predecessors and cycles with typed `WorkflowError`.
-- `TaskState {Pending, Ready, Running, WaitingForApproval, Completed, Failed(FailureRecord), Cancelled, Skipped{prerequisite}}`.
+- `TaskState {Pending, Ready, Running, WaitingForApproval, Completed, Failed(FailureRecord), Cancelled, Skipped{prerequisite}, Uncertain(FailureRecord)}`. `Uncertain` (issue #55) means "not known whether the effect happened"; it is not terminal.
 - `TaskRunner` is the task body and returns `TaskOutcome {Completed(value), Failed(ToolFault), ApprovalPending, Cancelled}`. `certainty_on_interrupt()` says what is known about effects if the DAG interrupts the body (timeout, cancel); the default is `Uncertain`.
 - `WorkflowConfig {run_id, session_id, max_parallel, per_task_timeout, total_budget}`.
 
@@ -34,14 +34,15 @@ Absent before this change: prerequisite edges between tasks, readiness tracking,
 - A dependent becomes Ready only when every prerequisite is `Completed`.
 - A prerequisite that is `Failed`, `Cancelled` or `Skipped` makes the dependent `Skipped` with a `FailureRecord` of class `Rejected`, certainty `NoEffect`, cause `prerequisite failed: <id>`. This is transitive.
 - `WaitingForApproval` is not success and not terminal. Dependents stay `Pending`; the report lists them in `unfinished` and the status is `WaitingForApproval`.
-- The DAG never retries or reschedules anything. An `Uncertain` outcome runs once and is final.
-- Timeout gives `Failed` with class `Timeout` and the runner's certainty. Cancellation (token or total budget) cancels running tasks and every Pending/Ready task and starts nothing new.
+- The DAG never retries or reschedules anything. An `Uncertain` outcome runs once and is never retried here.
+- Timeout gives `Failed` with class `Timeout` and the runner's certainty, unless that certainty is `Uncertain`: then the task becomes `Uncertain` (#55). Cancellation (token or total budget) cancels running tasks and every Pending/Ready task and starts nothing new; a running task whose certainty is `Uncertain` becomes `Uncertain` instead of `Cancelled`.
+- Dependents of an `Uncertain` task are neither run nor skipped. They stay `Pending`, are listed in `unfinished`, and `WorkflowReport.blocked_behind_uncertain` names the uncertain task each one waits on (transitively). A task with both an `Uncertain` and a `Failed` prerequisite is still skipped by the failed one.
 - Parallelism is bounded by a `tokio::sync::Semaphore`. The coordinator only awaits; task bodies run on spawned tasks. No `block_on`.
 - The DAG authorizes nothing and caches no decision. Real effects go through the agent/skill gate path or `ExecutionAuthority` inside the task body.
 
 ## Events and replay
 
-Every transition takes a workflow sequence number under one lock, together with the state change, and is published in that same critical section. New `AegisEvent` variants: `WorkflowTaskReady/Started/Completed/Waiting/Failed/Cancelled/Skipped`, `WorkflowFinished`. They carry `workflow_seq` and go out with `EventEnvelope.sequence` set to it, so sorting by sequence replays the exact order. With `max_parallel = 1` the whole order is fixed for a given spec; with more parallelism the order of simultaneous completions follows real completion order, but the sequence is still gapless and dependency-consistent. Existing variants are unchanged; the canonical mapping returns `None` for the new ones.
+Every transition takes a workflow sequence number under one lock, together with the state change, and is published in that same critical section. New `AegisEvent` variants: `WorkflowTaskReady/Started/Completed/Waiting/Failed/Cancelled/Skipped`, `WorkflowFinished`. They carry `workflow_seq` and go out with `EventEnvelope.sequence` set to it, so sorting by sequence replays the exact order. With `max_parallel = 1` the whole order is fixed for a given spec; with more parallelism the order of simultaneous completions follows real completion order, but the sequence is still gapless and dependency-consistent. Existing variants are unchanged; the canonical mapping returns `None` for the new ones. The `Uncertain` task state (#55) has no bus variant yet (#55 item 4): its ledger event `uncertain` is written in sequence, and the bus stays silent rather than publish a false Failed or Cancelled. `WorkflowStatus` still reads `Failed` or `Cancelled` when a task is uncertain; the "needs reconciliation" status is #55 item 2, not in the first cut.
 
 Results: `WorkflowSnapshot.results` maps task id to a sha256 digest of the result value. Failure records for Failed, Skipped and Cancelled tasks are in `WorkflowReport.failures`.
 
@@ -51,7 +52,7 @@ Results: `WorkflowSnapshot.results` maps task id to a sha256 digest of the resul
 
 ## Restart boundary
 
-Workflow state is in memory only. After a process restart nothing is recovered and no task is resumed or re-run. `WorkflowSnapshot` is serializable (tested) so a later change can persist it, but no schema, table or recovery path exists. A resumed workflow must not re-run a task whose effect is `Uncertain`; that recovery policy is not designed here.
+Workflow state is in memory only. After a process restart nothing is recovered and no task is resumed or re-run. `WorkflowSnapshot` is serializable (tested) so a later change can persist it, but no schema, table or recovery path exists. A resumed workflow must not re-run a task whose effect is `Uncertain`; that recovery policy is not designed here. Which record owns each fact of a delegated task, and the rebuild rule after a restart, are in [DELEGATED-DAG.md](DELEGATED-DAG.md).
 
 ## Not claimed
 
diff --git a/src/orchestration/workflow.rs b/src/orchestration/workflow.rs
index c34ca7c..8700dff 100644
--- a/src/orchestration/workflow.rs
+++ b/src/orchestration/workflow.rs
@@ -105,11 +105,20 @@ pub enum TaskState {
     Completed,
     Failed(FailureRecord),
     Cancelled,
-    Skipped { prerequisite: TaskId },
+    Skipped {
+        prerequisite: TaskId,
+    },
+    /// Started, then interrupted (timeout or cancel) while its effect
+    /// certainty was `Uncertain`: not known whether the effect happened. Not
+    /// terminal: it must be reconciled against the effect authority before
+    /// anything else happens, and its dependents stay Pending behind it
+    /// (issue #55). The record says why it was interrupted.
+    Uncertain(FailureRecord),
 }
 
 impl TaskState {
-    /// Terminal means the task will never change state again.
+    /// Terminal means the task will never change state again. `Uncertain` is
+    /// not terminal: reconciliation decides its final state.
     pub fn is_terminal(&self) -> bool {
         matches!(
             self,
@@ -128,6 +137,7 @@ impl TaskState {
             Self::Failed(_) => "failed",
             Self::Cancelled => "cancelled",
             Self::Skipped { .. } => "skipped",
+            Self::Uncertain(_) => "uncertain",
         }
     }
 }
@@ -412,10 +422,15 @@ pub struct WorkflowSnapshot {
 pub struct WorkflowReport {
     pub status: WorkflowStatus,
     pub snapshot: WorkflowSnapshot,
-    /// Failure records for Failed, Skipped and Cancelled tasks.
+    /// Failure records for Failed, Skipped, Cancelled and Uncertain tasks.
     pub failures: BTreeMap<TaskId, FailureRecord>,
-    /// Tasks left non-terminal (waiting for approval, or blocked behind one).
+    /// Tasks left non-terminal (waiting for approval, uncertain, or blocked
+    /// behind either).
     pub unfinished: Vec<TaskId>,
+    /// Pending tasks that wait, directly or through other pending tasks, on
+    /// an `Uncertain` task, mapped to one uncertain task they wait on.
+    /// They were neither run nor skipped.
+    pub blocked_behind_uncertain: BTreeMap<TaskId, TaskId>,
     pub events: Vec<WorkflowEvent>,
     pub peak_concurrency: usize,
     pub budget_exhausted: bool,
@@ -558,6 +573,10 @@ impl Recorder {
                 task_id,
                 prerequisite: prerequisite.to_string(),
             },
+            // No bus variant yet (issue #55 item 4). Publishing it as Failed
+            // or Cancelled would be false, so the bus stays silent; the
+            // ledger event "uncertain" is still written in sequence.
+            TaskState::Uncertain(_) => return None,
         })
     }
 }
@@ -782,7 +801,8 @@ impl WorkflowExecutor {
             // is settled here, so Cancelled never lists unfinished tasks.
             self.cancel_open(&rec, &ids, &nodes);
         }
-        self.report(rec, ids, peak, budget_exhausted, cancel_seen)
+        let blocked = blocked_behind_uncertain(&rec, &ids, &nodes);
+        self.report(rec, ids, peak, budget_exhausted, cancel_seen, blocked)
     }
 
     /// Moves every non-terminal, non-running task to Cancelled. A task
@@ -874,8 +894,12 @@ impl WorkflowExecutor {
                     interrupt,
                     "task cancelled while running",
                 );
-                rec.note_failure(id, f);
-                rec.transition(id, TaskState::Cancelled, None);
+                rec.note_failure(id, f.clone());
+                if interrupt == EffectCertainty::Uncertain {
+                    rec.transition(id, TaskState::Uncertain(f), None);
+                } else {
+                    rec.transition(id, TaskState::Cancelled, None);
+                }
             }
             Finish::TimedOut => {
                 let f = self.failure(
@@ -886,7 +910,11 @@ impl WorkflowExecutor {
                     "per-task timeout elapsed",
                 );
                 rec.note_failure(id, f.clone());
-                rec.transition(id, TaskState::Failed(f), None);
+                if interrupt == EffectCertainty::Uncertain {
+                    rec.transition(id, TaskState::Uncertain(f), None);
+                } else {
+                    rec.transition(id, TaskState::Failed(f), None);
+                }
             }
         }
     }
@@ -898,6 +926,7 @@ impl WorkflowExecutor {
         peak: usize,
         budget_exhausted: bool,
         cancelled: bool,
+        blocked_behind_uncertain: BTreeMap<TaskId, TaskId>,
     ) -> WorkflowReport {
         let (unfinished, any_waiting, all_done) = {
             let l = rec.ledger.lock();
@@ -934,6 +963,7 @@ impl WorkflowExecutor {
             },
             failures: l.failures.clone(),
             unfinished,
+            blocked_behind_uncertain,
             events: l.events.clone(),
             peak_concurrency: peak,
             budget_exhausted,
@@ -941,6 +971,36 @@ impl WorkflowExecutor {
     }
 }
 
+/// Pending tasks that wait on an `Uncertain` task, directly or through other
+/// pending tasks. Each maps to one uncertain task it waits on (several may
+/// apply; the first one found is named).
+fn blocked_behind_uncertain(
+    rec: &Recorder,
+    ids: &[TaskId],
+    nodes: &HashMap<TaskId, &TaskNode>,
+) -> BTreeMap<TaskId, TaskId> {
+    let mut blocked: BTreeMap<TaskId, TaskId> = BTreeMap::new();
+    loop {
+        let mut changed = false;
+        for id in ids {
+            if blocked.contains_key(id) || rec.state_of(id) != TaskState::Pending {
+                continue;
+            }
+            let root = nodes[id].deps.iter().find_map(|d| match rec.state_of(d) {
+                TaskState::Uncertain(_) => Some(d.clone()),
+                _ => blocked.get(d).cloned(),
+            });
+            if let Some(root) = root {
+                blocked.insert(id.clone(), root);
+                changed = true;
+            }
+        }
+        if !changed {
+            return blocked;
+        }
+    }
+}
+
 /// Error text from runners and engines goes into Workflow events and reports,
 /// so it is cut to the cause limit before it is recorded. Runners that know
 /// their payload should also call `redact_payload_echoes` first (the agent
diff --git a/tests/workflow_dag_tests.rs b/tests/workflow_dag_tests.rs
index 04505a2..72652e5 100644
--- a/tests/workflow_dag_tests.rs
+++ b/tests/workflow_dag_tests.rs
@@ -268,22 +268,23 @@ async fn timeout_is_failed_timeout_with_runner_certainty() {
     let mut c = cfg(2);
     c.per_task_timeout = Some(Duration::from_millis(40));
     let r = WorkflowExecutor::new(c).unwrap().run(spec).await;
-    for (id, cert) in [
-        ("read_only", EffectCertainty::NoEffect),
-        ("writer", EffectCertainty::Uncertain),
-    ] {
-        match &r.snapshot.states[&tid(id)] {
-            TaskState::Failed(f) => {
-                assert_eq!(f.class, FailureClass::Timeout);
-                assert_eq!(f.effect_certainty, cert);
-            }
-            other => panic!("{id}: {other:?}"),
+    match &r.snapshot.states[&tid("read_only")] {
+        TaskState::Failed(f) => {
+            assert_eq!(f.class, FailureClass::Timeout);
+            assert_eq!(f.effect_certainty, EffectCertainty::NoEffect);
         }
+        other => panic!("read_only: {other:?}"),
     }
-    assert!(matches!(
-        r.snapshot.states[&tid("after")],
-        TaskState::Skipped { .. }
-    ));
+    // Since #55 an Uncertain timeout is not reported as Failed, and its
+    // dependent waits behind it instead of being skipped.
+    match &r.snapshot.states[&tid("writer")] {
+        TaskState::Uncertain(f) => {
+            assert_eq!(f.class, FailureClass::Timeout);
+            assert_eq!(f.effect_certainty, EffectCertainty::Uncertain);
+        }
+        other => panic!("writer: {other:?}"),
+    }
+    assert_eq!(r.snapshot.states[&tid("after")], TaskState::Pending);
 }
 
 #[tokio::test]
@@ -293,12 +294,16 @@ async fn cancellation_cancels_running_and_pending_and_starts_nothing_new() {
         .add_task(
             "long",
             &[],
-            runner_fn(|c: TaskContext| {
-                Box::pin(async move {
-                    c.cancel.cancelled().await;
-                    TaskOutcome::Cancelled
-                })
-            }),
+            // Waits for the token and touches nothing: NoEffect (#55).
+            runner_fn_with_certainty(
+                |c: TaskContext| {
+                    Box::pin(async move {
+                        c.cancel.cancelled().await;
+                        TaskOutcome::Cancelled
+                    })
+                },
+                EffectCertainty::NoEffect,
+            ),
         )
         .unwrap()
         .add_task("next", &["long"], p.task("next", 1))
@@ -326,7 +331,8 @@ async fn cancellation_cancels_running_and_pending_and_starts_nothing_new() {
 #[tokio::test]
 async fn total_budget_cancels_the_workflow() {
     let spec = b()
-        .add_task("slow", &[], ok(10_000))
+        // A sleeper with no effect, so the interrupt is a plain cancel (#55).
+        .add_task("slow", &[], hang(EffectCertainty::NoEffect))
         .unwrap()
         .add_task("n", &["slow"], ok(1))
         .unwrap()
@@ -668,12 +674,16 @@ async fn cancel_while_waiting_for_approval_leaves_nothing_unfinished() {
         .add_task(
             "long",
             &[],
-            runner_fn(|c: TaskContext| {
-                Box::pin(async move {
-                    c.cancel.cancelled().await;
-                    TaskOutcome::Cancelled
-                })
-            }),
+            // Waits for the token and touches nothing: NoEffect (#55).
+            runner_fn_with_certainty(
+                |c: TaskContext| {
+                    Box::pin(async move {
+                        c.cancel.cancelled().await;
+                        TaskOutcome::Cancelled
+                    })
+                },
+                EffectCertainty::NoEffect,
+            ),
         )
         .unwrap()
         .build()
@@ -858,3 +868,131 @@ async fn runner_error_text_is_truncated_before_it_is_recorded() {
     let msg = &r.failures[&tid("noisy")].cause[0].message;
     assert!(msg.len() <= aegis::failure::MAX_CAUSE_MESSAGE_BYTES);
 }
+
+// ---- G2 (#55): "not known whether it happened" is its own state ----
+
+/// A body that never finishes on its own, with an explicit interrupt certainty.
+fn hang(cert: EffectCertainty) -> Arc<dyn TaskRunner> {
+    runner_fn_with_certainty(
+        |_c| {
+            Box::pin(async {
+                tokio::time::sleep(Duration::from_secs(30)).await;
+                TaskOutcome::Completed(serde_json::json!(null))
+            })
+        },
+        cert,
+    )
+}
+
+#[tokio::test]
+async fn g2_timeout_on_uncertain_runner_is_uncertain_and_blocks_dependents() {
+    let p = Probe::new();
+    let spec = b()
+        .add_task("writer", &[], hang(EffectCertainty::Uncertain))
+        .unwrap()
+        .add_task("after", &["writer"], p.task("after", 1))
+        .unwrap()
+        .add_task("after2", &["after"], p.task("after2", 1))
+        .unwrap()
+        .add_task("free", &[], p.task("free", 1))
+        .unwrap()
+        .build()
+        .unwrap();
+    let mut c = cfg(2);
+    c.per_task_timeout = Some(Duration::from_millis(40));
+    let r = WorkflowExecutor::new(c).unwrap().run(spec).await;
+    match &r.snapshot.states[&tid("writer")] {
+        TaskState::Uncertain(f) => {
+            assert_eq!(f.class, FailureClass::Timeout);
+            assert_eq!(f.effect_certainty, EffectCertainty::Uncertain);
+        }
+        other => panic!("writer: {other:?}"),
+    }
+    assert!(!r.snapshot.states[&tid("writer")].is_terminal());
+    // Dependents are neither run nor skipped: they wait behind the unknown.
+    for d in ["after", "after2"] {
+        assert_eq!(r.snapshot.states[&tid(d)], TaskState::Pending, "{d}");
+        assert_eq!(p.runs(d), 0, "{d} ran");
+        assert_eq!(r.blocked_behind_uncertain[&tid(d)], tid("writer"), "{d}");
+    }
+    assert_eq!(r.snapshot.states[&tid("free")], TaskState::Completed);
+    assert!(!r.blocked_behind_uncertain.contains_key(&tid("free")));
+    for t in ["writer", "after", "after2"] {
+        assert!(r.unfinished.contains(&tid(t)), "{t} not listed unfinished");
+    }
+    assert!(r.failures.contains_key(&tid("writer")));
+    assert!(r.events.iter().any(|e| e.state == "uncertain"));
+    gapless(&r);
+}
+
+#[tokio::test]
+async fn g2_timeout_on_no_effect_runner_is_still_failed() {
+    let spec = b()
+        .add_task("read_only", &[], hang(EffectCertainty::NoEffect))
+        .unwrap()
+        .add_task("after", &["read_only"], ok(1))
+        .unwrap()
+        .build()
+        .unwrap();
+    let mut c = cfg(1);
+    c.per_task_timeout = Some(Duration::from_millis(40));
+    let r = WorkflowExecutor::new(c).unwrap().run(spec).await;
+    match &r.snapshot.states[&tid("read_only")] {
+        TaskState::Failed(f) => {
+            assert_eq!(f.class, FailureClass::Timeout);
+            assert_eq!(f.effect_certainty, EffectCertainty::NoEffect);
+        }
+        other => panic!("read_only: {other:?}"),
+    }
+    assert_eq!(
+        r.snapshot.states[&tid("after")],
+        TaskState::Skipped {
+            prerequisite: tid("read_only")
+        }
+    );
+    assert!(r.blocked_behind_uncertain.is_empty());
+}
+
+#[tokio::test]
+async fn g2_cancel_interrupting_uncertain_runner_is_uncertain_not_cancelled() {
+    let spec = b()
+        .add_task("writer", &[], hang(EffectCertainty::Uncertain))
+        .unwrap()
+        .add_task("reader", &[], hang(EffectCertainty::NoEffect))
+        .unwrap()
+        .build()
+        .unwrap();
+    let cancel = CancelToken::new();
+    let c2 = cancel.clone();
+    let exec = WorkflowExecutor::new(cfg(2))
+        .unwrap()
+        .with_cancel_token(cancel);
+    let h = tokio::spawn(async move { exec.run(spec).await });
+    tokio::time::sleep(Duration::from_millis(30)).await;
+    c2.cancel();
+    let r = h.await.unwrap();
+    match &r.snapshot.states[&tid("writer")] {
+        TaskState::Uncertain(f) => {
+            assert_eq!(f.class, FailureClass::Cancelled);
+            assert_eq!(f.effect_certainty, EffectCertainty::Uncertain);
+        }
+        other => panic!("writer: {other:?}"),
+    }
+    assert_eq!(r.snapshot.states[&tid("reader")], TaskState::Cancelled);
+}
+
+#[tokio::test]
+async fn g2_uncertain_state_round_trips_in_the_snapshot() {
+    let spec = b()
+        .add_task("writer", &[], hang(EffectCertainty::Uncertain))
+        .unwrap()
+        .build()
+        .unwrap();
+    let mut c = cfg(1);
+    c.per_task_timeout = Some(Duration::from_millis(20));
+    let r = WorkflowExecutor::new(c).unwrap().run(spec).await;
+    let j = serde_json::to_string(&r.snapshot).unwrap();
+    assert!(j.contains("\"state\":\"uncertain\""), "{j}");
+    let back: aegis::orchestration::workflow::WorkflowSnapshot = serde_json::from_str(&j).unwrap();
+    assert_eq!(back, r.snapshot);
+}