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

GitHub aien-dev/aien-sovereign-core-mv#350 (code only)

closed derived 07d22e2456b748fa #350

Imported from GitHub aien-dev/aien-sovereign-core-mv#350 (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 957a6ef6c17e11024e51db707fb1eadbcd2d7116 · Head d00293bc0463ce74b2f06df348b1119d37c1fd82

Fetch it

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

curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/07d22e2456b748fa.bundle -o 07d22e2456b748fa.bundle
git fetch 07d22e2456b748fa.bundle refs/pull/350/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/aien-sovereign-core-mv
350
d00293bc0463ce74b2f06df348b1119d37c1fd82
{"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":350,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/350","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:54Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.crumb b/.crumb
index ef68da85..3888964a 100644
--- a/.crumb
+++ b/.crumb
@@ -77,14 +77,14 @@
         }
       ],
       "children_root": "sha256:285ca7eafbe46d808ebe5e4fb533e464bfdf0fedaf3eef486ac2e2c8826baf6f",
-      "compiled_at": "2026-10-08T19:10:10Z",
+      "compiled_at": "2026-10-08T19:33:05Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:ba6a3056932eeb5c7d0e197320bc4532608b28974e64ec034c543de3ebd69d36",
+      "digest": "sha256:b2e77d9577057a43570b304d3c75c36e12e91f38ab76fbbf97b87fa5a5a96309",
       "evidence_files": 187,
       "evidence_root": "sha256:27ee0353cb4d4aae2b7dbce2bfe0d9f4ef2a94cd7a4555b84684d59372503280",
-      "files": 1613,
-      "generated_at_commit": "b62490c28dfecedcc619c579c32f566003208921",
-      "source_tree": "sha256:a519ee1891ce3ceb9bfbb94c8174dece790cd94e65802f8e0b68dab656168af9"
+      "files": 1614,
+      "generated_at_commit": "2285c3fde7a8fcd7a29f7806b74dccaa9c54b98f",
+      "source_tree": "sha256:c74bb8a193cbaf631ea4fd95214bffb37e9fc4c4ca9a1c56d92de1fa4feae86b"
     }
   },
   "history": [],
diff --git a/crates/aien-abi-core/src/lib.rs b/crates/aien-abi-core/src/lib.rs
index 91d18e1d..837d63aa 100644
--- a/crates/aien-abi-core/src/lib.rs
+++ b/crates/aien-abi-core/src/lib.rs
@@ -498,6 +498,25 @@ pub struct DecodeObservation {
 // NaN from the runtime; equality is used only to compare records.
 impl Eq for DecodeObservation {}
 
+/// Which tensor backend ran the model and how many operations it ran on the
+/// reference CPU path, as process totals since the backend was built (sc#337:
+/// "no silent fallback" must be shown, not inferred from the absence of a
+/// crash). Evidence only: nothing decides on it.
+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
+pub struct OpEvidence {
+    /// The tensor backend's name (`TensorBackend::name`).
+    pub backend: String,
+    /// Runs of ops the backend claims native that fell back to the reference
+    /// CPU path. A production build panics on the first one, so a finished
+    /// strict call always records 0.
+    pub native_fallbacks: u64,
+    /// Runs of ops on the reference CPU path by design (outside the native mask).
+    pub reference_runs: u64,
+    /// The full `OP_REPORT native=[..] reference=[..] native_fallbacks=[..]
+    /// reference_runs=[..]` line.
+    pub report: String,
+}
+
 impl DecodeObservation {
     /// "greedy" (every chosen token was the argmax), "sampled" (every one was
     /// drawn), "mixed", or "none" (no token was chosen).
@@ -616,4 +635,12 @@ pub trait AienInferenceBackend: Send + Sync {
     fn take_decode_observation(&mut self, _request_id: u64) -> Option<DecodeObservation> {
         None
     }
+
+    /// The tensor backend and its op counters so far (sc#337). The scheduler
+    /// reads it when a request finishes and attaches it to
+    /// `CompletionEvent::Finished`. Default: None, for a backend that does not
+    /// account its ops (an absent claim, not zero fallbacks).
+    fn op_evidence(&self) -> Option<OpEvidence> {
+        None
+    }
 }
diff --git a/crates/aien-cli/.crumb b/crates/aien-cli/.crumb
index 74b160da..0a61190e 100644
--- a/crates/aien-cli/.crumb
+++ b/crates/aien-cli/.crumb
@@ -34,21 +34,21 @@
     "generated": {
       "children": [
         {
-          "digest": "341c94dbe5bc51ebc0817b9d30d63574cb232a935be1d205722094b1b868f881",
-          "last_commit": "ac34ad7",
+          "digest": "804855137b5e132ba9042140b09c6245ef2b4d80daca6df80b1a379c46b44ea4",
+          "last_commit": "bbd3f91",
           "name": "src",
           "purpose": ""
         }
       ],
-      "children_root": "sha256:8d67b9a3f053e35074684b398443f1a26c2be0d37a3b2dcf00e37ece860a4f4c",
-      "compiled_at": "2026-10-08T14:18:06Z",
+      "children_root": "sha256:ef6f15538546cd814625d4700947b75d96e62670ee1d0c79a943d7045f77b3f8",
+      "compiled_at": "2026-10-08T19:20:34Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:25e3b61a1d6916362265b667214779ac27fa318a7004b518976b82726d14cffd",
+      "digest": "sha256:c9ff168e1db6ead04f3c865c37c39fa3eede7bd2c93462610fa5f384222fcbd2",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 34,
-      "generated_at_commit": "6255540f6f11b9b4b23c3a39627abd40c624eeec",
-      "source_tree": "sha256:91fce885e88b09d49babf8847053b2b6f7316ff79126c5be0c97e20dfcd18cf6"
+      "generated_at_commit": "5785cbeed29084095880b8f6b8563c359d6922aa",
+      "source_tree": "sha256:85a71ccc5581f2d4ac89c1ca018bd199899bd09cd5f4003ad5426b7f36a06320"
     }
   },
   "history": [
diff --git a/crates/aien-cli/src/.crumb b/crates/aien-cli/src/.crumb
index 1e209bde..a2ee2276 100644
--- a/crates/aien-cli/src/.crumb
+++ b/crates/aien-cli/src/.crumb
@@ -64,14 +64,14 @@
     "generated": {
       "children": [],
       "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "compiled_at": "2026-10-08T14:18:06Z",
+      "compiled_at": "2026-10-08T19:20:34Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:341c94dbe5bc51ebc0817b9d30d63574cb232a935be1d205722094b1b868f881",
+      "digest": "sha256:804855137b5e132ba9042140b09c6245ef2b4d80daca6df80b1a379c46b44ea4",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 26,
-      "generated_at_commit": "6255540f6f11b9b4b23c3a39627abd40c624eeec",
-      "source_tree": "sha256:3d48d1b160879a6b6fae8fbded303e439313bb8a9fb00762053fb09cffdfb194"
+      "generated_at_commit": "5785cbeed29084095880b8f6b8563c359d6922aa",
+      "source_tree": "sha256:b06fa9c9ed0aeeaf6d8c4d076451519bca60c49ab93bddcb066418870e700c50"
     }
   },
   "history": [
diff --git a/crates/aien-cli/src/commands.rs b/crates/aien-cli/src/commands.rs
index 4698f46c..ba4f05d7 100644
--- a/crates/aien-cli/src/commands.rs
+++ b/crates/aien-cli/src/commands.rs
@@ -983,6 +983,21 @@ impl CheckpointPolicy {
     }
 }
 
+/// The daemon's start line (sc#337): whether this process fails closed, whether
+/// the binary was built with `dev-fallback`, the effective `require_checkpoint`
+/// and the tensor backend's name, so a run's log shows the protections were on
+/// instead of only the absence of a crash.
+fn strict_start_line(
+    strict: bool,
+    dev_fallback_build: bool,
+    require_checkpoint: bool,
+    backend: &str,
+) -> String {
+    format!(
+        "STRICT strict={strict} dev_fallback_build={dev_fallback_build} require_checkpoint={require_checkpoint} backend={backend}"
+    )
+}
+
 fn is_safetensors(path: &std::path::Path) -> bool {
     path.extension().and_then(|ext| ext.to_str()) == Some("safetensors")
 }
@@ -1626,6 +1641,15 @@ pub async fn run_daemon_server() {
                 std::process::exit(1);
             }
         };
