interplane.Get Omega
Read in your language

aien-sovereign-core-mv

AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination.

Brought by drakestapleton

branch main Branches Tags History

aien-sovereign-core-mv / docs / headstart / ROLLOUT.md

148 lines · 9663 bytes Raw Blame History Rendered
1# Headstart provisional preparation: rollout and rollback
2
3Status: **off everywhere**. Issue: aien-spark/aien-sovereign-core#538 (M6).
4This page says how provisional preparation (Headstart M2 scheduler plus the
5M3 adapter, #537) is switched on and off, what fails closed, what a restart
6does, and what must be true before anyone activates it. Line references are
7to this repository at the commit that added this page.
8
9## 1. Two switches, both off by default
10
111. **Cargo feature `provisional-prep`** on `aien-runtime`
12 (`crates/aien-runtime/Cargo.toml`, the `[features]` table:
13 `provisional-prep = ["dep:spark-harness", "dep:aien-proof"]`). It is not in
14 `default`, and no other crate in the workspace enables it. Without it the
15 `provisional` module, `AienRuntimeServer::with_prep_adapter` and every
16 fence branch in `server.rs` are not compiled (`#[cfg(feature =
17 "provisional-prep")]`), and the control ABI is identical in both builds.
182. **Runtime flag `ProvisionalConfig::enabled`**
19 (`crates/spark-harness/src/scheduler/mod.rs`, `impl Default for
20 ProvisionalConfig`: `enabled: false`). With the flag off, M2 dispatches a
21 consumer only when every producer is final (committable with a verified
22 M1 completion), which is plain sequential behavior.
23
24Enable, in order: build with `--features provisional-prep`, construct the
25adapter with `PrepAdapter::open(ProvisionalConfig { enabled: true, .. }, store,
26journal, clock)`, and hand it to the daemon with
27`AienRuntimeServer::with_prep_adapter`. Disable in reverse: drop the adapter
28(no `with_prep_adapter` call, so nothing is fenced and every compose request
29runs the original call unchanged), then build without the feature.
30
31**The daemon installs no adapter today.** No code outside tests calls
32`with_prep_adapter`, so even a feature-on build fences nothing and prepares
33nothing. Activation in production needs a separate, reviewed change.
34
35**Manual off switch.** There is no environment variable or config file for
36this today. The off switch is the code path above: start the daemon without
37an adapter (the default), or with `enabled: false`. Both are deterministic
38startup defaults. A rebuild without the feature removes the code entirely.
39
40## 2. Default-off proof
41
42| Claim | Check |
43| --- | --- |
44| The default build links neither `spark-harness` nor `aien-proof` | CI job "Headstart feature-on tests (provisional-prep)", step "Feature-off invariant": `cargo tree -e normal -p aien-runtime` must name neither crate (with the feature on, both appear: the negative control) |
45| The default build's tests are unchanged | the required job "Workspace Verification & Invariant Audit" runs `cargo test --workspace` with default features |
46| The flag defaults to off and is sequential | `disabled_flag_is_the_default_and_sequential` (aien-runtime `tests/provisional_prep_test.rs`), `disabled_is_the_default` (spark-harness `tests/provisional_scheduler.rs`) |
47| With the flag off nothing prepares on an interface | `headstart_ab_smoke` asserts `preparations_provisional == 0` on every off arm |
48
49## 3. What may start early, and what still needs the final fence
50
51Safe to start early (flag on, producer only interface-verified):
52
53- exactly one operation, `PrepOperation::ComposePlanPreview`
54 (`OperationClass::ReadOnlyAnalysis`): it reads the workspace to build the
55 compose prompt and destination. It opens no compose home, runs no model,
56 calls no tool, writes nothing and uses no network. Its result is held in
57 memory only and is never journaled.
58
59Needs the final fence (task `Committable`, every producer final-verified
60recursively through `may_finalize`, and the task's own M1 completion receipt
61verifying through `verify_final`):
62
63- `ComposeApprovedProposal` (`PrepAdapter::submit_approved`, the World commit);
64- `ComposeAuthorize` (`PrepAdapter::authorize`, the grant).
65
66The fence is a prerequisite only. Desk MAC, AEGIS verify, the replay ledger,
67the effect ledger and the World commit stay inside the unchanged calls and
68still decide.
69
70## 4. Fail-closed states
71
72| State or error | Cause | What happens | Who clears it |
73| --- | --- | --- | --- |
74| `SchedError::BindingsFull` | a task already holds `MAX_APPROVAL_BINDINGS_PER_TASK` (64, `crates/spark-harness/src/scheduler/core.rs`) approval keys | the new binding is refused; nothing is fenced or run for it | the caller (fewer keys, or a new generation) |
75| `DeliverError::DeferredFull` | a commit is running and `DEFERRED_CAPACITY` (64, `crates/aien-runtime/src/provisional.rs`) events already wait | the event is refused and nothing is queued | the caller redelivers after the commit ends; queued events that stay refused hold a slot until `PrepAdapter::discard_deferred` |
76| `SchedError::CommitInProgress` | an event would change a task (or an ancestor) that is `Committing`, or a second commit in the same chain | through `deliver` the event is queued and redelivered after the outcome | automatic |
77| `CommitUncertain` | the commit call panicked, or a restart found a `Committing` task with no recorded outcome | terminal: never run again, consumers revoked, bindings dropped (later requests run as the original call and the durable ledgers decide) | **an operator**: check the World and the approved replay ledger to learn whether the effect landed; M2 has no retry from this state (`Retry` needs `Aborted`) |
78| `FenceError::NotCommittable`, `NoCompletion`, `CompletionInvalid`, `StaleGeneration`, `AlreadySubmitted` | the fence checks failed | the call does not run | the workflow (finish the task, or bind again at the new generation) |
79
80## 5. Restart semantics
81
82- The M2 journal replays to the same state, and `open` then audits every
83 active task against the M1 store and revokes the ones whose receipts no
84 longer verify (`Unaudited::audit`, `scheduler/mod.rs`).
85- A replayed `Committing` task becomes `CommitUncertain` and never runs again.
86- Preparation results are never journaled: after a restart a `Provisional`
87 task has no result and prepares again.
88- An unfinished task is never treated as committed. `Committable` is reached
89 only through a journaled `Finalize`, which M2 journals only after its
90 producers were final. A completion receipt minted in M1 but never
91 delivered to M2 is not a completion after replay; the fence refuses
92 (`NoCompletion`) until it is delivered. Tests:
93 `a_restart_with_an_unfinished_task_is_never_treated_as_committed`,
94 `restart_with_a_provisional_task_drops_the_result_and_prepares_again`,
95 `a_restart_during_a_commit_is_uncertain_and_never_runs_it_again`
96 (aien-runtime), `replay_never_turns_provisional_work_committable`
97 (spark-harness `tests/provisional_journal.rs`).
98- Journaled deferred events are delivered again on every open.
99- **Untested:** reopening a journal written with `enabled: true` under
100 `enabled: false`. Until a test covers it, switch the flag off only with a
101 fresh journal or no adapter.
102
103## 6. Activation checklist (#538 task 5)
104
105Every item must hold, with evidence linked from #538, before any production
106change installs an adapter. Today none of the timing items is met.
107
108- [ ] Zero unauthorized or double commits: the fence tests above, the A/B
109 sample gate (`check_sample` in `crates/aien-runtime/tests/headstart_ab.rs`:
110 no task committed twice, every commit record final-verified) over the
111 held samples.
112- [ ] Zero unhandled state divergence: `check_invariants` after every sample,
113 and equal final states and commit counts between the off and on arms
114 (compared by the smoke run only; the held-sample script does not
115 compare arms).
116- [ ] Exact baseline behavior with the flag off: section 2.
117- [ ] No new OOM or deadlock: every sample reports `deadlock: false` and
118 `max_rss_kb_process`; compare arms.
119- [ ] Resource budgets enforced: `BindingsFull`, `DeferredFull` and M2 permits
120 (`the_binding_table_is_bounded_per_task_and_fails_closed`,
121 `the_deferred_queue_is_bounded_and_fails_closed`,
122 `concurrency_is_bounded_by_the_m2_permits`,
123 `resource_budget_bounds_queue_and_permits`).
124- [ ] At least 10% repeatable wall-time improvement on one representative
125 workflow: held LINKED A/B samples (`scripts/bench/headstart-m6-ab.sh`),
126 with the A/A spread smaller than the A/B difference.
127 **NOT MET** on 2026-10-16 (section 7).
128- [ ] The daemon wiring change itself reviewed, with this page updated.
129
130## 7. Measured, hypothesis, untested
131
132- **Measured (gate NOT MET):** held LINKED samples on the Spark, 2026-10-16
133 (`benchmarks/data/headstart/m6-2026-10-16/RESULTS.md`, n=5 per arm). The
134 on arm is 1.06% slower on chain and 1.90% slower on parallel, inside the
135 A/A spread (1.31% and 2.70%). No measurable gain; the feature stays off.
136 Smoke runs are single unheld runs labelled SMOKE and are not results.
137- **Hypothesis:** on the chain shape the preparable share of a sample is
138 small next to the producer work and the World commit (the per-sample
139 `ceiling_estimate` field, prep or producer time over wall time). The held samples agree (estimate at most about 2% to 6%): the
140 gate needs a workload where read-only preparation is a larger share.
141- **Platforms:** results from the CI runner (`CI-RUNNER`, x86_64, hosted
142 Ubuntu) are correctness only; timing comes from held samples on the Spark
143 (aarch64). Neither says anything about the other architecture. The CI job
144 builds the STUB composition library; feature-on tests against the real
145 linked library run only locally (the linked CI job does not enable
146 `provisional-prep`).
147- **M5** experimental compiler results are independent of these runtime
148 readiness results and are reported separately.