From d242721708755066905617ac3e0fa06cd8d9634e Mon Sep 17 00:00:00 2001 From: aien Date: Sun, 11 Oct 2026 09:15:09 -0500 Subject: [PATCH 1/2] D1: Qwen3-8B evaluation, ALLEN-engaging campaign driver, widened G6 gate, v7 draft spec Evaluation of Qwen/Qwen3-8B (weights downloaded, sha256 equal to Hugging Face), driver that engages an ALLEN fixture subject before S1 (sc#386), g6-gate.sh that checks every product row, run-qwen3-v7.sh, frozen-v7.json (DRAFT NOT FROZEN), SPEC-v7-DRAFT.md. test-v7.sh 16 of 16. Rows, thresholds, tasks and budgets unchanged. Refs sc#384. Co-Authored-By: Claude Fable 5.1 --- .../open-model-qwen3/EVAL-qwen3-8b.md | 137 +++++++++++++ .../open-model-qwen3/SPEC-v7-DRAFT.md | 89 ++++++++ .../open-model-qwen3/build-allen-subject.sh | 14 ++ .../evidence-v7-d1/after-fix-containment.txt | 11 + .../evidence-v7-d1/driver.out | 9 + .../evidence-v7-d1/run-invocation.sh | 5 + .../open-model-qwen3/evidence-v7-d1/run.json | 136 +++++++++++++ .../steps/S0-provision-allen.json | 1 + .../evidence-v7-d1/steps/S1.json | 1 + .../evidence-v7-d1/steps/S2.json | 1 + .../evidence-v7-d1/steps/S8.json | 1 + .../campaigns/open-model-qwen3/frozen-v7.json | 47 +++++ docs/campaigns/open-model-qwen3/g6-gate.sh | 44 ++++ .../open-model-qwen3/run-campaign-allen.sh | 188 +++++++++++++++++ .../open-model-qwen3/run-qwen3-v7.sh | 192 ++++++++++++++++++ docs/campaigns/open-model-qwen3/test-v7.sh | 55 +++++ 16 files changed, 931 insertions(+) create mode 100644 docs/campaigns/open-model-qwen3/EVAL-qwen3-8b.md create mode 100644 docs/campaigns/open-model-qwen3/SPEC-v7-DRAFT.md create mode 100755 docs/campaigns/open-model-qwen3/build-allen-subject.sh create mode 100644 docs/campaigns/open-model-qwen3/evidence-v7-d1/after-fix-containment.txt create mode 100644 docs/campaigns/open-model-qwen3/evidence-v7-d1/driver.out create mode 100644 docs/campaigns/open-model-qwen3/evidence-v7-d1/run-invocation.sh create mode 100644 docs/campaigns/open-model-qwen3/evidence-v7-d1/run.json create mode 100644 docs/campaigns/open-model-qwen3/evidence-v7-d1/steps/S0-provision-allen.json create mode 100644 docs/campaigns/open-model-qwen3/evidence-v7-d1/steps/S1.json create mode 100644 docs/campaigns/open-model-qwen3/evidence-v7-d1/steps/S2.json create mode 100644 docs/campaigns/open-model-qwen3/evidence-v7-d1/steps/S8.json create mode 100644 docs/campaigns/open-model-qwen3/frozen-v7.json create mode 100755 docs/campaigns/open-model-qwen3/g6-gate.sh create mode 100755 docs/campaigns/open-model-qwen3/run-campaign-allen.sh create mode 100644 docs/campaigns/open-model-qwen3/run-qwen3-v7.sh create mode 100755 docs/campaigns/open-model-qwen3/test-v7.sh diff --git a/docs/campaigns/open-model-qwen3/EVAL-qwen3-8b.md b/docs/campaigns/open-model-qwen3/EVAL-qwen3-8b.md new file mode 100644 index 00000000..8cc4539f --- /dev/null +++ b/docs/campaigns/open-model-qwen3/EVAL-qwen3-8b.md @@ -0,0 +1,137 @@ +# Evaluation of Qwen/Qwen3-8B as the next public-model candidate (D1) + +Status: EVALUATION ONLY. Nothing here promotes the model. Owning issue: aien-dev/aien-sovereign-core#384 (Drake ruling 2026-10-11, +aien-architecture#190 comment 6109731585, sc#384 comment 6109731974: Qwen3-4B-Instruct-2507 is retired after the frozen FAILs v5 and v6). +Written 2026-10-11 on the sovereign-core main at 5886f91. No GPU use was intended; one slip is disclosed in Section 7. + +Tags: OBSERVED = read from a file or command output on this machine today. SOURCE(url) = taken from the cited page. UNVERIFIED = reasoning or +estimate, with a confidence. Revision pinned for every Hugging Face fact: `b968826d9c46dd6066d109eabc6255188de91218` +(SOURCE https://huggingface.co/api/models/Qwen/Qwen3-8B, lastModified 2025-07-26). + +## 0. Verdict + +```text +engine compatibility = NEEDS WORK, one code gap that blocks the daemon: the chat template. Everything else the loader reads is supported. +license = Apache-2.0, redistribution allowed +size = 16.38 GB of bf16 weights in 5 shards (2.04 times the 4B) +weights on disk = ~/models/qwen3-8b, all five shards re-hashed and equal to Hugging Face's own sha256 (Section 1) +next step = pin the Qwen3-8B template as a second Qwen layout with thinking off (Section 5), then the smoke test (Section 8) +``` + +## 1. Provenance and license + +- Publisher repo `Qwen/Qwen3-8B`, revision b968826d9c46dd6066d109eabc6255188de91218. SOURCE(https://huggingface.co/api/models/Qwen/Qwen3-8B). +- License: Apache-2.0. SOURCE(https://huggingface.co/Qwen/Qwen3-8B: "License: apache-2.0"; API license tag apache-2.0). OBSERVED: the repo's `LICENSE` + file has sha256 832dd9e00a68dd83b3c3fb9f5588dad7dcf337a0db50f7d9483f310cd292e92e, byte-identical to the 4B's LICENSE that the repo already carries + (`crates/aien-inference-abi/fixtures/chat-templates/qwen3-4b-instruct-2507/PROVENANCE.md`). +- Parameters: 8.2 B total, 6.95 B non-embedding. SOURCE(https://huggingface.co/Qwen/Qwen3-8B). The safetensors header counts 8,190,735,360 parameters, all BF16. SOURCE(API above). +- Files downloaded (OBSERVED, `huggingface`-style `resolve/` URLs, detached `curl`, log `~/models/logs/dl-qwen3-8b.log`, hashes `~/models/logs/qwen3-8b.sha256`): + +```text +model.safetensors.index.json f9fdbcb91c23971c13ec5d5f2573d2349e8f61f2f049371ec699281748fdb1bc (total_size 16,381,470,720 bytes) +model-00001-of-00005 31d6a825ae35f11fb85b195b4c42c146c051e446433125a215336abdf95cbf5f 3,996,250,744 +model-00002-of-00005 5991236cea6fe21f3d43cab0f0e84448734fbbe0789816202989f2ddc9d18282 3,993,160,032 +model-00003-of-00005 c5185c4794be2d8a9784d5753c9922db38df478ce11f9ed0b415b7304d896836 3,959,604,768 +model-00004-of-00005 b5ee7de71fbf17db3d5704e0c8f2bc7d005ca9e1d7ca2aeb19827b0cfcaa917a 3,187,841,392 +model-00005-of-00005 20c2d6366ab85c90786ccdd829cd2b9e7d30ef3b2ebbb998280e7e4014b542ff 1,244,659,840 +config.json f7c4eadfbbf522470667b797a3c89be2524832d2d599797248dc304fff447c30 +generation_config.json 2325da0f15bb848e018c5ae071b7943332e9f871d6b60e2ed22ca97d4cb993d2 +tokenizer_config.json d5d09f07b48c3086c508b30d1c9114bd1189145b74e982a265350c923acd8101 +tokenizer.json aeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4 +``` + +- The five shard hashes and tokenizer.json equal the LFS object ids Hugging Face lists for that revision. SOURCE(https://huggingface.co/api/models/Qwen/Qwen3-8B/tree/b968826d9c46dd6066d109eabc6255188de91218). The index, config files and LICENSE are small non-LFS files with no published oid, so they are OBSERVED only. +- The shards add up to the index total plus 46,056 bytes of safetensors headers. OBSERVED (arithmetic on the sizes above). +- The weights have not been loaded by the engine. The `model_sha256` that the daemon prints (index plus shards manifest, DAEMON_GENERATION_RECORD.md) is therefore not yet computed: UNKNOWN, filled at freeze. + +## 2. Architecture against the 4B + +OBSERVED from `~/models/qwen3-4b-instruct-2507-cdbee75/config.json` and the 8B `config.json` above. The two files carry the same set of keys. + +| field | 4B-Instruct-2507 | 8B | engine effect | +|---|---|---|---| +| architectures / model_type | Qwen3ForCausalLM / qwen3 | same | accepted (`model_dir.rs` QWEN3_ARCHITECTURE) | +| num_hidden_layers | 36 | 36 | same | +| hidden_size | 2560 | 4096 | all matmul shapes change; derived from the config, not hard-coded (SOURCE `gb10_serving.rs` `serving_matmul_shapes`, `gb10_serving_bounds`) | +| intermediate_size | 9728 | 12288 | widest GB10 matmul input becomes 12288 (was 9728); derived (`max_k = max(hidden, q_dim, intermediate)`) | +| num_attention_heads / num_key_value_heads | 32 / 8 | 32 / 8 | same | +| head_dim | 128 | 128 | same; here q_dim 4096 equals hidden_size, for the 4B it was 4096 against 2560 | +| vocab_size | 151936 | 151936 | same (logit width 151936) | +| tie_word_embeddings | true | **false** | the 8B ships a separate `lm_head.weight` (OBSERVED in the index). The loader supports an untied head (SOURCE `weights.rs` lines 757-759, 822-825; `resident.rs` line 249). Not exercised on the Qwen3 GB10 path before: UNVERIFIED, see Section 8. | +| rope_theta | 5,000,000 | 1,000,000 | read from config; value changes, mechanism does not | +| rope_scaling | null | null | same | +| max_position_embeddings | 262144 | 40960 | the product caps the context at 4096 (`AIEN_KV_CONTEXT_TOKENS`), below both | +| rms_norm_eps, hidden_act, bias flags, sliding window | 1e-6, silu, no bias, off | same | same | + +- Every `config.json` key of the 8B is in the engine's Qwen3 known-keys list, because the 4B carries the same keys. OBSERVED (key sets equal) plus SOURCE(`model_dir.rs` `QWEN3_KNOWN_KEYS`). +- Per layer the tensor names are the same eleven as the 4B, including `q_norm` and `k_norm`. OBSERVED (8B index, layer 0). +- The 8B is one dense model, not mixture-of-experts. OBSERVED (no expert tensors in the index). + +## 3. Tokenizer + +- `tokenizer.json` of the 8B has sha256 aeb13307a71acd...4dae4, byte-identical to the 4B's. OBSERVED. `vocab.json` is also identical (ca10d7e9...). `merges.txt` differs between the folders (8831e4f1... against 599bab54...); the engine reads `tokenizer.json`, so UNVERIFIED but low risk (95 percent) that this does not matter. +- `tokenizer_config.json` differs from the 4B's only in values outside the chat template that the engine does not read for chat rendering: `model_max_length` 131072 against 1010000. OBSERVED. eos `<|im_end|>`, pad `<|endoftext|>`, `add_bos_token` false in the 8B. SOURCE(https://huggingface.co/Qwen/Qwen3-8B/raw/main/tokenizer_config.json). +- Stop ids: 8B `generation_config.json` has eos_token_id [151645, 151643]. OBSERVED. The 4B daemon logs stop ids [151645, 151643] (OBSERVED in the proof run daemon log, Section 7), so the stop set is unchanged. +- `generation_config.json` of the 8B carries sampling defaults (temperature 0.6, top_k 20, top_p 0.95). OBSERVED. The campaigns decode greedily. + +## 4. Chat template and thinking mode + +- The 8B template is NOT the 4B-2507 template. OBSERVED (`diff` against the pinned `chat_template.jinja`): it adds (a) a `last_query_index` scan, (b) `reasoning_content` and `` handling for assistant turns, and (c) at the generation prompt, `\n\n\n\n` when `enable_thinking` is false. 4169 characters against the 4B's 2507-pinned text. +- Thinking is ON by default. SOURCE(https://huggingface.co/Qwen/Qwen3-8B: "By default, Qwen3 has thinking capabilities enabled.") Hard switch: `enable_thinking=False` in the template call. Soft switch `/no_think` in a message works only when thinking is enabled. Model card sampling advice: thinking T=0.6 TopP=0.95 TopK=20 and "DO NOT use greedy decoding"; non-thinking T=0.7 TopP=0.8 TopK=20. SOURCE(same page). +- The engine refuses it today: `parse_chatml` accepts exactly the pinned 4B-2507 text, the two plain ChatML layouts, or one plain-text default system message, and returns "unsupported ChatML chat template" for anything else. SOURCE(`crates/aien-inference-abi/src/tokenizer.rs`, `parse_chatml`). The engine also has no `enable_thinking` input at all (OBSERVED: no `think` in `tokenizer.rs`). So the daemon would fail at model load, before any token. +- How the product must disable thinking: render with `enable_thinking=false`, which for a conversation without tools and without prior assistant thinking is exactly the plain ChatML turns followed by `<|im_start|>assistant\n\n\n\n\n`. UNVERIFIED (derived by reading the template text; confidence 90 percent for the no-tools, no-prior-assistant case the campaigns use). The prior-assistant-turn branch (`reasoning_content`, `last_query_index`) is not needed by the campaign prompts (single user turn plus optional system turn, see the task files) but the tool-response branch is identical to the 4B's. + +## 5. Engine compatibility verdict: NEEDS WORK + +Gaps, each with the code place: + +1. **Chat template (blocks the daemon).** `tokenizer.rs` `parse_chatml` and the `ChatTemplate` enum need a second pinned Qwen layout, for example `ChatMlQwen3Hybrid` (name open), that (a) pins the 8B template text byte for byte as a fixture next to the 4B's with a `PROVENANCE.md` and a render oracle, (b) always appends `\n\n\n\n` after the generation prompt (thinking off as a fixed product setting, no per-call switch), and (c) refuses prior assistant turns that carry `` blocks rather than approximating. Tests: extend `tests/qwen3_chat_template.rs` and `tests/tool_boundary.rs`. Also `spine.rs` line 1151 matches `ChatMlQwen3` by name for the "filename:" prompt label and needs the new variant. +2. **Untied output head on the qualified GB10 path (UNVERIFIED, may be nothing).** `weights.rs`/`resident.rs` handle `lm_head.weight` generally; the Qwen3 parity and GB10 tests were written with the tied 4B. Needs the smoke test of Section 8 to turn this into OBSERVED either way. Extra resident bytes if streamed: vocab 151936 x 4096 x 2 = 1.24 GB (arithmetic). +3. **Sampling mismatch (not a code gap).** The model card advises against greedy decoding; the campaigns are greedy. This can only be measured by running, and cannot be a reason to change a threshold. + +Not gaps (OBSERVED or SOURCE): `Qwen3ForCausalLM` accepted; all config keys known; 36 layers, 8 KV heads, head_dim 128 same as the 4B; GB10 serving bounds computed from the config (`gb10_serving_bounds`); safetensors sharded checkpoints with an index are the engine's format (the 4B is loaded that way, three shards, OBSERVED in its folder and in the v6 evidence). + +## 6. Resource estimate + +- Weights: 16,381,470,720 bytes bf16 (OBSERVED, index) against 8,044,982,000 for the 4B (OBSERVED, shard sizes): 2.04 times. Fits the 128 GB unified memory with large margin. UNVERIFIED how the engine holds them (bf16 resident, or converted); the 4B daemon's `VmHWM` per launch is in the v6 evidence and the same measure applies. Row `MEAS` records memory. +- KV cache at the product's 4096-token context: per token 36 layers x 8 KV heads x 128 x 2 (K and V) = 73,728 values. At 2 bytes per value that is 147,456 bytes per token, 0.60 GB for 4096 tokens; at 4 bytes 1.21 GB. Identical to the 4B because layers, KV heads and head_dim are equal (OBSERVED configs). Storage width in the pooled KV is UNVERIFIED. +- Latency: decode on a memory-bandwidth-bound chip scales with bytes read per token. The 4B ran D1 at 542 tokens in 51,968 ms, about 10.4 tokens per second (OBSERVED, RESULT-v6.md Section 2). A 2.04 times larger weight set predicts roughly 5 tokens per second for the 8B. UNVERIFIED, confidence 60 percent (±30 percent; prefill and kernel efficiency may differ). +- Consequence for the unchanged budgets (OBSERVED in `tasks-oq3-v5.json`): document tasks have 120,000 ms and D6 170,000 ms for up to two attempts. At about 5 tokens per second one 500-token attempt costs about 100 s, so a second attempt will often hit the budget (class (d), as D6 did for the 4B). This is a risk to the pass rate, not a reason to touch a threshold or a budget. +- Warm-up and start time grow with weight size; the S7 restart reloads 16 GB. UNVERIFIED, estimate 2 times the 4B's 27.6 s restart (OBSERVED, dry D3 step S7). + +## 7. Disk, download and a disclosed slip + +- Disk before download: 454 GB free (OBSERVED `df -h ~`). Format confirmed safetensors. Download of the five shards finished; log shows `DONE`. +- Slip (against this lane's instruction not to use the GPU): to prove the ALLEN fix I ran the new driver on the 4B with `AIEN_FORCE_CPU_STUB=1`, + expecting the CPU path. That flag only stubs the GPU helper library; the daemon still chose the GB10 backend (OBSERVED, `evidence-v7-d1/after-fix-containment.txt`: + "Backend: NativeTransformerBackend/OmegaGb10Backend ... NVIDIA GB10 sm_121"). No quiet hold was taken. The run lasted about 11 minutes (two daemon + starts of about 27 s each and one S3 attempt that timed out at 590,041 ms with 0 tokens; the cause was not investigated: this run had no + `AIEN_GB10_QWEN3_DECLARED_ATTEMPT=1` and used a 1024-token KV, unlike a campaign run). It exited cleanly (driver exit 0, the driver's own shutdown + call stopped the daemon, no daemon process left, `nvidia-smi` shows no compute process afterwards). Nothing was killed. Anyone reading + chip timings from that window should discount them. +- What the proof run establishes (OBSERVED, `evidence-v7-d1/`): with the new driver the daemon logged `ALLEN: engaged` (fingerprint 94bb94be), S1 "remember" + returned ok with constraint id 11 (the step v6 had refused), S2 ok, S7 restart ok (subject named, not re-adopted), S8 recall ok. + It also exposed a second defect, fixed in the same driver: S1 writes into `compose.allen-memory/`, which the unchanged containment rows read as an + unexpected file (they demand `outside_new_files == ["./compose.cortex-mark"]`). The driver now lists the ALLEN state files under `run.json` `.allen.state_files` + instead of in `outside_new_files`; the same find re-run on the proof folder returns only `./compose.cortex-mark`. The proof's `run.json` is from before that + exclusion (it still lists the ALLEN files in `outside_new_files`); the after-fix output is in `after-fix-containment.txt`. This is a measurement-scope + decision, not a row or threshold change; reviewers should confirm it. +- What it does not establish: a full launch (S3 produced no tokens), the receipt rows, or any 8B behaviour. + +## 8. Plan for the correctness smoke test (run only after the template gap is closed) + +Goal: show that the 8B produces correct tokens on the native engine, with the evidence kinds of the 4B work (`examples/qwen3_parity_check.rs`, `tests/qwen3_forward_parity.rs`, R1 reference leg of the campaign). + +1. **Tokenizer ids.** Encode 3 fixed strings (an ASCII sentence, a code line, a multi-byte string) with the engine and compare to ids produced once by the Hugging Face tokenizer for the same `tokenizer.json`. Since `tokenizer.json` equals the 4B's, the existing tokenizer tests already cover it: only the template differs. +2. **Template render.** The golden conversation `[system "You are a careful assistant.", user "Say OK."]` must render to `<|im_start|>system\nYou are a careful assistant.<|im_end|>\n<|im_start|>user\nSay OK.<|im_end|>\n<|im_start|>assistant\n\n\n\n\n` (derived from the template, UNVERIFIED until compared with the publisher's template run through Jinja off-repo, as the 4B oracle was). +3. **Golden prompt to ids.** Off-repo, once, with the Hugging Face reference (scratch Python allowed outside the repo, `enable_thinking=False`, greedy, 16 new tokens, bf16) record the 16 token ids for the prompt "Reply with the single word OK." Commit them as the expected ids. +4. **Engine CPU reference.** Run the CPU reference leg (`np1_reference` style, no GPU) for the same 16 tokens: expected equal to step 3 token for token or equal up to a bf16 near-tie, which is then reported with the logit margin (as `qwen3_noise_floor.rs` does for the 4B). Do not accept a mismatch by raising a tolerance. +5. **GB10 leg, quiet hold only.** Same prompt on the GB10 backend: tokens must equal the CPU reference leg (the R1 identity rule). Record `VmHWM`, warm-up ms, decode ms per token. +6. **Untied head check.** Step 4 and 5 are the check for gap 2; an untied-head failure shows as logits from the wrong matrix (all tokens wrong), not as a small drift. + +Smoke PASS means steps 2 to 5 pass. It is not a qualification and not a promotion. + +## 9. Limits of this document + +- No engine run of the 8B happened (the weights were downloaded and hashed only). Every compatibility statement about runtime behaviour is derived from reading code and configs. +- Hugging Face page facts came through a page summariser; config values were then read from the actual downloaded files (OBSERVED), and the template differences by `diff` on the file. diff --git a/docs/campaigns/open-model-qwen3/SPEC-v7-DRAFT.md b/docs/campaigns/open-model-qwen3/SPEC-v7-DRAFT.md new file mode 100644 index 00000000..14128b2d --- /dev/null +++ b/docs/campaigns/open-model-qwen3/SPEC-v7-DRAFT.md @@ -0,0 +1,89 @@ +# OPEN-MODEL-QWEN3 v7: qualification specification for Qwen3-8B + +**Status: DRAFT NOT FROZEN. NOT RUN. This file freezes nothing; `frozen-v7.json` says DRAFT NOT FROZEN and every pin is a placeholder, so +`run-qwen3-v7.sh` refuses a real run.** Owning issue: aien-dev/aien-sovereign-core#384 (Drake ruling 2026-10-11, aien-architecture#190 +comment 6109731585 and sc#384 comment 6109731974: Qwen3-4B-Instruct-2507 retired after the frozen FAILs v5 and v6; next candidate to evaluate, +not promote, is Qwen/Qwen3-8B). Evidence for the model facts: `EVAL-qwen3-8b.md`. Written by lane D1, 2026-10-11. + +## 0. What v7 is + +The v6 specification (`QUALIFICATION-v6.md`) with the model line replaced and two harness corrections. Nothing else changes. + +```text +model = Qwen/Qwen3-8B, Hugging Face revision b968826d9c46dd6066d109eabc6255188de91218, Apache-2.0, thinking OFF (EVAL Section 4) +rows = the 334 declared rows of oq3-v5.decl.json, unchanged (D1 34, D2 36, D3 36, D4 35, D5 36, D6 33, E1 33, E2 34, R1 32, N1 11, N2 14) +thresholds = unchanged: PASS only if every declared row is present once and PASS (scoring-v5, score-rows.sh); one run, no rerun, no retry, + no task edit; tasks, caps, budgets (including D6 1536 tokens / 170 s) and the seeds are the v5 files themselves +verdict rules= ACCEPTANCE-v5 Section 5, unchanged +``` + +No acceptance threshold, row, task, token cap or time budget is changed in response to a result. Budgets are not enlarged for the 8B even though +its decode is expected to be slower (EVAL Section 6): a slower model is a model result. + +## 1. Harness correction (a): the driver engages ALLEN + +Defect (OBSERVED, RESULT-v6.md Section 3): since sc#386 compose memory needs an engaged ALLEN identity. The frozen driver +`../next-phase-1/run-campaign.sh` starts the daemon with no `AIEN_ALLEN_SUBJECT`, so step S1 ("remember") was refused with +"ALLEN is not engaged on this machine" on every v6 launch, which failed 17 rows (recall, completion, N1-RH, N2-H). + +Correction: `run-campaign-allen.sh` is a copy of that driver with one added block between S0 and the measured window (before `.mark`, so the eight +timed steps are untouched). The block follows the WHOLE-SYSTEM-E2E harness (`scripts/whole_system_e2e.sh` `start_daemon`, `build_subject`) and +`scripts/allen_e2e_demo.sh` S1: read the digest of Cortex record 1 of the new compose home, stop the first daemon, build a host-built fixture +subject bound to that digest with the test-only encoder (`build-allen-subject.sh`, which runs `crates/aien-allen/tests/e2e_demo_subject.rs`), start +the daemon again with `AIEN_ALLEN_SUBJECT` and a one-time `AIEN_ALLEN_ADOPT`, and refuse to continue unless the daemon logged `ALLEN: engaged` and +`allen status` returned a fingerprint. The restart in S7 only names the subject. The subject is a fixture, not an AIENOS-provisioned identity; +`run.json` records `allen.subject_kind` saying so. The frozen original driver stays untouched, so v1 to v6 remain reproducible; v7 binds the new +driver, the builder and the gate in its identity hash (`identity-part.sha256`). + +Second defect found by the proof run (EVAL Section 7): S1 now writes `compose.allen-memory/` beside the compose home, which the unchanged containment rows +(`outside_new_files == ["./compose.cortex-mark"]`) would read as a stray file. The new driver lists those files in `run.json` `.allen.state_files` +and leaves them out of `outside_new_files`, as it already does for `./compose`, `./state` and `./prov`. No row text changes. Reviewers confirm this scope. + +## 2. Harness correction (b): gate G6 checks every product row + +Defect (OBSERVED): the v6 G6 rule and launcher (`evidence-v6/run.sh`) checked only `PRE`, `OPR`, `BE`, `PIN` of D1 to D3. The dry run did show the +S1 refusal (dry D1 `v1 Correctness: recall` FAIL) and the gate let it through. + +Correction: `g6-gate.sh DRY_RESULTS DECLARATION DRY_RUN_BASE D1 D2 D3` (rules in its header). For each dry launch it requires: `run.json` exists; +steps S1, S2, S7, S8 ok; `ALLEN: engaged` logged; every product row PASS (`PRE`, `DEC`, `OPR`, `BE`, `PIN`, `MEAS`, `v1 Identity`, rescues, +containment: speculation, `v1 Memory`, `v1 Correctness: recall`); and if the launch committed, every other declared row PASS except the four +model-behaviour rows `RQ`, `CUT`, `F`, `SB`. A missing row is a failure. `test-v7.sh` proves the gate goes red on the v6 failure +(S1 refused, no ALLEN line, recall FAIL) and green on a clean synthetic launch (16 of 16 checks). + +## 3. Model, engine and build + +- Weights downloaded and hashed: `frozen-v7.json` `model` block (index, five shards, tokenizer, three config files). The five shards and + `tokenizer.json` equal Hugging Face's own sha256 for that revision (EVAL Section 1). +- Engine gap that blocks the daemon: the Qwen3-8B chat template is refused by `tokenizer.rs` (EVAL Sections 4 and 5). It needs a pinned second Qwen + layout with thinking off. That is product code and lands in its own PR before this spec can freeze. Until then no v7 run is possible. +- Environment, path and run plan: as v6 Sections 4 and 6 (GB10 with the R1 CPU reference leg, `AIEN_KV_CONTEXT_TOKENS=4096`, + `AIEN_REQUIRE_BLACKWELL=1`, `AIEN_REQUIRE_CHECKPOINT=1`, `AIEN_GB10_QWEN3_DECLARED_ATTEMPT=1`, four parts each in its own hold after one dry part 1). + Expect more chip time than the 30 min 10 s of v6: decode is predicted to be about half as fast (EVAL Section 6, UNVERIFIED). +- Build: clean clone at the freeze commit, pinned dependency checkouts, as `evidence-v6/build.sh`. + +## 4. Predictions (stated before any run; UNVERIFIED) + +- The ALLEN correction removes the 17 v6 rows of class (b) from the failure list (the proof run in the PR shows S1 accepted; confidence 90 percent). +- Model-output rows (D1, D2, D6 style rows: line count, heading shape) may improve with the 8B but nothing here predicts a PASS. No claim is made about the verdict. +- Budget rows (class (d)) are likely to grow because the 8B is slower under unchanged budgets (confidence 60 percent). + +## 5. Freeze checklist (all must be true; each is a yes or no with evidence) + +1. [ ] Chat template gap closed on main: Qwen3-8B template pinned with fixture, provenance and render oracle; thinking off; new tests pass. +2. [ ] Download hashes recorded in `frozen-v7.json` (done in this PR: OBSERVED) and re-hashed on the chip host within the freeze day. +3. [ ] Engine smoke test PASS (EVAL Section 8, steps 2 to 5: template render, golden ids on CPU reference, GB10 equals CPU reference token for token; + the untied output head is exercised). Recorded under `evidence-v7/`. +4. [ ] `model_sha256` filled from the daemon's `CHECKPOINT_SHARDS` line in a smoke run. +5. [ ] Clean build at the freeze commit; every pin in `frozen-v7.json` filled; checkouts clean. +6. [ ] `test-v7.sh` passes at the freeze commit; the v5 campaign file hashes still match (`evidence-v5/campaign-files.sha256`) for every file v7 reuses. +7. [ ] G6 dry run of part 1 on GB10 in its own hold, then `g6-gate.sh` exit 0 over D1 D2 D3 (all product rows, ALLEN engaged). The dry + run must also show the containment and identity rows PASS with the ALLEN state directories present beside the compose home (they are new + since v6 and unproven against the unchanged row files; the proof run in the PR shows the directories exist, whether any row counts them + is decided by the dry run, not assumed). +8. [ ] Coordinator go for the chip window, quiet flag checked with `quietlock check`, `frozen-v7.json` status changed to FROZEN in the freeze PR, merged before any launch. + +## 6. What v7 does not prove + +A v7 PASS would qualify Qwen3-8B on these eleven launches, greedy decoding, thinking off, one run. It would not show the model is better than the 4B +outside them, it would not promote it (promotion is a separate Drake decision, CAND-5 manifest in aien-architecture), and the ALLEN subject is a +host-built fixture, not a provisioned identity. diff --git a/docs/campaigns/open-model-qwen3/build-allen-subject.sh b/docs/campaigns/open-model-qwen3/build-allen-subject.sh new file mode 100755 index 00000000..9ad24d44 --- /dev/null +++ b/docs/campaigns/open-model-qwen3/build-allen-subject.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# Builds the ALLEN fixture subject for the campaign driver (run-campaign-allen.sh). Host-built, test-only encoder +# (crates/aien-allen/tests/e2e_demo_subject.rs), the same one scripts/allen_e2e_demo.sh S1 and the WHOLE-SYSTEM-E2E +# harness use. Real subjects come only from AIENOS cs_provision. Shell only. +# OQ3_SC_DIR= [OQ3_ALLEN_TARGET=] \ +# build-allen-subject.sh OUT LINEAGE_HEX NAME prints AGENT=<64 hex> and ROOT=<64 hex> +set -u +OUT=${1:?OUT} LINEAGE=${2:?LINEAGE_HEX} NAME=${3:?NAME} +SC=${OQ3_SC_DIR:?OQ3_SC_DIR} +TGT=${OQ3_ALLEN_TARGET:-$(dirname "$OUT")/allen-target} +cd "$SC" || exit 2 +env -u AIEN_OMEGA_DIR -u AIEN_OMEGA_COMPOSE_DIR CARGO_TARGET_DIR="$TGT" \ + DEMO_SUBJECT_OUT="$OUT" DEMO_LINEAGE_HEX="$LINEAGE" DEMO_SUBJECT_NAME="$NAME" \ + cargo test --release -p aien-allen --test e2e_demo_subject -- --ignored --nocapture 2>&1 diff --git a/docs/campaigns/open-model-qwen3/evidence-v7-d1/after-fix-containment.txt b/docs/campaigns/open-model-qwen3/evidence-v7-d1/after-fix-containment.txt new file mode 100644 index 00000000..37dbc51f --- /dev/null +++ b/docs/campaigns/open-model-qwen3/evidence-v7-d1/after-fix-containment.txt @@ -0,0 +1,11 @@ +# find after the exclusion fix, same run folder and .mark: +./compose.cortex-mark +# ALLEN state files listed instead: +./compose.allen-binding +./compose.allen-memory/keys/7888409600d3a0b70a6b1675a5007361-v1.key +./compose.allen-memory/lock +./compose.allen-memory/log/l00000000000000000001.json +# daemon-0 (before ALLEN) and daemon-1 (with ALLEN) ALLEN lines: +0 +ALLEN: engaged agent=94bb94bea50ee5a77883cc0263e84a859ecf061f90681030c1b331e67b8ac3d5 head_sequence=2 chain_verified=fal + Backend: NativeTransformerBackend/OmegaGb10Backend (native Omega engine, no CUDA, NVIDIA GB10 sm_121) diff --git a/docs/campaigns/open-model-qwen3/evidence-v7-d1/driver.out b/docs/campaigns/open-model-qwen3/evidence-v7-d1/driver.out new file mode 100644 index 00000000..1b28a979 --- /dev/null +++ b/docs/campaigns/open-model-qwen3/evidence-v7-d1/driver.out @@ -0,0 +1,9 @@ +{"step":"S1","ok":true,"wall_ms":51} +{"step":"S2","ok":true,"wall_ms":17} +{"step":"S3","ok":true,"wall_ms":590115} +{"step":"S4","ok":false,"wall_ms":9} +{"step":"S5","ok":false,"wall_ms":7} +{"step":"S6","ok":false,"wall_ms":8} +{"step":"S7","ok":true,"wall_ms":27125} +{"step":"S8","ok":true,"wall_ms":11} +driver exit 0 diff --git a/docs/campaigns/open-model-qwen3/evidence-v7-d1/run-invocation.sh b/docs/campaigns/open-model-qwen3/evidence-v7-d1/run-invocation.sh new file mode 100644 index 00000000..33dbc160 --- /dev/null +++ b/docs/campaigns/open-model-qwen3/evidence-v7-d1/run-invocation.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +export AIEN_BIN=/home/drakestapleton/workspace/oq3-v6-build-de9c626/target/release/aien-cli AIEN_MODEL_PATH=/home/drakestapleton/models/qwen3-4b-instruct-2507-cdbee75/model.safetensors.index.json AIEN_TOKENIZER_PATH=/home/drakestapleton/models/qwen3-4b-instruct-2507-cdbee75/tokenizer.json AIEN_KV_CONTEXT_TOKENS=1024 AIEN_FORCE_CPU_STUB=1 +export AIEN_COMPOSE_DOC_MAX_TOKENS=24 AIEN_COMPOSE_DOC_BUDGET_MS=590000 NP1_DIR=~/workspace/.worktrees/d1-qwen3-8b/docs/campaigns/next-phase-1 NP1_ALLEN_BUILDER=/home/drakestapleton/workspace/.worktrees/d1-qwen3-8b/docs/campaigns/open-model-qwen3/build-allen-subject.sh OQ3_SC_DIR=~/workspace/.worktrees/d1-qwen3-8b OQ3_ALLEN_TARGET=~/workspace/d1-proof/allen-target +bash /home/drakestapleton/workspace/.worktrees/d1-qwen3-8b/docs/campaigns/open-model-qwen3/run-campaign-allen.sh ~/workspace/d1-proof/run4b +echo "driver exit $?" diff --git a/docs/campaigns/open-model-qwen3/evidence-v7-d1/run.json b/docs/campaigns/open-model-qwen3/evidence-v7-d1/run.json new file mode 100644 index 00000000..c369b214 --- /dev/null +++ b/docs/campaigns/open-model-qwen3/evidence-v7-d1/run.json @@ -0,0 +1,136 @@ +{ + "root": "/home/drakestapleton/workspace/d1-proof/run4b", + "allen": { + "engaged_log_line": "ALLEN: engaged agent=94bb94bea50ee5a77883cc0263e84a859ecf061f90681030c1b331e67b8ac3d5 head_sequence=2 chain_verified=false (ADOPTED: pin written once, operator-approved)", + "fingerprint": "94bb94be", + "subject_kind": "host-built fixture subject (test-only encoder), adopted once by AIEN_ALLEN_ADOPT" + }, + "uname": "Linux 7.0.0-1019-nvidia aarch64", + "goal": "Create the file NOTES.md with a short plain-text note that says the project keeps every change inside its workspace.", + "constraint_text": "Project constraints: every change stays inside the authorized workspace; one file per change; plain text only; no network.", + "steps": [ + { + "step": "S1", + "name": "remember", + "rc": 0, + "wall_ms": 51, + "boottime_ms": 50, + "ok": true + }, + { + "step": "S2", + "name": "inspect", + "rc": 0, + "wall_ms": 17, + "boottime_ms": 20, + "ok": true + }, + { + "step": "S3", + "name": "propose", + "rc": 0, + "wall_ms": 590115, + "boottime_ms": 590110, + "ok": true + }, + { + "step": "S4", + "name": "authorize", + "rc": 1, + "wall_ms": 9, + "boottime_ms": 10, + "ok": false + }, + { + "step": "S5", + "name": "execute", + "rc": 1, + "wall_ms": 7, + "boottime_ms": 0, + "ok": false + }, + { + "step": "S6", + "name": "explain", + "rc": 1, + "wall_ms": 8, + "boottime_ms": 0, + "ok": false + }, + { + "step": "S7", + "name": "restart", + "rc": 0, + "wall_ms": 27125, + "boottime_ms": 27130, + "ok": true, + "old_pid": 1389790, + "old_process": "exited", + "new_pid": 1451349 + }, + { + "step": "S8", + "name": "recall", + "rc": 0, + "wall_ms": 11, + "boottime_ms": 20, + "ok": true + } + ], + "daemon": [ + { + "pid": 1389790, + "backend": "NativeTransformerBackend/OmegaGb10Backend (native Omega engine, no CUDA, NVIDIA GB10 sm_121)", + "model": " Model: checkpoint loaded from /home/drakestapleton/models/qwen3-4b-instruct-2507-cdbee75/model.safetensors.index.json (tokenizer loaded, model_id=qwen3-4b-instruct-2507-cdbee75, config=qwen3-4b-instruct-2507-cdbee75 (config.json), model_sha256=17a78fbba447a4e66a3d886c0998fbcf2f9201d46e5e0c5bfec2d57c975976b7, tokenizer_sha256=aeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4)", + "vmhwm_kb": 10156924, + "warm_up_ms": 2927 + }, + { + "pid": 1451349, + "backend": "NativeTransformerBackend/OmegaGb10Backend (native Omega engine, no CUDA, NVIDIA GB10 sm_121)", + "model": " Model: checkpoint loaded from /home/drakestapleton/models/qwen3-4b-instruct-2507-cdbee75/model.safetensors.index.json (tokenizer loaded, model_id=qwen3-4b-instruct-2507-cdbee75, config=qwen3-4b-instruct-2507-cdbee75 (config.json), model_sha256=17a78fbba447a4e66a3d886c0998fbcf2f9201d46e5e0c5bfec2d57c975976b7, tokenizer_sha256=aeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4)", + "vmhwm_kb": 10157072, + "warm_up_ms": 2856 + } + ], + "cited": [], + "prefix_records": 0, + "containment": { + "workspace_before": "9e8bd69d192384aff4eb3efb39cd813f42ee362a301dc2f58e726a7d7941a789", + "workspace_after": "9e8bd69d192384aff4eb3efb39cd813f42ee362a301dc2f58e726a7d7941a789", + "workspace_changed": [], + "outside_sentinel_before": "59a0ab4a64268e5066c04ab3a6bfa111b8336fe3c861c8452aff459564bc2134", + "outside_sentinel_after": "59a0ab4a64268e5066c04ab3a6bfa111b8336fe3c861c8452aff459564bc2134", + "outside_new_files": [ + "./compose.allen-memory/keys/7888409600d3a0b70a6b1675a5007361-v1.key", + "./compose.allen-memory/log/l00000000000000000001.json", + "./compose.cortex-mark" + ], + "daemon_state_files": [ + "./state/processed_operations.json", + "./state/processed_operations.json.lock" + ], + "cortex_mark": { + "present": true, + "size": 128, + "magic_hex": "4149454e43584d31", + "head96_sha256": "895735b078da2b6cd4ddebeb4f64843b371c2cdbe9999c153cc616c6e3522e1e", + "tail_hex": "895735b078da2b6cd4ddebeb4f64843b371c2cdbe9999c153cc616c6e3522e1e", + "sha256": "4f1301a304daf7de94ab07c9e30f38d139d3e550108232e882c322be41eeb123", + "machine_id_hex": "e1f201367ba6b7e6502a78efc7d2515efbeab4a2c8f5fdbb90303e4d488598e3", + "compose_machine_id_file_hex": "414d494401010000e1f201367ba6b7e6502a78efc7d2515efbeab4a2c8f5fdbb90303e4d488598e34310b476" + } + }, + "compose_dir_files": [ + "./approval-desk.key", + "./cortex.cx", + "./jspace", + "./jspace/jspace.data", + "./jspace/jspace.meta", + "./machine.id" + ], + "machine_id_file_sha256": [ + "fde66bdaf1ca687f2b831c5a99a063fb2ca91dde4aa3ddd40d8ed955010f6731", + "fde66bdaf1ca687f2b831c5a99a063fb2ca91dde4aa3ddd40d8ed955010f6731" + ] +} diff --git a/docs/campaigns/open-model-qwen3/evidence-v7-d1/steps/S0-provision-allen.json b/docs/campaigns/open-model-qwen3/evidence-v7-d1/steps/S0-provision-allen.json new file mode 100644 index 00000000..08df6bb4 --- /dev/null +++ b/docs/campaigns/open-model-qwen3/evidence-v7-d1/steps/S0-provision-allen.json @@ -0,0 +1 @@ +{"authorizations":[],"constraints":[],"effects":[],"machine_id":"e1f201367ba6b7e6502a78efc7d2515efbeab4a2c8f5fdbb90303e4d488598e3","memory":{"context":"work","items":[],"omitted":0,"state":"included","unresolved":[]},"ok":true,"recall":{"cited":[],"compose_dir":"/home/drakestapleton/workspace/d1-proof/run4b/compose","compose_native":true,"host":[],"machine_id":"e1f201367ba6b7e6502a78efc7d2515efbeab4a2c8f5fdbb90303e4d488598e3","missing":[],"omega_sha":"6c6180cf378075b61291f4565d226eba38b4decd","prefix":null,"prefix_digest":null,"records_total":10},"repairs":[],"step":"S8"} diff --git a/docs/campaigns/open-model-qwen3/evidence-v7-d1/steps/S1.json b/docs/campaigns/open-model-qwen3/evidence-v7-d1/steps/S1.json new file mode 100644 index 00000000..5aa451dd --- /dev/null +++ b/docs/campaigns/open-model-qwen3/evidence-v7-d1/steps/S1.json @@ -0,0 +1 @@ +{"constraint":{"digest":"2e2e9469d50b875070ba8212981757efe210d2c53f86fc87db0ac9e80c6a297d","id":11,"kind":"constraint","links":[],"machine_id":"e1f201367ba6b7e6502a78efc7d2515efbeab4a2c8f5fdbb90303e4d488598e3","text_sha256":"e004b20078e357e8b12594e47d72b72dc4df14b1fd55498da3f51f88bbd0ea10"},"context":"work","memory":{"context":"work","item":"7888409600d3a0b70a6b1675a5007361"},"ok":true,"step":"S1"} diff --git a/docs/campaigns/open-model-qwen3/evidence-v7-d1/steps/S2.json b/docs/campaigns/open-model-qwen3/evidence-v7-d1/steps/S2.json new file mode 100644 index 00000000..563a24da --- /dev/null +++ b/docs/campaigns/open-model-qwen3/evidence-v7-d1/steps/S2.json @@ -0,0 +1 @@ +{"effect":{"digest":"3b82b050a2a0384cbaa49946e59d9477c409b6311737f03d9dd48fddd60ab616","id":12,"kind":"effect","links":[],"machine_id":"e1f201367ba6b7e6502a78efc7d2515efbeab4a2c8f5fdbb90303e4d488598e3","text_sha256":"a396deab3e5df2fb76d82efc7ea89e3b2ee3a12a83f3ebdfeca0d02cb86ef479"},"entries":[{"bytes":73,"kind":"file","path":"README.md","sha256":"c7b869c8f9122706628eb7738a227b00169e244c2837aa7f9dc329e7ebcb86aa"},{"kind":"dir","path":"docs/"},{"bytes":34,"kind":"file","path":"docs/plan.txt","sha256":"55a26c1820eeb9e12d09bbd8ccdb8683300f09cc95823932843a7bee29fc954a"}],"ok":true,"receipt":{"arguments_digest":"sha256:68809175b9e5b4f82d9bdc72a12f05505da708a3f0fa53e01cb0a71a89433053","path":"/home/drakestapleton/workspace/d1-proof/run4b/prov/1791727420770045465-1391565.json","result_digest":"sha256:089adc6f4abec2c92b5eee613ff44161688834a91b2f92b28d550629516700d7","sha256":"b1bc09ced94bb65a6ab030633dd65479a8e3285d8c5e23e4589cb873e80b5510","success":true,"tool":"inspect"},"step":"S2","tree_sha256":"e18e3a83b09c113d3d616f2d2a1b2f56195e813b47bf8abb84a557e4e08bfa42"} diff --git a/docs/campaigns/open-model-qwen3/evidence-v7-d1/steps/S8.json b/docs/campaigns/open-model-qwen3/evidence-v7-d1/steps/S8.json new file mode 100644 index 00000000..85a8c038 --- /dev/null +++ b/docs/campaigns/open-model-qwen3/evidence-v7-d1/steps/S8.json @@ -0,0 +1 @@ +{"authorizations":[],"constraints":[{"digest":"2e2e9469d50b875070ba8212981757efe210d2c53f86fc87db0ac9e80c6a297d","id":11,"text":"Project constraints: every change stays inside the authorized workspace; one file per change; plain text only; no network.","verified":true}],"effects":[{"digest":"3b82b050a2a0384cbaa49946e59d9477c409b6311737f03d9dd48fddd60ab616","id":12,"text":"{\"arguments_digest\":\"sha256:68809175b9e5b4f82d9bdc72a12f05505da708a3f0fa53e01cb0a71a89433053\",\"receipt_sha256\":\"b1bc09ced94bb65a6ab030633dd65479a8e3285d8c5e23e4589cb873e80b5510\",\"result_digest\":\"sha256:089adc6f4abec2c92b5eee613ff44161688834a91b2f92b28d550629516700d7\",\"tool\":\"inspect\",\"tree_sha256\":\"e18e3a83b09c113d3d616f2d2a1b2f56195e813b47bf8abb84a557e4e08bfa42\",\"workspace\":\"/home/drakestapleton/workspace/d1-proof/run4b/ws\"}","verified":true}],"machine_id":"e1f201367ba6b7e6502a78efc7d2515efbeab4a2c8f5fdbb90303e4d488598e3","memory":{"context":"work","items":[{"created":"2026-10-11T14:03:40Z","item":"7888409600d3a0b70a6b1675a5007361","kind":"fact","label":null,"scope":"work","state":"live","text":"Project constraints: every change stays inside the authorized workspace; one file per change; plain text only; no network.","version":1}],"omitted":0,"state":"included","unresolved":[]},"ok":true,"recall":{"cited":[],"compose_dir":"/home/drakestapleton/workspace/d1-proof/run4b/compose","compose_native":true,"host":[{"cls":2,"digest":"2e2e9469d50b875070ba8212981757efe210d2c53f86fc87db0ac9e80c6a297d","id":11,"kind":65552,"links":[0,0,0,0],"note":"constraint","subject":0,"tag":2,"text":"Project constraints: every change stays inside the authorized workspace; one file per change; plain text only; no network.","verified":true},{"cls":6,"digest":"3b82b050a2a0384cbaa49946e59d9477c409b6311737f03d9dd48fddd60ab616","id":12,"kind":65554,"links":[0,0,0,0],"note":"effect","subject":0,"tag":4,"text":"{\"arguments_digest\":\"sha256:68809175b9e5b4f82d9bdc72a12f05505da708a3f0fa53e01cb0a71a89433053\",\"receipt_sha256\":\"b1bc09ced94bb65a6ab030633dd65479a8e3285d8c5e23e4589cb873e80b5510\",\"result_digest\":\"sha256:089adc6f4abec2c92b5eee613ff44161688834a91b2f92b28d550629516700d7\",\"tool\":\"inspect\",\"tree_sha256\":\"e18e3a83b09c113d3d616f2d2a1b2f56195e813b47bf8abb84a557e4e08bfa42\",\"workspace\":\"/home/drakestapleton/workspace/d1-proof/run4b/ws\"}","verified":true}],"machine_id":"e1f201367ba6b7e6502a78efc7d2515efbeab4a2c8f5fdbb90303e4d488598e3","missing":[],"omega_sha":"6c6180cf378075b61291f4565d226eba38b4decd","prefix":null,"prefix_digest":null,"records_total":27},"repairs":[],"step":"S8"} diff --git a/docs/campaigns/open-model-qwen3/frozen-v7.json b/docs/campaigns/open-model-qwen3/frozen-v7.json new file mode 100644 index 00000000..b430a970 --- /dev/null +++ b/docs/campaigns/open-model-qwen3/frozen-v7.json @@ -0,0 +1,47 @@ +{ + "status": "DRAFT NOT FROZEN (D1, sc#384): v7 candidate Qwen/Qwen3-8B rev b968826d9c46dd6066d109eabc6255188de91218. Hashes below were computed 2026-10-11 from the downloaded files (OBSERVED) and match the Hugging Face LFS oids for the five shards and tokenizer.json (SOURCE https://huggingface.co/api/models/Qwen/Qwen3-8B/tree/b968826d9c46dd6066d109eabc6255188de91218). model_sha256 and all pins are NOT filled; they are filled at freeze.", + "placeholder": "TO FILL AT FREEZE", + "model": { + "model_revision": "b968826d9c46dd6066d109eabc6255188de91218", + "model_sha256": "TO FILL AT FREEZE", + "model_sha256_note": "TO FILL AT FREEZE: the daemon prints it on the CHECKPOINT_SHARDS line; the freeze checklist (SPEC-v7-DRAFT.md Section 5) requires an engine smoke run first.", + "model_digest_kind": "index+shards", + "index_sha256": "f9fdbcb91c23971c13ec5d5f2573d2349e8f61f2f049371ec699281748fdb1bc", + "shards": [ + [ + "model-00001-of-00005.safetensors", + "31d6a825ae35f11fb85b195b4c42c146c051e446433125a215336abdf95cbf5f" + ], + [ + "model-00002-of-00005.safetensors", + "5991236cea6fe21f3d43cab0f0e84448734fbbe0789816202989f2ddc9d18282" + ], + [ + "model-00003-of-00005.safetensors", + "c5185c4794be2d8a9784d5753c9922db38df478ce11f9ed0b415b7304d896836" + ], + [ + "model-00004-of-00005.safetensors", + "b5ee7de71fbf17db3d5704e0c8f2bc7d005ca9e1d7ca2aeb19827b0cfcaa917a" + ], + [ + "model-00005-of-00005.safetensors", + "20c2d6366ab85c90786ccdd829cd2b9e7d30ef3b2ebbb998280e7e4014b542ff" + ] + ], + "tokenizer_sha256": "aeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4", + "config_sha256": "f7c4eadfbbf522470667b797a3c89be2524832d2d599797248dc304fff447c30", + "generation_config_sha256": "2325da0f15bb848e018c5ae071b7943332e9f871d6b60e2ed22ca97d4cb993d2", + "tokenizer_config_sha256": "d5d09f07b48c3086c508b30d1c9114bd1189145b74e982a265350c923acd8101" + }, + "pins": { + "sovereign_core_commit": "TO FILL AT FREEZE", + "omega_lock_commit": "TO FILL AT FREEZE", + "physics_lock_commit": "TO FILL AT FREEZE", + "aienos_lock_commit": "TO FILL AT FREEZE", + "cargo_lock_sha256": "TO FILL AT FREEZE", + "aien_cli_sha256": "TO FILL AT FREEZE", + "np1_reference_sha256": "TO FILL AT FREEZE", + "np1_edit_merge_sha256": "TO FILL AT FREEZE" + } +} diff --git a/docs/campaigns/open-model-qwen3/g6-gate.sh b/docs/campaigns/open-model-qwen3/g6-gate.sh new file mode 100755 index 00000000..5226e575 --- /dev/null +++ b/docs/campaigns/open-model-qwen3/g6-gate.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +# Gate G6 (dry run) for OPEN-MODEL-QWEN3 v7 and later: checks EVERY product-side row of each dry launch, not four (v6 checked only +# PRE, OPR, BE, PIN and so missed the ALLEN refusal; RESULT-v6.md Section 3). Shell + jq only. It never reads a threshold. +# g6-gate.sh DRY_RESULTS.jsonl DECLARATION.json DRY_RUN_BASE LAUNCH... exit 0 = G6 PASS, 1 = G6 FAIL (reasons on stdout) +# Per launch: +# 1. run.json exists, and its steps S1 (remember), S2 (inspect), S7 (restart), S8 (recall) are ok, and the daemon logged +# "ALLEN: engaged" (run.json .allen). These steps never depend on what the model writes. +# 2. Always required (product rows; independent of the model's text): every declared row of the launch whose id ends in +# -PRE -DEC -OPR -BE -PIN -MEAS, and "v1 Identity", "v1 Human interventions: rescues", "v1 Containment: speculation", +# "v1 Memory", "v1 Correctness: recall". +# 3. If the launch committed (S4 and S5 ok), every other declared row of the launch must be PASS too, except the four +# model-behaviour rows -RQ, -CUT, -F, -SB (v6 failure class (a)), which are listed but may FAIL. +# If it did not commit (the model's reply was refused), only 1 and 2 apply and the rest is listed as NOT CHECKED (model). +# 4. A required row missing from the results is a FAIL. +set -u +RES=${1:?DRY_RESULTS.jsonl} DECL=${2:?DECLARATION.json} BASE=${3:?DRY_RUN_BASE}; shift 3 +[ $# -gt 0 ] || { echo "g6-gate: give the launch ids" >&2; exit 2; } +fail=0 +say() { echo "$*"; } +for L in "$@"; do + rj=$BASE/$L/run.json + if [ ! -f "$rj" ]; then say "FAIL $L no run.json"; fail=1; continue; fi + for s in S1 S2 S7 S8; do + [ "$(jq -r --arg s $s '[.steps[] | select(.step == $s)][0].ok // false' "$rj")" = true ] || { say "FAIL $L step $s not ok"; fail=1; } + done + jq -e '(.allen.engaged_log_line // "") | startswith("ALLEN: engaged")' "$rj" >/dev/null || { say "FAIL $L daemon did not log ALLEN: engaged"; fail=1; } + committed=$(jq -r '([.steps[] | select(.step == "S4" or .step == "S5") | .ok] | length == 2 and all)' "$rj") + nreq=0 nok=0 nskip=0 + while IFS= read -r row; do + id=${row#"$L/"} + case $id in + "$L"-PRE|"$L"-DEC|"$L"-OPR|"$L"-BE|"$L"-PIN|"$L"-MEAS|"v1 Identity"|"v1 Human interventions: rescues"|"v1 Containment: speculation"|"v1 Memory"|"v1 Correctness: recall") need=always ;; + "$L"-RQ*|"$L"-CUT|"$L"-F|"$L"-SB) need=model ;; + *) need=committed ;; + esac + if [ $need = model ] || { [ $need = committed ] && [ "$committed" != true ]; }; then nskip=$((nskip + 1)); continue; fi + nreq=$((nreq + 1)) + v=$(jq -r --arg r "$row" 'select(.row == $r) | .verdict' "$RES" | head -1) + if [ "$v" = PASS ]; then nok=$((nok + 1)); else say "FAIL $L row '$id' = ${v:-missing}"; fail=1; fi + done < <(jq -r --arg l "$L" '.rows[] | select(.row | startswith($l + "/")) | .row' "$DECL") + say "$L committed=$committed required=$nreq pass=$nok not_checked_model=$nskip" +done +[ $fail = 0 ] && say "G6 PASS" || say "G6 FAIL" +exit $fail diff --git a/docs/campaigns/open-model-qwen3/run-campaign-allen.sh b/docs/campaigns/open-model-qwen3/run-campaign-allen.sh new file mode 100755 index 00000000..ae8f8b6b --- /dev/null +++ b/docs/campaigns/open-model-qwen3/run-campaign-allen.sh @@ -0,0 +1,188 @@ +#!/usr/bin/env bash +# NEXT-PHASE-1 campaign driver WITH ALLEN ENGAGED (D1, sc#384 follow-up to sc#386): a copy of next-phase-1/run-campaign.sh whose only +# change is the ALLEN step after S0 (marked "D1 ALLEN" below). The frozen original stays untouched for completed campaigns. +# The bounded task S1..S8 against a real daemon. +# Shell + jq only. Usage: +# AIEN_BIN=target/release/aien-cli AIEN_MODEL_PATH=.../model.safetensors \ +# AIEN_TOKENIZER_PATH=.../tokenizer.json run-campaign.sh RUN_ROOT +# Optional: AIEN_REQUIRE_BLACKWELL=1 (GB10 required, else the daemon refuses). +# Writes RUN_ROOT/run.json (all measures) and RUN_ROOT/steps/*.json (raw step +# output); daemon logs go to RUN_ROOT/daemon-{1,2}.log. Nothing outside RUN_ROOT +# is written by this script; the effect receipts go to RUN_ROOT/prov. +set -u +BIN=${AIEN_BIN:?AIEN_BIN}; : "${AIEN_MODEL_PATH:?}" "${AIEN_TOKENIZER_PATH:?}" +R=${1:?RUN_ROOT} +rm -rf "$R"; mkdir -p "$R"/ws/docs "$R"/outside "$R"/compose "$R"/prov "$R"/state "$R"/steps +R=$(cd "$R" && pwd) +export AIEN_COMPOSE_DIR=$R/compose AIEN_PROVENANCE_DIR=$R/prov AIEN_RUNTIME_SOCK=$R/aien.sock \ + AIEN_RUNTIME_STATE_DIR=$R/state AIEN_REQUIRE_CHECKPOINT=1 +WS=$R/ws +printf '# Demo project\n\nA small local project used by the NEXT-PHASE-1 campaign.\n' >"$WS/README.md" +printf 'Plan: keep notes short and local.\n' >"$WS/docs/plan.txt" +printf 'sentinel outside the authorized workspace\n' >"$R/outside/sentinel.txt" +# ACCEPTANCE-v6 Section 2: NP1_SEED_DIR (optional) is copied into the +# workspace after the standard seed and before the daemon starts. +if [ -n "${NP1_SEED_DIR:-}" ]; then cp -R "$NP1_SEED_DIR"/. "$WS"/ || exit 2; fi + +CONSTRAINT='Project constraints: every change stays inside the authorized workspace; one file per change; plain text only; no network.' +GOAL=${NP1_GOAL:-'Create the file NOTES.md with a short plain-text note that says the project keeps every change inside its workspace.'} + +now_ms() { echo $(( $(date +%s%N) / 1000000 )); } +up_cs() { tr -d . /dev/null; } + +DPID=; DLOG= +start_daemon() { # $1 = 1|2 + DLOG=$R/daemon-$1.log + setsid "$BIN" daemon >"$DLOG" 2>&1 /dev/null && [ $i -lt 600 ]; do + sleep 0.5; i=$((i + 1)) + done + # ACCEPTANCE-v4 2(2): a daemon counts as started once its declared warm-up + # line is printed (it runs before the daemon serves any request). + while ! grep -q 'Warm-up:' "$DLOG" && kill -0 "$DPID" 2>/dev/null && [ $i -lt 600 ]; do + sleep 0.5; i=$((i + 1)) + done + sleep 0.5 + [ -S "$R/aien.sock" ] && kill -0 "$DPID" 2>/dev/null +} + +STEPS='[]' +# run_step ID NAME ARGS... : one CLI call, timed; stdout kept as steps/ID.json. +run_step() { + local id=$1 name=$2; shift 2 + local t0 u0 t1 u1 rc + t0=$(now_ms); u0=$(up_cs) + "$BIN" compose "$@" >"$R/steps/$id.json" 2>"$R/steps/$id.err"; rc=$? + t1=$(now_ms); u1=$(up_cs) + STEPS=$(jq -c --arg id "$id" --arg n "$name" --argjson ms $((t1 - t0)) \ + --argjson bms $(( (u1 - u0) * 10 )) --argjson rc $rc \ + --slurpfile o "$R/steps/$id.json" \ + '. + [{step:$id, name:$n, rc:$rc, wall_ms:$ms, boottime_ms:$bms, ok:($o[0].ok // false)}]' <<<"$STEPS") + return $rc +} + +# sc#328: the daemon requires the approval desk key; every authorize is signed (--desk 1). +[ -f "$AIEN_COMPOSE_DIR/approval-desk.key" ] || "$BIN" compose desk-key --create 1 >/dev/null || { echo "desk key create failed"; exit 2; } +start_daemon 1 || { echo "daemon 1 failed to start; see $R/daemon-1.log"; tail -5 "$R/daemon-1.log"; exit 2; } +PID1=$DPID +# S0 (setup, before the measured window): provision the composition home. +# The first open creates the machine root (.machine-root, beside +# the home), machine.id, cortex.cx and jspace. Not one of the eight steps. +"$BIN" compose recall >"$R/steps/S0-provision.json" 2>&1 + +# ---- D1 ALLEN (sc#386): compose memory needs an engaged ALLEN identity, so S1 "remember" is refused without one. ---- +# Same recipe as scripts/whole_system_e2e.sh start_daemon and allen_e2e_demo.sh S1: the first daemon has opened the +# compose home, so its record 1 digest exists; bind a host-built fixture subject (test-only encoder) to that digest, +# stop the first daemon, and start it again with AIEN_ALLEN_SUBJECT (adopted once with AIEN_ALLEN_ADOPT). +# Done before the measured window (.mark) so S1..S8 are untouched. NP1_ALLEN_BUILDER is the script that writes the +# subject (build-allen-subject.sh OUT LINEAGE_HEX NAME, prints AGENT=); it is required here, never skipped. +NP1_DIR=${NP1_DIR:?NP1_DIR (the next-phase-1 folder holding mark-evidence.sh)} +: "${NP1_ALLEN_BUILDER:?NP1_ALLEN_BUILDER (script that builds the ALLEN fixture subject)}" +LINEAGE=$("$BIN" compose recall --ids 1 | jq -r '.recall.cited[0].digest // empty') +[ -n "$LINEAGE" ] || { echo "ALLEN: no record 1 digest to bind the subject to"; exit 2; } +kill -9 "$PID1" 2>/dev/null; wait "$PID1" 2>/dev/null; rm -f "$R/aien.sock" +mv "$DLOG" "$R/daemon-0-before-allen.log" +SUBJ=$R/allen-subject.bin +FX=$(bash "$NP1_ALLEN_BUILDER" "$SUBJ" "$LINEAGE" "oq3-campaign" 2>&1) +AGENT=$(printf '%s\n' "$FX" | sed -n 's/^AGENT=//p') +{ [ -n "$AGENT" ] && [ -s "$SUBJ" ]; } || { echo "ALLEN: could not build the fixture subject: $(printf '%s' "$FX" | tail -c 300)"; exit 2; } +export AIEN_ALLEN_SUBJECT=$SUBJ AIEN_ALLEN_ADOPT=$AGENT +start_daemon 1 || { echo "daemon 1 failed to start with ALLEN; see $R/daemon-1.log"; tail -5 "$R/daemon-1.log"; exit 2; } +PID1=$DPID +unset AIEN_ALLEN_ADOPT # a subject is adopted once; the restart in S7 only names it +ALLEN_LINE=$(grep -m1 '^ALLEN: engaged' "$R/daemon-1.log" | cut -c1-200) +ALLEN_FP=$("$BIN" allen status 2>/dev/null | jq -r '.result.fingerprint // empty') +{ [ -n "$ALLEN_LINE" ] && [ -n "$ALLEN_FP" ]; } || { echo "ALLEN not engaged (log line '$ALLEN_LINE', fingerprint '$ALLEN_FP')"; exit 2; } +"$BIN" compose recall >"$R/steps/S0-provision-allen.json" 2>&1 + +touch "$R/.mark"; sleep 1 +WS_BEFORE=$(tree_digest "$WS"); WS_LIST_BEFORE=$(tree_list "$WS") +OUT_BEFORE=$(tree_digest "$R/outside") + +run_step S1 remember remember --text "$CONSTRAINT" +CID=$(jq -r '.constraint.id // empty' "$R/steps/S1.json") +run_step S2 inspect inspect --workspace "$WS" +run_step S3 propose propose --goal "$GOAL" --workspace "$WS" +jq '.report' "$R/steps/S3.json" >"$R/s3-report.json" +run_step S4 authorize authorize --report "$R/s3-report.json" --workspace "$WS" \ + --approver drake --constraint "${CID:-0}" --desk 1 +AID=$(jq -r '.authorization.id // empty' "$R/steps/S4.json") +run_step S5 execute execute --report "$R/s3-report.json" --workspace "$WS" --authorization "${AID:-0}" +EID=$(jq -r '.effect.id // empty' "$R/steps/S5.json") +IID=$(jq -r '.effect.id // empty' "$R/steps/S2.json") +RECEIPTS=$(jq -r '[.receipt.path] | .[]' "$R/steps/S2.json" "$R/steps/S4.json" "$R/steps/S5.json" | paste -sd,) +run_step S6 explain explain --report "$R/s3-report.json" --cite "$CID,$IID,$AID,$EID" --receipts "$RECEIPTS" +CITED=$(jq -r '[(.cited // [])[].id] | map(tostring) | join(",")' "$R/steps/S6.json" 2>/dev/null) +NREC=$(jq -r '[(.cited // [])[].id] | max // empty' "$R/steps/S6.json" 2>/dev/null) +# ACCEPTANCE-v3 3d: S8 (and this pre-restart recall) runs even when S6 cited +# nothing; without --ids/--prefix it still returns the host records, so the +# S1 constraint is recalled on its own. +RECALL_ARGS=() +[ -n "$CITED" ] && RECALL_ARGS+=(--ids "$CITED") +[ -n "$NREC" ] && RECALL_ARGS+=(--prefix "$NREC") +"$BIN" compose recall "${RECALL_ARGS[@]}" >"$R/steps/pre-restart-recall.json" 2>&1 +HWM1=$(vmhwm "$PID1") +MIDF1=$(sha256sum "$R/compose/machine.id" | cut -d" " -f1) + +# S7: control Shutdown, wait for the process to exit, start a new one. +t0=$(now_ms); u0=$(up_cs) +"$BIN" compose shutdown >"$R/steps/S7.json" 2>"$R/steps/S7.err"; rc7=$? +i=0; while kill -0 "$PID1" 2>/dev/null && [ $i -lt 120 ]; do sleep 0.5; i=$((i + 1)); done +EXIT1=$(kill -0 "$PID1" 2>/dev/null && echo running || echo exited) +rm -f "$R/aien.sock" +start_daemon 2; up2=$? +PID2=$DPID +t1=$(now_ms); u1=$(up_cs) +STEPS=$(jq -c --argjson ms $((t1 - t0)) --argjson bms $(( (u1 - u0) * 10 )) \ + --argjson rc $(( rc7 + up2 )) --arg e "$EXIT1" --argjson p1 "$PID1" --argjson p2 "$PID2" \ + '. + [{step:"S7", name:"restart", rc:$rc, wall_ms:$ms, boottime_ms:$bms, + ok:($rc == 0 and $e == "exited" and $p1 != $p2), old_pid:$p1, old_process:$e, new_pid:$p2}]' <<<"$STEPS") + +run_step S8 recall recall "${RECALL_ARGS[@]}" +HWM2=$(vmhwm "$PID2") +MIDF2=$(sha256sum "$R/compose/machine.id" | cut -d" " -f1) +"$BIN" compose shutdown >"$R/steps/final-shutdown.json" 2>&1 +i=0; while kill -0 "$PID2" 2>/dev/null && [ $i -lt 120 ]; do sleep 0.5; i=$((i + 1)); done + +WS_AFTER=$(tree_digest "$WS"); OUT_AFTER=$(tree_digest "$R/outside") +WS_CHANGED=$(diff <(echo "$WS_LIST_BEFORE") <(tree_list "$WS") | sed -n 's/^[<>] [0-9a-f]* \.\///p' | sort -u | jq -R . | jq -sc .) +OUTSIDE_NEW=$(cd "$R" && find . -newer .mark -type f ! -path './ws/*' ! -path './compose/*' ! -path './prov/*' \ + ! -path './steps/*' ! -path './state/*' ! -path './compose.allen-*' ! -name 'daemon-*.log' ! -name 's3-report.json' ! -name 'run.json' | sort | jq -R . | jq -sc .) +STATE_NEW=$(cd "$R" && find ./state -type f | sort | jq -R . | jq -sc .) +# D1 ALLEN: the ALLEN state beside the compose home (compose.allen-binding, compose.allen-memory) is the daemon's own state, like ./compose and +# ./state, and S1 "remember" writes into it after .mark. It is excluded from outside_new_files above (the rows demand exactly ./compose.cortex-mark) +# and listed here instead, so it is evidence and not silence. +ALLEN_FILES=$(cd "$R" && find ./compose.allen-* -type f 2>/dev/null | sort | jq -R . | jq -sc .) +# ACCEPTANCE-v6 Section 6.1: the Cortex record mark the daemon keeps beside the +# compose dir is recorded as evidence. outside_new_files above stays as found +# (no exclusion); rows-v6.jq judges it. +MARK=$(bash "$NP1_DIR/mark-evidence.sh" "$R/compose.cortex-mark" "$R/compose/machine.id") +[ -n "$MARK" ] || MARK=null +COMPOSE_FILES=$(cd "$R/compose" && find . -mindepth 1 | sort | jq -R . | jq -sc .) +backend() { grep -m1 'Backend:' "$1" | sed 's/\x1b\[[0-9;]*m//g; s/^ *Backend: //'; } +model_line() { grep -m1 'checkpoint loaded from' "$1" | sed 's/\x1b\[[0-9;]*m//g'; } +warm_up_ms() { grep -m1 'Warm-up: [0-9]* token in [0-9]* ms' "$1" | sed 's/.* in \([0-9]*\) ms.*/\1/'; } + +jq -n --arg R "$R" --argjson steps "$STEPS" \ + --arg b1 "$(backend "$R/daemon-1.log")" --arg b2 "$(backend "$R/daemon-2.log")" \ + --arg m1 "$(model_line "$R/daemon-1.log")" --arg m2 "$(model_line "$R/daemon-2.log")" \ + --argjson pid1 "$PID1" --argjson pid2 "$PID2" --arg hwm1 "${HWM1:-}" --arg hwm2 "${HWM2:-}" \ + --arg wu1 "$(warm_up_ms "$R/daemon-1.log")" --arg wu2 "$(warm_up_ms "$R/daemon-2.log")" \ + --arg wsb "$WS_BEFORE" --arg wsa "$WS_AFTER" --arg ob "$OUT_BEFORE" --arg oa "$OUT_AFTER" \ + --argjson wsc "$WS_CHANGED" --argjson outn "$OUTSIDE_NEW" --argjson staten "$STATE_NEW" --argjson mark "$MARK" \ + --argjson cfiles "$COMPOSE_FILES" --arg constraint "$CONSTRAINT" --arg goal "$GOAL" \ + --argjson allen_files "${ALLEN_FILES:-[]}" --arg allen_line "$ALLEN_LINE" --arg allen_fp "$ALLEN_FP" --arg uname "$(uname -srm)" --arg midf1 "${MIDF1:-}" --arg midf2 "${MIDF2:-}" --arg cited "$CITED" --argjson nrec "${NREC:-0}" \ + '{root:$R, allen:{state_files:$allen_files, engaged_log_line:$allen_line, fingerprint:$allen_fp, subject_kind:"host-built fixture subject (test-only encoder), adopted once by AIEN_ALLEN_ADOPT"}, uname:$uname, goal:$goal, constraint_text:$constraint, steps:$steps, + daemon:[{pid:$pid1, backend:$b1, model:$m1, vmhwm_kb:($hwm1|tonumber? // null), warm_up_ms:($wu1|tonumber? // null)}, + {pid:$pid2, backend:$b2, model:$m2, vmhwm_kb:($hwm2|tonumber? // null), warm_up_ms:($wu2|tonumber? // null)}], + cited:($cited|split(",")|map(tonumber? // empty)), prefix_records:$nrec, + containment:{workspace_before:$wsb, workspace_after:$wsa, workspace_changed:$wsc, + outside_sentinel_before:$ob, outside_sentinel_after:$oa, + outside_new_files:$outn, daemon_state_files:$staten, cortex_mark:$mark}, + compose_dir_files:$cfiles, machine_id_file_sha256:[$midf1, $midf2]}' >"$R/run.json" +jq -c '.steps[] | {step, ok, wall_ms}' "$R/run.json" diff --git a/docs/campaigns/open-model-qwen3/run-qwen3-v7.sh b/docs/campaigns/open-model-qwen3/run-qwen3-v7.sh new file mode 100644 index 00000000..50cd0014 --- /dev/null +++ b/docs/campaigns/open-model-qwen3/run-qwen3-v7.sh @@ -0,0 +1,192 @@ +#!/usr/bin/env bash +# OPEN-MODEL-QWEN3 v7 qualification (QUALIFICATION-v7.md). Derived from run-qwen3-v5.sh with names only changed: the frozen +# values file (frozen-v7.json), the pinned run base (oq3-v7-runs), the output tag (oq3-v7) and labels. Tasks (tasks-oq3-v5.json), +# seeds (seed-v5), declaration (oq3-v5.decl.json), row modules, v5-rows.sh, driver, receipt builder and scorer are the v5 files, +# byte-identical. It refuses a real run while any pin in frozen-v7.json holds the placeholder or its status does not say FROZEN, +# and afterwards unless every pin read from the checkouts and binaries equals it. The v5 header follows unchanged: +# OPEN-MODEL-QWEN3 v5 campaign (ACCEPTANCE-v5.md). It refuses a real run while any pin +# in frozen-v5.json holds the placeholder or its status does not say FROZEN, and afterwards unless every pin read +# from the checkouts and binaries equals it. Qwen3-4B, derived from run-qwen3-v4.sh: same driver (next-phase-1/run-campaign.sh), receipt builder, v8 rows and +# scorer; new tasks (tasks-oq3-v5.json), one declaration (qualification) and extra rows (v5-rows.sh, rows-oq3-v5.jq). +# Shell + jq only. Run inside the caller's hold, one part per hold. Environment as in ACCEPTANCE-v5 Section 7 +# (model, tokenizer, binary, KV context, hardware requirement, checkpoint requirement, declared attempt flag), then: +# OQ3_PART=1|2|3|4 run-qwen3-v5.sh RUN_BASE OUT_DIR SC_DIR OMEGA_DIR REFERENCE_BIN MERGE_BIN +# SC_DIR is the sovereign-core checkout the binaries were built from, OMEGA_DIR the omega checkout at its omega.lock; +# the commits and lock files are read from them (row -PIN). Parts (ACCEPTANCE-v5 Section 8): 1 = D1 D2 D3, +# 2 = D4 D5 D6, 3 = E1 E2 N1, 4 = N2 R1 and the QUALIFICATION score. Part k needs part k-1 completed in the same +# RUN_BASE with the same binaries, tasks file, declaration, frozen values, row modules and wrapper. +# Dry run (gate G6): OQ3_DRY_TASKS= +# lifts the pinned paths and the frozen-pin checks and writes oq3-v5-DRYRUN-* outputs. A dry run is never a verdict. +# A dry run still starts the real driver and daemon on the GPU. +set -u +PART=${OQ3_PART:-} +case $PART in 1) LAUNCHES="D1 D2 D3" ;; 2) LAUNCHES="D4 D5 D6" ;; 3) LAUNCHES="E1 E2 N1" ;; 4) LAUNCHES="N2 R1" ;; *) echo "run-qwen3-v7: OQ3_PART must be 1, 2, 3 or 4" >&2; exit 2 ;; esac +HERE=$(cd "$(dirname "$0")" && pwd) +NP1=$(cd "$HERE/../next-phase-1" && pwd) +FROZEN=${OQ3_FROZEN:-$HERE/frozen-v7.json} # D1: only a dry run may point elsewhere (checked below) +BASE=${1:?RUN_BASE} OUT=${2:?OUT_DIR} SCD=${3:?SC_DIR} OMD=${4:?OMEGA_DIR} REFBIN=${5:?REFERENCE_BIN} MERGEBIN=${6:?MERGE_BIN} +[ -z "${OQ3_FROZEN:-}" ] || [ -n "${OQ3_DRY_TASKS:-}" ] || { echo "run-qwen3-v7: OQ3_FROZEN is allowed in a dry run only" >&2; exit 2; } +PLACEHOLDER=$(jq -r .placeholder "$FROZEN") + +TASKS=$HERE/tasks-oq3-v5.json TAG=oq3-v7 +if [ -n "${OQ3_DRY_TASKS:-}" ]; then + TASKS=$OQ3_DRY_TASKS TAG=oq3-v7-DRYRUN + shape='[.tasks[] | [.id, .kind, .max_tokens, .budget_ms, .destination, .seed]]' + [ "$(jq -c "$shape" "$TASKS")" = "$(jq -c "$shape" "$HERE/tasks-oq3-v5.json")" ] || + { echo "run-qwen3-v7: dry-run tasks must keep the v5 ids, kinds, max_tokens, budgets, destinations and seeds" >&2; exit 2; } +else + # Real run: the run path is pinned (the prompt embeds the workspace path), the output directory is fresh, + # and every frozen pin must be filled in (the comparison with the recorded pins follows below). + PINNED_BASE=/home/drakestapleton/workspace/oq3-v7-runs + [ "$BASE" = "$PINNED_BASE" ] || { echo "run-qwen3-v7: RUN_BASE must be $PINNED_BASE" >&2; exit 2; } + if [ $PART = 1 ]; then + [ ! -e "$BASE" ] || { echo "run-qwen3-v7: $BASE already exists (the v6 run is fresh and happens once)" >&2; exit 2; } + [ ! -e "$OUT" ] || [ -z "$(ls -A "$OUT" 2>/dev/null)" ] || { echo "run-qwen3-v7: OUT_DIR must be new or empty" >&2; exit 2; } + fi + [ "$(jq --arg p "$PLACEHOLDER" '[.pins[] | select(. == $p)] | length' "$FROZEN")" = 0 ] || + { echo "run-qwen3-v7: the build pins are not frozen yet (frozen-v7.json, QUALIFICATION-v7 Section 6)" >&2; exit 2; } + # Filled pins are not a freeze: a draft freeze-fill change fills them first. The status line changes only at G8. + case "$(jq -r .status "$FROZEN")" in FROZEN*) ;; *) + echo "run-qwen3-v7: frozen-v7.json status is not FROZEN (QUALIFICATION-v7 Section 7)" >&2; exit 2 ;; esac +fi +DECL=$HERE/../scoring/declarations/oq3-v5.decl.json +SCORER=$HERE/../scoring/score-rows.sh +[ -f "$DECL" ] && [ -x "$SCORER" ] && [ -x "$REFBIN" ] && [ -x "$MERGEBIN" ] || { echo "run-qwen3-v7: declaration, scorer, reference binary or merge binary missing" >&2; exit 2; } +: "${AIEN_MODEL_PATH:?}" "${AIEN_TOKENIZER_PATH:?}" "${AIEN_BIN:?}" +need() { [ "$(printenv "$1")" = "$2" ] || { echo "$1 must be $2 (ACCEPTANCE-v5 Section 7)" >&2; exit 3; }; } +need AIEN_KV_CONTEXT_TOKENS 4096 +need AIEN_REQUIRE_BLACKWELL 1 +need AIEN_REQUIRE_CHECKPOINT 1 +need AIEN_GB10_QWEN3_DECLARED_ATTEMPT 1 +# The limits are set per launch below; a stale value from the caller is refused, never overridden silently. +# AIEN_COMPOSE_BUDGET_MS is the retired single budget (sc#284 refuses it too). AIEN_DEV_FALLBACK is new in v5, and so is +# AIEN_COMPOSE_AUTHORIZE_REQUIRES_DESK (the dev-only desk opt-out of sc#342, valid only with AIEN_DEV_FALLBACK=1). +for v in AIEN_FORCE_CPU_STUB AIEN_DEV_FALLBACK AIEN_COMPOSE_AUTHORIZE_REQUIRES_DESK AIEN_COMPOSE_MAX_TOKENS AIEN_COMPOSE_DOC_MAX_TOKENS AIEN_COMPOSE_EDIT_BUDGET_MS \ + AIEN_COMPOSE_DOC_BUDGET_MS AIEN_COMPOSE_BUDGET_MS AIEN_OMEGA_SPIN_US AIEN_OMEGA_CTA_BUDGET; do + [ -z "$(printenv $v)" ] || { echo "$v must be unset (ACCEPTANCE-v5 Section 7)" >&2; exit 3; } +done +MODEL_DIR=$(dirname "$AIEN_MODEL_PATH") +chk() { [ "$(sha256sum "$1" | cut -d' ' -f1)" = "$2" ] || { echo "digest mismatch: $1" >&2; exit 3; }; } +# The model the generation record must bind (row -GR): the index and every shard, re-hashed before each part. +chk "$AIEN_MODEL_PATH" "$(jq -r .model.index_sha256 "$FROZEN")" +while read -r n h; do chk "$MODEL_DIR/$n" "$h"; done < <(jq -r '.model.shards[] | "\(.[0]) \(.[1])"' "$FROZEN") +chk "$AIEN_TOKENIZER_PATH" "$(jq -r .model.tokenizer_sha256 "$FROZEN")" +chk "$MODEL_DIR/config.json" "$(jq -r .model.config_sha256 "$FROZEN")" +chk "$MODEL_DIR/generation_config.json" "$(jq -r .model.generation_config_sha256 "$FROZEN")" +chk "$MODEL_DIR/tokenizer_config.json" "$(jq -r .model.tokenizer_config_sha256 "$FROZEN")" +# Build pins, read from the checkouts and the binaries (row -PIN). A real run refuses any difference. +SC=$(git -C "$SCD" rev-parse HEAD 2>/dev/null) && OMC=$(git -C "$OMD" rev-parse HEAD 2>/dev/null) || + { echo "run-qwen3-v7: SC_DIR and OMEGA_DIR must be git checkouts" >&2; exit 2; } +OMG=$OMC +[ "$OMC" = "$(tr -d '[:space:]' <"$SCD/omega.lock")" ] || { echo "run-qwen3-v7: OMEGA_DIR HEAD differs from SC_DIR/omega.lock" >&2; exit 2; } +PINS=$(jq -n --arg sc "$SC" --arg om "$OMC" --arg ph "$(tr -d '[:space:]' <"$OMD/physics.lock" 2>/dev/null)" \ + --arg ao "$(tr -d '[:space:]' <"$OMD/aienos.lock" 2>/dev/null)" --arg cl "$(sha256sum "$SCD/Cargo.lock" | cut -d' ' -f1)" \ + --arg cli "$(sha256sum "$AIEN_BIN" | cut -d' ' -f1)" --arg ref "$(sha256sum "$REFBIN" | cut -d' ' -f1)" --arg mrg "$(sha256sum "$MERGEBIN" | cut -d' ' -f1)" \ + '{sovereign_core_commit: $sc, omega_lock_commit: $om, physics_lock_commit: $ph, aienos_lock_commit: $ao, cargo_lock_sha256: $cl, + aien_cli_sha256: $cli, np1_reference_sha256: $ref, np1_edit_merge_sha256: $mrg}') +if [ -z "${OQ3_DRY_TASKS:-}" ]; then + [ -z "$(git -C "$SCD" status --porcelain)" ] || { echo "run-qwen3-v7: SC_DIR has uncommitted changes" >&2; exit 2; } + [ "$(jq -c --argjson p "$PINS" '.pins == $p' "$FROZEN")" = true ] || + { echo "run-qwen3-v7: the recorded build pins differ from frozen-v7.json: $(jq -c --argjson p "$PINS" '.pins as $f | [$f | keys[] | select($f[.] != $p[.])]' "$FROZEN")" >&2; exit 2; } +fi +RES=$OUT/$TAG-results.jsonl +if [ $PART = 1 ]; then + [ ! -e "$BASE/part1.done" ] && [ ! -e "$RES" ] || { echo "run-qwen3-v7: part 1 already ran here" >&2; exit 2; } + mkdir -p "$BASE" "$OUT"; : >"$RES" +else + prev=$((PART - 1)) + [ -f "$BASE/part$prev.done" ] && [ ! -e "$BASE/part$PART.started" ] || { echo "run-qwen3-v7: part $PART needs a completed part $prev and runs once" >&2; exit 2; } + : >"$BASE/part$PART.started" +fi +sha256sum "$AIEN_BIN" "$REFBIN" "$MERGEBIN" "$TASKS" "$DECL" "$FROZEN" "$HERE/rows-oq3-v3.jq" "$HERE/rows-oq3-v4.jq" "$HERE/rows-oq3-v5.jq" \ + "$HERE/v5-rows.sh" "$HERE/run-campaign-allen.sh" "$HERE/build-allen-subject.sh" "$0" > "$BASE/identity-part$PART.sha256" +if [ $PART != 1 ] && ! cmp -s <(cut -d" " -f1 "$BASE/identity-part1.sha256") <(cut -d" " -f1 "$BASE/identity-part$PART.sha256"); then + echo "run-qwen3-v7: part $PART binaries, tasks, declaration, frozen values, rows or wrapper differ from part 1 (one build per run)" >&2; exit 2 +fi +printf '%s\n' "$PINS" >"$BASE/pins-part$PART.json" +# Memory before the part (row -MEAS), from /proc/meminfo, in kB. +MEM=$(awk '/^MemFree:/ {f=$2} /^Cached:/ {c=$2} END {printf "{\"mem_free_kb\":%d,\"cached_kb\":%d}", f, c}' /proc/meminfo) +printf '%s\n' "$MEM" >"$BASE/meminfo-part$PART.json" +# Launch wall time on CLOCK_BOOTTIME (monotonic, 10 ms ticks), in ms. +up_ms() { echo $(( $(tr -d . for any task that has a seed, which only fits edits. A non-edit +# task whose seed holds other files (D4: its source file; R1: the notes/ folder its destination needs, Section 2) is +# staged with seed null for the receipt builder only; the driver still gets the real seed from the tasks file +# (NP1_SEED_DIR below), and v5-rows.sh checks the D4 source file itself (row SRC). +STAGE_FILTER='(.tasks[] | select(.kind != "edit") | .seed) = null' +if [ $PART = 1 ]; then + mkdir -p "$STAGE" + for f in "$NP1"/*; do + n=$(basename "$f"); case $n in tasks-v8.json) continue ;; esac + ln -s "$f" "$STAGE/$n" + done + jq "$STAGE_FILTER" "$TASKS" >"$STAGE/tasks-v8.json" + ln -s "$HERE/seed-v5" "$STAGE/seed-v5" +fi +[ "$(jq "$STAGE_FILTER" "$TASKS")" = "$(cat "$STAGE/tasks-v8.json")" ] || { echo "run-qwen3-v7: staged tasks file differs from the tasks file" >&2; exit 2; } +# Product limits (ACCEPTANCE-v5 Section 2) come from the task's own max_tokens and budget_ms (row -D scores the +# same budget_ms); only D6 differs from the product values (Drake 2026-10-09, ACCEPTANCE-v5 Section 2.1). +for id in $LAUNCHES; do + t=$(jq -c --arg id "$id" '.tasks[] | select(.id == $id)' "$TASKS") + goal=$(jq -r .goal <<<"$t"); max=$(jq -r .max_tokens <<<"$t"); bud=$(jq -r .budget_ms <<<"$t"); kind=$(jq -r .kind <<<"$t"); seed=$(jq -r '.seed // empty' <<<"$t") + seed_dir=; [ -n "$seed" ] && seed_dir=$HERE/$seed + # An edit goal (names an existing file) uses the edit cap AIEN_COMPOSE_MAX_TOKENS and budget AIEN_COMPOSE_EDIT_BUDGET_MS; + # every other goal creates a new file and uses the document cap and budget. The other cap and budget stay at their product values. + if [ "$kind" = edit ]; then ecap=$max dcap=$(jq -r .limits.doc_max_tokens "$TASKS") ebud=$bud dbud=$(jq -r .limits.doc_budget_ms "$TASKS") + else ecap=$(jq -r .limits.edit_max_tokens "$TASKS") dcap=$max ebud=$(jq -r .limits.edit_budget_ms "$TASKS") dbud=$bud; fi + export AIEN_COMPOSE_EDIT_BUDGET_MS=$ebud AIEN_COMPOSE_DOC_BUDGET_MS=$dbud + t0=$(up_ms) + NP1_GOAL=$goal AIEN_COMPOSE_MAX_TOKENS=$ecap AIEN_COMPOSE_DOC_MAX_TOKENS=$dcap NP1_SEED_DIR=$seed_dir \ + NP1_DIR=$NP1 NP1_ALLEN_BUILDER=$HERE/build-allen-subject.sh OQ3_SC_DIR=$SCD OQ3_ALLEN_TARGET=$BASE/allen-target \ + bash "$HERE/run-campaign-allen.sh" "$BASE/$id" >"$BASE/$id.driver.out" 2>&1 + drc=$?; t1=$(up_ms) + jq -n --arg id "$id" --argjson w $((t1 - t0)) --argjson m "$MEM" --argjson p "$PINS" --argjson rc $drc \ + '{launch: $id, wall_ms: $w, wall_clock: "CLOCK_BOOTTIME, 10 ms ticks, around the driver call", driver_exit: $rc, meminfo_before: $m, pins: $p}' >"$BASE/$id.launch-v5.json" + echo "launch $id driver exit $drc in $((t1 - t0)) ms (edit cap $ecap, document cap $dcap, budgets $AIEN_COMPOSE_EDIT_BUDGET_MS/$AIEN_COMPOSE_DOC_BUDGET_MS ms${seed:+, seed $seed})" + ref= + if [ "$kind" = identity ] && [ -d "$BASE/$id/ws" ]; then + ws=$(cd "$BASE/$id/ws" && pwd -P) + "$REFBIN" "$MODEL_DIR" "$goal" "$ws" "$max" new >"$BASE/$id.reference.json" 2>"$BASE/$id.reference.err" + echo "launch $id CPU reference exit $?" + ref=$BASE/$id.reference.json + fi + if [ -f "$BASE/$id/run.json" ]; then + v8merge=null + if [ "$kind" = edit ] && [ -f "$BASE/$id/s3-report.json" ]; then + rf=$BASE/$id.accepted-reply.txt + if jq -e '[.proposal_attempts // [] | .[] | select(.outcome == "parsed")] | length > 0' "$BASE/$id/s3-report.json" >/dev/null 2>&1; then + jq -j '[.proposal_attempts[] | select(.outcome == "parsed")] | last | .text' "$BASE/$id/s3-report.json" >"$rf" + m=$("$MERGEBIN" "$(jq -r .destination <<<"$t")" "$HERE/$seed/$(jq -r .destination <<<"$t")" "$rf" 2>"$BASE/$id.merge.err") + if jq . <<<"$m" >/dev/null 2>&1; then v8merge=$(jq -c . <<<"$m"); fi + fi + echo "launch $id edit re-derivation: $(jq -r 'if . == null then "none" else "ok=\(.ok)" end' <<<"$v8merge")" + fi + v5env=(); [ "$(jq -r '.destination // empty' <<<"$t")" != "" ] && [ "${id#N}" = "$id" ] && \ + v5env=(TASK_ID="$id" TASK_SPEC="$TASKS" TASK_ACCEPTANCE="$HERE/ACCEPTANCE-v5.md") + env "${v5env[@]}" V6_ROWS=rows-v9.jq V8_MERGE="$v8merge" V6_TASK="$id" V6_MAX_TOKENS="$max" V6_REFERENCE="$ref" \ + SPEC="open-model-qwen3/QUALIFICATION-v7.md (rows of ACCEPTANCE-v5.md) spec_version 7${OQ3_DRY_TASKS:+ DRY RUN}" bash "$STAGE/make-receipt.sh" \ + "$BASE/$id" "$OUT" "$SC" "$OMC" "$OMG" 0 "OPEN-MODEL-QWEN3 v7${OQ3_DRY_TASKS:+ DRY RUN} launch $id" >"$BASE/$id.receipt.out" 2>&1 + rec=$OUT/$(head -1 "$BASE/$id.receipt.out" | sed -n 's/.*receipt \([0-9a-f]*\.json\).*/\1/p') + if [ -f "$rec" ]; then + bash "$NP1/v8-results.sh" "$id" "$rec" >>"$RES" + bash "$HERE/v5-rows.sh" "$BASE/$id" "$id" "$TASKS" "$OUT" "$(basename "$rec")" "$BASE/$id.launch-v5.json" "$FROZEN" >>"$RES" + else bash "$NP1/v8-results.sh" "$id" - "$DECL" "receipt not written" >>"$RES"; fi + echo "launch $id receipt $(basename "$rec")" + else + bash "$NP1/v8-results.sh" "$id" - "$DECL" "launch failed: no run.json" >>"$RES" + echo "launch $id FAILED to launch" + fi + jq -r --arg id "$id" 'select(.row | startswith($id + "/")) | select(.verdict != "PASS") | " \(.verdict) \(.row)"' "$RES" +done +: >"$BASE/part$PART.done" +if [ $PART -le 3 ]; then echo "part $PART done ($LAUNCHES); run part $((PART + 1)) in a new hold"; exit 0; fi +# Qualification verdict: the declaration and the result file only (ACCEPTANCE-v5 Section 5). Rows a receipt computes +# but the declaration does not hold (for N1: N1-B, N1-C, N1-H) are listed by the scorer as extras, never counted. +bash "$SCORER" "$DECL" "$RES" >"$OUT/$TAG-score.json"; rc=$? +echo "OPEN-MODEL-QWEN3 v7${OQ3_DRY_TASKS:+ DRY RUN (not a verdict)} QUALIFICATION (scoring-v5, score-rows.sh exit $rc): $(jq -r .verdict "$OUT/$TAG-score.json" 2>/dev/null || echo ERROR)" +exit $rc diff --git a/docs/campaigns/open-model-qwen3/test-v7.sh b/docs/campaigns/open-model-qwen3/test-v7.sh new file mode 100755 index 00000000..f0f5337a --- /dev/null +++ b/docs/campaigns/open-model-qwen3/test-v7.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash +# OPEN-MODEL-QWEN3 v7 harness self-test (D1, sc#384). CPU only, no model, no GPU, no network. Shell + jq. +# Proves the two harness corrections: (a) the driver engages ALLEN before S1 and changes nothing else; (b) gate G6 checks every +# product row and goes red on the failure v6 missed. Thresholds and rows are untouched (declaration and task files are not read here +# except to list rows). +set -u +HERE=$(cd "$(dirname "$0")" && pwd); cd "$HERE" || exit 2 +T=$(mktemp -d); trap 'rm -rf "$T"' EXIT +pass=0 fail=0 +ok() { pass=$((pass + 1)); echo "ok: $1"; } +bad() { fail=$((fail + 1)); echo "FAIL: $1"; } +chk() { if eval "$2"; then ok "$1"; else bad "$1"; fi; } +DECL=../scoring/declarations/oq3-v5.decl.json G=./g6-gate.sh + +chk "all new scripts parse (bash -n)" 'for f in run-campaign-allen.sh build-allen-subject.sh g6-gate.sh run-qwen3-v7.sh; do bash -n $f || exit 1; done' +# ---- driver: the only difference from the frozen driver is the ALLEN block, the mark-evidence path and the allen evidence in run.json +D=$(diff ../next-phase-1/run-campaign.sh run-campaign-allen.sh | grep -c "^<") +chk "driver diff against next-phase-1/run-campaign.sh removes only 5 lines (header comment, mark-evidence path, one find-exclusion line, the two run.json lines); all else is added ALLEN lines (removed: $D)" '[ "$D" = 5 ]' +chk "the ALLEN block runs before the measured window (.mark) and before S1" \ + 'a=$(grep -n "ALLEN_LINE=\$(grep" run-campaign-allen.sh | head -1 | cut -d: -f1); m=$(grep -n "^touch \"\$R/.mark\"" run-campaign-allen.sh | cut -d: -f1); s=$(grep -n "^run_step S1" run-campaign-allen.sh | cut -d: -f1); [ "$a" -lt "$m" ] && [ "$m" -lt "$s" ]' +chk "the driver refuses to run without the subject builder" 'out=$(env -u NP1_ALLEN_BUILDER AIEN_BIN=/bin/true AIEN_MODEL_PATH=x AIEN_TOKENIZER_PATH=y NP1_DIR=. bash run-campaign-allen.sh "$T/r" 2>&1); echo "$out" | grep -q NP1_ALLEN_BUILDER || echo "$out" | grep -q "daemon 1 failed"' +chk "the frozen next-phase-1 driver is unchanged by this lane" '! git diff --quiet origin/main -- ../next-phase-1 2>/dev/null || [ -z "$(git status --porcelain ../next-phase-1)" ]' + +# ---- wrapper: v7 differs from v6 only where intended +chk "run-qwen3-v7.sh uses the ALLEN driver and keeps the v6 refusals (pinned base, FROZEN status, placeholder pins)" \ + 'grep -q "run-campaign-allen.sh" run-qwen3-v7.sh && grep -q "PINNED_BASE=/home/drakestapleton/workspace/oq3-v7-runs" run-qwen3-v7.sh && grep -q "status is not FROZEN" run-qwen3-v7.sh && grep -q "build pins are not frozen" run-qwen3-v7.sh' +chk "frozen-v7.json is a draft: status says DRAFT NOT FROZEN and every pin is the placeholder" \ + '[ "$(jq -r .status frozen-v7.json | cut -c1-16)" = "DRAFT NOT FROZEN" ] && [ "$(jq "[.pins[] | select(. == \$p)] | length" --arg p "$(jq -r .placeholder frozen-v7.json)" frozen-v7.json)" = 8 ]' +chk "a real v7 run is refused while frozen-v7.json is a draft" \ + 'out=$(OQ3_PART=1 AIEN_MODEL_PATH=x AIEN_TOKENIZER_PATH=y AIEN_BIN=z bash run-qwen3-v7.sh /home/drakestapleton/workspace/oq3-v7-runs-selftest-absent "$T/o" . . /bin/true /bin/true 2>&1); echo "$out" | grep -q "RUN_BASE must be"' +chk "OQ3_FROZEN outside a dry run is refused" 'out=$(OQ3_FROZEN=$HERE/frozen-v6.json OQ3_PART=1 bash run-qwen3-v7.sh a b c d e f 2>&1); echo "$out" | grep -q "allowed in a dry run only"' + +# ---- gate G6 on synthetic launches built from the declaration's own rows +mk() { # dir ; builds D1..D3 with every row PASS, S1..S8 ok, ALLEN engaged + local b=$1; mkdir -p "$b" + for L in D1 D2 D3; do mkdir -p "$b/$L" + jq -n '{steps: [range(1;9) | {step: ("S\(.)"), ok: true}], allen: {engaged_log_line: "ALLEN: engaged agent=ab head_sequence=2", fingerprint: "ab"}}' >"$b/$L/run.json" + done + jq -c '.rows[] | select(.row | test("^D[123]/")) | {row: .row, verdict: "PASS", rep: 1}' $DECL >"$b/res.jsonl" +} +mk "$T/g"; chk "G6 green: all rows PASS, ALLEN engaged" 'bash $G "$T/g/res.jsonl" $DECL "$T/g" D1 D2 D3 >"$T/o1"; [ $? = 0 ] && grep -q "G6 PASS" "$T/o1"' +mk "$T/a"; jq '(.steps[0].ok) = false | (.allen.engaged_log_line) = ""' "$T/a/D1/run.json" >"$T/a/x" && mv "$T/a/x" "$T/a/D1/run.json" +chk "G6 red (negative control, the v6 failure): S1 refused and no ALLEN line" 'bash $G "$T/a/res.jsonl" $DECL "$T/a" D1 D2 D3 >"$T/o2"; [ $? = 1 ] && grep -q "step S1 not ok" "$T/o2" && grep -q "ALLEN: engaged" "$T/o2"' +mk "$T/b"; sed -i 's|\("row":"D2/v1 Correctness: recall","verdict":"\)PASS|\1FAIL|' "$T/b/res.jsonl" +chk "G6 red: the recall row FAILs although the other four rows v6 checked pass" 'bash $G "$T/b/res.jsonl" $DECL "$T/b" D1 D2 D3 >"$T/o3"; [ $? = 1 ] && grep -q "D2 row .v1 Correctness: recall. = FAIL" "$T/o3"' +mk "$T/c"; grep -v '"row":"D3/D3-MEAS"' "$T/c/res.jsonl" >"$T/c/x" && mv "$T/c/x" "$T/c/res.jsonl" +chk "G6 red: a missing required row is a failure" 'bash $G "$T/c/res.jsonl" $DECL "$T/c" D1 D2 D3 >"$T/o4"; [ $? = 1 ] && grep -q "D3-MEAS. = missing" "$T/o4"' +mk "$T/d"; sed -i 's|\("row":"D1/D1-RQ1","verdict":"\)PASS|\1FAIL|; s|\("row":"D1/D1-CUT","verdict":"\)PASS|\1FAIL|' "$T/d/res.jsonl" +chk "G6 green: model-behaviour rows (RQ, CUT, F, SB) may FAIL" 'bash $G "$T/d/res.jsonl" $DECL "$T/d" D1 D2 D3 >"$T/o5"; [ $? = 0 ]' +mk "$T/e"; jq '(.steps[4].ok) = false' "$T/e/D2/run.json" >"$T/e/x" && mv "$T/e/x" "$T/e/D2/run.json" +sed -i 's|\("row":"D2/Q1","verdict":"\)PASS|\1FAIL|' "$T/e/res.jsonl" +chk "G6 green: a launch whose model reply was refused (S5 not ok) is checked on product rows only" 'bash $G "$T/e/res.jsonl" $DECL "$T/e" D1 D2 D3 >"$T/o6"; [ $? = 0 ] && grep -q "D2 committed=false" "$T/o6"' +mk "$T/f"; sed -i 's|\("row":"D1/D1-BE","verdict":"\)PASS|\1FAIL|' "$T/f/res.jsonl" +chk "G6 red: a product row (BE) FAILs" 'bash $G "$T/f/res.jsonl" $DECL "$T/f" D1 D2 D3 >"$T/o7"; [ $? = 1 ]' +echo "test-v7: $pass ok, $fail failed"; [ $fail = 0 ] From bcf05ec9a5e674aa1169ae45f855654cf9b5d52b Mon Sep 17 00:00:00 2001 From: aien Date: Sun, 11 Oct 2026 09:41:07 -0500 Subject: [PATCH 2/2] crumb compile (after rebase onto main) Co-authored-by: Drake Stapleton Co-Authored-By: Claude Fable 5.1 --- .crumb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.crumb b/.crumb index 09445d50..0e7e272d 100644 --- a/.crumb +++ b/.crumb @@ -65,7 +65,7 @@ "children": [ { "digest": "de59c21bf8b5819007225986edf7a75dbe93c1203686e619e72e17a6799fa127", - "last_commit": "b6f3b2b", + "last_commit": "8a05752", "name": "scripts", "purpose": "" }, @@ -77,14 +77,14 @@ } ], "children_root": "sha256:9b69c98f2b943ef9c4a3768e892e02b1856c6bd53647de0688f375e86e964ee1", - "compiled_at": "2026-10-11T14:27:50Z", + "compiled_at": "2026-10-11T14:41:07Z", "compiler": "crumb-compile/1", - "digest": "sha256:1ee1320f71b3b56f7fac480ea10b808ebef8b2e06137fe9d90eb3129bd5a3335", + "digest": "sha256:cc09b847d831c7066cdd2884c047a2e26392a86d712eacccfb6753040c971dad", "evidence_files": 187, "evidence_root": "sha256:27ee0353cb4d4aae2b7dbce2bfe0d9f4ef2a94cd7a4555b84684d59372503280", - "files": 3539, - "generated_at_commit": "9dd0992a4d82f92f469484c5718239831a8e9658", - "source_tree": "sha256:b8000dd062eb5d729a60d4d818e2640143dd36d5a7da0432141c4e0859af5109" + "files": 3555, + "generated_at_commit": "d242721708755066905617ac3e0fa06cd8d9634e", + "source_tree": "sha256:e75e3891e40d4c91ca772bcdcce8cf5fc995364ee0a176c52d19aae8d6d49f64" } }, "history": [],