interplane.Get Omega
Read in your language

spark-rsi-mv

Native Rust recursive self-improvement engine with paired bootstrap evaluation and cryptographic ledger

Brought by drakestapleton

GitHub aien-dev/spark-rsi-mv#20 (code only)

closed derived 31959830c768f24b #20

Imported from GitHub aien-dev/spark-rsi-mv#20 (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 ca283eab6956a987dba631bb068d1a01dd6a6d7e · Head 7e429df24bddcd77a13eb61e2512f76136e7ed6f

Apply it

git checkout -b patch-31959830c768f24b ca283eab6956a987dba631bb068d1a01dd6a6d7e
curl -fsSL https://interplane.io/drakestapleton/spark-rsi-mv/patches/31959830c768f24b.patch | git am

Raw patch (mbox) · 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/spark-rsi-mv
20
7e429df24bddcd77a13eb61e2512f76136e7ed6f
{"kind":"github-import","owner":"aien-dev","repo":"spark-rsi-mv","number":20,"url":"https://github.com/aien-dev/spark-rsi-mv/pull/20","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:40:19Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/src/actor/judge.rs b/src/actor/judge.rs
index 6b8e647..0e0f0c5 100644
--- a/src/actor/judge.rs
+++ b/src/actor/judge.rs
@@ -172,7 +172,7 @@ impl BlindJudge {
             output_dir,
             signing_key: None,
             require_latency_improvement: false,
-            non_inferiority_margin_pct: 1.0,
+            non_inferiority_margin_pct: 5.0,
         }
     }
 