+    println!(
+        "  {}",
+        strict_start_line(
+            aien_inference_abi::strict::production_strict(),
+            aien_inference_abi::strict::DEV_FALLBACK,
+            CheckpointPolicy::from_env().require_checkpoint,
+            tensor_backend.name(),
+        )
+    );
 
     // One KV for runtime and backend: the spine's block tables and the
     // backend's K/V writes go to the same pooled manager. The pool is sized
@@ -2103,6 +2127,18 @@ pub async fn handle_aegis_command() {
 mod tests {
     use super::*;
 
+    #[test]
+    fn strict_start_line_names_every_protection() {
+        assert_eq!(
+            strict_start_line(true, false, true, "omega-gb10"),
+            "STRICT strict=true dev_fallback_build=false require_checkpoint=true backend=omega-gb10"
+        );
+        assert_eq!(
+            strict_start_line(false, true, false, "ReferenceCpuBackend"),
+            "STRICT strict=false dev_fallback_build=true require_checkpoint=false backend=ReferenceCpuBackend"
+        );
+    }
+
     // ---- GB10 serving reservation: the daemon's start-up decision (sovereign-core#277) ----
 
     fn qwen3_4b_config() -> aien_inference_abi::ModelConfig {
diff --git a/crates/aien-inference-abi/src/native_ops.rs b/crates/aien-inference-abi/src/native_ops.rs
index efb91780..ace3d286 100644
--- a/crates/aien-inference-abi/src/native_ops.rs
+++ b/crates/aien-inference-abi/src/native_ops.rs
@@ -126,6 +126,18 @@ pub struct OpReport {
 }
 
 impl OpReport {
+    /// The evidence a run keeps (sc#337): `backend`, the summed fallback and
+    /// reference-run counts, and this report's [`OpReport::line`].
+    pub fn evidence(&self, backend: &str) -> aien_abi_core::OpEvidence {
+        let total = |v: &[(String, u64)]| v.iter().map(|(_, c)| c).sum();
+        aien_abi_core::OpEvidence {
+            backend: backend.to_string(),
+            native_fallbacks: total(&self.native_fallbacks),
+            reference_runs: total(&self.reference_runs),
+            report: self.line(),
+        }
+    }
+
     /// One greppable line: `OP_REPORT native=[..] reference=[..] native_fallbacks=[..] reference_runs=[..]`.
     pub fn line(&self) -> String {
         let counts = |v: &[(String, u64)]| {
@@ -233,6 +245,28 @@ impl OpAccounting {
 mod tests {
     use super::*;
 
+    /// sc#337: the evidence a run keeps sums the counters by kind and keeps
+    /// the full line; a forced fallback (counted without the strict check)
+    /// shows as a non-zero `native_fallbacks`.
+    #[test]
+    fn evidence_sums_the_counters_and_keeps_the_line() {
+        let acct = OpAccounting::new(NativeOpMask::from_ops(&[TensorOp::MatmulVec]));
+        assert_eq!(acct.report().evidence("omega-gb10").native_fallbacks, 0);
+        assert!(acct.record_reference(TensorOp::MatmulVec));
+        acct.record_reference(TensorOp::Rmsnorm);
+        acct.record_reference(TensorOp::Rmsnorm);
+        acct.record_reference(TensorOp::Swiglu);
+        let e = acct.report().evidence("omega-gb10");
+        assert_eq!(e.backend, "omega-gb10");
+        assert_eq!((e.native_fallbacks, e.reference_runs), (1, 3));
+        assert_eq!(e.report, acct.report().line());
+        assert!(
+            e.report.contains("native_fallbacks=[matmul_vec:1]"),
+            "{}",
+            e.report
+        );
+    }
+
     #[test]
     fn default_mask_is_all_native() {
         let m = NativeOpMask::default();
diff --git a/crates/aien-inference-abi/src/transformer_backend.rs b/crates/aien-inference-abi/src/transformer_backend.rs
index 0c5dcce0..1d8de911 100644
--- a/crates/aien-inference-abi/src/transformer_backend.rs
+++ b/crates/aien-inference-abi/src/transformer_backend.rs
@@ -1879,6 +1879,15 @@ impl AienInferenceBackend for NativeTransformerBackend {
             .map(DecodeTally::merged)
     }
 
+    /// sc#337: the tensor backend's name and op counters so far.
+    fn op_evidence(&self) -> Option<crate::OpEvidence> {
+        Some(
+            self.tensor_backend
+                .op_report()
+                .evidence(self.tensor_backend.name()),
+        )
+    }
+
     async fn execute_step(
         &mut self,
         batch: &ScheduledBatch,
diff --git a/crates/aien-runtime/src/control.rs b/crates/aien-runtime/src/control.rs
index bef43d65..d3d4cde6 100644
--- a/crates/aien-runtime/src/control.rs
+++ b/crates/aien-runtime/src/control.rs
@@ -741,6 +741,11 @@ pub struct ProposalAttempt {
     /// call failed or nothing observed it; omitted from the JSON then.
     #[serde(default, skip_serializing_if = "Option::is_none")]
     pub decoding: Option<aien_abi_core::DecodeObservation>,
+    /// The tensor backend and its op counters when this attempt's call
+    /// finished (sc#337). None when the call failed or the backend does not
+    /// account its ops; omitted from the JSON then.
+    #[serde(default, skip_serializing_if = "Option::is_none")]
+    pub ops: Option<aien_abi_core::OpEvidence>,
     /// Requirements of the goal this attempt's complete document failed
     /// (crate::requirements); empty when none failed or none were recognized.
     #[serde(default)]
diff --git a/crates/aien-runtime/src/effects.rs b/crates/aien-runtime/src/effects.rs
index e020e5c8..0c1be629 100644
--- a/crates/aien-runtime/src/effects.rs
+++ b/crates/aien-runtime/src/effects.rs
@@ -2002,6 +2002,7 @@ mod tests {
                 request_id: 7,
                 operation_id: 8,
                 decoding: None,
+                ops: None,
             },
             crate::generation::DaemonStart(1),
         );
diff --git a/crates/aien-runtime/src/generation.rs b/crates/aien-runtime/src/generation.rs
index 817ffacd..2edcd5e9 100644
--- a/crates/aien-runtime/src/generation.rs
+++ b/crates/aien-runtime/src/generation.rs
@@ -38,6 +38,8 @@ pub struct TurnEvidence<'a> {
     pub operation_id: u128,
     /// How the backend chose the output tokens (sc#294); None: no claim.
     pub decoding: Option<&'a aien_abi_core::DecodeObservation>,
+    /// The tensor backend and its op counters when the call finished (sc#337); None: no claim.
+    pub ops: Option<&'a aien_abi_core::OpEvidence>,
 }
 
 /// When this daemon started: unix milliseconds, captured once.
@@ -91,6 +93,30 @@ fn with_decoding(record: &mut Value, d: Option<&aien_abi_core::DecodeObservation
     record["decoding"] = o;
 }
 
+/// Adds `ops` (sc#337): the tensor backend that ran the call and its op
+/// counters when the call finished, as process totals since the daemon built
+/// the backend (`native_fallbacks`: claimed-native ops that ran on the
+/// reference CPU path, always 0 in a production build, which panics on the
+/// first; `reference_runs`: ops on the reference path by design). Left out
+/// when the backend does not account its ops: no field means no claim.
+fn with_ops(record: &mut Value, o: Option<&aien_abi_core::OpEvidence>) {
+    let Some(o) = o else { return };
+    record["ops"] = json!({
+        "backend": o.backend,
+        "native_fallbacks": o.native_fallbacks,
+        "reference_runs": o.reference_runs,
+        "scope": "process",
+        "report": o.report,
+    });
+}
+
+/// The line the daemon logs at the end of every model call (sc#337): the
+/// backend's `OP_REPORT ...` line with ` backend=<name>` appended. None when
+/// the backend does not account its ops.
+pub fn op_report_line(o: Option<&aien_abi_core::OpEvidence>) -> Option<String> {
+    o.map(|o| format!("{} backend={}", o.report, o.backend))
+}
+
 /// The record's JSON body (field list is documented in docs/DAEMON_GENERATION_RECORD.md).
 pub fn build_record(id: &ModelIdentity, t: &TurnEvidence, start: DaemonStart) -> Value {
     let (pid, start_ticks) = crate::effects::self_executor();
@@ -113,6 +139,7 @@ pub fn build_record(id: &ModelIdentity, t: &TurnEvidence, start: DaemonStart) ->
         "operation_id": t.operation_id.to_string(),
     });
     with_decoding(&mut record, t.decoding);
+    with_ops(&mut record, t.ops);
     record
 }
 
@@ -309,6 +336,8 @@ pub struct ComposeEvidence<'a> {
     pub attempt: u32,
     /// How the backend chose the output tokens (sc#294); None: no claim.
     pub decoding: Option<&'a aien_abi_core::DecodeObservation>,
+    /// The tensor backend and its op counters when the call finished (sc#337); None: no claim.
+    pub ops: Option<&'a aien_abi_core::OpEvidence>,
 }
 
 /// The generation record of one compose proposal attempt: the same fields as
@@ -338,5 +367,6 @@ pub fn build_compose_record(id: &ModelIdentity, e: &ComposeEvidence, start: Daem
         "operation_id": "0",
     });
     with_decoding(&mut record, e.decoding);
+    with_ops(&mut record, e.ops);
     record
 }
diff --git a/crates/aien-runtime/src/server.rs b/crates/aien-runtime/src/server.rs
index cc2c2a72..9785ca29 100644
--- a/crates/aien-runtime/src/server.rs
+++ b/crates/aien-runtime/src/server.rs
@@ -545,8 +545,12 @@ async fn generate_text(
                 Some(CompletionEvent::Finished {
                     finish_reason,
                     decoding,
+                    ops,
                     ..
                 }) => {
+                    if let Some(line) = crate::generation::op_report_line(ops.as_ref()) {
+                        eprintln!("{line}");
+                    }
                     return tokenizer
                         .decode_opts(&produced, true)
                         .map(|text| crate::spine::Generation {
@@ -557,6 +561,7 @@ async fn generate_text(
                             prompt_tokens: Some(prompt_ids.len()),
                             prompt_ids_sha256: Some(crate::spine::token_ids_sha256(&prompt_ids)),
                             decoding: decoding.clone(),
+                            ops: ops.clone(),
                         })
                         .map_err(|e| format!("tokenizer decode failed: {e}"));
                 }
@@ -654,6 +659,7 @@ struct GenerationOwned {
     request_id: u64,
     operation_id: u128,
     decoding: Option<aien_abi_core::DecodeObservation>,
+    ops: Option<aien_abi_core::OpEvidence>,
 }
 
 /// Write the daemon's generation record for a finished turn and return its
@@ -680,6 +686,7 @@ async fn record_generation(
                 request_id: g.request_id,
                 operation_id: g.operation_id,
                 decoding: g.decoding.as_ref(),
+                ops: g.ops.as_ref(),
             },
             started,
         );
@@ -750,8 +757,12 @@ async fn stream_turn(
                 total_tokens,
                 finish_reason,
                 decoding,
+                ops,
                 ..
             })) => {
+                if let Some(line) = crate::generation::op_report_line(ops.as_ref()) {
+                    eprintln!("{line}");
+                }
                 let generation_record = record_generation(
                     compose,
                     identity,
@@ -765,6 +776,7 @@ async fn stream_turn(
                         request_id,
                         operation_id,
                         decoding,
+                        ops,
                     },
                 )
                 .await;
@@ -1049,6 +1061,7 @@ mod generation_record_tests {
             request_id: 1,
             operation_id: 1,
             decoding: None,
+            ops: None,
         }
     }
 
diff --git a/crates/aien-runtime/src/spine.rs b/crates/aien-runtime/src/spine.rs
index d8e781fa..a53b4b2d 100644
--- a/crates/aien-runtime/src/spine.rs
+++ b/crates/aien-runtime/src/spine.rs
@@ -543,6 +543,9 @@ pub struct Generation {
     /// reported it when the sequence finished. None when the proposer or the
     /// backend does not observe it: an absent claim, not greedy.
     pub decoding: Option<aien_abi_core::DecodeObservation>,
+    /// The tensor backend and its op counters when the call finished (sc#337).
+    /// None when the proposer or the backend does not report them: no claim.
+    pub ops: Option<aien_abi_core::OpEvidence>,
 }
 
 /// sha256 (hex) of token ids, each as 4 little-endian bytes (NEXT-PHASE-1 v6
@@ -1467,6 +1470,7 @@ fn new_attempt(k: u32) -> ProposalAttempt {
         prompt_tokens: None,
         prompt_ids_sha256: None,
         decoding: None,
+        ops: None,
         unmet_requirements: Vec::new(),
     }
 }
@@ -1599,6 +1603,7 @@ pub fn propose_task_checked(
                 a.prompt_tokens = g.prompt_tokens;
                 a.prompt_ids_sha256 = g.prompt_ids_sha256.clone();
                 a.decoding = g.decoding.clone();
+                a.ops = g.ops.clone();
                 a.text_sha256 = Some(hex(&Sha256::digest(g.text.as_bytes())));
                 a.text = Some(g.text.clone());
                 // NEXT-PHASE-1 v6 N2: a length-cut reply is refused before parsing.
@@ -2319,6 +2324,7 @@ impl ComposeBridge {
                 task,
                 attempt: a.attempt,
                 decoding: a.decoding.as_ref(),
+                ops: a.ops.as_ref(),
             },
             started,
         );
diff --git a/crates/aien-runtime/tests/decoding_observed_test.rs b/crates/aien-runtime/tests/decoding_observed_test.rs
index 1ed3c935..95c07e22 100644
--- a/crates/aien-runtime/tests/decoding_observed_test.rs
+++ b/crates/aien-runtime/tests/decoding_observed_test.rs
@@ -173,6 +173,7 @@ fn record_field_matches_the_report_and_is_absent_without_one() {
         request_id: 1,
         operation_id: 1,
         decoding: d,
+        ops: None,
     };
     let start = aien_runtime::generation::DaemonStart(1);
     let with = aien_runtime::generation::build_record(&id, &ev(Some(&report)), start);
diff --git a/crates/aien-runtime/tests/np1_v6_test.rs b/crates/aien-runtime/tests/np1_v6_test.rs
index d78aa910..e76eadc5 100644
--- a/crates/aien-runtime/tests/np1_v6_test.rs
+++ b/crates/aien-runtime/tests/np1_v6_test.rs
@@ -78,6 +78,7 @@ fn token_ids_reach_the_attempt_record() {
             prompt_tokens: Some(p2.len()),
             prompt_ids_sha256: Some(token_ids_sha256(&p2)),
             decoding: None,
+            ops: None,
         })
     };
     let (out, a) = propose_with_retries(
diff --git a/crates/aien-runtime/tests/ops_evidence_test.rs b/crates/aien-runtime/tests/ops_evidence_test.rs
new file mode 100644
index 00000000..08760bb9
--- /dev/null
+++ b/crates/aien-runtime/tests/ops_evidence_test.rs
@@ -0,0 +1,270 @@
+//! sc#337: "no silent fallback" must be shown by what a run keeps, not by the
+//! absence of a crash. The real submission path the daemon uses
+//! (`submit_work` -> scheduler -> `NativeTransformerBackend::execute_step`)
+//! reports, in `CompletionEvent::Finished`, the tensor backend and its op
+//! counters; the generation record and the daemon's `OP_REPORT` log line carry
+//! them. CPU reference tensors, micro model, no chip.
+use aien_inference_abi::native_ops::{NativeOpMask, OpAccounting, TensorOp};
+use aien_inference_abi::{
+    MockInferenceBackend, ModelConfig, NativeTransformerBackend, OpEvidence, ReferenceCpuBackend,
+    RopeParams, SamplingParams, TensorBackend, TransformerWeights,
+};
+use aien_kv_cache::{create_shared_kv_manager, SharedKvManager};
+use aien_runtime::spine::AienRuntimeSpine;
+use aien_scheduler::{ChannelCompletionSink, CompletionEvent, PromptHandle, SchedulerConfig};
+use std::sync::Arc;
+
+fn micro_config() -> ModelConfig {
+    ModelConfig {
+        model_id: "aien-micro-v1".to_string(),
+        max_sequence_length: 512,
+        block_size: 16,
+        num_layers: 2,
+        num_heads: 4,
+        head_dim: 16,
+        num_kv_heads: 2,
+        hidden_dim: 64,
+        intermediate_dim: 128,
+        vocab_size: 256,
+        rms_norm_eps: 1e-5,
+        rope_theta: 10000.0,
+        rope_scaling: None,
+        tie_word_embeddings: false,
+        eos_token_ids: Vec::new(),
+        qk_norm: false,
+    }
+}
+
+fn spine() -> (AienRuntimeSpine, SharedKvManager) {
+    let kv = create_shared_kv_manager(64, 16);
+    let cfg = SchedulerConfig {
+        max_batch_size: 16,
+        max_batch_tokens: 512,
+        max_prefill_tokens: 256,
+        prefill_chunk_size: 64,
+        chunk_prefill: true,
+        watermark_blocks: 4,
+    };
+    (AienRuntimeSpine::new(64, cfg, kv.clone()), kv)
+}
+
+fn greedy() -> SamplingParams {
+    SamplingParams {
+        temperature: 0.0,
+        top_p: 1.0,
+        max_tokens: 3,
+        stop_token_ids: vec![],
+    }
+}
+
+/// Runs one request to completion; returns the `Finished` op evidence.
+async fn run<B: aien_inference_abi::AienInferenceBackend>(
+    backend_for: impl FnOnce(SharedKvManager) -> B,
+) -> Option<OpEvidence> {
+    let (mut spine, kv) = spine();
+    let mut backend = backend_for(kv);
+    let (sink, mut rx) = ChannelCompletionSink::channel();
+    let sink_id = spine.register_completion_sink(Arc::new(sink));
+    let prompt: PromptHandle = Arc::from([1u32, 10, 25, 42].as_slice());
+    spine
+        .submit_work(prompt, greedy(), 1, Some(sink_id))
+        .unwrap();
+    spine.run_until_complete(&mut backend, 40).await.unwrap();
+    let mut ops = None;
+    let mut finished = false;
+    while let Ok(event) = rx.try_recv() {
+        match event {
+            CompletionEvent::Finished { ops: o, .. } => {
+                finished = true;
+                ops = o;
+            }
+            CompletionEvent::Error { message, .. } => panic!("{message}"),
+            CompletionEvent::Token { .. } => {}
+        }
+    }
+    assert!(finished, "the request must finish");
+    ops
+}
+
+fn native_with(
+    tensors: Arc<dyn TensorBackend>,
+) -> impl FnOnce(SharedKvManager) -> NativeTransformerBackend {
+    move |kv| {
+        NativeTransformerBackend::with_shared_kv_and_backend(
+            TransformerWeights::reference_test_weights(&micro_config()),
+            tensors,
+            kv,
+        )
+    }
+}
+
+/// The reference CPU math, with every op claimed native and every `rmsnorm`
+/// counted as a fallback: what a dev build (`AIEN_DEV_FALLBACK=1`) records
+/// when a claimed-native op runs on the CPU. `record_reference` counts
+/// without the strict check, so the test runs the same in any build.
+struct ForcedFallback {
+    cpu: ReferenceCpuBackend,
+    acct: OpAccounting,
+}
+
+impl TensorBackend for ForcedFallback {
+    fn name(&self) -> &'static str {
+        "forced-fallback"
+    }
+    fn op_report(&self) -> aien_inference_abi::native_ops::OpReport {
+        self.acct.report()
+    }
+    fn rmsnorm(&self, out: &mut [f32], x: &[f32], weight: &[f32], eps: f32) {
+        self.acct.record_reference(TensorOp::Rmsnorm);
+        self.cpu.rmsnorm(out, x, weight, eps)
+    }
+    fn rmsnorm_heads(&self, x: &mut [f32], weight: &[f32], head_dim: usize, eps: f32) {
+        self.cpu.rmsnorm_heads(x, weight, head_dim, eps)
+    }
+    #[allow(clippy::too_many_arguments)]
+    fn apply_rope(
+        &self,
+        q: &mut [f32],
+        k: &mut [f32],
+        pos: usize,
+        head_dim: usize,
+        num_q_heads: usize,
+        num_kv_heads: usize,
+        rope: &RopeParams,
+    ) {
+        self.cpu
+            .apply_rope(q, k, pos, head_dim, num_q_heads, num_kv_heads, rope)
+    }
+    fn matmul_vec(
+        &self,
+        out: &mut [f32],
+        x: &[f32],
+        weight: &[f32],
+        out_dim: usize,
+        in_dim: usize,
+    ) {
+        self.cpu.matmul_vec(out, x, weight, out_dim, in_dim)
+    }
+    fn swiglu(&self, out: &mut [f32], gate: &[f32], up: &[f32]) {
+        self.cpu.swiglu(out, gate, up)
+    }
+    fn compute_logits(
+        &self,
+        logits: &mut [f32],
+        hidden: &[f32],
+        embed_weight: &[f32],
+        vocab_size: usize,
+        hidden_dim: usize,
+    ) {
+        self.cpu
+            .compute_logits(logits, hidden, embed_weight, vocab_size, hidden_dim)
+    }
+    #[allow(clippy::too_many_arguments)]
+    fn gqa_attention(
+        &self,
+        out: &mut [f32],
+        q: &[f32],
+        k_cache: &[f32],
+        v_cache: &[f32],
+        seq_len: usize,
+        num_q_heads: usize,
+        num_kv_heads: usize,
+        head_dim: usize,
+    ) {
+        self.cpu.gqa_attention(
+            out,
+            q,
+            k_cache,
+            v_cache,
+            seq_len,
+            num_q_heads,
+            num_kv_heads,
+            head_dim,
+        )
+    }
+}
+
+/// A production run on the CPU reference backend: the call reports the
+/// backend by name and zero fallbacks.
+#[tokio::test]
+async fn a_production_run_reports_its_backend_and_zero_fallbacks() {
+    let ops = run(native_with(Arc::new(ReferenceCpuBackend::new())))
+        .await
+        .expect("the native backend reports its op evidence");
+    assert_eq!(ops.backend, "ReferenceCpuBackend");
+    assert_eq!(ops.native_fallbacks, 0, "{ops:?}");
+    assert!(ops.report.starts_with("OP_REPORT "), "{}", ops.report);
+}
+
+/// A forced fallback shows: a non-zero `native_fallbacks` and the op by name.
+#[tokio::test]
+async fn a_forced_fallback_shows_a_non_zero_count() {
+    let tensors = Arc::new(ForcedFallback {
+        cpu: ReferenceCpuBackend::new(),
+        acct: OpAccounting::new(NativeOpMask::ALL),
+    });
+    let ops = run(native_with(tensors))
+        .await
+        .expect("the native backend reports its op evidence");
+    assert_eq!(ops.backend, "forced-fallback");
+    assert!(ops.native_fallbacks > 0, "{ops:?}");
+    assert!(
+        ops.report.contains("native_fallbacks=[rmsnorm:"),
+        "{}",
+        ops.report
+    );
+    let line = aien_runtime::generation::op_report_line(Some(&ops)).unwrap();
+    assert!(
+        line.starts_with("OP_REPORT ") && line.ends_with(" backend=forced-fallback"),
+        "{line}"
+    );
+}
+
+/// A backend that does not account its ops makes no claim: None, never zero.
+#[tokio::test]
+async fn a_backend_without_op_accounting_makes_no_claim() {
+    assert_eq!(run(|_| MockInferenceBackend::new(1)).await, None);
+    assert_eq!(aien_runtime::generation::op_report_line(None), None);
+}
+
+/// The record field: present with the backend's evidence, absent without it.
+#[test]
+fn record_field_matches_the_evidence_and_is_absent_without_it() {
+    let id = aien_runtime::generation::ModelIdentity {
+        model_sha256: "m".repeat(64),
+        model_path: "/m".into(),
+        tokenizer_sha256: "t".repeat(64),
+        tokenizer_path: "/t".into(),
+    };
+    let ops = OpEvidence {
+        backend: "omega-gb10".into(),
+        native_fallbacks: 0,
+        reference_runs: 7,
+        report: "OP_REPORT native=[matmul_vec] reference=[rmsnorm] native_fallbacks=[] reference_runs=[rmsnorm:7]".into(),
+    };
+    let ev = |o| aien_runtime::generation::TurnEvidence {
+        prompt_ids: &[1, 2],
+        output_ids: &[3, 4, 5],
+        text: "abc",
+        total_tokens: 5,
+        finish_reason: "eos",
+        request_id: 1,
+        operation_id: 1,
+        decoding: None,
+        ops: o,
+    };
+    let start = aien_runtime::generation::DaemonStart(1);
+    let with = aien_runtime::generation::build_record(&id, &ev(Some(&ops)), start);
+    assert_eq!(
+        with["ops"],
+        serde_json::json!({
+            "backend": "omega-gb10",
+            "native_fallbacks": 0,
+            "reference_runs": 7,
+            "scope": "process",
+            "report": ops.report,
+        })
+    );
+    let without = aien_runtime::generation::build_record(&id, &ev(None), start);
+    assert!(without.get("ops").is_none(), "{without}");
+}
diff --git a/crates/aien-runtime/tests/provenance_link_test.rs b/crates/aien-runtime/tests/provenance_link_test.rs
index d0b7dc6e..e7d7c29c 100644
--- a/crates/aien-runtime/tests/provenance_link_test.rs
+++ b/crates/aien-runtime/tests/provenance_link_test.rs
@@ -66,6 +66,16 @@ fn greedy_observation() -> aien_inference_abi::DecodeObservation {
     }
 }
 
