Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-sovereign-core-mv/patches/76497f42f9e1eddd # 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 Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers ## GitHub aien-dev/aien-sovereign-core-mv#361 (code only) closed derived `76497f42f9e1eddd` #361 Imported from GitHub aien-dev/aien-sovereign-core-mv#361 (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 `4992a7ece219fe026111ba0c83a7ae04df1908e6` · Head `3a386f766aec22b7a77214848f50e4afcc5b1c66` ### Apply it ``` git checkout -b patch-76497f42f9e1eddd 4992a7ece219fe026111ba0c83a7ae04df1908e6 curl -fsSL https://interplane.io/drakestapleton/aien-sovereign-core-mv/patches/76497f42f9e1eddd.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/aien-sovereign-core-mv 361 3a386f766aec22b7a77214848f50e4afcc5b1c66 ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"aien-sovereign-core-mv","number":361,"url":"https://github.com/aien-dev/aien-sovereign-core-mv/pull/361","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:36:56Z","metadata":"unavailable","state_derived":true} ``` ### Changes ``` diff --git a/.crumb b/.crumb index d34ff840..7c7b1022 100644 --- a/.crumb +++ b/.crumb @@ -77,14 +77,14 @@ } ], "children_root": "sha256:20c95358a2e6cde016bc1a6b9d07b1ed5500de7131c7eb30982592664870658c", - "compiled_at": "2026-10-09T14:50:37Z", + "compiled_at": "2026-10-09T15:04:09Z", "compiler": "crumb-compile/1", - "digest": "sha256:9cfbde28d83d8770600ce621d93cd695720f9fe9088c4eaf3a011a9c196d12a4", + "digest": "sha256:da3472e0e9ef761eb4e2715a53a6a1fd3e3aab55a0e70eb48f84636c32c6a821", "evidence_files": 187, "evidence_root": "sha256:27ee0353cb4d4aae2b7dbce2bfe0d9f4ef2a94cd7a4555b84684d59372503280", - "files": 1848, - "generated_at_commit": "2865673d8f0288049f88999f686c613287a628a3", - "source_tree": "sha256:b278a7013dfae86f02b66d6b877096408d7388f7aa06830f4da9a010e6924733" + "files": 1850, + "generated_at_commit": "fe4c7fefbf5a59a9b89fab4370d596f8f513ec6f", + "source_tree": "sha256:3d5a6dafc4b8b8c1b399c50f71a2f2ce6392e6b3b6181eb54d891b2066e11e95" } }, "history": [], diff --git a/crates/aien-runtime/src/requirements_extract.rs b/crates/aien-runtime/src/requirements_extract.rs index 9e951021..fc710f40 100644 --- a/crates/aien-runtime/src/requirements_extract.rs +++ b/crates/aien-runtime/src/requirements_extract.rs @@ -18,7 +18,7 @@ //! | `` = `lines` (also `non-empty|nonempty|non-blank lines`: lines are counted non-empty anyway), `words`; `items`, `steps`, `sections`, `headings`, `questions`, `paragraphs` (Min only; singular too) | lines, words, list items, numbered steps, headings, questions, paragraphs (`MinParagraphs`: runs of prose lines, see `requirements::count_paragraphs`) | //! | `N sentences in|per|for|within every|each section` (or `in every section, ... N sentences`) | `MinSentencesPerSection(N)` | //! | `a one-sentence|single-sentence X`, `a single sentence`, `just|only|exactly one sentence` (the only such phrase; no part of the file, edit or addition named in the goal) | `SingleSentence` | -//! | `containing|with [just|only] one line that says|reads "S"` / `one line saying|reading "S"` | `AddedLines` exactly 1 and `RequiredPhrases([S])` (a final `.` `!` `?` inside quotes that end the goal sentence is not part of S) | +//! | `containing|with [just|only] one line that says|reads "S"` / `one line saying|reading "S"` | `AddedLines` exactly 1 and `RequiredPhrases([S])` (a final `.` `!` `?` inside quotes that end the goal sentence is not part of S). UNQUOTED text there (also after a destination, `one line to a.md saying S`) is read only as one to three plain words running to the end of the sentence, optionally before one destination file (`saying hello to a.md`); a pronoun or vague word, a joiner (`and then`), an instruction verb or a preposition makes it UNCERTAIN, never dropped (sc#349) | //! | `sections|headings titled|named|called A, B and C`, `sections: A, B and C`; with quoted titles also `section(s) is|are titled "A"` and `[one] section(s) must|should|will|shall|can be titled "A"` | `RequiredHeadings` (a count before the noun must equal the number of titles; `organise it under three sections titled ...` is read the same). The is/are/be forms stay UNCERTAIN after `each every all any` or with `if unless optionally optional may might when whenever perhaps maybe` in the clause | //! | `between N and M lines|words` (N <= M) | `MinX(N)` and `MaxX(M)`, inclusive. Other nouns, `from N to M`, ranges like `2-3`, `... or so`, and a range on a part of the document (a countable noun or `gap space distance` right before `between`, or `each every per` within three words) stay UNCERTAIN | //! | `covers|covering A, B and C` (and `to|should|must|will|can cover ...`) | `RequiredTopics` | @@ -584,6 +584,118 @@ fn qualifier_ok(toks: &[Tok], j: usize) -> bool { } } +/// Words that make an unquoted "saying S" ambiguous: a pronoun or vague word +/// (what is said is not named), a joiner (a second clause follows), or a +/// preposition or instruction verb (S is not a plain phrase). +const SAID_AMBIGUOUS: &[&str] = &[ + "it", + "them", + "this", + "that", + "these", + "those", + "something", + "anything", + "everything", + "whatever", + "one", + "some", + "and", + "or", + "but", + "so", + "then", + "because", + "which", + "also", + "while", + "when", + "if", + "to", + "in", + "into", + "at", + "on", + "for", + "about", + "with", + "using", + "like", + "save", + "write", + "add", + "make", + "create", + "put", + "the", +]; + +/// sc#349: the unquoted text after `saying|reading|that says|reads`, starting +/// at token `q`, read as a required phrase: one to three plain words that run to +/// the end of the sentence, optionally followed by one destination file +/// (`hello to a.md`). Returns the text and the byte after it; None when it is +/// wider or ambiguous (see `SAID_AMBIGUOUS`), so the caller marks it uncertain. +fn unquoted_said(goal: &str, toks: &[Tok], q: usize) -> Option<(String, usize)> { + let mut last = (q..toks.len()) + .find(|&k| ends_sentence(&toks[k].raw)) + .unwrap_or(toks.len().checked_sub(1)?); + // "hello to a.md": a lone path-like word after to|in|into|at is the destination. + if last >= q + 2 + && matches!(toks[last - 1].word.as_str(), "to" | "in" | "into" | "at") + && toks[last].word.contains(['.', '/']) + { + last -= 2; + } + if last < q || last >= q + 3 { + return None; + } + for (k, t) in toks.iter().enumerate().take(last + 1).skip(q) { + let w = plain(&t.raw); + if (k < last && t.raw.ends_with([',', '.', ';', ':', '!', '?', ')'])) + || w.is_empty() + || !w + .chars() + .all(|c| c.is_alphanumeric() || matches!(c, '\'' | '-')) + || SAID_AMBIGUOUS.contains(&w) + { + return None; + } + } + let end = toks[last].end; + let text = goal[toks[q].start..end].trim_end_matches([',', '.', ';', ':', '!', '?']); + Some((text.to_string(), end)) +} + +/// sc#336 / sc#349: the "saying" clause of a line, `noun` being the token of +/// `line|lines`: `that says|reads S`, `saying|reading S`, also after one +/// destination file (`to a.md saying S`). None when there is no such clause; +/// Ok((S, end byte)) when S is read (quoted whole, or a short plain unquoted +/// phrase, see `unquoted_said`); Err(()) when S is there but cannot be read. +fn said_clause(goal: &str, toks: &[Tok], noun: usize) -> Option> { + let w = |k: usize| toks.get(k).map(|t| t.word.as_str()); + let at = if matches!(w(noun + 1), Some("to" | "in" | "into" | "at")) + && w(noun + 2).is_some_and(|p| p.contains(['.', '/'])) + { + noun + 3 + } else { + noun + 1 + }; + let q = match (w(at), w(at + 1)) { + (Some("that"), Some("says" | "reads" | "say" | "read")) => at + 2, + (Some("saying" | "reading"), _) => at + 1, + _ => return None, + }; + if toks.get(q).is_none() { + return Some(Err(())); + } + let said = if toks[q].raw.starts_with(['"', '\u{201C}']) { + quoted_at(goal, toks, q) + } else { + unquoted_said(goal, toks, q) + }; + Some(said.ok_or(())) +} + /// Mark the tokens that start inside the byte range as consumed. fn mark_bytes(handled: &mut std::collections::BTreeSet, toks: &[Tok], lo: usize, hi: usize) { for (i, t) in toks.iter().enumerate() { @@ -1632,6 +1744,21 @@ pub fn analyze(goal: &str) -> Extraction { } else { parse_num(&t.word) }; + // "add|write a line saying hello" (sc#349): no count is measured, but the + // text it names is required (or uncertain), never dropped + if t.word == "line" && i > 0 && matches!(toks[i - 1].word.as_str(), "a" | "an") { + match said_clause(goal, &toks, i) { + Some(Ok((phrase, end))) => { + if !phrases.contains(&phrase) { + phrases.push(phrase); + } + mark_bytes(&mut handled, &toks, toks[i].end, end); + } + Some(Err(())) => bad(&mut unsure, i + 1, false), + None => {} + } + continue; + } let (Num::Val(v), Some(noun)) = (num, toks.get(i + 1).map(|t| t.word.as_str())) else { continue; }; @@ -1663,28 +1790,18 @@ pub fn analyze(goal: &str) -> Extraction { // "one line that says|reads \"S\"", "one line saying \"S\"" (sc#336): // that line holds S. A final . ! ? inside quotes that close the goal // sentence is the goal's own punctuation and is not required. - if v == 1 && exact && !bound { - let w = |k: usize| toks.get(k).map(|t| t.word.as_str()); - let q = match (w(i + 2), w(i + 3)) { - (Some("that"), Some("says" | "reads")) => Some(i + 4), - (Some("saying" | "reading"), _) => Some(i + 3), - _ => None, - }; - // only a quoted S is read; an unquoted one keeps the older reading - let quoted = q.filter(|&q| { - toks.get(q) - .is_some_and(|t| t.raw.starts_with(['"', '\u{201C}'])) - }); - match quoted.map(|q| quoted_at(goal, &toks, q)) { - Some(Some((phrase, end))) => { + // A saying clause on a counted line is never dropped: one line (exact + // or "at least one") reads S, any other count (or a lower bound) is + // uncertain (sc#349). + if let Some(said) = said_clause(goal, &toks, i + 1) { + match said { + Ok((phrase, end)) if v == 1 && !bound => { if !phrases.contains(&phrase) { phrases.push(phrase); } mark_bytes(&mut handled, &toks, toks[i + 1].end, end); } - // what the line says cannot be read whole: never drop it - Some(None) => bad(&mut unsure, i + 2, false), - None => {} + _ => bad(&mut unsure, i + 2, false), } } } diff --git a/crates/aien-runtime/tests/oq3_v5_reading_probe_test.rs b/crates/aien-runtime/tests/oq3_v5_reading_probe_test.rs new file mode 100644 index 00000000..93e3431a --- /dev/null +++ b/crates/aien-runtime/tests/oq3_v5_reading_probe_test.rs @@ -0,0 +1,23 @@ +//! Prints how the requirement reader reads every goal of the Qwen3 v5 campaign +//! (docs/campaigns/open-model-qwen3/tasks-oq3-v5.json), so a reader change can +//! be compared before and after: `cargo test --test oq3_v5_reading_probe_test +//! -- --nocapture`. It pins nothing; it only fails if the file lists no goals. +use aien_runtime::requirements::analyze; + +#[test] +fn print_how_each_oq3_v5_goal_is_read() { + let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")) + .join("../../docs/campaigns/open-model-qwen3/tasks-oq3-v5.json"); + let v: serde_json::Value = + serde_json::from_str(&std::fs::read_to_string(path).unwrap()).unwrap(); + let tasks = v["tasks"].as_array().expect("tasks array"); + assert!(!tasks.is_empty()); + for (k, t) in tasks.iter().enumerate() { + let goal = t["goal"].as_str().unwrap_or(""); + let ex = analyze(goal); + println!( + "OQ3V5 {k} {:?} | uncertain {:?}", + ex.requirements, ex.uncertain + ); + } +} diff --git a/crates/aien-runtime/tests/requirements_said_line_test.rs b/crates/aien-runtime/tests/requirements_said_line_test.rs new file mode 100644 index 00000000..355a2ff3 --- /dev/null +++ b/crates/aien-runtime/tests/requirements_said_line_test.rs @@ -0,0 +1,195 @@ +//! sc#349: `one line saying hello` / `one line that says hello` (no quotes). +//! A short plain phrase that runs to the end of its sentence (or to a trailing +//! destination file) is a required phrase; anything wider is UNCERTAIN, never +//! dropped. The one-line count is kept in every case. +use aien_runtime::control::ControlResponse; +use aien_runtime::requirements::{analyze, refusal_reason, Requirement}; +use aien_runtime::spine::{ComposeBridge, ComposeProposer, Generation}; +use std::sync::Arc; +use std::time::Duration; + +use Requirement::*; + +fn read(goal: &str) -> Vec { + let ex = analyze(goal); + assert!(ex.uncertain.is_empty(), "{goal:?}: {:?}", ex.uncertain); + ex.requirements +} + +fn one_line_with(goal: &str, phrase: &str) { + let r = read(goal); + assert!( + r.iter().any(|q| matches!( + q, + AddedLines { + n: 1, + exact: true, + .. + } + )), + "{goal}: {r:?}" + ); + assert!( + r.contains(&RequiredPhrases(vec![phrase.to_string()])), + "{goal}: {r:?}" + ); +} + +#[test] +fn a_plain_unquoted_phrase_is_required() { + one_line_with("Add a single line saying hello to a.md", "hello"); + one_line_with("Create a.txt containing one line that says hello.", "hello"); + one_line_with("Add one line to notes/TODO.md saying buy milk", "buy milk"); + one_line_with("Add one line saying Good Morning.", "Good Morning"); + one_line_with("Add one line to a.md that says hello world!", "hello world"); +} + +#[test] +fn an_ambiguous_unquoted_phrase_is_uncertain_never_dropped() { + for goal in [ + "Add a single line saying hello and then save it to a.md", + "Add a single line saying something nice to a.md", + "Add one line saying hello, then stop", + "Add one line saying it to a.md", + "Create a.txt containing one line that says the project keeps every change inside its workspace.", + "Add one line saying", + "Add one line saying save the file to a.md", + "Add one line saying hello to the end of a.md", + ] { + let ex = analyze(goal); + assert!(!ex.uncertain.is_empty(), "{goal:?} should be uncertain: {:?}", ex.requirements); + } +} + +#[test] +fn unrelated_numbers_and_words_are_unchanged() { + assert!(read("Fix 2 typos in README.md").is_empty()); + assert!(read("Add a line to a.md").is_empty()); +} + +#[test] +fn the_check_refuses_a_line_without_the_phrase() { + let reqs = analyze("Add a single line saying hello to a.md") + .resolved("") + .requirements; + assert!(refusal_reason(&reqs, "goodbye\n").is_some()); + assert!(refusal_reason(&reqs, "hello\n").is_none()); + assert!(refusal_reason(&reqs, "hello\nhello again\n").is_some()); +} + +#[test] +fn linked_compose_does_not_commit_a_line_without_the_phrase() { + let tmp = tempfile::tempdir().unwrap(); + let ws = tmp.path().join("ws"); + std::fs::create_dir_all(&ws).unwrap(); + let run = |reply: &'static str, sub: &str| { + let proposer: ComposeProposer = Arc::new(move |_: &str, _: Duration| { + Ok(Generation { + text: reply.to_string(), + tokens: 5, + finish_reason: Some("eos".into()), + ..Default::default() + }) + }); + let bridge = ComposeBridge::new(tmp.path().join(sub), proposer, "test:said"); + bridge.run_task( + "Create a.md containing one line saying hello.", + ws.to_str().unwrap(), + ) + }; + let resp = run("filename: a.md\ngoodbye\n", "c1"); + if !aien_omega_compose::LINKED { + assert!(matches!(resp, ControlResponse::Error(_))); + return; + } + let ControlResponse::ComposeTaskResult(r) = resp else { + panic!("{resp:?}") + }; + assert!(!r.committed, "{r:?}"); + assert!(r.proposal.is_none()); + assert!( + r.proposer_error + .as_deref() + .is_some_and(|e| e.contains("hello")), + "{r:?}" + ); + assert_eq!(r.proposal_attempts.len(), 3, "{:?}", r.proposal_attempts); + assert!(!ws.join("a.md").exists()); + let ControlResponse::ComposeTaskResult(ok) = run("filename: a.md\nhello\n", "c2") else { + panic!() + }; + assert!(ok.committed, "{ok:?}"); + // committed = the proposal is approved for write authorization with these exact bytes + assert_eq!(ok.proposal.as_deref(), Some("filename: a.md\nhello\n")); +} + +/// The compose verification boundary that runs without the linked compose +/// library: a reply whose one line lacks the phrase is never approved. +#[test] +fn the_proposal_boundary_approves_only_the_line_with_the_phrase() { + use aien_runtime::spine::{propose_task_checked, COMPOSE_MAX_ATTEMPTS}; + let reqs = analyze("Create a.md containing one line saying hello.") + .resolved("") + .requirements; + let go = |reply: &'static str| { + let proposer = move |_: &str, _: Duration| { + Ok(Generation { + text: reply.to_string(), + tokens: 5, + finish_reason: Some("eos".into()), + ..Default::default() + }) + }; + propose_task_checked( + &proposer, + "base", + None, + &reqs, + Duration::from_secs(5), + Duration::from_millis(1), + COMPOSE_MAX_ATTEMPTS, + ) + .0 + }; + assert!(go("filename: a.md\ngoodbye\n").is_err()); + assert!(go("filename: a.md\nhello\n").is_ok()); +} + +/// A saying clause on a line is never silently dropped, whatever the count +/// wording: it is read (one line, short plain phrase) or uncertain. +#[test] +fn a_saying_clause_on_any_line_wording_is_read_or_uncertain() { + // not exact ("write" means at least) but a single line with a plain phrase: read + for (goal, phrase) in [ + ("Write one line saying hello to a.md", "hello"), + ("Write a line saying hello to a.md", "hello"), + ("Add a line that says hello.", "hello"), + ("Write a line saying \"hello there\"", "hello there"), + ] { + let r = read(goal); + assert!( + r.contains(&RequiredPhrases(vec![phrase.to_string()])), + "{goal}: {r:?}" + ); + } + // another count, or a bound, cannot say what each line holds: uncertain + for goal in [ + "Add 2 lines saying hi to a.md", + "Write three lines saying hello", + "Add 2 lines that say hi", + "Add at least 3 lines saying hi to a.md", + "Write a line saying hello and then save it", + "Write a line saying something nice", + "Add one line saying", + ] { + let ex = analyze(goal); + assert!( + !ex.uncertain.is_empty(), + "{goal:?} must be uncertain, got {:?}", + ex.requirements + ); + } + // unrelated numbers and words stay as they were + assert!(read("Fix 2 typos in README.md").is_empty()); + assert!(read("Add a line to a.md").is_empty()); +} diff --git a/crates/aien-runtime/tests/requirements_usability_test.rs b/crates/aien-runtime/tests/requirements_usability_test.rs index 30650216..cc69328b 100644 --- a/crates/aien-runtime/tests/requirements_usability_test.rs +++ b/crates/aien-runtime/tests/requirements_usability_test.rs @@ -40,7 +40,6 @@ fn uncertain(goal: &str) -> Vec { fn counted_requests_are_read_by_the_documented_rule() { // add|append|insert|with N lines (and "N-line"): exactly N added lines. for (goal, n) in [ - ("Add one line to notes/TODO.md saying buy milk", 1), ("Add 2 lines to README.md", 2), ("Append 3 lines to LOG.md", 3), ("Add a one-line note to README.md", 1), @@ -54,6 +53,14 @@ fn counted_requests_are_read_by_the_documented_rule() { ] { assert_eq!(reqs(goal), [added(n, true)], "{goal}"); } + // sc#349: the plain phrase after "saying" is required as well + assert_eq!( + reqs("Add one line to notes/TODO.md saying buy milk"), + [ + added(1, true), + RequiredPhrases(vec!["buy milk".to_string()]) + ] + ); // write|put|create|... N lines: at least N added lines. for (goal, n) in [ ("Write 20 lines about X to docs/x.md", 20), @@ -456,9 +463,13 @@ fn lower_bound_after_the_noun_and_single_line() { ); assert_eq!( reqs("Add a single line saying hello to a.md"), - [added(1, true)] + [added(1, true), RequiredPhrases(vec!["hello".to_string()])] ); // No explicit count: nothing is measured (documented): "a line" is not a number word. - assert!(reqs("Add a line saying hello to a.md").is_empty()); + // sc#349: no count is measured, but what the line says is still required + assert_eq!( + reqs("Add a line saying hello to a.md"), + [RequiredPhrases(vec!["hello".to_string()])] + ); assert!(reqs("Add a couple of lines or a few to a.md").is_empty()); } ```