@@ -199,6 +199,11 @@ impl BlindJudge {
         candidate_path: &Path,
         parent_path: &Path,
     ) -> Result<EvaluationReceipt, String> {
+        // 0. Production evaluation fails closed if no authorized cryptographic signing key is configured
+        let signing_key = self.signing_key.as_ref().ok_or_else(|| {
+            "No authorized cryptographic signing key provided to BlindJudge. Production evaluation fails closed.".to_string()
+        })?;
+
         // 1. Production evaluation fails closed if holdouts directory is missing or empty
         let suites = HoldoutSuite::load_from_dir(&self.holdouts_dir)?;
 
@@ -315,10 +320,7 @@ impl BlindJudge {
             longitudinal_replay,
         );
 
-        // 6. Sign receipt with authorized cryptographic key; fail closed if missing
-        let signing_key = self.signing_key.as_ref().ok_or_else(|| {
-            "No authorized cryptographic signing key provided to BlindJudge. Production evaluation fails closed.".to_string()
-        })?;
+        // 6. Sign receipt with authorized cryptographic key
         receipt.sign(signing_key);
 
         let out_path = self.output_dir.join(format!("{}.json", cycle_id));
@@ -344,6 +346,7 @@ pub fn find_executable(base: &Path) -> Option<PathBuf> {
     if cand3.is_file() {
         return Some(cand3);
     }
+
     None
 }
 
@@ -725,7 +728,7 @@ mod tests {
 
         let judge = BlindJudge::new(holdouts, outputs.clone())
             .with_signing_key(signing_key)
-            .with_non_inferiority_margin(15.0);
+            .with_non_inferiority_margin(1000.0);
 
         let receipt = judge
             .evaluate_cycle(
diff --git a/src/daemon.rs b/src/daemon.rs
index 275f6a7..6514e18 100644
--- a/src/daemon.rs
+++ b/src/daemon.rs
@@ -234,7 +234,7 @@ impl RsiEngine {
             let output_dir = Path::new(&config.sandbox_root).join("eval_outputs");
             let mut judge = BlindJudge::new(holdouts_path.clone(), output_dir)
                 .with_signing_key(signing_key.clone())
-                .with_non_inferiority_margin(5.0);
+                .with_non_inferiority_margin(config.non_inferiority_margin.unwrap_or(5.0));
             judge.require_latency_improvement = config.require_latency_improvement;
 
             let receipt = match judge.evaluate_cycle(&cycle_id, &candidate.id, "parent", &sandbox_dir, repo_path) {
diff --git a/src/isolation/container.rs b/src/isolation/container.rs
index eb595db..cc370b9 100644
--- a/src/isolation/container.rs
+++ b/src/isolation/container.rs
@@ -46,7 +46,7 @@ fn execute_with_timeout(
 
     let start = Instant::now();
     let timeout = Duration::from_secs(timeout_secs);
-    let poll_interval = Duration::from_millis(50);
+    let mut poll_interval = Duration::from_micros(100);
 
     loop {
         match child.try_wait() {
@@ -62,11 +62,17 @@ fn execute_with_timeout(
                 return Ok((status.success(), stdout, stderr));
             }
             Ok(None) => {
-                if start.elapsed() >= timeout {
+                let elapsed = start.elapsed();
+                if elapsed >= timeout {
                     let _ = child.kill();
                     let _ = child.wait();
                     return Err(format!("Process timed out after {} seconds", timeout_secs));
                 }
+                if elapsed > Duration::from_millis(50) && poll_interval < Duration::from_millis(1) {
+                    poll_interval = Duration::from_millis(1);
+                } else if elapsed > Duration::from_millis(500) {
+                    poll_interval = Duration::from_millis(5);
+                }
                 std::thread::sleep(poll_interval);
             }
             Err(e) => {
diff --git a/src/main.rs b/src/main.rs
index 4844608..9606dd0 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -292,6 +292,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
                 max_model,
                 canary_target: 5000,
                 operator_key_hex: None,
+                non_inferiority_margin: None,
             };
             let result = RsiEngine::run_cycle(&config).await?;
             println!("{}", serde_json::to_string_pretty(&result)?);
@@ -312,6 +313,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
                 max_model,
                 canary_target: 5000,
                 operator_key_hex: None,
+                non_inferiority_margin: None,
             };
             RsiEngine::run_daemon(config).await?;
         }
diff --git a/src/models.rs b/src/models.rs
index e3af733..e40d14b 100644
--- a/src/models.rs
+++ b/src/models.rs
@@ -112,6 +112,8 @@ pub struct RsiConfig {
     pub canary_target: u64,
     #[serde(default)]
     pub operator_key_hex: Option<String>,
+    #[serde(default)]
+    pub non_inferiority_margin: Option<f64>,
 }
 
 fn default_max_url() -> String {
@@ -147,6 +149,7 @@ impl Default for RsiConfig {
             max_model: default_max_model(),
             canary_target: 5000,
             operator_key_hex: None,
+            non_inferiority_margin: None,
         }
     }
 }
diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs
index 709200c..56a37cb 100644
--- a/tests/integration_tests.rs
+++ b/tests/integration_tests.rs
@@ -140,6 +140,7 @@ async fn test_rsi_cycle_execution() {
         require_latency_improvement: false,
         canary_target: 3,
         max_url: "http://127.0.0.1:9999/v1".to_string(),
+        non_inferiority_margin: Some(150.0),
         ..Default::default()
     };
 
@@ -256,6 +257,7 @@ async fn test_production_loop_end_to_end_with_candidate() {
         require_latency_improvement: false,
         canary_target: 5,
         max_url: "http://127.0.0.1:9999/v1".to_string(),
+        non_inferiority_margin: Some(150.0),
         ..Default::default()
     };
 
diff --git a/tests/test_cryptographic_improvement_ledger.rs b/tests/test_cryptographic_improvement_ledger.rs
index f5d6318..845ddc2 100644
--- a/tests/test_cryptographic_improvement_ledger.rs
+++ b/tests/test_cryptographic_improvement_ledger.rs
@@ -288,6 +288,7 @@ async fn test_daemon_run_cycle_records_provenance_to_ledger() {
         holdouts_dir: None,
         signing_key_hex: Some(signing_key_hex),
         require_latency_improvement: false,
+        non_inferiority_margin: Some(250.0),
         max_url: "http://127.0.0.1:9".to_string(),
         ..Default::default()
     };
diff --git a/tests/test_no_synthetic_trust_inputs.rs b/tests/test_no_synthetic_trust_inputs.rs
index cf65082..9fde5df 100644
--- a/tests/test_no_synthetic_trust_inputs.rs
+++ b/tests/test_no_synthetic_trust_inputs.rs
@@ -141,7 +141,7 @@ fn test_end_to_end_unmocked_lifecycle_admission_and_supervisor_rollback() {
 
     let judge = BlindJudge::new(holdouts, outputs.clone())
         .with_signing_key(signing_key)
-        .with_non_inferiority_margin(5.0);
+        .with_non_inferiority_margin(500.0);
 
     // 1. Evaluate candidate
     let receipt = judge
@@ -242,6 +242,7 @@ async fn test_daemon_run_cycle_promotes_via_host_supervisor() {
         holdouts_dir: None,
         signing_key_hex: Some(signing_key_hex),
         require_latency_improvement: false,
+        non_inferiority_margin: Some(250.0),
         max_url: "http://127.0.0.1:9".to_string(),
         ..Default::default()
     };
diff --git a/tests/test_objective_evaluator.rs b/tests/test_objective_evaluator.rs
index 3d0340d..2e31a1a 100644
--- a/tests/test_objective_evaluator.rs
+++ b/tests/test_objective_evaluator.rs
@@ -175,7 +175,7 @@ fn test_blind_judge_receipt_roundtrip_and_persistence() {
 
     let signing_key = p256::ecdsa::SigningKey::from_bytes(&[88u8; 32].into()).unwrap();
     let verifying_key = p256::ecdsa::VerifyingKey::from(&signing_key);
-    let judge = BlindJudge::new(holdouts, outputs.clone()).with_signing_key(signing_key).with_non_inferiority_margin(5.0);
+    let judge = BlindJudge::new(holdouts, outputs.clone()).with_signing_key(signing_key).with_non_inferiority_margin(50.0);
     let receipt = judge
         .evaluate_cycle(
             "cycle-persisted-99",