+/// The tensor backend and op counters the scheduler reports (sc#337).
+fn cpu_ops() -> aien_inference_abi::OpEvidence {
+    aien_inference_abi::OpEvidence {
+        backend: "reference-cpu".into(),
+        native_fallbacks: 0,
+        reference_runs: 0,
+        report: "OP_REPORT native=[] reference=[] native_fallbacks=[] reference_runs=[]".into(),
+    }
+}
+
 /// The reply the real inference path gives: text, generated ids, prompt ids hash.
 fn proposer() -> ComposeProposer {
     Arc::new(|_p: &str, _l: Duration| {
@@ -78,6 +88,8 @@ fn proposer() -> ComposeProposer {
             prompt_ids_sha256: Some(token_ids_sha256(&PROMPT_IDS)),
             // sc#294: what the scheduler reports for a greedy run of these ids.
             decoding: Some(greedy_observation()),
+            // sc#337: what the scheduler reports for a production CPU run.
+            ops: Some(cpu_ops()),
         })
     })
 }
@@ -293,6 +305,18 @@ async fn assert_linked(d: &Daemon, f: &Flow, want_agent: &str) {
         json!({"mode": "greedy", "greedy_tokens": OUT_IDS.len(), "sampled_tokens": 0}),
         "{g}"
     );
+    // sc#337: the backend and op counters travel into the record.
+    assert_eq!(
+        g["ops"],
+        json!({
+            "backend": "reference-cpu",
+            "native_fallbacks": 0,
+            "reference_runs": 0,
+            "scope": "process",
+            "report": cpu_ops().report,
+        }),
+        "{g}"
+    );
     // The grant, intent and commit still say what they said before.
     assert_eq!(
         d.record(f.commit).await["proposal_sha256"],
diff --git a/crates/aien-scheduler/src/lib.rs b/crates/aien-scheduler/src/lib.rs
index 74727048..100b02fe 100644
--- a/crates/aien-scheduler/src/lib.rs
+++ b/crates/aien-scheduler/src/lib.rs
@@ -1115,6 +1115,8 @@ impl AienScheduler {
                             });
                             // sc#294: taken on every finish, listened to or not.
                             let decoding = backend.take_decode_observation(request_id);
+                            // sc#337: the op counters at this finish, listened to or not.
+                            let ops = backend.op_evidence();
                             if let Some(sink_id) = finished_sink {
                                 self.completion_router.emit(
                                     sink_id,
@@ -1123,6 +1125,7 @@ impl AienScheduler {
                                         finish_reason,
                                         total_tokens,
                                         decoding,
+                                        ops,
                                     },
                                 );
                             }
@@ -1151,6 +1154,8 @@ impl AienScheduler {
                         self.metrics.finished_requests += 1;
                         // sc#294: taken on every finish, listened to or not.
                         let decoding = backend.take_decode_observation(request_id);
+                        // sc#337: the op counters at this finish, listened to or not.
+                        let ops = backend.op_evidence();
                         if let Some(sink_id) = finished_sink {
                             self.completion_router.emit(
                                 sink_id,
@@ -1159,6 +1164,7 @@ impl AienScheduler {
                                     finish_reason: reason,
                                     total_tokens,
                                     decoding,
+                                    ops,
                                 },
                             );
                         }
diff --git a/crates/aien-scheduler/src/sequence.rs b/crates/aien-scheduler/src/sequence.rs
index dcec6461..a467dcb9 100644
--- a/crates/aien-scheduler/src/sequence.rs
+++ b/crates/aien-scheduler/src/sequence.rs
@@ -1,4 +1,4 @@
-use aien_abi_core::{DecodeObservation, FinishReason, SamplingParams, SequenceRequest};
+use aien_abi_core::{DecodeObservation, FinishReason, OpEvidence, SamplingParams, SequenceRequest};
 use aien_platform::{InferenceWork, KvHandle, ModelHandle, Priority, Ticks};
 use serde::{Deserialize, Serialize};
 use std::collections::HashMap;
@@ -90,6 +90,11 @@ pub enum CompletionEvent {
         /// observe its decoding: an absent claim, not greedy.
         #[serde(default)]
         decoding: Option<DecodeObservation>,
+        /// The tensor backend and its op counters (process totals) when the
+        /// sequence finished (sc#337). None when the backend does not account
+        /// its ops: an absent claim, not zero fallbacks.
+        #[serde(default)]
+        ops: Option<OpEvidence>,
     },
     Error {
         seq_id: SequenceId,
diff --git a/docs/DAEMON_GENERATION_RECORD.md b/docs/DAEMON_GENERATION_RECORD.md
index 7fb648f7..bc95bfc1 100644
--- a/docs/DAEMON_GENERATION_RECORD.md
+++ b/docs/DAEMON_GENERATION_RECORD.md
@@ -31,6 +31,7 @@ An `effect`-class host note whose JSON has the marker field `generation`:
 | `total_tokens`, `output_tokens` | token count the engine reported; generated tokens |
 | `finish_reason` | `eos`, `max_tokens`, `aborted` or `preempted` |
 | `decoding` | how the backend chose the output tokens (below); ABSENT when the backend did not report it |
+| `ops` | the tensor backend that ran the call and its op counters (below); ABSENT when the backend did not report them |
 | `daemon` | `pid`, `start_ticks` (process start, clock ticks) and `started_unix_ms` |
 | `request_id`, `operation_id` | CALLER-ASSERTED: the request envelope's ids, exactly as the client sent them |
 
@@ -73,6 +74,43 @@ report, not signed. It covers the native backend's scheduler path
 (`execute_step`); the standalone generation helpers (`generate_tokens*`) and
 example binaries are not observed.
 
+### `ops`: the backend and its fallbacks (sc#337)
+
+"No silent fallback" used to be shown only by the absence of a crash. `ops`
+is positive evidence. The native backend reads its tensor backend's op
+counters (`TensorBackend::op_report`) when a sequence finishes
+(`AienInferenceBackend::op_evidence`), the scheduler puts them in
+`CompletionEvent::Finished.ops`, and the daemon copies them into the record.
+
+| field | meaning |
+|---|---|
+| `backend` | the tensor backend's name (`TensorBackend::name`, e.g. the Omega GB10 engine or `ReferenceCpuBackend`) |
+| `native_fallbacks` | runs of ops the backend claims native that ran on the reference CPU path |
+| `reference_runs` | runs of ops on the reference CPU path by design (outside the backend's native mask) |
+| `scope` | always `process`: the counts are totals since the daemon built the backend, NOT per call |
+| `report` | the full `OP_REPORT native=[..] reference=[..] native_fallbacks=[..] reference_runs=[..]` line |
+
+Because the counts are process totals, a later record's counts include every
+earlier call's; a per-call figure is the difference between two records of the
+same daemon (`daemon.pid` and `daemon.start_ticks` equal), and only when no
+other call ran in between. A production build panics on the first
+claimed-native fallback (`STRICT_REAL_MODEL_VIOLATION`), so a record written by
+a production daemon always has `native_fallbacks == 0`; a verifier that needs
+a strict run requires `ops` to be present with `native_fallbacks == 0` and the
+daemon's `STRICT strict=true dev_fallback_build=false ...` start line. `ops` is
+ABSENT, not zero, when the backend does not account its ops (the mock backend
+and the other `AienInferenceBackend` implementations; only
+`NativeTransformerBackend`, the backend the daemon builds, reports them).
+
+The daemon also logs, at the end of every model call (turn and compose), the
+`report` line with ` backend=<name>` appended, on stderr. At start it prints
+`STRICT strict=<bool> dev_fallback_build=<bool> require_checkpoint=<bool>
+backend=<name>` on stdout with its other start lines: `strict` is the
+effective value (false with `dev_fallback_build=false` means the
+`AIEN_DEV_FALLBACK=1` opt-in), `dev_fallback_build` is the compile-time
+`dev-fallback` feature, `require_checkpoint` is the effective checkpoint
+policy.
+
 ## What it proves
 
 The daemon process with that pid and start time generated text with that