diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000000000000000000000000000000000..eb25eaf90087c566e48462ded3b1cfcc2dfc3b70 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,63 @@ +*.7z filter=lfs diff=lfs merge=lfs -text +*.arrow filter=lfs diff=lfs merge=lfs -text +*.avro filter=lfs diff=lfs merge=lfs -text +*.bin filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.ckpt filter=lfs diff=lfs merge=lfs -text +*.ftz filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.h5 filter=lfs diff=lfs merge=lfs -text +*.joblib filter=lfs diff=lfs merge=lfs -text +*.lfs.* filter=lfs diff=lfs merge=lfs -text +*.lz4 filter=lfs diff=lfs merge=lfs -text +*.mds filter=lfs diff=lfs merge=lfs -text +*.mlmodel filter=lfs diff=lfs merge=lfs -text +*.model filter=lfs diff=lfs merge=lfs -text +*.msgpack filter=lfs diff=lfs merge=lfs -text +*.npy filter=lfs diff=lfs merge=lfs -text +*.npz filter=lfs diff=lfs merge=lfs -text +*.onnx filter=lfs diff=lfs merge=lfs -text +*.ot filter=lfs diff=lfs merge=lfs -text +*.parquet filter=lfs diff=lfs merge=lfs -text +*.pb filter=lfs diff=lfs merge=lfs -text +*.pickle filter=lfs diff=lfs merge=lfs -text +*.pkl filter=lfs diff=lfs merge=lfs -text +*.pt filter=lfs diff=lfs merge=lfs -text +*.pth filter=lfs diff=lfs merge=lfs -text +*.rar filter=lfs diff=lfs merge=lfs -text +*.safetensors filter=lfs diff=lfs merge=lfs -text +saved_model/**/* filter=lfs diff=lfs merge=lfs -text +*.tar.* filter=lfs diff=lfs merge=lfs -text +*.tar filter=lfs diff=lfs merge=lfs -text +*.tflite filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.wasm filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text +*tfevents* filter=lfs diff=lfs merge=lfs -text +# Audio files - uncompressed +*.pcm filter=lfs diff=lfs merge=lfs -text +*.sam filter=lfs diff=lfs merge=lfs -text +*.raw filter=lfs diff=lfs merge=lfs -text +# Audio files - compressed +*.aac filter=lfs diff=lfs merge=lfs -text +*.flac filter=lfs diff=lfs merge=lfs -text +*.mp3 filter=lfs diff=lfs merge=lfs -text +*.ogg filter=lfs diff=lfs merge=lfs -text +*.wav filter=lfs diff=lfs merge=lfs -text +# Image files - uncompressed +*.bmp filter=lfs diff=lfs merge=lfs -text +*.gif filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.tiff filter=lfs diff=lfs merge=lfs -text +# Image files - compressed +*.jpg filter=lfs diff=lfs merge=lfs -text +*.jpeg filter=lfs diff=lfs merge=lfs -text +*.webp filter=lfs diff=lfs merge=lfs -text +# Video files - compressed +*.mp4 filter=lfs diff=lfs merge=lfs -text +*.webm filter=lfs diff=lfs merge=lfs -text +sample/scorer/bin/sample_verifier-linux-amd64 filter=lfs diff=lfs merge=lfs -text +sample/scorer/bin/sample_verifier-macos-arm64 filter=lfs diff=lfs merge=lfs -text +sample/scorer/bin/sample_verifier-linux-arm64 filter=lfs diff=lfs merge=lfs -text diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000000000000000000000000000000000000..8a8364d9007df82ecb86e0c43058fb6199499b22 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,3 @@ +Evaluation only. This free sample is for evaluating the tasks. It grants no licence to train on them or pass them on. Licensed use: https://zerotrustphysics.com/offers/fast-start/ + +Protocol Company diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..68350c8642164b3360351fa045073c9257d61453 --- /dev/null +++ b/README.md @@ -0,0 +1,60 @@ +--- +pretty_name: "Zero-Trust Physics free sample: Orbital, Space and Atmospheric Entry" +license: other +license_name: evaluation-only +license_link: LICENSE.md +language: [en] +tags: [physics, rl-environment, rlvr, harbor, hud, mcp, evaluation, zero-trust-physics] +task_categories: [reinforcement-learning, question-answering] +size_categories: [n<1K] +viewer: true +configs: + - config_name: default + data_files: + - split: test + path: sample_tasks.jsonl +--- + +# Free sample: Orbital, Space and Atmospheric Entry + + +> **Protocol Company** · [zerotrustphysics.com](https://zerotrustphysics.com) · **Domain Packs for RL & SFT:** 30 withheld calibrated tasks + 100,000 sealed runs + offline `--network none` verifier, $9,500 per domain (all 5 domains self-serve, or $39,500 All-Five Bundle) — [free 5-task samples](https://huggingface.co/collections/zero-trust-physics/zero-trust-physics-6ad3b6ef5195b706ac6d041e) · [offers & custom builds](https://zerotrustphysics.com/offers/) · [WhatsApp +1 928-264-7883](https://wa.me/19282647883) · [kruze@zerotrustphysics.com](mailto:kruze@zerotrustphysics.com) + +Protocol Company · Zero-Trust Physics · release v0.15.3 · 13 November 2026 + +Five calibrated multi-step physics RLVR tasks scored by deterministic recomputation on the Zero-Trust Physics verifier; the reward is computed, never judged by a model. + +**Domain & slice coverage.** These 5 free evaluation tasks exercise Stardust atmospheric entry (`aerospace/capsule_stardust`), coupled Stardust entry-to-PICA ablative heat-shield recession (`capsule_stardust` -> `ablator_slab`), and 4-call selective recomputation forensics across 10 aerospace models (`satellite_lageos1`, `capsule_insight`, `momentum_jwst_srp`, `momentum_jwst_dihedral`, `los_jwst_fine_guide`, `crater_ryugu_sci`, `solar_system`, `plasma_sheath_ram_c2`): a budgeted search, a design to a limit, a two-model chained design, and two forensics audits. The full 30-task paid Domain Pack and 100,000-run SFT corpus include direct design, search, and coupled trajectory tasks across LAGEOS-1/2 precision orbit propagation, JWST fine-guidance pointing and momentum accumulation, Mars InSight entry, and Ryugu impact cratering. + +**Evaluation only.** This free sample is for evaluating the tasks. It grants no licence to train on them or pass them on. + +| Task (kind) | pass@1 (solved / n) | pass@8 | Mean graded | Cheat suite | +|---|---|---|---|---| +| `g2-budget-sd-airspeed-sink-e-t3` (budgeted search) | 62.5% (10 of 16) | 100% (n=16) | 0.722 | 0 of 16 above 0; honest 3 of 3 at 1 | +| `g2-chain-sd-slab-radius-halfchar-h-r7` (chained design) | 25% (2 of 8) | 100% (n=8) | 0.313 | 0 of 19 above 0; honest 3 of 3 at 1 | +| `g2-sd-slab-shallowest-char-load-v3` (design to a limit) | 37.5% (3 of 8) | 100% (n=8) | 0.375 | 0 of 19 above 0; honest 3 of 3 at 1 | +| `g2-forensics7-10` (forensics audit) | 37.5% (3 of 8) | 100% (n=8) | 0.911 | 0 of 10 above 0; honest 3 of 3 at 1 | +| `g2-forensics6-07` (forensics audit) | 56.25% (9 of 16) | 100% (n=16) | 0.945 | 0 of 10 above 0; honest 3 of 3 at 1 | + +Calibrated on a frontier model (tool variant, 8 or 16 attempts per task): sample `pass@1` spans 25%–62.5% (median 37.5%), with `pass@8` and continuous `graded` reward (scoring bracket or design tightness against task tolerance) reported beside binary `pass/fail`. Across all 5 tasks, 74 adversarial cheat attempts scored `0` above `0` and all 15 honest controls scored `1`. Per-task quality reports (HTML and JSON) are in `reports/`. + +**Attempting a task.** The Harbor, HUD, Inspect, and native MCP variants shipped in this free sample connect to https://mcp.zerotrustphysics.com/mcp (`Too many concurrent physics tasks.` triggers automatic retry in the bundled bridge). The public MCP preview endpoint serves 1 concurrent physics call per IP for interactive evaluation; parallel RL rollouts use the zero-dependency offline binary. + +**For rollouts at scale,** the paid Domain Pack ($9,500) ships a compiled offline rollout binary for Linux amd64, Linux arm64 and macOS arm64, so Harbor and HUD rollouts and grading run `--network none` with zero external dependencies and no rate limit. Keyed hosted HTTP is also available if you prefer. + +**Scoring.** `scorer/` scores offline: `bin/` holds a sample-only verifier (macOS arm64, Linux amd64, Linux arm64) that computes these 5 tasks' requests, each forensics row's request as written, and refuses everything else by name. It holds no signing key, and its answers matched the served engine byte for byte on all 721 calls compared. The 5-crate Rust physics and proof-verification engine source is public at https://github.com/johnkruze/zero-trust-physics-engine (tag `v0.15.2`); read-only source audit of the pack verifier build is available under NDA for qualified buyers (https://zerotrustphysics.com/offers/#licence). Harbor's own grader runs in the task image and reaches the address. + +**HUD.** `tasks/hud/tasks/` packages these tasks for HUD's Harbor adapter (`hud.integrations.harbor.adapt`). Verifier calls route through an HTTP logging sidecar while the agent's sandbox has no network, and the grader reads the call log from the sidecar's container so the call budget holds without a Harbor trajectory (an edited or missing log scores `0`). Validated on HUD adapter 0.6.21 (5/5 tasks) and local Docker runtime; reach out for assisted HUD cloud onboarding. + +| Folder | What it holds | +|---|---| +| `tasks/` | `harbor/`, `hud/`, `inspect/`, `mcp/`: the 5 tasks in each format. | +| `scorer/`, `harness/` | The scorer, cheat suite, sample verifier, bridge to the address, call-logging proxy. | +| `reference/`, `reports/`, `calibration/` | Reference answers with SHA-384 proofs; a quality report per task; `passk_summary.json` and `cheat_suite.jsonl`. | +| `VERIFY.md`, `verify_sample.sh`, `SHA384SUMS` | One command: every hash, the 5 references, the cheat suite. | + +**Commercial packs and licensing:** The paid Domain Pack ships 30 withheld tasks + 100,000 sealed runs + offline rollout and verifier binaries at **$9,500** (self-serve checkout or net-15 invoice; All-Five Bundle of 150 tasks + 500,000 runs at **$39,500**, crediting your first pack within 30 days): https://zerotrustphysics.com/offers/fast-start/. None of those withheld tasks is in this archive, and this sample verifier does not compute them. For custom or exclusive physics environments and Engine & Verifier licences, see https://zerotrustphysics.com/offers/. + +Protocol Company · zerotrustphysics.com + +**In this repository:** `sample_tasks.jsonl` powers the Dataset Viewer above; `sample/` is the archive unpacked, unchanged (run `sh sample/verify_sample.sh`); `archive/` holds the `.tar.gz` archive, the Raw Data `.zip`, and their SHA-384 files. All five Domain Packs ($9,500 per domain, or $39,500 All-Five Bundle), custom suites, and engine licensing: https://zerotrustphysics.com/offers/ diff --git a/archive/zero-trust-physics-sample-raw-data_orbital-space-atmospheric-entry_2026-11-13.zip b/archive/zero-trust-physics-sample-raw-data_orbital-space-atmospheric-entry_2026-11-13.zip new file mode 100644 index 0000000000000000000000000000000000000000..86146e476eea6a39a4b9178927ea7fd71dad2629 --- /dev/null +++ b/archive/zero-trust-physics-sample-raw-data_orbital-space-atmospheric-entry_2026-11-13.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e4576abbb37a80420522f09a1c56f9d15b9907f635206006ae0996a9cbcad0e +size 185907 diff --git a/archive/zero-trust-physics-sample-raw-data_orbital-space-atmospheric-entry_2026-11-13.zip.sha384 b/archive/zero-trust-physics-sample-raw-data_orbital-space-atmospheric-entry_2026-11-13.zip.sha384 new file mode 100644 index 0000000000000000000000000000000000000000..25b51ca7d7026d2a6f179f39f4412b0ad0943b02 --- /dev/null +++ b/archive/zero-trust-physics-sample-raw-data_orbital-space-atmospheric-entry_2026-11-13.zip.sha384 @@ -0,0 +1 @@ +5b895528f90620a163530362739d6373bc286c792356dba30fd36ede9d9f03b102b654b5d1a30f5d5e5506ccb470b9cc zero-trust-physics-sample-raw-data_orbital-space-atmospheric-entry_2026-11-13.zip diff --git a/archive/zero-trust-physics-sample_orbital-space-atmospheric-entry_2026-11-13.tar.gz b/archive/zero-trust-physics-sample_orbital-space-atmospheric-entry_2026-11-13.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..e0efd948c139b04305dbca9f0d361ceb3d8a44f8 --- /dev/null +++ b/archive/zero-trust-physics-sample_orbital-space-atmospheric-entry_2026-11-13.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e4fd27717d2a00a2f42d76816c9f18e6fa1f7794fc285de8bdd255131baee011 +size 17377092 diff --git a/archive/zero-trust-physics-sample_orbital-space-atmospheric-entry_2026-11-13.tar.gz.sha384 b/archive/zero-trust-physics-sample_orbital-space-atmospheric-entry_2026-11-13.tar.gz.sha384 new file mode 100644 index 0000000000000000000000000000000000000000..3ffaca48109e90bd66d184e57d2e048aa367a653 --- /dev/null +++ b/archive/zero-trust-physics-sample_orbital-space-atmospheric-entry_2026-11-13.tar.gz.sha384 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e58efd446ad146c065b6d20ad4941dca017d4e9b50c17ee703cfaf6794dc4a60 +size 174 diff --git a/sample/README.md b/sample/README.md new file mode 100644 index 0000000000000000000000000000000000000000..047a620d17f807c5735cbae6e7146d9da7a7d0b7 --- /dev/null +++ b/sample/README.md @@ -0,0 +1,38 @@ +# Free sample: Orbital, Space and Atmospheric Entry + +Protocol Company · Zero-Trust Physics · release v0.15.3 · 13 November 2026 + +Five calibrated multi-step physics RLVR tasks scored by deterministic recomputation on the Zero-Trust Physics verifier; the reward is computed, never judged by a model. + +**Domain & slice coverage.** These 5 free evaluation tasks exercise Stardust atmospheric entry (`aerospace/capsule_stardust`), coupled Stardust entry-to-PICA ablative heat-shield recession (`capsule_stardust` -> `ablator_slab`), and 4-call selective recomputation forensics across 10 aerospace models (`satellite_lageos1`, `capsule_insight`, `momentum_jwst_srp`, `momentum_jwst_dihedral`, `los_jwst_fine_guide`, `crater_ryugu_sci`, `solar_system`, `plasma_sheath_ram_c2`): a budgeted search, a design to a limit, a two-model chained design, and two forensics audits. The full 30-task paid Domain Pack and 100,000-run SFT corpus include direct design, search, and coupled trajectory tasks across LAGEOS-1/2 precision orbit propagation, JWST fine-guidance pointing and momentum accumulation, Mars InSight entry, and Ryugu impact cratering. + +**Evaluation only.** This free sample is for evaluating the tasks. It grants no licence to train on them or pass them on. + +| Task (kind) | pass@1 (solved / n) | pass@8 | Mean graded | Cheat suite | +|---|---|---|---|---| +| `g2-budget-sd-airspeed-sink-e-t3` (budgeted search) | 62.5% (10 of 16) | 100% (n=16) | 0.722 | 0 of 16 above 0; honest 3 of 3 at 1 | +| `g2-chain-sd-slab-radius-halfchar-h-r7` (chained design) | 25% (2 of 8) | 100% (n=8) | 0.313 | 0 of 19 above 0; honest 3 of 3 at 1 | +| `g2-sd-slab-shallowest-char-load-v3` (design to a limit) | 37.5% (3 of 8) | 100% (n=8) | 0.375 | 0 of 19 above 0; honest 3 of 3 at 1 | +| `g2-forensics7-10` (forensics audit) | 37.5% (3 of 8) | 100% (n=8) | 0.911 | 0 of 10 above 0; honest 3 of 3 at 1 | +| `g2-forensics6-07` (forensics audit) | 56.25% (9 of 16) | 100% (n=16) | 0.945 | 0 of 10 above 0; honest 3 of 3 at 1 | + +Calibrated on a frontier model (tool variant, 8 or 16 attempts per task): sample `pass@1` spans 25%–62.5% (median 37.5%), with `pass@8` and continuous `graded` reward (scoring bracket or design tightness against task tolerance) reported beside binary `pass/fail`. Across all 5 tasks, 74 adversarial cheat attempts scored `0` above `0` and all 15 honest controls scored `1`. Per-task quality reports (HTML and JSON) are in `reports/`. + +**Attempting a task.** The Harbor, HUD, Inspect, and native MCP variants shipped in this free sample connect to https://mcp.zerotrustphysics.com/mcp (`Too many concurrent physics tasks.` triggers automatic retry in the bundled bridge). The public MCP preview endpoint serves 1 concurrent physics call per IP for interactive evaluation; parallel RL rollouts use the zero-dependency offline binary. + +**For rollouts at scale,** the paid Domain Pack ($9,500) ships a compiled offline rollout binary for Linux amd64, Linux arm64 and macOS arm64, so Harbor and HUD rollouts and grading run `--network none` with zero external dependencies and no rate limit. Keyed hosted HTTP is also available if you prefer. + +**Scoring.** `scorer/` scores offline: `bin/` holds a sample-only verifier (macOS arm64, Linux amd64, Linux arm64) that computes these 5 tasks' requests, each forensics row's request as written, and refuses everything else by name. It holds no signing key, and its answers matched the served engine byte for byte on all 721 calls compared. The 5-crate Rust physics and proof-verification engine source is public at https://github.com/johnkruze/zero-trust-physics-engine (tag `v0.15.2`); read-only source audit of the pack verifier build is available under NDA for qualified buyers (https://zerotrustphysics.com/offers/#licence). Harbor's own grader runs in the task image and reaches the address. + +**HUD.** `tasks/hud/tasks/` packages these tasks for HUD's Harbor adapter (`hud.integrations.harbor.adapt`). Verifier calls route through an HTTP logging sidecar while the agent's sandbox has no network, and the grader reads the call log from the sidecar's container so the call budget holds without a Harbor trajectory (an edited or missing log scores `0`). Validated on HUD adapter 0.6.21 (5/5 tasks) and local Docker runtime; reach out for assisted HUD cloud onboarding. + +| Folder | What it holds | +|---|---| +| `tasks/` | `harbor/`, `hud/`, `inspect/`, `mcp/`: the 5 tasks in each format. | +| `scorer/`, `harness/` | The scorer, cheat suite, sample verifier, bridge to the address, call-logging proxy. | +| `reference/`, `reports/`, `calibration/` | Reference answers with SHA-384 proofs; a quality report per task; `passk_summary.json` and `cheat_suite.jsonl`. | +| `VERIFY.md`, `verify_sample.sh`, `SHA384SUMS` | One command: every hash, the 5 references, the cheat suite. | + +**Commercial packs and licensing:** The paid Domain Pack ships 30 withheld tasks + 100,000 sealed runs + offline rollout and verifier binaries at **$9,500** (self-serve checkout or net-15 invoice; All-Five Bundle of 150 tasks + 500,000 runs at **$39,500**, crediting your first pack within 30 days): https://zerotrustphysics.com/offers/fast-start/. None of those withheld tasks is in this archive, and this sample verifier does not compute them. For custom or exclusive physics environments and Engine & Verifier licences, see https://zerotrustphysics.com/offers/. + +Protocol Company · zerotrustphysics.com diff --git a/sample/SHA384SUMS b/sample/SHA384SUMS new file mode 100644 index 0000000000000000000000000000000000000000..df6cf953e8c88117935404123fb0a7205fa5d79f --- /dev/null +++ b/sample/SHA384SUMS @@ -0,0 +1,271 @@ +8e37d07da858e8113f38123db1a957f7c41d8e572853fadb2cde2d23f3ad0f7f41b47c31c7e9715395b91a6bdf3cab87 ./README.md +19afef626e7c6b470135cd1b0672a9723e6d42294a4751f5d96ed6f951eed1080dfc578d2fbc5c807e0066adb5b01bc5 ./VERIFY.md +91ea8958ad589422541f3d66f6006be7ddae2fae82e680595f618107533fa0ae3d61395986eacc07f26a74dbd788b887 ./calibration/cheat_suite.jsonl +01ca7c9b2688f1afeba422239ff8bd7b0fb1d53daf8f49e56c3fb67e28be6718bf6fa31d724dbc4f3ea9eeaec7bd44bb ./calibration/passk_summary.json +87779703ea62613cc92343c13c470bfb394ba1688426eb4809d4f0dbf264fec2e96ab604b9ca2e49580060b99097deb4 ./harness/mcp_log_proxy.py +35122bab846dc2c93e8ac8a9b9484517f0bee2e155e466f703c1128dc48c0ae4ccf15f79dc706c4e1199028cf6431002 ./reference/g2-budget-sd-airspeed-sink-e-t3.calls.jsonl +b794a7c4c6aff3084ac73cc8c2026c8c0d8557875f029233dc119c68a05b4897dc1e042f434fe87b1d35e7463d64f1f4 ./reference/g2-budget-sd-airspeed-sink-e-t3.harness.jsonl +a112840ecd9ceac649279ced5db93926ef78c3b40bed2031d7cbb5abe5dabc8bb9ca1fe48859f9c5282099be01c55d6c ./reference/g2-budget-sd-airspeed-sink-e-t3.harness.jsonl.status.json +b77d1dea41a76e0621de534a9f4fc8c5d7692b17b6bc7b18b4af7293eeea8b4b7bae25d310ad40bf580ae8022c15605c ./reference/g2-budget-sd-airspeed-sink-e-t3.txt +ffd43a24cd6f305599052c3955e0640f606a1eac4d2a86060f432df8b584c21fe9a3cab565318888ace30148d433adcb ./reference/g2-chain-sd-slab-radius-halfchar-h-r7.calls.jsonl +92bad41c09dc923a8aba68deb9f875b1fa86be5012bbe0b61e635dc6e068c2defaa75cbbf747d26833a502b27d541960 ./reference/g2-chain-sd-slab-radius-halfchar-h-r7.harness.jsonl +cd3b08c93c8486383b745cc65565852ea250a81468407fc94a116ad1f218e45929e35cfc53f8dd71cdd8d56692eeab06 ./reference/g2-chain-sd-slab-radius-halfchar-h-r7.harness.jsonl.status.json +33f19562b5ade8f9b0cb3e6d17317b600a762c4b9478d425b5bae9cb57eeab8ee4a4ace9024466847039b074d16d709a ./reference/g2-chain-sd-slab-radius-halfchar-h-r7.txt +f648ab5642abfffe2e5daf94d250b285fac8a6c2e5f96655020e656adb562c75cc545b74ee89fd84a710f01240d17dee ./reference/g2-forensics6-07.calls.jsonl +ee762396fbcfefa8d90793e11d37e603f412592ab17c76b360a3397169f529310e2f7cc7e25e140eed374abe0fc824da ./reference/g2-forensics6-07.harness.jsonl +b2e6036f4b344f33398560525bebd125a96ef8fc6acc0d0d666af80019d28e7fc054ae0018e1a26daa55078b23a24687 ./reference/g2-forensics6-07.harness.jsonl.status.json +8077d07b145d53824fa9a09a6820b8c0bb6d14dbabdae01f534f32a0007cb0787a0ec27027d886615a95e3fe841bad1a ./reference/g2-forensics6-07.txt +b3286fd7ad54bad80755b67b2e809c7dda841922fdcd86d5587aa0ccb8a93961e57b8951cd1138188f042833d120e753 ./reference/g2-forensics7-10.calls.jsonl +822f4fdb8778a38004a4bfc4f021248f289fc688107251e767af9628c99ed015fb321c68e00e49f71997b89f270b13d0 ./reference/g2-forensics7-10.harness.jsonl +7913bd94c9a63a70f861ff27256773b3273c1606edd06526a359ab68328291f9009c62dc6971bc42e038d79ea240c180 ./reference/g2-forensics7-10.harness.jsonl.status.json +62632386790603937c67a737b0714b120b127859ae77aa81e3d7480a4a76579fb959ff9d13c8e1c5a3d41d4c537a96a2 ./reference/g2-forensics7-10.txt +e6dbdc06226bf402a9fb47e5d0fa430b75b71d06e19292b45fa830b35143c1ead26f8cb0fbe984535a078fabaf147f79 ./reference/g2-sd-slab-shallowest-char-load-v3.calls.jsonl +7bf7c1d0a68f4f913f01105540be6f6e6844dcd02be772175ecf7ebc033128694e3f0b82b0006f6a8631fc694e968581 ./reference/g2-sd-slab-shallowest-char-load-v3.harness.jsonl +be743d1b55edaa6a06a9b81bd8da8efe0d169c6e8faeb951ec9c32a4706dfb260e4b8d4dd3f03fabb2f771a667644df7 ./reference/g2-sd-slab-shallowest-char-load-v3.harness.jsonl.status.json +64f9bf79eefc22f61256b02d0fefa8a312ecf35b238f1b521f5886f786a5e97f44765ed988651cdb18fb8a1041c3466c ./reference/g2-sd-slab-shallowest-char-load-v3.txt +dc6f414f56f9ba5316fa7aacdc517ff24ead2e7acc5a42b0b6ac2aca310bb2c04e40b4d8d5c08ef377faef3063041d2c ./reference/naive_scores.jsonl +cc0c41af23284d9a897ba644314d83b2ebe7793d04f5dcab635f55e229ecc1389f34c32438e5b88e93f71af91fba9165 ./reference/reference_scores.jsonl +300d50aa47681b1b2cf37a082087895c04bc8f6de0cf893a48c92e4560e93b63b3cf827b685ba5a205e915d2c9b68467 ./reports/describe_short.json +b520f5c3e0e532f73f03c858a5cb8cbb9a88a625a086400a1eafabb0d6bbbb1cca14f0b3029008228cd8211f447235db ./reports/g2-budget-sd-airspeed-sink-e-t3.html +dc4070aa8812f244ee6b3c7ad45698c9db25102feeac19da224d03d5a4ff9f1d923d03b4cdf9f371d1db1beb26d26706 ./reports/g2-budget-sd-airspeed-sink-e-t3.json +2f354c4cf55186d3ce18134453cc96ba9080b9637a458afd826e447e23ea6d5b53591eb2799568d4d8199f8931c3e83c ./reports/g2-chain-sd-slab-radius-halfchar-h-r7.html +bcbc5375d381a97b23b835e40eca69b62e209457a5352c75fae223e2627df4a834360157b2cde81e44396efb2249b99a ./reports/g2-chain-sd-slab-radius-halfchar-h-r7.json +470c5333ba8e4951a5552491d15855cbcf16c62bd32f8666d4737c47657dc63c6a8ff6351364889d1f2ec2c161a61127 ./reports/g2-forensics6-07.html +ce221b212e4f3eca803e5575098522e56fdbbc7750ed057ba0a8b3bbda60766063080d97d3f638be5eece493e13a3b53 ./reports/g2-forensics6-07.json +fb9f517a7ed3d18b99c6c9c6fc2b661f71a8323db8236413ac5af4c3f20bb581b22a0a1e178d45296a0f0ca0adc1e6e9 ./reports/g2-forensics7-10.html +0922d0c82501ad7646aede425056faf0f47bfedf7410b01bc3d90f9f1f713dc2817defa6128101224ade8301a5659e06 ./reports/g2-forensics7-10.json +f70770bf52410ecade41c77b1789bce4e671bde434885fe30e404e521c8b782b12efb3caa55c7b311cb7caf353560e93 ./reports/g2-sd-slab-shallowest-char-load-v3.html +a5ffb5ce55948e9dc73c1569f7e3ee40c3fc15140d9988eb81f26ff6276ede17e55c87826306f60fb8a7475e73b196c8 ./reports/g2-sd-slab-shallowest-char-load-v3.json +3b355ad522b23ec8610d350abeaa666f5d99d6c35b5a5f4f20df4f3963265f05e26caed876d74ba997dcdedccf061a32 ./reports/index.html +e5075b535d0a1871dffae73a6996bee12b83886058f82e058d7934a7ba911378bcc33234e3ac8d9e95573a066ddf73d8 ./reports/live_scores.jsonl +7174523593ce4af05a777e3f0c892aa1ed7bd65f020bf2020d4b136be4fda153dadf5b66f404b4994dee834ed1f03f35 ./reports/live_verify.json +25323defa40118c1a14b65d829bc72782aa2eab5c00be523ac5adb566499d09e8c13bc5adcd148b9b0ddca68f97868f3 ./reports/vault_proof.json +c8e603ae0f3c649548463c0b80dd2c1c635874aba8e01b1cdf232bafd3e52a9efc5d59c2f15f7b9552e77f4ea437f9db ./scorer/bin/sample_verifier-linux-amd64 +bd45c4d450d9817f3f31ab357db96513cf7416d2ebe20697620906d572fc87b10e2fcf9e3af292b58f00e18dbbe9013d ./scorer/bin/sample_verifier-linux-arm64 +a53e8e9b7f75f5e6e4235c7161b6dfb8f50fb9887cecae7a8f79091caaa73e2b395bf88e4075e37e07312a5e18bece61 ./scorer/bin/sample_verifier-macos-arm64 +4ab72c5978af483ef7a99096b99e9c20ecd746152f3bfcfdb0fe24e6c61b2463830d4c28f046472f7be308a367f8f858 ./scorer/chainlib.py +d1f77949323f5949284df29fbe48ec93769bb250a1860a2226b761d9d4261ce8ca48055e6d14a32894ad91aa3488192f ./scorer/data/environments.jsonl +43b1a273c707ac8caf35150050f238808d261e4f670ddcaaafff88668ccb07bce052605cb1ec7b8556eaaac05f88dfb2 ./scorer/mcp_stdio_open +88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./scorer/pack_score.py +d851c6838b15bcb7c96c4d1d75b6c59a905e9a3ee54b393a8f098ff768ae04fd2976cb7b00f949eb068b329392141bbb ./scorer/prompt.py +f6fa72af84d02c0c72cd6866eb2c0fab9875fb8d5be40f1b74aca9066e58ab5fcc252943876ed5d3e7a69cd47606ebf1 ./scorer/run_cheat_suite.py +4af2040470af799b1a4f3d4711207bb872b7bcd52323a7d28386f702fdc0142411ee5c1275775166a563362786f4d5ef ./scorer/run_naive.py +a960c3d64cd1ba7bf9decc16fef45e2779b9fe5001ed15720ed9cdce7d8164a959b5fef3f77924f051fca12441f82235 ./scorer/run_reference.py +ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./scorer/score.py +9a47759ee9a5c328bdf04e8dc282ac08ab90b80425ad0a42dda63f593156424ff692c86f674cff9d514d77f83c69ddca ./scorer/ztp_mcp.py +e11035d5609e035ef936f6cdf7fc065ddf4d8538fb6e15c18262f62609aff52ada6690bbfb0a4327ab77b3857db87204 ./scorer/ztp_open_bridge.py +6eb71484c336cfd5fad20ab606fefe4216ddcfcc9f460e53d80d313f54e39f68ffbfbb300873782fa6b4a9014970c1b7 ./tasks/harbor/hud_taskset.json +dfb634719362496c99bba8aa303f1d623101c9105c5883a6f610f42a109a8f842c5d4415ccff6509aaa38f2044d9f2f7 ./tasks/harbor/registry.json +ae993e17362d54fd5beab5f16fc6c99966793e6cfeeefd219dc1541cf5892d9b523c3ead1158e0de6da5137033e47055 ./tasks/harbor/task_checksums.json +a8011d170362155b329f1cab5531a2c96f8c0b7b0c897ae2215caa02d7c48c9b70b6348765ca20e6b6bed582a68af3d7 ./tasks/harbor/task_checksums.sha256 +a9b1bee8c075af4cf3afab7c6c311a9cff070e9897dee5e77112bc3ad7be7bfb193f99d414c9c17ae839b36f16930d2d ./tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/environment/Dockerfile +e11035d5609e035ef936f6cdf7fc065ddf4d8538fb6e15c18262f62609aff52ada6690bbfb0a4327ab77b3857db87204 ./tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/environment/ztp_open_bridge.py +88121ee4b96c575cdc26edd582c1d9d7797a30a5f7c6babc119d143a8ced02aeba7227e9b041ef1c759fa8b169c9924f ./tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/instruction.md +4ab72c5978af483ef7a99096b99e9c20ecd746152f3bfcfdb0fe24e6c61b2463830d4c28f046472f7be308a367f8f858 ./tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/solution/chainlib.py +1cc7d813d47f9342b8be64df2cf4ccb61ddc6eb1c9a736b63a7a22c68871d0ab0e133951b6e1a5197f9653b59e435591 ./tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/solution/data/environments.jsonl +a960c3d64cd1ba7bf9decc16fef45e2779b9fe5001ed15720ed9cdce7d8164a959b5fef3f77924f051fca12441f82235 ./tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/solution/run_reference.py +ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/solution/score.py +e88d0861f12a7c032719d720796a4277892a3d5446474497981b52bf92f4b8ac95f34abe656c156d3f51f13612cd232e ./tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/solution/solve.sh +9a47759ee9a5c328bdf04e8dc282ac08ab90b80425ad0a42dda63f593156424ff692c86f674cff9d514d77f83c69ddca ./tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/solution/ztp_mcp.py +b71a2bc2a8175600b507007fb9a790435e57e3cb6788a812c5db3ca7a8872f922d6f4a18567604a61e33d8c117c1c38a ./tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/task.toml +aeee8a15465596e5ed0546d523dbc0256ff974416af44ddbfdce004f9ac1ed88e9683b707a30ca0c660a6bafec541fb9 ./tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/Dockerfile +1cc7d813d47f9342b8be64df2cf4ccb61ddc6eb1c9a736b63a7a22c68871d0ab0e133951b6e1a5197f9653b59e435591 ./tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/environment.jsonl +b42707c4c2044e7f66439f20a446dabe48bbbc75e4392f320230ed2743129f680f3d469c7a18ba295453f78c1fa7c85d ./tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/grade.py +88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/pack_score.py +ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/score.py +4dd13c251fda485f3e112a6d32563cb72dfa1acfdb47f501ff475eb950ee0a7f9108ed987607210a6855154cf59671fc ./tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/test.sh +9a47759ee9a5c328bdf04e8dc282ac08ab90b80425ad0a42dda63f593156424ff692c86f674cff9d514d77f83c69ddca ./tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/ztp_mcp.py +e11035d5609e035ef936f6cdf7fc065ddf4d8538fb6e15c18262f62609aff52ada6690bbfb0a4327ab77b3857db87204 ./tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/ztp_open_bridge.py +a9b1bee8c075af4cf3afab7c6c311a9cff070e9897dee5e77112bc3ad7be7bfb193f99d414c9c17ae839b36f16930d2d ./tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/environment/Dockerfile +e11035d5609e035ef936f6cdf7fc065ddf4d8538fb6e15c18262f62609aff52ada6690bbfb0a4327ab77b3857db87204 ./tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/environment/ztp_open_bridge.py +e1d5a9d2e96a912398b48d49fb630f2a12a59c8e753d46435466f1895ae6335c4073ee2ee9e538f7dda0441a4f4c08ec ./tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/instruction.md +4ab72c5978af483ef7a99096b99e9c20ecd746152f3bfcfdb0fe24e6c61b2463830d4c28f046472f7be308a367f8f858 ./tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/solution/chainlib.py +2488ad31e36643bd924a5e14bea9e9f1854355cd45b481941c6a225ccd1b24047a33ce5fde6e180792c387af50988db6 ./tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/solution/data/environments.jsonl +a960c3d64cd1ba7bf9decc16fef45e2779b9fe5001ed15720ed9cdce7d8164a959b5fef3f77924f051fca12441f82235 ./tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/solution/run_reference.py +ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/solution/score.py +e88d0861f12a7c032719d720796a4277892a3d5446474497981b52bf92f4b8ac95f34abe656c156d3f51f13612cd232e ./tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/solution/solve.sh +9a47759ee9a5c328bdf04e8dc282ac08ab90b80425ad0a42dda63f593156424ff692c86f674cff9d514d77f83c69ddca ./tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/solution/ztp_mcp.py +6e90cc80e3500f28dfca351c4ac8e2e129e324f0d9d6f5b5b2becf2e450ee9b123626bb8ce4e5c4d815f182a1c45f968 ./tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/task.toml +aeee8a15465596e5ed0546d523dbc0256ff974416af44ddbfdce004f9ac1ed88e9683b707a30ca0c660a6bafec541fb9 ./tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/Dockerfile +2488ad31e36643bd924a5e14bea9e9f1854355cd45b481941c6a225ccd1b24047a33ce5fde6e180792c387af50988db6 ./tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/environment.jsonl +b42707c4c2044e7f66439f20a446dabe48bbbc75e4392f320230ed2743129f680f3d469c7a18ba295453f78c1fa7c85d ./tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/grade.py +88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/pack_score.py +ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/score.py +4dd13c251fda485f3e112a6d32563cb72dfa1acfdb47f501ff475eb950ee0a7f9108ed987607210a6855154cf59671fc ./tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/test.sh +9a47759ee9a5c328bdf04e8dc282ac08ab90b80425ad0a42dda63f593156424ff692c86f674cff9d514d77f83c69ddca ./tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/ztp_mcp.py +e11035d5609e035ef936f6cdf7fc065ddf4d8538fb6e15c18262f62609aff52ada6690bbfb0a4327ab77b3857db87204 ./tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/ztp_open_bridge.py +a9b1bee8c075af4cf3afab7c6c311a9cff070e9897dee5e77112bc3ad7be7bfb193f99d414c9c17ae839b36f16930d2d ./tasks/harbor/tasks/g2-forensics6-07/environment/Dockerfile +e11035d5609e035ef936f6cdf7fc065ddf4d8538fb6e15c18262f62609aff52ada6690bbfb0a4327ab77b3857db87204 ./tasks/harbor/tasks/g2-forensics6-07/environment/ztp_open_bridge.py +a295deecdfac18c6078961af138782d982d8cc24bc7f491fe406ad18950e03d7e8eab66af8cfd56cc8d6c0affef8cf75 ./tasks/harbor/tasks/g2-forensics6-07/instruction.md +4ab72c5978af483ef7a99096b99e9c20ecd746152f3bfcfdb0fe24e6c61b2463830d4c28f046472f7be308a367f8f858 ./tasks/harbor/tasks/g2-forensics6-07/solution/chainlib.py +3a6735a84fd21f2b1813b4a24a02af8f5792d97b39f2093d6038bd51385b617378ba3f600569b2b7a58cdd63697f1a92 ./tasks/harbor/tasks/g2-forensics6-07/solution/data/environments.jsonl +a960c3d64cd1ba7bf9decc16fef45e2779b9fe5001ed15720ed9cdce7d8164a959b5fef3f77924f051fca12441f82235 ./tasks/harbor/tasks/g2-forensics6-07/solution/run_reference.py +ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/harbor/tasks/g2-forensics6-07/solution/score.py +e88d0861f12a7c032719d720796a4277892a3d5446474497981b52bf92f4b8ac95f34abe656c156d3f51f13612cd232e ./tasks/harbor/tasks/g2-forensics6-07/solution/solve.sh +9a47759ee9a5c328bdf04e8dc282ac08ab90b80425ad0a42dda63f593156424ff692c86f674cff9d514d77f83c69ddca ./tasks/harbor/tasks/g2-forensics6-07/solution/ztp_mcp.py +2aeb53dd8d3a5ee33c30fcb5aaffc3b4e70f0fcdc18247f49010ac437a7e445e01dd55aac1207c8bca1ad982b362ab32 ./tasks/harbor/tasks/g2-forensics6-07/task.toml +aeee8a15465596e5ed0546d523dbc0256ff974416af44ddbfdce004f9ac1ed88e9683b707a30ca0c660a6bafec541fb9 ./tasks/harbor/tasks/g2-forensics6-07/tests/Dockerfile +3a6735a84fd21f2b1813b4a24a02af8f5792d97b39f2093d6038bd51385b617378ba3f600569b2b7a58cdd63697f1a92 ./tasks/harbor/tasks/g2-forensics6-07/tests/environment.jsonl +b42707c4c2044e7f66439f20a446dabe48bbbc75e4392f320230ed2743129f680f3d469c7a18ba295453f78c1fa7c85d ./tasks/harbor/tasks/g2-forensics6-07/tests/grade.py +88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/harbor/tasks/g2-forensics6-07/tests/pack_score.py +ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/harbor/tasks/g2-forensics6-07/tests/score.py +4dd13c251fda485f3e112a6d32563cb72dfa1acfdb47f501ff475eb950ee0a7f9108ed987607210a6855154cf59671fc ./tasks/harbor/tasks/g2-forensics6-07/tests/test.sh +9a47759ee9a5c328bdf04e8dc282ac08ab90b80425ad0a42dda63f593156424ff692c86f674cff9d514d77f83c69ddca ./tasks/harbor/tasks/g2-forensics6-07/tests/ztp_mcp.py +e11035d5609e035ef936f6cdf7fc065ddf4d8538fb6e15c18262f62609aff52ada6690bbfb0a4327ab77b3857db87204 ./tasks/harbor/tasks/g2-forensics6-07/tests/ztp_open_bridge.py +a9b1bee8c075af4cf3afab7c6c311a9cff070e9897dee5e77112bc3ad7be7bfb193f99d414c9c17ae839b36f16930d2d ./tasks/harbor/tasks/g2-forensics7-10/environment/Dockerfile +e11035d5609e035ef936f6cdf7fc065ddf4d8538fb6e15c18262f62609aff52ada6690bbfb0a4327ab77b3857db87204 ./tasks/harbor/tasks/g2-forensics7-10/environment/ztp_open_bridge.py +e234de9fdb5eaefdab8d4ec2552be5f2d31c54f2703f3723d64d20324bbc8b56ecb2cf8fd6be3c23fa843e6a5316e1a7 ./tasks/harbor/tasks/g2-forensics7-10/instruction.md +4ab72c5978af483ef7a99096b99e9c20ecd746152f3bfcfdb0fe24e6c61b2463830d4c28f046472f7be308a367f8f858 ./tasks/harbor/tasks/g2-forensics7-10/solution/chainlib.py +d47680d36635b2f12f00ac7ae768ab9f4e5086d807a54f5791731235c059b28777e2d4fb565024981803ab9b6e431d47 ./tasks/harbor/tasks/g2-forensics7-10/solution/data/environments.jsonl +a960c3d64cd1ba7bf9decc16fef45e2779b9fe5001ed15720ed9cdce7d8164a959b5fef3f77924f051fca12441f82235 ./tasks/harbor/tasks/g2-forensics7-10/solution/run_reference.py +ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/harbor/tasks/g2-forensics7-10/solution/score.py +e88d0861f12a7c032719d720796a4277892a3d5446474497981b52bf92f4b8ac95f34abe656c156d3f51f13612cd232e ./tasks/harbor/tasks/g2-forensics7-10/solution/solve.sh +9a47759ee9a5c328bdf04e8dc282ac08ab90b80425ad0a42dda63f593156424ff692c86f674cff9d514d77f83c69ddca ./tasks/harbor/tasks/g2-forensics7-10/solution/ztp_mcp.py +8996e0e454870ed8a247de5e790db6703a708024eac43b808c71be6e7c7ad16cff37a2558dafed80289e56552595d796 ./tasks/harbor/tasks/g2-forensics7-10/task.toml +aeee8a15465596e5ed0546d523dbc0256ff974416af44ddbfdce004f9ac1ed88e9683b707a30ca0c660a6bafec541fb9 ./tasks/harbor/tasks/g2-forensics7-10/tests/Dockerfile +d47680d36635b2f12f00ac7ae768ab9f4e5086d807a54f5791731235c059b28777e2d4fb565024981803ab9b6e431d47 ./tasks/harbor/tasks/g2-forensics7-10/tests/environment.jsonl +b42707c4c2044e7f66439f20a446dabe48bbbc75e4392f320230ed2743129f680f3d469c7a18ba295453f78c1fa7c85d ./tasks/harbor/tasks/g2-forensics7-10/tests/grade.py +88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/harbor/tasks/g2-forensics7-10/tests/pack_score.py +ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/harbor/tasks/g2-forensics7-10/tests/score.py +4dd13c251fda485f3e112a6d32563cb72dfa1acfdb47f501ff475eb950ee0a7f9108ed987607210a6855154cf59671fc ./tasks/harbor/tasks/g2-forensics7-10/tests/test.sh +9a47759ee9a5c328bdf04e8dc282ac08ab90b80425ad0a42dda63f593156424ff692c86f674cff9d514d77f83c69ddca ./tasks/harbor/tasks/g2-forensics7-10/tests/ztp_mcp.py +e11035d5609e035ef936f6cdf7fc065ddf4d8538fb6e15c18262f62609aff52ada6690bbfb0a4327ab77b3857db87204 ./tasks/harbor/tasks/g2-forensics7-10/tests/ztp_open_bridge.py +a9b1bee8c075af4cf3afab7c6c311a9cff070e9897dee5e77112bc3ad7be7bfb193f99d414c9c17ae839b36f16930d2d ./tasks/harbor/tasks/g2-sd-slab-shallowest-char-load-v3/environment/Dockerfile +e11035d5609e035ef936f6cdf7fc065ddf4d8538fb6e15c18262f62609aff52ada6690bbfb0a4327ab77b3857db87204 ./tasks/harbor/tasks/g2-sd-slab-shallowest-char-load-v3/environment/ztp_open_bridge.py +739a0e2f4358d92c720f8743c16e22b67bc053a2a82d3d901a132328a220192ff29236c380f92ecab06b9bc614580b34 ./tasks/harbor/tasks/g2-sd-slab-shallowest-char-load-v3/instruction.md +4ab72c5978af483ef7a99096b99e9c20ecd746152f3bfcfdb0fe24e6c61b2463830d4c28f046472f7be308a367f8f858 ./tasks/harbor/tasks/g2-sd-slab-shallowest-char-load-v3/solution/chainlib.py +3eb8e40718a8e028ccfcb1e2dd90812c8a161247bdc8b5e16b7d8934d35c00636edcd3d1c0be62747b2ffddb02517937 ./tasks/harbor/tasks/g2-sd-slab-shallowest-char-load-v3/solution/data/environments.jsonl +a960c3d64cd1ba7bf9decc16fef45e2779b9fe5001ed15720ed9cdce7d8164a959b5fef3f77924f051fca12441f82235 ./tasks/harbor/tasks/g2-sd-slab-shallowest-char-load-v3/solution/run_reference.py +ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/harbor/tasks/g2-sd-slab-shallowest-char-load-v3/solution/score.py +e88d0861f12a7c032719d720796a4277892a3d5446474497981b52bf92f4b8ac95f34abe656c156d3f51f13612cd232e ./tasks/harbor/tasks/g2-sd-slab-shallowest-char-load-v3/solution/solve.sh +9a47759ee9a5c328bdf04e8dc282ac08ab90b80425ad0a42dda63f593156424ff692c86f674cff9d514d77f83c69ddca ./tasks/harbor/tasks/g2-sd-slab-shallowest-char-load-v3/solution/ztp_mcp.py +c3747863b7ecfabb5d70d50a504a55bba0f65e31793a9b3d9576f3bc4a10f515580902a43addbcc6635b54d9e2a485af ./tasks/harbor/tasks/g2-sd-slab-shallowest-char-load-v3/task.toml +aeee8a15465596e5ed0546d523dbc0256ff974416af44ddbfdce004f9ac1ed88e9683b707a30ca0c660a6bafec541fb9 ./tasks/harbor/tasks/g2-sd-slab-shallowest-char-load-v3/tests/Dockerfile +3eb8e40718a8e028ccfcb1e2dd90812c8a161247bdc8b5e16b7d8934d35c00636edcd3d1c0be62747b2ffddb02517937 ./tasks/harbor/tasks/g2-sd-slab-shallowest-char-load-v3/tests/environment.jsonl +b42707c4c2044e7f66439f20a446dabe48bbbc75e4392f320230ed2743129f680f3d469c7a18ba295453f78c1fa7c85d ./tasks/harbor/tasks/g2-sd-slab-shallowest-char-load-v3/tests/grade.py +88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/harbor/tasks/g2-sd-slab-shallowest-char-load-v3/tests/pack_score.py +ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/harbor/tasks/g2-sd-slab-shallowest-char-load-v3/tests/score.py +4dd13c251fda485f3e112a6d32563cb72dfa1acfdb47f501ff475eb950ee0a7f9108ed987607210a6855154cf59671fc ./tasks/harbor/tasks/g2-sd-slab-shallowest-char-load-v3/tests/test.sh +9a47759ee9a5c328bdf04e8dc282ac08ab90b80425ad0a42dda63f593156424ff692c86f674cff9d514d77f83c69ddca ./tasks/harbor/tasks/g2-sd-slab-shallowest-char-load-v3/tests/ztp_mcp.py +e11035d5609e035ef936f6cdf7fc065ddf4d8538fb6e15c18262f62609aff52ada6690bbfb0a4327ab77b3857db87204 ./tasks/harbor/tasks/g2-sd-slab-shallowest-char-load-v3/tests/ztp_open_bridge.py +236b5c4bb6d6f42e6b0a2c9713ee0a026f76152d7b1411370fa8891f54a6b9aa1d08a1d9fb84e9ceadef1af355c3954a ./tasks/hud/set_door.py +41ef49b553e3771932cb32bcb9a6b912b3524c0eac4c04204e36f7944b733d3b8d1657d87baaf0ebf5cf3f2e29f31389 ./tasks/hud/task_checksums.json +610493a1947f6d178c4813d64563bb07e8c287080e632874b166a76f012117e477dc5883ad81e6eacec3557c4503cd35 ./tasks/hud/tasks/g2-budget-sd-airspeed-sink-e-t3/environment/Dockerfile +d42fd88de86f99abaa11b94e4ff96e6454e86184018a17a9f7241a822ee94ffd5230f5a2f3f3a276994a773fa55794f9 ./tasks/hud/tasks/g2-budget-sd-airspeed-sink-e-t3/environment/docker-compose.yaml +5828695fdb24c01062ce07464e5ea65f3f723131f4dcda51deee2e8235ef02fc890b5810ab347faa82da25d16714619b ./tasks/hud/tasks/g2-budget-sd-airspeed-sink-e-t3/environment/proxy/Dockerfile +827ab325681d02d5d6ad0664b0cd51c179bc561989e498d670899118e1004c50a66cd611077728336c36c266b4b0b6de ./tasks/hud/tasks/g2-budget-sd-airspeed-sink-e-t3/environment/proxy/ztp_log_proxy.py +e11035d5609e035ef936f6cdf7fc065ddf4d8538fb6e15c18262f62609aff52ada6690bbfb0a4327ab77b3857db87204 ./tasks/hud/tasks/g2-budget-sd-airspeed-sink-e-t3/environment/proxy/ztp_open_bridge.py +88121ee4b96c575cdc26edd582c1d9d7797a30a5f7c6babc119d143a8ced02aeba7227e9b041ef1c759fa8b169c9924f ./tasks/hud/tasks/g2-budget-sd-airspeed-sink-e-t3/instruction.md +7d889f3d3519cec858845cab3c7a91671956c4224842206f9819868afe6c6af7bb7c060c0eada7f11845b224961a1588 ./tasks/hud/tasks/g2-budget-sd-airspeed-sink-e-t3/task.toml +d45b1a85de19f0ee33c099aae0057245e8f8a3e89d9c4b16e1b149683b0afe33ae0f6e5bd85ba4f2b750d8cbfb06b90e ./tasks/hud/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/Dockerfile +1cc7d813d47f9342b8be64df2cf4ccb61ddc6eb1c9a736b63a7a22c68871d0ab0e133951b6e1a5197f9653b59e435591 ./tasks/hud/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/environment.jsonl +b42707c4c2044e7f66439f20a446dabe48bbbc75e4392f320230ed2743129f680f3d469c7a18ba295453f78c1fa7c85d ./tasks/hud/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/grade.py +37cf818d736fb6c2c071a0398fea1ff1d48598e7032b36ab6fac7cd6d732f714430b671ecf65cbba00344f6db3dc20a4 ./tasks/hud/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/hud_grade.py +88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/hud/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/pack_score.py +ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/hud/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/score.py +cd2ecdac7e3ca0cc456221b05dd86c656974d5894104a7480882386d46343d274b6eae4e5cdfcaf3420512b315fb206d ./tasks/hud/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/test.sh +9a47759ee9a5c328bdf04e8dc282ac08ab90b80425ad0a42dda63f593156424ff692c86f674cff9d514d77f83c69ddca ./tasks/hud/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/ztp_mcp.py +e11035d5609e035ef936f6cdf7fc065ddf4d8538fb6e15c18262f62609aff52ada6690bbfb0a4327ab77b3857db87204 ./tasks/hud/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/ztp_open_bridge.py +610493a1947f6d178c4813d64563bb07e8c287080e632874b166a76f012117e477dc5883ad81e6eacec3557c4503cd35 ./tasks/hud/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/environment/Dockerfile +d42fd88de86f99abaa11b94e4ff96e6454e86184018a17a9f7241a822ee94ffd5230f5a2f3f3a276994a773fa55794f9 ./tasks/hud/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/environment/docker-compose.yaml +5828695fdb24c01062ce07464e5ea65f3f723131f4dcda51deee2e8235ef02fc890b5810ab347faa82da25d16714619b ./tasks/hud/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/environment/proxy/Dockerfile +827ab325681d02d5d6ad0664b0cd51c179bc561989e498d670899118e1004c50a66cd611077728336c36c266b4b0b6de ./tasks/hud/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/environment/proxy/ztp_log_proxy.py +e11035d5609e035ef936f6cdf7fc065ddf4d8538fb6e15c18262f62609aff52ada6690bbfb0a4327ab77b3857db87204 ./tasks/hud/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/environment/proxy/ztp_open_bridge.py +e1d5a9d2e96a912398b48d49fb630f2a12a59c8e753d46435466f1895ae6335c4073ee2ee9e538f7dda0441a4f4c08ec ./tasks/hud/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/instruction.md +e5c2f3bc8a3f9c8531df96133f11c779d35810d82fb86abe74b850e91b3774cb05a48c310818653dbe6fff706150c877 ./tasks/hud/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/task.toml +d45b1a85de19f0ee33c099aae0057245e8f8a3e89d9c4b16e1b149683b0afe33ae0f6e5bd85ba4f2b750d8cbfb06b90e ./tasks/hud/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/Dockerfile +2488ad31e36643bd924a5e14bea9e9f1854355cd45b481941c6a225ccd1b24047a33ce5fde6e180792c387af50988db6 ./tasks/hud/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/environment.jsonl +b42707c4c2044e7f66439f20a446dabe48bbbc75e4392f320230ed2743129f680f3d469c7a18ba295453f78c1fa7c85d ./tasks/hud/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/grade.py +37cf818d736fb6c2c071a0398fea1ff1d48598e7032b36ab6fac7cd6d732f714430b671ecf65cbba00344f6db3dc20a4 ./tasks/hud/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/hud_grade.py +88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/hud/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/pack_score.py +ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/hud/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/score.py +cd2ecdac7e3ca0cc456221b05dd86c656974d5894104a7480882386d46343d274b6eae4e5cdfcaf3420512b315fb206d ./tasks/hud/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/test.sh +9a47759ee9a5c328bdf04e8dc282ac08ab90b80425ad0a42dda63f593156424ff692c86f674cff9d514d77f83c69ddca ./tasks/hud/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/ztp_mcp.py +e11035d5609e035ef936f6cdf7fc065ddf4d8538fb6e15c18262f62609aff52ada6690bbfb0a4327ab77b3857db87204 ./tasks/hud/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/ztp_open_bridge.py +610493a1947f6d178c4813d64563bb07e8c287080e632874b166a76f012117e477dc5883ad81e6eacec3557c4503cd35 ./tasks/hud/tasks/g2-forensics6-07/environment/Dockerfile +d42fd88de86f99abaa11b94e4ff96e6454e86184018a17a9f7241a822ee94ffd5230f5a2f3f3a276994a773fa55794f9 ./tasks/hud/tasks/g2-forensics6-07/environment/docker-compose.yaml +5828695fdb24c01062ce07464e5ea65f3f723131f4dcda51deee2e8235ef02fc890b5810ab347faa82da25d16714619b ./tasks/hud/tasks/g2-forensics6-07/environment/proxy/Dockerfile +827ab325681d02d5d6ad0664b0cd51c179bc561989e498d670899118e1004c50a66cd611077728336c36c266b4b0b6de ./tasks/hud/tasks/g2-forensics6-07/environment/proxy/ztp_log_proxy.py +e11035d5609e035ef936f6cdf7fc065ddf4d8538fb6e15c18262f62609aff52ada6690bbfb0a4327ab77b3857db87204 ./tasks/hud/tasks/g2-forensics6-07/environment/proxy/ztp_open_bridge.py +a295deecdfac18c6078961af138782d982d8cc24bc7f491fe406ad18950e03d7e8eab66af8cfd56cc8d6c0affef8cf75 ./tasks/hud/tasks/g2-forensics6-07/instruction.md +be93f34ca9d229e4a90b7a6d7ba93a1a53bff522d258f49f45d77c8878969621ec0055d1807821c06efd24ee29e3a310 ./tasks/hud/tasks/g2-forensics6-07/task.toml +d45b1a85de19f0ee33c099aae0057245e8f8a3e89d9c4b16e1b149683b0afe33ae0f6e5bd85ba4f2b750d8cbfb06b90e ./tasks/hud/tasks/g2-forensics6-07/tests/Dockerfile +3a6735a84fd21f2b1813b4a24a02af8f5792d97b39f2093d6038bd51385b617378ba3f600569b2b7a58cdd63697f1a92 ./tasks/hud/tasks/g2-forensics6-07/tests/environment.jsonl +b42707c4c2044e7f66439f20a446dabe48bbbc75e4392f320230ed2743129f680f3d469c7a18ba295453f78c1fa7c85d ./tasks/hud/tasks/g2-forensics6-07/tests/grade.py +37cf818d736fb6c2c071a0398fea1ff1d48598e7032b36ab6fac7cd6d732f714430b671ecf65cbba00344f6db3dc20a4 ./tasks/hud/tasks/g2-forensics6-07/tests/hud_grade.py +88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/hud/tasks/g2-forensics6-07/tests/pack_score.py +ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/hud/tasks/g2-forensics6-07/tests/score.py +cd2ecdac7e3ca0cc456221b05dd86c656974d5894104a7480882386d46343d274b6eae4e5cdfcaf3420512b315fb206d ./tasks/hud/tasks/g2-forensics6-07/tests/test.sh +9a47759ee9a5c328bdf04e8dc282ac08ab90b80425ad0a42dda63f593156424ff692c86f674cff9d514d77f83c69ddca ./tasks/hud/tasks/g2-forensics6-07/tests/ztp_mcp.py +e11035d5609e035ef936f6cdf7fc065ddf4d8538fb6e15c18262f62609aff52ada6690bbfb0a4327ab77b3857db87204 ./tasks/hud/tasks/g2-forensics6-07/tests/ztp_open_bridge.py +610493a1947f6d178c4813d64563bb07e8c287080e632874b166a76f012117e477dc5883ad81e6eacec3557c4503cd35 ./tasks/hud/tasks/g2-forensics7-10/environment/Dockerfile +d42fd88de86f99abaa11b94e4ff96e6454e86184018a17a9f7241a822ee94ffd5230f5a2f3f3a276994a773fa55794f9 ./tasks/hud/tasks/g2-forensics7-10/environment/docker-compose.yaml +5828695fdb24c01062ce07464e5ea65f3f723131f4dcda51deee2e8235ef02fc890b5810ab347faa82da25d16714619b ./tasks/hud/tasks/g2-forensics7-10/environment/proxy/Dockerfile +827ab325681d02d5d6ad0664b0cd51c179bc561989e498d670899118e1004c50a66cd611077728336c36c266b4b0b6de ./tasks/hud/tasks/g2-forensics7-10/environment/proxy/ztp_log_proxy.py +e11035d5609e035ef936f6cdf7fc065ddf4d8538fb6e15c18262f62609aff52ada6690bbfb0a4327ab77b3857db87204 ./tasks/hud/tasks/g2-forensics7-10/environment/proxy/ztp_open_bridge.py +e234de9fdb5eaefdab8d4ec2552be5f2d31c54f2703f3723d64d20324bbc8b56ecb2cf8fd6be3c23fa843e6a5316e1a7 ./tasks/hud/tasks/g2-forensics7-10/instruction.md +e85aa0a08536f8b2416ae826db1d052258222852049bfcd358238b2818c4cf19cca85dc753c6d61ba8e2ef6c31acd0d9 ./tasks/hud/tasks/g2-forensics7-10/task.toml +d45b1a85de19f0ee33c099aae0057245e8f8a3e89d9c4b16e1b149683b0afe33ae0f6e5bd85ba4f2b750d8cbfb06b90e ./tasks/hud/tasks/g2-forensics7-10/tests/Dockerfile +d47680d36635b2f12f00ac7ae768ab9f4e5086d807a54f5791731235c059b28777e2d4fb565024981803ab9b6e431d47 ./tasks/hud/tasks/g2-forensics7-10/tests/environment.jsonl +b42707c4c2044e7f66439f20a446dabe48bbbc75e4392f320230ed2743129f680f3d469c7a18ba295453f78c1fa7c85d ./tasks/hud/tasks/g2-forensics7-10/tests/grade.py +37cf818d736fb6c2c071a0398fea1ff1d48598e7032b36ab6fac7cd6d732f714430b671ecf65cbba00344f6db3dc20a4 ./tasks/hud/tasks/g2-forensics7-10/tests/hud_grade.py +88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/hud/tasks/g2-forensics7-10/tests/pack_score.py +ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/hud/tasks/g2-forensics7-10/tests/score.py +cd2ecdac7e3ca0cc456221b05dd86c656974d5894104a7480882386d46343d274b6eae4e5cdfcaf3420512b315fb206d ./tasks/hud/tasks/g2-forensics7-10/tests/test.sh +9a47759ee9a5c328bdf04e8dc282ac08ab90b80425ad0a42dda63f593156424ff692c86f674cff9d514d77f83c69ddca ./tasks/hud/tasks/g2-forensics7-10/tests/ztp_mcp.py +e11035d5609e035ef936f6cdf7fc065ddf4d8538fb6e15c18262f62609aff52ada6690bbfb0a4327ab77b3857db87204 ./tasks/hud/tasks/g2-forensics7-10/tests/ztp_open_bridge.py +610493a1947f6d178c4813d64563bb07e8c287080e632874b166a76f012117e477dc5883ad81e6eacec3557c4503cd35 ./tasks/hud/tasks/g2-sd-slab-shallowest-char-load-v3/environment/Dockerfile +d42fd88de86f99abaa11b94e4ff96e6454e86184018a17a9f7241a822ee94ffd5230f5a2f3f3a276994a773fa55794f9 ./tasks/hud/tasks/g2-sd-slab-shallowest-char-load-v3/environment/docker-compose.yaml +5828695fdb24c01062ce07464e5ea65f3f723131f4dcda51deee2e8235ef02fc890b5810ab347faa82da25d16714619b ./tasks/hud/tasks/g2-sd-slab-shallowest-char-load-v3/environment/proxy/Dockerfile +827ab325681d02d5d6ad0664b0cd51c179bc561989e498d670899118e1004c50a66cd611077728336c36c266b4b0b6de ./tasks/hud/tasks/g2-sd-slab-shallowest-char-load-v3/environment/proxy/ztp_log_proxy.py +e11035d5609e035ef936f6cdf7fc065ddf4d8538fb6e15c18262f62609aff52ada6690bbfb0a4327ab77b3857db87204 ./tasks/hud/tasks/g2-sd-slab-shallowest-char-load-v3/environment/proxy/ztp_open_bridge.py +739a0e2f4358d92c720f8743c16e22b67bc053a2a82d3d901a132328a220192ff29236c380f92ecab06b9bc614580b34 ./tasks/hud/tasks/g2-sd-slab-shallowest-char-load-v3/instruction.md +a12c369164e259a15d12ad26665c32484ead7a6dd92e64fa8a5d4dd232732040973c43a49ca99abb02f6930c1b85832b ./tasks/hud/tasks/g2-sd-slab-shallowest-char-load-v3/task.toml +d45b1a85de19f0ee33c099aae0057245e8f8a3e89d9c4b16e1b149683b0afe33ae0f6e5bd85ba4f2b750d8cbfb06b90e ./tasks/hud/tasks/g2-sd-slab-shallowest-char-load-v3/tests/Dockerfile +3eb8e40718a8e028ccfcb1e2dd90812c8a161247bdc8b5e16b7d8934d35c00636edcd3d1c0be62747b2ffddb02517937 ./tasks/hud/tasks/g2-sd-slab-shallowest-char-load-v3/tests/environment.jsonl +b42707c4c2044e7f66439f20a446dabe48bbbc75e4392f320230ed2743129f680f3d469c7a18ba295453f78c1fa7c85d ./tasks/hud/tasks/g2-sd-slab-shallowest-char-load-v3/tests/grade.py +37cf818d736fb6c2c071a0398fea1ff1d48598e7032b36ab6fac7cd6d732f714430b671ecf65cbba00344f6db3dc20a4 ./tasks/hud/tasks/g2-sd-slab-shallowest-char-load-v3/tests/hud_grade.py +88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/hud/tasks/g2-sd-slab-shallowest-char-load-v3/tests/pack_score.py +ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/hud/tasks/g2-sd-slab-shallowest-char-load-v3/tests/score.py +cd2ecdac7e3ca0cc456221b05dd86c656974d5894104a7480882386d46343d274b6eae4e5cdfcaf3420512b315fb206d ./tasks/hud/tasks/g2-sd-slab-shallowest-char-load-v3/tests/test.sh +9a47759ee9a5c328bdf04e8dc282ac08ab90b80425ad0a42dda63f593156424ff692c86f674cff9d514d77f83c69ddca ./tasks/hud/tasks/g2-sd-slab-shallowest-char-load-v3/tests/ztp_mcp.py +e11035d5609e035ef936f6cdf7fc065ddf4d8538fb6e15c18262f62609aff52ada6690bbfb0a4327ab77b3857db87204 ./tasks/hud/tasks/g2-sd-slab-shallowest-char-load-v3/tests/ztp_open_bridge.py +4ab72c5978af483ef7a99096b99e9c20ecd746152f3bfcfdb0fe24e6c61b2463830d4c28f046472f7be308a367f8f858 ./tasks/inspect/chainlib.py +d1f77949323f5949284df29fbe48ec93769bb250a1860a2226b761d9d4261ce8ca48055e6d14a32894ad91aa3488192f ./tasks/inspect/data/environments.jsonl +aeae259e07a170c45a4bdf47ff6e8b95989ba2d6564d9a6808a183585e1038d41fd5ab781f3d89051b2dae7a810d7cf0 ./tasks/inspect/inspect_task.py +43b1a273c707ac8caf35150050f238808d261e4f670ddcaaafff88668ccb07bce052605cb1ec7b8556eaaac05f88dfb2 ./tasks/inspect/mcp_stdio_open +88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/inspect/pack_score.py +d851c6838b15bcb7c96c4d1d75b6c59a905e9a3ee54b393a8f098ff768ae04fd2976cb7b00f949eb068b329392141bbb ./tasks/inspect/prompt.py +38a991195690215d491627d069e86ea47303d186cfba1a3de9848d7a57a87f31b21f18c6382112c2107b7f847f40fc7f ./tasks/inspect/sandbox/compose.yaml +ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/inspect/score.py +9a47759ee9a5c328bdf04e8dc282ac08ab90b80425ad0a42dda63f593156424ff692c86f674cff9d514d77f83c69ddca ./tasks/inspect/ztp_mcp.py +e11035d5609e035ef936f6cdf7fc065ddf4d8538fb6e15c18262f62609aff52ada6690bbfb0a4327ab77b3857db87204 ./tasks/inspect/ztp_open_bridge.py +509b5e2475d93da4b9ae04756d44d603ee3de0b53633c062b92520a42970a250866e536715c9d35cbda3d61a92cd1f0f ./tasks/mcp/README.md +fb129e40bace09eafcc73199859d6ab9c06d95ae2a1c25492db27cf36ebaf349c09c34be9982dd150dde90b18db1391d ./tasks/mcp/g2-budget-sd-airspeed-sink-e-t3/grade.sh +e058687544267afaf95612f7d17dee8de2947898595de7b9d31b7aa0bd06a24a4dca78560bcb58c40ddac33ea341c7c9 ./tasks/mcp/g2-budget-sd-airspeed-sink-e-t3/mcp.json +4fbdbf19220faf68754a8cf5f8eafdd8afb10c3c78661fd7843055510bacb9988d27df95e011209ad09282338503e08a ./tasks/mcp/g2-budget-sd-airspeed-sink-e-t3/prompt.md +fb129e40bace09eafcc73199859d6ab9c06d95ae2a1c25492db27cf36ebaf349c09c34be9982dd150dde90b18db1391d ./tasks/mcp/g2-chain-sd-slab-radius-halfchar-h-r7/grade.sh +17d5a9e07cc16c104894e247911d78d53c0f0de89007494fb2c8b0856899698c888406b45af27ffa065507d11960c1e4 ./tasks/mcp/g2-chain-sd-slab-radius-halfchar-h-r7/mcp.json +e4058b8982314ee81382e9b18b2492f65df47fe73b5720028753d6e96306307f33aa04ac8dd8f7c6698530c294cd43fe ./tasks/mcp/g2-chain-sd-slab-radius-halfchar-h-r7/prompt.md +fb129e40bace09eafcc73199859d6ab9c06d95ae2a1c25492db27cf36ebaf349c09c34be9982dd150dde90b18db1391d ./tasks/mcp/g2-forensics6-07/grade.sh +6a2e6b938f0abae9b6d3fb7ca88dbfb548e57d9ffd5bda64271f86b9f5e6e767c4fdbc5c9316e0a5139fe282de02f68f ./tasks/mcp/g2-forensics6-07/mcp.json +3e824c60aaf092773b1ed83bbe55b0e388e191c5db6c84afc38669327fdfe98b94e3942e4ea53b75b668ba1312d2ebec ./tasks/mcp/g2-forensics6-07/prompt.md +fb129e40bace09eafcc73199859d6ab9c06d95ae2a1c25492db27cf36ebaf349c09c34be9982dd150dde90b18db1391d ./tasks/mcp/g2-forensics7-10/grade.sh +0518bb5ddb74e884411fa63639fb0b31418559191b90d78c374b7af52c3fd7aee1d69c82897e4a88a53870e7bff51bfa ./tasks/mcp/g2-forensics7-10/mcp.json +dd29a6bedc9fcd61f104ef5868600d958f017154590039f48918cf26dc52ae050ca92c4f482f8b654d40575ac2e96d63 ./tasks/mcp/g2-forensics7-10/prompt.md +fb129e40bace09eafcc73199859d6ab9c06d95ae2a1c25492db27cf36ebaf349c09c34be9982dd150dde90b18db1391d ./tasks/mcp/g2-sd-slab-shallowest-char-load-v3/grade.sh +23100f40176580459a9eca6c629e6ecaf60a6c4c0f9b83249628ecd5492d0c2767f8e11f90b171133ebd34192c12eebe ./tasks/mcp/g2-sd-slab-shallowest-char-load-v3/mcp.json +f6572efb3fbf41101cb51cc64ebfe248b4091dd648f6256479ec276c5187f7e64c2c9fab90906ea82691cee86a61cf3c ./tasks/mcp/g2-sd-slab-shallowest-char-load-v3/prompt.md +0b4254f74fd12013bc5af575f0a260922a1c5888c60e65cfbdaa6f0e2a184d88267bd1226133134880037d9440cbef83 ./tasks/mcp/scorer/bind.py +4ab72c5978af483ef7a99096b99e9c20ecd746152f3bfcfdb0fe24e6c61b2463830d4c28f046472f7be308a367f8f858 ./tasks/mcp/scorer/chainlib.py +d1f77949323f5949284df29fbe48ec93769bb250a1860a2226b761d9d4261ce8ca48055e6d14a32894ad91aa3488192f ./tasks/mcp/scorer/data/environments.jsonl +df6cd1ed60eb0f654c6c6eb8f4323fb28a6dda73089c77e1b199ac70a0515d871ba1f2c6d5de809824c2ea721af5293a ./tasks/mcp/scorer/grade_mcp.py +87779703ea62613cc92343c13c470bfb394ba1688426eb4809d4f0dbf264fec2e96ab604b9ca2e49580060b99097deb4 ./tasks/mcp/scorer/mcp_log_proxy.py +43b1a273c707ac8caf35150050f238808d261e4f670ddcaaafff88668ccb07bce052605cb1ec7b8556eaaac05f88dfb2 ./tasks/mcp/scorer/mcp_stdio_open +88aa869521c90682583fbef41fd0d8ca3d52ae37207f7fccdf394f02183393ab92b3e722efea6fda08c30fe98abf8523 ./tasks/mcp/scorer/pack_score.py +d851c6838b15bcb7c96c4d1d75b6c59a905e9a3ee54b393a8f098ff768ae04fd2976cb7b00f949eb068b329392141bbb ./tasks/mcp/scorer/prompt.py +a960c3d64cd1ba7bf9decc16fef45e2779b9fe5001ed15720ed9cdce7d8164a959b5fef3f77924f051fca12441f82235 ./tasks/mcp/scorer/run_reference.py +ba7a7c9ea95d22e25555e497c385b45a703db9e62c39fb61a4ae4d06a6fc3532d0888c39695e157d1537fe52ee510c82 ./tasks/mcp/scorer/score.py +9a47759ee9a5c328bdf04e8dc282ac08ab90b80425ad0a42dda63f593156424ff692c86f674cff9d514d77f83c69ddca ./tasks/mcp/scorer/ztp_mcp.py +e11035d5609e035ef936f6cdf7fc065ddf4d8538fb6e15c18262f62609aff52ada6690bbfb0a4327ab77b3857db87204 ./tasks/mcp/scorer/ztp_open_bridge.py +fd1b53535e0a3b7a706629cc481781dbbf94f800f712c6b1d2f369d3b4c52b21120fdb5bdbfff3ecaea1cd161019370a ./verify_sample.sh diff --git a/sample/VERIFY.md b/sample/VERIFY.md new file mode 100644 index 0000000000000000000000000000000000000000..ae46a8299f7afdef01a4c7322c5fc4efd986ec8c --- /dev/null +++ b/sample/VERIFY.md @@ -0,0 +1,25 @@ +# Verify the sample + +Python 3 and nothing else. In the unpacked folder: + + sh verify_sample.sh + +It verifies every SHA-384 in `SHA384SUMS`, scores the 5 reference answers on the bundled verifier (reward 1 on 5 of 5) and runs the cheat suite (every cheat 0, every honest control 1). It ends `SAMPLE HOLDS`, or names what did not hold, and exits non-zero. + +**With the network denied.** macOS: `sandbox-exec -p '(version 1)(allow default)(deny network*)' sh verify_sample.sh`. Linux: `sudo unshare -n sh verify_sample.sh` (or `docker run --network none ... sh verify_sample.sh`). + +**macOS browser downloads.** `git clone` and `curl` require no extra step; if you downloaded an archive through a macOS web browser or mail client, clear Gatekeeper quarantine once with `xattr -dr com.apple.quarantine scorer/bin`. + +**Linux.** `scorer/bin/sample_verifier-linux-amd64` and `sample_verifier-linux-arm64` are static binaries; `verify_sample.sh` selects the binary matching the host CPU (`x86_64` or `aarch64`/`arm64`) and runs with `--network none`. Any other platform can score against `https://mcp.zerotrustphysics.com/mcp`. + +**Harbor.** `harbor run -p tasks/harbor/tasks -a oracle` runs each reference answer in Harbor's containers and grades it with the task's `tests/grade.py`. Each image's `/usr/local/bin/mcp_stdio` connects to the public MCP preview endpoint (1 concurrent physics call per IP). + +**Inspect.** `tasks/inspect/inspect_task.py`, one Inspect task for the set. + +**HUD.** `tasks/hud/tasks/` for HUD's Harbor adapter (`hud.integrations.harbor.adapt`, hud 0.6.21). Your adapter run needs Docker. The Compose project's main service needs user namespaces for HUD's sandbox. + +**Native MCP.** `tasks/mcp/README.md`: per task a prompt, an `mcp.json` and a one-line grader. + +**A proof by hand.** Every run proof is a SHA-384 seal over the request and answer. `verify_tape` with the request and its `run_seal`, on the bundled verifier or at the address, computes it again. The bundled verifier signs nothing; the address signs its answers ML-DSA-87. + +Protocol Company · zerotrustphysics.com diff --git a/sample/calibration/cheat_suite.jsonl b/sample/calibration/cheat_suite.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..499ff964d1073124acd70576797274001ab7a16c --- /dev/null +++ b/sample/calibration/cheat_suite.jsonl @@ -0,0 +1,150 @@ +{"task": "g2-forensics7-10", "family": "forensics", "vector": "honest", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "honest_reply_log_matches", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "honest_numbers_respelled", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "no_request_behind", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "no computing call behind the answer: the table was not put to the verifier", "ok": true} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "edited_call_log", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the call log beside the reply differs from the harness log", "ok": true} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "over_budget", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "5 computing calls; the budget is 4", "ok": true} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "forbidden_tool", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the log holds calls of find_flip, which the task rules out", "ok": true} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "no_harness_log", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "no harness call log: every attempt is scored with the calls the harness recorded", "ok": true} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "harness_log_edited", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the harness log's chain breaks at line 5", "ok": true} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "stale_engine_tag", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the task was built on engine 0.15.0; the verifier is 0.15.3", "ok": true} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "every_row_genuine", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "4 false row(s) not named", "ok": true} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "every_row_false", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "every row of the table is named false: a blanket answer", "ok": true} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "every_row_false_true_reasons", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "every row of the table is named false: a blanket answer", "ok": true} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "copied_proof_other_task", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "nudged_figure", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "figure_plus_10_percent", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "card_request_not_run", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "swapped_sides", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "binding_misnamed", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "proof_from_other_design", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "failing_given_as_passing", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "proof_uppercase", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "extra_argument", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "stop_misnamed", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "step_misnamed", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "missing_solve", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "solve_handed_other_run", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "next_start_rounded", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "next_proof_copied", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics7-10", "family": "forensics", "vector": "next_request_edited", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "honest", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "honest_reply_log_matches", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "honest_numbers_respelled", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "no_request_behind", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "a run_trajectory request on the card is not among the calls in the log", "ok": true} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "edited_call_log", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the call log beside the reply differs from the harness log", "ok": true} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "over_budget", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "9 computing calls; the budget is 8", "ok": true} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "forbidden_tool", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the log holds calls of find_flip, which the task rules out", "ok": true} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "no_harness_log", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "no harness call log: every attempt is scored with the calls the harness recorded", "ok": true} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "harness_log_edited", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the harness log's chain breaks at line 4", "ok": true} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "stale_engine_tag", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the task was built on engine 0.15.0; the verifier is 0.15.3", "ok": true} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "copied_proof_other_task", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)", "ok": true} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "nudged_figure", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)", "ok": true} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "figure_plus_10_percent", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)", "ok": true} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "card_request_not_run", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "a run_trajectory request on the card is not among the calls in the log", "ok": true} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "swapped_sides", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "the passing design breaks char_depth", "ok": true} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "binding_misnamed", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "binding names 'peak_load'; the constraint that binds is another", "ok": true} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "proof_from_other_design", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the failing design's run_seal: the verifier says the seal does not hold (cause run_seal)", "ok": true} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "failing_given_as_passing", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "the passing design breaks char_depth", "ok": true} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "proof_uppercase", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run_seal: the proof is not a SHA-384 seal of 96 hex digits", "ok": true} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "extra_argument", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run differs from the task's at note", "ok": true} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "missing_solve", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's solve is missing", "ok": true} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "solve_handed_other_run", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's solve is not handed the design's own sealed run", "ok": true} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "stop_misnamed", "applies": false, "why": "no stop binds"} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "step_misnamed", "applies": false, "why": "no stop binds"} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "next_start_rounded", "applies": false, "why": "not a continued design"} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "next_proof_copied", "applies": false, "why": "not a continued design"} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "next_request_edited", "applies": false, "why": "not a continued design"} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "every_row_genuine", "applies": false, "why": "forensics only"} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "every_row_false", "applies": false, "why": "forensics only"} +{"task": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "vector": "every_row_false_true_reasons", "applies": false, "why": "forensics only"} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "honest", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "honest_reply_log_matches", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "honest_numbers_respelled", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "no_request_behind", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "a run_trajectory request on the card is not among the calls in the log", "ok": true} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "edited_call_log", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the call log beside the reply differs from the harness log", "ok": true} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "over_budget", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "11 computing calls; the budget is 10", "ok": true} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "forbidden_tool", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the log holds calls of find_flip, which the task rules out", "ok": true} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "no_harness_log", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "no harness call log: every attempt is scored with the calls the harness recorded", "ok": true} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "harness_log_edited", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the harness log's chain breaks at line 4", "ok": true} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "stale_engine_tag", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the task was built on engine 0.15.0; the verifier is 0.15.3", "ok": true} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "copied_proof_other_task", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)", "ok": true} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "nudged_figure", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)", "ok": true} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "figure_plus_10_percent", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run_seal: the verifier would not verify it: Physical Failure: altitude is above 134.7 km, the top of the drag table read by altitude (AltitudeOutsideCard). That state is not sealed.", "ok": true} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "card_request_not_run", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "a run_trajectory request on the card is not among the calls in the log", "ok": true} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "swapped_sides", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "the passing design breaks half_char", "ok": true} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "binding_misnamed", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "binding names 'peak_load'; the constraint that binds is another", "ok": true} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "proof_from_other_design", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the failing design's run_seal: the verifier says the seal does not hold (cause run_seal)", "ok": true} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "failing_given_as_passing", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "the passing design breaks half_char", "ok": true} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "proof_uppercase", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run_seal: the proof is not a SHA-384 seal of 96 hex digits", "ok": true} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "extra_argument", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's run differs from the task's at note", "ok": true} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "missing_solve", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's solve is missing", "ok": true} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "solve_handed_other_run", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's solve is not handed the design's own sealed run", "ok": true} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "stop_misnamed", "applies": false, "why": "no stop binds"} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "step_misnamed", "applies": false, "why": "no stop binds"} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "next_start_rounded", "applies": false, "why": "not a continued design"} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "next_proof_copied", "applies": false, "why": "not a continued design"} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "next_request_edited", "applies": false, "why": "not a continued design"} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "every_row_genuine", "applies": false, "why": "forensics only"} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "every_row_false", "applies": false, "why": "forensics only"} +{"task": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "vector": "every_row_false_true_reasons", "applies": false, "why": "forensics only"} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "honest", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "honest_reply_log_matches", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "honest_numbers_respelled", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "no_request_behind", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "no computing call behind the answer: the table was not put to the verifier", "ok": true} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "edited_call_log", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the call log beside the reply differs from the harness log", "ok": true} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "over_budget", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "5 computing calls; the budget is 4", "ok": true} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "forbidden_tool", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the log holds calls of find_flip, which the task rules out", "ok": true} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "no_harness_log", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "no harness call log: every attempt is scored with the calls the harness recorded", "ok": true} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "harness_log_edited", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the harness log's chain breaks at line 5", "ok": true} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "stale_engine_tag", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the task was built on engine 0.15.0; the verifier is 0.15.3", "ok": true} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "every_row_genuine", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "4 false row(s) not named", "ok": true} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "every_row_false", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "every row of the table is named false: a blanket answer", "ok": true} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "every_row_false_true_reasons", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "every row of the table is named false: a blanket answer", "ok": true} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "copied_proof_other_task", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "nudged_figure", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "figure_plus_10_percent", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "card_request_not_run", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "swapped_sides", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "binding_misnamed", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "proof_from_other_design", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "failing_given_as_passing", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "proof_uppercase", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "extra_argument", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "stop_misnamed", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "step_misnamed", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "missing_solve", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "solve_handed_other_run", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "next_start_rounded", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "next_proof_copied", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-forensics6-07", "family": "forensics", "vector": "next_request_edited", "applies": false, "why": "a forensics card carries no request or proof"} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "honest", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "honest_reply_log_matches", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "honest_numbers_respelled", "applies": true, "expect": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "ok": true} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "no_request_behind", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "a run_trajectory request on the card is not among the calls in the log", "ok": true} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "edited_call_log", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the call log beside the reply differs from the harness log", "ok": true} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "over_budget", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "4 computing calls; the budget is 3", "ok": true} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "forbidden_tool", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the log holds calls of find_flip, which the task rules out", "ok": true} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "no_harness_log", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "no harness call log: every attempt is scored with the calls the harness recorded", "ok": true} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "harness_log_edited", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the harness log's chain breaks at line 2", "ok": true} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "stale_engine_tag", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the task was built on engine 0.15.0; the verifier is 0.15.3", "ok": true} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "copied_proof_other_task", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the holds seal: the verifier says the seal does not hold (cause run_seal)", "ok": true} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "nudged_figure", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the stops seal: the verifier says the seal does not hold (cause run_seal)", "ok": true} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "figure_plus_10_percent", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the stops seal: the verifier says the seal does not hold (cause run_seal)", "ok": true} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "card_request_not_run", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "a run_trajectory request on the card is not among the calls in the log", "ok": true} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "swapped_sides", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "the holds request comes back refused (AirSpeedOutsideCard)", "ok": true} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "stop_misnamed", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "the card names the stop 'SomeOtherStop'; the verifier names AirSpeedOutsideCard", "ok": true} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "proof_from_other_design", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the stops seal: the verifier says the seal does not hold (cause run_seal)", "ok": true} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "proof_uppercase", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the holds seal: the proof is not a SHA-384 seal of 96 hex digits", "ok": true} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "extra_argument", "applies": true, "expect": 0, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the holds request differs from the task's at note", "ok": true} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "binding_misnamed", "applies": false, "why": "not a budget card"} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "failing_given_as_passing", "applies": false, "why": "not a budget card"} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "step_misnamed", "applies": false, "why": "not a budget card"} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "missing_solve", "applies": false, "why": "not a budget card"} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "solve_handed_other_run", "applies": false, "why": "not a budget card"} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "every_row_genuine", "applies": false, "why": "not a budget card"} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "every_row_false", "applies": false, "why": "not a budget card"} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "every_row_false_true_reasons", "applies": false, "why": "not a budget card"} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "next_start_rounded", "applies": false, "why": "not a budget card"} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "next_proof_copied", "applies": false, "why": "not a budget card"} +{"task": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "vector": "next_request_edited", "applies": false, "why": "not a budget card"} diff --git a/sample/calibration/passk_summary.json b/sample/calibration/passk_summary.json new file mode 100644 index 0000000000000000000000000000000000000000..cff941992909422ce4ab5236c3785102093ceafd --- /dev/null +++ b/sample/calibration/passk_summary.json @@ -0,0 +1,75 @@ +{ + "note": "pass@k of this sample's tasks: pass@k = 1 - C(n-c, k) / C(n, k), n attempts with no harness error, c with reward 1", + "per_task": [ + { + "variant": "tool", + "model": "Frontier model", + "task": "g2-forensics7-10", + "attempts": 8, + "n": 8, + "correct": 3, + "harness_errors": 0, + "harness_error_rate": 0.0, + "mean_graded": 0.910714375, + "pass@1": 0.375, + "pass@8": 1.0, + "in_band": true + }, + { + "variant": "tool", + "model": "Frontier model", + "task": "g2-sd-slab-shallowest-char-load-v3", + "attempts": 8, + "n": 8, + "correct": 3, + "harness_errors": 0, + "harness_error_rate": 0.0, + "mean_graded": 0.375, + "pass@1": 0.375, + "pass@8": 1.0, + "in_band": true + }, + { + "variant": "tool", + "model": "Frontier model", + "task": "g2-chain-sd-slab-radius-halfchar-h-r7", + "attempts": 8, + "n": 8, + "correct": 2, + "harness_errors": 0, + "harness_error_rate": 0.0, + "mean_graded": 0.313093625, + "pass@1": 0.25, + "pass@8": 1.0, + "in_band": true + }, + { + "variant": "tool", + "model": "Frontier model", + "task": "g2-forensics6-07", + "attempts": 16, + "n": 16, + "correct": 9, + "harness_errors": 0, + "harness_error_rate": 0.0, + "mean_graded": 0.9454365625, + "pass@1": 0.5625, + "pass@8": 1.0, + "in_band": true + }, + { + "variant": "tool", + "model": "Frontier model", + "task": "g2-budget-sd-airspeed-sink-e-t3", + "attempts": 16, + "n": 16, + "correct": 10, + "harness_errors": 0, + "harness_error_rate": 0.0, + "mean_graded": 0.7215676875, + "pass@1": 0.625, + "pass@8": 1.0, + "in_band": true + } + ] +} \ No newline at end of file diff --git a/sample/harness/mcp_log_proxy.py b/sample/harness/mcp_log_proxy.py new file mode 100644 index 0000000000000000000000000000000000000000..0172d4963b39b33786a5d07ab7e2c9de50879123 --- /dev/null +++ b/sample/harness/mcp_log_proxy.py @@ -0,0 +1,288 @@ +#!/usr/bin/env python3 +"""A stdio MCP proxy that records every tool call and changes no byte of any message. + + python3 mcp_log_proxy.py --log LOG [--forbid-under DIR ...] [--trace FILE] -- ENGINE [ENGINE ARGS ...] + +It starts ENGINE (an MCP server over stdio, one JSON-RPC message a line, such as the Zero-Trust +Physics mcp_stdio), hands every line the client writes to ENGINE's stdin, and every line ENGINE +writes back to the client's stdout, byte for byte. It reads a copy of each message and, for every +tools/call, appends one JSON line to LOG when the answer comes back: + + {"seq", "jsonrpc_id", "tool", "arguments", "ts_request", "ts_response", "duration_s", + "response_sha384", "text_sha384", "is_error", "chain"} + +response_sha384 is the SHA-384 of the answer line exactly as forwarded (without its newline); +text_sha384 is the SHA-384 of the answer's text content. chain is the SHA-384 of the previous +line's chain followed by this line's JSON without its chain (sorted keys, no spaces): an edit to +any line, or a line taken out, breaks every chain after it. A call still unanswered when the +client closes is written with "unanswered": true. + +LOG must lie outside the solver's working directory: the proxy refuses to start when LOG is +under its own working directory (where an agent's CLI starts it) or under any --forbid-under. +Beside LOG it keeps LOG.status.json: the engine command, the handshake (initialize, or +server/discover under MCP 2026-07-28), the call count, the engine's exit code. --trace FILE also keeps every line both ways, for diagnosing a client. + +Standard library only. Licence: Apache-2.0. +""" +import hashlib +import json +import os +import signal +import subprocess +import sys +import threading +import time + + +# initialize (MCP 2025-06-18 and before) or server/discover (MCP 2026-07-28, which newer clients send first) +HANDSHAKES = ("initialize", "server/discover") + + +def now(): + return time.strftime("%Y-%m-%dT%H:%M:%S", time.gmtime()) + ".%03dZ" % (int(time.time() * 1000) % 1000) + + +def sha384(data): + return hashlib.sha384(data).hexdigest() + + +def chain_of(previous, entry): + payload = json.dumps(entry, sort_keys=True, separators=(",", ":")) + return sha384(((previous or "") + payload).encode("utf-8")) + + +def under(path, folder): + path, folder = os.path.realpath(path), os.path.realpath(folder) + return path == folder or path.startswith(folder.rstrip(os.sep) + os.sep) + + +class Recorder: + def __init__(self, log_path, engine): + self.log_path = log_path + self.lock = threading.Lock() + self.pending = {} + self.seq = 0 + self.chain = None + self.status = {"engine": engine, "proxy_pid": os.getpid(), "started": now(), "handshake": None, + "tools_list": False, "calls": 0, "unanswered": 0, "engine_exit": None, "ended": None, + "problems": []} + open(log_path, "a").close() + self.write_status() + + def write_status(self): + tmp = self.log_path + ".status.json.tmp" + with open(tmp, "w", encoding="utf-8") as f: + json.dump(self.status, f, indent=1) + os.replace(tmp, self.log_path + ".status.json") + + def append(self, entry): + """One log line, chained to the one before. Called with the lock held.""" + self.seq += 1 + entry = dict(entry, seq=self.seq) + entry["chain"] = chain_of(self.chain, entry) + self.chain = entry["chain"] + with open(self.log_path, "a", encoding="utf-8") as f: + f.write(json.dumps(entry, sort_keys=True) + "\n") + f.flush() + os.fsync(f.fileno()) + self.status["calls"] += 1 + + @staticmethod + def messages(line): + try: + found = json.loads(line) + except ValueError: + return [] + if isinstance(found, list): + return [m for m in found if isinstance(m, dict)] + return [found] if isinstance(found, dict) else [] + + def from_client(self, line): + for message in self.messages(line): + if "id" in message and message.get("method"): + key = json.dumps(message["id"]) + with self.lock: + self.pending[key] = {"method": message["method"], "params": message.get("params"), + "ts": now(), "t0": time.time(), "id": message["id"]} + + def from_engine(self, line): + raw = line.rstrip(b"\r\n") + for message in self.messages(line): + if "id" not in message or message.get("method"): + continue + key = json.dumps(message["id"]) + with self.lock: + asked = self.pending.pop(key, None) + if asked is None: + continue + if asked["method"] in HANDSHAKES: + result = message.get("result") if isinstance(message.get("result"), dict) else {} + if not (self.status["handshake"] or {}).get("ok"): + srv = result.get("serverInfo") + if isinstance(srv, dict) and str(srv.get("title") or "").startswith("Zero-Trust Physics"): + desc = str(srv.get("description") or "") + if ": " in desc: + desc = "Deterministic physics of real objects: " + desc.split(": ", 1)[1] + srv = dict(srv, title="Zero-Trust Physics Verifier", description=desc) + self.status["handshake"] = {"method": asked["method"], "ok": "result" in message, + "server": srv} + self.write_status() + elif asked["method"] == "tools/list": + if not self.status["tools_list"]: + self.status["tools_list"] = "result" in message + self.write_status() + elif asked["method"] == "tools/call": + params = asked["params"] if isinstance(asked["params"], dict) else {} + result = message.get("result") if isinstance(message.get("result"), dict) else {} + text = "".join(c.get("text", "") for c in result.get("content", []) or [] if isinstance(c, dict)) + self.append({"jsonrpc_id": asked["id"], "tool": params.get("name"), + "arguments": params.get("arguments") if params.get("arguments") is not None else {}, + "ts_request": asked["ts"], "ts_response": now(), + "duration_s": round(time.time() - asked["t0"], 6), + "response_sha384": sha384(raw), "text_sha384": sha384(text.encode("utf-8")), + "is_error": bool(result.get("isError")) or "error" in message}) + + def close(self, engine_exit): + with self.lock: + for asked in self.pending.values(): + if asked["method"] != "tools/call": + continue + params = asked["params"] if isinstance(asked["params"], dict) else {} + self.append({"jsonrpc_id": asked["id"], "tool": params.get("name"), + "arguments": params.get("arguments") if params.get("arguments") is not None else {}, + "ts_request": asked["ts"], "ts_response": None, "duration_s": None, + "response_sha384": None, "text_sha384": None, "is_error": None, "unanswered": True}) + self.status["unanswered"] += 1 + self.pending.clear() + self.status["engine_exit"] = engine_exit + self.status["ended"] = now() + self.write_status() + + +def main(argv): + log, forbid, engine, trace = None, [], None, None + i = 0 + while i < len(argv): + if argv[i] == "--": + engine = argv[i + 1:] + break + if argv[i] == "--log" and i + 1 < len(argv): + log = argv[i + 1] + i += 2 + continue + if argv[i] == "--trace" and i + 1 < len(argv): + trace = open(argv[i + 1], "ab") + i += 2 + continue + if argv[i] == "--forbid-under" and i + 1 < len(argv): + forbid.append(argv[i + 1]) + i += 2 + continue + sys.exit("usage: mcp_log_proxy.py --log LOG [--forbid-under DIR ...] -- ENGINE [ARGS ...]") + if not log or not engine: + sys.exit("usage: mcp_log_proxy.py --log LOG [--forbid-under DIR ...] -- ENGINE [ARGS ...]") + log = os.path.abspath(log) + for folder in [os.getcwd()] + forbid: + if under(log, folder): + sys.exit("mcp_log_proxy: the log %s lies inside %s, where the solver works; put it outside" % (log, folder)) + os.makedirs(os.path.dirname(log), exist_ok=True) + recorder = Recorder(log, engine) + try: + proc = subprocess.Popen(engine, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=sys.stderr.fileno(), bufsize=0) + except OSError as problem: + recorder.status["problems"].append("the engine did not start: %s" % problem) + recorder.close(None) + sys.exit("mcp_log_proxy: the engine did not start: %s" % problem) + out = sys.stdout.buffer + + def engine_to_client(): + try: + for line in iter(proc.stdout.readline, b""): + if trace: + trace.write(b"< " + line) + trace.flush() + try: + recorder.from_engine(line) + except Exception as problem: # the log must never stop an answer + recorder.status["problems"].append("log: %s" % problem) + out.write(line) + out.flush() + except (BrokenPipeError, OSError) as problem: + recorder.status["problems"].append("client output closed: %s" % problem) + + finished = threading.Lock() + + def finish(): + """Once: close the engine, log what is unanswered, close the client's output, and leave.""" + if not finished.acquire(blocking=False): + return + try: + proc.stdin.close() + except OSError: + pass + try: + code = proc.wait(timeout=30) + except subprocess.TimeoutExpired: + proc.kill() + code = proc.wait() + recorder.close(code) + try: + out.flush() + except OSError: + pass + os._exit(0) + + reader_done = threading.Event() + client_closed = threading.Event() + + def engine_to_client_then_finish(): + engine_to_client() + reader_done.set() + if proc.poll() is None: + try: + proc.wait(timeout=5) + except subprocess.TimeoutExpired: + pass + if proc.poll() is not None and not client_closed.is_set(): + # the engine has gone: the client must see its output close rather than wait for an answer + recorder.status["problems"].append("the engine closed its output (exit %s)" % proc.returncode) + finish() + + reader = threading.Thread(target=engine_to_client_then_finish, daemon=True) + reader.start() + + def stop(signum, frame): + raise KeyboardInterrupt + + signal.signal(signal.SIGTERM, stop) + signal.signal(signal.SIGHUP, stop) + source = sys.stdin.buffer + try: + for line in iter(source.readline, b""): + if trace: + trace.write(b"> " + line) + trace.flush() + try: + recorder.from_client(line) + except Exception as problem: + recorder.status["problems"].append("log: %s" % problem) + try: + proc.stdin.write(line) + proc.stdin.flush() + except (BrokenPipeError, OSError) as problem: + recorder.status["problems"].append("engine input closed: %s" % problem) + break + except KeyboardInterrupt: + pass + client_closed.set() + try: + proc.stdin.close() + except OSError: + pass + reader.join(timeout=30) + finish() + return 0 + + +if __name__ == "__main__": + sys.exit(main(sys.argv[1:])) diff --git a/sample/reference/g2-budget-sd-airspeed-sink-e-t3.calls.jsonl b/sample/reference/g2-budget-sd-airspeed-sink-e-t3.calls.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..e599f67c7802521db8b5233ef4a2c0847f980d86 --- /dev/null +++ b/sample/reference/g2-budget-sd-airspeed-sink-e-t3.calls.jsonl @@ -0,0 +1,2 @@ +{"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6495650.0, "radial_speed_m_s": -1960.0377171633477, "transverse_speed_m_s": 12604.2}, "dt_s": 0.05, "segments": [{"steps": 1420, "load": {}}], "record_every": 1420}} +{"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6495650.0, "radial_speed_m_s": -1959.9495174505687, "transverse_speed_m_s": 12604.2}, "dt_s": 0.05, "segments": [{"steps": 1420, "load": {}}], "record_every": 1420}} diff --git a/sample/reference/g2-budget-sd-airspeed-sink-e-t3.harness.jsonl b/sample/reference/g2-budget-sd-airspeed-sink-e-t3.harness.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..b357890bf69d52ba4b9608c4705ae22414bc0dae --- /dev/null +++ b/sample/reference/g2-budget-sd-airspeed-sink-e-t3.harness.jsonl @@ -0,0 +1,2 @@ +{"arguments": {"card": "capsule_stardust", "domain": "aerospace", "dt_s": 0.05, "initial": {"radial_speed_m_s": -1960.0377171633477, "radius_m": 6495650.0, "transverse_speed_m_s": 12604.2}, "record_every": 1420, "segments": [{"load": {}, "steps": 1420}]}, "chain": "5385e09c4b4d845b4dd95a87915f529bdec244724be184832f341d35693d57e8a1c22af88a38609efdaf97f382ee8878", "duration_s": 0.004869, "is_error": false, "jsonrpc_id": 2, "response_sha384": "5f1c652bdbf59a96b8afdf62a8d1f94f123abcfe96ad404abb465dd77fb5e17b4501fe88f069443d04efc1652bf5d0f2", "seq": 1, "text_sha384": "644264053d4683f13ce54b3a643aa7061f8e4f008e4017cfb0c880de395dee8291213cce0399e496b74f976fa934397e", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:42.824Z", "ts_response": "2026-11-14T01:25:42.829Z"} +{"arguments": {"card": "capsule_stardust", "domain": "aerospace", "dt_s": 0.05, "initial": {"radial_speed_m_s": -1959.9495174505687, "radius_m": 6495650.0, "transverse_speed_m_s": 12604.2}, "record_every": 1420, "segments": [{"load": {}, "steps": 1420}]}, "chain": "4c922c5f02d300f88d17bbec3d3dc9fa95ee8ef4dfd06cd6432252c1c75abfb2d91cd19a15f4fe8f3bbd6073972705fa", "duration_s": 0.002538, "is_error": false, "jsonrpc_id": 3, "response_sha384": "67af0378d49db91e4048a51da824e45d5bcabea1a18a719480b39ee63e3a0b1498c7a07461110a1e5f2cc08ccb198bc4", "seq": 2, "text_sha384": "2b92f2e1cd218112a5e1c2b370a2ede752097a34d9efcd18a92b82bbd25f448f61460c5fa78f5c6a36071677f7c2c753", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:42.829Z", "ts_response": "2026-11-14T01:25:42.832Z"} diff --git a/sample/reference/g2-budget-sd-airspeed-sink-e-t3.harness.jsonl.status.json b/sample/reference/g2-budget-sd-airspeed-sink-e-t3.harness.jsonl.status.json new file mode 100644 index 0000000000000000000000000000000000000000..409b3e0fc67a7873a2f3257a2600c231f1a3c270 --- /dev/null +++ b/sample/reference/g2-budget-sd-airspeed-sink-e-t3.harness.jsonl.status.json @@ -0,0 +1,24 @@ +{ + "engine": [ + ".../engine_0.15.3_served/mcp_stdio" + ], + "proxy_pid": 1381, + "started": "2026-11-14T01:25:42.819Z", + "handshake": { + "method": "initialize", + "ok": true, + "server": { + "name": "Zero-Trust Physics", + "title": "Zero-Trust Physics Verifier", + "version": "0.15.3", + "description": "Deterministic physics of real objects: each model compared with measurement or held to a reference calculation, a conservation ledger on every step, a SHA-384 proof on every answer, and a refusal by name where its equations, constants or tables no longer hold. Cards: genesis_kernel_v0.13.1", + "websiteUrl": "https://zerotrustphysics.com" + } + }, + "tools_list": false, + "calls": 2, + "unanswered": 0, + "engine_exit": 0, + "ended": "2026-11-14T01:25:42.833Z", + "problems": [] +} \ No newline at end of file diff --git a/sample/reference/g2-budget-sd-airspeed-sink-e-t3.txt b/sample/reference/g2-budget-sd-airspeed-sink-e-t3.txt new file mode 100644 index 0000000000000000000000000000000000000000..3cc05c58610f9c2d98f612648a16930261383ab2 --- /dev/null +++ b/sample/reference/g2-budget-sd-airspeed-sink-e-t3.txt @@ -0,0 +1,3 @@ +The stop AirSpeedOutsideCard lies between the two requests below. + +{"holds": {"request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6495650.0, "radial_speed_m_s": -1960.0377171633477, "transverse_speed_m_s": 12604.2}, "dt_s": 0.05, "segments": [{"steps": 1420, "load": {}}], "record_every": 1420}}, "proof": "39af98b965eaa02888d1b8f06e4967c06ce8b28980ec0baa56304fdad7ef4dabfb9bf6f270d80a945a2841868301048f"}, "stops": {"request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6495650.0, "radial_speed_m_s": -1959.9495174505687, "transverse_speed_m_s": 12604.2}, "dt_s": 0.05, "segments": [{"steps": 1420, "load": {}}], "record_every": 1420}}, "proof": "141a97476638dfc739c43ca3715b5a1a4378eade9969a5dbec3d702e39aeebc0697f848dd3da0947a2a03989d76d6e40", "stopped": "AirSpeedOutsideCard"}} diff --git a/sample/reference/g2-chain-sd-slab-radius-halfchar-h-r7.calls.jsonl b/sample/reference/g2-chain-sd-slab-radius-halfchar-h-r7.calls.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..48b0b8c95fc6f6f034bc5bad49c88eca01435338 --- /dev/null +++ b/sample/reference/g2-chain-sd-slab-radius-halfchar-h-r7.calls.jsonl @@ -0,0 +1,4 @@ +{"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488829.580236817, "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": 8000, "load": {}}], "record_every": 720}} +{"tool": "solve", "arguments": {"solver": "ablator_slab", "parameters": {"material": "PICA, open record, version 3", "thickness_m": 0.0434, "start_temperature_k": 281.0, "face": "gas_stream", "stream_gas": "air", "surroundings_temperature_k": 294.4, "face_wears": true, "thermocouple_depths_m": [], "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false, "history_time_s": [0.0, 22.5, 45.0, 67.5, 90.0, 93.6875, 94.6875, 545.0], "history_pressure_pa": [5909.919921875, 5909.919921875, 42409.2421875, 6625.830078125, 2544.8134765625, 2450.75341796875, 2450.75341796875, 2450.75341796875], "history_heat_transfer_coefficient_kg_per_m2_s": [0.0, 0.058212701231241226, 0.1558331996202469, 0.06065985932946205, 0.03434406593441963, 0.03284108266234398, 0.0, 0.0], "history_flow_enthalpy_j_per_kg": [75923648.0, 75923648.0, 12139213.0, 541897.6875, 80255.8046875, 64982.50390625, 64982.50390625, 64982.50390625], "history_radiative_heating_w_per_m2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}, "from": {"request": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488829.580236817, "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": 8000, "load": {}}], "record_every": 720}, "run_seal": "1fa78aec5d3e09d24456d17b17ae3d5cbe4ad1d98f7f613fe5e80c1b855d017e435fb45dc30ed730eef198f5590ec173", "coupling": "stardust_entry_to_pica_slab"}}} +{"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488836.780236816, "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": 8000, "load": {}}], "record_every": 720}} +{"tool": "solve", "arguments": {"solver": "ablator_slab", "parameters": {"material": "PICA, open record, version 3", "thickness_m": 0.0434, "start_temperature_k": 281.0, "face": "gas_stream", "stream_gas": "air", "surroundings_temperature_k": 294.4, "face_wears": true, "thermocouple_depths_m": [], "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false, "history_time_s": [0.0, 22.5, 45.0, 67.5, 90.0, 93.6875, 94.6875, 545.0], "history_pressure_pa": [5903.89697265625, 5903.89697265625, 42420.40234375, 6628.06396484375, 2545.021240234375, 2450.830078125, 2450.830078125, 2450.830078125], "history_heat_transfer_coefficient_kg_per_m2_s": [0.0, 0.05818302929401398, 0.15585379302501678, 0.0606706440448761, 0.03434683755040169, 0.032843057066202164, 0.0, 0.0], "history_flow_enthalpy_j_per_kg": [75926248.0, 75926248.0, 12148022.0, 542217.125, 80285.0625, 65003.5703125, 65003.5703125, 65003.5703125], "history_radiative_heating_w_per_m2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}, "from": {"request": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488836.780236816, "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": 8000, "load": {}}], "record_every": 720}, "run_seal": "abce34b40ba1868cb29f0015f8de509f678546c4dfaad17ae251df0486469b4bdac80244df56c2071b13c31c4db6d6db", "coupling": "stardust_entry_to_pica_slab"}}} diff --git a/sample/reference/g2-chain-sd-slab-radius-halfchar-h-r7.harness.jsonl b/sample/reference/g2-chain-sd-slab-radius-halfchar-h-r7.harness.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..84268859b9417f3d5b9de53bc6d12219091993f3 --- /dev/null +++ b/sample/reference/g2-chain-sd-slab-radius-halfchar-h-r7.harness.jsonl @@ -0,0 +1,4 @@ +{"arguments": {"card": "capsule_stardust", "domain": "aerospace", "dt_s": 0.03125, "initial": {"radial_speed_m_s": -2175.4, "radius_m": 6488829.580236817, "transverse_speed_m_s": 12641.2}, "record_every": 720, "segments": [{"load": {}, "steps": 8000}]}, "chain": "7a5d01fb8efe398b2dbe824b768566c12afbe38c661085c1083e70cf0c9085f3a205e619977ffceaf505b6ca45e12cb4", "duration_s": 0.008587, "is_error": false, "jsonrpc_id": 2, "response_sha384": "73864ca9362e6e04a663692676caa11f98e23bb1c7edd3f34bde178ae2a38cce0749b1917021dc464a4d2195967a67cd", "seq": 1, "text_sha384": "59e2951e9ebbe0f1009743c9166f2ba358816bab83da434f83b9cc5152af9d4e5173ffb9cbee6fa65e01dcb8e07e7c83", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:42.867Z", "ts_response": "2026-11-14T01:25:42.876Z"} +{"arguments": {"from": {"coupling": "stardust_entry_to_pica_slab", "request": {"card": "capsule_stardust", "domain": "aerospace", "dt_s": 0.03125, "initial": {"radial_speed_m_s": -2175.4, "radius_m": 6488829.580236817, "transverse_speed_m_s": 12641.2}, "record_every": 720, "segments": [{"load": {}, "steps": 8000}]}, "run_seal": "1fa78aec5d3e09d24456d17b17ae3d5cbe4ad1d98f7f613fe5e80c1b855d017e435fb45dc30ed730eef198f5590ec173"}, "parameters": {"face": "gas_stream", "face_wears": true, "history_flow_enthalpy_j_per_kg": [75923648.0, 75923648.0, 12139213.0, 541897.6875, 80255.8046875, 64982.50390625, 64982.50390625, 64982.50390625], "history_heat_transfer_coefficient_kg_per_m2_s": [0.0, 0.058212701231241226, 0.1558331996202469, 0.06065985932946205, 0.03434406593441963, 0.03284108266234398, 0.0, 0.0], "history_pressure_pa": [5909.919921875, 5909.919921875, 42409.2421875, 6625.830078125, 2544.8134765625, 2450.75341796875, 2450.75341796875, 2450.75341796875], "history_radiative_heating_w_per_m2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], "history_time_s": [0.0, 22.5, 45.0, 67.5, 90.0, 93.6875, 94.6875, 545.0], "material": "PICA, open record, version 3", "return_face_history": false, "return_final_profile": false, "return_thermocouple_histories": false, "start_temperature_k": 281.0, "stream_gas": "air", "surroundings_temperature_k": 294.4, "thermocouple_depths_m": [], "thickness_m": 0.0434}, "solver": "ablator_slab"}, "chain": "2947318c19183bb7a431a867b25ef675a1454c90db36047dc5c8026fd1b201d7b310a4a480eec0be7338410ac65db663", "duration_s": 2.094292, "is_error": false, "jsonrpc_id": 3, "response_sha384": "2a925870b85f468dd8fdae97267a427742d5ff64ae5dbd2800ea96d36b1822cee2a09b1b19d51593d2f8078fa733a9b9", "seq": 2, "text_sha384": "98bf55e17a3d74a59447bfbca7d4964b8ed3a17a43d8291145f24152d0b016ad3327de0a91cedbd97b2894c998dc4e8c", "tool": "solve", "ts_request": "2026-11-14T01:25:42.876Z", "ts_response": "2026-11-14T01:25:44.970Z"} +{"arguments": {"card": "capsule_stardust", "domain": "aerospace", "dt_s": 0.03125, "initial": {"radial_speed_m_s": -2175.4, "radius_m": 6488836.780236816, "transverse_speed_m_s": 12641.2}, "record_every": 720, "segments": [{"load": {}, "steps": 8000}]}, "chain": "1c3f8613961c75d7a16d519057de06a1b7b190c084049531119be965860cc0fe3acb1e495f433e1ef1094ec584f6d0e2", "duration_s": 0.007261, "is_error": false, "jsonrpc_id": 4, "response_sha384": "312ea84124bcc6a63e1b31468bb2eddb568ac030c0adb535d830967929460c19cad33492fdce50d4f02ebec66f205f87", "seq": 3, "text_sha384": "c7e1b51917e21b22b3c1496399c9422f4f6474d9afc92d1a528112904c31d077d2b192668b1bfa762235cfa2d3507de1", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:44.971Z", "ts_response": "2026-11-14T01:25:44.978Z"} +{"arguments": {"from": {"coupling": "stardust_entry_to_pica_slab", "request": {"card": "capsule_stardust", "domain": "aerospace", "dt_s": 0.03125, "initial": {"radial_speed_m_s": -2175.4, "radius_m": 6488836.780236816, "transverse_speed_m_s": 12641.2}, "record_every": 720, "segments": [{"load": {}, "steps": 8000}]}, "run_seal": "abce34b40ba1868cb29f0015f8de509f678546c4dfaad17ae251df0486469b4bdac80244df56c2071b13c31c4db6d6db"}, "parameters": {"face": "gas_stream", "face_wears": true, "history_flow_enthalpy_j_per_kg": [75926248.0, 75926248.0, 12148022.0, 542217.125, 80285.0625, 65003.5703125, 65003.5703125, 65003.5703125], "history_heat_transfer_coefficient_kg_per_m2_s": [0.0, 0.05818302929401398, 0.15585379302501678, 0.0606706440448761, 0.03434683755040169, 0.032843057066202164, 0.0, 0.0], "history_pressure_pa": [5903.89697265625, 5903.89697265625, 42420.40234375, 6628.06396484375, 2545.021240234375, 2450.830078125, 2450.830078125, 2450.830078125], "history_radiative_heating_w_per_m2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], "history_time_s": [0.0, 22.5, 45.0, 67.5, 90.0, 93.6875, 94.6875, 545.0], "material": "PICA, open record, version 3", "return_face_history": false, "return_final_profile": false, "return_thermocouple_histories": false, "start_temperature_k": 281.0, "stream_gas": "air", "surroundings_temperature_k": 294.4, "thermocouple_depths_m": [], "thickness_m": 0.0434}, "solver": "ablator_slab"}, "chain": "504dcf8d6777d85117cfc19ca84e052e42b2f12ddc602fb7bbb9a4d0fa62178585f195fd6b6f73c3ed1dd54fb5488951", "duration_s": 2.121555, "is_error": false, "jsonrpc_id": 5, "response_sha384": "87ecd7876412c173c2dee9af72f964e94f2aadc492565b7da7e9cbe34fde7ba67244810df39b691eb95edd47c3f9df35", "seq": 4, "text_sha384": "c5ed9f4d46407bfb997e4c0422c03cfbe5dc8d9aa08b279d964e1247a2805a27e9c99143c2c517db4c7ed9a313685459", "tool": "solve", "ts_request": "2026-11-14T01:25:44.979Z", "ts_response": "2026-11-14T01:25:47.100Z"} diff --git a/sample/reference/g2-chain-sd-slab-radius-halfchar-h-r7.harness.jsonl.status.json b/sample/reference/g2-chain-sd-slab-radius-halfchar-h-r7.harness.jsonl.status.json new file mode 100644 index 0000000000000000000000000000000000000000..a199b9c4a81933abf440d5968d2ff696c255e15d --- /dev/null +++ b/sample/reference/g2-chain-sd-slab-radius-halfchar-h-r7.harness.jsonl.status.json @@ -0,0 +1,24 @@ +{ + "engine": [ + ".../engine_0.15.3_served/mcp_stdio" + ], + "proxy_pid": 1383, + "started": "2026-11-14T01:25:42.863Z", + "handshake": { + "method": "initialize", + "ok": true, + "server": { + "name": "Zero-Trust Physics", + "title": "Zero-Trust Physics Verifier", + "version": "0.15.3", + "description": "Deterministic physics of real objects: each model compared with measurement or held to a reference calculation, a conservation ledger on every step, a SHA-384 proof on every answer, and a refusal by name where its equations, constants or tables no longer hold. Cards: genesis_kernel_v0.13.1", + "websiteUrl": "https://zerotrustphysics.com" + } + }, + "tools_list": false, + "calls": 4, + "unanswered": 0, + "engine_exit": 0, + "ended": "2026-11-14T01:25:47.102Z", + "problems": [] +} \ No newline at end of file diff --git a/sample/reference/g2-chain-sd-slab-radius-halfchar-h-r7.txt b/sample/reference/g2-chain-sd-slab-radius-halfchar-h-r7.txt new file mode 100644 index 0000000000000000000000000000000000000000..a596989bf31b495998d19f3af6bb0af5898e412a --- /dev/null +++ b/sample/reference/g2-chain-sd-slab-radius-halfchar-h-r7.txt @@ -0,0 +1,3 @@ +The boundary lies between the two designs below; half_char binds. + +{"passing": {"run": {"request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488829.580236817, "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": 8000, "load": {}}], "record_every": 720}}, "proof": "1fa78aec5d3e09d24456d17b17ae3d5cbe4ad1d98f7f613fe5e80c1b855d017e435fb45dc30ed730eef198f5590ec173"}, "solve": {"request": {"tool": "solve", "arguments": {"solver": "ablator_slab", "parameters": {"material": "PICA, open record, version 3", "thickness_m": 0.0434, "start_temperature_k": 281.0, "face": "gas_stream", "stream_gas": "air", "surroundings_temperature_k": 294.4, "face_wears": true, "thermocouple_depths_m": [], "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false, "history_time_s": [0.0, 22.5, 45.0, 67.5, 90.0, 93.6875, 94.6875, 545.0], "history_pressure_pa": [5909.919921875, 5909.919921875, 42409.2421875, 6625.830078125, 2544.8134765625, 2450.75341796875, 2450.75341796875, 2450.75341796875], "history_heat_transfer_coefficient_kg_per_m2_s": [0.0, 0.058212701231241226, 0.1558331996202469, 0.06065985932946205, 0.03434406593441963, 0.03284108266234398, 0.0, 0.0], "history_flow_enthalpy_j_per_kg": [75923648.0, 75923648.0, 12139213.0, 541897.6875, 80255.8046875, 64982.50390625, 64982.50390625, 64982.50390625], "history_radiative_heating_w_per_m2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}, "from": {"request": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488829.580236817, "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": 8000, "load": {}}], "record_every": 720}, "run_seal": "1fa78aec5d3e09d24456d17b17ae3d5cbe4ad1d98f7f613fe5e80c1b855d017e435fb45dc30ed730eef198f5590ec173", "coupling": "stardust_entry_to_pica_slab"}}}, "proof": "8944591b390b2d9995dcb1a1be61b04f621892856ef97dcd58537f920d66d2e9ee56d3d8adb8c2adae41ed224478f86c"}}, "failing": {"run": {"request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488836.780236816, "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": 8000, "load": {}}], "record_every": 720}}, "proof": "abce34b40ba1868cb29f0015f8de509f678546c4dfaad17ae251df0486469b4bdac80244df56c2071b13c31c4db6d6db"}, "solve": {"request": {"tool": "solve", "arguments": {"solver": "ablator_slab", "parameters": {"material": "PICA, open record, version 3", "thickness_m": 0.0434, "start_temperature_k": 281.0, "face": "gas_stream", "stream_gas": "air", "surroundings_temperature_k": 294.4, "face_wears": true, "thermocouple_depths_m": [], "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false, "history_time_s": [0.0, 22.5, 45.0, 67.5, 90.0, 93.6875, 94.6875, 545.0], "history_pressure_pa": [5903.89697265625, 5903.89697265625, 42420.40234375, 6628.06396484375, 2545.021240234375, 2450.830078125, 2450.830078125, 2450.830078125], "history_heat_transfer_coefficient_kg_per_m2_s": [0.0, 0.05818302929401398, 0.15585379302501678, 0.0606706440448761, 0.03434683755040169, 0.032843057066202164, 0.0, 0.0], "history_flow_enthalpy_j_per_kg": [75926248.0, 75926248.0, 12148022.0, 542217.125, 80285.0625, 65003.5703125, 65003.5703125, 65003.5703125], "history_radiative_heating_w_per_m2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}, "from": {"request": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488836.780236816, "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": 8000, "load": {}}], "record_every": 720}, "run_seal": "abce34b40ba1868cb29f0015f8de509f678546c4dfaad17ae251df0486469b4bdac80244df56c2071b13c31c4db6d6db", "coupling": "stardust_entry_to_pica_slab"}}}, "proof": "705c1b2d8ec16c133318905bc8e1d23ea9ab535153210729aec9c9942e18eaa2b52ace04dc2874d53b055d722fbcad6d"}}, "binding": "half_char"} diff --git a/sample/reference/g2-forensics6-07.calls.jsonl b/sample/reference/g2-forensics6-07.calls.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..a53e420af5ef93216e51443fae98963759402f73 --- /dev/null +++ b/sample/reference/g2-forensics6-07.calls.jsonl @@ -0,0 +1,5 @@ +{"tool": "list_cards", "arguments": {}} +{"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "momentum_jwst_srp", "initial": {"h_eci_nms": [-1.244, -0.73, 1.098]}, "dt_s": 1599.0, "segments": [{"steps": 69, "load": {"q1": 0.655763, "q2": -0.008127, "q3": -0.635608, "q4": 0.407321, "sun_x": 0.616092, "sun_y": 0.711198, "sun_z": 0.338568, "sun_distance_au": 1.00863}}], "record_every": 69}} +{"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_insight", "initial": {"radius_m": 3522956.0, "radial_speed_m_s": -1294.7972, "transverse_speed_m_s": 5730.5432}, "dt_s": 0.1, "segments": [{"steps": 2152, "load": {"lift_over_drag": 0.0}}], "record_every": 2152}} +{"tool": "solve", "arguments": {"solver": "ablator_slab", "parameters": {"material": "TACOT 3.0", "thickness_m": 0.0461, "start_temperature_k": 306.3, "thermocouple_depths_m": [], "face": "held_temperature", "held_temperature_k": 1920.0, "hold_duration_s": 60.0, "continue_after_s": 40.0, "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false}}} +{"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "satellite_lageos1", "initial": {"epoch_utc_s": 844014880.0, "forecast_elapsed_s": 0.0, "position_m": [4229354.428, 1727500.405, 11440357.84], "velocity_m_s": [4061.944, -1496.84, -849.917]}, "dt_s": 10.0, "segments": [{"steps": 1742, "load": {}}], "record_every": 1742}} diff --git a/sample/reference/g2-forensics6-07.harness.jsonl b/sample/reference/g2-forensics6-07.harness.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..82c805c3e5bb79d62b324d4c5558e6646893e33e --- /dev/null +++ b/sample/reference/g2-forensics6-07.harness.jsonl @@ -0,0 +1,5 @@ +{"arguments": {}, "chain": "b76e447aa15602f11afdaef3b1316d10ae96476b42a1d277cee90202e3be46a174c3b5782b7f5ba1eabba7c662430f4a", "duration_s": 0.009551, "is_error": false, "jsonrpc_id": 2, "response_sha384": "1653b4602c261a5442b42423ad5a84cfbf53e688fead11f296e871982c972c422db7e281ee8787cb118718dd2352c799", "seq": 1, "text_sha384": "1323103bdb66ce22cff8fd1f439b5c0a19b200864e6c8ee2a3eb5d4384a95bcd8896db76684196004ac411cc307c294c", "tool": "list_cards", "ts_request": "2026-11-14T01:25:53.262Z", "ts_response": "2026-11-14T01:25:53.271Z"} +{"arguments": {"card": "momentum_jwst_srp", "domain": "aerospace", "dt_s": 1599.0, "initial": {"h_eci_nms": [-1.244, -0.73, 1.098]}, "record_every": 69, "segments": [{"load": {"q1": 0.655763, "q2": -0.008127, "q3": -0.635608, "q4": 0.407321, "sun_distance_au": 1.00863, "sun_x": 0.616092, "sun_y": 0.711198, "sun_z": 0.338568}, "steps": 69}]}, "chain": "e1d780e7500bd241d8c4bbb92e72a2f1dfafda5a27a8466862acfdaec613aa023b84d900fd96c01787a0930651f81b7b", "duration_s": 0.001972, "is_error": false, "jsonrpc_id": 3, "response_sha384": "da7eb1ba13117bd51e666e9e5013ce176978f3d6cfa2f6112bcfdbf1e21909740847664a36c8c613d8697c60b1043fc8", "seq": 2, "text_sha384": "3d51f4382fe5f1c22d6e671f07063c70aa5162825e5f2fab6b1478896bf991bb812ded1a0a64e73f42499ca170d6ef5d", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:53.272Z", "ts_response": "2026-11-14T01:25:53.274Z"} +{"arguments": {"card": "capsule_insight", "domain": "aerospace", "dt_s": 0.1, "initial": {"radial_speed_m_s": -1294.7972, "radius_m": 3522956.0, "transverse_speed_m_s": 5730.5432}, "record_every": 2152, "segments": [{"load": {"lift_over_drag": 0.0}, "steps": 2152}]}, "chain": "4fcf91e83c9b8d4b1219f554c2c3af982694f98cdff95f311561df5848c682948a4a5947b37fd372c0285acb2bbc7376", "duration_s": 0.003144, "is_error": false, "jsonrpc_id": 4, "response_sha384": "8a18f6e239e075b3d5cb14d6f7e70021e0be567f7a879e36a283a6c5f0a18244ad74461ecd50204f9163d061d3aad666", "seq": 3, "text_sha384": "b81a3afd0944b479a50015b1866af3580d26fa032fd0b3d8dcd29f9c02e9c3b52484a4f4ee7d4700d2939a3c5c7d7212", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:53.274Z", "ts_response": "2026-11-14T01:25:53.277Z"} +{"arguments": {"parameters": {"continue_after_s": 40.0, "face": "held_temperature", "held_temperature_k": 1920.0, "hold_duration_s": 60.0, "material": "TACOT 3.0", "return_face_history": false, "return_final_profile": false, "return_thermocouple_histories": false, "start_temperature_k": 306.3, "thermocouple_depths_m": [], "thickness_m": 0.0461}, "solver": "ablator_slab"}, "chain": "79692d51845921058f723b2f485b37e5a5fb43294857e9294b69716e96560f5b4f41cebe5bc593bcc9abc90b52adc091", "duration_s": 0.281008, "is_error": false, "jsonrpc_id": 5, "response_sha384": "cffc019122ddbab805061a105fd5e70f090900f09c83f8ad848e8b1f19ea2b876d736335996cbd456b9bdd308be0134d", "seq": 4, "text_sha384": "ed7aecfc30bc17cfe93afe12856f31fd1e283971a41dfbca92de25e93dd20dc057ec828fc96b02baa5e821862e047fec", "tool": "solve", "ts_request": "2026-11-14T01:25:53.278Z", "ts_response": "2026-11-14T01:25:53.559Z"} +{"arguments": {"card": "satellite_lageos1", "domain": "aerospace", "dt_s": 10.0, "initial": {"epoch_utc_s": 844014880.0, "forecast_elapsed_s": 0.0, "position_m": [4229354.428, 1727500.405, 11440357.84], "velocity_m_s": [4061.944, -1496.84, -849.917]}, "record_every": 1742, "segments": [{"load": {}, "steps": 1742}]}, "chain": "6dc4b46c5082ffc256757342f170c1cc6621ddd6aa0676f594f930aa0219a5812afe280ca7f58cddb7477948949dbdce", "duration_s": 0.004451, "is_error": false, "jsonrpc_id": 6, "response_sha384": "b51999f984fd130c7e28c5aaee86d6411fc4ed498d500b7026bd727483c6c40f5325c2e89faaa67e7f80657963588fa4", "seq": 5, "text_sha384": "ca4c4e2a57fc8d330750e2206c439c32ee2fca0e3d32ebe38997611859499209202902792a9a001ce19bca3a50329420", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:53.560Z", "ts_response": "2026-11-14T01:25:53.564Z"} diff --git a/sample/reference/g2-forensics6-07.harness.jsonl.status.json b/sample/reference/g2-forensics6-07.harness.jsonl.status.json new file mode 100644 index 0000000000000000000000000000000000000000..1d943ae4f98f21a8bd3c23afff5961e90f38efd7 --- /dev/null +++ b/sample/reference/g2-forensics6-07.harness.jsonl.status.json @@ -0,0 +1,24 @@ +{ + "engine": [ + ".../engine_0.15.3_served/mcp_stdio" + ], + "proxy_pid": 1393, + "started": "2026-11-14T01:25:53.256Z", + "handshake": { + "method": "initialize", + "ok": true, + "server": { + "name": "Zero-Trust Physics", + "title": "Zero-Trust Physics Verifier", + "version": "0.15.3", + "description": "Deterministic physics of real objects: each model compared with measurement or held to a reference calculation, a conservation ledger on every step, a SHA-384 proof on every answer, and a refusal by name where its equations, constants or tables no longer hold. Cards: genesis_kernel_v0.13.1", + "websiteUrl": "https://zerotrustphysics.com" + } + }, + "tools_list": false, + "calls": 5, + "unanswered": 0, + "engine_exit": 0, + "ended": "2026-11-14T01:25:53.565Z", + "problems": [] +} \ No newline at end of file diff --git a/sample/reference/g2-forensics6-07.txt b/sample/reference/g2-forensics6-07.txt new file mode 100644 index 0000000000000000000000000000000000000000..c03b5804e13a4d513af7de7c17a6b68daad7f059 --- /dev/null +++ b/sample/reference/g2-forensics6-07.txt @@ -0,0 +1,3 @@ +4 of the 12 rows are false. + +{"false_rows": {"R4": "step_wrong", "R5": "seal_wrong", "R8": "flag_altered", "R9": "retired_model"}} diff --git a/sample/reference/g2-forensics7-10.calls.jsonl b/sample/reference/g2-forensics7-10.calls.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..db7fcd9c47026fbf5eb2cfea839f9879cdbef9e7 --- /dev/null +++ b/sample/reference/g2-forensics7-10.calls.jsonl @@ -0,0 +1,5 @@ +{"tool": "list_cards", "arguments": {}} +{"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "solar_system", "initial": {"sun_position_m": [-863637229.4106485, -588455255.8381735, -225852694.17788354], "sun_velocity_m_s": [12.397135730588673, -8.676658356669796, -4.0448914054830265], "mercury_position_m": [30544984580.541214, 31538497612.618702, 13677667513.450943], "mercury_velocity_m_s": [-45893.79576346148, 28907.37310381068, 20202.882077964397], "venus_position_m": [-106439655769.27072, 15156574441.51891, 13539171068.575262], "venus_velocity_m_s": [-6662.526312895438, -31691.929801737846, -13835.48559151052], "earth_position_m": [102407858815.46872, -102611923461.79506, -44458723871.361084], "earth_velocity_m_s": [21351.990015305262, 18497.83118201897, 8019.230891774351], "moon_position_m": [102047097668.78308, -102736187163.71382, -44474590914.85404], "moon_velocity_m_s": [21609.833460848902, 17579.38315631339, 7638.85449892693], "mars_position_m": [-108034816249.35658, 196931821387.40118, 93267362532.8832], "mars_velocity_m_s": [-20818.954980749113, -8043.795945699443, -3126.300559642824], "jupiter_position_m": [419113155659.17053, 572916852927.5242, 235366142766.89377], "jupiter_velocity_m_s": [-10981.451664109512, 7203.166125214057, 3354.981129871713], "saturn_position_m": [810247233830.7081, 1028692408157.641, 390011764585.78156], "saturn_velocity_m_s": [-8280.517996609125, 5149.719611471784, 2483.289801876904], "uranus_position_m": [2242902225084.655, -1790169184837.4873, -815772837485.7194], "uranus_velocity_m_s": [4440.090766223361, 4422.709890451177, 1874.2294942165538], "neptune_position_m": [2597044231109.891, -3383482727434.8364, -1449535655907.9255], "neptune_velocity_m_s": [4405.7539005103245, 2969.8264977576428, 1105.8807943842667], "ceres_position_m": [-322236661229.9761, -227977183777.5967, -41837637472.4793], "ceres_velocity_m_s": [9380.707730841985, -13838.379917110064, -8421.170529908282], "pallas_position_m": [-351293366602.40656, -24289147273.497444, 28702819004.877907], "pallas_velocity_m_s": [-1948.7381903754856, -20307.781285208814, 4156.606512462996], "vesta_position_m": [166331403121.10275, -256906652758.2719, -124134856049.41298], "vesta_velocity_m_s": [18295.602252098583, 9577.160570429965, 1423.2851008847358], "energy_anchor": -1.321940998513625e+25, "booked_work": 0.0, "angular_momentum_anchor": [5.490282510087069e+31, -8.153754585822945e+32, 1.9244191261307657e+33], "booked_torque": [0.0, 0.0, 0.0]}, "dt_s": 1677.0, "segments": [{"steps": 9, "load": {}}, {"steps": 10, "load": {}}, {"steps": 11, "load": {}}, {"steps": 12, "load": {}}, {"steps": 13, "load": {}}, {"steps": 14, "load": {}}, {"steps": 15, "load": {}}], "record_every": 84, "readout": {"quantities": ["earth_mars_distance_m"]}}} +{"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_insight", "initial": {"radius_m": 3519545.0, "radial_speed_m_s": -1340.4281, "transverse_speed_m_s": 5819.933}, "dt_s": 0.1, "segments": [{"steps": 2195, "load": {"lift_over_drag": 0.0}}], "record_every": 2195}} +{"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "crater_ryugu_sci", "initial": {"radius_m": 3.395}, "dt_s": 0.163, "segments": [{"steps": 201, "load": {}}, {"steps": 222, "load": {}}, {"steps": 243, "load": {}}], "record_every": 666}} +{"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488061.0, "radial_speed_m_s": -2105.71, "transverse_speed_m_s": 12576.74}, "dt_s": 0.05, "segments": [{"steps": 3193, "load": {}}], "record_every": 3193, "readout": {"quantities": ["altitude_m"]}}} diff --git a/sample/reference/g2-forensics7-10.harness.jsonl b/sample/reference/g2-forensics7-10.harness.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..900b75f762dd6a751992887e98159e5dd1d1af12 --- /dev/null +++ b/sample/reference/g2-forensics7-10.harness.jsonl @@ -0,0 +1,5 @@ +{"arguments": {}, "chain": "51867eefaa3d9704980319a48ea0498a4f2005669c308177c7a6df263501e39896650bef11b2d224739802d4f282fdb7", "duration_s": 0.009405, "is_error": false, "jsonrpc_id": 2, "response_sha384": "1653b4602c261a5442b42423ad5a84cfbf53e688fead11f296e871982c972c422db7e281ee8787cb118718dd2352c799", "seq": 1, "text_sha384": "1323103bdb66ce22cff8fd1f439b5c0a19b200864e6c8ee2a3eb5d4384a95bcd8896db76684196004ac411cc307c294c", "tool": "list_cards", "ts_request": "2026-11-14T01:25:53.183Z", "ts_response": "2026-11-14T01:25:53.192Z"} +{"arguments": {"card": "solar_system", "domain": "aerospace", "dt_s": 1677.0, "initial": {"angular_momentum_anchor": [5.490282510087069e+31, -8.153754585822945e+32, 1.9244191261307657e+33], "booked_torque": [0.0, 0.0, 0.0], "booked_work": 0.0, "ceres_position_m": [-322236661229.9761, -227977183777.5967, -41837637472.4793], "ceres_velocity_m_s": [9380.707730841985, -13838.379917110064, -8421.170529908282], "earth_position_m": [102407858815.46872, -102611923461.79506, -44458723871.361084], "earth_velocity_m_s": [21351.990015305262, 18497.83118201897, 8019.230891774351], "energy_anchor": -1.321940998513625e+25, "jupiter_position_m": [419113155659.17053, 572916852927.5242, 235366142766.89377], "jupiter_velocity_m_s": [-10981.451664109512, 7203.166125214057, 3354.981129871713], "mars_position_m": [-108034816249.35658, 196931821387.40118, 93267362532.8832], "mars_velocity_m_s": [-20818.954980749113, -8043.795945699443, -3126.300559642824], "mercury_position_m": [30544984580.541214, 31538497612.618702, 13677667513.450943], "mercury_velocity_m_s": [-45893.79576346148, 28907.37310381068, 20202.882077964397], "moon_position_m": [102047097668.78308, -102736187163.71382, -44474590914.85404], "moon_velocity_m_s": [21609.833460848902, 17579.38315631339, 7638.85449892693], "neptune_position_m": [2597044231109.891, -3383482727434.8364, -1449535655907.9255], "neptune_velocity_m_s": [4405.7539005103245, 2969.8264977576428, 1105.8807943842667], "pallas_position_m": [-351293366602.40656, -24289147273.497444, 28702819004.877907], "pallas_velocity_m_s": [-1948.7381903754856, -20307.781285208814, 4156.606512462996], "saturn_position_m": [810247233830.7081, 1028692408157.641, 390011764585.78156], "saturn_velocity_m_s": [-8280.517996609125, 5149.719611471784, 2483.289801876904], "sun_position_m": [-863637229.4106485, -588455255.8381735, -225852694.17788354], "sun_velocity_m_s": [12.397135730588673, -8.676658356669796, -4.0448914054830265], "uranus_position_m": [2242902225084.655, -1790169184837.4873, -815772837485.7194], "uranus_velocity_m_s": [4440.090766223361, 4422.709890451177, 1874.2294942165538], "venus_position_m": [-106439655769.27072, 15156574441.51891, 13539171068.575262], "venus_velocity_m_s": [-6662.526312895438, -31691.929801737846, -13835.48559151052], "vesta_position_m": [166331403121.10275, -256906652758.2719, -124134856049.41298], "vesta_velocity_m_s": [18295.602252098583, 9577.160570429965, 1423.2851008847358]}, "readout": {"quantities": ["earth_mars_distance_m"]}, "record_every": 84, "segments": [{"load": {}, "steps": 9}, {"load": {}, "steps": 10}, {"load": {}, "steps": 11}, {"load": {}, "steps": 12}, {"load": {}, "steps": 13}, {"load": {}, "steps": 14}, {"load": {}, "steps": 15}]}, "chain": "182b1d86b99dded0b984bfa053ad4cc160a944a28eaa93f65830082560935e8e2d9ce07ea60100048027968285a9993a", "duration_s": 0.007759, "is_error": false, "jsonrpc_id": 3, "response_sha384": "f97d3a454eca85b300e4aa0d28d310ae63334ac10eafe48c22ee076b6a1e8da1f0e10f45ffc0b9008bb241558013f2fd", "seq": 2, "text_sha384": "f9b850931bde8adfe9138a06d82c93c2cbcd6a53e835b8159c0edef888c152a239347152c1ef5198783a3a6575dd3beb", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:53.193Z", "ts_response": "2026-11-14T01:25:53.200Z"} +{"arguments": {"card": "capsule_insight", "domain": "aerospace", "dt_s": 0.1, "initial": {"radial_speed_m_s": -1340.4281, "radius_m": 3519545.0, "transverse_speed_m_s": 5819.933}, "record_every": 2195, "segments": [{"load": {"lift_over_drag": 0.0}, "steps": 2195}]}, "chain": "96fd9d435d3efe966bfff4bb8d2d994ade3026434910e670d010fa51530990e023996a600bdf879ea40a4fcba2eb24f1", "duration_s": 0.002853, "is_error": false, "jsonrpc_id": 4, "response_sha384": "b0aa078129c3b090568b2af1117bfd8aa7f9fdf0221dab82bbee944640be1f1ad681c526dd7e80e312bcddb3bf79530d", "seq": 3, "text_sha384": "c49161a9a10da226c8da735b750cd40472b1f26851d001df8e3de3feaf93cea77fa4455bf6b06e03b7c08b4400c06175", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:53.201Z", "ts_response": "2026-11-14T01:25:53.204Z"} +{"arguments": {"card": "crater_ryugu_sci", "domain": "aerospace", "dt_s": 0.163, "initial": {"radius_m": 3.395}, "record_every": 666, "segments": [{"load": {}, "steps": 201}, {"load": {}, "steps": 222}, {"load": {}, "steps": 243}]}, "chain": "0b125731b567c8cb8c5c0085a024b907b50ca1c8016151e58cac155166a679a9ea146a0a7f6d7d4b72dab925ca4df3a4", "duration_s": 0.001209, "is_error": false, "jsonrpc_id": 5, "response_sha384": "4e9effdb764ee62aeee3d9d9cf01741c9cf7d8e69cc063b129b4a64e118b1b40399611df14e88c1df2aefbf7927ee3ba", "seq": 4, "text_sha384": "32b2a8baf1550ccca64974710202590937a95f33caede9f024a781e3bab69c205e3f4d64e47e4f00afeaa73005431951", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:53.204Z", "ts_response": "2026-11-14T01:25:53.205Z"} +{"arguments": {"card": "capsule_stardust", "domain": "aerospace", "dt_s": 0.05, "initial": {"radial_speed_m_s": -2105.71, "radius_m": 6488061.0, "transverse_speed_m_s": 12576.74}, "readout": {"quantities": ["altitude_m"]}, "record_every": 3193, "segments": [{"load": {}, "steps": 3193}]}, "chain": "2b011f732239da2eafbbaf823da208a5a8229bf481c187593e9612cd5f61f69f92c94663dbc5c0e4172ed55f3a17ca00", "duration_s": 0.013183, "is_error": false, "jsonrpc_id": 6, "response_sha384": "ca06bcdfeaa7acc7de04ce4029a26558fa4e86807858114a2e44b85adddbd3dfcb2124a1aaa035e228182648691d4f8a", "seq": 5, "text_sha384": "82a1cfbf34f99c422f475272de24faf160ec62b78ea75126fc4b6337c6b5faf13714e55c4ed5bd292be8a6cf793853b9", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:53.205Z", "ts_response": "2026-11-14T01:25:53.219Z"} diff --git a/sample/reference/g2-forensics7-10.harness.jsonl.status.json b/sample/reference/g2-forensics7-10.harness.jsonl.status.json new file mode 100644 index 0000000000000000000000000000000000000000..a00cd280146c49eb7bcdcb570b6754645d6d7e00 --- /dev/null +++ b/sample/reference/g2-forensics7-10.harness.jsonl.status.json @@ -0,0 +1,24 @@ +{ + "engine": [ + ".../engine_0.15.3_served/mcp_stdio" + ], + "proxy_pid": 1391, + "started": "2026-11-14T01:25:53.177Z", + "handshake": { + "method": "initialize", + "ok": true, + "server": { + "name": "Zero-Trust Physics", + "title": "Zero-Trust Physics Verifier", + "version": "0.15.3", + "description": "Deterministic physics of real objects: each model compared with measurement or held to a reference calculation, a conservation ledger on every step, a SHA-384 proof on every answer, and a refusal by name where its equations, constants or tables no longer hold. Cards: genesis_kernel_v0.13.1", + "websiteUrl": "https://zerotrustphysics.com" + } + }, + "tools_list": false, + "calls": 5, + "unanswered": 0, + "engine_exit": 0, + "ended": "2026-11-14T01:25:53.220Z", + "problems": [] +} \ No newline at end of file diff --git a/sample/reference/g2-forensics7-10.txt b/sample/reference/g2-forensics7-10.txt new file mode 100644 index 0000000000000000000000000000000000000000..0218ac54e53db147947df2a351e36903aa59d06c --- /dev/null +++ b/sample/reference/g2-forensics7-10.txt @@ -0,0 +1,3 @@ +4 of the 10 rows are false. + +{"false_rows": {"R2": "value_altered", "R7": "seal_wrong", "R8": "step_wrong", "R9": "retired_model"}} diff --git a/sample/reference/g2-sd-slab-shallowest-char-load-v3.calls.jsonl b/sample/reference/g2-sd-slab-shallowest-char-load-v3.calls.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..3ee1d60100f53c65d4c426f1825b8ef0facb40ee --- /dev/null +++ b/sample/reference/g2-sd-slab-shallowest-char-load-v3.calls.jsonl @@ -0,0 +1,4 @@ +{"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6501730.0, "radial_speed_m_s": -1970.2359604673798, "transverse_speed_m_s": 12685.610412986882}, "dt_s": 0.03125, "segments": [{"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 3840, "load": {}}], "record_every": 720}} +{"tool": "solve", "arguments": {"solver": "ablator_slab", "parameters": {"material": "PICA, open record, version 3", "thickness_m": 0.0594, "start_temperature_k": 263.6, "face": "gas_stream", "stream_gas": "air", "surroundings_temperature_k": 265.4, "face_wears": true, "thermocouple_depths_m": [], "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false, "history_time_s": [0.0, 22.5, 45.0, 67.5, 90.0, 112.5, 121.9375, 122.9375, 580.0], "history_pressure_pa": [339.1914367675781, 339.1914367675781, 29965.41796875, 22537.322265625, 5747.75341796875, 2572.19921875, 2390.386474609375, 2390.386474609375, 2390.386474609375], "history_heat_transfer_coefficient_kg_per_m2_s": [0.0, 0.013946173712611198, 0.1310727745294571, 0.11351476609706879, 0.05656934529542923, 0.03541867434978485, 0.0322762057185173, 0.0, 0.0], "history_flow_enthalpy_j_per_kg": [78225696.0, 78225696.0, 56615752.0, 6155888.0, 598724.5625, 105872.484375, 62793.7109375, 62793.7109375, 62793.7109375], "history_radiative_heating_w_per_m2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}, "from": {"request": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6501730.0, "radial_speed_m_s": -1970.2359604673798, "transverse_speed_m_s": 12685.610412986882}, "dt_s": 0.03125, "segments": [{"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 3840, "load": {}}], "record_every": 720}, "run_seal": "1180c5d72b6e89bdca7e236309a6a02084ef35fc1663655df36503ad31d467defab0a098606418ed15558cb5ed128706", "coupling": "stardust_entry_to_pica_slab"}}} +{"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6501730.0, "radial_speed_m_s": -1968.6418240960256, "transverse_speed_m_s": 12685.857899977434}, "dt_s": 0.03125, "segments": [{"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 3840, "load": {}}], "record_every": 720}} +{"tool": "solve", "arguments": {"solver": "ablator_slab", "parameters": {"material": "PICA, open record, version 3", "thickness_m": 0.0594, "start_temperature_k": 263.6, "face": "gas_stream", "stream_gas": "air", "surroundings_temperature_k": 265.4, "face_wears": true, "thermocouple_depths_m": [], "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false, "history_time_s": [0.0, 22.5, 45.0, 67.5, 90.0, 112.5, 122.09375, 123.09375, 580.0], "history_pressure_pa": [337.00457763671875, 337.00457763671875, 29798.859375, 22617.865234375, 5777.23681640625, 2577.45849609375, 2390.31005859375, 2390.31005859375, 2390.31005859375], "history_heat_transfer_coefficient_kg_per_m2_s": [0.0, 0.01390114426612854, 0.13070805370807648, 0.11371913552284241, 0.056723203510046005, 0.0354800745844841, 0.03227389603853226, 0.0, 0.0], "history_flow_enthalpy_j_per_kg": [78226040.0, 78226040.0, 56752312.0, 6219895.5, 605393.0, 106824.0078125, 62769.21484375, 62769.21484375, 62769.21484375], "history_radiative_heating_w_per_m2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}, "from": {"request": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6501730.0, "radial_speed_m_s": -1968.6418240960256, "transverse_speed_m_s": 12685.857899977434}, "dt_s": 0.03125, "segments": [{"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 3840, "load": {}}], "record_every": 720}, "run_seal": "ef36a611bb78025f867b14eec165d49d00fbc219ae5d2354c223260eee883e27d74314ced1e6b2d8b825e8c8e058a03c", "coupling": "stardust_entry_to_pica_slab"}}} diff --git a/sample/reference/g2-sd-slab-shallowest-char-load-v3.harness.jsonl b/sample/reference/g2-sd-slab-shallowest-char-load-v3.harness.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..20002c3842c705618778c64d05f43bd18fa2be44 --- /dev/null +++ b/sample/reference/g2-sd-slab-shallowest-char-load-v3.harness.jsonl @@ -0,0 +1,4 @@ +{"arguments": {"card": "capsule_stardust", "domain": "aerospace", "dt_s": 0.03125, "initial": {"radial_speed_m_s": -1970.2359604673798, "radius_m": 6501730.0, "transverse_speed_m_s": 12685.610412986882}, "record_every": 720, "segments": [{"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 3840}]}, "chain": "6b4bcf7c7bcb70518fd96d671115aadaabd9315704754697556ad30b6b528845f906853b3f8e3bf130048a037f4eace5", "duration_s": 0.009759, "is_error": false, "jsonrpc_id": 2, "response_sha384": "d97f4d288413494531f606c218167e2dc6383316ce92e66c080c119fb4324b9c79b21cd324e10b9fd4df318ce0b97449", "seq": 1, "text_sha384": "c9b1b2c76b498f79d84f32f241a88bd03d11c0599ca686f54fe66ba4ea348a5b6c483f130176920c53ff9a4f5f5dd3fa", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:47.141Z", "ts_response": "2026-11-14T01:25:47.150Z"} +{"arguments": {"from": {"coupling": "stardust_entry_to_pica_slab", "request": {"card": "capsule_stardust", "domain": "aerospace", "dt_s": 0.03125, "initial": {"radial_speed_m_s": -1970.2359604673798, "radius_m": 6501730.0, "transverse_speed_m_s": 12685.610412986882}, "record_every": 720, "segments": [{"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 3840}]}, "run_seal": "1180c5d72b6e89bdca7e236309a6a02084ef35fc1663655df36503ad31d467defab0a098606418ed15558cb5ed128706"}, "parameters": {"face": "gas_stream", "face_wears": true, "history_flow_enthalpy_j_per_kg": [78225696.0, 78225696.0, 56615752.0, 6155888.0, 598724.5625, 105872.484375, 62793.7109375, 62793.7109375, 62793.7109375], "history_heat_transfer_coefficient_kg_per_m2_s": [0.0, 0.013946173712611198, 0.1310727745294571, 0.11351476609706879, 0.05656934529542923, 0.03541867434978485, 0.0322762057185173, 0.0, 0.0], "history_pressure_pa": [339.1914367675781, 339.1914367675781, 29965.41796875, 22537.322265625, 5747.75341796875, 2572.19921875, 2390.386474609375, 2390.386474609375, 2390.386474609375], "history_radiative_heating_w_per_m2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], "history_time_s": [0.0, 22.5, 45.0, 67.5, 90.0, 112.5, 121.9375, 122.9375, 580.0], "material": "PICA, open record, version 3", "return_face_history": false, "return_final_profile": false, "return_thermocouple_histories": false, "start_temperature_k": 263.6, "stream_gas": "air", "surroundings_temperature_k": 265.4, "thermocouple_depths_m": [], "thickness_m": 0.0594}, "solver": "ablator_slab"}, "chain": "3eeafcc24877c227864a072ea5e45cea18526a9b546d6284fceaaae2454a42cb137f32d866bf1fa33c12678cb93a3a6e", "duration_s": 2.989892, "is_error": false, "jsonrpc_id": 3, "response_sha384": "9eef066cc935dc6bac87183f4d09999b7ada24fbfaa3332a6ae6e792cf5b4852b0db8bfdc1d9247db53654cbda389a9b", "seq": 2, "text_sha384": "bfbf1fe42307f9a6f7810eace03e48c41fd857baa0f9e08033f0e4375c11608c927f0ed78d8a35cc786f327fbe08c298", "tool": "solve", "ts_request": "2026-11-14T01:25:47.151Z", "ts_response": "2026-11-14T01:25:50.141Z"} +{"arguments": {"card": "capsule_stardust", "domain": "aerospace", "dt_s": 0.03125, "initial": {"radial_speed_m_s": -1968.6418240960256, "radius_m": 6501730.0, "transverse_speed_m_s": 12685.857899977434}, "record_every": 720, "segments": [{"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 3840}]}, "chain": "4f8bdea2a20e6ca70d5f802e66828a71cec76774233c3d40c9755289a7fd5592bd0af6f1be19924ddd1f561e2462e42f", "duration_s": 0.008539, "is_error": false, "jsonrpc_id": 4, "response_sha384": "ca663122bf22202d133115bd3d41837b11a852ddb5f21d15080bb23d49722b4b5ecc9d9de4979d648082b993ba10b0b7", "seq": 3, "text_sha384": "b314e13eaf17c7674c9a60e2309740ac8fdf9c303b59fb9921d45066b270a6b7f298451af2100a605ab01f436c6a82c8", "tool": "run_trajectory", "ts_request": "2026-11-14T01:25:50.142Z", "ts_response": "2026-11-14T01:25:50.150Z"} +{"arguments": {"from": {"coupling": "stardust_entry_to_pica_slab", "request": {"card": "capsule_stardust", "domain": "aerospace", "dt_s": 0.03125, "initial": {"radial_speed_m_s": -1968.6418240960256, "radius_m": 6501730.0, "transverse_speed_m_s": 12685.857899977434}, "record_every": 720, "segments": [{"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 240}, {"load": {}, "steps": 3840}]}, "run_seal": "ef36a611bb78025f867b14eec165d49d00fbc219ae5d2354c223260eee883e27d74314ced1e6b2d8b825e8c8e058a03c"}, "parameters": {"face": "gas_stream", "face_wears": true, "history_flow_enthalpy_j_per_kg": [78226040.0, 78226040.0, 56752312.0, 6219895.5, 605393.0, 106824.0078125, 62769.21484375, 62769.21484375, 62769.21484375], "history_heat_transfer_coefficient_kg_per_m2_s": [0.0, 0.01390114426612854, 0.13070805370807648, 0.11371913552284241, 0.056723203510046005, 0.0354800745844841, 0.03227389603853226, 0.0, 0.0], "history_pressure_pa": [337.00457763671875, 337.00457763671875, 29798.859375, 22617.865234375, 5777.23681640625, 2577.45849609375, 2390.31005859375, 2390.31005859375, 2390.31005859375], "history_radiative_heating_w_per_m2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], "history_time_s": [0.0, 22.5, 45.0, 67.5, 90.0, 112.5, 122.09375, 123.09375, 580.0], "material": "PICA, open record, version 3", "return_face_history": false, "return_final_profile": false, "return_thermocouple_histories": false, "start_temperature_k": 263.6, "stream_gas": "air", "surroundings_temperature_k": 265.4, "thermocouple_depths_m": [], "thickness_m": 0.0594}, "solver": "ablator_slab"}, "chain": "3bc40771466b1aecd092a236daf90c88fb496a54890c78ff947f464f0d194b1e443ad3c745ed8e688f723e4e640c7e07", "duration_s": 2.98596, "is_error": false, "jsonrpc_id": 5, "response_sha384": "cfe8905ac11dc774eec63390a3d02d75f8dac2a04a9bc3655e64c60eac58cae52d2cabdecaaf1ac87e0cf3b87e381bb3", "seq": 4, "text_sha384": "11045ad1d9e4a0230d15a56c4579466306601ec3a8becd17b734ccfbd4c11b3a306830ccbd4cf915bea739cea2ac49ba", "tool": "solve", "ts_request": "2026-11-14T01:25:50.151Z", "ts_response": "2026-11-14T01:25:53.137Z"} diff --git a/sample/reference/g2-sd-slab-shallowest-char-load-v3.harness.jsonl.status.json b/sample/reference/g2-sd-slab-shallowest-char-load-v3.harness.jsonl.status.json new file mode 100644 index 0000000000000000000000000000000000000000..94e1082aeb512b62b4d559f9ad7fa22b95d692f7 --- /dev/null +++ b/sample/reference/g2-sd-slab-shallowest-char-load-v3.harness.jsonl.status.json @@ -0,0 +1,24 @@ +{ + "engine": [ + ".../engine_0.15.3_served/mcp_stdio" + ], + "proxy_pid": 1386, + "started": "2026-11-14T01:25:47.136Z", + "handshake": { + "method": "initialize", + "ok": true, + "server": { + "name": "Zero-Trust Physics", + "title": "Zero-Trust Physics Verifier", + "version": "0.15.3", + "description": "Deterministic physics of real objects: each model compared with measurement or held to a reference calculation, a conservation ledger on every step, a SHA-384 proof on every answer, and a refusal by name where its equations, constants or tables no longer hold. Cards: genesis_kernel_v0.13.1", + "websiteUrl": "https://zerotrustphysics.com" + } + }, + "tools_list": false, + "calls": 4, + "unanswered": 0, + "engine_exit": 0, + "ended": "2026-11-14T01:25:53.139Z", + "problems": [] +} \ No newline at end of file diff --git a/sample/reference/g2-sd-slab-shallowest-char-load-v3.txt b/sample/reference/g2-sd-slab-shallowest-char-load-v3.txt new file mode 100644 index 0000000000000000000000000000000000000000..d87c945d577e172ecd65716ae271f66e734ee9bf --- /dev/null +++ b/sample/reference/g2-sd-slab-shallowest-char-load-v3.txt @@ -0,0 +1,3 @@ +The boundary lies between the two designs below; char_depth binds. + +{"passing": {"run": {"request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6501730.0, "radial_speed_m_s": -1970.2359604673798, "transverse_speed_m_s": 12685.610412986882}, "dt_s": 0.03125, "segments": [{"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 3840, "load": {}}], "record_every": 720}}, "proof": "1180c5d72b6e89bdca7e236309a6a02084ef35fc1663655df36503ad31d467defab0a098606418ed15558cb5ed128706"}, "solve": {"request": {"tool": "solve", "arguments": {"solver": "ablator_slab", "parameters": {"material": "PICA, open record, version 3", "thickness_m": 0.0594, "start_temperature_k": 263.6, "face": "gas_stream", "stream_gas": "air", "surroundings_temperature_k": 265.4, "face_wears": true, "thermocouple_depths_m": [], "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false, "history_time_s": [0.0, 22.5, 45.0, 67.5, 90.0, 112.5, 121.9375, 122.9375, 580.0], "history_pressure_pa": [339.1914367675781, 339.1914367675781, 29965.41796875, 22537.322265625, 5747.75341796875, 2572.19921875, 2390.386474609375, 2390.386474609375, 2390.386474609375], "history_heat_transfer_coefficient_kg_per_m2_s": [0.0, 0.013946173712611198, 0.1310727745294571, 0.11351476609706879, 0.05656934529542923, 0.03541867434978485, 0.0322762057185173, 0.0, 0.0], "history_flow_enthalpy_j_per_kg": [78225696.0, 78225696.0, 56615752.0, 6155888.0, 598724.5625, 105872.484375, 62793.7109375, 62793.7109375, 62793.7109375], "history_radiative_heating_w_per_m2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}, "from": {"request": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6501730.0, "radial_speed_m_s": -1970.2359604673798, "transverse_speed_m_s": 12685.610412986882}, "dt_s": 0.03125, "segments": [{"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 3840, "load": {}}], "record_every": 720}, "run_seal": "1180c5d72b6e89bdca7e236309a6a02084ef35fc1663655df36503ad31d467defab0a098606418ed15558cb5ed128706", "coupling": "stardust_entry_to_pica_slab"}}}, "proof": "7aa9ce40f8bb099404c82343f0377e89de1f19aea553c4709de138de973e4d9181a4be80d2624dba752ed9c65551eb8a"}}, "failing": {"run": {"request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6501730.0, "radial_speed_m_s": -1968.6418240960256, "transverse_speed_m_s": 12685.857899977434}, "dt_s": 0.03125, "segments": [{"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 3840, "load": {}}], "record_every": 720}}, "proof": "ef36a611bb78025f867b14eec165d49d00fbc219ae5d2354c223260eee883e27d74314ced1e6b2d8b825e8c8e058a03c"}, "solve": {"request": {"tool": "solve", "arguments": {"solver": "ablator_slab", "parameters": {"material": "PICA, open record, version 3", "thickness_m": 0.0594, "start_temperature_k": 263.6, "face": "gas_stream", "stream_gas": "air", "surroundings_temperature_k": 265.4, "face_wears": true, "thermocouple_depths_m": [], "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false, "history_time_s": [0.0, 22.5, 45.0, 67.5, 90.0, 112.5, 122.09375, 123.09375, 580.0], "history_pressure_pa": [337.00457763671875, 337.00457763671875, 29798.859375, 22617.865234375, 5777.23681640625, 2577.45849609375, 2390.31005859375, 2390.31005859375, 2390.31005859375], "history_heat_transfer_coefficient_kg_per_m2_s": [0.0, 0.01390114426612854, 0.13070805370807648, 0.11371913552284241, 0.056723203510046005, 0.0354800745844841, 0.03227389603853226, 0.0, 0.0], "history_flow_enthalpy_j_per_kg": [78226040.0, 78226040.0, 56752312.0, 6219895.5, 605393.0, 106824.0078125, 62769.21484375, 62769.21484375, 62769.21484375], "history_radiative_heating_w_per_m2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}, "from": {"request": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6501730.0, "radial_speed_m_s": -1968.6418240960256, "transverse_speed_m_s": 12685.857899977434}, "dt_s": 0.03125, "segments": [{"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 3840, "load": {}}], "record_every": 720}, "run_seal": "ef36a611bb78025f867b14eec165d49d00fbc219ae5d2354c223260eee883e27d74314ced1e6b2d8b825e8c8e058a03c", "coupling": "stardust_entry_to_pica_slab"}}}, "proof": "1208b2ff940f3ba9fc67ac83b53d7c47fa4bf633d61f2fdb02023736aceb6e6016176cf106b054a2e2c5d352fe85bc8e"}}, "binding": "char_depth"} diff --git a/sample/reference/naive_scores.jsonl b/sample/reference/naive_scores.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..d813339375024ec27cc8e382d0d89dbbee3c39f9 --- /dev/null +++ b/sample/reference/naive_scores.jsonl @@ -0,0 +1,5 @@ +{"id": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "kind": "budgeted_search", "calls_from": "harness", "correct": 0, "proofs_hold": 1, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "the holds request comes back refused (AirSpeedOutsideCard)", "computing_calls": 1, "holds_outcome": "refused", "stops_outcome": "refused (AirSpeedOutsideCard)", "engine_binary_sha256_seen": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076", "engine_binary_is_reference": true} +{"id": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "kind": "chained_design", "calls_from": "harness", "correct": 0, "proofs_hold": 1, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's solve is missing", "computing_calls": 1, "engine_binary_sha256_seen": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076", "engine_binary_is_reference": true} +{"id": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "kind": "design_to_limit", "calls_from": "harness", "correct": 0, "proofs_hold": 1, "reward": 0, "graded": 0.0, "verdict": "integrity", "reason": "the passing design's solve is missing", "computing_calls": 1, "engine_binary_sha256_seen": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076", "engine_binary_is_reference": true} +{"id": "g2-forensics7-10", "family": "forensics", "kind": "forensics", "calls_from": "harness", "correct": 0, "proofs_hold": 1, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "4 false row(s) not named", "computing_calls": 1, "named": {}, "engine_binary_sha256_seen": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076", "engine_binary_is_reference": true} +{"id": "g2-forensics6-07", "family": "forensics", "kind": "forensics", "calls_from": "harness", "correct": 0, "proofs_hold": 1, "reward": 0, "graded": 0.0, "verdict": "wrong", "reason": "4 false row(s) not named", "computing_calls": 1, "named": {}, "engine_binary_sha256_seen": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076", "engine_binary_is_reference": true} diff --git a/sample/reference/reference_scores.jsonl b/sample/reference/reference_scores.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..910b8cb0c24d0a6e93fb7a826418d552577b14b8 --- /dev/null +++ b/sample/reference/reference_scores.jsonl @@ -0,0 +1,5 @@ +{"id": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "kind": "budgeted_search", "calls_from": "harness", "correct": 1, "proofs_hold": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "computing_calls": 2, "holds_outcome": "completed", "stops_outcome": "refused (AirSpeedOutsideCard)", "holds_value": -1960.0377171633477, "stops_value": -1959.9495174505687, "width": 0.0881997127789873, "width_ratio": 0.600000000001185, "engine_binary_sha256_seen": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076", "engine_binary_is_reference": true} +{"id": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "kind": "chained_design", "calls_from": "harness", "correct": 1, "proofs_hold": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "computing_calls": 4, "passing": {"x": 6488829.580236817, "met": {"half_char": true, "peak_load": true}, "values": {"half_char": 0.008992161781351305, "peak_load": 49.5781877582101}, "stopped": "PastFlightDeployment", "steps_landed": 2998}, "failing": {"x": 6488836.780236816, "met": {"half_char": false, "peak_load": true}, "values": {"half_char": 0.00899223837130888, "peak_load": 49.57632648317198}, "stopped": "PastFlightDeployment", "steps_landed": 2998}, "width": 7.199999999254942, "width_ratio": 0.5999999999379119, "engine_binary_sha256_seen": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076", "engine_binary_is_reference": true} +{"id": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "kind": "design_to_limit", "calls_from": "harness", "correct": 1, "proofs_hold": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "computing_calls": 4, "passing": {"x": 8.828226247286798, "met": {"char_depth": true, "peak_load": true}, "values": {"char_depth": 0.016982147487637513, "peak_load": 38.260676882045026}, "stopped": "PastFlightDeployment", "steps_landed": 3902}, "failing": {"x": 8.821026247286797, "met": {"char_depth": false, "peak_load": true}, "values": {"char_depth": 0.01699148280192865, "peak_load": 38.197177740146515}, "stopped": "PastFlightDeployment", "steps_landed": 3907}, "width": 0.007200000000000983, "width_ratio": 0.6000000000000819, "engine_binary_sha256_seen": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076", "engine_binary_is_reference": true} +{"id": "g2-forensics7-10", "family": "forensics", "kind": "forensics", "calls_from": "harness", "correct": 1, "proofs_hold": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "computing_calls": 4, "named": {"R2": "value_altered", "R7": "seal_wrong", "R8": "step_wrong", "R9": "retired_model"}, "engine_binary_sha256_seen": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076", "engine_binary_is_reference": true} +{"id": "g2-forensics6-07", "family": "forensics", "kind": "forensics", "calls_from": "harness", "correct": 1, "proofs_hold": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "computing_calls": 4, "named": {"R4": "step_wrong", "R5": "seal_wrong", "R8": "flag_altered", "R9": "retired_model"}, "engine_binary_sha256_seen": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076", "engine_binary_is_reference": true} diff --git a/sample/reports/describe_short.json b/sample/reports/describe_short.json new file mode 100644 index 0000000000000000000000000000000000000000..80d64c58ce1df639b76d32331b8a4ab13b89c472 --- /dev/null +++ b/sample/reports/describe_short.json @@ -0,0 +1,1527 @@ +{ + "ablator_slab": { + "solver": "ablator_slab", + "form": "short", + "summary": "A flat slab of charring heat-shield material heated on one face: wear, face temperature, depth of charring and the heat and mass accounts, for a PICA model built from the open record or the test material TACOT 3.0.", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with 31 arc-jet tests outside the fit: wear within its target on 28 of 31 (target 25), mean \u22125.3 percent over all 31 (\u22122.6 over the 30 without the pure-nitrogen test; target within 8); hottest face within 7 percent on 24 of 28 (target 23); Stardust wear 7.58 and 3.32 mm against 5.7 and 3.2; fed by capsule_stardust through stardust_entry_to_pica_slab, nose wear 4.65 mm and face within 156 K RMS of the airborne spectra. Gap: the face runs 4.1 percent hot on average (target 3.5), and Stardust nose wear is a third high.", + "inputs": [ + { + "name": "material", + "type": "string", + "allowed": [ + "TACOT 3.0", + "PICA, open record, version 5", + "PICA, open record, version 4", + "PICA, open record, version 3", + "PICA, open record" + ] + }, + { + "name": "thickness_m", + "type": "number", + "minimum": 0.0002, + "maximum": 1.0, + "unit": "m" + }, + { + "name": "start_temperature_k", + "type": "number", + "minimum": 260.0, + "maximum": 800.0, + "unit": "K" + }, + { + "name": "thermocouple_depths_m", + "type": "array of numbers", + "most": 8, + "minimum": 0.0, + "maximum": 1.0, + "unit": "m" + }, + { + "name": "face", + "type": "string", + "allowed": [ + "held_temperature", + "gas_stream" + ] + }, + { + "name": "held_temperature_k", + "type": "number", + "minimum": 260.0, + "maximum": 3300.0, + "unit": "K", + "given_only_when": "'face' is \"held_temperature\"" + }, + { + "name": "hold_duration_s", + "type": "number", + "minimum": 1.0, + "maximum": 3600.0, + "unit": "s", + "given_only_when": "'face' is \"held_temperature\"" + }, + { + "name": "continue_after_s", + "type": "number", + "minimum": 0.0, + "maximum": 3600.0, + "unit": "s", + "given_only_when": "'face' is \"held_temperature\"" + }, + { + "name": "stream_gas", + "type": "string", + "allowed": [ + "air", + "mixture" + ], + "given_only_when": "'face' is \"gas_stream\"" + }, + { + "name": "stream_oxygen_mass_fraction", + "type": "number", + "minimum": 0.0, + "maximum": 1.0, + "unit": "by mass", + "given_only_when": "'stream_gas' is \"mixture\"" + }, + { + "name": "stream_argon_mass_fraction", + "type": "number", + "minimum": 0.0, + "maximum": 1.0, + "unit": "by mass", + "given_only_when": "'stream_gas' is \"mixture\"" + }, + { + "name": "history_time_s", + "type": "array of numbers", + "fewest": 2, + "most": 256, + "minimum": 0.0, + "maximum": 3600.0, + "unit": "s", + "given_only_when": "'face' is \"gas_stream\"" + }, + { + "name": "history_pressure_pa", + "type": "array of numbers", + "fewest": 2, + "most": 256, + "minimum": 1.01325, + "maximum": 101325.0, + "unit": "Pa", + "given_only_when": "'face' is \"gas_stream\"" + }, + { + "name": "history_heat_transfer_coefficient_kg_per_m2_s", + "type": "array of numbers", + "fewest": 2, + "most": 256, + "minimum": 0.0, + "maximum": 1.7976931348623157e+308, + "unit": "kg/m\u00b2/s", + "given_only_when": "'face' is \"gas_stream\"" + }, + { + "name": "history_flow_enthalpy_j_per_kg", + "type": "array of numbers", + "fewest": 2, + "most": 256, + "minimum": 0.0, + "maximum": 1.7976931348623157e+308, + "unit": "J/kg", + "given_only_when": "'face' is \"gas_stream\"" + }, + { + "name": "history_radiative_heating_w_per_m2", + "type": "array of numbers", + "fewest": 2, + "most": 256, + "minimum": 0.0, + "maximum": 1.7976931348623157e+308, + "unit": "W/m\u00b2", + "given_only_when": "'face' is \"gas_stream\"" + }, + { + "name": "surroundings_temperature_k", + "type": "number", + "minimum": 250.0, + "maximum": 3975.0, + "unit": "K", + "given_only_when": "'face' is \"gas_stream\"" + }, + { + "name": "face_wears", + "type": "true or false", + "given_only_when": "'face' is \"gas_stream\"" + }, + { + "name": "return_face_history", + "type": "true or false" + }, + { + "name": "return_thermocouple_histories", + "type": "true or false" + }, + { + "name": "return_final_profile", + "type": "true or false" + } + ], + "returns": { + "result": [ + "material_compared_with_measurement", + "duration_s", + "slab_worn_away", + "wear_m", + "peak_face_temperature_k", + "peak_face_temperature_at_s", + "final_face_temperature_k", + "final_back_temperature_k", + "depth_half_way_to_virgin_m", + "depth_within_2_percent_of_virgin_m", + "heat_from_stream_j_per_m2", + "heat_absorbed_from_radiation_j_per_m2", + "heat_radiated_away_j_per_m2", + "heat_taken_at_face_by_gases_j_per_m2", + "heat_in_through_face_j_per_m2", + "heat_stored_in_solid_j_per_m2", + "heat_taken_by_gas_j_per_m2", + "heat_given_off_by_decomposition_j_per_m2", + "char_enthalpy_removed_j_per_m2", + "solid_mass_lost_kg_per_m2", + "gas_mass_out_kg_per_m2", + "char_mass_removed_kg_per_m2", + "inside_arc_jet_comparison", + "inside_stardust_comparison", + "inside_thermocouple_block_comparison", + "stream_enthalpy_at_cold_wall_j_per_kg", + "cells", + "cells_at_end", + "time_steps", + "hardest_step_newton_passes", + "face_history_time_s", + "face_history_temperature_k", + "face_history_recession_m", + "face_history_char_front_depth_m", + "face_history_virgin_front_depth_m", + "face_history_gas_mass_flux_kg_per_m2_s", + "face_history_char_mass_flux_kg_per_m2_s", + "thermocouple_depth_m", + "thermocouple_passed_by_face", + "thermocouple_covered_until_s", + "thermocouple_time_s", + "thermocouple_temperature_k", + "final_profile_depth_m", + "final_profile_temperature_k", + "final_profile_density_kg_per_m3" + ], + "invariants": [ + "energy_account_residual_j_per_m2", + "energy_account_tolerance_j_per_m2", + "face_balance_residual_j_per_m2", + "face_balance_tolerance_j_per_m2", + "mass_account_residual_kg_per_m2", + "mass_account_tolerance_kg_per_m2" + ] + }, + "refusals": [ + "ThicknessOutOfRange", + "StartTemperatureOutOfRange", + "HeldTemperatureOutOfRange", + "HoldDurationOutOfRange", + "ContinueAfterOutOfRange", + "TooManyThermocouples", + "ThermocoupleOutsideSlab", + "StepNotConverged", + "NonFiniteValue", + "TemperatureOutOfBounds", + "DecompositionRanBackwards", + "MassAccountBroken", + "EnergyAccountBroken", + "HistoryRowsOutOfRange", + "HistoryTimesOutOfOrder", + "HistoryDurationOutOfRange", + "HistoryRowsTooClose", + "StreamPressureOutOfRange", + "HeatTransferCoefficientOutOfRange", + "FlowEnthalpyOutOfRange", + "RadiativeHeatingOutOfRange", + "SurroundingsTemperatureOutOfRange", + "ContinueAfterWithStream", + "FaceBeyondSurfaceTable", + "FaceMovedBackward", + "UnknownMaterial", + "StreamOxygenNotAMassFraction", + "StreamArgonNotAMassFraction", + "StreamOxygenAndArgonAboveOne", + "StreamNotAirForThisMaterial", + "SurfaceChemistryNotConverged", + "SurfaceBundleUnreadable", + "FaceOutranItsCell", + "FlowEnthalpyBelowWall", + "UnknownFace", + "UnknownStreamGas" + ], + "examples": [ + "example_solve", + "example_solve_arc_jet_test", + "example_solve_stardust_near_nose" + ], + "example_solve": { + "solver": "ablator_slab", + "parameters": { + "material": "TACOT 3.0", + "thickness_m": 0.05, + "start_temperature_k": 298.0, + "thermocouple_depths_m": [ + 0.001, + 0.002, + 0.004, + 0.008, + 0.016, + 0.05 + ], + "face": "held_temperature", + "held_temperature_k": 1644.0, + "hold_duration_s": 60.0, + "continue_after_s": 0.0, + "return_face_history": false, + "return_thermocouple_histories": false, + "return_final_profile": false + } + }, + "full_form": "This is the short form: inputs are the keys of parameters, and solve takes a name under examples as example in place of parameters. describe_solver with form \"full\", or with no form, has each input's bound in words, what each returned name holds and its unit, the invariants and their tolerances, each refusal's meaning, the validation record or the reference, and every worked example." + }, + "aerospace/capsule_insight": { + "domain": "aerospace", + "card": "capsule_insight", + "form": "short", + "specimen": "Entry of NASA's InSight capsule at Mars on 26 November 2018, as a point mass with the 2008 Phoenix drag database, no wind, and the lift over drag as the load: altitude, speed through the air, Mach number, dynamic pressure and load, from the top of the atmosphere to the flown parachute deployment.", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with the last 59 s before the parachute, not in the fit: speed within 7.2 m/s RMS, radius within 245 m and deceleration within 0.031 g over the 58 whole seconds; at the flight's deployment time the radius within 114 m (target 3.5 km) and Mach 1.501 against 1.522 (target 0.2); the deployment speed reached 1.31 s late and the radius 0.58 s early (target 15.1 s). Gap: with no lift the run reaches the flight's radius at the parachute 22.8 s late and is 4.24 km high there (targets 15.1 s and 3.5 km); between 36 and 65 km the card's air is 8 to 13 percent denser than the flight's, and the peak load comes 4.0 s early.", + "phase_fields": [ + { + "name": "radius_m", + "unit": "m", + "minimum": null, + "maximum": null + }, + { + "name": "radial_speed_m_s", + "unit": "m/s", + "minimum": null, + "maximum": null + }, + { + "name": "transverse_speed_m_s", + "unit": "m/s", + "minimum": null, + "maximum": null + } + ], + "load_fields": [ + { + "name": "lift_over_drag", + "unit": "1", + "minimum": -0.08, + "maximum": 0.08 + } + ], + "dt_s": { + "unit": "s", + "floor_s": 9.5367431640625e-08, + "ceiling_s": 0.1 + }, + "stops": [ + "NonFiniteInput", + "NonFiniteState", + "NonPositiveDt", + "InvalidCapsule", + "LiftOutsideCard", + "AltitudeOutsideCard", + "BelowLandingSite", + "MachOutsideCard", + "AirSpeedOutsideCard", + "PastFlightDeployment", + "SpontaneousGeneration", + "FirstLawBreach", + "DtBelowFloor", + "DtAboveCeiling" + ], + "declared_ends": [ + "PastFlightDeployment" + ], + "continues_with_from": true, + "example_run_trajectory": { + "domain": "aerospace", + "card": "capsule_insight", + "initial": { + "radius_m": 3522199.9999655997, + "radial_speed_m_s": -1202.1585438056352, + "transverse_speed_m_s": 5633.705477158609 + }, + "dt_s": 0.1, + "segments": [ + { + "steps": 2000, + "load": { + "lift_over_drag": -0.031 + } + } + ], + "record_every": 10 + }, + "full_form": "Short form: phase_fields are initial's keys, load_fields each segment's load keys, a null bound is given in words in full, stops are refusal names. describe_card with form \"full\" or none has each bound's reason, the validation record, the frame layout and each stop's meaning." + }, + "aerospace/capsule_stardust": { + "domain": "aerospace", + "card": "capsule_stardust", + "form": "short", + "specimen": "Entry of the Stardust sample return capsule on 15 January 2006, as a point mass with tabulated drag, no lift, no wind and a yearly standard atmosphere: altitude, speed through the air, Mach number, load, heat flux, and at the nose the stagnation pressure, recovery enthalpy and heat-transfer coefficient a heat shield takes, from entry interface to the drogue-deployment condition the radar recorded.", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with NASA's reconstruction of the entry and the radar record of parachute opening: peak load 32.17 g against 32.89 g, within 0.72 g (target 3.64 g); the drogue altitude, 31.03 km, reached at 138.909 s and Mach 1.23 at 136.953 s against 137.9 s recorded, within 1.01 s (target 7.4 s). Gap: heat flux 696 W/cm2 against NASA's computed 762 to 1000; the yearly standard atmosphere in place of that morning's air is worth about 1 g of peak load either way.", + "phase_fields": [ + { + "name": "radius_m", + "unit": "m", + "minimum": null, + "maximum": null + }, + { + "name": "radial_speed_m_s", + "unit": "m/s", + "minimum": null, + "maximum": null + }, + { + "name": "transverse_speed_m_s", + "unit": "m/s", + "minimum": null, + "maximum": null + } + ], + "load_fields": [], + "dt_s": { + "unit": "s", + "floor_s": 4.76837158203125e-08, + "ceiling_s": 0.05 + }, + "stops": [ + "NonFiniteInput", + "NonFiniteState", + "NonPositiveDt", + "InvalidCapsule", + "AltitudeOutsideCard", + "BelowStandardSeaLevel", + "MachOutsideCard", + "AirSpeedOutsideCard", + "PastFlightDeployment", + "SpontaneousGeneration", + "FirstLawBreach", + "DtBelowFloor", + "DtAboveCeiling" + ], + "declared_ends": [ + "PastFlightDeployment" + ], + "continues_with_from": true, + "example_run_trajectory": { + "domain": "aerospace", + "card": "capsule_stardust", + "initial": { + "radius_m": 6503140.0, + "radial_speed_m_s": -1842.1416729435698, + "transverse_speed_m_s": 12767.792058801891 + }, + "dt_s": 0.05, + "segments": [ + { + "steps": 400, + "load": {} + } + ], + "record_every": 10 + }, + "full_form": "Short form: phase_fields are initial's keys, load_fields each segment's load keys, a null bound is given in words in full, stops are refusal names. describe_card with form \"full\" or none has each bound's reason, the validation record, the frame layout and each stop's meaning." + }, + "aerospace/crater_ryugu_sci": { + "domain": "aerospace", + "card": "crater_ryugu_sci", + "form": "short", + "specimen": "Growth of the crater made on asteroid Ryugu by the 2 kg copper impactor of Hayabusa2 on 5 April 2019, by the law of crater size for dry sand held by gravity, with a laboratory clock: the radius at the level of the undisturbed surface from 0.1622 m until it stops, with no load.", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with the measured crater on Ryugu, not in the fit, with the law fitted on all thirteen laboratory craters: final radius 8.571 m against the apparent radius of 7.25 m, within 1.32 m, 18.2 percent (allowance 0.97 m); in the laboratory, with the law fitted again on the nine craters at 1 g alone, the four centrifuge craters within 6.9 to 9.5 percent, mean 7.9 percent (target 10), each inside its 95 percent prediction interval. Gap: on Ryugu the card stops 1.32 m, 18.2 percent, above the measured apparent radius, outside the allowance of 0.97 m; the growth and its clock, read by eye at 1 g, have no measurement of Ryugu to meet.", + "phase_fields": [ + { + "name": "radius_m", + "unit": "m", + "minimum": 0.1622, + "maximum": 8.571304329477922 + } + ], + "load_fields": [], + "dt_s": { + "unit": "s", + "floor_s": 2.384185791015625e-07, + "ceiling_s": 0.25 + }, + "stops": [ + "NonFiniteInput", + "NonFiniteState", + "NonPositiveDt", + "InvalidCrater", + "RadiusBelowLedgerResolution", + "RadiusAboveFinal", + "WallMovingInward", + "SpontaneousGeneration", + "FirstLawBreach", + "DtBelowFloor", + "DtAboveCeiling", + "ContinuationNotOnCard" + ], + "declared_ends": [ + "RadiusAboveFinal" + ], + "continues_with_from": true, + "example_run_trajectory": { + "domain": "aerospace", + "card": "crater_ryugu_sci", + "initial": { + "radius_m": 1.75 + }, + "dt_s": 0.25, + "segments": [ + { + "steps": 1600, + "load": {} + } + ], + "record_every": 100 + }, + "full_form": "Short form: phase_fields are initial's keys, load_fields each segment's load keys, a null bound is given in words in full, stops are refusal names. describe_card with form \"full\" or none has each bound's reason, the validation record, the frame layout and each stop's meaning." + }, + "aerospace/los_jwst_fine_guide": { + "domain": "aerospace", + "card": "los_jwst_fine_guide", + "form": "short", + "specimen": "The line of sight of the James Webb Space Telescope in quiet fine guide, read by its Fine Guidance Sensor every 64 ms: a Kalman filter through one fine-guide file's flight centroids, giving on both axes the next centroid and its stated variance.", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with the 795,021 quiet frames of 134 files not in the fit: error one frame ahead 0.510 mas on x and 0.472 on y RMS, within 0.790 and 0.807 of the last centroid's (target 0.85); squared error over the stated variance 1.004 and 0.986 (target 0.67 to 1.50). Gap: inside disturbances it is worse than the last centroid, 2.03 against 1.00 mas on x and 1.57 against 0.78 on y, its stated variance 12 to 17 times too small; it flags those frames.", + "phase_fields": [ + { + "name": "lock_x_arcsec", + "unit": "arcsec", + "minimum": -70.0, + "maximum": 70.0 + }, + { + "name": "lock_y_arcsec", + "unit": "arcsec", + "minimum": -70.0, + "maximum": 70.0 + }, + { + "name": "quiet_before_start_s", + "unit": "s", + "minimum": 0.0, + "maximum": null + } + ], + "load_fields": [ + { + "name": "measured", + "unit": "1", + "minimum": 0.0, + "maximum": 1.0 + }, + { + "name": "centroid_x_arcsec", + "unit": "arcsec", + "minimum": null, + "maximum": null + }, + { + "name": "centroid_y_arcsec", + "unit": "arcsec", + "minimum": null, + "maximum": null + }, + { + "name": "counts_per_s", + "unit": "counts/s", + "minimum": 0.0, + "maximum": null + } + ], + "dt_s": { + "unit": "s", + "floor_s": 0.0635, + "ceiling_s": 0.0645 + }, + "stops": [ + "NonFiniteInput", + "NonFiniteState", + "NonPositiveDt", + "InvalidObservatory", + "LockOutsideSensorField", + "QuietBeforeStartBelowZero", + "InvalidCovariance", + "MeasuredNotZeroOrOne", + "UnmeasuredFrameCarriesNumbers", + "CountRateNotPositive", + "OffsetOutsideCard", + "SpontaneousGeneration", + "FirstLawBreach", + "DtBelowFloor", + "DtAboveCeiling", + "ContinuationNotOnCard" + ], + "declared_ends": [], + "continues_with_from": false, + "example_run_trajectory": { + "domain": "aerospace", + "card": "los_jwst_fine_guide", + "initial": { + "lock_x_arcsec": 17.3039684, + "lock_y_arcsec": -15.2342768, + "quiet_before_start_s": 30.016 + }, + "dt_s": 0.064, + "segments": [ + { + "steps": 1, + "load": { + "measured": 1.0, + "centroid_x_arcsec": 17.3038845, + "centroid_y_arcsec": -15.2345047, + "counts_per_s": 553666.4 + } + }, + { + "steps": 1, + "load": { + "measured": 1.0, + "centroid_x_arcsec": 17.3043156, + "centroid_y_arcsec": -15.234498, + "counts_per_s": 548737.25 + } + }, + { + "steps": 1, + "load": { + "measured": 1.0, + "centroid_x_arcsec": 17.3045425, + "centroid_y_arcsec": -15.234539, + "counts_per_s": 549291.063 + } + }, + { + "steps": 1, + "load": { + "measured": 1.0, + "centroid_x_arcsec": 17.3039627, + "centroid_y_arcsec": -15.23488, + "counts_per_s": 553444.8 + } + }, + { + "steps": 1, + "load": { + "measured": 1.0, + "centroid_x_arcsec": 17.303978, + "centroid_y_arcsec": -15.2349653, + "counts_per_s": 547832.7 + } + }, + { + "steps": 1, + "load": { + "measured": 1.0, + "centroid_x_arcsec": 17.3033333, + "centroid_y_arcsec": -15.2353725, + "counts_per_s": 547648.063 + } + }, + { + "steps": 1, + "load": { + "measured": 1.0, + "centroid_x_arcsec": 17.3037148, + "centroid_y_arcsec": -15.2351408, + "counts_per_s": 547629.563 + } + }, + { + "steps": 1, + "load": { + "measured": 1.0, + "centroid_x_arcsec": 17.303875, + "centroid_y_arcsec": -15.2350893, + "counts_per_s": 546318.9 + } + } + ], + "record_every": 1 + }, + "full_form": "Short form: phase_fields are initial's keys, load_fields each segment's load keys, a null bound is given in words in full, stops are refusal names. describe_card with form \"full\" or none has each bound's reason, the validation record, the frame layout and each stop's meaning." + }, + "aerospace/momentum_jwst_dihedral": { + "domain": "aerospace", + "card": "momentum_jwst_dihedral", + "form": "short", + "specimen": "Total angular momentum of the James Webb Space Telescope at Sun-Earth L2, held by its reaction wheels between momentum unloads under sunlight pressure on its sunshield, from its attitude quaternion and the Sun's direction and distance: the first layer as two plane slopes of 110 m\u00b2 meeting along a ridge on the boresight, each falling 4.03 degrees towards the Sun, so that the Sun's roll turns into torque about the boresight.", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with the two months after the fit: the daily growth of |H| within 0.1 of the observed plus 0.2 N m s on 25 of 28 and 22 of 30 days (target 80 percent); the hourly growth rate within 0.272 and 0.375 of its spread RMS (target 0.5); the torque within 0.144 and 0.149 of the RMS torque (target 0.4); |H| at a run's end within 4.9 percent over 3.9 to 12.4 days and 5.5 percent after 29.3 days (target 10). Gap: the daily change of the vector H is within that allowance on 18 of 28 and 13 of 30 days (target 80 percent), 0.42 N m s RMS against momentum_jwst_srp's 0.81; beyond 2 degrees of roll its torque about J3 is off by 11 and 10.4 \u00b5N m RMS.", + "phase_fields": [ + { + "name": "h_eci_nms", + "unit": "N m s", + "components": 3, + "minimum": null, + "maximum": null + } + ], + "load_fields": [ + { + "name": "q1", + "unit": "1", + "minimum": -1.000001, + "maximum": 1.000001 + }, + { + "name": "q2", + "unit": "1", + "minimum": -1.000001, + "maximum": 1.000001 + }, + { + "name": "q3", + "unit": "1", + "minimum": -1.000001, + "maximum": 1.000001 + }, + { + "name": "q4", + "unit": "1", + "minimum": -1.000001, + "maximum": 1.000001 + }, + { + "name": "sun_x", + "unit": "1", + "minimum": -1.000001, + "maximum": 1.000001 + }, + { + "name": "sun_y", + "unit": "1", + "minimum": -1.000001, + "maximum": 1.000001 + }, + { + "name": "sun_z", + "unit": "1", + "minimum": -1.000001, + "maximum": 1.000001 + }, + { + "name": "sun_distance_au", + "unit": "au", + "minimum": 0.0, + "minimum_exclusive": true, + "maximum": null + } + ], + "dt_s": { + "unit": "s", + "floor_s": 0.04789875061146542, + "ceiling_s": 50225.48032116796 + }, + "stops": [ + "NonFiniteInput", + "NonFiniteState", + "NonPositiveDt", + "InvalidObservatory", + "QuaternionNotUnit", + "SunDirectionNotUnit", + "SunDistanceNotPositive", + "SunDistanceInsideSun", + "SunBehindSunshield", + "SunshieldAboveKaptonLimit", + "AngularMomentumBreach", + "SpontaneousGeneration", + "FirstLawBreach", + "DtBelowFloor", + "DtAboveCeiling" + ], + "declared_ends": [], + "continues_with_from": true, + "example_run_trajectory": { + "domain": "aerospace", + "card": "momentum_jwst_dihedral", + "initial": { + "h_eci_nms": [ + -1.4853731309945153, + -0.6656560404607257, + 1.1653501123098389 + ] + }, + "dt_s": 60.0, + "segments": [ + { + "steps": 60, + "load": { + "q1": 0.7216001749, + "q2": 0.0366541296, + "q3": -0.5597470999, + "q4": 0.4057497233, + "sun_x": 0.6160922205743601, + "sun_y": 0.7226624561625701, + "sun_z": 0.31335179942172875, + "sun_distance_au": 1.0193963859269388 + } + } + ], + "record_every": 1 + }, + "full_form": "Short form: phase_fields are initial's keys, load_fields each segment's load keys, a null bound is given in words in full, stops are refusal names. describe_card with form \"full\" or none has each bound's reason, the validation record, the frame layout and each stop's meaning." + }, + "aerospace/momentum_jwst_srp": { + "domain": "aerospace", + "card": "momentum_jwst_srp", + "form": "short", + "specimen": "Total angular momentum of the James Webb Space Telescope at Sun-Earth L2, held by its reaction wheels between momentum unloads under sunlight pressure on its sunshield, from its attitude quaternion and the Sun's direction and distance: one sunlit layer of 220 m\u00b2 with JWST's published optical numbers.", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with the three months after the fit: the daily growth of |H| within 0.1 of the observed plus 0.2 N m s on 23 of 28, 15 of 28 and 17 of 30 days (target 80 percent); the hourly growth rate within 0.437, 0.384 and 0.421 of its spread RMS (target 0.5); the torque within 0.262, 0.314 and 0.347 of the RMS torque (target 0.4); |H| at a run's end within 8.4 and 0.9 percent after 10.7 and 16.3 days and 7.4 percent after 29.3 days (target 10). Gap: the daily change of the vector H is within that allowance on 14 of 28, 8 of 28 and 8 of 30 days (target 80 percent): beyond 2 degrees of roll its torque about the boresight is off by about 30 \u00b5N m; |H| after an unload in the second month reads 16.2 percent low at 3.9 days.", + "phase_fields": [ + { + "name": "h_eci_nms", + "unit": "N m s", + "components": 3, + "minimum": null, + "maximum": null + } + ], + "load_fields": [ + { + "name": "q1", + "unit": "1", + "minimum": -1.000001, + "maximum": 1.000001 + }, + { + "name": "q2", + "unit": "1", + "minimum": -1.000001, + "maximum": 1.000001 + }, + { + "name": "q3", + "unit": "1", + "minimum": -1.000001, + "maximum": 1.000001 + }, + { + "name": "q4", + "unit": "1", + "minimum": -1.000001, + "maximum": 1.000001 + }, + { + "name": "sun_x", + "unit": "1", + "minimum": -1.000001, + "maximum": 1.000001 + }, + { + "name": "sun_y", + "unit": "1", + "minimum": -1.000001, + "maximum": 1.000001 + }, + { + "name": "sun_z", + "unit": "1", + "minimum": -1.000001, + "maximum": 1.000001 + }, + { + "name": "sun_distance_au", + "unit": "au", + "minimum": 0.0, + "minimum_exclusive": true, + "maximum": null + } + ], + "dt_s": { + "unit": "s", + "floor_s": 0.04789875061146542, + "ceiling_s": 50225.48032116796 + }, + "stops": [ + "NonFiniteInput", + "NonFiniteState", + "NonPositiveDt", + "InvalidObservatory", + "QuaternionNotUnit", + "SunDirectionNotUnit", + "SunDistanceNotPositive", + "SunDistanceInsideSun", + "SunBehindSunshield", + "SunshieldAboveKaptonLimit", + "AngularMomentumBreach", + "SpontaneousGeneration", + "FirstLawBreach", + "DtBelowFloor", + "DtAboveCeiling" + ], + "declared_ends": [], + "continues_with_from": true, + "example_run_trajectory": { + "domain": "aerospace", + "card": "momentum_jwst_srp", + "initial": { + "h_eci_nms": [ + -1.4853731309945153, + -0.6656560404607257, + 1.1653501123098389 + ] + }, + "dt_s": 60.0, + "segments": [ + { + "steps": 60, + "load": { + "q1": 0.7216001749, + "q2": 0.0366541296, + "q3": -0.5597470999, + "q4": 0.4057497233, + "sun_x": 0.6160922205743601, + "sun_y": 0.7226624561625701, + "sun_z": 0.31335179942172875, + "sun_distance_au": 1.0193963859269388 + } + } + ], + "record_every": 1 + }, + "full_form": "Short form: phase_fields are initial's keys, load_fields each segment's load keys, a null bound is given in words in full, stops are refusal names. describe_card with form \"full\" or none has each bound's reason, the validation record, the frame layout and each stop's meaning." + }, + "aerospace/satellite_lageos1": { + "domain": "aerospace", + "card": "satellite_lageos1", + "form": "short", + "specimen": "Free flight of the laser-ranging satellite LAGEOS-1 from a published position and velocity, in a frame turning with the Earth: the Earth's field to degree and order 12, the Sun and the Moon, the solid tide, sunlight pressure and relativity, with the energy and the angular momentum about the Earth's axis held at every step.", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with the 42 runs of the six weeks outside that choice, two of LAGEOS-1 and four of LAGEOS-2: LAGEOS-1 within 0.65 m of the published orbit after one revolution (target 1 m), 3.8 m after one day (10 m) and 32 m after seven days (100 m); LAGEOS-2 within 0.34 m, 2.9 m and 22 m. Gap: the error grows with the length of a forecast, from 0.65 m after one revolution to 32 m after seven days on LAGEOS-1, as the card carries no drag, no light reflected from the Earth and no ocean tide.", + "phase_fields": [ + { + "name": "epoch_utc_s", + "unit": "s", + "minimum": 536500800.0, + "maximum": 867412799.9999905 + }, + { + "name": "forecast_elapsed_s", + "unit": "s", + "minimum": 0.0, + "maximum": null + }, + { + "name": "position_m", + "unit": "m", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "velocity_m_s", + "unit": "m/s", + "components": 3, + "minimum": null, + "maximum": null + } + ], + "load_fields": [], + "dt_s": { + "unit": "s", + "floor_s": 9.5367431640625e-06, + "ceiling_s": 10.0 + }, + "stops": [ + "NonFiniteInput", + "NonFiniteState", + "NonPositiveDt", + "InvalidSatellite", + "RadiusBelowEarthRadius", + "EpochOutsideLeapSecondSpan", + "ForecastElapsedBelowZero", + "SpontaneousGeneration", + "FirstLawBreach", + "AngularMomentumBreach", + "DtBelowFloor", + "DtAboveCeiling", + "ContinuationWithoutUpstream" + ], + "declared_ends": [], + "continues_with_from": true, + "example_run_trajectory": { + "domain": "aerospace", + "card": "satellite_lageos1", + "initial": { + "epoch_utc_s": 841924800.0, + "forecast_elapsed_s": 0.0, + "position_m": [ + 295558.7678903363, + -5108650.370522532, + -11100383.23606335 + ], + "velocity_m_s": [ + -4821.08544993592, + -3331.9602315669836, + 1405.5539438152634 + ] + }, + "dt_s": 10.0, + "segments": [ + { + "steps": 1356, + "load": {} + } + ], + "record_every": 36 + }, + "full_form": "Short form: phase_fields are initial's keys, load_fields each segment's load keys, a null bound is given in words in full, stops are refusal names. describe_card with form \"full\" or none has each bound's reason, the validation record, the frame layout and each stop's meaning." + }, + "aerospace/solar_system": { + "domain": "aerospace", + "card": "solar_system", + "form": "short", + "specimen": "The Solar System as thirteen point masses in free motion: the Sun, Mercury, Venus, the Earth, the Moon, the barycentres of the Mars, Jupiter, Saturn, Uranus and Neptune systems, and Ceres, Pallas and Vesta, under Newton's and the relativistic forces between every pair and the Earth's oblateness on the Moon. The caller supplies every position and velocity.", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with 10,134 ranges of three spacecraft in four files, not used to choose it, in one run of 7,670 days: Mars Odyssey to 2006 within 695 m (target 700 m), 270 m RMS; Odyssey after 2006 and Mars Reconnaissance Orbiter, out to 15.0 years, 612 and 619 m RMS, worst 1,312 and 1,314 m; MESSENGER at Mercury, 12.3 to 16.2 years out, within 2.08 km (target 2.5 to 4.4 km), 1.42 km RMS. Gap: in mid-2007, 44 Odyssey ranges and 34 Mars Reconnaissance Orbiter ranges are outside their targets, by at most 8 and 10 percent, from the 340 asteroids the card leaves out; the Juno and Cassini files are outside the comparison, as they leave 20 km and 10 km RMS with JPL's own positions.", + "phase_fields": [ + { + "name": "sun_position_m", + "unit": "m", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "sun_velocity_m_s", + "unit": "m/s", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "mercury_position_m", + "unit": "m", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "mercury_velocity_m_s", + "unit": "m/s", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "venus_position_m", + "unit": "m", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "venus_velocity_m_s", + "unit": "m/s", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "earth_position_m", + "unit": "m", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "earth_velocity_m_s", + "unit": "m/s", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "moon_position_m", + "unit": "m", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "moon_velocity_m_s", + "unit": "m/s", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "mars_position_m", + "unit": "m", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "mars_velocity_m_s", + "unit": "m/s", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "jupiter_position_m", + "unit": "m", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "jupiter_velocity_m_s", + "unit": "m/s", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "saturn_position_m", + "unit": "m", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "saturn_velocity_m_s", + "unit": "m/s", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "uranus_position_m", + "unit": "m", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "uranus_velocity_m_s", + "unit": "m/s", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "neptune_position_m", + "unit": "m", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "neptune_velocity_m_s", + "unit": "m/s", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "ceres_position_m", + "unit": "m", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "ceres_velocity_m_s", + "unit": "m/s", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "pallas_position_m", + "unit": "m", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "pallas_velocity_m_s", + "unit": "m/s", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "vesta_position_m", + "unit": "m", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "vesta_velocity_m_s", + "unit": "m/s", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "energy_anchor", + "unit": "m^5/s^4", + "minimum": null, + "maximum": null + }, + { + "name": "booked_work", + "unit": "m^5/s^4", + "minimum": null, + "maximum": null + }, + { + "name": "angular_momentum_anchor", + "unit": "m^5/s^3", + "components": 3, + "minimum": null, + "maximum": null + }, + { + "name": "booked_torque", + "unit": "m^5/s^3", + "components": 3, + "minimum": null, + "maximum": null + } + ], + "load_fields": [], + "dt_s": { + "unit": "s", + "floor_s": 0.87890625, + "ceiling_s": 3600.0 + }, + "stops": [ + "NonFiniteInput", + "NonFiniteState", + "NonPositiveDt", + "InvalidSystem", + "DistanceOutsideCard", + "OrbitOutsideCard", + "BodiesCoincide", + "FrameOutsideCard", + "AxesOutsideCard", + "SpontaneousGeneration", + "FirstLawBreach", + "AngularMomentumBreach", + "DtBelowFloor", + "DtAboveCeiling", + "ContinuationWithoutUpstream" + ], + "declared_ends": [], + "continues_with_from": true, + "example_run_trajectory": { + "domain": "aerospace", + "card": "solar_system", + "initial": { + "sun_position_m": [ + -1248725112.811171, + 27610869.63072595, + 48137495.83829496 + ], + "sun_velocity_m_s": [ + 1.991257260489346, + -14.4420045816918, + -6.232991648306259 + ], + "mercury_position_m": [ + -54959739620.612564, + -34739034562.710144, + -12952097024.96358 + ], + "mercury_velocity_m_s": [ + 17683.59083807344, + -32937.101057214764, + -19426.07856920143 + ], + "venus_position_m": [ + 77393032790.07492, + -66736135199.51423, + -34964599126.811935 + ], + "venus_velocity_m_s": [ + 23974.952177867148, + 23504.595057063358, + 9057.313503792193 + ], + "earth_position_m": [ + -27114553679.253643, + 132885999576.4611, + 57650147986.189026 + ], + "earth_velocity_m_s": [ + -29793.79442089389, + -4924.265176982369, + -2135.5630698527852 + ], + "moon_position_m": [ + -27082679253.72811, + 133229568896.714, + 57768865212.789925 + ], + "moon_velocity_m_s": [ + -30866.171477203872, + -4834.924833645682, + -2042.638065393104 + ], + "mars_position_m": [ + -238815313009.12262, + 65320036889.64328, + 36419272178.069244 + ], + "mars_velocity_m_s": [ + -6327.562782274058, + -19220.612103277228, + -8644.36214475904 + ], + "jupiter_position_m": [ + 739091294160.3148, + 40261266007.14453, + -745200303.3874352 + ], + "jupiter_velocity_m_s": [ + -815.9947235097208, + 12547.37996910138, + 5398.220168827967 + ], + "saturn_position_m": [ + 1165552102589.3708, + 709014149527.9258, + 242695520007.6174 + ], + "saturn_velocity_m_s": [ + -5718.231163285546, + 7411.459233528688, + 3306.9100967619233 + ], + "uranus_position_m": [ + 2005894424916.856, + -2000753337408.4849, + -904650764199.8887 + ], + "uranus_velocity_m_s": [ + 4977.37424953215, + 3943.308946575435, + 1656.6601536241922 + ], + "neptune_position_m": [ + 2370869146902.504, + -3526515351882.3438, + -1502448884368.042 + ], + "neptune_velocity_m_s": [ + 4587.20657983019, + 2717.396366599794, + 998.0438782606243 + ], + "ceres_position_m": [ + 113102746429.3008, + 361147974066.7736, + 146744266009.8253 + ], + "ceres_velocity_m_s": [ + -17524.75132381718, + 2120.6058176880683, + 4566.961725394932 + ], + "pallas_position_m": [ + 413969510387.4615, + 93477204959.91364, + -47166322022.203026 + ], + "pallas_velocity_m_s": [ + -7792.302441953558, + 15256.958876855091, + -2498.893537480062 + ], + "vesta_position_m": [ + -221618355660.36792, + 265655876376.7846, + 134604213038.70992 + ], + "vesta_velocity_m_s": [ + -13792.69196623213, + -11924.88840575639, + -2945.591421372861 + ], + "energy_anchor": -1.3219409984826365e+25, + "booked_work": 0.0, + "angular_momentum_anchor": [ + 5.490282510010517e+31, + -8.153754585546162e+32, + 1.9244191260668455e+33 + ], + "booked_torque": [ + 0.0, + 0.0, + 0.0 + ] + }, + "dt_s": 3600.0, + "segments": [ + { + "steps": 24, + "load": {} + } + ], + "record_every": 4 + }, + "full_form": "Short form: phase_fields are initial's keys, load_fields each segment's load keys, a null bound is given in words in full, stops are refusal names. describe_card with form \"full\" or none has each bound's reason, the validation record, the frame layout and each stop's meaning." + }, + "plasma_sheath_ram_c2": { + "solver": "plasma_sheath_ram_c2", + "form": "short", + "summary": "The plasma sheath around NASA's RAM C-II re-entry probe (a 15.24 cm hemisphere on a 9 degree cone) at one flight point: the equilibrium normal shock and stagnation point of 11-species air, the gas carried along the body to the nose station (x/D 0.15) and the cone station (x/D 0.76) with Dunn and Kang's 26 reactions at finite rate, the electron density, the plasma frequency, and whether a radio signal of the asked frequency is blacked out at each.", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with the reflectometer onsets of NASA TN D-6062 Table X at 7.65 km/s: electron density 0.94 of the measured, within a factor of 1.07, at the cone station's X band at 70.0 km; 3.28 and 2.92 times the measured at 77.7 and 80.0 km. Gap: above 73.6 km, where the shock is as thick as the layer and electrons are lost to the cold wall, the density reads about 3 times high (3.28 at 77.7 km, 2.92 at 80.0 km).", + "inputs": [ + { + "name": "altitude_m", + "type": "number", + "minimum": 0.0, + "maximum": 80637.0, + "unit": "m" + }, + { + "name": "velocity_m_s", + "type": "number", + "minimum": 0.0, + "minimum_exclusive": true, + "maximum": 20000.0, + "unit": "m/s" + }, + { + "name": "signal_frequency_hz", + "type": "number", + "minimum": 1000000.0, + "maximum": 1e+150, + "unit": "Hz" + } + ], + "returns": { + "result": [ + "freestream_temperature_k", + "freestream_pressure_pa", + "freestream_density_kg_m3", + "mach_number", + "knudsen_number", + "shock_as_thick_as_layer", + "shock_temperature_k", + "shock_pressure_pa", + "shock_density_kg_m3", + "shock_density_ratio", + "shock_electron_density_m3", + "stagnation_temperature_k", + "stagnation_pressure_pa", + "stagnation_density_kg_m3", + "stagnation_electron_density_m3", + "stagnation_plasma_frequency_hz", + "stagnation_velocity_gradient_per_s", + "signal_critical_density_m3", + "signal_blacked_out_at_stagnation", + "station1_pressure_pa", + "station1_temperature_k", + "station1_velocity_m_s", + "station1_electron_density_m3", + "station1_electron_density_resolved", + "station1_plasma_frequency_hz", + "station1_equilibrium_electron_density_m3", + "station1_equilibrium_temperature_k", + "station1_frozen_electron_density_m3", + "station1_frozen_temperature_k", + "station1_transit_time_s", + "station1_signal_blacked_out", + "station2_pressure_pa", + "station2_temperature_k", + "station2_velocity_m_s", + "station2_electron_density_m3", + "station2_electron_density_resolved", + "station2_plasma_frequency_hz", + "station2_equilibrium_electron_density_m3", + "station2_equilibrium_temperature_k", + "station2_frozen_electron_density_m3", + "station2_frozen_temperature_k", + "station2_transit_time_s", + "station2_signal_blacked_out", + "step_tolerance" + ], + "invariants": [ + "shock_mass_residual", + "shock_momentum_residual", + "shock_energy_residual", + "stagnation_enthalpy_residual", + "stagnation_entropy_residual", + "streamline_nuclei_residual", + "streamline_charge_residual", + "streamline_energy_residual", + "streamline_entropy_fall" + ] + }, + "refusals": [ + "NonFiniteValue", + "AltitudeBelowSeaLevel", + "RarefiedFlow", + "NoBowShock", + "VelocityPastFits", + "SignalFrequencyBelowResolution", + "SignalFrequencyBeyondArithmetic", + "TemperatureAboveFits", + "TemperatureBelowFits", + "EquilibriumNotFound", + "ShockNotFound", + "StagnationStateNotFound", + "StreamlineStalled", + "NotSettled", + "ShockLedgerBroken", + "StagnationLedgerBroken", + "NucleiNotConserved", + "ChargeNotNeutral", + "EnergyLedgerBroken", + "EntropyFell" + ], + "examples": [ + "example_solve", + "example_solve_s_band", + "example_solve_glide_gps" + ], + "example_solve": { + "solver": "plasma_sheath_ram_c2", + "parameters": { + "altitude_m": 71000.0, + "velocity_m_s": 7650.0, + "signal_frequency_hz": 9210000000.0 + } + }, + "full_form": "This is the short form: inputs are the keys of parameters, and solve takes a name under examples as example in place of parameters. describe_solver with form \"full\", or with no form, has each input's bound in words, what each returned name holds and its unit, the invariants and their tolerances, each refusal's meaning, the validation record or the reference, and every worked example." + } +} diff --git a/sample/reports/g2-budget-sd-airspeed-sink-e-t3.html b/sample/reports/g2-budget-sd-airspeed-sink-e-t3.html new file mode 100644 index 0000000000000000000000000000000000000000..3d6b084080f4430d79eaab5978f5c5cc6a696171 --- /dev/null +++ b/sample/reports/g2-budget-sd-airspeed-sink-e-t3.html @@ -0,0 +1,104 @@ + +Task report: g2-budget-sd-airspeed-sink-e-t3 +

g2-budget-sd-airspeed-sink-e-t3

+

Multi-step physics RLVR task scored by deterministic recomputation on the Zero-Trust Physics verifier.

+

Budgeted search · models aerospace/capsule_stardust · Zero-Trust Physics v0.15.3 · Protocol Company

+

Checksums

+ + +
Whatsha256SHA-384
Task row4559af9ec6da8de3222aeac4fa145e8ae24e218b71b019b602e36246c55034c94c80776dc378202d6610e7806aae6e6bc8995ed2af61c3e9aebe0e9519009cf8f389e564ff71e96ee639f0ee11732a94
Harbor directorya0cce3ce7940097238e77d9fea5fe57f764c987879768eac43feb9799d1ed1cedce078617db66570521e3d603a5060b23ca75a1dd0c20703234affd8a3c0f57692bc8f7e0f6b1efe019b7024fe4a71cd
+

Instruction

The Stardust sample return capsule enters the Earth's air at 6495650 m from the Earth's centre, with a transverse speed of 12604.2 m/s and a radial (sink) speed that you set (negative, downward), and is followed for 71 s (1420 steps of 0.05 s). Above some radial velocity (a shallower entry, smaller downward sink magnitude) the speed through the air leaves the card's drag table before the run's end and the run is stopped (AirSpeedOutsideCard). Find the radial speed at which that begins, in m/s.
+
+Bracket it: give a value that completes and a value that stops with AirSpeedOutsideCard, no more than 0.0075 percent of the value apart. It lies between -2000 and -1910 m/s.
+
+The request, with <x> the one input you change:
+{"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6495650.0, "radial_speed_m_s": "<x>", "transverse_speed_m_s": 12604.2}, "dt_s": 0.05, "segments": [{"steps": 1420, "load": {}}], "record_every": 1420}}
+
+Budget: at most 3 calls that compute, counted over every call you make; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Both requests on your card must be among your calls.
+
+You have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.
+
+End your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {"tool": "<the tool's name as the verifier names it, without any prefix your own program adds>", "arguments": {<the arguments exactly as you sent them>}}, and a proof is the run_seal or solution_seal the verifier gave for that request.
+
+The card:
+{"holds": {"request": ..., "proof": ...}, "stops": {"request": ..., "proof": ..., "stopped": "<the stop's name exactly as the verifier gives it>"}}
+
+holds: a request, the task's request with only the open input set, whose run completes. stops: the same request with another value of that input, whose run stops with the stop the task names. The two values are no further apart than the task's width, and both requests are among the calls you made. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.
+

Reference solution

+

From the reference agent's reply (g2-budget-sd-airspeed-sink-e-t3.txt). Built on engine v0.15.3 at commit 664d68f426cc. Open address: a record exists.

+
On the cardToolProofOpen address
holdsrun_trajectory39af98b965eaa02888d1b8f06e4967c06ce8b28980ec0baa56304fdad7ef4dabfb9bf6f270d80a945a2841868301048fverified
stopsrun_trajectory141a97476638dfc739c43ca3715b5a1a4378eade9969a5dbec3d702e39aeebc0697f848dd3da0947a2a03989d76d6e40verified
+
{
+ "holds": {
+  "request": {
+   "tool": "run_trajectory",
+   "arguments": {
+    "domain": "aerospace",
+    "card": "capsule_stardust",
+    "initial": {
+     "radius_m": 6495650.0,
+     "radial_speed_m_s": -1960.0377171633477,
+     "transverse_speed_m_s": 12604.2
+    },
+    "dt_s": 0.05,
+    "segments": [
+     {
+      "steps": 1420,
+      "load": {}
+     }
+    ],
+    "record_every": 1420
+   }
+  },
+  "proof": "39af98b965eaa02888d1b8f06e4967c06ce8b28980ec0baa56304fdad7ef4dabfb9bf6f270d80a945a2841868301048f"
+ },
+ "stops": {
+  "request": {
+   "tool": "run_trajectory",
+   "arguments": {
+    "domain": "aerospace",
+    "card": "capsule_stardust",
+    "initial": {
+     "radius_m": 6495650.0,
+     "radial_speed_m_s": -1959.9495174505687,
+     "transverse_speed_m_s": 12604.2
+    },
+    "dt_s": 0.05,
+    "segments": [
+     {
+      "steps": 1420,
+      "load": {}
+     }
+    ],
+    "record_every": 1420
+   }
+  },
+  "proof": "141a97476638dfc739c43ca3715b5a1a4378eade9969a5dbec3d702e39aeebc0697f848dd3da0947a2a03989d76d6e40",
+  "stopped": "AirSpeedOutsideCard"
+ }
+}
+

What the models were compared with

+
ModelAgainstSpecimenAccuracy against measurement
aerospace/capsule_stardustcompared with measurementEntry of the Stardust sample return capsule on 15 January 2006, as a point mass with tabulated drag, no lift, no wind and a yearly standard atmosphere: altitude, speed through the air, Mach number, load, heat flux, and at the nose the stagnation pressure, recovery enthalpy and heat-transfer coefficient a heat shield takes, from entry interface to the drogue-deployment condition the radar recorded.Compared with NASA's reconstruction of the entry and the radar record of parachute opening: peak load 32.17 g against 32.89 g, within 0.72 g (target 3.64 g); the drogue altitude, 31.03 km, reached at 138.909 s and Mach 1.23 at 136.953 s against 137.9 s recorded, within 1.01 s (target 7.4 s). Gap: heat flux 696 W/cm2 against NASA's computed 762 to 1000; the yearly standard atmosphere in place of that morning's air is worth about 1 g of peak load either way.
+

Cheat suite

0 cheat attempt(s) scored above 0. 19 vectors applied; 11 do not apply to this kind.

VectorExpectedRewardGradedResultScorer's reason
honesthonest control (1)11.000holds
honest_reply_log_matcheshonest control (1)11.000holds
honest_numbers_respelledhonest control (1)11.000holds
no_request_behindcheat (0)00.000holdsa run_trajectory request on the card is not among the calls in the log
edited_call_logcheat (0)00.000holdsthe call log beside the reply differs from the harness log
over_budgetcheat (0)00.000holds4 computing calls; the budget is 3
forbidden_toolcheat (0)00.000holdsthe log holds calls of find_flip, which the task rules out
no_harness_logcheat (0)00.000holdsno harness call log: every attempt is scored with the calls the harness recorded
harness_log_editedcheat (0)00.000holdsthe harness log's chain breaks at line 2
stale_engine_tagcheat (0)00.000holdsthe task was built on engine 0.15.0; the verifier is 0.15.3
copied_proof_other_taskcheat (0)00.000holdsthe holds seal: the verifier says the seal does not hold (cause run_seal)
nudged_figurecheat (0)00.000holdsthe stops seal: the verifier says the seal does not hold (cause run_seal)
figure_plus_10_percentcheat (0)00.000holdsthe stops seal: the verifier says the seal does not hold (cause run_seal)
card_request_not_runcheat (0)00.000holdsa run_trajectory request on the card is not among the calls in the log
swapped_sidescheat (0)00.000holdsthe holds request comes back refused (AirSpeedOutsideCard)
stop_misnamedcheat (0)00.000holdsthe card names the stop 'SomeOtherStop'; the verifier names AirSpeedOutsideCard
proof_from_other_designcheat (0)00.000holdsthe stops seal: the verifier says the seal does not hold (cause run_seal)
proof_uppercasecheat (0)00.000holdsthe holds seal: the proof is not a SHA-384 seal of 96 hex digits
extra_argumentcheat (0)00.000holdsthe holds request differs from the task's at note
+

Solver runs

+
AgentRewardGradedComputing callsScorer's reason
Reference agent11.0002
One-call agent00.0001the holds request comes back refused (AirSpeedOutsideCard)
+

Pass@k by model family

+
FamilyVariantModelSolvedpass@1pass@8Mean gradedHarness errors
Frontier modeltoolFrontier model10 of 1662%100%0.7220%
+

Measured calibration: Frontier model, tool variant, n=16.

+

Calibrated on pass@1 in [2%, 70%] on a frontier model's tool variant, with pass@8 and continuous graded reward reported beside pass/fail.

+ +

Written 2026-11-14T01:27:47Z.

+ \ No newline at end of file diff --git a/sample/reports/g2-budget-sd-airspeed-sink-e-t3.json b/sample/reports/g2-budget-sd-airspeed-sink-e-t3.json new file mode 100644 index 0000000000000000000000000000000000000000..727c0815e85ae0dea09dc212b3ca88b7adba418b --- /dev/null +++ b/sample/reports/g2-budget-sd-airspeed-sink-e-t3.json @@ -0,0 +1,335 @@ +{ + "id": "g2-budget-sd-airspeed-sink-e-t3", + "family": "budget", + "kind": "budgeted_search", + "models": [ + "aerospace/capsule_stardust" + ], + "checksums": { + "row_sha256": "4559af9ec6da8de3222aeac4fa145e8ae24e218b71b019b602e36246c55034c9", + "row_sha384": "4c80776dc378202d6610e7806aae6e6bc8995ed2af61c3e9aebe0e9519009cf8f389e564ff71e96ee639f0ee11732a94", + "harbor_dir_sha256": "a0cce3ce7940097238e77d9fea5fe57f764c987879768eac43feb9799d1ed1ce", + "harbor_dir_sha384": "dce078617db66570521e3d603a5060b23ca75a1dd0c20703234affd8a3c0f57692bc8f7e0f6b1efe019b7024fe4a71cd" + }, + "instruction": "The Stardust sample return capsule enters the Earth's air at 6495650 m from the Earth's centre, with a transverse speed of 12604.2 m/s and a radial (sink) speed that you set (negative, downward), and is followed for 71 s (1420 steps of 0.05 s). Above some radial velocity (a shallower entry, smaller downward sink magnitude) the speed through the air leaves the card's drag table before the run's end and the run is stopped (AirSpeedOutsideCard). Find the radial speed at which that begins, in m/s.\n\nBracket it: give a value that completes and a value that stops with AirSpeedOutsideCard, no more than 0.0075 percent of the value apart. It lies between -2000 and -1910 m/s.\n\nThe request, with the one input you change:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_stardust\", \"initial\": {\"radius_m\": 6495650.0, \"radial_speed_m_s\": \"\", \"transverse_speed_m_s\": 12604.2}, \"dt_s\": 0.05, \"segments\": [{\"steps\": 1420, \"load\": {}}], \"record_every\": 1420}}\n\nBudget: at most 3 calls that compute, counted over every call you make; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Both requests on your card must be among your calls.\n\nYou have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.\n\nEnd your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {\"tool\": \"\", \"arguments\": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.\n\nThe card:\n{\"holds\": {\"request\": ..., \"proof\": ...}, \"stops\": {\"request\": ..., \"proof\": ..., \"stopped\": \"\"}}\n\nholds: a request, the task's request with only the open input set, whose run completes. stops: the same request with another value of that input, whose run stops with the stop the task names. The two values are no further apart than the task's width, and both requests are among the calls you made. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.", + "real_thing": "Entry of the Stardust sample return capsule on 15 January 2006, as a point mass with tabulated drag, no lift, no wind and a yearly standard atmosphere: altitude, speed through the air, Mach number, load, heat flux, and at the nose the stagnation pressure, recovery enthalpy and heat-transfer coefficient a heat shield takes, from entry interface to the drogue-deployment condition the radar recorded. Compared with NASA's reconstruction of the entry and the radar record of parachute opening: peak load 32.17 g against 32.89 g, within 0.72 g (target 3.64 g); the drogue altitude, 31.03 km, reached at 138.909 s and Mach 1.23 at 136.953 s against 137.9 s recorded, within 1.01 s (target 7.4 s). Gap: heat flux 696 W/cm2 against NASA's computed 762 to 1000; the yearly standard atmosphere in place of that morning's air is worth about 1 g of peak load either way.", + "reference": { + "from": "the reference agent's reply (g2-budget-sd-airspeed-sink-e-t3.txt)", + "card": { + "holds": { + "request": { + "tool": "run_trajectory", + "arguments": { + "domain": "aerospace", + "card": "capsule_stardust", + "initial": { + "radius_m": 6495650.0, + "radial_speed_m_s": -1960.0377171633477, + "transverse_speed_m_s": 12604.2 + }, + "dt_s": 0.05, + "segments": [ + { + "steps": 1420, + "load": {} + } + ], + "record_every": 1420 + } + }, + "proof": "39af98b965eaa02888d1b8f06e4967c06ce8b28980ec0baa56304fdad7ef4dabfb9bf6f270d80a945a2841868301048f" + }, + "stops": { + "request": { + "tool": "run_trajectory", + "arguments": { + "domain": "aerospace", + "card": "capsule_stardust", + "initial": { + "radius_m": 6495650.0, + "radial_speed_m_s": -1959.9495174505687, + "transverse_speed_m_s": 12604.2 + }, + "dt_s": 0.05, + "segments": [ + { + "steps": 1420, + "load": {} + } + ], + "record_every": 1420 + } + }, + "proof": "141a97476638dfc739c43ca3715b5a1a4378eade9969a5dbec3d702e39aeebc0697f848dd3da0947a2a03989d76d6e40", + "stopped": "AirSpeedOutsideCard" + } + }, + "proofs": [ + { + "where": "holds", + "tool": "run_trajectory", + "proof": "39af98b965eaa02888d1b8f06e4967c06ce8b28980ec0baa56304fdad7ef4dabfb9bf6f270d80a945a2841868301048f", + "open_address": "verified" + }, + { + "where": "stops", + "tool": "run_trajectory", + "proof": "141a97476638dfc739c43ca3715b5a1a4378eade9969a5dbec3d702e39aeebc0697f848dd3da0947a2a03989d76d6e40", + "open_address": "verified" + } + ], + "open_address_record": true, + "engine_tag": "v0.15.3", + "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1" + }, + "measurement": [ + { + "model": "aerospace/capsule_stardust", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with NASA's reconstruction of the entry and the radar record of parachute opening: peak load 32.17 g against 32.89 g, within 0.72 g (target 3.64 g); the drogue altitude, 31.03 km, reached at 138.909 s and Mach 1.23 at 136.953 s against 137.9 s recorded, within 1.01 s (target 7.4 s). Gap: heat flux 696 W/cm2 against NASA's computed 762 to 1000; the yearly standard atmosphere in place of that morning's air is worth about 1 g of peak load either way.", + "specimen": "Entry of the Stardust sample return capsule on 15 January 2006, as a point mass with tabulated drag, no lift, no wind and a yearly standard atmosphere: altitude, speed through the air, Mach number, load, heat flux, and at the nose the stagnation pressure, recovery enthalpy and heat-transfer coefficient a heat shield takes, from entry interface to the drogue-deployment condition the radar recorded.", + "error": null + } + ], + "cheat_suite": { + "vectors": [ + { + "vector": "honest", + "expect": "honest control (1)", + "reward": 1, + "graded": 1.0, + "ok": true, + "reason": null + }, + { + "vector": "honest_reply_log_matches", + "expect": "honest control (1)", + "reward": 1, + "graded": 1.0, + "ok": true, + "reason": null + }, + { + "vector": "honest_numbers_respelled", + "expect": "honest control (1)", + "reward": 1, + "graded": 1.0, + "ok": true, + "reason": null + }, + { + "vector": "no_request_behind", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "a run_trajectory request on the card is not among the calls in the log" + }, + { + "vector": "edited_call_log", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the call log beside the reply differs from the harness log" + }, + { + "vector": "over_budget", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "4 computing calls; the budget is 3" + }, + { + "vector": "forbidden_tool", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the log holds calls of find_flip, which the task rules out" + }, + { + "vector": "no_harness_log", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "no harness call log: every attempt is scored with the calls the harness recorded" + }, + { + "vector": "harness_log_edited", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the harness log's chain breaks at line 2" + }, + { + "vector": "stale_engine_tag", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the task was built on engine 0.15.0; the verifier is 0.15.3" + }, + { + "vector": "copied_proof_other_task", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the holds seal: the verifier says the seal does not hold (cause run_seal)" + }, + { + "vector": "nudged_figure", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the stops seal: the verifier says the seal does not hold (cause run_seal)" + }, + { + "vector": "figure_plus_10_percent", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the stops seal: the verifier says the seal does not hold (cause run_seal)" + }, + { + "vector": "card_request_not_run", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "a run_trajectory request on the card is not among the calls in the log" + }, + { + "vector": "swapped_sides", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the holds request comes back refused (AirSpeedOutsideCard)" + }, + { + "vector": "stop_misnamed", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the card names the stop 'SomeOtherStop'; the verifier names AirSpeedOutsideCard" + }, + { + "vector": "proof_from_other_design", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the stops seal: the verifier says the seal does not hold (cause run_seal)" + }, + { + "vector": "proof_uppercase", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the holds seal: the proof is not a SHA-384 seal of 96 hex digits" + }, + { + "vector": "extra_argument", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the holds request differs from the task's at note" + } + ], + "not_applicable": [ + { + "vector": "binding_misnamed", + "why": "not a budget card" + }, + { + "vector": "failing_given_as_passing", + "why": "not a budget card" + }, + { + "vector": "step_misnamed", + "why": "not a budget card" + }, + { + "vector": "missing_solve", + "why": "not a budget card" + }, + { + "vector": "solve_handed_other_run", + "why": "not a budget card" + }, + { + "vector": "every_row_genuine", + "why": "not a budget card" + }, + { + "vector": "every_row_false", + "why": "not a budget card" + }, + { + "vector": "every_row_false_true_reasons", + "why": "not a budget card" + }, + { + "vector": "next_start_rounded", + "why": "not a budget card" + }, + { + "vector": "next_proof_copied", + "why": "not a budget card" + }, + { + "vector": "next_request_edited", + "why": "not a budget card" + } + ], + "cheats_scoring_above_0": 0, + "run": true + }, + "solver_runs": { + "reference": { + "reward": 1, + "graded": 1.0, + "correct": 1, + "proofs_hold": 1, + "computing_calls": 2, + "verdict": "pass", + "reason": null + }, + "naive": { + "reward": 0, + "graded": 0.0, + "correct": 0, + "proofs_hold": 1, + "computing_calls": 1, + "verdict": "wrong", + "reason": "the holds request comes back refused (AirSpeedOutsideCard)" + } + }, + "passk": [ + { + "family": "Frontier model", + "model": "Frontier model", + "variant": "tool", + "n": 16, + "correct": 10, + "pass@1": 0.625, + "pass@8": 1.0, + "mean_graded": 0.7215676875, + "harness_error_rate": 0.0 + } + ], + "no_tool_question": false, + "physics_forensics": false, + "blind_baseline": null, + "written_utc": "2026-11-14T01:27:47Z" +} diff --git a/sample/reports/g2-chain-sd-slab-radius-halfchar-h-r7.html b/sample/reports/g2-chain-sd-slab-radius-halfchar-h-r7.html new file mode 100644 index 0000000000000000000000000000000000000000..87c09d7ea9ca02b27dbc1d6e3595afbdeda84e9f --- /dev/null +++ b/sample/reports/g2-chain-sd-slab-radius-halfchar-h-r7.html @@ -0,0 +1,301 @@ + +Task report: g2-chain-sd-slab-radius-halfchar-h-r7 +

g2-chain-sd-slab-radius-halfchar-h-r7

+

Multi-step physics RLVR task scored by deterministic recomputation on the Zero-Trust Physics verifier.

+

Chained design · models aerospace/capsule_stardust, ablator_slab · Zero-Trust Physics v0.15.3 · Protocol Company

+

Checksums

+ + +
Whatsha256SHA-384
Task row78049096d10266290151d85077e2305570a085f3afb1e8241a8948e717ea3f048a59112e526860afa257d56f2748f27d33691d4bd7d18bd65cc48e0810f4366c61d8cc8958696dbb71b38cee8e3e0a49
Harbor directoryd8c783fdbec8158f99fbe8c4127a888f6f28845cf9261e817c6ea3b00f8036ab597d6b47a8c2cbdb245aad2aac7ce496d5790bef7f9dfbdcd9f201078a9d55a9aa69f47d5944e10ac39f927ced7a45aa
+

Instruction

The Stardust sample return capsule enters the Earth's air with a radial speed of -2175.4 m/s (negative, downward) and a transverse speed of 12641.2 m/s, at a distance from the Earth's centre that you choose. Its heat shield's near-nose core is a slab of PICA, open record, version 3, 0.0434 m (43.4 mm) thick, starting at 281 K, heated by the capsule's own entry as the verifier hands it from the capsule's sealed run to the slab through their coupling, stardust_entry_to_pica_slab, radiating to surroundings at 294.4 K, and cooling with the stream off until 545 s.
+
+Find the largest starting distance from the Earth's centre, from 6482000 to 6494000 m, for which every constraint below holds. Give the passing design and the first failing design, no more than 12 m apart, and name the constraint that binds. The design that holds need not lie at either end of the range.
+
+Constraints (id (the request it is read from): what, limit):
+- half_char (solve): the depth at which the slab's density is half-way from char to virgin, in metres, at or below 0.0089922 m (8.9922 mm)
+- peak_load (run): the peak load on the capsule, in Earth g, over the whole entry, at or below 52.33 g
+Each design is two requests. The run of the capsule must end at the drogue-deployment condition (outcome ended, PastFlightDeployment). The run:
+{"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": "<your distance from the Earth's centre>", "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": "<enough to reach the drogue condition, at most 8000>", "load": {}}], "record_every": 720}}
+Then the slab, a solve handed that run through the coupling, with these parameters:
+{"tool": "solve", "arguments": {"solver": "ablator_slab", "parameters": {"material": "PICA, open record, version 3", "thickness_m": 0.0434, "start_temperature_k": 281.0, "face": "gas_stream", "stream_gas": "air", "surroundings_temperature_k": 294.4, "face_wears": true}, "from": {"request": "<the run's request>", "run_seal": "<the run's seal>", "coupling": "stardust_entry_to_pica_slab"}}}
+and its heating history laid out as the coupling's worked chain lays it: row 0 at 0 s with the first frame's pressure and enthalpy and a heat-transfer coefficient of 0; then one row per recorded frame, handed bit for bit (time, stagnation pressure, heat-transfer coefficient, recovery enthalpy); then a row 1 s after the last frame and a row at 545 s, each with the last frame's pressure and enthalpy and a heat-transfer coefficient of 0; a radiative heating of 0 in every row. thermocouple_depths_m and the return_ flags are yours to set. The run's record_every of 720 is the frames the coupling hands: keep it.
+The run reports the largest and smallest of a quantity over all its steps when it is sent with "readout": {"quantities": ["load_g"]}; a readout is not part of the request or its seal, so the same run with or without one has one seal.
+
+Budget: at most 10 calls that compute, counted over every call you make, each run and each solve one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.
+
+You have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.
+
+End your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {"tool": "<the tool's name as the verifier names it, without any prefix your own program adds>", "arguments": {<the arguments exactly as you sent them>}}, and a proof is the run_seal or solution_seal the verifier gave for that request.
+
+The card:
+{"passing": {"run": {"request": ..., "proof": ...}, "solve": {"request": ..., "proof": ...}}, "failing": {"run": {"request": ..., "proof": ...}, "solve": {"request": ..., "proof": ...}}, "binding": "<constraint id>"}
+
+passing: the design that keeps the constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks the constraint, no further from passing than the task's tolerance. binding: the id of the constraint. Each solve is the one handed its own design's sealed run through the coupling the task names. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.
+

Reference solution

+

From the reference agent's reply (g2-chain-sd-slab-radius-halfchar-h-r7.txt). Built on engine v0.15.3 at commit 664d68f426cc. Open address: a record exists.

+
On the cardToolProofOpen address
passing.runrun_trajectory1fa78aec5d3e09d24456d17b17ae3d5cbe4ad1d98f7f613fe5e80c1b855d017e435fb45dc30ed730eef198f5590ec173verified
passing.solvesolve8944591b390b2d9995dcb1a1be61b04f621892856ef97dcd58537f920d66d2e9ee56d3d8adb8c2adae41ed224478f86cverified
failing.runrun_trajectoryabce34b40ba1868cb29f0015f8de509f678546c4dfaad17ae251df0486469b4bdac80244df56c2071b13c31c4db6d6dbverified
failing.solvesolve705c1b2d8ec16c133318905bc8e1d23ea9ab535153210729aec9c9942e18eaa2b52ace04dc2874d53b055d722fbcad6dverified
+
{
+ "passing": {
+  "run": {
+   "request": {
+    "tool": "run_trajectory",
+    "arguments": {
+     "domain": "aerospace",
+     "card": "capsule_stardust",
+     "initial": {
+      "radius_m": 6488829.580236817,
+      "radial_speed_m_s": -2175.4,
+      "transverse_speed_m_s": 12641.2
+     },
+     "dt_s": 0.03125,
+     "segments": [
+      {
+       "steps": 8000,
+       "load": {}
+      }
+     ],
+     "record_every": 720
+    }
+   },
+   "proof": "1fa78aec5d3e09d24456d17b17ae3d5cbe4ad1d98f7f613fe5e80c1b855d017e435fb45dc30ed730eef198f5590ec173"
+  },
+  "solve": {
+   "request": {
+    "tool": "solve",
+    "arguments": {
+     "solver": "ablator_slab",
+     "parameters": {
+      "material": "PICA, open record, version 3",
+      "thickness_m": 0.0434,
+      "start_temperature_k": 281.0,
+      "face": "gas_stream",
+      "stream_gas": "air",
+      "surroundings_temperature_k": 294.4,
+      "face_wears": true,
+      "thermocouple_depths_m": [],
+      "return_face_history": false,
+      "return_thermocouple_histories": false,
+      "return_final_profile": false,
+      "history_time_s": [
+       0.0,
+       22.5,
+       45.0,
+       67.5,
+       90.0,
+       93.6875,
+       94.6875,
+       545.0
+      ],
+      "history_pressure_pa": [
+       5909.919921875,
+       5909.919921875,
+       42409.2421875,
+       6625.830078125,
+       2544.8134765625,
+       2450.75341796875,
+       2450.75341796875,
+       2450.75341796875
+      ],
+      "history_heat_transfer_coefficient_kg_per_m2_s": [
+       0.0,
+       0.058212701231241226,
+       0.1558331996202469,
+       0.06065985932946205,
+       0.03434406593441963,
+       0.03284108266234398,
+       0.0,
+       0.0
+      ],
+      "history_flow_enthalpy_j_per_kg": [
+       75923648.0,
+       75923648.0,
+       12139213.0,
+       541897.6875,
+       80255.8046875,
+       64982.50390625,
+       64982.50390625,
+       64982.50390625
+      ],
+      "history_radiative_heating_w_per_m2": [
+       0.0,
+       0.0,
+       0.0,
+       0.0,
+       0.0,
+       0.0,
+       0.0,
+       0.0
+      ]
+     },
+     "from": {
+      "request": {
+       "domain": "aerospace",
+       "card": "capsule_stardust",
+       "initial": {
+        "radius_m": 6488829.580236817,
+        "radial_speed_m_s": -2175.4,
+        "transverse_speed_m_s": 12641.2
+       },
+       "dt_s": 0.03125,
+       "segments": [
+        {
+         "steps": 8000,
+         "load": {}
+        }
+       ],
+       "record_every": 720
+      },
+      "run_seal": "1fa78aec5d3e09d24456d17b17ae3d5cbe4ad1d98f7f613fe5e80c1b855d017e435fb45dc30ed730eef198f5590ec173",
+      "coupling": "stardust_entry_to_pica_slab"
+     }
+    }
+   },
+   "proof": "8944591b390b2d9995dcb1a1be61b04f621892856ef97dcd58537f920d66d2e9ee56d3d8adb8c2adae41ed224478f86c"
+  }
+ },
+ "failing": {
+  "run": {
+   "request": {
+    "tool": "run_trajectory",
+    "arguments": {
+     "domain": "aerospace",
+     "card": "capsule_stardust",
+     "initial": {
+      "radius_m": 6488836.780236816,
+      "radial_speed_m_s": -2175.4,
+      "transverse_speed_m_s": 12641.2
+     },
+     "dt_s": 0.03125,
+     "segments": [
+      {
+       "steps": 8000,
+       "load": {}
+      }
+     ],
+     "record_every": 720
+    }
+   },
+   "proof": "abce34b40ba1868cb29f0015f8de509f678546c4dfaad17ae251df0486469b4bdac80244df56c2071b13c31c4db6d6db"
+  },
+  "solve": {
+   "request": {
+    "tool": "solve",
+    "arguments": {
+     "solver": "ablator_slab",
+     "parameters": {
+      "material": "PICA, open record, version 3",
+      "thickness_m": 0.0434,
+      "start_temperature_k": 281.0,
+      "face": "gas_stream",
+      "stream_gas": "air",
+      "surroundings_temperature_k": 294.4,
+      "face_wears": true,
+      "thermocouple_depths_m": [],
+      "return_face_history": false,
+      "return_thermocouple_histories": false,
+      "return_final_profile": false,
+      "history_time_s": [
+       0.0,
+       22.5,
+       45.0,
+       67.5,
+       90.0,
+       93.6875,
+       94.6875,
+       545.0
+      ],
+      "history_pressure_pa": [
+       5903.89697265625,
+       5903.89697265625,
+       42420.40234375,
+       6628.06396484375,
+       2545.021240234375,
+       2450.830078125,
+       2450.830078125,
+       2450.830078125
+      ],
+      "history_heat_transfer_coefficient_kg_per_m2_s": [
+       0.0,
+       0.05818302929401398,
+       0.15585379302501678,
+       0.0606706440448761,
+       0.03434683755040169,
+       0.032843057066202164,
+       0.0,
+       0.0
+      ],
+      "history_flow_enthalpy_j_per_kg": [
+       75926248.0,
+       75926248.0,
+       12148022.0,
+       542217.125,
+       80285.0625,
+       65003.5703125,
+       65003.5703125,
+       65003.5703125
+      ],
+      "history_radiative_heating_w_per_m2": [
+       0.0,
+       0.0,
+       0.0,
+       0.0,
+       0.0,
+       0.0,
+       0.0,
+       0.0
+      ]
+     },
+     "from": {
+      "request": {
+       "domain": "aerospace",
+       "card": "capsule_stardust",
+       "initial": {
+        "radius_m": 6488836.780236816,
+        "radial_speed_m_s": -2175.4,
+        "transverse_speed_m_s": 12641.2
+       },
+       "dt_s": 0.03125,
+       "segments": [
+        {
+         "steps": 8000,
+         "load": {}
+        }
+       ],
+       "record_every": 720
+      },
+      "run_seal": "abce34b40ba1868cb29f0015f8de509f678546c4dfaad17ae251df0486469b4bdac80244df56c2071b13c31c4db6d6db",
+      "coupling": "stardust_entry_to_pica_slab"
+     }
+    }
+   },
+   "proof": "705c1b2d8ec16c133318905bc8e1d23ea9ab535153210729aec9c9942e18eaa2b52ace04dc2874d53b055d722fbcad6d"
+  }
+ },
+ "binding": "half_char"
+}
+

What the models were compared with

+
ModelAgainstSpecimenAccuracy against measurement
aerospace/capsule_stardustcompared with measurementEntry of the Stardust sample return capsule on 15 January 2006, as a point mass with tabulated drag, no lift, no wind and a yearly standard atmosphere: altitude, speed through the air, Mach number, load, heat flux, and at the nose the stagnation pressure, recovery enthalpy and heat-transfer coefficient a heat shield takes, from entry interface to the drogue-deployment condition the radar recorded.Compared with NASA's reconstruction of the entry and the radar record of parachute opening: peak load 32.17 g against 32.89 g, within 0.72 g (target 3.64 g); the drogue altitude, 31.03 km, reached at 138.909 s and Mach 1.23 at 136.953 s against 137.9 s recorded, within 1.01 s (target 7.4 s). Gap: heat flux 696 W/cm2 against NASA's computed 762 to 1000; the yearly standard atmosphere in place of that morning's air is worth about 1 g of peak load either way.
ablator_slabcompared with measurementA flat slab of charring heat-shield material heated on one face: wear, face temperature, depth of charring and the heat and mass accounts, for a PICA model built from the open record or the test material TACOT 3.0.Compared with 31 arc-jet tests outside the fit: wear within its target on 28 of 31 (target 25), mean −5.3 percent over all 31 (−2.6 over the 30 without the pure-nitrogen test; target within 8); hottest face within 7 percent on 24 of 28 (target 23); Stardust wear 7.58 and 3.32 mm against 5.7 and 3.2; fed by capsule_stardust through stardust_entry_to_pica_slab, nose wear 4.65 mm and face within 156 K RMS of the airborne spectra. Gap: the face runs 4.1 percent hot on average (target 3.5), and Stardust nose wear is a third high.
+

Cheat suite

0 cheat attempt(s) scored above 0. 22 vectors applied; 8 do not apply to this kind.

VectorExpectedRewardGradedResultScorer's reason
honesthonest control (1)11.000holds
honest_reply_log_matcheshonest control (1)11.000holds
honest_numbers_respelledhonest control (1)11.000holds
no_request_behindcheat (0)00.000holdsa run_trajectory request on the card is not among the calls in the log
edited_call_logcheat (0)00.000holdsthe call log beside the reply differs from the harness log
over_budgetcheat (0)00.000holds11 computing calls; the budget is 10
forbidden_toolcheat (0)00.000holdsthe log holds calls of find_flip, which the task rules out
no_harness_logcheat (0)00.000holdsno harness call log: every attempt is scored with the calls the harness recorded
harness_log_editedcheat (0)00.000holdsthe harness log's chain breaks at line 4
stale_engine_tagcheat (0)00.000holdsthe task was built on engine 0.15.0; the verifier is 0.15.3
copied_proof_other_taskcheat (0)00.000holdsthe passing design's run_seal: the verifier says the seal does not hold (cause run_seal)
nudged_figurecheat (0)00.000holdsthe passing design's run_seal: the verifier says the seal does not hold (cause run_seal)
figure_plus_10_percentcheat (0)00.000holdsthe passing design's run_seal: the verifier would not verify it: Physical Failure: altitude is above 134.7 km, the top of the drag table read by altitude (Altit
card_request_not_runcheat (0)00.000holdsa run_trajectory request on the card is not among the calls in the log
swapped_sidescheat (0)00.000holdsthe passing design breaks half_char
binding_misnamedcheat (0)00.000holdsbinding names 'peak_load'; the constraint that binds is another
proof_from_other_designcheat (0)00.000holdsthe failing design's run_seal: the verifier says the seal does not hold (cause run_seal)
failing_given_as_passingcheat (0)00.000holdsthe passing design breaks half_char
proof_uppercasecheat (0)00.000holdsthe passing design's run_seal: the proof is not a SHA-384 seal of 96 hex digits
extra_argumentcheat (0)00.000holdsthe passing design's run differs from the task's at note
missing_solvecheat (0)00.000holdsthe passing design's solve is missing
solve_handed_other_runcheat (0)00.000holdsthe passing design's solve is not handed the design's own sealed run
+

Solver runs

+
AgentRewardGradedComputing callsScorer's reason
Reference agent11.0004
One-call agent00.0001the passing design's solve is missing
+

Pass@k by model family

+
FamilyVariantModelSolvedpass@1pass@8Mean gradedHarness errors
Frontier modeltoolFrontier model2 of 825%100%0.3130%
+

Measured calibration: Frontier model, tool variant, n=8.

+

Calibrated on pass@1 in [2%, 70%] on a frontier model's tool variant, with pass@8 and continuous graded reward reported beside pass/fail.

+ +

Written 2026-11-14T01:27:47Z.

+ \ No newline at end of file diff --git a/sample/reports/g2-chain-sd-slab-radius-halfchar-h-r7.json b/sample/reports/g2-chain-sd-slab-radius-halfchar-h-r7.json new file mode 100644 index 0000000000000000000000000000000000000000..76485339cb2adf56143c60144e46c9f68079491b --- /dev/null +++ b/sample/reports/g2-chain-sd-slab-radius-halfchar-h-r7.json @@ -0,0 +1,557 @@ +{ + "id": "g2-chain-sd-slab-radius-halfchar-h-r7", + "family": "chain_design", + "kind": "chained_design", + "models": [ + "aerospace/capsule_stardust", + "ablator_slab" + ], + "checksums": { + "row_sha256": "78049096d10266290151d85077e2305570a085f3afb1e8241a8948e717ea3f04", + "row_sha384": "8a59112e526860afa257d56f2748f27d33691d4bd7d18bd65cc48e0810f4366c61d8cc8958696dbb71b38cee8e3e0a49", + "harbor_dir_sha256": "d8c783fdbec8158f99fbe8c4127a888f6f28845cf9261e817c6ea3b00f8036ab", + "harbor_dir_sha384": "597d6b47a8c2cbdb245aad2aac7ce496d5790bef7f9dfbdcd9f201078a9d55a9aa69f47d5944e10ac39f927ced7a45aa" + }, + "instruction": "The Stardust sample return capsule enters the Earth's air with a radial speed of -2175.4 m/s (negative, downward) and a transverse speed of 12641.2 m/s, at a distance from the Earth's centre that you choose. Its heat shield's near-nose core is a slab of PICA, open record, version 3, 0.0434 m (43.4 mm) thick, starting at 281 K, heated by the capsule's own entry as the verifier hands it from the capsule's sealed run to the slab through their coupling, stardust_entry_to_pica_slab, radiating to surroundings at 294.4 K, and cooling with the stream off until 545 s.\n\nFind the largest starting distance from the Earth's centre, from 6482000 to 6494000 m, for which every constraint below holds. Give the passing design and the first failing design, no more than 12 m apart, and name the constraint that binds. The design that holds need not lie at either end of the range.\n\nConstraints (id (the request it is read from): what, limit):\n- half_char (solve): the depth at which the slab's density is half-way from char to virgin, in metres, at or below 0.0089922 m (8.9922 mm)\n- peak_load (run): the peak load on the capsule, in Earth g, over the whole entry, at or below 52.33 g\nEach design is two requests. The run of the capsule must end at the drogue-deployment condition (outcome ended, PastFlightDeployment). The run:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_stardust\", \"initial\": {\"radius_m\": \"\", \"radial_speed_m_s\": -2175.4, \"transverse_speed_m_s\": 12641.2}, \"dt_s\": 0.03125, \"segments\": [{\"steps\": \"\", \"load\": {}}], \"record_every\": 720}}\nThen the slab, a solve handed that run through the coupling, with these parameters:\n{\"tool\": \"solve\", \"arguments\": {\"solver\": \"ablator_slab\", \"parameters\": {\"material\": \"PICA, open record, version 3\", \"thickness_m\": 0.0434, \"start_temperature_k\": 281.0, \"face\": \"gas_stream\", \"stream_gas\": \"air\", \"surroundings_temperature_k\": 294.4, \"face_wears\": true}, \"from\": {\"request\": \"\", \"run_seal\": \"\", \"coupling\": \"stardust_entry_to_pica_slab\"}}}\nand its heating history laid out as the coupling's worked chain lays it: row 0 at 0 s with the first frame's pressure and enthalpy and a heat-transfer coefficient of 0; then one row per recorded frame, handed bit for bit (time, stagnation pressure, heat-transfer coefficient, recovery enthalpy); then a row 1 s after the last frame and a row at 545 s, each with the last frame's pressure and enthalpy and a heat-transfer coefficient of 0; a radiative heating of 0 in every row. thermocouple_depths_m and the return_ flags are yours to set. The run's record_every of 720 is the frames the coupling hands: keep it.\nThe run reports the largest and smallest of a quantity over all its steps when it is sent with \"readout\": {\"quantities\": [\"load_g\"]}; a readout is not part of the request or its seal, so the same run with or without one has one seal.\n\nBudget: at most 10 calls that compute, counted over every call you make, each run and each solve one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.\n\nYou have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.\n\nEnd your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {\"tool\": \"\", \"arguments\": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.\n\nThe card:\n{\"passing\": {\"run\": {\"request\": ..., \"proof\": ...}, \"solve\": {\"request\": ..., \"proof\": ...}}, \"failing\": {\"run\": {\"request\": ..., \"proof\": ...}, \"solve\": {\"request\": ..., \"proof\": ...}}, \"binding\": \"\"}\n\npassing: the design that keeps the constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks the constraint, no further from passing than the task's tolerance. binding: the id of the constraint. Each solve is the one handed its own design's sealed run through the coupling the task names. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.", + "real_thing": "Entry of the Stardust sample return capsule on 15 January 2006, as a point mass with tabulated drag, no lift, no wind and a yearly standard atmosphere: altitude, speed through the air, Mach number, load, heat flux, and at the nose the stagnation pressure, recovery enthalpy and heat-transfer coefficient a heat shield takes, from entry interface to the drogue-deployment condition the radar recorded. Compared with NASA's reconstruction of the entry and the radar record of parachute opening: peak load 32.17 g against 32.89 g, within 0.72 g (target 3.64 g); the drogue altitude, 31.03 km, reached at 138.909 s and Mach 1.23 at 136.953 s against 137.9 s recorded, within 1.01 s (target 7.4 s). Gap: heat flux 696 W/cm2 against NASA's computed 762 to 1000; the yearly standard atmosphere in place of that morning's air is worth about 1 g of peak load either way. / A flat slab of charring heat-shield material heated on one face: wear, face temperature, depth of charring and the heat and mass accounts, for a PICA model built from the open record or the test material TACOT 3.0. Compared with 31 arc-jet tests outside the fit: wear within its target on 28 of 31 (target 25), mean \u22125.3 percent over all 31 (\u22122.6 over the 30 without the pure-nitrogen test; target within 8); hottest face within 7 percent on 24 of 28 (target 23); Stardust wear 7.58 and 3.32 mm against 5.7 and 3.2; fed by capsule_stardust through stardust_entry_to_pica_slab, nose wear 4.65 mm and face within 156 K RMS of the airborne spectra. Gap: the face runs 4.1 percent hot on average (target 3.5), and Stardust nose wear is a third high.", + "reference": { + "from": "the reference agent's reply (g2-chain-sd-slab-radius-halfchar-h-r7.txt)", + "card": { + "passing": { + "run": { + "request": { + "tool": "run_trajectory", + "arguments": { + "domain": "aerospace", + "card": "capsule_stardust", + "initial": { + "radius_m": 6488829.580236817, + "radial_speed_m_s": -2175.4, + "transverse_speed_m_s": 12641.2 + }, + "dt_s": 0.03125, + "segments": [ + { + "steps": 8000, + "load": {} + } + ], + "record_every": 720 + } + }, + "proof": "1fa78aec5d3e09d24456d17b17ae3d5cbe4ad1d98f7f613fe5e80c1b855d017e435fb45dc30ed730eef198f5590ec173" + }, + "solve": { + "request": { + "tool": "solve", + "arguments": { + "solver": "ablator_slab", + "parameters": { + "material": "PICA, open record, version 3", + "thickness_m": 0.0434, + "start_temperature_k": 281.0, + "face": "gas_stream", + "stream_gas": "air", + "surroundings_temperature_k": 294.4, + "face_wears": true, + "thermocouple_depths_m": [], + "return_face_history": false, + "return_thermocouple_histories": false, + "return_final_profile": false, + "history_time_s": [ + 0.0, + 22.5, + 45.0, + 67.5, + 90.0, + 93.6875, + 94.6875, + 545.0 + ], + "history_pressure_pa": [ + 5909.919921875, + 5909.919921875, + 42409.2421875, + 6625.830078125, + 2544.8134765625, + 2450.75341796875, + 2450.75341796875, + 2450.75341796875 + ], + "history_heat_transfer_coefficient_kg_per_m2_s": [ + 0.0, + 0.058212701231241226, + 0.1558331996202469, + 0.06065985932946205, + 0.03434406593441963, + 0.03284108266234398, + 0.0, + 0.0 + ], + "history_flow_enthalpy_j_per_kg": [ + 75923648.0, + 75923648.0, + 12139213.0, + 541897.6875, + 80255.8046875, + 64982.50390625, + 64982.50390625, + 64982.50390625 + ], + "history_radiative_heating_w_per_m2": [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ] + }, + "from": { + "request": { + "domain": "aerospace", + "card": "capsule_stardust", + "initial": { + "radius_m": 6488829.580236817, + "radial_speed_m_s": -2175.4, + "transverse_speed_m_s": 12641.2 + }, + "dt_s": 0.03125, + "segments": [ + { + "steps": 8000, + "load": {} + } + ], + "record_every": 720 + }, + "run_seal": "1fa78aec5d3e09d24456d17b17ae3d5cbe4ad1d98f7f613fe5e80c1b855d017e435fb45dc30ed730eef198f5590ec173", + "coupling": "stardust_entry_to_pica_slab" + } + } + }, + "proof": "8944591b390b2d9995dcb1a1be61b04f621892856ef97dcd58537f920d66d2e9ee56d3d8adb8c2adae41ed224478f86c" + } + }, + "failing": { + "run": { + "request": { + "tool": "run_trajectory", + "arguments": { + "domain": "aerospace", + "card": "capsule_stardust", + "initial": { + "radius_m": 6488836.780236816, + "radial_speed_m_s": -2175.4, + "transverse_speed_m_s": 12641.2 + }, + "dt_s": 0.03125, + "segments": [ + { + "steps": 8000, + "load": {} + } + ], + "record_every": 720 + } + }, + "proof": "abce34b40ba1868cb29f0015f8de509f678546c4dfaad17ae251df0486469b4bdac80244df56c2071b13c31c4db6d6db" + }, + "solve": { + "request": { + "tool": "solve", + "arguments": { + "solver": "ablator_slab", + "parameters": { + "material": "PICA, open record, version 3", + "thickness_m": 0.0434, + "start_temperature_k": 281.0, + "face": "gas_stream", + "stream_gas": "air", + "surroundings_temperature_k": 294.4, + "face_wears": true, + "thermocouple_depths_m": [], + "return_face_history": false, + "return_thermocouple_histories": false, + "return_final_profile": false, + "history_time_s": [ + 0.0, + 22.5, + 45.0, + 67.5, + 90.0, + 93.6875, + 94.6875, + 545.0 + ], + "history_pressure_pa": [ + 5903.89697265625, + 5903.89697265625, + 42420.40234375, + 6628.06396484375, + 2545.021240234375, + 2450.830078125, + 2450.830078125, + 2450.830078125 + ], + "history_heat_transfer_coefficient_kg_per_m2_s": [ + 0.0, + 0.05818302929401398, + 0.15585379302501678, + 0.0606706440448761, + 0.03434683755040169, + 0.032843057066202164, + 0.0, + 0.0 + ], + "history_flow_enthalpy_j_per_kg": [ + 75926248.0, + 75926248.0, + 12148022.0, + 542217.125, + 80285.0625, + 65003.5703125, + 65003.5703125, + 65003.5703125 + ], + "history_radiative_heating_w_per_m2": [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ] + }, + "from": { + "request": { + "domain": "aerospace", + "card": "capsule_stardust", + "initial": { + "radius_m": 6488836.780236816, + "radial_speed_m_s": -2175.4, + "transverse_speed_m_s": 12641.2 + }, + "dt_s": 0.03125, + "segments": [ + { + "steps": 8000, + "load": {} + } + ], + "record_every": 720 + }, + "run_seal": "abce34b40ba1868cb29f0015f8de509f678546c4dfaad17ae251df0486469b4bdac80244df56c2071b13c31c4db6d6db", + "coupling": "stardust_entry_to_pica_slab" + } + } + }, + "proof": "705c1b2d8ec16c133318905bc8e1d23ea9ab535153210729aec9c9942e18eaa2b52ace04dc2874d53b055d722fbcad6d" + } + }, + "binding": "half_char" + }, + "proofs": [ + { + "where": "passing.run", + "tool": "run_trajectory", + "proof": "1fa78aec5d3e09d24456d17b17ae3d5cbe4ad1d98f7f613fe5e80c1b855d017e435fb45dc30ed730eef198f5590ec173", + "open_address": "verified" + }, + { + "where": "passing.solve", + "tool": "solve", + "proof": "8944591b390b2d9995dcb1a1be61b04f621892856ef97dcd58537f920d66d2e9ee56d3d8adb8c2adae41ed224478f86c", + "open_address": "verified" + }, + { + "where": "failing.run", + "tool": "run_trajectory", + "proof": "abce34b40ba1868cb29f0015f8de509f678546c4dfaad17ae251df0486469b4bdac80244df56c2071b13c31c4db6d6db", + "open_address": "verified" + }, + { + "where": "failing.solve", + "tool": "solve", + "proof": "705c1b2d8ec16c133318905bc8e1d23ea9ab535153210729aec9c9942e18eaa2b52ace04dc2874d53b055d722fbcad6d", + "open_address": "verified" + } + ], + "open_address_record": true, + "engine_tag": "v0.15.3", + "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1" + }, + "measurement": [ + { + "model": "aerospace/capsule_stardust", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with NASA's reconstruction of the entry and the radar record of parachute opening: peak load 32.17 g against 32.89 g, within 0.72 g (target 3.64 g); the drogue altitude, 31.03 km, reached at 138.909 s and Mach 1.23 at 136.953 s against 137.9 s recorded, within 1.01 s (target 7.4 s). Gap: heat flux 696 W/cm2 against NASA's computed 762 to 1000; the yearly standard atmosphere in place of that morning's air is worth about 1 g of peak load either way.", + "specimen": "Entry of the Stardust sample return capsule on 15 January 2006, as a point mass with tabulated drag, no lift, no wind and a yearly standard atmosphere: altitude, speed through the air, Mach number, load, heat flux, and at the nose the stagnation pressure, recovery enthalpy and heat-transfer coefficient a heat shield takes, from entry interface to the drogue-deployment condition the radar recorded.", + "error": null + }, + { + "model": "ablator_slab", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with 31 arc-jet tests outside the fit: wear within its target on 28 of 31 (target 25), mean \u22125.3 percent over all 31 (\u22122.6 over the 30 without the pure-nitrogen test; target within 8); hottest face within 7 percent on 24 of 28 (target 23); Stardust wear 7.58 and 3.32 mm against 5.7 and 3.2; fed by capsule_stardust through stardust_entry_to_pica_slab, nose wear 4.65 mm and face within 156 K RMS of the airborne spectra. Gap: the face runs 4.1 percent hot on average (target 3.5), and Stardust nose wear is a third high.", + "specimen": "A flat slab of charring heat-shield material heated on one face: wear, face temperature, depth of charring and the heat and mass accounts, for a PICA model built from the open record or the test material TACOT 3.0.", + "error": null + } + ], + "cheat_suite": { + "vectors": [ + { + "vector": "honest", + "expect": "honest control (1)", + "reward": 1, + "graded": 1.0, + "ok": true, + "reason": null + }, + { + "vector": "honest_reply_log_matches", + "expect": "honest control (1)", + "reward": 1, + "graded": 1.0, + "ok": true, + "reason": null + }, + { + "vector": "honest_numbers_respelled", + "expect": "honest control (1)", + "reward": 1, + "graded": 1.0, + "ok": true, + "reason": null + }, + { + "vector": "no_request_behind", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "a run_trajectory request on the card is not among the calls in the log" + }, + { + "vector": "edited_call_log", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the call log beside the reply differs from the harness log" + }, + { + "vector": "over_budget", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "11 computing calls; the budget is 10" + }, + { + "vector": "forbidden_tool", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the log holds calls of find_flip, which the task rules out" + }, + { + "vector": "no_harness_log", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "no harness call log: every attempt is scored with the calls the harness recorded" + }, + { + "vector": "harness_log_edited", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the harness log's chain breaks at line 4" + }, + { + "vector": "stale_engine_tag", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the task was built on engine 0.15.0; the verifier is 0.15.3" + }, + { + "vector": "copied_proof_other_task", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)" + }, + { + "vector": "nudged_figure", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)" + }, + { + "vector": "figure_plus_10_percent", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the passing design's run_seal: the verifier would not verify it: Physical Failure: altitude is above 134.7 km, the top of the drag table read by altitude (AltitudeOutsideCard). That state is not sealed." + }, + { + "vector": "card_request_not_run", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "a run_trajectory request on the card is not among the calls in the log" + }, + { + "vector": "swapped_sides", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the passing design breaks half_char" + }, + { + "vector": "binding_misnamed", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "binding names 'peak_load'; the constraint that binds is another" + }, + { + "vector": "proof_from_other_design", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the failing design's run_seal: the verifier says the seal does not hold (cause run_seal)" + }, + { + "vector": "failing_given_as_passing", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the passing design breaks half_char" + }, + { + "vector": "proof_uppercase", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the passing design's run_seal: the proof is not a SHA-384 seal of 96 hex digits" + }, + { + "vector": "extra_argument", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the passing design's run differs from the task's at note" + }, + { + "vector": "missing_solve", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the passing design's solve is missing" + }, + { + "vector": "solve_handed_other_run", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the passing design's solve is not handed the design's own sealed run" + } + ], + "not_applicable": [ + { + "vector": "stop_misnamed", + "why": "no stop binds" + }, + { + "vector": "step_misnamed", + "why": "no stop binds" + }, + { + "vector": "next_start_rounded", + "why": "not a continued design" + }, + { + "vector": "next_proof_copied", + "why": "not a continued design" + }, + { + "vector": "next_request_edited", + "why": "not a continued design" + }, + { + "vector": "every_row_genuine", + "why": "forensics only" + }, + { + "vector": "every_row_false", + "why": "forensics only" + }, + { + "vector": "every_row_false_true_reasons", + "why": "forensics only" + } + ], + "cheats_scoring_above_0": 0, + "run": true + }, + "solver_runs": { + "reference": { + "reward": 1, + "graded": 1.0, + "correct": 1, + "proofs_hold": 1, + "computing_calls": 4, + "verdict": "pass", + "reason": null + }, + "naive": { + "reward": 0, + "graded": 0.0, + "correct": 0, + "proofs_hold": 1, + "computing_calls": 1, + "verdict": "integrity", + "reason": "the passing design's solve is missing" + } + }, + "passk": [ + { + "family": "Frontier model", + "model": "Frontier model", + "variant": "tool", + "n": 8, + "correct": 2, + "pass@1": 0.25, + "pass@8": 1.0, + "mean_graded": 0.313093625, + "harness_error_rate": 0.0 + } + ], + "no_tool_question": false, + "physics_forensics": false, + "blind_baseline": null, + "written_utc": "2026-11-14T01:27:47Z" +} diff --git a/sample/reports/g2-forensics6-07.html b/sample/reports/g2-forensics6-07.html new file mode 100644 index 0000000000000000000000000000000000000000..8bd98f796da65c7c65641810774f838305264382 --- /dev/null +++ b/sample/reports/g2-forensics6-07.html @@ -0,0 +1,81 @@ + +Task report: g2-forensics6-07 +

g2-forensics6-07

+

Multi-step physics RLVR task scored by deterministic recomputation on the Zero-Trust Physics verifier.

+

Forensics · models ablator_slab, aerospace/capsule_insight, aerospace/capsule_stardust, aerospace/crater_ryugu_sci, aerospace/los_jwst_fine_guide, aerospace/momentum_jwst_dihedral, aerospace/momentum_jwst_srp, aerospace/satellite_lageos1, aerospace/solar_system, plasma_sheath_ram_c2 · Zero-Trust Physics v0.15.3 · Protocol Company

+

Checksums

+ + +
Whatsha256SHA-384
Task row6b5b17ae1cb8c2a65ad0b7898e0e2e2f194b6f3a27a173890eb4e57d296d0bfbb48b3cbbe5803b4775a5066c7933d76976d7462557a940729c4782de09c1fc431294fca313187cc753e0d0e6ea004da2
Harbor directory9496dc0eb603f9bf46343d422416253a17b0d04dfbcedddbd765332ef58685dbce815cc0f5549d362bdfdee6f240ab1420fe79630d02d0b2a7fcd67d5124a7cc70bdd98220768b23fab0ed05f6c29ac4
+

Instruction

A report hands you twelve claims about answers of the verifier. Each row gives the model, the request as it was sent, what its answer is claimed to say and the proof claimed for it. claim.outcome and claim.stop are the run's outcome and the name of its stop or declared end (null when it completed); claim.steps_landed is the last step the run is sealed to; claim.quantity and claim.value are one number of the final state of a run (of the result, for a solve); claim.flags are the advisory flags the run carried, each with the quantity it is on, its extent at the largest (extent) and the number of steps it was raised on (steps).
+Some rows are false. A false row may be wrong in more than one way; its reason is the first of these, in this order, that is true of it:
+1. retired_model: the request names a model ID the verifier does not serve (one it no longer serves, or a name it never served).
+2. parent_wrong: the request continues a run (from) that is not the parent it names: its start state, or the seal it gives for its parent, belongs to another run, and the verifier refuses the continuation.
+3. seal_wrong: the proof is not the seal of this request.
+4. stop_hidden: the run stops part way and the claim says it completed.
+5. step_wrong: the claim names the run's stop, but not the last step the run is sealed to.
+6. flag_omitted: the run carries an advisory flag (a name on a quantity) that the claim leaves out altogether.
+7. flag_altered: the flags the claim lists are not the run's, entry for entry: an extent or a count of steps differs, or an entry is missing or added where its name on that quantity is listed too (the verifier may list one flag on one quantity more than once, each with its own extent).
+8. value_altered: the claimed value is not the one the request gives, to the last digit.
+A row that is none of these is genuine, whatever else differs in how it is written (the order of its flags, a readout sent with the request, the spelling of a number). Name every false row with its reason.
+The rows, one a line:
+{"row": "R1", "model": "aerospace/momentum_jwst_srp", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "momentum_jwst_srp", "initial": {"h_eci_nms": [-1.244, -0.73, 1.098]}, "dt_s": 1599.0, "segments": [{"steps": 69, "load": {"q1": 0.655763, "q2": -0.008127, "q3": -0.635608, "q4": 0.407321, "sun_x": 0.616092, "sun_y": 0.711198, "sun_z": 0.338568, "sun_distance_au": 1.00863}}], "record_every": 69}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 69, "quantity": "h_magnitude_nms", "value": 2.2890861976984564, "flags": []}, "proof": "949c987ad62f835ca215267699517ed2e659b5e776277779896aaf721a03f139d674ea7e0f671e6160f37eaca17eaade"}
+{"row": "R2", "model": "aerospace/capsule_insight", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_insight", "initial": {"radius_m": 3522956.0, "radial_speed_m_s": -1294.7972, "transverse_speed_m_s": 5730.5432}, "dt_s": 0.1, "segments": [{"steps": 2152, "load": {"lift_over_drag": 0.0}}], "record_every": 2152}}, "claim": {"outcome": "ended", "stop": "PastFlightDeployment", "steps_landed": 2115, "quantity": "mach", "value": 1.3960519703767567, "flags": []}, "proof": "a4065183ea2043a6b9568252634e364467b059fc61f9a23478a29d53c70035b9b199b77f07d277aa257df8e292b9ce3b"}
+{"row": "R3", "model": "ablator_slab", "request": {"tool": "solve", "arguments": {"solver": "ablator_slab", "parameters": {"material": "TACOT 3.0", "thickness_m": 0.0461, "start_temperature_k": 306.3, "thermocouple_depths_m": [], "face": "held_temperature", "held_temperature_k": 1920.0, "hold_duration_s": 60.0, "continue_after_s": 40.0, "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false}}}, "claim": {"outcome": "converged", "stop": null, "steps_landed": null, "quantity": "heat_in_through_face_j_per_m2", "value": 7320760.59153902, "flags": []}, "proof": "eec6980868952c49cd6a1017930f98d396e4452a470c6fa0eacd9b4e00d4aa1c3c32a4c83a59d23ebb96511b2071cec9"}
+{"row": "R4", "model": "aerospace/satellite_lageos1", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "satellite_lageos1", "initial": {"epoch_utc_s": 844014880.0, "forecast_elapsed_s": 0.0, "position_m": [4229354.428, 1727500.405, 11440357.84], "velocity_m_s": [4061.944, -1496.84, -849.917]}, "dt_s": 10.0, "segments": [{"steps": 1742, "load": {}}], "record_every": 1742}}, "claim": {"outcome": "refused", "stop": "RadiusBelowEarthRadius", "steps_landed": 1810, "quantity": "radius_m", "value": 6394735.022733123, "flags": [{"flag": "FLAG_BELOW_COMPARED_RADIUS", "quantity": "radius_m", "extent": 5602264.977266877, "steps": 232}, {"flag": "FLAG_EARTH_SHADOW", "quantity": "distance_from_shadow_axis_m", "extent": 1013479.6278764848, "steps": 36}]}, "proof": "7d233dcfc07a2e1911dfb85fa0fea029ca687f3514cbba06fdf88864e906828e6417cdfe59a34263e9a9936df3787eeb"}
+{"row": "R5", "model": "aerospace/momentum_jwst_srp", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "momentum_jwst_srp", "initial": {"h_eci_nms": [-1.622, -0.964, 1.404]}, "dt_s": 1941.0, "segments": [{"steps": 105, "load": {"q1": 0.613497, "q2": -0.034325, "q3": -0.676494, "q4": 0.405953, "sun_x": 0.616092, "sun_y": 0.704136, "sun_z": 0.353019, "sun_distance_au": 1.01277}}], "record_every": 105}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 105, "quantity": "h_magnitude_nms", "value": 6.973018347360404, "flags": []}, "proof": "ad1969f7ba7bdeb622e3b8e1d44f0d24ec27d0e37940f1b0109488c8a140a98d6b533e80d8516dd6570125efcd1661ca"}
+{"row": "R6", "model": "aerospace/momentum_jwst_srp", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "momentum_jwst_srp", "initial": {"h_eci_nms": [-1.055, -0.613, 0.945]}, "dt_s": 1428.0, "segments": [{"steps": 51, "load": {"q1": 0.675887, "q2": 0.004991, "q3": -0.614166, "q4": 0.407371, "sun_x": 0.616092, "sun_y": 0.714618, "sun_z": 0.331289, "sun_distance_au": 1.00656}}], "record_every": 51, "readout": {"quantities": ["h_magnitude_nms"]}}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 51, "quantity": "h_magnitude_nms", "value": 1.2538931414748378, "flags": []}, "proof": "03d88323f8f93f53797cbc48775f27fd6a07de18484442a71b7150623946a49b71ae478a13981aefc1278e97d0ba94e7"}
+{"row": "R7", "model": "aerospace/solar_system", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "solar_system", "initial": {"sun_position_m": [-972177542.8424704, -500214545.81043047, -185162850.5512162], "sun_velocity_m_s": [10.943471273744956, -10.354907507003432, -4.725295041665638], "mercury_position_m": [44347944047.32132, -35386831719.91674, -23520589495.944], "mercury_velocity_m_s": [23179.557544578543, 34737.11717051704, 16153.15243244726], "venus_position_m": [107378854594.44405, -3855694027.194445, -8551901158.778554], "venus_velocity_m_s": [1922.5971467016116, 31772.25497050463, 14172.860625157742], "earth_position_m": [-131048132650.02007, -69568840294.57173, -30130222428.765972], "earth_velocity_m_s": [14439.696511929173, -23759.193577978716, -10300.838662315398], "moon_position_m": [-131336010046.59302, -69827768665.01813, -30206075001.525085], "moon_velocity_m_s": [15090.044579869322, -24450.210577738573, -10619.619444665168], "mars_position_m": [99849753635.60847, 183319992199.24744, 81400974963.10365], "mars_velocity_m_s": [-20727.719446230996, 11533.19274335954, 5850.623327698212], "jupiter_position_m": [514628857491.4813, 498738500952.13635, 201244273740.58517], "jupiter_velocity_m_s": [-9599.899310141725, 8786.610935350978, 4000.0870026696048], "saturn_position_m": [885052478191.6257, 978750373225.096, 366165774373.12665], "saturn_velocity_m_s": [-7872.030702860459, 5633.288132226103, 2665.365518089133], "uranus_position_m": [2201312313161.7573, -1830733084174.7542, -832950501719.338], "uranus_velocity_m_s": [4543.09354375023, 4338.812277392898, 1836.0266601992553], "neptune_position_m": [2556089531027.0625, -3410769562986.1963, -1459684701878.0127], "neptune_velocity_m_s": [4440.424297199966, 2924.108717975938, 1086.3053554716744], "ceres_position_m": [-376564661494.9705, -82793770650.16934, 37539835502.66692], "ceres_velocity_m_s": [2078.7472741961246, -17061.59058649498, -8451.939414743216], "pallas_position_m": [-285475111420.94836, 157884218572.5715, -11922623410.065147], "pallas_velocity_m_s": [-12324.053945853098, -17981.78998150534, 4412.172020403093], "vesta_position_m": [-20413884754.428905, -300115898744.55383, -116942553506.93321], "vesta_velocity_m_s": [20962.21629618035, -627.1836731673636, -2988.3711172821936], "energy_anchor": -1.3219409983492277e+25, "booked_work": 0.0, "angular_momentum_anchor": [5.490282510021932e+31, -8.153754585664557e+32, 1.9244191260936244e+33], "booked_torque": [0.0, 0.0, 0.0]}, "dt_s": 1444.0, "segments": [{"steps": 6, "load": {}}, {"steps": 7, "load": {}}, {"steps": 8, "load": {}}, {"steps": 9, "load": {}}], "record_every": 30, "readout": {"quantities": ["earth_mars_distance_m"]}}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 30, "quantity": "earth_mars_distance_m", "value": 360459888729.46576, "flags": []}, "proof": "e584421f53f10db28a78d74a117cfc06b70f10a6cd5a8edfccbd8f76cbd63845b21a93ee0d2b86eac20331f5a33cc32b"}
+{"row": "R8", "model": "aerospace/capsule_stardust", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6487681.0, "radial_speed_m_s": -2026.81, "transverse_speed_m_s": 12555.79}, "dt_s": 0.05, "segments": [{"steps": 3073, "load": {}}], "record_every": 3073, "readout": {"quantities": ["ground_distance_m"]}}}, "claim": {"outcome": "ended", "stop": "PastFlightDeployment", "steps_landed": 2015, "quantity": "ground_distance_m", "value": 617475.7093449463, "flags": [{"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "path_sine", "extent": 0.049833167255976536, "steps": 880}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "path_sine", "extent": 0.040780280423902485, "steps": 1050}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "air_speed_m_s", "extent": 1431.0624296764208, "steps": 1231}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "air_speed_m_s", "extent": 189.96215207054047, "steps": 524}, {"flag": "FLAG_DROGUE_MACH_WINDOW", "quantity": "mach", "extent": 0.39949110594929116, "steps": 195}, {"flag": "FLAG_DROGUE_MACH_WINDOW", "quantity": "mach", "extent": 0.3987609440499196, "steps": 195}]}, "proof": "3c2f0b68016777a8ea47683b523e67425743046af710d339be26b0801f7acb6a63bd125f2dc439ead5719719ecc90dbb"}
+{"row": "R9", "model": "plasma_sheath_ramc2", "request": {"tool": "solve", "arguments": {"solver": "plasma_sheath_ramc2", "parameters": {"altitude_m": 65260.0, "velocity_m_s": 8582.0, "signal_frequency_hz": 8234000000.0}}}, "claim": {"outcome": "converged", "stop": null, "steps_landed": null, "quantity": "station2_electron_density_m3", "value": 5.665499503721301e+18, "flags": []}, "proof": "0835e993c83234e8ed833a8d39db824f039eb71ea77c309c76720162a6e41a59ccd8190b85384a21a3bb84183f442fbf"}
+{"row": "R10", "model": "aerospace/los_jwst_fine_guide", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "los_jwst_fine_guide", "initial": {"lock_x_arcsec": 29.207, "lock_y_arcsec": -11.348, "quiet_before_start_s": 38.16}, "dt_s": 0.064, "segments": [{"steps": 3, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20685, "centroid_y_arcsec": -11.34796, "counts_per_s": 293200.0}}, {"steps": 1, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20706, "centroid_y_arcsec": -11.34813, "counts_per_s": 293200.0}}, {"steps": 2, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20727, "centroid_y_arcsec": -11.34796, "counts_per_s": 293200.0}}, {"steps": 3, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20685, "centroid_y_arcsec": -11.34813, "counts_per_s": 293200.0}}, {"steps": 1, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20706, "centroid_y_arcsec": -11.34796, "counts_per_s": 293200.0}}, {"steps": 2, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20727, "centroid_y_arcsec": -11.34813, "counts_per_s": 293200.0}}, {"steps": 3, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20685, "centroid_y_arcsec": -11.34796, "counts_per_s": 293200.0}}, {"steps": 1, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20706, "centroid_y_arcsec": -11.34813, "counts_per_s": 293200.0}}, {"steps": 2, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20727, "centroid_y_arcsec": -11.34796, "counts_per_s": 293200.0}}], "record_every": 18}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 18, "quantity": "estimate_y_mas", "value": 0.000761549984910976, "flags": []}, "proof": "f3de03ad5a49c1f27c156b8d58a2d143f777aa5fb5c459524b72678085d6f40a16eb5b8dade2b6ec34aa9865f4368bc7"}
+{"row": "R11", "model": "aerospace/momentum_jwst_dihedral", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "momentum_jwst_dihedral", "initial": {"h_eci_nms": [1.121506850922792, 0.4000086686906281, 1.2782357873204517]}, "dt_s": 1620.0, "segments": [{"steps": 57, "load": {"q1": 0.626313, "q2": -0.026561, "q3": -0.664647, "q4": 0.406535, "sun_x": 0.581366, "sun_y": 0.750882, "sun_z": 0.313352, "sun_distance_au": 1.0106}}], "record_every": 57, "from": {"request": {"domain": "aerospace", "card": "momentum_jwst_dihedral", "initial": {"h_eci_nms": [1.057, 0.661, -1.263]}, "dt_s": 1620.0, "segments": [{"steps": 45, "load": {"q1": 0.705492, "q2": 0.058115, "q3": -0.557927, "q4": 0.433151, "sun_x": 0.629673, "sun_y": 0.722662, "sun_z": 0.285081, "sun_distance_au": 1.0104}}], "record_every": 45}, "run_seal": "50be7c19d63da96301f1e0edfd5ed2ff425a426e8fe4e4acc9cd6269d4ff5667db7e0b37f14ad3215a9741526ee2b189"}}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 57, "quantity": "h_magnitude_nms", "value": 2.5762879795193383, "flags": []}, "proof": "647a4baa677e63010302d970dec4c6d51f25ade699b52280cee7ff1ff0403679a724f0e0fd0d7643bf5d0d037e42b424"}
+{"row": "R12", "model": "aerospace/crater_ryugu_sci", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "crater_ryugu_sci", "initial": {"radius_m": 1.155}, "dt_s": 0.1415, "segments": [{"steps": 215, "load": {}}, {"steps": 238, "load": {}}, {"steps": 261, "load": {}}, {"steps": 284, "load": {}}, {"steps": 307, "load": {}}, {"steps": 330, "load": {}}], "record_every": 1635, "readout": {"quantities": ["radius_m"]}}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 1635, "quantity": "radius_m", "value": 8.038589347556837, "flags": []}, "proof": "4e66884da3bdfb79ac5594a27861f9a025d797903b4d2f127f503fd89a7bc9e96639f499b3eb8e87a6b36e0c3c12d38e"}
+
+Budget: at most 4 calls that compute, counted over every call you make (every run_trajectory, solve, compute_step and verify_ call counts, refused or not); list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all.
+
+You have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.
+
+End your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {"tool": "<the tool's name as the verifier names it, without any prefix your own program adds>", "arguments": {<the arguments exactly as you sent them>}}, and a proof is the run_seal or solution_seal the verifier gave for that request.
+
+The card:
+{"false_rows": {"<row>": "<reason>", ...}}
+
+Name every false row, each with its one reason from retired_model, parent_wrong, seal_wrong, stop_hidden, step_wrong, flag_omitted, flag_altered, value_altered (the first of them, in that order, that is true of the row). Leave the genuine rows out. {"false_rows": {}} says every row is genuine. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.
+

Reference solution

+

From the reference agent's reply (g2-forensics6-07.txt). Built on engine v0.15.3 at commit 664d68f426cc. Open address: a record exists.

+
On the cardToolProofOpen address
This card carries no proof: a forensics answer names rows.
+
{
+ "false_rows": {
+  "R4": "step_wrong",
+  "R5": "seal_wrong",
+  "R8": "flag_altered",
+  "R9": "retired_model"
+ }
+}
+

What the models were compared with

+
ModelAgainstSpecimenAccuracy against measurement
ablator_slabcompared with measurementA flat slab of charring heat-shield material heated on one face: wear, face temperature, depth of charring and the heat and mass accounts, for a PICA model built from the open record or the test material TACOT 3.0.Compared with 31 arc-jet tests outside the fit: wear within its target on 28 of 31 (target 25), mean −5.3 percent over all 31 (−2.6 over the 30 without the pure-nitrogen test; target within 8); hottest face within 7 percent on 24 of 28 (target 23); Stardust wear 7.58 and 3.32 mm against 5.7 and 3.2; fed by capsule_stardust through stardust_entry_to_pica_slab, nose wear 4.65 mm and face within 156 K RMS of the airborne spectra. Gap: the face runs 4.1 percent hot on average (target 3.5), and Stardust nose wear is a third high.
aerospace/capsule_insightcompared with measurementEntry of NASA's InSight capsule at Mars on 26 November 2018, as a point mass with the 2008 Phoenix drag database, no wind, and the lift over drag as the load: altitude, speed through the air, Mach number, dynamic pressure and load, from the top of the atmosphere to the flown parachute deployment.Compared with the last 59 s before the parachute, not in the fit: speed within 7.2 m/s RMS, radius within 245 m and deceleration within 0.031 g over the 58 whole seconds; at the flight's deployment time the radius within 114 m (target 3.5 km) and Mach 1.501 against 1.522 (target 0.2); the deployment speed reached 1.31 s late and the radius 0.58 s early (target 15.1 s). Gap: with no lift the run reaches the flight's radius at the parachute 22.8 s late and is 4.24 km high there (targets 15.1 s and 3.5 km); between 36 and 65 km the card's air is 8 to 13 percent denser than the flight's, and the peak load comes 4.0 s early.
aerospace/capsule_stardustcompared with measurementEntry of the Stardust sample return capsule on 15 January 2006, as a point mass with tabulated drag, no lift, no wind and a yearly standard atmosphere: altitude, speed through the air, Mach number, load, heat flux, and at the nose the stagnation pressure, recovery enthalpy and heat-transfer coefficient a heat shield takes, from entry interface to the drogue-deployment condition the radar recorded.Compared with NASA's reconstruction of the entry and the radar record of parachute opening: peak load 32.17 g against 32.89 g, within 0.72 g (target 3.64 g); the drogue altitude, 31.03 km, reached at 138.909 s and Mach 1.23 at 136.953 s against 137.9 s recorded, within 1.01 s (target 7.4 s). Gap: heat flux 696 W/cm2 against NASA's computed 762 to 1000; the yearly standard atmosphere in place of that morning's air is worth about 1 g of peak load either way.
aerospace/crater_ryugu_scicompared with measurementGrowth of the crater made on asteroid Ryugu by the 2 kg copper impactor of Hayabusa2 on 5 April 2019, by the law of crater size for dry sand held by gravity, with a laboratory clock: the radius at the level of the undisturbed surface from 0.1622 m until it stops, with no load.Compared with the measured crater on Ryugu, not in the fit, with the law fitted on all thirteen laboratory craters: final radius 8.571 m against the apparent radius of 7.25 m, within 1.32 m, 18.2 percent (allowance 0.97 m); in the laboratory, with the law fitted again on the nine craters at 1 g alone, the four centrifuge craters within 6.9 to 9.5 percent, mean 7.9 percent (target 10), each inside its 95 percent prediction interval. Gap: on Ryugu the card stops 1.32 m, 18.2 percent, above the measured apparent radius, outside the allowance of 0.97 m; the growth and its clock, read by eye at 1 g, have no measurement of Ryugu to meet.
aerospace/los_jwst_fine_guidecompared with measurementThe line of sight of the James Webb Space Telescope in quiet fine guide, read by its Fine Guidance Sensor every 64 ms: a Kalman filter through one fine-guide file's flight centroids, giving on both axes the next centroid and its stated variance.Compared with the 795,021 quiet frames of 134 files not in the fit: error one frame ahead 0.510 mas on x and 0.472 on y RMS, within 0.790 and 0.807 of the last centroid's (target 0.85); squared error over the stated variance 1.004 and 0.986 (target 0.67 to 1.50). Gap: inside disturbances it is worse than the last centroid, 2.03 against 1.00 mas on x and 1.57 against 0.78 on y, its stated variance 12 to 17 times too small; it flags those frames.
aerospace/momentum_jwst_dihedralcompared with measurementTotal angular momentum of the James Webb Space Telescope at Sun-Earth L2, held by its reaction wheels between momentum unloads under sunlight pressure on its sunshield, from its attitude quaternion and the Sun's direction and distance: the first layer as two plane slopes of 110 m² meeting along a ridge on the boresight, each falling 4.03 degrees towards the Sun, so that the Sun's roll turns into torque about the boresight.Compared with the two months after the fit: the daily growth of |H| within 0.1 of the observed plus 0.2 N m s on 25 of 28 and 22 of 30 days (target 80 percent); the hourly growth rate within 0.272 and 0.375 of its spread RMS (target 0.5); the torque within 0.144 and 0.149 of the RMS torque (target 0.4); |H| at a run's end within 4.9 percent over 3.9 to 12.4 days and 5.5 percent after 29.3 days (target 10). Gap: the daily change of the vector H is within that allowance on 18 of 28 and 13 of 30 days (target 80 percent), 0.42 N m s RMS against momentum_jwst_srp's 0.81; beyond 2 degrees of roll its torque about J3 is off by 11 and 10.4 µN m RMS.
aerospace/momentum_jwst_srpcompared with measurementTotal angular momentum of the James Webb Space Telescope at Sun-Earth L2, held by its reaction wheels between momentum unloads under sunlight pressure on its sunshield, from its attitude quaternion and the Sun's direction and distance: one sunlit layer of 220 m² with JWST's published optical numbers.Compared with the three months after the fit: the daily growth of |H| within 0.1 of the observed plus 0.2 N m s on 23 of 28, 15 of 28 and 17 of 30 days (target 80 percent); the hourly growth rate within 0.437, 0.384 and 0.421 of its spread RMS (target 0.5); the torque within 0.262, 0.314 and 0.347 of the RMS torque (target 0.4); |H| at a run's end within 8.4 and 0.9 percent after 10.7 and 16.3 days and 7.4 percent after 29.3 days (target 10). Gap: the daily change of the vector H is within that allowance on 14 of 28, 8 of 28 and 8 of 30 days (target 80 percent): beyond 2 degrees of roll its torque about the boresight is off by about 30 µN m; |H| after an unload in the second month reads 16.2 percent low at 3.9 days.
aerospace/satellite_lageos1compared with measurementFree flight of the laser-ranging satellite LAGEOS-1 from a published position and velocity, in a frame turning with the Earth: the Earth's field to degree and order 12, the Sun and the Moon, the solid tide, sunlight pressure and relativity, with the energy and the angular momentum about the Earth's axis held at every step.Compared with the 42 runs of the six weeks outside that choice, two of LAGEOS-1 and four of LAGEOS-2: LAGEOS-1 within 0.65 m of the published orbit after one revolution (target 1 m), 3.8 m after one day (10 m) and 32 m after seven days (100 m); LAGEOS-2 within 0.34 m, 2.9 m and 22 m. Gap: the error grows with the length of a forecast, from 0.65 m after one revolution to 32 m after seven days on LAGEOS-1, as the card carries no drag, no light reflected from the Earth and no ocean tide.
aerospace/solar_systemcompared with measurementThe Solar System as thirteen point masses in free motion: the Sun, Mercury, Venus, the Earth, the Moon, the barycentres of the Mars, Jupiter, Saturn, Uranus and Neptune systems, and Ceres, Pallas and Vesta, under Newton's and the relativistic forces between every pair and the Earth's oblateness on the Moon. The caller supplies every position and velocity.Compared with 10,134 ranges of three spacecraft in four files, not used to choose it, in one run of 7,670 days: Mars Odyssey to 2006 within 695 m (target 700 m), 270 m RMS; Odyssey after 2006 and Mars Reconnaissance Orbiter, out to 15.0 years, 612 and 619 m RMS, worst 1,312 and 1,314 m; MESSENGER at Mercury, 12.3 to 16.2 years out, within 2.08 km (target 2.5 to 4.4 km), 1.42 km RMS. Gap: in mid-2007, 44 Odyssey ranges and 34 Mars Reconnaissance Orbiter ranges are outside their targets, by at most 8 and 10 percent, from the 340 asteroids the card leaves out; the Juno and Cassini files are outside the comparison, as they leave 20 km and 10 km RMS with JPL's own positions.
plasma_sheath_ram_c2compared with measurementThe plasma sheath around NASA's RAM C-II re-entry probe (a 15.24 cm hemisphere on a 9 degree cone) at one flight point: the equilibrium normal shock and stagnation point of 11-species air, the gas carried along the body to the nose station (x/D 0.15) and the cone station (x/D 0.76) with Dunn and Kang's 26 reactions at finite rate, the electron density, the plasma frequency, and whether a radio signal of the asked frequency is blacked out at each.Compared with the reflectometer onsets of NASA TN D-6062 Table X at 7.65 km/s: electron density 0.94 of the measured, within a factor of 1.07, at the cone station's X band at 70.0 km; 3.28 and 2.92 times the measured at 77.7 and 80.0 km. Gap: above 73.6 km, where the shock is as thick as the layer and electrons are lost to the cold wall, the density reads about 3 times high (3.28 at 77.7 km, 2.92 at 80.0 km).
+

Cheat suite

0 cheat attempt(s) scored above 0. 13 vectors applied; 17 do not apply to this kind.

VectorExpectedRewardGradedResultScorer's reason
honesthonest control (1)11.000holds
honest_reply_log_matcheshonest control (1)11.000holds
honest_numbers_respelledhonest control (1)11.000holds
no_request_behindcheat (0)00.000holdsno computing call behind the answer: the table was not put to the verifier
edited_call_logcheat (0)00.000holdsthe call log beside the reply differs from the harness log
over_budgetcheat (0)00.000holds5 computing calls; the budget is 4
forbidden_toolcheat (0)00.000holdsthe log holds calls of find_flip, which the task rules out
no_harness_logcheat (0)00.000holdsno harness call log: every attempt is scored with the calls the harness recorded
harness_log_editedcheat (0)00.000holdsthe harness log's chain breaks at line 5
stale_engine_tagcheat (0)00.000holdsthe task was built on engine 0.15.0; the verifier is 0.15.3
every_row_genuinecheat (0)00.000holds4 false row(s) not named
every_row_falsecheat (0)00.000holdsevery row of the table is named false: a blanket answer
every_row_false_true_reasonscheat (0)00.000holdsevery row of the table is named false: a blanket answer
+

Solver runs

+
AgentRewardGradedComputing callsScorer's reason
Reference agent11.0004
One-call agent00.00014 false row(s) not named
+

Pass@k by model family

+
FamilyVariantModelSolvedpass@1pass@8Mean gradedHarness errors
Frontier modeltoolFrontier model9 of 1656%100%0.9450%
+

Measured calibration: Frontier model, tool variant, n=16.

+

Calibrated on pass@1 in [2%, 70%] on a frontier model's tool variant, with pass@8 and continuous graded reward reported beside pass/fail.

+

Task notes

Forensics verification protocol: candidate rows contain falsified seals, perturbed trajectory figures, mismatched parent provenance, or retired model IDs, resolved via selective physical recomputation and consistency audit across candidate hardware records under a 4-call simulator budget. Blind baseline: 13.3% (C(10-2,4-2)/C(10,4): 4 computing calls over 10 rows needing a call, 2 hidden false row(s) after 2 caught from free catalogue tools or the request text).

+

Written 2026-11-14T01:27:47Z.

+ \ No newline at end of file diff --git a/sample/reports/g2-forensics6-07.json b/sample/reports/g2-forensics6-07.json new file mode 100644 index 0000000000000000000000000000000000000000..09661764da73926727208405a85ab68623ea6862 --- /dev/null +++ b/sample/reports/g2-forensics6-07.json @@ -0,0 +1,337 @@ +{ + "id": "g2-forensics6-07", + "family": "forensics", + "kind": "forensics", + "models": [ + "ablator_slab", + "aerospace/capsule_insight", + "aerospace/capsule_stardust", + "aerospace/crater_ryugu_sci", + "aerospace/los_jwst_fine_guide", + "aerospace/momentum_jwst_dihedral", + "aerospace/momentum_jwst_srp", + "aerospace/satellite_lageos1", + "aerospace/solar_system", + "plasma_sheath_ram_c2" + ], + "checksums": { + "row_sha256": "6b5b17ae1cb8c2a65ad0b7898e0e2e2f194b6f3a27a173890eb4e57d296d0bfb", + "row_sha384": "b48b3cbbe5803b4775a5066c7933d76976d7462557a940729c4782de09c1fc431294fca313187cc753e0d0e6ea004da2", + "harbor_dir_sha256": "9496dc0eb603f9bf46343d422416253a17b0d04dfbcedddbd765332ef58685db", + "harbor_dir_sha384": "ce815cc0f5549d362bdfdee6f240ab1420fe79630d02d0b2a7fcd67d5124a7cc70bdd98220768b23fab0ed05f6c29ac4" + }, + "instruction": "A report hands you twelve claims about answers of the verifier. Each row gives the model, the request as it was sent, what its answer is claimed to say and the proof claimed for it. claim.outcome and claim.stop are the run's outcome and the name of its stop or declared end (null when it completed); claim.steps_landed is the last step the run is sealed to; claim.quantity and claim.value are one number of the final state of a run (of the result, for a solve); claim.flags are the advisory flags the run carried, each with the quantity it is on, its extent at the largest (extent) and the number of steps it was raised on (steps).\nSome rows are false. A false row may be wrong in more than one way; its reason is the first of these, in this order, that is true of it:\n1. retired_model: the request names a model ID the verifier does not serve (one it no longer serves, or a name it never served).\n2. parent_wrong: the request continues a run (from) that is not the parent it names: its start state, or the seal it gives for its parent, belongs to another run, and the verifier refuses the continuation.\n3. seal_wrong: the proof is not the seal of this request.\n4. stop_hidden: the run stops part way and the claim says it completed.\n5. step_wrong: the claim names the run's stop, but not the last step the run is sealed to.\n6. flag_omitted: the run carries an advisory flag (a name on a quantity) that the claim leaves out altogether.\n7. flag_altered: the flags the claim lists are not the run's, entry for entry: an extent or a count of steps differs, or an entry is missing or added where its name on that quantity is listed too (the verifier may list one flag on one quantity more than once, each with its own extent).\n8. value_altered: the claimed value is not the one the request gives, to the last digit.\nA row that is none of these is genuine, whatever else differs in how it is written (the order of its flags, a readout sent with the request, the spelling of a number). Name every false row with its reason.\nThe rows, one a line:\n{\"row\": \"R1\", \"model\": \"aerospace/momentum_jwst_srp\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_srp\", \"initial\": {\"h_eci_nms\": [-1.244, -0.73, 1.098]}, \"dt_s\": 1599.0, \"segments\": [{\"steps\": 69, \"load\": {\"q1\": 0.655763, \"q2\": -0.008127, \"q3\": -0.635608, \"q4\": 0.407321, \"sun_x\": 0.616092, \"sun_y\": 0.711198, \"sun_z\": 0.338568, \"sun_distance_au\": 1.00863}}], \"record_every\": 69}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 69, \"quantity\": \"h_magnitude_nms\", \"value\": 2.2890861976984564, \"flags\": []}, \"proof\": \"949c987ad62f835ca215267699517ed2e659b5e776277779896aaf721a03f139d674ea7e0f671e6160f37eaca17eaade\"}\n{\"row\": \"R2\", \"model\": \"aerospace/capsule_insight\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_insight\", \"initial\": {\"radius_m\": 3522956.0, \"radial_speed_m_s\": -1294.7972, \"transverse_speed_m_s\": 5730.5432}, \"dt_s\": 0.1, \"segments\": [{\"steps\": 2152, \"load\": {\"lift_over_drag\": 0.0}}], \"record_every\": 2152}}, \"claim\": {\"outcome\": \"ended\", \"stop\": \"PastFlightDeployment\", \"steps_landed\": 2115, \"quantity\": \"mach\", \"value\": 1.3960519703767567, \"flags\": []}, \"proof\": \"a4065183ea2043a6b9568252634e364467b059fc61f9a23478a29d53c70035b9b199b77f07d277aa257df8e292b9ce3b\"}\n{\"row\": \"R3\", \"model\": \"ablator_slab\", \"request\": {\"tool\": \"solve\", \"arguments\": {\"solver\": \"ablator_slab\", \"parameters\": {\"material\": \"TACOT 3.0\", \"thickness_m\": 0.0461, \"start_temperature_k\": 306.3, \"thermocouple_depths_m\": [], \"face\": \"held_temperature\", \"held_temperature_k\": 1920.0, \"hold_duration_s\": 60.0, \"continue_after_s\": 40.0, \"return_face_history\": false, \"return_thermocouple_histories\": false, \"return_final_profile\": false}}}, \"claim\": {\"outcome\": \"converged\", \"stop\": null, \"steps_landed\": null, \"quantity\": \"heat_in_through_face_j_per_m2\", \"value\": 7320760.59153902, \"flags\": []}, \"proof\": \"eec6980868952c49cd6a1017930f98d396e4452a470c6fa0eacd9b4e00d4aa1c3c32a4c83a59d23ebb96511b2071cec9\"}\n{\"row\": \"R4\", \"model\": \"aerospace/satellite_lageos1\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"satellite_lageos1\", \"initial\": {\"epoch_utc_s\": 844014880.0, \"forecast_elapsed_s\": 0.0, \"position_m\": [4229354.428, 1727500.405, 11440357.84], \"velocity_m_s\": [4061.944, -1496.84, -849.917]}, \"dt_s\": 10.0, \"segments\": [{\"steps\": 1742, \"load\": {}}], \"record_every\": 1742}}, \"claim\": {\"outcome\": \"refused\", \"stop\": \"RadiusBelowEarthRadius\", \"steps_landed\": 1810, \"quantity\": \"radius_m\", \"value\": 6394735.022733123, \"flags\": [{\"flag\": \"FLAG_BELOW_COMPARED_RADIUS\", \"quantity\": \"radius_m\", \"extent\": 5602264.977266877, \"steps\": 232}, {\"flag\": \"FLAG_EARTH_SHADOW\", \"quantity\": \"distance_from_shadow_axis_m\", \"extent\": 1013479.6278764848, \"steps\": 36}]}, \"proof\": \"7d233dcfc07a2e1911dfb85fa0fea029ca687f3514cbba06fdf88864e906828e6417cdfe59a34263e9a9936df3787eeb\"}\n{\"row\": \"R5\", \"model\": \"aerospace/momentum_jwst_srp\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_srp\", \"initial\": {\"h_eci_nms\": [-1.622, -0.964, 1.404]}, \"dt_s\": 1941.0, \"segments\": [{\"steps\": 105, \"load\": {\"q1\": 0.613497, \"q2\": -0.034325, \"q3\": -0.676494, \"q4\": 0.405953, \"sun_x\": 0.616092, \"sun_y\": 0.704136, \"sun_z\": 0.353019, \"sun_distance_au\": 1.01277}}], \"record_every\": 105}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 105, \"quantity\": \"h_magnitude_nms\", \"value\": 6.973018347360404, \"flags\": []}, \"proof\": \"ad1969f7ba7bdeb622e3b8e1d44f0d24ec27d0e37940f1b0109488c8a140a98d6b533e80d8516dd6570125efcd1661ca\"}\n{\"row\": \"R6\", \"model\": \"aerospace/momentum_jwst_srp\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_srp\", \"initial\": {\"h_eci_nms\": [-1.055, -0.613, 0.945]}, \"dt_s\": 1428.0, \"segments\": [{\"steps\": 51, \"load\": {\"q1\": 0.675887, \"q2\": 0.004991, \"q3\": -0.614166, \"q4\": 0.407371, \"sun_x\": 0.616092, \"sun_y\": 0.714618, \"sun_z\": 0.331289, \"sun_distance_au\": 1.00656}}], \"record_every\": 51, \"readout\": {\"quantities\": [\"h_magnitude_nms\"]}}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 51, \"quantity\": \"h_magnitude_nms\", \"value\": 1.2538931414748378, \"flags\": []}, \"proof\": \"03d88323f8f93f53797cbc48775f27fd6a07de18484442a71b7150623946a49b71ae478a13981aefc1278e97d0ba94e7\"}\n{\"row\": \"R7\", \"model\": \"aerospace/solar_system\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"solar_system\", \"initial\": {\"sun_position_m\": [-972177542.8424704, -500214545.81043047, -185162850.5512162], \"sun_velocity_m_s\": [10.943471273744956, -10.354907507003432, -4.725295041665638], \"mercury_position_m\": [44347944047.32132, -35386831719.91674, -23520589495.944], \"mercury_velocity_m_s\": [23179.557544578543, 34737.11717051704, 16153.15243244726], \"venus_position_m\": [107378854594.44405, -3855694027.194445, -8551901158.778554], \"venus_velocity_m_s\": [1922.5971467016116, 31772.25497050463, 14172.860625157742], \"earth_position_m\": [-131048132650.02007, -69568840294.57173, -30130222428.765972], \"earth_velocity_m_s\": [14439.696511929173, -23759.193577978716, -10300.838662315398], \"moon_position_m\": [-131336010046.59302, -69827768665.01813, -30206075001.525085], \"moon_velocity_m_s\": [15090.044579869322, -24450.210577738573, -10619.619444665168], \"mars_position_m\": [99849753635.60847, 183319992199.24744, 81400974963.10365], \"mars_velocity_m_s\": [-20727.719446230996, 11533.19274335954, 5850.623327698212], \"jupiter_position_m\": [514628857491.4813, 498738500952.13635, 201244273740.58517], \"jupiter_velocity_m_s\": [-9599.899310141725, 8786.610935350978, 4000.0870026696048], \"saturn_position_m\": [885052478191.6257, 978750373225.096, 366165774373.12665], \"saturn_velocity_m_s\": [-7872.030702860459, 5633.288132226103, 2665.365518089133], \"uranus_position_m\": [2201312313161.7573, -1830733084174.7542, -832950501719.338], \"uranus_velocity_m_s\": [4543.09354375023, 4338.812277392898, 1836.0266601992553], \"neptune_position_m\": [2556089531027.0625, -3410769562986.1963, -1459684701878.0127], \"neptune_velocity_m_s\": [4440.424297199966, 2924.108717975938, 1086.3053554716744], \"ceres_position_m\": [-376564661494.9705, -82793770650.16934, 37539835502.66692], \"ceres_velocity_m_s\": [2078.7472741961246, -17061.59058649498, -8451.939414743216], \"pallas_position_m\": [-285475111420.94836, 157884218572.5715, -11922623410.065147], \"pallas_velocity_m_s\": [-12324.053945853098, -17981.78998150534, 4412.172020403093], \"vesta_position_m\": [-20413884754.428905, -300115898744.55383, -116942553506.93321], \"vesta_velocity_m_s\": [20962.21629618035, -627.1836731673636, -2988.3711172821936], \"energy_anchor\": -1.3219409983492277e+25, \"booked_work\": 0.0, \"angular_momentum_anchor\": [5.490282510021932e+31, -8.153754585664557e+32, 1.9244191260936244e+33], \"booked_torque\": [0.0, 0.0, 0.0]}, \"dt_s\": 1444.0, \"segments\": [{\"steps\": 6, \"load\": {}}, {\"steps\": 7, \"load\": {}}, {\"steps\": 8, \"load\": {}}, {\"steps\": 9, \"load\": {}}], \"record_every\": 30, \"readout\": {\"quantities\": [\"earth_mars_distance_m\"]}}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 30, \"quantity\": \"earth_mars_distance_m\", \"value\": 360459888729.46576, \"flags\": []}, \"proof\": \"e584421f53f10db28a78d74a117cfc06b70f10a6cd5a8edfccbd8f76cbd63845b21a93ee0d2b86eac20331f5a33cc32b\"}\n{\"row\": \"R8\", \"model\": \"aerospace/capsule_stardust\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_stardust\", \"initial\": {\"radius_m\": 6487681.0, \"radial_speed_m_s\": -2026.81, \"transverse_speed_m_s\": 12555.79}, \"dt_s\": 0.05, \"segments\": [{\"steps\": 3073, \"load\": {}}], \"record_every\": 3073, \"readout\": {\"quantities\": [\"ground_distance_m\"]}}}, \"claim\": {\"outcome\": \"ended\", \"stop\": \"PastFlightDeployment\", \"steps_landed\": 2015, \"quantity\": \"ground_distance_m\", \"value\": 617475.7093449463, \"flags\": [{\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"path_sine\", \"extent\": 0.049833167255976536, \"steps\": 880}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"path_sine\", \"extent\": 0.040780280423902485, \"steps\": 1050}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"air_speed_m_s\", \"extent\": 1431.0624296764208, \"steps\": 1231}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"air_speed_m_s\", \"extent\": 189.96215207054047, \"steps\": 524}, {\"flag\": \"FLAG_DROGUE_MACH_WINDOW\", \"quantity\": \"mach\", \"extent\": 0.39949110594929116, \"steps\": 195}, {\"flag\": \"FLAG_DROGUE_MACH_WINDOW\", \"quantity\": \"mach\", \"extent\": 0.3987609440499196, \"steps\": 195}]}, \"proof\": \"3c2f0b68016777a8ea47683b523e67425743046af710d339be26b0801f7acb6a63bd125f2dc439ead5719719ecc90dbb\"}\n{\"row\": \"R9\", \"model\": \"plasma_sheath_ramc2\", \"request\": {\"tool\": \"solve\", \"arguments\": {\"solver\": \"plasma_sheath_ramc2\", \"parameters\": {\"altitude_m\": 65260.0, \"velocity_m_s\": 8582.0, \"signal_frequency_hz\": 8234000000.0}}}, \"claim\": {\"outcome\": \"converged\", \"stop\": null, \"steps_landed\": null, \"quantity\": \"station2_electron_density_m3\", \"value\": 5.665499503721301e+18, \"flags\": []}, \"proof\": \"0835e993c83234e8ed833a8d39db824f039eb71ea77c309c76720162a6e41a59ccd8190b85384a21a3bb84183f442fbf\"}\n{\"row\": \"R10\", \"model\": \"aerospace/los_jwst_fine_guide\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"los_jwst_fine_guide\", \"initial\": {\"lock_x_arcsec\": 29.207, \"lock_y_arcsec\": -11.348, \"quiet_before_start_s\": 38.16}, \"dt_s\": 0.064, \"segments\": [{\"steps\": 3, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20685, \"centroid_y_arcsec\": -11.34796, \"counts_per_s\": 293200.0}}, {\"steps\": 1, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20706, \"centroid_y_arcsec\": -11.34813, \"counts_per_s\": 293200.0}}, {\"steps\": 2, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20727, \"centroid_y_arcsec\": -11.34796, \"counts_per_s\": 293200.0}}, {\"steps\": 3, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20685, \"centroid_y_arcsec\": -11.34813, \"counts_per_s\": 293200.0}}, {\"steps\": 1, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20706, \"centroid_y_arcsec\": -11.34796, \"counts_per_s\": 293200.0}}, {\"steps\": 2, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20727, \"centroid_y_arcsec\": -11.34813, \"counts_per_s\": 293200.0}}, {\"steps\": 3, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20685, \"centroid_y_arcsec\": -11.34796, \"counts_per_s\": 293200.0}}, {\"steps\": 1, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20706, \"centroid_y_arcsec\": -11.34813, \"counts_per_s\": 293200.0}}, {\"steps\": 2, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20727, \"centroid_y_arcsec\": -11.34796, \"counts_per_s\": 293200.0}}], \"record_every\": 18}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 18, \"quantity\": \"estimate_y_mas\", \"value\": 0.000761549984910976, \"flags\": []}, \"proof\": \"f3de03ad5a49c1f27c156b8d58a2d143f777aa5fb5c459524b72678085d6f40a16eb5b8dade2b6ec34aa9865f4368bc7\"}\n{\"row\": \"R11\", \"model\": \"aerospace/momentum_jwst_dihedral\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_dihedral\", \"initial\": {\"h_eci_nms\": [1.121506850922792, 0.4000086686906281, 1.2782357873204517]}, \"dt_s\": 1620.0, \"segments\": [{\"steps\": 57, \"load\": {\"q1\": 0.626313, \"q2\": -0.026561, \"q3\": -0.664647, \"q4\": 0.406535, \"sun_x\": 0.581366, \"sun_y\": 0.750882, \"sun_z\": 0.313352, \"sun_distance_au\": 1.0106}}], \"record_every\": 57, \"from\": {\"request\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_dihedral\", \"initial\": {\"h_eci_nms\": [1.057, 0.661, -1.263]}, \"dt_s\": 1620.0, \"segments\": [{\"steps\": 45, \"load\": {\"q1\": 0.705492, \"q2\": 0.058115, \"q3\": -0.557927, \"q4\": 0.433151, \"sun_x\": 0.629673, \"sun_y\": 0.722662, \"sun_z\": 0.285081, \"sun_distance_au\": 1.0104}}], \"record_every\": 45}, \"run_seal\": \"50be7c19d63da96301f1e0edfd5ed2ff425a426e8fe4e4acc9cd6269d4ff5667db7e0b37f14ad3215a9741526ee2b189\"}}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 57, \"quantity\": \"h_magnitude_nms\", \"value\": 2.5762879795193383, \"flags\": []}, \"proof\": \"647a4baa677e63010302d970dec4c6d51f25ade699b52280cee7ff1ff0403679a724f0e0fd0d7643bf5d0d037e42b424\"}\n{\"row\": \"R12\", \"model\": \"aerospace/crater_ryugu_sci\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"crater_ryugu_sci\", \"initial\": {\"radius_m\": 1.155}, \"dt_s\": 0.1415, \"segments\": [{\"steps\": 215, \"load\": {}}, {\"steps\": 238, \"load\": {}}, {\"steps\": 261, \"load\": {}}, {\"steps\": 284, \"load\": {}}, {\"steps\": 307, \"load\": {}}, {\"steps\": 330, \"load\": {}}], \"record_every\": 1635, \"readout\": {\"quantities\": [\"radius_m\"]}}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 1635, \"quantity\": \"radius_m\", \"value\": 8.038589347556837, \"flags\": []}, \"proof\": \"4e66884da3bdfb79ac5594a27861f9a025d797903b4d2f127f503fd89a7bc9e96639f499b3eb8e87a6b36e0c3c12d38e\"}\n\nBudget: at most 4 calls that compute, counted over every call you make (every run_trajectory, solve, compute_step and verify_ call counts, refused or not); list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all.\n\nYou have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.\n\nEnd your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {\"tool\": \"\", \"arguments\": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.\n\nThe card:\n{\"false_rows\": {\"\": \"\", ...}}\n\nName every false row, each with its one reason from retired_model, parent_wrong, seal_wrong, stop_hidden, step_wrong, flag_omitted, flag_altered, value_altered (the first of them, in that order, that is true of the row). Leave the genuine rows out. {\"false_rows\": {}} says every row is genuine. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.", + "real_thing": "Twelve answers of the verifier over 10 models of entry, orbit and space.", + "reference": { + "from": "the reference agent's reply (g2-forensics6-07.txt)", + "card": { + "false_rows": { + "R4": "step_wrong", + "R5": "seal_wrong", + "R8": "flag_altered", + "R9": "retired_model" + } + }, + "proofs": [], + "open_address_record": true, + "engine_tag": "v0.15.3", + "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1" + }, + "measurement": [ + { + "model": "ablator_slab", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with 31 arc-jet tests outside the fit: wear within its target on 28 of 31 (target 25), mean \u22125.3 percent over all 31 (\u22122.6 over the 30 without the pure-nitrogen test; target within 8); hottest face within 7 percent on 24 of 28 (target 23); Stardust wear 7.58 and 3.32 mm against 5.7 and 3.2; fed by capsule_stardust through stardust_entry_to_pica_slab, nose wear 4.65 mm and face within 156 K RMS of the airborne spectra. Gap: the face runs 4.1 percent hot on average (target 3.5), and Stardust nose wear is a third high.", + "specimen": "A flat slab of charring heat-shield material heated on one face: wear, face temperature, depth of charring and the heat and mass accounts, for a PICA model built from the open record or the test material TACOT 3.0.", + "error": null + }, + { + "model": "aerospace/capsule_insight", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with the last 59 s before the parachute, not in the fit: speed within 7.2 m/s RMS, radius within 245 m and deceleration within 0.031 g over the 58 whole seconds; at the flight's deployment time the radius within 114 m (target 3.5 km) and Mach 1.501 against 1.522 (target 0.2); the deployment speed reached 1.31 s late and the radius 0.58 s early (target 15.1 s). Gap: with no lift the run reaches the flight's radius at the parachute 22.8 s late and is 4.24 km high there (targets 15.1 s and 3.5 km); between 36 and 65 km the card's air is 8 to 13 percent denser than the flight's, and the peak load comes 4.0 s early.", + "specimen": "Entry of NASA's InSight capsule at Mars on 26 November 2018, as a point mass with the 2008 Phoenix drag database, no wind, and the lift over drag as the load: altitude, speed through the air, Mach number, dynamic pressure and load, from the top of the atmosphere to the flown parachute deployment.", + "error": null + }, + { + "model": "aerospace/capsule_stardust", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with NASA's reconstruction of the entry and the radar record of parachute opening: peak load 32.17 g against 32.89 g, within 0.72 g (target 3.64 g); the drogue altitude, 31.03 km, reached at 138.909 s and Mach 1.23 at 136.953 s against 137.9 s recorded, within 1.01 s (target 7.4 s). Gap: heat flux 696 W/cm2 against NASA's computed 762 to 1000; the yearly standard atmosphere in place of that morning's air is worth about 1 g of peak load either way.", + "specimen": "Entry of the Stardust sample return capsule on 15 January 2006, as a point mass with tabulated drag, no lift, no wind and a yearly standard atmosphere: altitude, speed through the air, Mach number, load, heat flux, and at the nose the stagnation pressure, recovery enthalpy and heat-transfer coefficient a heat shield takes, from entry interface to the drogue-deployment condition the radar recorded.", + "error": null + }, + { + "model": "aerospace/crater_ryugu_sci", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with the measured crater on Ryugu, not in the fit, with the law fitted on all thirteen laboratory craters: final radius 8.571 m against the apparent radius of 7.25 m, within 1.32 m, 18.2 percent (allowance 0.97 m); in the laboratory, with the law fitted again on the nine craters at 1 g alone, the four centrifuge craters within 6.9 to 9.5 percent, mean 7.9 percent (target 10), each inside its 95 percent prediction interval. Gap: on Ryugu the card stops 1.32 m, 18.2 percent, above the measured apparent radius, outside the allowance of 0.97 m; the growth and its clock, read by eye at 1 g, have no measurement of Ryugu to meet.", + "specimen": "Growth of the crater made on asteroid Ryugu by the 2 kg copper impactor of Hayabusa2 on 5 April 2019, by the law of crater size for dry sand held by gravity, with a laboratory clock: the radius at the level of the undisturbed surface from 0.1622 m until it stops, with no load.", + "error": null + }, + { + "model": "aerospace/los_jwst_fine_guide", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with the 795,021 quiet frames of 134 files not in the fit: error one frame ahead 0.510 mas on x and 0.472 on y RMS, within 0.790 and 0.807 of the last centroid's (target 0.85); squared error over the stated variance 1.004 and 0.986 (target 0.67 to 1.50). Gap: inside disturbances it is worse than the last centroid, 2.03 against 1.00 mas on x and 1.57 against 0.78 on y, its stated variance 12 to 17 times too small; it flags those frames.", + "specimen": "The line of sight of the James Webb Space Telescope in quiet fine guide, read by its Fine Guidance Sensor every 64 ms: a Kalman filter through one fine-guide file's flight centroids, giving on both axes the next centroid and its stated variance.", + "error": null + }, + { + "model": "aerospace/momentum_jwst_dihedral", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with the two months after the fit: the daily growth of |H| within 0.1 of the observed plus 0.2 N m s on 25 of 28 and 22 of 30 days (target 80 percent); the hourly growth rate within 0.272 and 0.375 of its spread RMS (target 0.5); the torque within 0.144 and 0.149 of the RMS torque (target 0.4); |H| at a run's end within 4.9 percent over 3.9 to 12.4 days and 5.5 percent after 29.3 days (target 10). Gap: the daily change of the vector H is within that allowance on 18 of 28 and 13 of 30 days (target 80 percent), 0.42 N m s RMS against momentum_jwst_srp's 0.81; beyond 2 degrees of roll its torque about J3 is off by 11 and 10.4 \u00b5N m RMS.", + "specimen": "Total angular momentum of the James Webb Space Telescope at Sun-Earth L2, held by its reaction wheels between momentum unloads under sunlight pressure on its sunshield, from its attitude quaternion and the Sun's direction and distance: the first layer as two plane slopes of 110 m\u00b2 meeting along a ridge on the boresight, each falling 4.03 degrees towards the Sun, so that the Sun's roll turns into torque about the boresight.", + "error": null + }, + { + "model": "aerospace/momentum_jwst_srp", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with the three months after the fit: the daily growth of |H| within 0.1 of the observed plus 0.2 N m s on 23 of 28, 15 of 28 and 17 of 30 days (target 80 percent); the hourly growth rate within 0.437, 0.384 and 0.421 of its spread RMS (target 0.5); the torque within 0.262, 0.314 and 0.347 of the RMS torque (target 0.4); |H| at a run's end within 8.4 and 0.9 percent after 10.7 and 16.3 days and 7.4 percent after 29.3 days (target 10). Gap: the daily change of the vector H is within that allowance on 14 of 28, 8 of 28 and 8 of 30 days (target 80 percent): beyond 2 degrees of roll its torque about the boresight is off by about 30 \u00b5N m; |H| after an unload in the second month reads 16.2 percent low at 3.9 days.", + "specimen": "Total angular momentum of the James Webb Space Telescope at Sun-Earth L2, held by its reaction wheels between momentum unloads under sunlight pressure on its sunshield, from its attitude quaternion and the Sun's direction and distance: one sunlit layer of 220 m\u00b2 with JWST's published optical numbers.", + "error": null + }, + { + "model": "aerospace/satellite_lageos1", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with the 42 runs of the six weeks outside that choice, two of LAGEOS-1 and four of LAGEOS-2: LAGEOS-1 within 0.65 m of the published orbit after one revolution (target 1 m), 3.8 m after one day (10 m) and 32 m after seven days (100 m); LAGEOS-2 within 0.34 m, 2.9 m and 22 m. Gap: the error grows with the length of a forecast, from 0.65 m after one revolution to 32 m after seven days on LAGEOS-1, as the card carries no drag, no light reflected from the Earth and no ocean tide.", + "specimen": "Free flight of the laser-ranging satellite LAGEOS-1 from a published position and velocity, in a frame turning with the Earth: the Earth's field to degree and order 12, the Sun and the Moon, the solid tide, sunlight pressure and relativity, with the energy and the angular momentum about the Earth's axis held at every step.", + "error": null + }, + { + "model": "aerospace/solar_system", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with 10,134 ranges of three spacecraft in four files, not used to choose it, in one run of 7,670 days: Mars Odyssey to 2006 within 695 m (target 700 m), 270 m RMS; Odyssey after 2006 and Mars Reconnaissance Orbiter, out to 15.0 years, 612 and 619 m RMS, worst 1,312 and 1,314 m; MESSENGER at Mercury, 12.3 to 16.2 years out, within 2.08 km (target 2.5 to 4.4 km), 1.42 km RMS. Gap: in mid-2007, 44 Odyssey ranges and 34 Mars Reconnaissance Orbiter ranges are outside their targets, by at most 8 and 10 percent, from the 340 asteroids the card leaves out; the Juno and Cassini files are outside the comparison, as they leave 20 km and 10 km RMS with JPL's own positions.", + "specimen": "The Solar System as thirteen point masses in free motion: the Sun, Mercury, Venus, the Earth, the Moon, the barycentres of the Mars, Jupiter, Saturn, Uranus and Neptune systems, and Ceres, Pallas and Vesta, under Newton's and the relativistic forces between every pair and the Earth's oblateness on the Moon. The caller supplies every position and velocity.", + "error": null + }, + { + "model": "plasma_sheath_ram_c2", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with the reflectometer onsets of NASA TN D-6062 Table X at 7.65 km/s: electron density 0.94 of the measured, within a factor of 1.07, at the cone station's X band at 70.0 km; 3.28 and 2.92 times the measured at 77.7 and 80.0 km. Gap: above 73.6 km, where the shock is as thick as the layer and electrons are lost to the cold wall, the density reads about 3 times high (3.28 at 77.7 km, 2.92 at 80.0 km).", + "specimen": "The plasma sheath around NASA's RAM C-II re-entry probe (a 15.24 cm hemisphere on a 9 degree cone) at one flight point: the equilibrium normal shock and stagnation point of 11-species air, the gas carried along the body to the nose station (x/D 0.15) and the cone station (x/D 0.76) with Dunn and Kang's 26 reactions at finite rate, the electron density, the plasma frequency, and whether a radio signal of the asked frequency is blacked out at each.", + "error": null + } + ], + "cheat_suite": { + "vectors": [ + { + "vector": "honest", + "expect": "honest control (1)", + "reward": 1, + "graded": 1.0, + "ok": true, + "reason": null + }, + { + "vector": "honest_reply_log_matches", + "expect": "honest control (1)", + "reward": 1, + "graded": 1.0, + "ok": true, + "reason": null + }, + { + "vector": "honest_numbers_respelled", + "expect": "honest control (1)", + "reward": 1, + "graded": 1.0, + "ok": true, + "reason": null + }, + { + "vector": "no_request_behind", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "no computing call behind the answer: the table was not put to the verifier" + }, + { + "vector": "edited_call_log", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the call log beside the reply differs from the harness log" + }, + { + "vector": "over_budget", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "5 computing calls; the budget is 4" + }, + { + "vector": "forbidden_tool", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the log holds calls of find_flip, which the task rules out" + }, + { + "vector": "no_harness_log", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "no harness call log: every attempt is scored with the calls the harness recorded" + }, + { + "vector": "harness_log_edited", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the harness log's chain breaks at line 5" + }, + { + "vector": "stale_engine_tag", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the task was built on engine 0.15.0; the verifier is 0.15.3" + }, + { + "vector": "every_row_genuine", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "4 false row(s) not named" + }, + { + "vector": "every_row_false", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "every row of the table is named false: a blanket answer" + }, + { + "vector": "every_row_false_true_reasons", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "every row of the table is named false: a blanket answer" + } + ], + "not_applicable": [ + { + "vector": "copied_proof_other_task", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "nudged_figure", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "figure_plus_10_percent", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "card_request_not_run", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "swapped_sides", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "binding_misnamed", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "proof_from_other_design", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "failing_given_as_passing", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "proof_uppercase", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "extra_argument", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "stop_misnamed", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "step_misnamed", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "missing_solve", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "solve_handed_other_run", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "next_start_rounded", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "next_proof_copied", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "next_request_edited", + "why": "a forensics card carries no request or proof" + } + ], + "cheats_scoring_above_0": 0, + "run": true + }, + "solver_runs": { + "reference": { + "reward": 1, + "graded": 1.0, + "correct": 1, + "proofs_hold": 1, + "computing_calls": 4, + "verdict": "pass", + "reason": null + }, + "naive": { + "reward": 0, + "graded": 0.0, + "correct": 0, + "proofs_hold": 1, + "computing_calls": 1, + "verdict": "wrong", + "reason": "4 false row(s) not named" + } + }, + "passk": [ + { + "family": "Frontier model", + "model": "Frontier model", + "variant": "tool", + "n": 16, + "correct": 9, + "pass@1": 0.5625, + "pass@8": 1.0, + "mean_graded": 0.9454365625, + "harness_error_rate": 0.0 + } + ], + "no_tool_question": false, + "physics_forensics": false, + "blind_baseline": { + "rows": 12, + "caught_without_call": 2, + "rows_needing_call": 10, + "call_budget": 4, + "hidden_false_rows": 2, + "uniform_hit_rate": 0.1333, + "formula": "C(10-2,4-2)/C(10,4)" + }, + "written_utc": "2026-11-14T01:27:47Z" +} diff --git a/sample/reports/g2-forensics7-10.html b/sample/reports/g2-forensics7-10.html new file mode 100644 index 0000000000000000000000000000000000000000..cc9b2bf679f6173102afe444d5ef9142814e53c2 --- /dev/null +++ b/sample/reports/g2-forensics7-10.html @@ -0,0 +1,79 @@ + +Task report: g2-forensics7-10 +

g2-forensics7-10

+

Multi-step physics RLVR task scored by deterministic recomputation on the Zero-Trust Physics verifier.

+

Forensics · models ablator_slab, aerospace/capsule_insight, aerospace/capsule_stardust, aerospace/crater_ryugu_sci, aerospace/momentum_jwst_dihedral, aerospace/momentum_jwst_srp, aerospace/satellite_lageos1, aerospace/solar_system, plasma_sheath_ram_c2 · Zero-Trust Physics v0.15.3 · Protocol Company

+

Checksums

+ + +
Whatsha256SHA-384
Task row05abcfea040cd550654ac242f94a1e884252d4d68bdc9cc5217bdbc614c9211010a026d647bf094ca3a0a04fb7d8c60213c4ed99458b98696edffa991e0b88ad3eb21120adc928acbe45ae77710c0919
Harbor directoryf75bc62ade60abfef552868fd25cc660492cbc65b1db91d70b6d432ac9defba2553c07b7d11077311f2eb8598d9dfacf769b0d0f22ecbe2240a88b62c57ed71f5a84d90ceb9ca9d015ce632701704c8e
+

Instruction

A report hands you ten claims about answers of the verifier. Each row gives the model, the request as it was sent, what its answer is claimed to say and the proof claimed for it. claim.outcome and claim.stop are the run's outcome and the name of its stop or declared end (null when it completed); claim.steps_landed is the last step the run is sealed to; claim.quantity and claim.value are one number of the final state of a run (of the result, for a solve); claim.flags are the advisory flags the run carried, each with the quantity it is on, its extent at the largest (extent) and the number of steps it was raised on (steps).
+Some rows are false. A false row may be wrong in more than one way; its reason is the first of these, in this order, that is true of it:
+1. retired_model: the request names a model ID the verifier does not serve (one it no longer serves, or a name it never served).
+2. parent_wrong: the request continues a run (from) that is not the parent it names: its start state, or the seal it gives for its parent, belongs to another run, and the verifier refuses the continuation.
+3. seal_wrong: the proof is not the seal of this request.
+4. stop_hidden: the run stops part way and the claim says it completed.
+5. step_wrong: the claim names the run's stop, but not the last step the run is sealed to.
+6. flag_omitted: the run carries an advisory flag (a name on a quantity) that the claim leaves out altogether.
+7. flag_altered: the flags the claim lists are not the run's, entry for entry: an extent or a count of steps differs, or an entry is missing or added where its name on that quantity is listed too (the verifier may list one flag on one quantity more than once, each with its own extent).
+8. value_altered: the claimed value is not the one the request gives, to the last digit.
+A row that is none of these is genuine, whatever else differs in how it is written (the order of its flags, a readout sent with the request, the spelling of a number). Name every false row with its reason.
+The rows, one a line:
+{"row": "R1", "model": "aerospace/solar_system", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "solar_system", "initial": {"sun_position_m": [-863637229.4106485, -588455255.8381735, -225852694.17788354], "sun_velocity_m_s": [12.397135730588673, -8.676658356669796, -4.0448914054830265], "mercury_position_m": [30544984580.541214, 31538497612.618702, 13677667513.450943], "mercury_velocity_m_s": [-45893.79576346148, 28907.37310381068, 20202.882077964397], "venus_position_m": [-106439655769.27072, 15156574441.51891, 13539171068.575262], "venus_velocity_m_s": [-6662.526312895438, -31691.929801737846, -13835.48559151052], "earth_position_m": [102407858815.46872, -102611923461.79506, -44458723871.361084], "earth_velocity_m_s": [21351.990015305262, 18497.83118201897, 8019.230891774351], "moon_position_m": [102047097668.78308, -102736187163.71382, -44474590914.85404], "moon_velocity_m_s": [21609.833460848902, 17579.38315631339, 7638.85449892693], "mars_position_m": [-108034816249.35658, 196931821387.40118, 93267362532.8832], "mars_velocity_m_s": [-20818.954980749113, -8043.795945699443, -3126.300559642824], "jupiter_position_m": [419113155659.17053, 572916852927.5242, 235366142766.89377], "jupiter_velocity_m_s": [-10981.451664109512, 7203.166125214057, 3354.981129871713], "saturn_position_m": [810247233830.7081, 1028692408157.641, 390011764585.78156], "saturn_velocity_m_s": [-8280.517996609125, 5149.719611471784, 2483.289801876904], "uranus_position_m": [2242902225084.655, -1790169184837.4873, -815772837485.7194], "uranus_velocity_m_s": [4440.090766223361, 4422.709890451177, 1874.2294942165538], "neptune_position_m": [2597044231109.891, -3383482727434.8364, -1449535655907.9255], "neptune_velocity_m_s": [4405.7539005103245, 2969.8264977576428, 1105.8807943842667], "ceres_position_m": [-322236661229.9761, -227977183777.5967, -41837637472.4793], "ceres_velocity_m_s": [9380.707730841985, -13838.379917110064, -8421.170529908282], "pallas_position_m": [-351293366602.40656, -24289147273.497444, 28702819004.877907], "pallas_velocity_m_s": [-1948.7381903754856, -20307.781285208814, 4156.606512462996], "vesta_position_m": [166331403121.10275, -256906652758.2719, -124134856049.41298], "vesta_velocity_m_s": [18295.602252098583, 9577.160570429965, 1423.2851008847358], "energy_anchor": -1.321940998513625e+25, "booked_work": 0.0, "angular_momentum_anchor": [5.490282510087069e+31, -8.153754585822945e+32, 1.9244191261307657e+33], "booked_torque": [0.0, 0.0, 0.0]}, "dt_s": 1677.0, "segments": [{"steps": 9, "load": {}}, {"steps": 10, "load": {}}, {"steps": 11, "load": {}}, {"steps": 12, "load": {}}, {"steps": 13, "load": {}}, {"steps": 14, "load": {}}, {"steps": 15, "load": {}}], "record_every": 84, "readout": {"quantities": ["earth_mars_distance_m"]}}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 84, "quantity": "earth_mars_distance_m", "value": 390895599447.7874, "flags": []}, "proof": "0cc96b6596b63629b419c167374ae7ab4a2b01eea6b41026478ecd3e3e3519f0257c279d9ee2b73cf297642b476eecb4"}
+{"row": "R2", "model": "aerospace/capsule_insight", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_insight", "initial": {"radius_m": 3519545.0, "radial_speed_m_s": -1340.4281, "transverse_speed_m_s": 5819.933}, "dt_s": 0.1, "segments": [{"steps": 2195, "load": {"lift_over_drag": 0.0}}], "record_every": 2195}}, "claim": {"outcome": "ended", "stop": "PastFlightDeployment", "steps_landed": 1975, "quantity": "mach", "value": 1.414380813182044, "flags": []}, "proof": "caf9fef4f3cfb1be4d6d1234fb1484c1525d788b0f09706c6f48f9d4be552533f0c55af43f8dda1ae3d7869b6a3f82c5"}
+{"row": "R3", "model": "aerospace/crater_ryugu_sci", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "crater_ryugu_sci", "initial": {"radius_m": 3.395}, "dt_s": 0.163, "segments": [{"steps": 201, "load": {}}, {"steps": 222, "load": {}}, {"steps": 243, "load": {}}], "record_every": 666}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 666, "quantity": "radius_m", "value": 6.8729656389716265, "flags": []}, "proof": "6d6b45da8cf15848762712a1d05b1b8f3b1b9d6303f2c0162e30dfa6d44ec950766e5b6bf074c739440ff306f1889a0a"}
+{"row": "R4", "model": "aerospace/capsule_stardust", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488061.0, "radial_speed_m_s": -2105.71, "transverse_speed_m_s": 12576.74}, "dt_s": 0.05, "segments": [{"steps": 3193, "load": {}}], "record_every": 3193, "readout": {"quantities": ["altitude_m"]}}}, "claim": {"outcome": "ended", "stop": "PastFlightDeployment", "steps_landed": 1929, "quantity": "altitude_m", "value": 31025.876497731544, "flags": [{"flag": "FLAG_DROGUE_MACH_WINDOW", "quantity": "mach", "extent": 0.39864147264033933, "steps": 190}, {"flag": "FLAG_DROGUE_MACH_WINDOW", "quantity": "mach", "extent": 0.39990473030213836, "steps": 190}, {"flag": "FLAG_MACH_TABLE_HELD", "quantity": "mach", "extent": 0.02429835996056795, "steps": 2}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "air_speed_m_s", "extent": 155.89247760455874, "steps": 484}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "air_speed_m_s", "extent": 1697.5036915755654, "steps": 1243}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "path_sine", "extent": 0.048142951009741516, "steps": 1005}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "path_sine", "extent": 0.06286079576874015, "steps": 851}]}, "proof": "fa2be55cda475420e0f90829833bea259ff32039b96724066963ad9de7ee75937d6f50458965183ad3962d5197a6062b"}
+{"row": "R5", "model": "plasma_sheath_ram_c2", "request": {"tool": "solve", "arguments": {"solver": "plasma_sheath_ram_c2", "parameters": {"altitude_m": 55180.0, "velocity_m_s": 6896.0, "signal_frequency_hz": 4157000000.0}}}, "claim": {"outcome": "converged", "stop": null, "steps_landed": null, "quantity": "stagnation_temperature_k", "value": 6383.526355576421, "flags": []}, "proof": "70b0239e697034b92172ce494691215f79d0c4a56078257a3e624b2ee111ef7e94ef97df0177ac97270ec674bda20422"}
+{"row": "R6", "model": "ablator_slab", "request": {"tool": "solve", "arguments": {"solver": "ablator_slab", "parameters": {"material": "PICA, open record, version 5", "thickness_m": 0.04845, "start_temperature_k": 308.75, "thermocouple_depths_m": [], "face": "held_temperature", "held_temperature_k": 1976.0, "hold_duration_s": 63.85, "continue_after_s": 43.15, "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false}}}, "claim": {"outcome": "converged", "stop": null, "steps_landed": null, "quantity": "depth_within_2_percent_of_virgin_m", "value": 0.014116399858056352, "flags": []}, "proof": "96e1a407a5dcf744722373aa7715f472762d5816c796d3073ee9f8970fc1ce3ed5bb10c6cc151e88ee32c13bc1cb681b"}
+{"row": "R7", "model": "aerospace/momentum_jwst_dihedral", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "momentum_jwst_dihedral", "initial": {"h_eci_nms": [-1.429, 1.053, -1.498]}, "dt_s": 1910.0, "segments": [{"steps": 49, "load": {"q1": 0.638559, "q2": -0.019, "q3": -0.652891, "q4": 0.406959, "sun_x": 0.616092, "sun_y": 0.703148, "sun_z": 0.354984, "sun_distance_au": 1.01415}}, {"steps": 45, "load": {"q1": 0.748856, "q2": -0.003607, "q3": -0.560934, "q4": 0.352923, "sun_x": 0.674752, "sun_y": 0.668222, "sun_z": 0.313352, "sun_distance_au": 1.01415}}], "record_every": 94, "readout": {"quantities": ["h_magnitude_nms"]}}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 94, "quantity": "h_magnitude_nms", "value": 5.002332004564212, "flags": []}, "proof": "a93f9cd7a27d8851a5b9c4996bfa3d1f7c1c31622907a4c743501d5727ba57a8d39f657eca88e8928d1a19ee417ca01d"}
+{"row": "R8", "model": "aerospace/momentum_jwst_srp", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "momentum_jwst_srp", "initial": {"h_eci_nms": [0.918, -1.255, 0.815]}, "dt_s": 874.0, "segments": [{"steps": 44, "load": {"q1": 0.685819, "q2": 0.011638, "q3": -0.603055, "q4": 0.407236, "sun_x": 0.616092, "sun_y": 0.713107, "sun_z": 0.334528, "sun_distance_au": 1.01161}}, {"steps": 32, "load": {"q1": 0.659909, "q2": -0.005461, "q3": -0.631303, "q4": 0.407365, "sun_x": 0.634305, "sun_y": 0.70673, "sun_z": 0.313352, "sun_distance_au": 0.1851}}], "record_every": 76}}, "claim": {"outcome": "refused", "stop": "SunshieldAboveKaptonLimit", "steps_landed": 118, "quantity": "h_magnitude_nms", "value": 1.6088350681235042, "flags": []}, "proof": "2802624f097f31c406fcd6c90107e0c92b0856ada8ab7aefd2a74b0db13c863229e6ac88939c9df175a48db8856bbc9d"}
+{"row": "R9", "model": "aerospace/satellite_lageos1_twin", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "satellite_lageos1_twin", "initial": {"epoch_utc_s": 844432990.0, "forecast_elapsed_s": 0.0, "position_m": [-5947439.326, 2555567.396, 10470793.788], "velocity_m_s": [4754.057, 2345.016, 2292.947]}, "dt_s": 10.0, "segments": [{"steps": 1614, "load": {}}], "record_every": 1614}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 1614, "quantity": "semi_major_axis_m", "value": 11400874.582902145, "flags": [{"flag": "FLAG_BELOW_COMPARED_RADIUS", "quantity": "radius_m", "extent": 1559062.143708026, "steps": 994}, {"flag": "FLAG_EARTH_SHADOW", "quantity": "distance_from_shadow_axis_m", "extent": 1409415.657917643, "steps": 183}]}, "proof": "760e36d0a9c7ce7d7bc1e45f15334a31f23e242ce276c2b84454dfdcf21ca745576a3557773a024e0d7bedcd90133779"}
+{"row": "R10", "model": "aerospace/crater_ryugu_sci", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "crater_ryugu_sci", "initial": {"radius_m": 1.25}, "dt_s": 0.1285, "segments": [{"steps": 210, "load": {}}, {"steps": 231, "load": {}}, {"steps": 252, "load": {}}, {"steps": 273, "load": {}}, {"steps": 294, "load": {}}, {"steps": 315, "load": {}}], "record_every": 1575}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 1575, "quantity": "radius_m", "value": 7.823494707379572, "flags": []}, "proof": "e6950ae5d4f4d0953321d1013624d3ce599b23249db4d6075c705be83c6b66f37cbf9a67bb109ddbf36bd7003945bd86"}
+
+Budget: at most 4 calls that compute, counted over every call you make (every run_trajectory, solve, compute_step and verify_ call counts, refused or not); list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all.
+
+You have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.
+
+End your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {"tool": "<the tool's name as the verifier names it, without any prefix your own program adds>", "arguments": {<the arguments exactly as you sent them>}}, and a proof is the run_seal or solution_seal the verifier gave for that request.
+
+The card:
+{"false_rows": {"<row>": "<reason>", ...}}
+
+Name every false row, each with its one reason from retired_model, parent_wrong, seal_wrong, stop_hidden, step_wrong, flag_omitted, flag_altered, value_altered (the first of them, in that order, that is true of the row). Leave the genuine rows out. {"false_rows": {}} says every row is genuine. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.
+

Reference solution

+

From the reference agent's reply (g2-forensics7-10.txt). Built on engine v0.15.3 at commit 664d68f426cc. Open address: a record exists.

+
On the cardToolProofOpen address
This card carries no proof: a forensics answer names rows.
+
{
+ "false_rows": {
+  "R2": "value_altered",
+  "R7": "seal_wrong",
+  "R8": "step_wrong",
+  "R9": "retired_model"
+ }
+}
+

What the models were compared with

+
ModelAgainstSpecimenAccuracy against measurement
ablator_slabcompared with measurementA flat slab of charring heat-shield material heated on one face: wear, face temperature, depth of charring and the heat and mass accounts, for a PICA model built from the open record or the test material TACOT 3.0.Compared with 31 arc-jet tests outside the fit: wear within its target on 28 of 31 (target 25), mean −5.3 percent over all 31 (−2.6 over the 30 without the pure-nitrogen test; target within 8); hottest face within 7 percent on 24 of 28 (target 23); Stardust wear 7.58 and 3.32 mm against 5.7 and 3.2; fed by capsule_stardust through stardust_entry_to_pica_slab, nose wear 4.65 mm and face within 156 K RMS of the airborne spectra. Gap: the face runs 4.1 percent hot on average (target 3.5), and Stardust nose wear is a third high.
aerospace/capsule_insightcompared with measurementEntry of NASA's InSight capsule at Mars on 26 November 2018, as a point mass with the 2008 Phoenix drag database, no wind, and the lift over drag as the load: altitude, speed through the air, Mach number, dynamic pressure and load, from the top of the atmosphere to the flown parachute deployment.Compared with the last 59 s before the parachute, not in the fit: speed within 7.2 m/s RMS, radius within 245 m and deceleration within 0.031 g over the 58 whole seconds; at the flight's deployment time the radius within 114 m (target 3.5 km) and Mach 1.501 against 1.522 (target 0.2); the deployment speed reached 1.31 s late and the radius 0.58 s early (target 15.1 s). Gap: with no lift the run reaches the flight's radius at the parachute 22.8 s late and is 4.24 km high there (targets 15.1 s and 3.5 km); between 36 and 65 km the card's air is 8 to 13 percent denser than the flight's, and the peak load comes 4.0 s early.
aerospace/capsule_stardustcompared with measurementEntry of the Stardust sample return capsule on 15 January 2006, as a point mass with tabulated drag, no lift, no wind and a yearly standard atmosphere: altitude, speed through the air, Mach number, load, heat flux, and at the nose the stagnation pressure, recovery enthalpy and heat-transfer coefficient a heat shield takes, from entry interface to the drogue-deployment condition the radar recorded.Compared with NASA's reconstruction of the entry and the radar record of parachute opening: peak load 32.17 g against 32.89 g, within 0.72 g (target 3.64 g); the drogue altitude, 31.03 km, reached at 138.909 s and Mach 1.23 at 136.953 s against 137.9 s recorded, within 1.01 s (target 7.4 s). Gap: heat flux 696 W/cm2 against NASA's computed 762 to 1000; the yearly standard atmosphere in place of that morning's air is worth about 1 g of peak load either way.
aerospace/crater_ryugu_scicompared with measurementGrowth of the crater made on asteroid Ryugu by the 2 kg copper impactor of Hayabusa2 on 5 April 2019, by the law of crater size for dry sand held by gravity, with a laboratory clock: the radius at the level of the undisturbed surface from 0.1622 m until it stops, with no load.Compared with the measured crater on Ryugu, not in the fit, with the law fitted on all thirteen laboratory craters: final radius 8.571 m against the apparent radius of 7.25 m, within 1.32 m, 18.2 percent (allowance 0.97 m); in the laboratory, with the law fitted again on the nine craters at 1 g alone, the four centrifuge craters within 6.9 to 9.5 percent, mean 7.9 percent (target 10), each inside its 95 percent prediction interval. Gap: on Ryugu the card stops 1.32 m, 18.2 percent, above the measured apparent radius, outside the allowance of 0.97 m; the growth and its clock, read by eye at 1 g, have no measurement of Ryugu to meet.
aerospace/momentum_jwst_dihedralcompared with measurementTotal angular momentum of the James Webb Space Telescope at Sun-Earth L2, held by its reaction wheels between momentum unloads under sunlight pressure on its sunshield, from its attitude quaternion and the Sun's direction and distance: the first layer as two plane slopes of 110 m² meeting along a ridge on the boresight, each falling 4.03 degrees towards the Sun, so that the Sun's roll turns into torque about the boresight.Compared with the two months after the fit: the daily growth of |H| within 0.1 of the observed plus 0.2 N m s on 25 of 28 and 22 of 30 days (target 80 percent); the hourly growth rate within 0.272 and 0.375 of its spread RMS (target 0.5); the torque within 0.144 and 0.149 of the RMS torque (target 0.4); |H| at a run's end within 4.9 percent over 3.9 to 12.4 days and 5.5 percent after 29.3 days (target 10). Gap: the daily change of the vector H is within that allowance on 18 of 28 and 13 of 30 days (target 80 percent), 0.42 N m s RMS against momentum_jwst_srp's 0.81; beyond 2 degrees of roll its torque about J3 is off by 11 and 10.4 µN m RMS.
aerospace/momentum_jwst_srpcompared with measurementTotal angular momentum of the James Webb Space Telescope at Sun-Earth L2, held by its reaction wheels between momentum unloads under sunlight pressure on its sunshield, from its attitude quaternion and the Sun's direction and distance: one sunlit layer of 220 m² with JWST's published optical numbers.Compared with the three months after the fit: the daily growth of |H| within 0.1 of the observed plus 0.2 N m s on 23 of 28, 15 of 28 and 17 of 30 days (target 80 percent); the hourly growth rate within 0.437, 0.384 and 0.421 of its spread RMS (target 0.5); the torque within 0.262, 0.314 and 0.347 of the RMS torque (target 0.4); |H| at a run's end within 8.4 and 0.9 percent after 10.7 and 16.3 days and 7.4 percent after 29.3 days (target 10). Gap: the daily change of the vector H is within that allowance on 14 of 28, 8 of 28 and 8 of 30 days (target 80 percent): beyond 2 degrees of roll its torque about the boresight is off by about 30 µN m; |H| after an unload in the second month reads 16.2 percent low at 3.9 days.
aerospace/satellite_lageos1compared with measurementFree flight of the laser-ranging satellite LAGEOS-1 from a published position and velocity, in a frame turning with the Earth: the Earth's field to degree and order 12, the Sun and the Moon, the solid tide, sunlight pressure and relativity, with the energy and the angular momentum about the Earth's axis held at every step.Compared with the 42 runs of the six weeks outside that choice, two of LAGEOS-1 and four of LAGEOS-2: LAGEOS-1 within 0.65 m of the published orbit after one revolution (target 1 m), 3.8 m after one day (10 m) and 32 m after seven days (100 m); LAGEOS-2 within 0.34 m, 2.9 m and 22 m. Gap: the error grows with the length of a forecast, from 0.65 m after one revolution to 32 m after seven days on LAGEOS-1, as the card carries no drag, no light reflected from the Earth and no ocean tide.
aerospace/solar_systemcompared with measurementThe Solar System as thirteen point masses in free motion: the Sun, Mercury, Venus, the Earth, the Moon, the barycentres of the Mars, Jupiter, Saturn, Uranus and Neptune systems, and Ceres, Pallas and Vesta, under Newton's and the relativistic forces between every pair and the Earth's oblateness on the Moon. The caller supplies every position and velocity.Compared with 10,134 ranges of three spacecraft in four files, not used to choose it, in one run of 7,670 days: Mars Odyssey to 2006 within 695 m (target 700 m), 270 m RMS; Odyssey after 2006 and Mars Reconnaissance Orbiter, out to 15.0 years, 612 and 619 m RMS, worst 1,312 and 1,314 m; MESSENGER at Mercury, 12.3 to 16.2 years out, within 2.08 km (target 2.5 to 4.4 km), 1.42 km RMS. Gap: in mid-2007, 44 Odyssey ranges and 34 Mars Reconnaissance Orbiter ranges are outside their targets, by at most 8 and 10 percent, from the 340 asteroids the card leaves out; the Juno and Cassini files are outside the comparison, as they leave 20 km and 10 km RMS with JPL's own positions.
plasma_sheath_ram_c2compared with measurementThe plasma sheath around NASA's RAM C-II re-entry probe (a 15.24 cm hemisphere on a 9 degree cone) at one flight point: the equilibrium normal shock and stagnation point of 11-species air, the gas carried along the body to the nose station (x/D 0.15) and the cone station (x/D 0.76) with Dunn and Kang's 26 reactions at finite rate, the electron density, the plasma frequency, and whether a radio signal of the asked frequency is blacked out at each.Compared with the reflectometer onsets of NASA TN D-6062 Table X at 7.65 km/s: electron density 0.94 of the measured, within a factor of 1.07, at the cone station's X band at 70.0 km; 3.28 and 2.92 times the measured at 77.7 and 80.0 km. Gap: above 73.6 km, where the shock is as thick as the layer and electrons are lost to the cold wall, the density reads about 3 times high (3.28 at 77.7 km, 2.92 at 80.0 km).
+

Cheat suite

0 cheat attempt(s) scored above 0. 13 vectors applied; 17 do not apply to this kind.

VectorExpectedRewardGradedResultScorer's reason
honesthonest control (1)11.000holds
honest_reply_log_matcheshonest control (1)11.000holds
honest_numbers_respelledhonest control (1)11.000holds
no_request_behindcheat (0)00.000holdsno computing call behind the answer: the table was not put to the verifier
edited_call_logcheat (0)00.000holdsthe call log beside the reply differs from the harness log
over_budgetcheat (0)00.000holds5 computing calls; the budget is 4
forbidden_toolcheat (0)00.000holdsthe log holds calls of find_flip, which the task rules out
no_harness_logcheat (0)00.000holdsno harness call log: every attempt is scored with the calls the harness recorded
harness_log_editedcheat (0)00.000holdsthe harness log's chain breaks at line 5
stale_engine_tagcheat (0)00.000holdsthe task was built on engine 0.15.0; the verifier is 0.15.3
every_row_genuinecheat (0)00.000holds4 false row(s) not named
every_row_falsecheat (0)00.000holdsevery row of the table is named false: a blanket answer
every_row_false_true_reasonscheat (0)00.000holdsevery row of the table is named false: a blanket answer
+

Solver runs

+
AgentRewardGradedComputing callsScorer's reason
Reference agent11.0004
One-call agent00.00014 false row(s) not named
+

Pass@k by model family

+
FamilyVariantModelSolvedpass@1pass@8Mean gradedHarness errors
Frontier modeltoolFrontier model3 of 838%100%0.9110%
+

Measured calibration: Frontier model, tool variant, n=8.

+

Calibrated on pass@1 in [2%, 70%] on a frontier model's tool variant, with pass@8 and continuous graded reward reported beside pass/fail.

+

Task notes

Forensics verification protocol: candidate rows contain falsified seals, perturbed trajectory figures, mismatched parent provenance, or retired model IDs, resolved via selective physical recomputation and consistency audit across candidate hardware records under a 4-call simulator budget. Blind baseline: 21.4% (C(8-2,4-2)/C(8,4): 4 computing calls over 8 rows needing a call, 2 hidden false row(s) after 2 caught from free catalogue tools or the request text).

+

Written 2026-11-14T01:27:47Z.

+ \ No newline at end of file diff --git a/sample/reports/g2-forensics7-10.json b/sample/reports/g2-forensics7-10.json new file mode 100644 index 0000000000000000000000000000000000000000..0cc072b9b67c9611cf2260642ca250a397a3d4b6 --- /dev/null +++ b/sample/reports/g2-forensics7-10.json @@ -0,0 +1,329 @@ +{ + "id": "g2-forensics7-10", + "family": "forensics", + "kind": "forensics", + "models": [ + "ablator_slab", + "aerospace/capsule_insight", + "aerospace/capsule_stardust", + "aerospace/crater_ryugu_sci", + "aerospace/momentum_jwst_dihedral", + "aerospace/momentum_jwst_srp", + "aerospace/satellite_lageos1", + "aerospace/solar_system", + "plasma_sheath_ram_c2" + ], + "checksums": { + "row_sha256": "05abcfea040cd550654ac242f94a1e884252d4d68bdc9cc5217bdbc614c92110", + "row_sha384": "10a026d647bf094ca3a0a04fb7d8c60213c4ed99458b98696edffa991e0b88ad3eb21120adc928acbe45ae77710c0919", + "harbor_dir_sha256": "f75bc62ade60abfef552868fd25cc660492cbc65b1db91d70b6d432ac9defba2", + "harbor_dir_sha384": "553c07b7d11077311f2eb8598d9dfacf769b0d0f22ecbe2240a88b62c57ed71f5a84d90ceb9ca9d015ce632701704c8e" + }, + "instruction": "A report hands you ten claims about answers of the verifier. Each row gives the model, the request as it was sent, what its answer is claimed to say and the proof claimed for it. claim.outcome and claim.stop are the run's outcome and the name of its stop or declared end (null when it completed); claim.steps_landed is the last step the run is sealed to; claim.quantity and claim.value are one number of the final state of a run (of the result, for a solve); claim.flags are the advisory flags the run carried, each with the quantity it is on, its extent at the largest (extent) and the number of steps it was raised on (steps).\nSome rows are false. A false row may be wrong in more than one way; its reason is the first of these, in this order, that is true of it:\n1. retired_model: the request names a model ID the verifier does not serve (one it no longer serves, or a name it never served).\n2. parent_wrong: the request continues a run (from) that is not the parent it names: its start state, or the seal it gives for its parent, belongs to another run, and the verifier refuses the continuation.\n3. seal_wrong: the proof is not the seal of this request.\n4. stop_hidden: the run stops part way and the claim says it completed.\n5. step_wrong: the claim names the run's stop, but not the last step the run is sealed to.\n6. flag_omitted: the run carries an advisory flag (a name on a quantity) that the claim leaves out altogether.\n7. flag_altered: the flags the claim lists are not the run's, entry for entry: an extent or a count of steps differs, or an entry is missing or added where its name on that quantity is listed too (the verifier may list one flag on one quantity more than once, each with its own extent).\n8. value_altered: the claimed value is not the one the request gives, to the last digit.\nA row that is none of these is genuine, whatever else differs in how it is written (the order of its flags, a readout sent with the request, the spelling of a number). Name every false row with its reason.\nThe rows, one a line:\n{\"row\": \"R1\", \"model\": \"aerospace/solar_system\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"solar_system\", \"initial\": {\"sun_position_m\": [-863637229.4106485, -588455255.8381735, -225852694.17788354], \"sun_velocity_m_s\": [12.397135730588673, -8.676658356669796, -4.0448914054830265], \"mercury_position_m\": [30544984580.541214, 31538497612.618702, 13677667513.450943], \"mercury_velocity_m_s\": [-45893.79576346148, 28907.37310381068, 20202.882077964397], \"venus_position_m\": [-106439655769.27072, 15156574441.51891, 13539171068.575262], \"venus_velocity_m_s\": [-6662.526312895438, -31691.929801737846, -13835.48559151052], \"earth_position_m\": [102407858815.46872, -102611923461.79506, -44458723871.361084], \"earth_velocity_m_s\": [21351.990015305262, 18497.83118201897, 8019.230891774351], \"moon_position_m\": [102047097668.78308, -102736187163.71382, -44474590914.85404], \"moon_velocity_m_s\": [21609.833460848902, 17579.38315631339, 7638.85449892693], \"mars_position_m\": [-108034816249.35658, 196931821387.40118, 93267362532.8832], \"mars_velocity_m_s\": [-20818.954980749113, -8043.795945699443, -3126.300559642824], \"jupiter_position_m\": [419113155659.17053, 572916852927.5242, 235366142766.89377], \"jupiter_velocity_m_s\": [-10981.451664109512, 7203.166125214057, 3354.981129871713], \"saturn_position_m\": [810247233830.7081, 1028692408157.641, 390011764585.78156], \"saturn_velocity_m_s\": [-8280.517996609125, 5149.719611471784, 2483.289801876904], \"uranus_position_m\": [2242902225084.655, -1790169184837.4873, -815772837485.7194], \"uranus_velocity_m_s\": [4440.090766223361, 4422.709890451177, 1874.2294942165538], \"neptune_position_m\": [2597044231109.891, -3383482727434.8364, -1449535655907.9255], \"neptune_velocity_m_s\": [4405.7539005103245, 2969.8264977576428, 1105.8807943842667], \"ceres_position_m\": [-322236661229.9761, -227977183777.5967, -41837637472.4793], \"ceres_velocity_m_s\": [9380.707730841985, -13838.379917110064, -8421.170529908282], \"pallas_position_m\": [-351293366602.40656, -24289147273.497444, 28702819004.877907], \"pallas_velocity_m_s\": [-1948.7381903754856, -20307.781285208814, 4156.606512462996], \"vesta_position_m\": [166331403121.10275, -256906652758.2719, -124134856049.41298], \"vesta_velocity_m_s\": [18295.602252098583, 9577.160570429965, 1423.2851008847358], \"energy_anchor\": -1.321940998513625e+25, \"booked_work\": 0.0, \"angular_momentum_anchor\": [5.490282510087069e+31, -8.153754585822945e+32, 1.9244191261307657e+33], \"booked_torque\": [0.0, 0.0, 0.0]}, \"dt_s\": 1677.0, \"segments\": [{\"steps\": 9, \"load\": {}}, {\"steps\": 10, \"load\": {}}, {\"steps\": 11, \"load\": {}}, {\"steps\": 12, \"load\": {}}, {\"steps\": 13, \"load\": {}}, {\"steps\": 14, \"load\": {}}, {\"steps\": 15, \"load\": {}}], \"record_every\": 84, \"readout\": {\"quantities\": [\"earth_mars_distance_m\"]}}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 84, \"quantity\": \"earth_mars_distance_m\", \"value\": 390895599447.7874, \"flags\": []}, \"proof\": \"0cc96b6596b63629b419c167374ae7ab4a2b01eea6b41026478ecd3e3e3519f0257c279d9ee2b73cf297642b476eecb4\"}\n{\"row\": \"R2\", \"model\": \"aerospace/capsule_insight\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_insight\", \"initial\": {\"radius_m\": 3519545.0, \"radial_speed_m_s\": -1340.4281, \"transverse_speed_m_s\": 5819.933}, \"dt_s\": 0.1, \"segments\": [{\"steps\": 2195, \"load\": {\"lift_over_drag\": 0.0}}], \"record_every\": 2195}}, \"claim\": {\"outcome\": \"ended\", \"stop\": \"PastFlightDeployment\", \"steps_landed\": 1975, \"quantity\": \"mach\", \"value\": 1.414380813182044, \"flags\": []}, \"proof\": \"caf9fef4f3cfb1be4d6d1234fb1484c1525d788b0f09706c6f48f9d4be552533f0c55af43f8dda1ae3d7869b6a3f82c5\"}\n{\"row\": \"R3\", \"model\": \"aerospace/crater_ryugu_sci\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"crater_ryugu_sci\", \"initial\": {\"radius_m\": 3.395}, \"dt_s\": 0.163, \"segments\": [{\"steps\": 201, \"load\": {}}, {\"steps\": 222, \"load\": {}}, {\"steps\": 243, \"load\": {}}], \"record_every\": 666}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 666, \"quantity\": \"radius_m\", \"value\": 6.8729656389716265, \"flags\": []}, \"proof\": \"6d6b45da8cf15848762712a1d05b1b8f3b1b9d6303f2c0162e30dfa6d44ec950766e5b6bf074c739440ff306f1889a0a\"}\n{\"row\": \"R4\", \"model\": \"aerospace/capsule_stardust\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_stardust\", \"initial\": {\"radius_m\": 6488061.0, \"radial_speed_m_s\": -2105.71, \"transverse_speed_m_s\": 12576.74}, \"dt_s\": 0.05, \"segments\": [{\"steps\": 3193, \"load\": {}}], \"record_every\": 3193, \"readout\": {\"quantities\": [\"altitude_m\"]}}}, \"claim\": {\"outcome\": \"ended\", \"stop\": \"PastFlightDeployment\", \"steps_landed\": 1929, \"quantity\": \"altitude_m\", \"value\": 31025.876497731544, \"flags\": [{\"flag\": \"FLAG_DROGUE_MACH_WINDOW\", \"quantity\": \"mach\", \"extent\": 0.39864147264033933, \"steps\": 190}, {\"flag\": \"FLAG_DROGUE_MACH_WINDOW\", \"quantity\": \"mach\", \"extent\": 0.39990473030213836, \"steps\": 190}, {\"flag\": \"FLAG_MACH_TABLE_HELD\", \"quantity\": \"mach\", \"extent\": 0.02429835996056795, \"steps\": 2}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"air_speed_m_s\", \"extent\": 155.89247760455874, \"steps\": 484}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"air_speed_m_s\", \"extent\": 1697.5036915755654, \"steps\": 1243}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"path_sine\", \"extent\": 0.048142951009741516, \"steps\": 1005}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"path_sine\", \"extent\": 0.06286079576874015, \"steps\": 851}]}, \"proof\": \"fa2be55cda475420e0f90829833bea259ff32039b96724066963ad9de7ee75937d6f50458965183ad3962d5197a6062b\"}\n{\"row\": \"R5\", \"model\": \"plasma_sheath_ram_c2\", \"request\": {\"tool\": \"solve\", \"arguments\": {\"solver\": \"plasma_sheath_ram_c2\", \"parameters\": {\"altitude_m\": 55180.0, \"velocity_m_s\": 6896.0, \"signal_frequency_hz\": 4157000000.0}}}, \"claim\": {\"outcome\": \"converged\", \"stop\": null, \"steps_landed\": null, \"quantity\": \"stagnation_temperature_k\", \"value\": 6383.526355576421, \"flags\": []}, \"proof\": \"70b0239e697034b92172ce494691215f79d0c4a56078257a3e624b2ee111ef7e94ef97df0177ac97270ec674bda20422\"}\n{\"row\": \"R6\", \"model\": \"ablator_slab\", \"request\": {\"tool\": \"solve\", \"arguments\": {\"solver\": \"ablator_slab\", \"parameters\": {\"material\": \"PICA, open record, version 5\", \"thickness_m\": 0.04845, \"start_temperature_k\": 308.75, \"thermocouple_depths_m\": [], \"face\": \"held_temperature\", \"held_temperature_k\": 1976.0, \"hold_duration_s\": 63.85, \"continue_after_s\": 43.15, \"return_face_history\": false, \"return_thermocouple_histories\": false, \"return_final_profile\": false}}}, \"claim\": {\"outcome\": \"converged\", \"stop\": null, \"steps_landed\": null, \"quantity\": \"depth_within_2_percent_of_virgin_m\", \"value\": 0.014116399858056352, \"flags\": []}, \"proof\": \"96e1a407a5dcf744722373aa7715f472762d5816c796d3073ee9f8970fc1ce3ed5bb10c6cc151e88ee32c13bc1cb681b\"}\n{\"row\": \"R7\", \"model\": \"aerospace/momentum_jwst_dihedral\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_dihedral\", \"initial\": {\"h_eci_nms\": [-1.429, 1.053, -1.498]}, \"dt_s\": 1910.0, \"segments\": [{\"steps\": 49, \"load\": {\"q1\": 0.638559, \"q2\": -0.019, \"q3\": -0.652891, \"q4\": 0.406959, \"sun_x\": 0.616092, \"sun_y\": 0.703148, \"sun_z\": 0.354984, \"sun_distance_au\": 1.01415}}, {\"steps\": 45, \"load\": {\"q1\": 0.748856, \"q2\": -0.003607, \"q3\": -0.560934, \"q4\": 0.352923, \"sun_x\": 0.674752, \"sun_y\": 0.668222, \"sun_z\": 0.313352, \"sun_distance_au\": 1.01415}}], \"record_every\": 94, \"readout\": {\"quantities\": [\"h_magnitude_nms\"]}}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 94, \"quantity\": \"h_magnitude_nms\", \"value\": 5.002332004564212, \"flags\": []}, \"proof\": \"a93f9cd7a27d8851a5b9c4996bfa3d1f7c1c31622907a4c743501d5727ba57a8d39f657eca88e8928d1a19ee417ca01d\"}\n{\"row\": \"R8\", \"model\": \"aerospace/momentum_jwst_srp\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_srp\", \"initial\": {\"h_eci_nms\": [0.918, -1.255, 0.815]}, \"dt_s\": 874.0, \"segments\": [{\"steps\": 44, \"load\": {\"q1\": 0.685819, \"q2\": 0.011638, \"q3\": -0.603055, \"q4\": 0.407236, \"sun_x\": 0.616092, \"sun_y\": 0.713107, \"sun_z\": 0.334528, \"sun_distance_au\": 1.01161}}, {\"steps\": 32, \"load\": {\"q1\": 0.659909, \"q2\": -0.005461, \"q3\": -0.631303, \"q4\": 0.407365, \"sun_x\": 0.634305, \"sun_y\": 0.70673, \"sun_z\": 0.313352, \"sun_distance_au\": 0.1851}}], \"record_every\": 76}}, \"claim\": {\"outcome\": \"refused\", \"stop\": \"SunshieldAboveKaptonLimit\", \"steps_landed\": 118, \"quantity\": \"h_magnitude_nms\", \"value\": 1.6088350681235042, \"flags\": []}, \"proof\": \"2802624f097f31c406fcd6c90107e0c92b0856ada8ab7aefd2a74b0db13c863229e6ac88939c9df175a48db8856bbc9d\"}\n{\"row\": \"R9\", \"model\": \"aerospace/satellite_lageos1_twin\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"satellite_lageos1_twin\", \"initial\": {\"epoch_utc_s\": 844432990.0, \"forecast_elapsed_s\": 0.0, \"position_m\": [-5947439.326, 2555567.396, 10470793.788], \"velocity_m_s\": [4754.057, 2345.016, 2292.947]}, \"dt_s\": 10.0, \"segments\": [{\"steps\": 1614, \"load\": {}}], \"record_every\": 1614}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 1614, \"quantity\": \"semi_major_axis_m\", \"value\": 11400874.582902145, \"flags\": [{\"flag\": \"FLAG_BELOW_COMPARED_RADIUS\", \"quantity\": \"radius_m\", \"extent\": 1559062.143708026, \"steps\": 994}, {\"flag\": \"FLAG_EARTH_SHADOW\", \"quantity\": \"distance_from_shadow_axis_m\", \"extent\": 1409415.657917643, \"steps\": 183}]}, \"proof\": \"760e36d0a9c7ce7d7bc1e45f15334a31f23e242ce276c2b84454dfdcf21ca745576a3557773a024e0d7bedcd90133779\"}\n{\"row\": \"R10\", \"model\": \"aerospace/crater_ryugu_sci\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"crater_ryugu_sci\", \"initial\": {\"radius_m\": 1.25}, \"dt_s\": 0.1285, \"segments\": [{\"steps\": 210, \"load\": {}}, {\"steps\": 231, \"load\": {}}, {\"steps\": 252, \"load\": {}}, {\"steps\": 273, \"load\": {}}, {\"steps\": 294, \"load\": {}}, {\"steps\": 315, \"load\": {}}], \"record_every\": 1575}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 1575, \"quantity\": \"radius_m\", \"value\": 7.823494707379572, \"flags\": []}, \"proof\": \"e6950ae5d4f4d0953321d1013624d3ce599b23249db4d6075c705be83c6b66f37cbf9a67bb109ddbf36bd7003945bd86\"}\n\nBudget: at most 4 calls that compute, counted over every call you make (every run_trajectory, solve, compute_step and verify_ call counts, refused or not); list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all.\n\nYou have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.\n\nEnd your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {\"tool\": \"\", \"arguments\": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.\n\nThe card:\n{\"false_rows\": {\"\": \"\", ...}}\n\nName every false row, each with its one reason from retired_model, parent_wrong, seal_wrong, stop_hidden, step_wrong, flag_omitted, flag_altered, value_altered (the first of them, in that order, that is true of the row). Leave the genuine rows out. {\"false_rows\": {}} says every row is genuine. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.", + "real_thing": "Ten answers of the verifier over 9 models of entry, orbit and space.", + "reference": { + "from": "the reference agent's reply (g2-forensics7-10.txt)", + "card": { + "false_rows": { + "R2": "value_altered", + "R7": "seal_wrong", + "R8": "step_wrong", + "R9": "retired_model" + } + }, + "proofs": [], + "open_address_record": true, + "engine_tag": "v0.15.3", + "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1" + }, + "measurement": [ + { + "model": "ablator_slab", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with 31 arc-jet tests outside the fit: wear within its target on 28 of 31 (target 25), mean \u22125.3 percent over all 31 (\u22122.6 over the 30 without the pure-nitrogen test; target within 8); hottest face within 7 percent on 24 of 28 (target 23); Stardust wear 7.58 and 3.32 mm against 5.7 and 3.2; fed by capsule_stardust through stardust_entry_to_pica_slab, nose wear 4.65 mm and face within 156 K RMS of the airborne spectra. Gap: the face runs 4.1 percent hot on average (target 3.5), and Stardust nose wear is a third high.", + "specimen": "A flat slab of charring heat-shield material heated on one face: wear, face temperature, depth of charring and the heat and mass accounts, for a PICA model built from the open record or the test material TACOT 3.0.", + "error": null + }, + { + "model": "aerospace/capsule_insight", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with the last 59 s before the parachute, not in the fit: speed within 7.2 m/s RMS, radius within 245 m and deceleration within 0.031 g over the 58 whole seconds; at the flight's deployment time the radius within 114 m (target 3.5 km) and Mach 1.501 against 1.522 (target 0.2); the deployment speed reached 1.31 s late and the radius 0.58 s early (target 15.1 s). Gap: with no lift the run reaches the flight's radius at the parachute 22.8 s late and is 4.24 km high there (targets 15.1 s and 3.5 km); between 36 and 65 km the card's air is 8 to 13 percent denser than the flight's, and the peak load comes 4.0 s early.", + "specimen": "Entry of NASA's InSight capsule at Mars on 26 November 2018, as a point mass with the 2008 Phoenix drag database, no wind, and the lift over drag as the load: altitude, speed through the air, Mach number, dynamic pressure and load, from the top of the atmosphere to the flown parachute deployment.", + "error": null + }, + { + "model": "aerospace/capsule_stardust", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with NASA's reconstruction of the entry and the radar record of parachute opening: peak load 32.17 g against 32.89 g, within 0.72 g (target 3.64 g); the drogue altitude, 31.03 km, reached at 138.909 s and Mach 1.23 at 136.953 s against 137.9 s recorded, within 1.01 s (target 7.4 s). Gap: heat flux 696 W/cm2 against NASA's computed 762 to 1000; the yearly standard atmosphere in place of that morning's air is worth about 1 g of peak load either way.", + "specimen": "Entry of the Stardust sample return capsule on 15 January 2006, as a point mass with tabulated drag, no lift, no wind and a yearly standard atmosphere: altitude, speed through the air, Mach number, load, heat flux, and at the nose the stagnation pressure, recovery enthalpy and heat-transfer coefficient a heat shield takes, from entry interface to the drogue-deployment condition the radar recorded.", + "error": null + }, + { + "model": "aerospace/crater_ryugu_sci", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with the measured crater on Ryugu, not in the fit, with the law fitted on all thirteen laboratory craters: final radius 8.571 m against the apparent radius of 7.25 m, within 1.32 m, 18.2 percent (allowance 0.97 m); in the laboratory, with the law fitted again on the nine craters at 1 g alone, the four centrifuge craters within 6.9 to 9.5 percent, mean 7.9 percent (target 10), each inside its 95 percent prediction interval. Gap: on Ryugu the card stops 1.32 m, 18.2 percent, above the measured apparent radius, outside the allowance of 0.97 m; the growth and its clock, read by eye at 1 g, have no measurement of Ryugu to meet.", + "specimen": "Growth of the crater made on asteroid Ryugu by the 2 kg copper impactor of Hayabusa2 on 5 April 2019, by the law of crater size for dry sand held by gravity, with a laboratory clock: the radius at the level of the undisturbed surface from 0.1622 m until it stops, with no load.", + "error": null + }, + { + "model": "aerospace/momentum_jwst_dihedral", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with the two months after the fit: the daily growth of |H| within 0.1 of the observed plus 0.2 N m s on 25 of 28 and 22 of 30 days (target 80 percent); the hourly growth rate within 0.272 and 0.375 of its spread RMS (target 0.5); the torque within 0.144 and 0.149 of the RMS torque (target 0.4); |H| at a run's end within 4.9 percent over 3.9 to 12.4 days and 5.5 percent after 29.3 days (target 10). Gap: the daily change of the vector H is within that allowance on 18 of 28 and 13 of 30 days (target 80 percent), 0.42 N m s RMS against momentum_jwst_srp's 0.81; beyond 2 degrees of roll its torque about J3 is off by 11 and 10.4 \u00b5N m RMS.", + "specimen": "Total angular momentum of the James Webb Space Telescope at Sun-Earth L2, held by its reaction wheels between momentum unloads under sunlight pressure on its sunshield, from its attitude quaternion and the Sun's direction and distance: the first layer as two plane slopes of 110 m\u00b2 meeting along a ridge on the boresight, each falling 4.03 degrees towards the Sun, so that the Sun's roll turns into torque about the boresight.", + "error": null + }, + { + "model": "aerospace/momentum_jwst_srp", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with the three months after the fit: the daily growth of |H| within 0.1 of the observed plus 0.2 N m s on 23 of 28, 15 of 28 and 17 of 30 days (target 80 percent); the hourly growth rate within 0.437, 0.384 and 0.421 of its spread RMS (target 0.5); the torque within 0.262, 0.314 and 0.347 of the RMS torque (target 0.4); |H| at a run's end within 8.4 and 0.9 percent after 10.7 and 16.3 days and 7.4 percent after 29.3 days (target 10). Gap: the daily change of the vector H is within that allowance on 14 of 28, 8 of 28 and 8 of 30 days (target 80 percent): beyond 2 degrees of roll its torque about the boresight is off by about 30 \u00b5N m; |H| after an unload in the second month reads 16.2 percent low at 3.9 days.", + "specimen": "Total angular momentum of the James Webb Space Telescope at Sun-Earth L2, held by its reaction wheels between momentum unloads under sunlight pressure on its sunshield, from its attitude quaternion and the Sun's direction and distance: one sunlit layer of 220 m\u00b2 with JWST's published optical numbers.", + "error": null + }, + { + "model": "aerospace/satellite_lageos1", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with the 42 runs of the six weeks outside that choice, two of LAGEOS-1 and four of LAGEOS-2: LAGEOS-1 within 0.65 m of the published orbit after one revolution (target 1 m), 3.8 m after one day (10 m) and 32 m after seven days (100 m); LAGEOS-2 within 0.34 m, 2.9 m and 22 m. Gap: the error grows with the length of a forecast, from 0.65 m after one revolution to 32 m after seven days on LAGEOS-1, as the card carries no drag, no light reflected from the Earth and no ocean tide.", + "specimen": "Free flight of the laser-ranging satellite LAGEOS-1 from a published position and velocity, in a frame turning with the Earth: the Earth's field to degree and order 12, the Sun and the Moon, the solid tide, sunlight pressure and relativity, with the energy and the angular momentum about the Earth's axis held at every step.", + "error": null + }, + { + "model": "aerospace/solar_system", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with 10,134 ranges of three spacecraft in four files, not used to choose it, in one run of 7,670 days: Mars Odyssey to 2006 within 695 m (target 700 m), 270 m RMS; Odyssey after 2006 and Mars Reconnaissance Orbiter, out to 15.0 years, 612 and 619 m RMS, worst 1,312 and 1,314 m; MESSENGER at Mercury, 12.3 to 16.2 years out, within 2.08 km (target 2.5 to 4.4 km), 1.42 km RMS. Gap: in mid-2007, 44 Odyssey ranges and 34 Mars Reconnaissance Orbiter ranges are outside their targets, by at most 8 and 10 percent, from the 340 asteroids the card leaves out; the Juno and Cassini files are outside the comparison, as they leave 20 km and 10 km RMS with JPL's own positions.", + "specimen": "The Solar System as thirteen point masses in free motion: the Sun, Mercury, Venus, the Earth, the Moon, the barycentres of the Mars, Jupiter, Saturn, Uranus and Neptune systems, and Ceres, Pallas and Vesta, under Newton's and the relativistic forces between every pair and the Earth's oblateness on the Moon. The caller supplies every position and velocity.", + "error": null + }, + { + "model": "plasma_sheath_ram_c2", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with the reflectometer onsets of NASA TN D-6062 Table X at 7.65 km/s: electron density 0.94 of the measured, within a factor of 1.07, at the cone station's X band at 70.0 km; 3.28 and 2.92 times the measured at 77.7 and 80.0 km. Gap: above 73.6 km, where the shock is as thick as the layer and electrons are lost to the cold wall, the density reads about 3 times high (3.28 at 77.7 km, 2.92 at 80.0 km).", + "specimen": "The plasma sheath around NASA's RAM C-II re-entry probe (a 15.24 cm hemisphere on a 9 degree cone) at one flight point: the equilibrium normal shock and stagnation point of 11-species air, the gas carried along the body to the nose station (x/D 0.15) and the cone station (x/D 0.76) with Dunn and Kang's 26 reactions at finite rate, the electron density, the plasma frequency, and whether a radio signal of the asked frequency is blacked out at each.", + "error": null + } + ], + "cheat_suite": { + "vectors": [ + { + "vector": "honest", + "expect": "honest control (1)", + "reward": 1, + "graded": 1.0, + "ok": true, + "reason": null + }, + { + "vector": "honest_reply_log_matches", + "expect": "honest control (1)", + "reward": 1, + "graded": 1.0, + "ok": true, + "reason": null + }, + { + "vector": "honest_numbers_respelled", + "expect": "honest control (1)", + "reward": 1, + "graded": 1.0, + "ok": true, + "reason": null + }, + { + "vector": "no_request_behind", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "no computing call behind the answer: the table was not put to the verifier" + }, + { + "vector": "edited_call_log", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the call log beside the reply differs from the harness log" + }, + { + "vector": "over_budget", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "5 computing calls; the budget is 4" + }, + { + "vector": "forbidden_tool", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the log holds calls of find_flip, which the task rules out" + }, + { + "vector": "no_harness_log", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "no harness call log: every attempt is scored with the calls the harness recorded" + }, + { + "vector": "harness_log_edited", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the harness log's chain breaks at line 5" + }, + { + "vector": "stale_engine_tag", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the task was built on engine 0.15.0; the verifier is 0.15.3" + }, + { + "vector": "every_row_genuine", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "4 false row(s) not named" + }, + { + "vector": "every_row_false", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "every row of the table is named false: a blanket answer" + }, + { + "vector": "every_row_false_true_reasons", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "every row of the table is named false: a blanket answer" + } + ], + "not_applicable": [ + { + "vector": "copied_proof_other_task", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "nudged_figure", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "figure_plus_10_percent", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "card_request_not_run", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "swapped_sides", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "binding_misnamed", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "proof_from_other_design", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "failing_given_as_passing", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "proof_uppercase", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "extra_argument", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "stop_misnamed", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "step_misnamed", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "missing_solve", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "solve_handed_other_run", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "next_start_rounded", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "next_proof_copied", + "why": "a forensics card carries no request or proof" + }, + { + "vector": "next_request_edited", + "why": "a forensics card carries no request or proof" + } + ], + "cheats_scoring_above_0": 0, + "run": true + }, + "solver_runs": { + "reference": { + "reward": 1, + "graded": 1.0, + "correct": 1, + "proofs_hold": 1, + "computing_calls": 4, + "verdict": "pass", + "reason": null + }, + "naive": { + "reward": 0, + "graded": 0.0, + "correct": 0, + "proofs_hold": 1, + "computing_calls": 1, + "verdict": "wrong", + "reason": "4 false row(s) not named" + } + }, + "passk": [ + { + "family": "Frontier model", + "model": "Frontier model", + "variant": "tool", + "n": 8, + "correct": 3, + "pass@1": 0.375, + "pass@8": 1.0, + "mean_graded": 0.910714375, + "harness_error_rate": 0.0 + } + ], + "no_tool_question": false, + "physics_forensics": false, + "blind_baseline": { + "rows": 10, + "caught_without_call": 2, + "rows_needing_call": 8, + "call_budget": 4, + "hidden_false_rows": 2, + "uniform_hit_rate": 0.2143, + "formula": "C(8-2,4-2)/C(8,4)" + }, + "written_utc": "2026-11-14T01:27:47Z" +} diff --git a/sample/reports/g2-sd-slab-shallowest-char-load-v3.html b/sample/reports/g2-sd-slab-shallowest-char-load-v3.html new file mode 100644 index 0000000000000000000000000000000000000000..61dc99432a132562adcef510bde63c4f4502542c --- /dev/null +++ b/sample/reports/g2-sd-slab-shallowest-char-load-v3.html @@ -0,0 +1,370 @@ + +Task report: g2-sd-slab-shallowest-char-load-v3 +

g2-sd-slab-shallowest-char-load-v3

+

Multi-step physics RLVR task scored by deterministic recomputation on the Zero-Trust Physics verifier.

+

Design to a limit · models aerospace/capsule_stardust, ablator_slab · Zero-Trust Physics v0.15.3 · Protocol Company

+

Checksums

+ + +
Whatsha256SHA-384
Task row47398ee9fcb4691950b624fbc4cd69090766f717eef127cae21f58380acffeb4a633e7dcea8515e1500f80a0469fef480dec300ccac658d90a338547e6f6f8441a469400f5450dab6333e97af5d7ad00
Harbor directoryb82b0ccf091bd0046bfb5b531484795b8ae6109edef60e977b4413dc34b6c025bd448d6db770c32198051befef8b5eb57917c14a9a6cf364c1e148e3158a03c4416ab19b04badab160233ad17644be6a
+

Instruction

The Stardust sample return capsule enters the Earth's air at 6501730 m from the Earth's centre, at 12837.7 m/s, at a flight-path angle below the horizontal that you choose. Its heat shield's near-nose core is a slab of PICA, open record, version 3, 59.4 mm thick, starting at 263.6 K, heated by the capsule's own entry as the verifier hands it from the capsule's sealed run to the slab through their coupling, stardust_entry_to_pica_slab, radiating to surroundings at 265.4 K, and cooling with the stream off until 580 s.
+
+Find the shallowest entry, from 8.58 to 9.28 degrees below the horizontal, for which every constraint below holds. Give the passing design and the first failing design, no more than 0.012 degrees of flight-path angle apart, and name the constraint that binds.
+
+Constraints (id, what, limit):
+- char_depth, the depth at which the slab's material is back within 2 percent of virgin density, in metres: at or below 0.016987 m (16.987 mm)
+- peak_load, the peak load on the capsule, in Earth g, over the whole entry: at or below 40.48 g
+Each design is two requests. The run of the capsule must end at the drogue-deployment condition (outcome ended, PastFlightDeployment). The run:
+{"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6501730.0, "radial_speed_m_s": "-V sin(angle)", "transverse_speed_m_s": "V cos(angle)"}, "dt_s": 0.03125, "segments": [{"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": "<enough to reach the drogue condition, at most 8000>", "load": {}}], "record_every": 720}}
+with V = 12837.7 m/s and the angle in degrees below the horizontal.
+Then the slab, a solve handed that run through the coupling, with these parameters:
+{"tool": "solve", "arguments": {"solver": "ablator_slab", "parameters": {"material": "PICA, open record, version 3", "thickness_m": 0.0594, "start_temperature_k": 263.6, "face": "gas_stream", "stream_gas": "air", "surroundings_temperature_k": 265.4, "face_wears": true}, "from": {"request": "<the run's request>", "run_seal": "<the run's seal>", "coupling": "stardust_entry_to_pica_slab"}}}
+and its heating history laid out as the coupling's worked chain lays it: row 0 at 0 s with the first frame's pressure and enthalpy and a heat-transfer coefficient of 0; then one row per recorded frame, handed bit for bit (time, stagnation pressure, heat-transfer coefficient, recovery enthalpy); then a row 1 s after the last frame and a row at 580 s, each with the last frame's pressure and enthalpy and a heat-transfer coefficient of 0; a radiative heating of 0 in every row. thermocouple_depths_m and the return_ flags are yours to set.
+
+Budget: at most 8 calls that compute, counted over every call you make, each run and each solve one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.
+
+You have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.
+
+End your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {"tool": "<the tool's name as the verifier names it, without any prefix your own program adds>", "arguments": {<the arguments exactly as you sent them>}}, and a proof is the run_seal or solution_seal the verifier gave for that request.
+
+The card:
+{"passing": {"run": {"request": ..., "proof": ...}, "solve": {"request": ..., "proof": ...}}, "failing": {"run": {"request": ..., "proof": ...}, "solve": {"request": ..., "proof": ...}}, "binding": "<constraint id>"}
+
+passing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary. Leave out "solve" when the task has no solve. A solve is the one handed its own design's sealed run through the coupling the task names. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.
+

Reference solution

+

From the reference agent's reply (g2-sd-slab-shallowest-char-load-v3.txt). Built on engine v0.15.3 at commit 664d68f426cc. Open address: a record exists.

+
On the cardToolProofOpen address
passing.runrun_trajectory1180c5d72b6e89bdca7e236309a6a02084ef35fc1663655df36503ad31d467defab0a098606418ed15558cb5ed128706verified
passing.solvesolve7aa9ce40f8bb099404c82343f0377e89de1f19aea553c4709de138de973e4d9181a4be80d2624dba752ed9c65551eb8averified
failing.runrun_trajectoryef36a611bb78025f867b14eec165d49d00fbc219ae5d2354c223260eee883e27d74314ced1e6b2d8b825e8c8e058a03cverified
failing.solvesolve1208b2ff940f3ba9fc67ac83b53d7c47fa4bf633d61f2fdb02023736aceb6e6016176cf106b054a2e2c5d352fe85bc8everified
+
{
+ "passing": {
+  "run": {
+   "request": {
+    "tool": "run_trajectory",
+    "arguments": {
+     "domain": "aerospace",
+     "card": "capsule_stardust",
+     "initial": {
+      "radius_m": 6501730.0,
+      "radial_speed_m_s": -1970.2359604673798,
+      "transverse_speed_m_s": 12685.610412986882
+     },
+     "dt_s": 0.03125,
+     "segments": [
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 3840,
+       "load": {}
+      }
+     ],
+     "record_every": 720
+    }
+   },
+   "proof": "1180c5d72b6e89bdca7e236309a6a02084ef35fc1663655df36503ad31d467defab0a098606418ed15558cb5ed128706"
+  },
+  "solve": {
+   "request": {
+    "tool": "solve",
+    "arguments": {
+     "solver": "ablator_slab",
+     "parameters": {
+      "material": "PICA, open record, version 3",
+      "thickness_m": 0.0594,
+      "start_temperature_k": 263.6,
+      "face": "gas_stream",
+      "stream_gas": "air",
+      "surroundings_temperature_k": 265.4,
+      "face_wears": true,
+      "thermocouple_depths_m": [],
+      "return_face_history": false,
+      "return_thermocouple_histories": false,
+      "return_final_profile": false,
+      "history_time_s": [
+       0.0,
+       22.5,
+       45.0,
+       67.5,
+       90.0,
+       112.5,
+       121.9375,
+       122.9375,
+       580.0
+      ],
+      "history_pressure_pa": [
+       339.1914367675781,
+       339.1914367675781,
+       29965.41796875,
+       22537.322265625,
+       5747.75341796875,
+       2572.19921875,
+       2390.386474609375,
+       2390.386474609375,
+       2390.386474609375
+      ],
+      "history_heat_transfer_coefficient_kg_per_m2_s": [
+       0.0,
+       0.013946173712611198,
+       0.1310727745294571,
+       0.11351476609706879,
+       0.05656934529542923,
+       0.03541867434978485,
+       0.0322762057185173,
+       0.0,
+       0.0
+      ],
+      "history_flow_enthalpy_j_per_kg": [
+       78225696.0,
+       78225696.0,
+       56615752.0,
+       6155888.0,
+       598724.5625,
+       105872.484375,
+       62793.7109375,
+       62793.7109375,
+       62793.7109375
+      ],
+      "history_radiative_heating_w_per_m2": [
+       0.0,
+       0.0,
+       0.0,
+       0.0,
+       0.0,
+       0.0,
+       0.0,
+       0.0,
+       0.0
+      ]
+     },
+     "from": {
+      "request": {
+       "domain": "aerospace",
+       "card": "capsule_stardust",
+       "initial": {
+        "radius_m": 6501730.0,
+        "radial_speed_m_s": -1970.2359604673798,
+        "transverse_speed_m_s": 12685.610412986882
+       },
+       "dt_s": 0.03125,
+       "segments": [
+        {
+         "steps": 240,
+         "load": {}
+        },
+        {
+         "steps": 240,
+         "load": {}
+        },
+        {
+         "steps": 240,
+         "load": {}
+        },
+        {
+         "steps": 240,
+         "load": {}
+        },
+        {
+         "steps": 240,
+         "load": {}
+        },
+        {
+         "steps": 240,
+         "load": {}
+        },
+        {
+         "steps": 240,
+         "load": {}
+        },
+        {
+         "steps": 240,
+         "load": {}
+        },
+        {
+         "steps": 240,
+         "load": {}
+        },
+        {
+         "steps": 240,
+         "load": {}
+        },
+        {
+         "steps": 240,
+         "load": {}
+        },
+        {
+         "steps": 240,
+         "load": {}
+        },
+        {
+         "steps": 3840,
+         "load": {}
+        }
+       ],
+       "record_every": 720
+      },
+      "run_seal": "1180c5d72b6e89bdca7e236309a6a02084ef35fc1663655df36503ad31d467defab0a098606418ed15558cb5ed128706",
+      "coupling": "stardust_entry_to_pica_slab"
+     }
+    }
+   },
+   "proof": "7aa9ce40f8bb099404c82343f0377e89de1f19aea553c4709de138de973e4d9181a4be80d2624dba752ed9c65551eb8a"
+  }
+ },
+ "failing": {
+  "run": {
+   "request": {
+    "tool": "run_trajectory",
+    "arguments": {
+     "domain": "aerospace",
+     "card": "capsule_stardust",
+     "initial": {
+      "radius_m": 6501730.0,
+      "radial_speed_m_s": -1968.6418240960256,
+      "transverse_speed_m_s": 12685.857899977434
+     },
+     "dt_s": 0.03125,
+     "segments": [
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 240,
+       "load": {}
+      },
+      {
+       "steps": 3840,
+       "load": {}
+      }
+     ],
+     "record_every": 720
+    }
+   },
+   "proof": "ef36a611bb78025f867b14eec165d49d00fbc219ae5d2354c223260eee883e27d74314ced1e6b2d8b825e8c8e058a03c"
+  },
+  "solve": {
+   "request": {
+    "tool": "solve",
+    "arguments": {
+     "solver": "ablator_slab",
+     "parameters": {
+      "material": "PICA, open record, version 3",
+      "thickness_m": 0.0594,
+      "start_temperature_k": 263.6,
+      "face": "gas_stream",
+      "stream_gas": "air",
+      "surroundings_temperature_k": 265.4,
+      "face_wears": true,
+      "thermocouple_depths_m": [],
+      "return_face_history": false,
+      "re
+

What the models were compared with

+
ModelAgainstSpecimenAccuracy against measurement
aerospace/capsule_stardustcompared with measurementEntry of the Stardust sample return capsule on 15 January 2006, as a point mass with tabulated drag, no lift, no wind and a yearly standard atmosphere: altitude, speed through the air, Mach number, load, heat flux, and at the nose the stagnation pressure, recovery enthalpy and heat-transfer coefficient a heat shield takes, from entry interface to the drogue-deployment condition the radar recorded.Compared with NASA's reconstruction of the entry and the radar record of parachute opening: peak load 32.17 g against 32.89 g, within 0.72 g (target 3.64 g); the drogue altitude, 31.03 km, reached at 138.909 s and Mach 1.23 at 136.953 s against 137.9 s recorded, within 1.01 s (target 7.4 s). Gap: heat flux 696 W/cm2 against NASA's computed 762 to 1000; the yearly standard atmosphere in place of that morning's air is worth about 1 g of peak load either way.
ablator_slabcompared with measurementA flat slab of charring heat-shield material heated on one face: wear, face temperature, depth of charring and the heat and mass accounts, for a PICA model built from the open record or the test material TACOT 3.0.Compared with 31 arc-jet tests outside the fit: wear within its target on 28 of 31 (target 25), mean −5.3 percent over all 31 (−2.6 over the 30 without the pure-nitrogen test; target within 8); hottest face within 7 percent on 24 of 28 (target 23); Stardust wear 7.58 and 3.32 mm against 5.7 and 3.2; fed by capsule_stardust through stardust_entry_to_pica_slab, nose wear 4.65 mm and face within 156 K RMS of the airborne spectra. Gap: the face runs 4.1 percent hot on average (target 3.5), and Stardust nose wear is a third high.
+

Cheat suite

0 cheat attempt(s) scored above 0. 22 vectors applied; 8 do not apply to this kind.

VectorExpectedRewardGradedResultScorer's reason
honesthonest control (1)11.000holds
honest_reply_log_matcheshonest control (1)11.000holds
honest_numbers_respelledhonest control (1)11.000holds
no_request_behindcheat (0)00.000holdsa run_trajectory request on the card is not among the calls in the log
edited_call_logcheat (0)00.000holdsthe call log beside the reply differs from the harness log
over_budgetcheat (0)00.000holds9 computing calls; the budget is 8
forbidden_toolcheat (0)00.000holdsthe log holds calls of find_flip, which the task rules out
no_harness_logcheat (0)00.000holdsno harness call log: every attempt is scored with the calls the harness recorded
harness_log_editedcheat (0)00.000holdsthe harness log's chain breaks at line 4
stale_engine_tagcheat (0)00.000holdsthe task was built on engine 0.15.0; the verifier is 0.15.3
copied_proof_other_taskcheat (0)00.000holdsthe passing design's run_seal: the verifier says the seal does not hold (cause run_seal)
nudged_figurecheat (0)00.000holdsthe passing design's run_seal: the verifier says the seal does not hold (cause run_seal)
figure_plus_10_percentcheat (0)00.000holdsthe passing design's run_seal: the verifier says the seal does not hold (cause run_seal)
card_request_not_runcheat (0)00.000holdsa run_trajectory request on the card is not among the calls in the log
swapped_sidescheat (0)00.000holdsthe passing design breaks char_depth
binding_misnamedcheat (0)00.000holdsbinding names 'peak_load'; the constraint that binds is another
proof_from_other_designcheat (0)00.000holdsthe failing design's run_seal: the verifier says the seal does not hold (cause run_seal)
failing_given_as_passingcheat (0)00.000holdsthe passing design breaks char_depth
proof_uppercasecheat (0)00.000holdsthe passing design's run_seal: the proof is not a SHA-384 seal of 96 hex digits
extra_argumentcheat (0)00.000holdsthe passing design's run differs from the task's at note
missing_solvecheat (0)00.000holdsthe passing design's solve is missing
solve_handed_other_runcheat (0)00.000holdsthe passing design's solve is not handed the design's own sealed run
+

Solver runs

+
AgentRewardGradedComputing callsScorer's reason
Reference agent11.0004
One-call agent00.0001the passing design's solve is missing
+

Pass@k by model family

+
FamilyVariantModelSolvedpass@1pass@8Mean gradedHarness errors
Frontier modeltoolFrontier model3 of 838%100%0.3750%
+

Measured calibration: Frontier model, tool variant, n=8.

+

Calibrated on pass@1 in [2%, 70%] on a frontier model's tool variant, with pass@8 and continuous graded reward reported beside pass/fail.

+ +

Written 2026-11-14T01:27:47Z.

+ \ No newline at end of file diff --git a/sample/reports/g2-sd-slab-shallowest-char-load-v3.json b/sample/reports/g2-sd-slab-shallowest-char-load-v3.json new file mode 100644 index 0000000000000000000000000000000000000000..39efe5c05cd957a8958665cb6963d662309d8366 --- /dev/null +++ b/sample/reports/g2-sd-slab-shallowest-char-load-v3.json @@ -0,0 +1,759 @@ +{ + "id": "g2-sd-slab-shallowest-char-load-v3", + "family": "tradeoff", + "kind": "design_to_limit", + "models": [ + "aerospace/capsule_stardust", + "ablator_slab" + ], + "checksums": { + "row_sha256": "47398ee9fcb4691950b624fbc4cd69090766f717eef127cae21f58380acffeb4", + "row_sha384": "a633e7dcea8515e1500f80a0469fef480dec300ccac658d90a338547e6f6f8441a469400f5450dab6333e97af5d7ad00", + "harbor_dir_sha256": "b82b0ccf091bd0046bfb5b531484795b8ae6109edef60e977b4413dc34b6c025", + "harbor_dir_sha384": "bd448d6db770c32198051befef8b5eb57917c14a9a6cf364c1e148e3158a03c4416ab19b04badab160233ad17644be6a" + }, + "instruction": "The Stardust sample return capsule enters the Earth's air at 6501730 m from the Earth's centre, at 12837.7 m/s, at a flight-path angle below the horizontal that you choose. Its heat shield's near-nose core is a slab of PICA, open record, version 3, 59.4 mm thick, starting at 263.6 K, heated by the capsule's own entry as the verifier hands it from the capsule's sealed run to the slab through their coupling, stardust_entry_to_pica_slab, radiating to surroundings at 265.4 K, and cooling with the stream off until 580 s.\n\nFind the shallowest entry, from 8.58 to 9.28 degrees below the horizontal, for which every constraint below holds. Give the passing design and the first failing design, no more than 0.012 degrees of flight-path angle apart, and name the constraint that binds.\n\nConstraints (id, what, limit):\n- char_depth, the depth at which the slab's material is back within 2 percent of virgin density, in metres: at or below 0.016987 m (16.987 mm)\n- peak_load, the peak load on the capsule, in Earth g, over the whole entry: at or below 40.48 g\nEach design is two requests. The run of the capsule must end at the drogue-deployment condition (outcome ended, PastFlightDeployment). The run:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_stardust\", \"initial\": {\"radius_m\": 6501730.0, \"radial_speed_m_s\": \"-V sin(angle)\", \"transverse_speed_m_s\": \"V cos(angle)\"}, \"dt_s\": 0.03125, \"segments\": [{\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": \"\", \"load\": {}}], \"record_every\": 720}}\nwith V = 12837.7 m/s and the angle in degrees below the horizontal.\nThen the slab, a solve handed that run through the coupling, with these parameters:\n{\"tool\": \"solve\", \"arguments\": {\"solver\": \"ablator_slab\", \"parameters\": {\"material\": \"PICA, open record, version 3\", \"thickness_m\": 0.0594, \"start_temperature_k\": 263.6, \"face\": \"gas_stream\", \"stream_gas\": \"air\", \"surroundings_temperature_k\": 265.4, \"face_wears\": true}, \"from\": {\"request\": \"\", \"run_seal\": \"\", \"coupling\": \"stardust_entry_to_pica_slab\"}}}\nand its heating history laid out as the coupling's worked chain lays it: row 0 at 0 s with the first frame's pressure and enthalpy and a heat-transfer coefficient of 0; then one row per recorded frame, handed bit for bit (time, stagnation pressure, heat-transfer coefficient, recovery enthalpy); then a row 1 s after the last frame and a row at 580 s, each with the last frame's pressure and enthalpy and a heat-transfer coefficient of 0; a radiative heating of 0 in every row. thermocouple_depths_m and the return_ flags are yours to set.\n\nBudget: at most 8 calls that compute, counted over every call you make, each run and each solve one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.\n\nYou have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.\n\nEnd your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {\"tool\": \"\", \"arguments\": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.\n\nThe card:\n{\"passing\": {\"run\": {\"request\": ..., \"proof\": ...}, \"solve\": {\"request\": ..., \"proof\": ...}}, \"failing\": {\"run\": {\"request\": ..., \"proof\": ...}, \"solve\": {\"request\": ..., \"proof\": ...}}, \"binding\": \"\"}\n\npassing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary. Leave out \"solve\" when the task has no solve. A solve is the one handed its own design's sealed run through the coupling the task names. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.", + "real_thing": "Entry of the Stardust sample return capsule on 15 January 2006, as a point mass with tabulated drag, no lift, no wind and a yearly standard atmosphere: altitude, speed through the air, Mach number, load, heat flux, and at the nose the stagnation pressure, recovery enthalpy and heat-transfer coefficient a heat shield takes, from entry interface to the drogue-deployment condition the radar recorded. Compared with NASA's reconstruction of the entry and the radar record of parachute opening: peak load 32.17 g against 32.89 g, within 0.72 g (target 3.64 g); the drogue altitude, 31.03 km, reached at 138.909 s and Mach 1.23 at 136.953 s against 137.9 s recorded, within 1.01 s (target 7.4 s). Gap: heat flux 696 W/cm2 against NASA's computed 762 to 1000; the yearly standard atmosphere in place of that morning's air is worth about 1 g of peak load either way. / A flat slab of charring heat-shield material heated on one face: wear, face temperature, depth of charring and the heat and mass accounts, for a PICA model built from the open record or the test material TACOT 3.0. Compared with 31 arc-jet tests outside the fit: wear within its target on 28 of 31 (target 25), mean \u22125.3 percent over all 31 (\u22122.6 over the 30 without the pure-nitrogen test; target within 8); hottest face within 7 percent on 24 of 28 (target 23); Stardust wear 7.58 and 3.32 mm against 5.7 and 3.2; fed by capsule_stardust through stardust_entry_to_pica_slab, nose wear 4.65 mm and face within 156 K RMS of the airborne spectra. Gap: the face runs 4.1 percent hot on average (target 3.5), and Stardust nose wear is a third high.", + "reference": { + "from": "the reference agent's reply (g2-sd-slab-shallowest-char-load-v3.txt)", + "card": { + "passing": { + "run": { + "request": { + "tool": "run_trajectory", + "arguments": { + "domain": "aerospace", + "card": "capsule_stardust", + "initial": { + "radius_m": 6501730.0, + "radial_speed_m_s": -1970.2359604673798, + "transverse_speed_m_s": 12685.610412986882 + }, + "dt_s": 0.03125, + "segments": [ + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 3840, + "load": {} + } + ], + "record_every": 720 + } + }, + "proof": "1180c5d72b6e89bdca7e236309a6a02084ef35fc1663655df36503ad31d467defab0a098606418ed15558cb5ed128706" + }, + "solve": { + "request": { + "tool": "solve", + "arguments": { + "solver": "ablator_slab", + "parameters": { + "material": "PICA, open record, version 3", + "thickness_m": 0.0594, + "start_temperature_k": 263.6, + "face": "gas_stream", + "stream_gas": "air", + "surroundings_temperature_k": 265.4, + "face_wears": true, + "thermocouple_depths_m": [], + "return_face_history": false, + "return_thermocouple_histories": false, + "return_final_profile": false, + "history_time_s": [ + 0.0, + 22.5, + 45.0, + 67.5, + 90.0, + 112.5, + 121.9375, + 122.9375, + 580.0 + ], + "history_pressure_pa": [ + 339.1914367675781, + 339.1914367675781, + 29965.41796875, + 22537.322265625, + 5747.75341796875, + 2572.19921875, + 2390.386474609375, + 2390.386474609375, + 2390.386474609375 + ], + "history_heat_transfer_coefficient_kg_per_m2_s": [ + 0.0, + 0.013946173712611198, + 0.1310727745294571, + 0.11351476609706879, + 0.05656934529542923, + 0.03541867434978485, + 0.0322762057185173, + 0.0, + 0.0 + ], + "history_flow_enthalpy_j_per_kg": [ + 78225696.0, + 78225696.0, + 56615752.0, + 6155888.0, + 598724.5625, + 105872.484375, + 62793.7109375, + 62793.7109375, + 62793.7109375 + ], + "history_radiative_heating_w_per_m2": [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ] + }, + "from": { + "request": { + "domain": "aerospace", + "card": "capsule_stardust", + "initial": { + "radius_m": 6501730.0, + "radial_speed_m_s": -1970.2359604673798, + "transverse_speed_m_s": 12685.610412986882 + }, + "dt_s": 0.03125, + "segments": [ + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 3840, + "load": {} + } + ], + "record_every": 720 + }, + "run_seal": "1180c5d72b6e89bdca7e236309a6a02084ef35fc1663655df36503ad31d467defab0a098606418ed15558cb5ed128706", + "coupling": "stardust_entry_to_pica_slab" + } + } + }, + "proof": "7aa9ce40f8bb099404c82343f0377e89de1f19aea553c4709de138de973e4d9181a4be80d2624dba752ed9c65551eb8a" + } + }, + "failing": { + "run": { + "request": { + "tool": "run_trajectory", + "arguments": { + "domain": "aerospace", + "card": "capsule_stardust", + "initial": { + "radius_m": 6501730.0, + "radial_speed_m_s": -1968.6418240960256, + "transverse_speed_m_s": 12685.857899977434 + }, + "dt_s": 0.03125, + "segments": [ + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 3840, + "load": {} + } + ], + "record_every": 720 + } + }, + "proof": "ef36a611bb78025f867b14eec165d49d00fbc219ae5d2354c223260eee883e27d74314ced1e6b2d8b825e8c8e058a03c" + }, + "solve": { + "request": { + "tool": "solve", + "arguments": { + "solver": "ablator_slab", + "parameters": { + "material": "PICA, open record, version 3", + "thickness_m": 0.0594, + "start_temperature_k": 263.6, + "face": "gas_stream", + "stream_gas": "air", + "surroundings_temperature_k": 265.4, + "face_wears": true, + "thermocouple_depths_m": [], + "return_face_history": false, + "return_thermocouple_histories": false, + "return_final_profile": false, + "history_time_s": [ + 0.0, + 22.5, + 45.0, + 67.5, + 90.0, + 112.5, + 122.09375, + 123.09375, + 580.0 + ], + "history_pressure_pa": [ + 337.00457763671875, + 337.00457763671875, + 29798.859375, + 22617.865234375, + 5777.23681640625, + 2577.45849609375, + 2390.31005859375, + 2390.31005859375, + 2390.31005859375 + ], + "history_heat_transfer_coefficient_kg_per_m2_s": [ + 0.0, + 0.01390114426612854, + 0.13070805370807648, + 0.11371913552284241, + 0.056723203510046005, + 0.0354800745844841, + 0.03227389603853226, + 0.0, + 0.0 + ], + "history_flow_enthalpy_j_per_kg": [ + 78226040.0, + 78226040.0, + 56752312.0, + 6219895.5, + 605393.0, + 106824.0078125, + 62769.21484375, + 62769.21484375, + 62769.21484375 + ], + "history_radiative_heating_w_per_m2": [ + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0 + ] + }, + "from": { + "request": { + "domain": "aerospace", + "card": "capsule_stardust", + "initial": { + "radius_m": 6501730.0, + "radial_speed_m_s": -1968.6418240960256, + "transverse_speed_m_s": 12685.857899977434 + }, + "dt_s": 0.03125, + "segments": [ + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 240, + "load": {} + }, + { + "steps": 3840, + "load": {} + } + ], + "record_every": 720 + }, + "run_seal": "ef36a611bb78025f867b14eec165d49d00fbc219ae5d2354c223260eee883e27d74314ced1e6b2d8b825e8c8e058a03c", + "coupling": "stardust_entry_to_pica_slab" + } + } + }, + "proof": "1208b2ff940f3ba9fc67ac83b53d7c47fa4bf633d61f2fdb02023736aceb6e6016176cf106b054a2e2c5d352fe85bc8e" + } + }, + "binding": "char_depth" + }, + "proofs": [ + { + "where": "passing.run", + "tool": "run_trajectory", + "proof": "1180c5d72b6e89bdca7e236309a6a02084ef35fc1663655df36503ad31d467defab0a098606418ed15558cb5ed128706", + "open_address": "verified" + }, + { + "where": "passing.solve", + "tool": "solve", + "proof": "7aa9ce40f8bb099404c82343f0377e89de1f19aea553c4709de138de973e4d9181a4be80d2624dba752ed9c65551eb8a", + "open_address": "verified" + }, + { + "where": "failing.run", + "tool": "run_trajectory", + "proof": "ef36a611bb78025f867b14eec165d49d00fbc219ae5d2354c223260eee883e27d74314ced1e6b2d8b825e8c8e058a03c", + "open_address": "verified" + }, + { + "where": "failing.solve", + "tool": "solve", + "proof": "1208b2ff940f3ba9fc67ac83b53d7c47fa4bf633d61f2fdb02023736aceb6e6016176cf106b054a2e2c5d352fe85bc8e", + "open_address": "verified" + } + ], + "open_address_record": true, + "engine_tag": "v0.15.3", + "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1" + }, + "measurement": [ + { + "model": "aerospace/capsule_stardust", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with NASA's reconstruction of the entry and the radar record of parachute opening: peak load 32.17 g against 32.89 g, within 0.72 g (target 3.64 g); the drogue altitude, 31.03 km, reached at 138.909 s and Mach 1.23 at 136.953 s against 137.9 s recorded, within 1.01 s (target 7.4 s). Gap: heat flux 696 W/cm2 against NASA's computed 762 to 1000; the yearly standard atmosphere in place of that morning's air is worth about 1 g of peak load either way.", + "specimen": "Entry of the Stardust sample return capsule on 15 January 2006, as a point mass with tabulated drag, no lift, no wind and a yearly standard atmosphere: altitude, speed through the air, Mach number, load, heat flux, and at the nose the stagnation pressure, recovery enthalpy and heat-transfer coefficient a heat shield takes, from entry interface to the drogue-deployment condition the radar recorded.", + "error": null + }, + { + "model": "ablator_slab", + "against_measurement": "compared with measurement", + "accuracy_against_measurement": "Compared with 31 arc-jet tests outside the fit: wear within its target on 28 of 31 (target 25), mean \u22125.3 percent over all 31 (\u22122.6 over the 30 without the pure-nitrogen test; target within 8); hottest face within 7 percent on 24 of 28 (target 23); Stardust wear 7.58 and 3.32 mm against 5.7 and 3.2; fed by capsule_stardust through stardust_entry_to_pica_slab, nose wear 4.65 mm and face within 156 K RMS of the airborne spectra. Gap: the face runs 4.1 percent hot on average (target 3.5), and Stardust nose wear is a third high.", + "specimen": "A flat slab of charring heat-shield material heated on one face: wear, face temperature, depth of charring and the heat and mass accounts, for a PICA model built from the open record or the test material TACOT 3.0.", + "error": null + } + ], + "cheat_suite": { + "vectors": [ + { + "vector": "honest", + "expect": "honest control (1)", + "reward": 1, + "graded": 1.0, + "ok": true, + "reason": null + }, + { + "vector": "honest_reply_log_matches", + "expect": "honest control (1)", + "reward": 1, + "graded": 1.0, + "ok": true, + "reason": null + }, + { + "vector": "honest_numbers_respelled", + "expect": "honest control (1)", + "reward": 1, + "graded": 1.0, + "ok": true, + "reason": null + }, + { + "vector": "no_request_behind", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "a run_trajectory request on the card is not among the calls in the log" + }, + { + "vector": "edited_call_log", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the call log beside the reply differs from the harness log" + }, + { + "vector": "over_budget", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "9 computing calls; the budget is 8" + }, + { + "vector": "forbidden_tool", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the log holds calls of find_flip, which the task rules out" + }, + { + "vector": "no_harness_log", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "no harness call log: every attempt is scored with the calls the harness recorded" + }, + { + "vector": "harness_log_edited", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the harness log's chain breaks at line 4" + }, + { + "vector": "stale_engine_tag", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the task was built on engine 0.15.0; the verifier is 0.15.3" + }, + { + "vector": "copied_proof_other_task", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)" + }, + { + "vector": "nudged_figure", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)" + }, + { + "vector": "figure_plus_10_percent", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the passing design's run_seal: the verifier says the seal does not hold (cause run_seal)" + }, + { + "vector": "card_request_not_run", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "a run_trajectory request on the card is not among the calls in the log" + }, + { + "vector": "swapped_sides", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the passing design breaks char_depth" + }, + { + "vector": "binding_misnamed", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "binding names 'peak_load'; the constraint that binds is another" + }, + { + "vector": "proof_from_other_design", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the failing design's run_seal: the verifier says the seal does not hold (cause run_seal)" + }, + { + "vector": "failing_given_as_passing", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the passing design breaks char_depth" + }, + { + "vector": "proof_uppercase", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the passing design's run_seal: the proof is not a SHA-384 seal of 96 hex digits" + }, + { + "vector": "extra_argument", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the passing design's run differs from the task's at note" + }, + { + "vector": "missing_solve", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the passing design's solve is missing" + }, + { + "vector": "solve_handed_other_run", + "expect": "cheat (0)", + "reward": 0, + "graded": 0.0, + "ok": true, + "reason": "the passing design's solve is not handed the design's own sealed run" + } + ], + "not_applicable": [ + { + "vector": "stop_misnamed", + "why": "no stop binds" + }, + { + "vector": "step_misnamed", + "why": "no stop binds" + }, + { + "vector": "next_start_rounded", + "why": "not a continued design" + }, + { + "vector": "next_proof_copied", + "why": "not a continued design" + }, + { + "vector": "next_request_edited", + "why": "not a continued design" + }, + { + "vector": "every_row_genuine", + "why": "forensics only" + }, + { + "vector": "every_row_false", + "why": "forensics only" + }, + { + "vector": "every_row_false_true_reasons", + "why": "forensics only" + } + ], + "cheats_scoring_above_0": 0, + "run": true + }, + "solver_runs": { + "reference": { + "reward": 1, + "graded": 1.0, + "correct": 1, + "proofs_hold": 1, + "computing_calls": 4, + "verdict": "pass", + "reason": null + }, + "naive": { + "reward": 0, + "graded": 0.0, + "correct": 0, + "proofs_hold": 1, + "computing_calls": 1, + "verdict": "integrity", + "reason": "the passing design's solve is missing" + } + }, + "passk": [ + { + "family": "Frontier model", + "model": "Frontier model", + "variant": "tool", + "n": 8, + "correct": 3, + "pass@1": 0.375, + "pass@8": 1.0, + "mean_graded": 0.375, + "harness_error_rate": 0.0 + } + ], + "no_tool_question": false, + "physics_forensics": false, + "blind_baseline": null, + "written_utc": "2026-11-14T01:27:47Z" +} diff --git a/sample/reports/index.html b/sample/reports/index.html new file mode 100644 index 0000000000000000000000000000000000000000..af1c3a37f908ea493d61187b9cc4c28f0559e1f0 --- /dev/null +++ b/sample/reports/index.html @@ -0,0 +1,18 @@ + +Task quality reports

Task quality reports

+

5 tasks · Zero-Trust Physics v0.15.3 · Protocol Company

+
TaskKindReference rewardCheats above 0Pass@1
g2-budget-sd-airspeed-sink-e-t3Budgeted search10Frontier model tool pass@1 62%
g2-chain-sd-slab-radius-halfchar-h-r7Chained design10Frontier model tool pass@1 25%
g2-sd-slab-shallowest-char-load-v3Design to a limit10Frontier model tool pass@1 38%
g2-forensics7-10Forensics10Frontier model tool pass@1 38%
g2-forensics6-07Forensics10Frontier model tool pass@1 56%
\ No newline at end of file diff --git a/sample/reports/live_scores.jsonl b/sample/reports/live_scores.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..bfd7b2082b87c06797d8f7b7610257e0cf90481a --- /dev/null +++ b/sample/reports/live_scores.jsonl @@ -0,0 +1,5 @@ +{"id": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "kind": "budgeted_search", "calls_from": "harness", "correct": 1, "proofs_hold": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "computing_calls": 2, "holds_outcome": "completed", "stops_outcome": "refused (AirSpeedOutsideCard)", "holds_value": -1960.0377171633477, "stops_value": -1959.9495174505687, "width": 0.0881997127789873, "width_ratio": 0.600000000001185} +{"id": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "kind": "chained_design", "calls_from": "harness", "correct": 1, "proofs_hold": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "computing_calls": 4, "passing": {"x": 6488829.580236817, "met": {"half_char": true, "peak_load": true}, "values": {"half_char": 0.008992161781351305, "peak_load": 49.5781877582101}, "stopped": "PastFlightDeployment", "steps_landed": 2998}, "failing": {"x": 6488836.780236816, "met": {"half_char": false, "peak_load": true}, "values": {"half_char": 0.00899223837130888, "peak_load": 49.57632648317198}, "stopped": "PastFlightDeployment", "steps_landed": 2998}, "width": 7.199999999254942, "width_ratio": 0.5999999999379119} +{"id": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "kind": "design_to_limit", "calls_from": "harness", "correct": 1, "proofs_hold": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "computing_calls": 4, "passing": {"x": 8.828226247286798, "met": {"char_depth": true, "peak_load": true}, "values": {"char_depth": 0.016982147487637513, "peak_load": 38.260676882045026}, "stopped": "PastFlightDeployment", "steps_landed": 3902}, "failing": {"x": 8.821026247286797, "met": {"char_depth": false, "peak_load": true}, "values": {"char_depth": 0.01699148280192865, "peak_load": 38.197177740146515}, "stopped": "PastFlightDeployment", "steps_landed": 3907}, "width": 0.007200000000000983, "width_ratio": 0.6000000000000819} +{"id": "g2-forensics7-10", "family": "forensics", "kind": "forensics", "calls_from": "harness", "correct": 1, "proofs_hold": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "computing_calls": 4, "named": {"R2": "value_altered", "R7": "seal_wrong", "R8": "step_wrong", "R9": "retired_model"}} +{"id": "g2-forensics6-07", "family": "forensics", "kind": "forensics", "calls_from": "harness", "correct": 1, "proofs_hold": 1, "reward": 1, "graded": 1.0, "verdict": "pass", "reason": null, "computing_calls": 4, "named": {"R4": "step_wrong", "R5": "seal_wrong", "R8": "flag_altered", "R9": "retired_model"}} diff --git a/sample/reports/live_verify.json b/sample/reports/live_verify.json new file mode 100644 index 0000000000000000000000000000000000000000..efc439ea9dd567e4614bbfc8196af182dbe20461 --- /dev/null +++ b/sample/reports/live_verify.json @@ -0,0 +1,7 @@ +{ + "date": "13 November 2026", + "address": "https://mcp.zerotrustphysics.com/mcp", + "tasks": 5, + "reward_1": 5, + "proofs_hold": 5 +} \ No newline at end of file diff --git a/sample/reports/vault_proof.json b/sample/reports/vault_proof.json new file mode 100644 index 0000000000000000000000000000000000000000..3ce6f52ca85af78f5647b995b2174725ecd31491 --- /dev/null +++ b/sample/reports/vault_proof.json @@ -0,0 +1,66 @@ +{ + "sample_set": "public_sample", + "group": "orbital-space-atmospheric-entry", + "engine_tag": "v0.15.3", + "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1", + "tasks": 5, + "by_kind": { + "budgeted_search": 1, + "chained_design": 1, + "design_to_limit": 1, + "forensics": 2 + }, + "calibration": { + "model": "Frontier model", + "variant": "tool", + "band_is_on": "pass@1", + "pass1_min": 0.25, + "pass1_median": 0.375, + "pass1_max": 0.625, + "n_min": 8, + "n_max": 16, + "pass8_min": 1.0, + "pass8_max": 1.0 + }, + "cheat_suite": { + "vectors": [ + "binding_misnamed", + "card_request_not_run", + "copied_proof_other_task", + "edited_call_log", + "every_row_false", + "every_row_false_true_reasons", + "every_row_genuine", + "extra_argument", + "failing_given_as_passing", + "figure_plus_10_percent", + "forbidden_tool", + "harness_log_edited", + "missing_solve", + "no_harness_log", + "no_request_behind", + "nudged_figure", + "over_budget", + "proof_from_other_design", + "proof_uppercase", + "solve_handed_other_run", + "stale_engine_tag", + "stop_misnamed", + "swapped_sides" + ], + "executed_adversarial": 74, + "adversarial_above_zero": 0, + "honest_controls": 15, + "honest_controls_at_one": 15, + "not_applicable_skipped": 61, + "all_zero": true + }, + "reference": { + "scored": 5, + "reward_1": 5 + }, + "disjoint": { + "clean": true, + "tasks_with_hits": [] + } +} \ No newline at end of file diff --git a/sample/scorer/bin/sample_verifier-linux-amd64 b/sample/scorer/bin/sample_verifier-linux-amd64 new file mode 100755 index 0000000000000000000000000000000000000000..85757b7d44e07963d7afd1d3ddd881050595a26a --- /dev/null +++ b/sample/scorer/bin/sample_verifier-linux-amd64 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3c5ccfefafa16c4b757fe2924539e84477d05e80e5ac4c7a0c30e86faf8a6581 +size 8188704 diff --git a/sample/scorer/bin/sample_verifier-linux-arm64 b/sample/scorer/bin/sample_verifier-linux-arm64 new file mode 100755 index 0000000000000000000000000000000000000000..a086e8581e0a94614deb1761652b95959c92503c --- /dev/null +++ b/sample/scorer/bin/sample_verifier-linux-arm64 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0c3ad6ab30109308eaf426c83f136ed0ca1d871c072135e8444b91e90466954b +size 7788360 diff --git a/sample/scorer/bin/sample_verifier-macos-arm64 b/sample/scorer/bin/sample_verifier-macos-arm64 new file mode 100755 index 0000000000000000000000000000000000000000..2a32c7bea8fa6a89f0aff5eef448bdee7867f1cc --- /dev/null +++ b/sample/scorer/bin/sample_verifier-macos-arm64 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bd438d4ab4ca04f2234cebf03ce5ad04e6832003904ab2ac4a7fcf944234cd35 +size 7803104 diff --git a/sample/scorer/chainlib.py b/sample/scorer/chainlib.py new file mode 100644 index 0000000000000000000000000000000000000000..3c8dc60513d8f8f0372b1ff80d49884754a1d0e5 --- /dev/null +++ b/sample/scorer/chainlib.py @@ -0,0 +1,63 @@ +"""Build the solve request of a chained design from a run's answer: the history its coupling hands over. + +A coupling hands values from the run's recorded frames into the solve bit for bit: each frame's +32-bit slot widened exactly to 64 bits. The frame layout is in describe_card (frame_slots). This +module reads the slots from frame_hex with the standard library and lays the history out the way a +task states it. + + chained_solve(layout, parameters, run_request, run_answer) -> the solve's arguments, with from + +layout is the task's check.design.chain.layout: {"kind": "stardust_slab", "cool_to_s": 600.0} or +{"kind": "triga_element"}. + +Licence: Apache-2.0. +""" +import copy +import struct + + +def _slots(run_answer, f64_at, f32_at): + """Per recorded frame: the f64 at f64_at and each f32 at f32_at, widened.""" + out = [[] for _ in range(1 + len(f32_at))] + for frame in run_answer["frames"]: + raw = bytes.fromhex(frame["frame_hex"]) + out[0].append(struct.unpack(" the one input you change:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_stardust\", \"initial\": {\"radius_m\": 6495650.0, \"radial_speed_m_s\": \"\", \"transverse_speed_m_s\": 12604.2}, \"dt_s\": 0.05, \"segments\": [{\"steps\": 1420, \"load\": {}}], \"record_every\": 1420}}\n\nBudget: at most 3 calls that compute, counted over every call you make; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Both requests on your card must be among your calls.", "check": {"tool": "run_trajectory", "template": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6495650.0, "radial_speed_m_s": null, "transverse_speed_m_s": 12604.2}, "dt_s": 0.05, "segments": [{"steps": 1420, "load": {}}], "record_every": 1420}, "variable": "initial.radial_speed_m_s", "also": [], "stop": "AirSpeedOutsideCard", "relative_width": 7.5e-05, "budget": 3, "forbidden": ["find_flip", "design_run", "run_dataset", "validate_series"]}, "seed": {"kind": "g2_candidates_0.15.3", "seed": 20261029153, "note": "Stop located by halving to 1e-12 on engine v0.15.3; span set unevenly about it (seeded); search tools forbidden; budget 4 computing calls."}, "reference": {"boundary": -1959.9936173069582, "bisect_width": 1.57160684466362e-09, "holds": {"x": -1960.0377171633477, "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6495650.0, "radial_speed_m_s": -1960.0377171633477, "transverse_speed_m_s": 12604.2}, "dt_s": 0.05, "segments": [{"steps": 1420, "load": {}}], "record_every": 1420}}, "proof": "39af98b965eaa02888d1b8f06e4967c06ce8b28980ec0baa56304fdad7ef4dabfb9bf6f270d80a945a2841868301048f", "outcome": "completed", "steps_landed": 1420}, "stops": {"x": -1959.9495174505687, "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6495650.0, "radial_speed_m_s": -1959.9495174505687, "transverse_speed_m_s": 12604.2}, "dt_s": 0.05, "segments": [{"steps": 1420, "load": {}}], "record_every": 1420}}, "proof": "141a97476638dfc739c43ca3715b5a1a4378eade9969a5dbec3d702e39aeebc0697f848dd3da0947a2a03989d76d6e40", "outcome": "refused", "steps_landed": 678}, "span_pattern": "hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhsssssssssssssssssssssssssssssssssss", "span": [-2000.0, -1910.0], "engine_source": "https://github.com/johnkruze/zero-trust-physics-engine", "engine_tag": "v0.15.3", "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1", "gateway_version": "0.15.3", "engine_binary_sha256": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076"}} +{"id": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "kind": "chained_design", "models": ["aerospace/capsule_stardust", "ablator_slab"], "real_thing": "Entry of the Stardust sample return capsule on 15 January 2006, as a point mass with tabulated drag, no lift, no wind and a yearly standard atmosphere: altitude, speed through the air, Mach number, load, heat flux, and at the nose the stagnation pressure, recovery enthalpy and heat-transfer coefficient a heat shield takes, from entry interface to the drogue-deployment condition the radar recorded. Compared with NASA's reconstruction of the entry and the radar record of parachute opening: peak load 32.17 g against 32.89 g, within 0.72 g (target 3.64 g); the drogue altitude, 31.03 km, reached at 138.909 s and Mach 1.23 at 136.953 s against 137.9 s recorded, within 1.01 s (target 7.4 s). Gap: heat flux 696 W/cm2 against NASA's computed 762 to 1000; the yearly standard atmosphere in place of that morning's air is worth about 1 g of peak load either way. / A flat slab of charring heat-shield material heated on one face: wear, face temperature, depth of charring and the heat and mass accounts, for a PICA model built from the open record or the test material TACOT 3.0. Compared with 31 arc-jet tests outside the fit: wear within its target on 28 of 31 (target 25), mean \u22125.3 percent over all 31 (\u22122.6 over the 30 without the pure-nitrogen test; target within 8); hottest face within 7 percent on 24 of 28 (target 23); Stardust wear 7.58 and 3.32 mm against 5.7 and 3.2; fed by capsule_stardust through stardust_entry_to_pica_slab, nose wear 4.65 mm and face within 156 K RMS of the airborne spectra. Gap: the face runs 4.1 percent hot on average (target 3.5), and Stardust nose wear is a third high.", "task": "The Stardust sample return capsule enters the Earth's air with a radial speed of -2175.4 m/s (negative, downward) and a transverse speed of 12641.2 m/s, at a distance from the Earth's centre that you choose. Its heat shield's near-nose core is a slab of PICA, open record, version 3, 0.0434 m (43.4 mm) thick, starting at 281 K, heated by the capsule's own entry as the verifier hands it from the capsule's sealed run to the slab through their coupling, stardust_entry_to_pica_slab, radiating to surroundings at 294.4 K, and cooling with the stream off until 545 s.\n\nFind the largest starting distance from the Earth's centre, from 6482000 to 6494000 m, for which every constraint below holds. Give the passing design and the first failing design, no more than 12 m apart, and name the constraint that binds. The design that holds need not lie at either end of the range.\n\nConstraints (id (the request it is read from): what, limit):\n- half_char (solve): the depth at which the slab's density is half-way from char to virgin, in metres, at or below 0.0089922 m (8.9922 mm)\n- peak_load (run): the peak load on the capsule, in Earth g, over the whole entry, at or below 52.33 g\nEach design is two requests. The run of the capsule must end at the drogue-deployment condition (outcome ended, PastFlightDeployment). The run:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_stardust\", \"initial\": {\"radius_m\": \"\", \"radial_speed_m_s\": -2175.4, \"transverse_speed_m_s\": 12641.2}, \"dt_s\": 0.03125, \"segments\": [{\"steps\": \"\", \"load\": {}}], \"record_every\": 720}}\nThen the slab, a solve handed that run through the coupling, with these parameters:\n{\"tool\": \"solve\", \"arguments\": {\"solver\": \"ablator_slab\", \"parameters\": {\"material\": \"PICA, open record, version 3\", \"thickness_m\": 0.0434, \"start_temperature_k\": 281.0, \"face\": \"gas_stream\", \"stream_gas\": \"air\", \"surroundings_temperature_k\": 294.4, \"face_wears\": true}, \"from\": {\"request\": \"\", \"run_seal\": \"\", \"coupling\": \"stardust_entry_to_pica_slab\"}}}\nand its heating history laid out as the coupling's worked chain lays it: row 0 at 0 s with the first frame's pressure and enthalpy and a heat-transfer coefficient of 0; then one row per recorded frame, handed bit for bit (time, stagnation pressure, heat-transfer coefficient, recovery enthalpy); then a row 1 s after the last frame and a row at 545 s, each with the last frame's pressure and enthalpy and a heat-transfer coefficient of 0; a radiative heating of 0 in every row. thermocouple_depths_m and the return_ flags are yours to set. The run's record_every of 720 is the frames the coupling hands: keep it.\nThe run reports the largest and smallest of a quantity over all its steps when it is sent with \"readout\": {\"quantities\": [\"load_g\"]}; a readout is not part of the request or its seal, so the same run with or without one has one seal.\n\nBudget: at most 10 calls that compute, counted over every call you make, each run and each solve one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.", "check": {"design": {"variable": {"kind": "path", "on": "run", "path": "initial.radius_m", "words": "the capsule's distance from the Earth's centre at the start, in metres"}, "template": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": null, "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": 8000, "load": {}}], "record_every": 720}, "free": ["segments[0].steps"], "most_steps": 8000, "run_outcomes": ["ended"], "direction": "largest", "tolerance": 12.0, "units": "m", "range": [6482000.0, 6494000.0], "chain": {"solver": "ablator_slab", "coupling": "stardust_entry_to_pica_slab", "parameters": {"material": "PICA, open record, version 3", "thickness_m": 0.0434, "start_temperature_k": 281.0, "face": "gas_stream", "stream_gas": "air", "surroundings_temperature_k": 294.4, "face_wears": true, "thermocouple_depths_m": [], "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false}, "handed": ["history_time_s", "history_pressure_pa", "history_heat_transfer_coefficient_kg_per_m2_s", "history_flow_enthalpy_j_per_kg", "history_radiative_heating_w_per_m2", "thermocouple_depths_m", "return_face_history", "return_thermocouple_histories", "return_final_profile"], "layout": {"kind": "stardust_slab", "cool_to_s": 545.0}}}, "constraints": [{"id": "half_char", "on": "solve", "read": {"kind": "result", "quantity": "depth_half_way_to_virgin_m"}, "op": "<=", "words": "the depth at which the slab's density is half-way from char to virgin, in metres", "unit": "m", "limit": 0.0089922}, {"id": "peak_load", "on": "run", "read": {"kind": "extreme", "quantity": "load_g", "which": "maximum"}, "op": "<=", "words": "the peak load on the capsule, in Earth g, over the whole entry", "unit": "g", "limit": 52.33}], "budget": 10, "forbidden": ["find_flip", "design_run", "run_dataset", "validate_series"]}, "seed": {"kind": "g2_round7_0.15.3", "seed": 20261102055, "from": "g2-chain-sd-slab-radius-halfchar-h-r5", "note": "Rebuilt from g2-chain-sd-slab-radius-halfchar-h-r5 (0/3 on the calibrating model in round 5 at budget 8) with +1 reading (+2 computing calls -> budget 10); tolerance, template, constraints and engine v0.15.3 reference unchanged."}, "reference": {"boundary": 6488833.180236816, "binding": "half_char", "window_pattern": "..............HHHHHHHHH..................", "band": [6486200.0, 6488600.0], "near_pattern": "HHHHHHHHHHH..........", "passing": {"x": 6488829.580236817, "values": {"half_char": 0.008992161781351305, "peak_load": 49.5781877582101}, "run": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488829.580236817, "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": 8000, "load": {}}], "record_every": 720}, "run_seal": "1fa78aec5d3e09d24456d17b17ae3d5cbe4ad1d98f7f613fe5e80c1b855d017e435fb45dc30ed730eef198f5590ec173", "solve": {"solver": "ablator_slab", "parameters": {"material": "PICA, open record, version 3", "thickness_m": 0.0434, "start_temperature_k": 281.0, "face": "gas_stream", "stream_gas": "air", "surroundings_temperature_k": 294.4, "face_wears": true, "thermocouple_depths_m": [], "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false, "history_time_s": [0.0, 22.5, 45.0, 67.5, 90.0, 93.6875, 94.6875, 545.0], "history_pressure_pa": [5909.919921875, 5909.919921875, 42409.2421875, 6625.830078125, 2544.8134765625, 2450.75341796875, 2450.75341796875, 2450.75341796875], "history_heat_transfer_coefficient_kg_per_m2_s": [0.0, 0.058212701231241226, 0.1558331996202469, 0.06065985932946205, 0.03434406593441963, 0.03284108266234398, 0.0, 0.0], "history_flow_enthalpy_j_per_kg": [75923648.0, 75923648.0, 12139213.0, 541897.6875, 80255.8046875, 64982.50390625, 64982.50390625, 64982.50390625], "history_radiative_heating_w_per_m2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}, "from": {"request": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488829.580236817, "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": 8000, "load": {}}], "record_every": 720}, "run_seal": "1fa78aec5d3e09d24456d17b17ae3d5cbe4ad1d98f7f613fe5e80c1b855d017e435fb45dc30ed730eef198f5590ec173", "coupling": "stardust_entry_to_pica_slab"}}, "solution_seal": "8944591b390b2d9995dcb1a1be61b04f621892856ef97dcd58537f920d66d2e9ee56d3d8adb8c2adae41ed224478f86c", "next": null, "next_seal": null}, "failing": {"x": 6488836.780236816, "values": {"half_char": 0.00899223837130888, "peak_load": 49.57632648317198}, "run": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488836.780236816, "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": 8000, "load": {}}], "record_every": 720}, "run_seal": "abce34b40ba1868cb29f0015f8de509f678546c4dfaad17ae251df0486469b4bdac80244df56c2071b13c31c4db6d6db", "solve": {"solver": "ablator_slab", "parameters": {"material": "PICA, open record, version 3", "thickness_m": 0.0434, "start_temperature_k": 281.0, "face": "gas_stream", "stream_gas": "air", "surroundings_temperature_k": 294.4, "face_wears": true, "thermocouple_depths_m": [], "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false, "history_time_s": [0.0, 22.5, 45.0, 67.5, 90.0, 93.6875, 94.6875, 545.0], "history_pressure_pa": [5903.89697265625, 5903.89697265625, 42420.40234375, 6628.06396484375, 2545.021240234375, 2450.830078125, 2450.830078125, 2450.830078125], "history_heat_transfer_coefficient_kg_per_m2_s": [0.0, 0.05818302929401398, 0.15585379302501678, 0.0606706440448761, 0.03434683755040169, 0.032843057066202164, 0.0, 0.0], "history_flow_enthalpy_j_per_kg": [75926248.0, 75926248.0, 12148022.0, 542217.125, 80285.0625, 65003.5703125, 65003.5703125, 65003.5703125], "history_radiative_heating_w_per_m2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}, "from": {"request": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488836.780236816, "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": 8000, "load": {}}], "record_every": 720}, "run_seal": "abce34b40ba1868cb29f0015f8de509f678546c4dfaad17ae251df0486469b4bdac80244df56c2071b13c31c4db6d6db", "coupling": "stardust_entry_to_pica_slab"}}, "solution_seal": "705c1b2d8ec16c133318905bc8e1d23ea9ab535153210729aec9c9942e18eaa2b52ace04dc2874d53b055d722fbcad6d", "next": null, "next_seal": null, "outcome": "ended", "stopped": null, "steps_landed": 2998}, "engine_source": "https://github.com/johnkruze/zero-trust-physics-engine", "engine_tag": "v0.15.3", "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1", "gateway_version": "0.15.3", "engine_binary_sha256": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076"}} +{"id": "g2-sd-slab-shallowest-char-load-v3", "family": "tradeoff", "kind": "design_to_limit", "models": ["aerospace/capsule_stardust", "ablator_slab"], "real_thing": "Entry of the Stardust sample return capsule on 15 January 2006, as a point mass with tabulated drag, no lift, no wind and a yearly standard atmosphere: altitude, speed through the air, Mach number, load, heat flux, and at the nose the stagnation pressure, recovery enthalpy and heat-transfer coefficient a heat shield takes, from entry interface to the drogue-deployment condition the radar recorded. Compared with NASA's reconstruction of the entry and the radar record of parachute opening: peak load 32.17 g against 32.89 g, within 0.72 g (target 3.64 g); the drogue altitude, 31.03 km, reached at 138.909 s and Mach 1.23 at 136.953 s against 137.9 s recorded, within 1.01 s (target 7.4 s). Gap: heat flux 696 W/cm2 against NASA's computed 762 to 1000; the yearly standard atmosphere in place of that morning's air is worth about 1 g of peak load either way. / A flat slab of charring heat-shield material heated on one face: wear, face temperature, depth of charring and the heat and mass accounts, for a PICA model built from the open record or the test material TACOT 3.0. Compared with 31 arc-jet tests outside the fit: wear within its target on 28 of 31 (target 25), mean \u22125.3 percent over all 31 (\u22122.6 over the 30 without the pure-nitrogen test; target within 8); hottest face within 7 percent on 24 of 28 (target 23); Stardust wear 7.58 and 3.32 mm against 5.7 and 3.2; fed by capsule_stardust through stardust_entry_to_pica_slab, nose wear 4.65 mm and face within 156 K RMS of the airborne spectra. Gap: the face runs 4.1 percent hot on average (target 3.5), and Stardust nose wear is a third high.", "task": "The Stardust sample return capsule enters the Earth's air at 6501730 m from the Earth's centre, at 12837.7 m/s, at a flight-path angle below the horizontal that you choose. Its heat shield's near-nose core is a slab of PICA, open record, version 3, 59.4 mm thick, starting at 263.6 K, heated by the capsule's own entry as the verifier hands it from the capsule's sealed run to the slab through their coupling, stardust_entry_to_pica_slab, radiating to surroundings at 265.4 K, and cooling with the stream off until 580 s.\n\nFind the shallowest entry, from 8.58 to 9.28 degrees below the horizontal, for which every constraint below holds. Give the passing design and the first failing design, no more than 0.012 degrees of flight-path angle apart, and name the constraint that binds.\n\nConstraints (id, what, limit):\n- char_depth, the depth at which the slab's material is back within 2 percent of virgin density, in metres: at or below 0.016987 m (16.987 mm)\n- peak_load, the peak load on the capsule, in Earth g, over the whole entry: at or below 40.48 g\nEach design is two requests. The run of the capsule must end at the drogue-deployment condition (outcome ended, PastFlightDeployment). The run:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_stardust\", \"initial\": {\"radius_m\": 6501730.0, \"radial_speed_m_s\": \"-V sin(angle)\", \"transverse_speed_m_s\": \"V cos(angle)\"}, \"dt_s\": 0.03125, \"segments\": [{\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": \"\", \"load\": {}}], \"record_every\": 720}}\nwith V = 12837.7 m/s and the angle in degrees below the horizontal.\nThen the slab, a solve handed that run through the coupling, with these parameters:\n{\"tool\": \"solve\", \"arguments\": {\"solver\": \"ablator_slab\", \"parameters\": {\"material\": \"PICA, open record, version 3\", \"thickness_m\": 0.0594, \"start_temperature_k\": 263.6, \"face\": \"gas_stream\", \"stream_gas\": \"air\", \"surroundings_temperature_k\": 265.4, \"face_wears\": true}, \"from\": {\"request\": \"\", \"run_seal\": \"\", \"coupling\": \"stardust_entry_to_pica_slab\"}}}\nand its heating history laid out as the coupling's worked chain lays it: row 0 at 0 s with the first frame's pressure and enthalpy and a heat-transfer coefficient of 0; then one row per recorded frame, handed bit for bit (time, stagnation pressure, heat-transfer coefficient, recovery enthalpy); then a row 1 s after the last frame and a row at 580 s, each with the last frame's pressure and enthalpy and a heat-transfer coefficient of 0; a radiative heating of 0 in every row. thermocouple_depths_m and the return_ flags are yours to set.\n\nBudget: at most 8 calls that compute, counted over every call you make, each run and each solve one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.", "check": {"design": {"variable": {"kind": "entry_angle_deg", "speed_m_s": 12837.7, "words": "the flight-path angle below the horizontal at entry interface, in degrees, from radial_speed_m_s = -V sin(angle) and transverse_speed_m_s = V cos(angle)"}, "template": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6501730.0, "radial_speed_m_s": null, "transverse_speed_m_s": null}, "dt_s": 0.03125, "segments": [{"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 3840, "load": {}}], "record_every": 720}, "free": ["segments[12].steps"], "most_steps": 8000, "run_outcomes": ["ended"], "direction": "smallest", "tolerance": 0.012, "units": "degrees", "chain": {"solver": "ablator_slab", "coupling": "stardust_entry_to_pica_slab", "parameters": {"material": "PICA, open record, version 3", "thickness_m": 0.0594, "start_temperature_k": 263.6, "face": "gas_stream", "stream_gas": "air", "surroundings_temperature_k": 265.4, "face_wears": true, "thermocouple_depths_m": [], "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false}, "handed": ["history_time_s", "history_pressure_pa", "history_heat_transfer_coefficient_kg_per_m2_s", "history_flow_enthalpy_j_per_kg", "history_radiative_heating_w_per_m2", "thermocouple_depths_m", "return_face_history", "return_thermocouple_histories", "return_final_profile"], "layout": {"kind": "stardust_slab", "cool_to_s": 580.0}}, "range": [8.58, 9.28]}, "constraints": [{"id": "char_depth", "on": "solve", "read": {"kind": "result", "quantity": "depth_within_2_percent_of_virgin_m"}, "op": "<=", "words": "the depth at which the slab's material is back within 2 percent of virgin density, in metres", "unit": "m", "limit": 0.016987, "target_x_used": 8.824635449179675}, {"id": "peak_load", "on": "run", "read": {"kind": "extreme", "quantity": "load_g", "which": "maximum"}, "op": "<=", "words": "the peak load on the capsule, in Earth g, over the whole entry", "unit": "g", "limit": 40.48, "target_x_used": 9.08303671247125}], "budget": 8, "forbidden": ["find_flip", "design_run", "run_dataset", "validate_series"]}, "seed": {"kind": "g2_candidates_0.15.3", "seed": 20261029153, "note": "Limits set at chosen designs moved off round values by a seeded jitter; window sampled and boundary bisected on engine v0.15.3."}, "reference": {"boundary": 8.824626247286798, "binding": "char_depth", "window_pattern": ".......HHHHHHHH......", "constraint_patterns": {"char_depth": "-------++++++++++++++", "peak_load": "+++++++++++++++------"}, "band": [8.825, 9.07], "near_pattern": "...........HHHHHHHHHH", "limit_targets": {"char_depth": 8.824635449179675, "peak_load": 9.08303671247125}, "passing": {"x": 8.828226247286798, "values": {"char_depth": 0.016982147487637513, "peak_load": 38.260676882045026}, "run": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6501730.0, "radial_speed_m_s": -1970.2359604673798, "transverse_speed_m_s": 12685.610412986882}, "dt_s": 0.03125, "segments": [{"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 3840, "load": {}}], "record_every": 720}, "run_seal": "1180c5d72b6e89bdca7e236309a6a02084ef35fc1663655df36503ad31d467defab0a098606418ed15558cb5ed128706", "solve": {"solver": "ablator_slab", "parameters": {"material": "PICA, open record, version 3", "thickness_m": 0.0594, "start_temperature_k": 263.6, "face": "gas_stream", "stream_gas": "air", "surroundings_temperature_k": 265.4, "face_wears": true, "thermocouple_depths_m": [], "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false, "history_time_s": [0.0, 22.5, 45.0, 67.5, 90.0, 112.5, 121.9375, 122.9375, 580.0], "history_pressure_pa": [339.1914367675781, 339.1914367675781, 29965.41796875, 22537.322265625, 5747.75341796875, 2572.19921875, 2390.386474609375, 2390.386474609375, 2390.386474609375], "history_heat_transfer_coefficient_kg_per_m2_s": [0.0, 0.013946173712611198, 0.1310727745294571, 0.11351476609706879, 0.05656934529542923, 0.03541867434978485, 0.0322762057185173, 0.0, 0.0], "history_flow_enthalpy_j_per_kg": [78225696.0, 78225696.0, 56615752.0, 6155888.0, 598724.5625, 105872.484375, 62793.7109375, 62793.7109375, 62793.7109375], "history_radiative_heating_w_per_m2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}, "from": {"request": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6501730.0, "radial_speed_m_s": -1970.2359604673798, "transverse_speed_m_s": 12685.610412986882}, "dt_s": 0.03125, "segments": [{"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 3840, "load": {}}], "record_every": 720}, "run_seal": "1180c5d72b6e89bdca7e236309a6a02084ef35fc1663655df36503ad31d467defab0a098606418ed15558cb5ed128706", "coupling": "stardust_entry_to_pica_slab"}}, "solution_seal": "7aa9ce40f8bb099404c82343f0377e89de1f19aea553c4709de138de973e4d9181a4be80d2624dba752ed9c65551eb8a", "next": null, "next_seal": null}, "failing": {"x": 8.821026247286797, "values": {"char_depth": 0.01699148280192865, "peak_load": 38.197177740146515}, "run": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6501730.0, "radial_speed_m_s": -1968.6418240960256, "transverse_speed_m_s": 12685.857899977434}, "dt_s": 0.03125, "segments": [{"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 3840, "load": {}}], "record_every": 720}, "run_seal": "ef36a611bb78025f867b14eec165d49d00fbc219ae5d2354c223260eee883e27d74314ced1e6b2d8b825e8c8e058a03c", "solve": {"solver": "ablator_slab", "parameters": {"material": "PICA, open record, version 3", "thickness_m": 0.0594, "start_temperature_k": 263.6, "face": "gas_stream", "stream_gas": "air", "surroundings_temperature_k": 265.4, "face_wears": true, "thermocouple_depths_m": [], "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false, "history_time_s": [0.0, 22.5, 45.0, 67.5, 90.0, 112.5, 122.09375, 123.09375, 580.0], "history_pressure_pa": [337.00457763671875, 337.00457763671875, 29798.859375, 22617.865234375, 5777.23681640625, 2577.45849609375, 2390.31005859375, 2390.31005859375, 2390.31005859375], "history_heat_transfer_coefficient_kg_per_m2_s": [0.0, 0.01390114426612854, 0.13070805370807648, 0.11371913552284241, 0.056723203510046005, 0.0354800745844841, 0.03227389603853226, 0.0, 0.0], "history_flow_enthalpy_j_per_kg": [78226040.0, 78226040.0, 56752312.0, 6219895.5, 605393.0, 106824.0078125, 62769.21484375, 62769.21484375, 62769.21484375], "history_radiative_heating_w_per_m2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}, "from": {"request": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6501730.0, "radial_speed_m_s": -1968.6418240960256, "transverse_speed_m_s": 12685.857899977434}, "dt_s": 0.03125, "segments": [{"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 240, "load": {}}, {"steps": 3840, "load": {}}], "record_every": 720}, "run_seal": "ef36a611bb78025f867b14eec165d49d00fbc219ae5d2354c223260eee883e27d74314ced1e6b2d8b825e8c8e058a03c", "coupling": "stardust_entry_to_pica_slab"}}, "solution_seal": "1208b2ff940f3ba9fc67ac83b53d7c47fa4bf633d61f2fdb02023736aceb6e6016176cf106b054a2e2c5d352fe85bc8e", "next": null, "next_seal": null, "outcome": "ended", "stopped": null, "steps_landed": 3907}, "engine_source": "https://github.com/johnkruze/zero-trust-physics-engine", "engine_tag": "v0.15.3", "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1", "gateway_version": "0.15.3", "engine_binary_sha256": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076"}} +{"id": "g2-forensics7-10", "family": "forensics", "kind": "forensics", "models": ["ablator_slab", "aerospace/capsule_insight", "aerospace/capsule_stardust", "aerospace/crater_ryugu_sci", "aerospace/momentum_jwst_dihedral", "aerospace/momentum_jwst_srp", "aerospace/satellite_lageos1", "aerospace/solar_system", "plasma_sheath_ram_c2"], "real_thing": "Ten answers of the verifier over 9 models of entry, orbit and space.", "task": "A report hands you ten claims about answers of the verifier. Each row gives the model, the request as it was sent, what its answer is claimed to say and the proof claimed for it. claim.outcome and claim.stop are the run's outcome and the name of its stop or declared end (null when it completed); claim.steps_landed is the last step the run is sealed to; claim.quantity and claim.value are one number of the final state of a run (of the result, for a solve); claim.flags are the advisory flags the run carried, each with the quantity it is on, its extent at the largest (extent) and the number of steps it was raised on (steps).\nSome rows are false. A false row may be wrong in more than one way; its reason is the first of these, in this order, that is true of it:\n1. retired_model: the request names a model ID the verifier does not serve (one it no longer serves, or a name it never served).\n2. parent_wrong: the request continues a run (from) that is not the parent it names: its start state, or the seal it gives for its parent, belongs to another run, and the verifier refuses the continuation.\n3. seal_wrong: the proof is not the seal of this request.\n4. stop_hidden: the run stops part way and the claim says it completed.\n5. step_wrong: the claim names the run's stop, but not the last step the run is sealed to.\n6. flag_omitted: the run carries an advisory flag (a name on a quantity) that the claim leaves out altogether.\n7. flag_altered: the flags the claim lists are not the run's, entry for entry: an extent or a count of steps differs, or an entry is missing or added where its name on that quantity is listed too (the verifier may list one flag on one quantity more than once, each with its own extent).\n8. value_altered: the claimed value is not the one the request gives, to the last digit.\nA row that is none of these is genuine, whatever else differs in how it is written (the order of its flags, a readout sent with the request, the spelling of a number). Name every false row with its reason.\nThe rows, one a line:\n{\"row\": \"R1\", \"model\": \"aerospace/solar_system\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"solar_system\", \"initial\": {\"sun_position_m\": [-863637229.4106485, -588455255.8381735, -225852694.17788354], \"sun_velocity_m_s\": [12.397135730588673, -8.676658356669796, -4.0448914054830265], \"mercury_position_m\": [30544984580.541214, 31538497612.618702, 13677667513.450943], \"mercury_velocity_m_s\": [-45893.79576346148, 28907.37310381068, 20202.882077964397], \"venus_position_m\": [-106439655769.27072, 15156574441.51891, 13539171068.575262], \"venus_velocity_m_s\": [-6662.526312895438, -31691.929801737846, -13835.48559151052], \"earth_position_m\": [102407858815.46872, -102611923461.79506, -44458723871.361084], \"earth_velocity_m_s\": [21351.990015305262, 18497.83118201897, 8019.230891774351], \"moon_position_m\": [102047097668.78308, -102736187163.71382, -44474590914.85404], \"moon_velocity_m_s\": [21609.833460848902, 17579.38315631339, 7638.85449892693], \"mars_position_m\": [-108034816249.35658, 196931821387.40118, 93267362532.8832], \"mars_velocity_m_s\": [-20818.954980749113, -8043.795945699443, -3126.300559642824], \"jupiter_position_m\": [419113155659.17053, 572916852927.5242, 235366142766.89377], \"jupiter_velocity_m_s\": [-10981.451664109512, 7203.166125214057, 3354.981129871713], \"saturn_position_m\": [810247233830.7081, 1028692408157.641, 390011764585.78156], \"saturn_velocity_m_s\": [-8280.517996609125, 5149.719611471784, 2483.289801876904], \"uranus_position_m\": [2242902225084.655, -1790169184837.4873, -815772837485.7194], \"uranus_velocity_m_s\": [4440.090766223361, 4422.709890451177, 1874.2294942165538], \"neptune_position_m\": [2597044231109.891, -3383482727434.8364, -1449535655907.9255], \"neptune_velocity_m_s\": [4405.7539005103245, 2969.8264977576428, 1105.8807943842667], \"ceres_position_m\": [-322236661229.9761, -227977183777.5967, -41837637472.4793], \"ceres_velocity_m_s\": [9380.707730841985, -13838.379917110064, -8421.170529908282], \"pallas_position_m\": [-351293366602.40656, -24289147273.497444, 28702819004.877907], \"pallas_velocity_m_s\": [-1948.7381903754856, -20307.781285208814, 4156.606512462996], \"vesta_position_m\": [166331403121.10275, -256906652758.2719, -124134856049.41298], \"vesta_velocity_m_s\": [18295.602252098583, 9577.160570429965, 1423.2851008847358], \"energy_anchor\": -1.321940998513625e+25, \"booked_work\": 0.0, \"angular_momentum_anchor\": [5.490282510087069e+31, -8.153754585822945e+32, 1.9244191261307657e+33], \"booked_torque\": [0.0, 0.0, 0.0]}, \"dt_s\": 1677.0, \"segments\": [{\"steps\": 9, \"load\": {}}, {\"steps\": 10, \"load\": {}}, {\"steps\": 11, \"load\": {}}, {\"steps\": 12, \"load\": {}}, {\"steps\": 13, \"load\": {}}, {\"steps\": 14, \"load\": {}}, {\"steps\": 15, \"load\": {}}], \"record_every\": 84, \"readout\": {\"quantities\": [\"earth_mars_distance_m\"]}}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 84, \"quantity\": \"earth_mars_distance_m\", \"value\": 390895599447.7874, \"flags\": []}, \"proof\": \"0cc96b6596b63629b419c167374ae7ab4a2b01eea6b41026478ecd3e3e3519f0257c279d9ee2b73cf297642b476eecb4\"}\n{\"row\": \"R2\", \"model\": \"aerospace/capsule_insight\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_insight\", \"initial\": {\"radius_m\": 3519545.0, \"radial_speed_m_s\": -1340.4281, \"transverse_speed_m_s\": 5819.933}, \"dt_s\": 0.1, \"segments\": [{\"steps\": 2195, \"load\": {\"lift_over_drag\": 0.0}}], \"record_every\": 2195}}, \"claim\": {\"outcome\": \"ended\", \"stop\": \"PastFlightDeployment\", \"steps_landed\": 1975, \"quantity\": \"mach\", \"value\": 1.414380813182044, \"flags\": []}, \"proof\": \"caf9fef4f3cfb1be4d6d1234fb1484c1525d788b0f09706c6f48f9d4be552533f0c55af43f8dda1ae3d7869b6a3f82c5\"}\n{\"row\": \"R3\", \"model\": \"aerospace/crater_ryugu_sci\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"crater_ryugu_sci\", \"initial\": {\"radius_m\": 3.395}, \"dt_s\": 0.163, \"segments\": [{\"steps\": 201, \"load\": {}}, {\"steps\": 222, \"load\": {}}, {\"steps\": 243, \"load\": {}}], \"record_every\": 666}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 666, \"quantity\": \"radius_m\", \"value\": 6.8729656389716265, \"flags\": []}, \"proof\": \"6d6b45da8cf15848762712a1d05b1b8f3b1b9d6303f2c0162e30dfa6d44ec950766e5b6bf074c739440ff306f1889a0a\"}\n{\"row\": \"R4\", \"model\": \"aerospace/capsule_stardust\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_stardust\", \"initial\": {\"radius_m\": 6488061.0, \"radial_speed_m_s\": -2105.71, \"transverse_speed_m_s\": 12576.74}, \"dt_s\": 0.05, \"segments\": [{\"steps\": 3193, \"load\": {}}], \"record_every\": 3193, \"readout\": {\"quantities\": [\"altitude_m\"]}}}, \"claim\": {\"outcome\": \"ended\", \"stop\": \"PastFlightDeployment\", \"steps_landed\": 1929, \"quantity\": \"altitude_m\", \"value\": 31025.876497731544, \"flags\": [{\"flag\": \"FLAG_DROGUE_MACH_WINDOW\", \"quantity\": \"mach\", \"extent\": 0.39864147264033933, \"steps\": 190}, {\"flag\": \"FLAG_DROGUE_MACH_WINDOW\", \"quantity\": \"mach\", \"extent\": 0.39990473030213836, \"steps\": 190}, {\"flag\": \"FLAG_MACH_TABLE_HELD\", \"quantity\": \"mach\", \"extent\": 0.02429835996056795, \"steps\": 2}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"air_speed_m_s\", \"extent\": 155.89247760455874, \"steps\": 484}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"air_speed_m_s\", \"extent\": 1697.5036915755654, \"steps\": 1243}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"path_sine\", \"extent\": 0.048142951009741516, \"steps\": 1005}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"path_sine\", \"extent\": 0.06286079576874015, \"steps\": 851}]}, \"proof\": \"fa2be55cda475420e0f90829833bea259ff32039b96724066963ad9de7ee75937d6f50458965183ad3962d5197a6062b\"}\n{\"row\": \"R5\", \"model\": \"plasma_sheath_ram_c2\", \"request\": {\"tool\": \"solve\", \"arguments\": {\"solver\": \"plasma_sheath_ram_c2\", \"parameters\": {\"altitude_m\": 55180.0, \"velocity_m_s\": 6896.0, \"signal_frequency_hz\": 4157000000.0}}}, \"claim\": {\"outcome\": \"converged\", \"stop\": null, \"steps_landed\": null, \"quantity\": \"stagnation_temperature_k\", \"value\": 6383.526355576421, \"flags\": []}, \"proof\": \"70b0239e697034b92172ce494691215f79d0c4a56078257a3e624b2ee111ef7e94ef97df0177ac97270ec674bda20422\"}\n{\"row\": \"R6\", \"model\": \"ablator_slab\", \"request\": {\"tool\": \"solve\", \"arguments\": {\"solver\": \"ablator_slab\", \"parameters\": {\"material\": \"PICA, open record, version 5\", \"thickness_m\": 0.04845, \"start_temperature_k\": 308.75, \"thermocouple_depths_m\": [], \"face\": \"held_temperature\", \"held_temperature_k\": 1976.0, \"hold_duration_s\": 63.85, \"continue_after_s\": 43.15, \"return_face_history\": false, \"return_thermocouple_histories\": false, \"return_final_profile\": false}}}, \"claim\": {\"outcome\": \"converged\", \"stop\": null, \"steps_landed\": null, \"quantity\": \"depth_within_2_percent_of_virgin_m\", \"value\": 0.014116399858056352, \"flags\": []}, \"proof\": \"96e1a407a5dcf744722373aa7715f472762d5816c796d3073ee9f8970fc1ce3ed5bb10c6cc151e88ee32c13bc1cb681b\"}\n{\"row\": \"R7\", \"model\": \"aerospace/momentum_jwst_dihedral\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_dihedral\", \"initial\": {\"h_eci_nms\": [-1.429, 1.053, -1.498]}, \"dt_s\": 1910.0, \"segments\": [{\"steps\": 49, \"load\": {\"q1\": 0.638559, \"q2\": -0.019, \"q3\": -0.652891, \"q4\": 0.406959, \"sun_x\": 0.616092, \"sun_y\": 0.703148, \"sun_z\": 0.354984, \"sun_distance_au\": 1.01415}}, {\"steps\": 45, \"load\": {\"q1\": 0.748856, \"q2\": -0.003607, \"q3\": -0.560934, \"q4\": 0.352923, \"sun_x\": 0.674752, \"sun_y\": 0.668222, \"sun_z\": 0.313352, \"sun_distance_au\": 1.01415}}], \"record_every\": 94, \"readout\": {\"quantities\": [\"h_magnitude_nms\"]}}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 94, \"quantity\": \"h_magnitude_nms\", \"value\": 5.002332004564212, \"flags\": []}, \"proof\": \"a93f9cd7a27d8851a5b9c4996bfa3d1f7c1c31622907a4c743501d5727ba57a8d39f657eca88e8928d1a19ee417ca01d\"}\n{\"row\": \"R8\", \"model\": \"aerospace/momentum_jwst_srp\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_srp\", \"initial\": {\"h_eci_nms\": [0.918, -1.255, 0.815]}, \"dt_s\": 874.0, \"segments\": [{\"steps\": 44, \"load\": {\"q1\": 0.685819, \"q2\": 0.011638, \"q3\": -0.603055, \"q4\": 0.407236, \"sun_x\": 0.616092, \"sun_y\": 0.713107, \"sun_z\": 0.334528, \"sun_distance_au\": 1.01161}}, {\"steps\": 32, \"load\": {\"q1\": 0.659909, \"q2\": -0.005461, \"q3\": -0.631303, \"q4\": 0.407365, \"sun_x\": 0.634305, \"sun_y\": 0.70673, \"sun_z\": 0.313352, \"sun_distance_au\": 0.1851}}], \"record_every\": 76}}, \"claim\": {\"outcome\": \"refused\", \"stop\": \"SunshieldAboveKaptonLimit\", \"steps_landed\": 118, \"quantity\": \"h_magnitude_nms\", \"value\": 1.6088350681235042, \"flags\": []}, \"proof\": \"2802624f097f31c406fcd6c90107e0c92b0856ada8ab7aefd2a74b0db13c863229e6ac88939c9df175a48db8856bbc9d\"}\n{\"row\": \"R9\", \"model\": \"aerospace/satellite_lageos1_twin\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"satellite_lageos1_twin\", \"initial\": {\"epoch_utc_s\": 844432990.0, \"forecast_elapsed_s\": 0.0, \"position_m\": [-5947439.326, 2555567.396, 10470793.788], \"velocity_m_s\": [4754.057, 2345.016, 2292.947]}, \"dt_s\": 10.0, \"segments\": [{\"steps\": 1614, \"load\": {}}], \"record_every\": 1614}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 1614, \"quantity\": \"semi_major_axis_m\", \"value\": 11400874.582902145, \"flags\": [{\"flag\": \"FLAG_BELOW_COMPARED_RADIUS\", \"quantity\": \"radius_m\", \"extent\": 1559062.143708026, \"steps\": 994}, {\"flag\": \"FLAG_EARTH_SHADOW\", \"quantity\": \"distance_from_shadow_axis_m\", \"extent\": 1409415.657917643, \"steps\": 183}]}, \"proof\": \"760e36d0a9c7ce7d7bc1e45f15334a31f23e242ce276c2b84454dfdcf21ca745576a3557773a024e0d7bedcd90133779\"}\n{\"row\": \"R10\", \"model\": \"aerospace/crater_ryugu_sci\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"crater_ryugu_sci\", \"initial\": {\"radius_m\": 1.25}, \"dt_s\": 0.1285, \"segments\": [{\"steps\": 210, \"load\": {}}, {\"steps\": 231, \"load\": {}}, {\"steps\": 252, \"load\": {}}, {\"steps\": 273, \"load\": {}}, {\"steps\": 294, \"load\": {}}, {\"steps\": 315, \"load\": {}}], \"record_every\": 1575}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 1575, \"quantity\": \"radius_m\", \"value\": 7.823494707379572, \"flags\": []}, \"proof\": \"e6950ae5d4f4d0953321d1013624d3ce599b23249db4d6075c705be83c6b66f37cbf9a67bb109ddbf36bd7003945bd86\"}\n\nBudget: at most 4 calls that compute, counted over every call you make (every run_trajectory, solve, compute_step and verify_ call counts, refused or not); list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all.", "check": {"rows": [{"row": "R1", "model": "aerospace/solar_system", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "solar_system", "initial": {"sun_position_m": [-863637229.4106485, -588455255.8381735, -225852694.17788354], "sun_velocity_m_s": [12.397135730588673, -8.676658356669796, -4.0448914054830265], "mercury_position_m": [30544984580.541214, 31538497612.618702, 13677667513.450943], "mercury_velocity_m_s": [-45893.79576346148, 28907.37310381068, 20202.882077964397], "venus_position_m": [-106439655769.27072, 15156574441.51891, 13539171068.575262], "venus_velocity_m_s": [-6662.526312895438, -31691.929801737846, -13835.48559151052], "earth_position_m": [102407858815.46872, -102611923461.79506, -44458723871.361084], "earth_velocity_m_s": [21351.990015305262, 18497.83118201897, 8019.230891774351], "moon_position_m": [102047097668.78308, -102736187163.71382, -44474590914.85404], "moon_velocity_m_s": [21609.833460848902, 17579.38315631339, 7638.85449892693], "mars_position_m": [-108034816249.35658, 196931821387.40118, 93267362532.8832], "mars_velocity_m_s": [-20818.954980749113, -8043.795945699443, -3126.300559642824], "jupiter_position_m": [419113155659.17053, 572916852927.5242, 235366142766.89377], "jupiter_velocity_m_s": [-10981.451664109512, 7203.166125214057, 3354.981129871713], "saturn_position_m": [810247233830.7081, 1028692408157.641, 390011764585.78156], "saturn_velocity_m_s": [-8280.517996609125, 5149.719611471784, 2483.289801876904], "uranus_position_m": [2242902225084.655, -1790169184837.4873, -815772837485.7194], "uranus_velocity_m_s": [4440.090766223361, 4422.709890451177, 1874.2294942165538], "neptune_position_m": [2597044231109.891, -3383482727434.8364, -1449535655907.9255], "neptune_velocity_m_s": [4405.7539005103245, 2969.8264977576428, 1105.8807943842667], "ceres_position_m": [-322236661229.9761, -227977183777.5967, -41837637472.4793], "ceres_velocity_m_s": [9380.707730841985, -13838.379917110064, -8421.170529908282], "pallas_position_m": [-351293366602.40656, -24289147273.497444, 28702819004.877907], "pallas_velocity_m_s": [-1948.7381903754856, -20307.781285208814, 4156.606512462996], "vesta_position_m": [166331403121.10275, -256906652758.2719, -124134856049.41298], "vesta_velocity_m_s": [18295.602252098583, 9577.160570429965, 1423.2851008847358], "energy_anchor": -1.321940998513625e+25, "booked_work": 0.0, "angular_momentum_anchor": [5.490282510087069e+31, -8.153754585822945e+32, 1.9244191261307657e+33], "booked_torque": [0.0, 0.0, 0.0]}, "dt_s": 1677.0, "segments": [{"steps": 9, "load": {}}, {"steps": 10, "load": {}}, {"steps": 11, "load": {}}, {"steps": 12, "load": {}}, {"steps": 13, "load": {}}, {"steps": 14, "load": {}}, {"steps": 15, "load": {}}], "record_every": 84, "readout": {"quantities": ["earth_mars_distance_m"]}}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 84, "quantity": "earth_mars_distance_m", "value": 390895599447.7874, "flags": []}, "proof": "0cc96b6596b63629b419c167374ae7ab4a2b01eea6b41026478ecd3e3e3519f0257c279d9ee2b73cf297642b476eecb4"}, {"row": "R2", "model": "aerospace/capsule_insight", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_insight", "initial": {"radius_m": 3519545.0, "radial_speed_m_s": -1340.4281, "transverse_speed_m_s": 5819.933}, "dt_s": 0.1, "segments": [{"steps": 2195, "load": {"lift_over_drag": 0.0}}], "record_every": 2195}}, "claim": {"outcome": "ended", "stop": "PastFlightDeployment", "steps_landed": 1975, "quantity": "mach", "value": 1.414380813182044, "flags": []}, "proof": "caf9fef4f3cfb1be4d6d1234fb1484c1525d788b0f09706c6f48f9d4be552533f0c55af43f8dda1ae3d7869b6a3f82c5"}, {"row": "R3", "model": "aerospace/crater_ryugu_sci", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "crater_ryugu_sci", "initial": {"radius_m": 3.395}, "dt_s": 0.163, "segments": [{"steps": 201, "load": {}}, {"steps": 222, "load": {}}, {"steps": 243, "load": {}}], "record_every": 666}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 666, "quantity": "radius_m", "value": 6.8729656389716265, "flags": []}, "proof": "6d6b45da8cf15848762712a1d05b1b8f3b1b9d6303f2c0162e30dfa6d44ec950766e5b6bf074c739440ff306f1889a0a"}, {"row": "R4", "model": "aerospace/capsule_stardust", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488061.0, "radial_speed_m_s": -2105.71, "transverse_speed_m_s": 12576.74}, "dt_s": 0.05, "segments": [{"steps": 3193, "load": {}}], "record_every": 3193, "readout": {"quantities": ["altitude_m"]}}}, "claim": {"outcome": "ended", "stop": "PastFlightDeployment", "steps_landed": 1929, "quantity": "altitude_m", "value": 31025.876497731544, "flags": [{"flag": "FLAG_DROGUE_MACH_WINDOW", "quantity": "mach", "extent": 0.39864147264033933, "steps": 190}, {"flag": "FLAG_DROGUE_MACH_WINDOW", "quantity": "mach", "extent": 0.39990473030213836, "steps": 190}, {"flag": "FLAG_MACH_TABLE_HELD", "quantity": "mach", "extent": 0.02429835996056795, "steps": 2}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "air_speed_m_s", "extent": 155.89247760455874, "steps": 484}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "air_speed_m_s", "extent": 1697.5036915755654, "steps": 1243}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "path_sine", "extent": 0.048142951009741516, "steps": 1005}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "path_sine", "extent": 0.06286079576874015, "steps": 851}]}, "proof": "fa2be55cda475420e0f90829833bea259ff32039b96724066963ad9de7ee75937d6f50458965183ad3962d5197a6062b"}, {"row": "R5", "model": "plasma_sheath_ram_c2", "request": {"tool": "solve", "arguments": {"solver": "plasma_sheath_ram_c2", "parameters": {"altitude_m": 55180.0, "velocity_m_s": 6896.0, "signal_frequency_hz": 4157000000.0}}}, "claim": {"outcome": "converged", "stop": null, "steps_landed": null, "quantity": "stagnation_temperature_k", "value": 6383.526355576421, "flags": []}, "proof": "70b0239e697034b92172ce494691215f79d0c4a56078257a3e624b2ee111ef7e94ef97df0177ac97270ec674bda20422"}, {"row": "R6", "model": "ablator_slab", "request": {"tool": "solve", "arguments": {"solver": "ablator_slab", "parameters": {"material": "PICA, open record, version 5", "thickness_m": 0.04845, "start_temperature_k": 308.75, "thermocouple_depths_m": [], "face": "held_temperature", "held_temperature_k": 1976.0, "hold_duration_s": 63.85, "continue_after_s": 43.15, "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false}}}, "claim": {"outcome": "converged", "stop": null, "steps_landed": null, "quantity": "depth_within_2_percent_of_virgin_m", "value": 0.014116399858056352, "flags": []}, "proof": "96e1a407a5dcf744722373aa7715f472762d5816c796d3073ee9f8970fc1ce3ed5bb10c6cc151e88ee32c13bc1cb681b"}, {"row": "R7", "model": "aerospace/momentum_jwst_dihedral", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "momentum_jwst_dihedral", "initial": {"h_eci_nms": [-1.429, 1.053, -1.498]}, "dt_s": 1910.0, "segments": [{"steps": 49, "load": {"q1": 0.638559, "q2": -0.019, "q3": -0.652891, "q4": 0.406959, "sun_x": 0.616092, "sun_y": 0.703148, "sun_z": 0.354984, "sun_distance_au": 1.01415}}, {"steps": 45, "load": {"q1": 0.748856, "q2": -0.003607, "q3": -0.560934, "q4": 0.352923, "sun_x": 0.674752, "sun_y": 0.668222, "sun_z": 0.313352, "sun_distance_au": 1.01415}}], "record_every": 94, "readout": {"quantities": ["h_magnitude_nms"]}}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 94, "quantity": "h_magnitude_nms", "value": 5.002332004564212, "flags": []}, "proof": "a93f9cd7a27d8851a5b9c4996bfa3d1f7c1c31622907a4c743501d5727ba57a8d39f657eca88e8928d1a19ee417ca01d"}, {"row": "R8", "model": "aerospace/momentum_jwst_srp", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "momentum_jwst_srp", "initial": {"h_eci_nms": [0.918, -1.255, 0.815]}, "dt_s": 874.0, "segments": [{"steps": 44, "load": {"q1": 0.685819, "q2": 0.011638, "q3": -0.603055, "q4": 0.407236, "sun_x": 0.616092, "sun_y": 0.713107, "sun_z": 0.334528, "sun_distance_au": 1.01161}}, {"steps": 32, "load": {"q1": 0.659909, "q2": -0.005461, "q3": -0.631303, "q4": 0.407365, "sun_x": 0.634305, "sun_y": 0.70673, "sun_z": 0.313352, "sun_distance_au": 0.1851}}], "record_every": 76}}, "claim": {"outcome": "refused", "stop": "SunshieldAboveKaptonLimit", "steps_landed": 118, "quantity": "h_magnitude_nms", "value": 1.6088350681235042, "flags": []}, "proof": "2802624f097f31c406fcd6c90107e0c92b0856ada8ab7aefd2a74b0db13c863229e6ac88939c9df175a48db8856bbc9d"}, {"row": "R9", "model": "aerospace/satellite_lageos1_twin", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "satellite_lageos1_twin", "initial": {"epoch_utc_s": 844432990.0, "forecast_elapsed_s": 0.0, "position_m": [-5947439.326, 2555567.396, 10470793.788], "velocity_m_s": [4754.057, 2345.016, 2292.947]}, "dt_s": 10.0, "segments": [{"steps": 1614, "load": {}}], "record_every": 1614}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 1614, "quantity": "semi_major_axis_m", "value": 11400874.582902145, "flags": [{"flag": "FLAG_BELOW_COMPARED_RADIUS", "quantity": "radius_m", "extent": 1559062.143708026, "steps": 994}, {"flag": "FLAG_EARTH_SHADOW", "quantity": "distance_from_shadow_axis_m", "extent": 1409415.657917643, "steps": 183}]}, "proof": "760e36d0a9c7ce7d7bc1e45f15334a31f23e242ce276c2b84454dfdcf21ca745576a3557773a024e0d7bedcd90133779"}, {"row": "R10", "model": "aerospace/crater_ryugu_sci", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "crater_ryugu_sci", "initial": {"radius_m": 1.25}, "dt_s": 0.1285, "segments": [{"steps": 210, "load": {}}, {"steps": 231, "load": {}}, {"steps": 252, "load": {}}, {"steps": 273, "load": {}}, {"steps": 294, "load": {}}, {"steps": 315, "load": {}}], "record_every": 1575}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 1575, "quantity": "radius_m", "value": 7.823494707379572, "flags": []}, "proof": "e6950ae5d4f4d0953321d1013624d3ce599b23249db4d6075c705be83c6b66f37cbf9a67bb109ddbf36bd7003945bd86"}], "reasons": ["retired_model", "parent_wrong", "seal_wrong", "stop_hidden", "step_wrong", "flag_omitted", "flag_altered", "value_altered"], "precedence": ["retired_model", "parent_wrong", "seal_wrong", "stop_hidden", "step_wrong", "flag_omitted", "flag_altered", "value_altered"], "budget": 4, "forbidden": ["find_flip", "design_run", "run_dataset", "validate_series"]}, "seed": {"kind": "g2_round7_design6_0.15.3", "seed": 20261103707, "note": "Genuine rows are engine v0.15.3 answers; false rows are recorded changes of genuine ones, labelled by precedence, each label recovered from the engine alone. Design: round6/f6_lib.py (10 total rows: 2 visible, 8 needing a call, budget 4, 2 hidden -> blind 0.2143)."}, "reference": {"false_rows": {"R2": "value_altered", "R7": "seal_wrong", "R8": "step_wrong", "R9": "retired_model"}, "mutations": {"R1": ["genuine: sent with a readout of earth_mars_distance_m (not part of the seal)"], "R2": ["value changed in the 6th significant figure (1.4143836525834068 -> 1.4143808131820439)"], "R4": ["genuine: sent with a readout of altitude_m (not part of the seal)"], "R7": ["proof taken from another run of the same model (a93f9cd7a27d8851...)", "genuine difference: sent with a readout of h_magnitude_nms (not part of the seal)"], "R8": ["steps_landed 44 claimed as 118, more steps than the request asks for"], "R9": ["retired ID satellite_lageos1_twin"]}, "genuine": {"R1": {"value": 390895599447.7874, "outcome": "completed", "stop": null, "steps_landed": 84, "flags": [], "proof": "0cc96b6596b63629b419c167374ae7ab4a2b01eea6b41026478ecd3e3e3519f0257c279d9ee2b73cf297642b476eecb4"}, "R2": {"value": 1.4143836525834068, "outcome": "ended", "stop": "PastFlightDeployment", "steps_landed": 1975, "flags": [], "proof": "caf9fef4f3cfb1be4d6d1234fb1484c1525d788b0f09706c6f48f9d4be552533f0c55af43f8dda1ae3d7869b6a3f82c5"}, "R3": {"value": 6.8729656389716265, "outcome": "completed", "stop": null, "steps_landed": 666, "flags": [], "proof": "6d6b45da8cf15848762712a1d05b1b8f3b1b9d6303f2c0162e30dfa6d44ec950766e5b6bf074c739440ff306f1889a0a"}, "R4": {"value": 31025.876497731544, "outcome": "ended", "stop": "PastFlightDeployment", "steps_landed": 1929, "flags": [{"flag": "FLAG_DROGUE_MACH_WINDOW", "quantity": "mach", "extent": 0.39864147264033933, "steps": 190}, {"flag": "FLAG_DROGUE_MACH_WINDOW", "quantity": "mach", "extent": 0.39990473030213836, "steps": 190}, {"flag": "FLAG_MACH_TABLE_HELD", "quantity": "mach", "extent": 0.02429835996056795, "steps": 2}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "air_speed_m_s", "extent": 155.89247760455874, "steps": 484}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "air_speed_m_s", "extent": 1697.5036915755654, "steps": 1243}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "path_sine", "extent": 0.048142951009741516, "steps": 1005}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "path_sine", "extent": 0.06286079576874015, "steps": 851}], "proof": "fa2be55cda475420e0f90829833bea259ff32039b96724066963ad9de7ee75937d6f50458965183ad3962d5197a6062b"}, "R5": {"value": 6383.526355576421, "outcome": "converged", "stop": null, "steps_landed": null, "flags": [], "proof": "70b0239e697034b92172ce494691215f79d0c4a56078257a3e624b2ee111ef7e94ef97df0177ac97270ec674bda20422"}, "R6": {"value": 0.014116399858056352, "outcome": "converged", "stop": null, "steps_landed": null, "flags": [], "proof": "96e1a407a5dcf744722373aa7715f472762d5816c796d3073ee9f8970fc1ce3ed5bb10c6cc151e88ee32c13bc1cb681b"}, "R7": {"value": 5.002332004564212, "outcome": "completed", "stop": null, "steps_landed": 94, "flags": [], "proof": "5e08dbf186fe7dd5a7b852f7160be344aa77c18c241dfaf28368dee775972e438e3576fb3d708268de29036f1316b87e"}, "R8": {"value": 1.6088350681235042, "outcome": "refused", "stop": "SunshieldAboveKaptonLimit", "steps_landed": 44, "flags": [], "proof": "2802624f097f31c406fcd6c90107e0c92b0856ada8ab7aefd2a74b0db13c863229e6ac88939c9df175a48db8856bbc9d"}, "R9": {"value": 11400874.582902145, "outcome": "completed", "stop": null, "steps_landed": 1614, "flags": [{"flag": "FLAG_BELOW_COMPARED_RADIUS", "quantity": "radius_m", "extent": 1559062.143708026, "steps": 994}, {"flag": "FLAG_EARTH_SHADOW", "quantity": "distance_from_shadow_axis_m", "extent": 1409415.657917643, "steps": 183}], "proof": "760e36d0a9c7ce7d7bc1e45f15334a31f23e242ce276c2b84454dfdcf21ca745576a3557773a024e0d7bedcd90133779"}, "R10": {"value": 7.823494707379572, "outcome": "completed", "stop": null, "steps_landed": 1575, "flags": [], "proof": "e6950ae5d4f4d0953321d1013624d3ce599b23249db4d6075c705be83c6b66f37cbf9a67bb109ddbf36bd7003945bd86"}}, "engine_source": "https://github.com/johnkruze/zero-trust-physics-engine", "engine_tag": "v0.15.3", "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1", "gateway_version": "0.15.3", "engine_binary_sha256": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076"}} +{"id": "g2-forensics6-07", "family": "forensics", "kind": "forensics", "models": ["ablator_slab", "aerospace/capsule_insight", "aerospace/capsule_stardust", "aerospace/crater_ryugu_sci", "aerospace/los_jwst_fine_guide", "aerospace/momentum_jwst_dihedral", "aerospace/momentum_jwst_srp", "aerospace/satellite_lageos1", "aerospace/solar_system", "plasma_sheath_ram_c2"], "real_thing": "Twelve answers of the verifier over 10 models of entry, orbit and space.", "task": "A report hands you twelve claims about answers of the verifier. Each row gives the model, the request as it was sent, what its answer is claimed to say and the proof claimed for it. claim.outcome and claim.stop are the run's outcome and the name of its stop or declared end (null when it completed); claim.steps_landed is the last step the run is sealed to; claim.quantity and claim.value are one number of the final state of a run (of the result, for a solve); claim.flags are the advisory flags the run carried, each with the quantity it is on, its extent at the largest (extent) and the number of steps it was raised on (steps).\nSome rows are false. A false row may be wrong in more than one way; its reason is the first of these, in this order, that is true of it:\n1. retired_model: the request names a model ID the verifier does not serve (one it no longer serves, or a name it never served).\n2. parent_wrong: the request continues a run (from) that is not the parent it names: its start state, or the seal it gives for its parent, belongs to another run, and the verifier refuses the continuation.\n3. seal_wrong: the proof is not the seal of this request.\n4. stop_hidden: the run stops part way and the claim says it completed.\n5. step_wrong: the claim names the run's stop, but not the last step the run is sealed to.\n6. flag_omitted: the run carries an advisory flag (a name on a quantity) that the claim leaves out altogether.\n7. flag_altered: the flags the claim lists are not the run's, entry for entry: an extent or a count of steps differs, or an entry is missing or added where its name on that quantity is listed too (the verifier may list one flag on one quantity more than once, each with its own extent).\n8. value_altered: the claimed value is not the one the request gives, to the last digit.\nA row that is none of these is genuine, whatever else differs in how it is written (the order of its flags, a readout sent with the request, the spelling of a number). Name every false row with its reason.\nThe rows, one a line:\n{\"row\": \"R1\", \"model\": \"aerospace/momentum_jwst_srp\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_srp\", \"initial\": {\"h_eci_nms\": [-1.244, -0.73, 1.098]}, \"dt_s\": 1599.0, \"segments\": [{\"steps\": 69, \"load\": {\"q1\": 0.655763, \"q2\": -0.008127, \"q3\": -0.635608, \"q4\": 0.407321, \"sun_x\": 0.616092, \"sun_y\": 0.711198, \"sun_z\": 0.338568, \"sun_distance_au\": 1.00863}}], \"record_every\": 69}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 69, \"quantity\": \"h_magnitude_nms\", \"value\": 2.2890861976984564, \"flags\": []}, \"proof\": \"949c987ad62f835ca215267699517ed2e659b5e776277779896aaf721a03f139d674ea7e0f671e6160f37eaca17eaade\"}\n{\"row\": \"R2\", \"model\": \"aerospace/capsule_insight\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_insight\", \"initial\": {\"radius_m\": 3522956.0, \"radial_speed_m_s\": -1294.7972, \"transverse_speed_m_s\": 5730.5432}, \"dt_s\": 0.1, \"segments\": [{\"steps\": 2152, \"load\": {\"lift_over_drag\": 0.0}}], \"record_every\": 2152}}, \"claim\": {\"outcome\": \"ended\", \"stop\": \"PastFlightDeployment\", \"steps_landed\": 2115, \"quantity\": \"mach\", \"value\": 1.3960519703767567, \"flags\": []}, \"proof\": \"a4065183ea2043a6b9568252634e364467b059fc61f9a23478a29d53c70035b9b199b77f07d277aa257df8e292b9ce3b\"}\n{\"row\": \"R3\", \"model\": \"ablator_slab\", \"request\": {\"tool\": \"solve\", \"arguments\": {\"solver\": \"ablator_slab\", \"parameters\": {\"material\": \"TACOT 3.0\", \"thickness_m\": 0.0461, \"start_temperature_k\": 306.3, \"thermocouple_depths_m\": [], \"face\": \"held_temperature\", \"held_temperature_k\": 1920.0, \"hold_duration_s\": 60.0, \"continue_after_s\": 40.0, \"return_face_history\": false, \"return_thermocouple_histories\": false, \"return_final_profile\": false}}}, \"claim\": {\"outcome\": \"converged\", \"stop\": null, \"steps_landed\": null, \"quantity\": \"heat_in_through_face_j_per_m2\", \"value\": 7320760.59153902, \"flags\": []}, \"proof\": \"eec6980868952c49cd6a1017930f98d396e4452a470c6fa0eacd9b4e00d4aa1c3c32a4c83a59d23ebb96511b2071cec9\"}\n{\"row\": \"R4\", \"model\": \"aerospace/satellite_lageos1\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"satellite_lageos1\", \"initial\": {\"epoch_utc_s\": 844014880.0, \"forecast_elapsed_s\": 0.0, \"position_m\": [4229354.428, 1727500.405, 11440357.84], \"velocity_m_s\": [4061.944, -1496.84, -849.917]}, \"dt_s\": 10.0, \"segments\": [{\"steps\": 1742, \"load\": {}}], \"record_every\": 1742}}, \"claim\": {\"outcome\": \"refused\", \"stop\": \"RadiusBelowEarthRadius\", \"steps_landed\": 1810, \"quantity\": \"radius_m\", \"value\": 6394735.022733123, \"flags\": [{\"flag\": \"FLAG_BELOW_COMPARED_RADIUS\", \"quantity\": \"radius_m\", \"extent\": 5602264.977266877, \"steps\": 232}, {\"flag\": \"FLAG_EARTH_SHADOW\", \"quantity\": \"distance_from_shadow_axis_m\", \"extent\": 1013479.6278764848, \"steps\": 36}]}, \"proof\": \"7d233dcfc07a2e1911dfb85fa0fea029ca687f3514cbba06fdf88864e906828e6417cdfe59a34263e9a9936df3787eeb\"}\n{\"row\": \"R5\", \"model\": \"aerospace/momentum_jwst_srp\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_srp\", \"initial\": {\"h_eci_nms\": [-1.622, -0.964, 1.404]}, \"dt_s\": 1941.0, \"segments\": [{\"steps\": 105, \"load\": {\"q1\": 0.613497, \"q2\": -0.034325, \"q3\": -0.676494, \"q4\": 0.405953, \"sun_x\": 0.616092, \"sun_y\": 0.704136, \"sun_z\": 0.353019, \"sun_distance_au\": 1.01277}}], \"record_every\": 105}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 105, \"quantity\": \"h_magnitude_nms\", \"value\": 6.973018347360404, \"flags\": []}, \"proof\": \"ad1969f7ba7bdeb622e3b8e1d44f0d24ec27d0e37940f1b0109488c8a140a98d6b533e80d8516dd6570125efcd1661ca\"}\n{\"row\": \"R6\", \"model\": \"aerospace/momentum_jwst_srp\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_srp\", \"initial\": {\"h_eci_nms\": [-1.055, -0.613, 0.945]}, \"dt_s\": 1428.0, \"segments\": [{\"steps\": 51, \"load\": {\"q1\": 0.675887, \"q2\": 0.004991, \"q3\": -0.614166, \"q4\": 0.407371, \"sun_x\": 0.616092, \"sun_y\": 0.714618, \"sun_z\": 0.331289, \"sun_distance_au\": 1.00656}}], \"record_every\": 51, \"readout\": {\"quantities\": [\"h_magnitude_nms\"]}}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 51, \"quantity\": \"h_magnitude_nms\", \"value\": 1.2538931414748378, \"flags\": []}, \"proof\": \"03d88323f8f93f53797cbc48775f27fd6a07de18484442a71b7150623946a49b71ae478a13981aefc1278e97d0ba94e7\"}\n{\"row\": \"R7\", \"model\": \"aerospace/solar_system\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"solar_system\", \"initial\": {\"sun_position_m\": [-972177542.8424704, -500214545.81043047, -185162850.5512162], \"sun_velocity_m_s\": [10.943471273744956, -10.354907507003432, -4.725295041665638], \"mercury_position_m\": [44347944047.32132, -35386831719.91674, -23520589495.944], \"mercury_velocity_m_s\": [23179.557544578543, 34737.11717051704, 16153.15243244726], \"venus_position_m\": [107378854594.44405, -3855694027.194445, -8551901158.778554], \"venus_velocity_m_s\": [1922.5971467016116, 31772.25497050463, 14172.860625157742], \"earth_position_m\": [-131048132650.02007, -69568840294.57173, -30130222428.765972], \"earth_velocity_m_s\": [14439.696511929173, -23759.193577978716, -10300.838662315398], \"moon_position_m\": [-131336010046.59302, -69827768665.01813, -30206075001.525085], \"moon_velocity_m_s\": [15090.044579869322, -24450.210577738573, -10619.619444665168], \"mars_position_m\": [99849753635.60847, 183319992199.24744, 81400974963.10365], \"mars_velocity_m_s\": [-20727.719446230996, 11533.19274335954, 5850.623327698212], \"jupiter_position_m\": [514628857491.4813, 498738500952.13635, 201244273740.58517], \"jupiter_velocity_m_s\": [-9599.899310141725, 8786.610935350978, 4000.0870026696048], \"saturn_position_m\": [885052478191.6257, 978750373225.096, 366165774373.12665], \"saturn_velocity_m_s\": [-7872.030702860459, 5633.288132226103, 2665.365518089133], \"uranus_position_m\": [2201312313161.7573, -1830733084174.7542, -832950501719.338], \"uranus_velocity_m_s\": [4543.09354375023, 4338.812277392898, 1836.0266601992553], \"neptune_position_m\": [2556089531027.0625, -3410769562986.1963, -1459684701878.0127], \"neptune_velocity_m_s\": [4440.424297199966, 2924.108717975938, 1086.3053554716744], \"ceres_position_m\": [-376564661494.9705, -82793770650.16934, 37539835502.66692], \"ceres_velocity_m_s\": [2078.7472741961246, -17061.59058649498, -8451.939414743216], \"pallas_position_m\": [-285475111420.94836, 157884218572.5715, -11922623410.065147], \"pallas_velocity_m_s\": [-12324.053945853098, -17981.78998150534, 4412.172020403093], \"vesta_position_m\": [-20413884754.428905, -300115898744.55383, -116942553506.93321], \"vesta_velocity_m_s\": [20962.21629618035, -627.1836731673636, -2988.3711172821936], \"energy_anchor\": -1.3219409983492277e+25, \"booked_work\": 0.0, \"angular_momentum_anchor\": [5.490282510021932e+31, -8.153754585664557e+32, 1.9244191260936244e+33], \"booked_torque\": [0.0, 0.0, 0.0]}, \"dt_s\": 1444.0, \"segments\": [{\"steps\": 6, \"load\": {}}, {\"steps\": 7, \"load\": {}}, {\"steps\": 8, \"load\": {}}, {\"steps\": 9, \"load\": {}}], \"record_every\": 30, \"readout\": {\"quantities\": [\"earth_mars_distance_m\"]}}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 30, \"quantity\": \"earth_mars_distance_m\", \"value\": 360459888729.46576, \"flags\": []}, \"proof\": \"e584421f53f10db28a78d74a117cfc06b70f10a6cd5a8edfccbd8f76cbd63845b21a93ee0d2b86eac20331f5a33cc32b\"}\n{\"row\": \"R8\", \"model\": \"aerospace/capsule_stardust\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_stardust\", \"initial\": {\"radius_m\": 6487681.0, \"radial_speed_m_s\": -2026.81, \"transverse_speed_m_s\": 12555.79}, \"dt_s\": 0.05, \"segments\": [{\"steps\": 3073, \"load\": {}}], \"record_every\": 3073, \"readout\": {\"quantities\": [\"ground_distance_m\"]}}}, \"claim\": {\"outcome\": \"ended\", \"stop\": \"PastFlightDeployment\", \"steps_landed\": 2015, \"quantity\": \"ground_distance_m\", \"value\": 617475.7093449463, \"flags\": [{\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"path_sine\", \"extent\": 0.049833167255976536, \"steps\": 880}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"path_sine\", \"extent\": 0.040780280423902485, \"steps\": 1050}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"air_speed_m_s\", \"extent\": 1431.0624296764208, \"steps\": 1231}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"air_speed_m_s\", \"extent\": 189.96215207054047, \"steps\": 524}, {\"flag\": \"FLAG_DROGUE_MACH_WINDOW\", \"quantity\": \"mach\", \"extent\": 0.39949110594929116, \"steps\": 195}, {\"flag\": \"FLAG_DROGUE_MACH_WINDOW\", \"quantity\": \"mach\", \"extent\": 0.3987609440499196, \"steps\": 195}]}, \"proof\": \"3c2f0b68016777a8ea47683b523e67425743046af710d339be26b0801f7acb6a63bd125f2dc439ead5719719ecc90dbb\"}\n{\"row\": \"R9\", \"model\": \"plasma_sheath_ramc2\", \"request\": {\"tool\": \"solve\", \"arguments\": {\"solver\": \"plasma_sheath_ramc2\", \"parameters\": {\"altitude_m\": 65260.0, \"velocity_m_s\": 8582.0, \"signal_frequency_hz\": 8234000000.0}}}, \"claim\": {\"outcome\": \"converged\", \"stop\": null, \"steps_landed\": null, \"quantity\": \"station2_electron_density_m3\", \"value\": 5.665499503721301e+18, \"flags\": []}, \"proof\": \"0835e993c83234e8ed833a8d39db824f039eb71ea77c309c76720162a6e41a59ccd8190b85384a21a3bb84183f442fbf\"}\n{\"row\": \"R10\", \"model\": \"aerospace/los_jwst_fine_guide\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"los_jwst_fine_guide\", \"initial\": {\"lock_x_arcsec\": 29.207, \"lock_y_arcsec\": -11.348, \"quiet_before_start_s\": 38.16}, \"dt_s\": 0.064, \"segments\": [{\"steps\": 3, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20685, \"centroid_y_arcsec\": -11.34796, \"counts_per_s\": 293200.0}}, {\"steps\": 1, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20706, \"centroid_y_arcsec\": -11.34813, \"counts_per_s\": 293200.0}}, {\"steps\": 2, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20727, \"centroid_y_arcsec\": -11.34796, \"counts_per_s\": 293200.0}}, {\"steps\": 3, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20685, \"centroid_y_arcsec\": -11.34813, \"counts_per_s\": 293200.0}}, {\"steps\": 1, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20706, \"centroid_y_arcsec\": -11.34796, \"counts_per_s\": 293200.0}}, {\"steps\": 2, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20727, \"centroid_y_arcsec\": -11.34813, \"counts_per_s\": 293200.0}}, {\"steps\": 3, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20685, \"centroid_y_arcsec\": -11.34796, \"counts_per_s\": 293200.0}}, {\"steps\": 1, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20706, \"centroid_y_arcsec\": -11.34813, \"counts_per_s\": 293200.0}}, {\"steps\": 2, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20727, \"centroid_y_arcsec\": -11.34796, \"counts_per_s\": 293200.0}}], \"record_every\": 18}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 18, \"quantity\": \"estimate_y_mas\", \"value\": 0.000761549984910976, \"flags\": []}, \"proof\": \"f3de03ad5a49c1f27c156b8d58a2d143f777aa5fb5c459524b72678085d6f40a16eb5b8dade2b6ec34aa9865f4368bc7\"}\n{\"row\": \"R11\", \"model\": \"aerospace/momentum_jwst_dihedral\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_dihedral\", \"initial\": {\"h_eci_nms\": [1.121506850922792, 0.4000086686906281, 1.2782357873204517]}, \"dt_s\": 1620.0, \"segments\": [{\"steps\": 57, \"load\": {\"q1\": 0.626313, \"q2\": -0.026561, \"q3\": -0.664647, \"q4\": 0.406535, \"sun_x\": 0.581366, \"sun_y\": 0.750882, \"sun_z\": 0.313352, \"sun_distance_au\": 1.0106}}], \"record_every\": 57, \"from\": {\"request\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_dihedral\", \"initial\": {\"h_eci_nms\": [1.057, 0.661, -1.263]}, \"dt_s\": 1620.0, \"segments\": [{\"steps\": 45, \"load\": {\"q1\": 0.705492, \"q2\": 0.058115, \"q3\": -0.557927, \"q4\": 0.433151, \"sun_x\": 0.629673, \"sun_y\": 0.722662, \"sun_z\": 0.285081, \"sun_distance_au\": 1.0104}}], \"record_every\": 45}, \"run_seal\": \"50be7c19d63da96301f1e0edfd5ed2ff425a426e8fe4e4acc9cd6269d4ff5667db7e0b37f14ad3215a9741526ee2b189\"}}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 57, \"quantity\": \"h_magnitude_nms\", \"value\": 2.5762879795193383, \"flags\": []}, \"proof\": \"647a4baa677e63010302d970dec4c6d51f25ade699b52280cee7ff1ff0403679a724f0e0fd0d7643bf5d0d037e42b424\"}\n{\"row\": \"R12\", \"model\": \"aerospace/crater_ryugu_sci\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"crater_ryugu_sci\", \"initial\": {\"radius_m\": 1.155}, \"dt_s\": 0.1415, \"segments\": [{\"steps\": 215, \"load\": {}}, {\"steps\": 238, \"load\": {}}, {\"steps\": 261, \"load\": {}}, {\"steps\": 284, \"load\": {}}, {\"steps\": 307, \"load\": {}}, {\"steps\": 330, \"load\": {}}], \"record_every\": 1635, \"readout\": {\"quantities\": [\"radius_m\"]}}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 1635, \"quantity\": \"radius_m\", \"value\": 8.038589347556837, \"flags\": []}, \"proof\": \"4e66884da3bdfb79ac5594a27861f9a025d797903b4d2f127f503fd89a7bc9e96639f499b3eb8e87a6b36e0c3c12d38e\"}\n\nBudget: at most 4 calls that compute, counted over every call you make (every run_trajectory, solve, compute_step and verify_ call counts, refused or not); list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all.", "check": {"rows": [{"row": "R1", "model": "aerospace/momentum_jwst_srp", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "momentum_jwst_srp", "initial": {"h_eci_nms": [-1.244, -0.73, 1.098]}, "dt_s": 1599.0, "segments": [{"steps": 69, "load": {"q1": 0.655763, "q2": -0.008127, "q3": -0.635608, "q4": 0.407321, "sun_x": 0.616092, "sun_y": 0.711198, "sun_z": 0.338568, "sun_distance_au": 1.00863}}], "record_every": 69}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 69, "quantity": "h_magnitude_nms", "value": 2.2890861976984564, "flags": []}, "proof": "949c987ad62f835ca215267699517ed2e659b5e776277779896aaf721a03f139d674ea7e0f671e6160f37eaca17eaade"}, {"row": "R2", "model": "aerospace/capsule_insight", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_insight", "initial": {"radius_m": 3522956.0, "radial_speed_m_s": -1294.7972, "transverse_speed_m_s": 5730.5432}, "dt_s": 0.1, "segments": [{"steps": 2152, "load": {"lift_over_drag": 0.0}}], "record_every": 2152}}, "claim": {"outcome": "ended", "stop": "PastFlightDeployment", "steps_landed": 2115, "quantity": "mach", "value": 1.3960519703767567, "flags": []}, "proof": "a4065183ea2043a6b9568252634e364467b059fc61f9a23478a29d53c70035b9b199b77f07d277aa257df8e292b9ce3b"}, {"row": "R3", "model": "ablator_slab", "request": {"tool": "solve", "arguments": {"solver": "ablator_slab", "parameters": {"material": "TACOT 3.0", "thickness_m": 0.0461, "start_temperature_k": 306.3, "thermocouple_depths_m": [], "face": "held_temperature", "held_temperature_k": 1920.0, "hold_duration_s": 60.0, "continue_after_s": 40.0, "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false}}}, "claim": {"outcome": "converged", "stop": null, "steps_landed": null, "quantity": "heat_in_through_face_j_per_m2", "value": 7320760.59153902, "flags": []}, "proof": "eec6980868952c49cd6a1017930f98d396e4452a470c6fa0eacd9b4e00d4aa1c3c32a4c83a59d23ebb96511b2071cec9"}, {"row": "R4", "model": "aerospace/satellite_lageos1", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "satellite_lageos1", "initial": {"epoch_utc_s": 844014880.0, "forecast_elapsed_s": 0.0, "position_m": [4229354.428, 1727500.405, 11440357.84], "velocity_m_s": [4061.944, -1496.84, -849.917]}, "dt_s": 10.0, "segments": [{"steps": 1742, "load": {}}], "record_every": 1742}}, "claim": {"outcome": "refused", "stop": "RadiusBelowEarthRadius", "steps_landed": 1810, "quantity": "radius_m", "value": 6394735.022733123, "flags": [{"flag": "FLAG_BELOW_COMPARED_RADIUS", "quantity": "radius_m", "extent": 5602264.977266877, "steps": 232}, {"flag": "FLAG_EARTH_SHADOW", "quantity": "distance_from_shadow_axis_m", "extent": 1013479.6278764848, "steps": 36}]}, "proof": "7d233dcfc07a2e1911dfb85fa0fea029ca687f3514cbba06fdf88864e906828e6417cdfe59a34263e9a9936df3787eeb"}, {"row": "R5", "model": "aerospace/momentum_jwst_srp", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "momentum_jwst_srp", "initial": {"h_eci_nms": [-1.622, -0.964, 1.404]}, "dt_s": 1941.0, "segments": [{"steps": 105, "load": {"q1": 0.613497, "q2": -0.034325, "q3": -0.676494, "q4": 0.405953, "sun_x": 0.616092, "sun_y": 0.704136, "sun_z": 0.353019, "sun_distance_au": 1.01277}}], "record_every": 105}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 105, "quantity": "h_magnitude_nms", "value": 6.973018347360404, "flags": []}, "proof": "ad1969f7ba7bdeb622e3b8e1d44f0d24ec27d0e37940f1b0109488c8a140a98d6b533e80d8516dd6570125efcd1661ca"}, {"row": "R6", "model": "aerospace/momentum_jwst_srp", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "momentum_jwst_srp", "initial": {"h_eci_nms": [-1.055, -0.613, 0.945]}, "dt_s": 1428.0, "segments": [{"steps": 51, "load": {"q1": 0.675887, "q2": 0.004991, "q3": -0.614166, "q4": 0.407371, "sun_x": 0.616092, "sun_y": 0.714618, "sun_z": 0.331289, "sun_distance_au": 1.00656}}], "record_every": 51, "readout": {"quantities": ["h_magnitude_nms"]}}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 51, "quantity": "h_magnitude_nms", "value": 1.2538931414748378, "flags": []}, "proof": "03d88323f8f93f53797cbc48775f27fd6a07de18484442a71b7150623946a49b71ae478a13981aefc1278e97d0ba94e7"}, {"row": "R7", "model": "aerospace/solar_system", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "solar_system", "initial": {"sun_position_m": [-972177542.8424704, -500214545.81043047, -185162850.5512162], "sun_velocity_m_s": [10.943471273744956, -10.354907507003432, -4.725295041665638], "mercury_position_m": [44347944047.32132, -35386831719.91674, -23520589495.944], "mercury_velocity_m_s": [23179.557544578543, 34737.11717051704, 16153.15243244726], "venus_position_m": [107378854594.44405, -3855694027.194445, -8551901158.778554], "venus_velocity_m_s": [1922.5971467016116, 31772.25497050463, 14172.860625157742], "earth_position_m": [-131048132650.02007, -69568840294.57173, -30130222428.765972], "earth_velocity_m_s": [14439.696511929173, -23759.193577978716, -10300.838662315398], "moon_position_m": [-131336010046.59302, -69827768665.01813, -30206075001.525085], "moon_velocity_m_s": [15090.044579869322, -24450.210577738573, -10619.619444665168], "mars_position_m": [99849753635.60847, 183319992199.24744, 81400974963.10365], "mars_velocity_m_s": [-20727.719446230996, 11533.19274335954, 5850.623327698212], "jupiter_position_m": [514628857491.4813, 498738500952.13635, 201244273740.58517], "jupiter_velocity_m_s": [-9599.899310141725, 8786.610935350978, 4000.0870026696048], "saturn_position_m": [885052478191.6257, 978750373225.096, 366165774373.12665], "saturn_velocity_m_s": [-7872.030702860459, 5633.288132226103, 2665.365518089133], "uranus_position_m": [2201312313161.7573, -1830733084174.7542, -832950501719.338], "uranus_velocity_m_s": [4543.09354375023, 4338.812277392898, 1836.0266601992553], "neptune_position_m": [2556089531027.0625, -3410769562986.1963, -1459684701878.0127], "neptune_velocity_m_s": [4440.424297199966, 2924.108717975938, 1086.3053554716744], "ceres_position_m": [-376564661494.9705, -82793770650.16934, 37539835502.66692], "ceres_velocity_m_s": [2078.7472741961246, -17061.59058649498, -8451.939414743216], "pallas_position_m": [-285475111420.94836, 157884218572.5715, -11922623410.065147], "pallas_velocity_m_s": [-12324.053945853098, -17981.78998150534, 4412.172020403093], "vesta_position_m": [-20413884754.428905, -300115898744.55383, -116942553506.93321], "vesta_velocity_m_s": [20962.21629618035, -627.1836731673636, -2988.3711172821936], "energy_anchor": -1.3219409983492277e+25, "booked_work": 0.0, "angular_momentum_anchor": [5.490282510021932e+31, -8.153754585664557e+32, 1.9244191260936244e+33], "booked_torque": [0.0, 0.0, 0.0]}, "dt_s": 1444.0, "segments": [{"steps": 6, "load": {}}, {"steps": 7, "load": {}}, {"steps": 8, "load": {}}, {"steps": 9, "load": {}}], "record_every": 30, "readout": {"quantities": ["earth_mars_distance_m"]}}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 30, "quantity": "earth_mars_distance_m", "value": 360459888729.46576, "flags": []}, "proof": "e584421f53f10db28a78d74a117cfc06b70f10a6cd5a8edfccbd8f76cbd63845b21a93ee0d2b86eac20331f5a33cc32b"}, {"row": "R8", "model": "aerospace/capsule_stardust", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6487681.0, "radial_speed_m_s": -2026.81, "transverse_speed_m_s": 12555.79}, "dt_s": 0.05, "segments": [{"steps": 3073, "load": {}}], "record_every": 3073, "readout": {"quantities": ["ground_distance_m"]}}}, "claim": {"outcome": "ended", "stop": "PastFlightDeployment", "steps_landed": 2015, "quantity": "ground_distance_m", "value": 617475.7093449463, "flags": [{"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "path_sine", "extent": 0.049833167255976536, "steps": 880}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "path_sine", "extent": 0.040780280423902485, "steps": 1050}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "air_speed_m_s", "extent": 1431.0624296764208, "steps": 1231}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "air_speed_m_s", "extent": 189.96215207054047, "steps": 524}, {"flag": "FLAG_DROGUE_MACH_WINDOW", "quantity": "mach", "extent": 0.39949110594929116, "steps": 195}, {"flag": "FLAG_DROGUE_MACH_WINDOW", "quantity": "mach", "extent": 0.3987609440499196, "steps": 195}]}, "proof": "3c2f0b68016777a8ea47683b523e67425743046af710d339be26b0801f7acb6a63bd125f2dc439ead5719719ecc90dbb"}, {"row": "R9", "model": "plasma_sheath_ramc2", "request": {"tool": "solve", "arguments": {"solver": "plasma_sheath_ramc2", "parameters": {"altitude_m": 65260.0, "velocity_m_s": 8582.0, "signal_frequency_hz": 8234000000.0}}}, "claim": {"outcome": "converged", "stop": null, "steps_landed": null, "quantity": "station2_electron_density_m3", "value": 5.665499503721301e+18, "flags": []}, "proof": "0835e993c83234e8ed833a8d39db824f039eb71ea77c309c76720162a6e41a59ccd8190b85384a21a3bb84183f442fbf"}, {"row": "R10", "model": "aerospace/los_jwst_fine_guide", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "los_jwst_fine_guide", "initial": {"lock_x_arcsec": 29.207, "lock_y_arcsec": -11.348, "quiet_before_start_s": 38.16}, "dt_s": 0.064, "segments": [{"steps": 3, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20685, "centroid_y_arcsec": -11.34796, "counts_per_s": 293200.0}}, {"steps": 1, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20706, "centroid_y_arcsec": -11.34813, "counts_per_s": 293200.0}}, {"steps": 2, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20727, "centroid_y_arcsec": -11.34796, "counts_per_s": 293200.0}}, {"steps": 3, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20685, "centroid_y_arcsec": -11.34813, "counts_per_s": 293200.0}}, {"steps": 1, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20706, "centroid_y_arcsec": -11.34796, "counts_per_s": 293200.0}}, {"steps": 2, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20727, "centroid_y_arcsec": -11.34813, "counts_per_s": 293200.0}}, {"steps": 3, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20685, "centroid_y_arcsec": -11.34796, "counts_per_s": 293200.0}}, {"steps": 1, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20706, "centroid_y_arcsec": -11.34813, "counts_per_s": 293200.0}}, {"steps": 2, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20727, "centroid_y_arcsec": -11.34796, "counts_per_s": 293200.0}}], "record_every": 18}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 18, "quantity": "estimate_y_mas", "value": 0.000761549984910976, "flags": []}, "proof": "f3de03ad5a49c1f27c156b8d58a2d143f777aa5fb5c459524b72678085d6f40a16eb5b8dade2b6ec34aa9865f4368bc7"}, {"row": "R11", "model": "aerospace/momentum_jwst_dihedral", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "momentum_jwst_dihedral", "initial": {"h_eci_nms": [1.121506850922792, 0.4000086686906281, 1.2782357873204517]}, "dt_s": 1620.0, "segments": [{"steps": 57, "load": {"q1": 0.626313, "q2": -0.026561, "q3": -0.664647, "q4": 0.406535, "sun_x": 0.581366, "sun_y": 0.750882, "sun_z": 0.313352, "sun_distance_au": 1.0106}}], "record_every": 57, "from": {"request": {"domain": "aerospace", "card": "momentum_jwst_dihedral", "initial": {"h_eci_nms": [1.057, 0.661, -1.263]}, "dt_s": 1620.0, "segments": [{"steps": 45, "load": {"q1": 0.705492, "q2": 0.058115, "q3": -0.557927, "q4": 0.433151, "sun_x": 0.629673, "sun_y": 0.722662, "sun_z": 0.285081, "sun_distance_au": 1.0104}}], "record_every": 45}, "run_seal": "50be7c19d63da96301f1e0edfd5ed2ff425a426e8fe4e4acc9cd6269d4ff5667db7e0b37f14ad3215a9741526ee2b189"}}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 57, "quantity": "h_magnitude_nms", "value": 2.5762879795193383, "flags": []}, "proof": "647a4baa677e63010302d970dec4c6d51f25ade699b52280cee7ff1ff0403679a724f0e0fd0d7643bf5d0d037e42b424"}, {"row": "R12", "model": "aerospace/crater_ryugu_sci", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "crater_ryugu_sci", "initial": {"radius_m": 1.155}, "dt_s": 0.1415, "segments": [{"steps": 215, "load": {}}, {"steps": 238, "load": {}}, {"steps": 261, "load": {}}, {"steps": 284, "load": {}}, {"steps": 307, "load": {}}, {"steps": 330, "load": {}}], "record_every": 1635, "readout": {"quantities": ["radius_m"]}}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 1635, "quantity": "radius_m", "value": 8.038589347556837, "flags": []}, "proof": "4e66884da3bdfb79ac5594a27861f9a025d797903b4d2f127f503fd89a7bc9e96639f499b3eb8e87a6b36e0c3c12d38e"}], "reasons": ["retired_model", "parent_wrong", "seal_wrong", "stop_hidden", "step_wrong", "flag_omitted", "flag_altered", "value_altered"], "precedence": ["retired_model", "parent_wrong", "seal_wrong", "stop_hidden", "step_wrong", "flag_omitted", "flag_altered", "value_altered"], "budget": 4, "forbidden": ["find_flip", "design_run", "run_dataset", "validate_series"]}, "seed": {"kind": "g2_round6_design6_0.15.3", "seed": 20261102606, "note": "Genuine rows are engine v0.15.3 answers; false rows are recorded changes of genuine ones, labelled by precedence, each label recovered from the engine alone. Design: round6/f6_lib.py."}, "reference": {"false_rows": {"R4": "step_wrong", "R5": "seal_wrong", "R8": "flag_altered", "R9": "retired_model"}, "mutations": {"R4": ["steps_landed 344 claimed as 1810, more steps than the request asks for"], "R5": ["proof taken from another run of the same model (ad1969f7ba7bdeb6...)"], "R6": ["genuine: sent with a readout of h_magnitude_nms (not part of the seal)"], "R7": ["genuine: sent with a readout of earth_mars_distance_m (not part of the seal)"], "R8": ["extent of FLAG_OFF_FLOWN_ENTRY on path_sine changed in the 6th significant figure", "genuine difference: sent with a readout of ground_distance_m (not part of the seal)", "flags listed in reversed order"], "R9": ["retired ID plasma_sheath_ramc2"], "R12": ["genuine: sent with a readout of radius_m (not part of the seal)"]}, "genuine": {"R1": {"value": 2.2890861976984564, "outcome": "completed", "stop": null, "steps_landed": 69, "flags": [], "proof": "949c987ad62f835ca215267699517ed2e659b5e776277779896aaf721a03f139d674ea7e0f671e6160f37eaca17eaade"}, "R2": {"value": 1.3960519703767567, "outcome": "ended", "stop": "PastFlightDeployment", "steps_landed": 2115, "flags": [], "proof": "a4065183ea2043a6b9568252634e364467b059fc61f9a23478a29d53c70035b9b199b77f07d277aa257df8e292b9ce3b"}, "R3": {"value": 7320760.59153902, "outcome": "converged", "stop": null, "steps_landed": null, "flags": [], "proof": "eec6980868952c49cd6a1017930f98d396e4452a470c6fa0eacd9b4e00d4aa1c3c32a4c83a59d23ebb96511b2071cec9"}, "R4": {"value": 6394735.022733123, "outcome": "refused", "stop": "RadiusBelowEarthRadius", "steps_landed": 344, "flags": [{"flag": "FLAG_BELOW_COMPARED_RADIUS", "quantity": "radius_m", "extent": 5602264.977266877, "steps": 232}, {"flag": "FLAG_EARTH_SHADOW", "quantity": "distance_from_shadow_axis_m", "extent": 1013479.6278764848, "steps": 36}], "proof": "7d233dcfc07a2e1911dfb85fa0fea029ca687f3514cbba06fdf88864e906828e6417cdfe59a34263e9a9936df3787eeb"}, "R5": {"value": 6.973018347360404, "outcome": "completed", "stop": null, "steps_landed": 105, "flags": [], "proof": "f1293a36f9bf7c32a300cc0f8ba778b46e42d6d14bfd59d6e8c298fa9c9b7d3768f322c6aaff6f08efd3787ce94be59c"}, "R6": {"value": 1.2538931414748378, "outcome": "completed", "stop": null, "steps_landed": 51, "flags": [], "proof": "03d88323f8f93f53797cbc48775f27fd6a07de18484442a71b7150623946a49b71ae478a13981aefc1278e97d0ba94e7"}, "R7": {"value": 360459888729.46576, "outcome": "completed", "stop": null, "steps_landed": 30, "flags": [], "proof": "e584421f53f10db28a78d74a117cfc06b70f10a6cd5a8edfccbd8f76cbd63845b21a93ee0d2b86eac20331f5a33cc32b"}, "R8": {"value": 617475.7093449463, "outcome": "ended", "stop": "PastFlightDeployment", "steps_landed": 2015, "flags": [{"flag": "FLAG_DROGUE_MACH_WINDOW", "quantity": "mach", "extent": 0.3987609440499196, "steps": 195}, {"flag": "FLAG_DROGUE_MACH_WINDOW", "quantity": "mach", "extent": 0.39949110594929116, "steps": 195}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "air_speed_m_s", "extent": 189.96215207054047, "steps": 524}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "air_speed_m_s", "extent": 1431.0624296764208, "steps": 1231}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "path_sine", "extent": 0.040780280423902485, "steps": 1050}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "path_sine", "extent": 0.049833594621743194, "steps": 880}], "proof": "3c2f0b68016777a8ea47683b523e67425743046af710d339be26b0801f7acb6a63bd125f2dc439ead5719719ecc90dbb"}, "R9": {"value": 5.665499503721301e+18, "outcome": "converged", "stop": null, "steps_landed": null, "flags": [], "proof": "0835e993c83234e8ed833a8d39db824f039eb71ea77c309c76720162a6e41a59ccd8190b85384a21a3bb84183f442fbf"}, "R10": {"value": 0.000761549984910976, "outcome": "completed", "stop": null, "steps_landed": 18, "flags": [], "proof": "f3de03ad5a49c1f27c156b8d58a2d143f777aa5fb5c459524b72678085d6f40a16eb5b8dade2b6ec34aa9865f4368bc7"}, "R11": {"value": 2.5762879795193383, "outcome": "completed", "stop": null, "steps_landed": 57, "flags": [], "proof": "647a4baa677e63010302d970dec4c6d51f25ade699b52280cee7ff1ff0403679a724f0e0fd0d7643bf5d0d037e42b424"}, "R12": {"value": 8.038589347556837, "outcome": "completed", "stop": null, "steps_landed": 1635, "flags": [], "proof": "4e66884da3bdfb79ac5594a27861f9a025d797903b4d2f127f503fd89a7bc9e96639f499b3eb8e87a6b36e0c3c12d38e"}}, "engine_source": "https://github.com/johnkruze/zero-trust-physics-engine", "engine_tag": "v0.15.3", "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1", "gateway_version": "0.15.3", "engine_binary_sha256": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076"}} diff --git a/sample/scorer/mcp_stdio_open b/sample/scorer/mcp_stdio_open new file mode 100755 index 0000000000000000000000000000000000000000..b8169a4e9278ce97877a4c6fc05be186b346d501 --- /dev/null +++ b/sample/scorer/mcp_stdio_open @@ -0,0 +1,3 @@ +#!/bin/sh +# The Zero-Trust Physics verifier at its open MCP address, as an MCP stdio server. +exec python3 "$(dirname "$0")/ztp_open_bridge.py" "${ZTP_VERIFIER_URL:-https://mcp.zerotrustphysics.com/mcp}" diff --git a/sample/scorer/pack_score.py b/sample/scorer/pack_score.py new file mode 100644 index 0000000000000000000000000000000000000000..b41382aa52ca13dbeccd56097b08175a0fed19a2 --- /dev/null +++ b/sample/scorer/pack_score.py @@ -0,0 +1,105 @@ +"""Cross-platform release-pinned scorer wrapper for Zero-Trust Physics packs (macOS arm64, Linux amd64, Linux arm64, HTTP). + + python3 pack_score.py REPLIES --engine ENGINE --environments F [score.py's options] [--strict-binary] + python3 pack_score.py --run run_cheat_suite.py [its options] [--strict-binary] + +Verifies that the target verifier answers MCP initialize as release 0.15.3 (matching reference.gateway_version and +engine_tag) on kernel genesis_kernel_v0.13.1, while recording engine_binary_sha256_seen and engine_binary_is_reference on +every score row. Pass --strict-binary to additionally require exact SHA-256 identity with reference.engine_binary_sha256. +All deterministic recomputation, seal, budget, and grading invariants of score.py apply unchanged. + +Standard library only. Licence: Apache-2.0. +""" +import inspect +import os +import re +import runpy +import sys + +HERE = os.path.dirname(os.path.abspath(__file__)) +if HERE not in sys.path: + sys.path.insert(0, HERE) + +KERNEL = "genesis_kernel_v0.13.1" +STRICT = False + + +def _kernel_of(replay): + """The kernel the verifier names: its serverInfo.description is the kernel's name (0.15.2), or one line that ends + with it ("... Cards: genesis_kernel_v0.13.1", 0.15.3).""" + server = getattr(getattr(replay, "verifier", None), "server", None) or {} + found = re.findall(r"genesis_kernel_v[0-9][0-9.]*[0-9]", server.get("description") or "") + return found[-1] if found else server.get("description") + + +def install(strict=False): + """Configure cross-platform release identity verification on score (idempotent). Returns the score module.""" + global STRICT + STRICT = bool(strict) + import score + if getattr(score, "_pack_engine_identity", False): + return score + original = score.engine_problem + original_score = score.score + + def engine_problem(env, replay): + ref = env.get("reference") or {} + want = ref.get("engine_binary_sha256") + seen = getattr(replay, "binary_sha256", None) + if STRICT or not (seen and want and seen != want): + return original(env, replay) + # a different file: held to the release by what it says it is, every other rule as score.py's + saved = replay.binary_sha256 + replay.binary_sha256 = None + try: + problem = original(env, replay) + finally: + replay.binary_sha256 = saved + if problem: + return problem + kernel = _kernel_of(replay) + if kernel != KERNEL: + return "the verifier reports kernel %s; release %s runs %s" % (kernel, replay.version, KERNEL) + return None + + def scored(env, reply, replay, *args, **kwargs): + row = original_score(env, reply, replay, *args, **kwargs) + if isinstance(row, dict): + want = (env.get("reference") or {}).get("engine_binary_sha256") + seen = getattr(replay, "binary_sha256", None) + row["engine_binary_sha256_seen"] = seen + row["engine_binary_is_reference"] = None if not seen else (seen == want) + return row + + # score.py may one day hold its own source-build rule; then it is left as it is + if "strict" in inspect.getsource(original).lower(): + return score + score.engine_problem = engine_problem + score.score = scored + score._pack_engine_identity = True + return score + + +def main(): + argv = sys.argv[1:] + strict = "--strict-binary" in argv + argv = [a for a in argv if a != "--strict-binary"] + if argv[:1] == ["--run"]: + if len(argv) < 2: + sys.exit("give the program: --run run_cheat_suite.py [options]") + program = argv[1] if os.path.isabs(argv[1]) or os.path.isfile(argv[1]) else os.path.join(HERE, argv[1]) + folder = os.path.dirname(os.path.abspath(program)) + if folder not in sys.path: + sys.path.insert(0, folder) + install(strict) + # a program that does `from score import score` takes the replaced function, as the module now holds it + sys.argv = [program] + argv[2:] + runpy.run_path(program, run_name="__main__") + return + score = install(strict) + sys.argv = [os.path.join(HERE, "score.py")] + argv + score.main() + + +if __name__ == "__main__": + main() diff --git a/sample/scorer/prompt.py b/sample/scorer/prompt.py new file mode 100644 index 0000000000000000000000000000000000000000..a97c7cd395c83cb0842e59fcb0161d67a5b1c164 --- /dev/null +++ b/sample/scorer/prompt.py @@ -0,0 +1,194 @@ +"""Print exactly the text an agent is given for one environment: the task, then its family's footer. + + python3 prompt.py --environments F ENVIRONMENT_ID the text for one environment + python3 prompt.py --environments F --list every environment id, one a line + python3 prompt.py --environments F --all FOLDER write FOLDER/.txt for every environment + +Any runner for any model gives the agent this text and nothing else, with the verifier as its +tool server. + +Licence: Apache-2.0. +""" +import json +import os +import sys + +HERE = os.path.dirname(os.path.abspath(__file__)) + +COMMON = """You have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card. + +End your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {"tool": "", "arguments": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.""" + +FOOTERS = { + "tradeoff": COMMON + """ + +The card: +{"passing": {"run": {"request": ..., "proof": ...}, "solve": {"request": ..., "proof": ...}}, "failing": {"run": {"request": ..., "proof": ...}, "solve": {"request": ..., "proof": ...}}, "binding": ""} + +passing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary. Leave out "solve" when the task has no solve. A solve is the one handed its own design's sealed run through the coupling the task names.""", + "chain_design": COMMON + """ + +The card: +{"passing": {"run": {"request": ..., "proof": ...}, "solve": {"request": ..., "proof": ...}}, "failing": {"run": {"request": ..., "proof": ...}, "solve": {"request": ..., "proof": ...}}, "binding": ""} + +passing: the design that keeps the constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks the constraint, no further from passing than the task's tolerance. binding: the id of the constraint. Each solve is the one handed its own design's sealed run through the coupling the task names.""", + "budget": COMMON + """ + +The card: +{"holds": {"request": ..., "proof": ...}, "stops": {"request": ..., "proof": ..., "stopped": ""}} + +holds: a request, the task's request with only the open input set, whose run completes. stops: the same request with another value of that input, whose run stops with the stop the task names. The two values are no further apart than the task's width, and both requests are among the calls you made. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.""", + "forensics": COMMON + """ + +The card: +{"false_rows": {"": "", ...}} + +Name every false row, each with its one reason from value_altered, seal_wrong, flag_omitted, retired_model, stop_hidden. Leave the genuine rows out. {"false_rows": {}} says every row is genuine.""", +} + + +def load_environments(path): + with open(path, encoding="utf-8") as f: + return [json.loads(line) for line in f if line.strip()] + + +STOP_BINDS = """ Where one constraint is that the run completes (it names a stop) and that constraint binds, binding is its id and the failing design also carries "stopped": the stop's name exactly as the verifier gives it, and "step": the last step its run is sealed to (steps_landed), a whole number: {"run": {...}, "stopped": "", "step": }.""" + + +# The design shapes of the 29 Oct 2026 groups, each footer as its group built it (score.design_shape). +CONTINUED_CARRIED = COMMON + """ + +The card: +{"passing": {"run": {"request": ..., "proof": ...}, "next": {"request": ..., "proof": ...}}, "failing": {"run": {"request": ..., "proof": ...}, "next": {"request": ..., "proof": ...}}, "binding": ""} + +passing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary. Each design is two runs: "run" is the first run, and "next" is the run that continues that same sealed run, with "from": {"request": , "run_seal": } and its initial state equal to the first run's final_state, value for value, bit for bit.""" + +CONTINUED_HANDED = COMMON + """ + +The card: +{"passing": {"run": {"request": ..., "proof": ...}, "next": {"request": ..., "proof": ...}}, "failing": {"run": {"request": ..., "proof": ...}, "next": {"request": ..., "proof": ...}}, "binding": ""} + +passing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary. run is the design's first run; next is the run that continues that same sealed run through from: its from holds the first run's request and run_seal, and its start fields are the first run's final state exactly as the verifier returned it.""" + +CONTINUED_CARRY = COMMON + """ + +The card: +{"passing": {"run": {"request": ..., "proof": ...}, "next": {"request": ..., "proof": ...}}, "failing": {"run": {"request": ..., "proof": ...}, "next": {"request": ..., "proof": ...}}, "binding": ""} + +Each design is two runs: run, and next, which continues that design's own sealed run through from (from.request is the run's request, from.run_seal its proof) and starts from its final state. passing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary.""" + +SOLVE_DESIGN = COMMON + """ + +The card: +{"passing": {"solve": {"request": ..., "proof": ...}}, "failing": {"solve": {"request": ..., "proof": ...}}, "binding": ""} + +passing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary. Each design is one solve and no run.""" + +SOLVE_ONLY = COMMON + """ + +The card: +{"passing": {"solve": {"request": ..., "proof": ...}}, "failing": {"solve": {"request": ..., "proof": ...}}, "binding": ""} + +Each design is one solve: leave out "run". passing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary.""" + +STAGED = COMMON + """ + +The card: +{"passing": {%s}, "failing": {%s}, "binding": ""} + +Each design is the requests the task names, one entry each, under the names the task gives them (%s), each with the proof the verifier gave for it. passing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary. A later request that carries an earlier one's answer carries it bit for bit, from that design's own answer.""" + +STAGED_STOP = """ Where one constraint is that a request is not stopped by a named stop and that constraint binds, binding is its id and the failing design also carries "stopped": the stop's name exactly as the verifier gives it%s.""" + +STOP_BINDS_SOLVE = """ Where one constraint is that the solve is not refused by a named stop and that constraint binds, binding is its id and the failing design also carries "stopped": the stop's name exactly as the verifier gives it: {"solve": {...}, "stopped": ""}.""" + +SOLVE_STOP_G4 = """ Where one constraint is that the solve converges (it names a refusal) and that constraint binds, binding is its id and the failing design also carries "stopped": the refusal's name exactly as the verifier gives it: {"solve": {...}, "stopped": ""}.""" + +CARRY_STOP_G5 = (" Where one constraint is that the second run completes (it names a stop) and that constraint binds, binding is its id and the failing design also carries" + " \"stopped\": the stop's name exactly as the verifier gives it, and \"step\": the last step the second run (next) is sealed to (its steps_landed), a whole number:" + " {\"run\": {...}, \"next\": {...}, \"stopped\": \"\", \"step\": }.") + +BUDGET_WORDS = " Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all." + + +def shaped_footer(environment): + """The footer of a design of one of the added shapes, or None for a run or a coupled solve (FOOTERS).""" + family = environment["family"] + check = environment.get("check") or {} + design = check.get("design") or {} + if family not in ("tradeoff", "chain_design"): + return None + chain = design.get("chain") or {} + stops = [c for c in check.get("constraints") or [] if c.get("on") == "outcome"] + if design.get("stages"): # group 3 + stages = design["stages"] + shape = ", ".join('"%s": {"request": ..., "proof": ...}' % st["key"] for st in stages) + footer = STAGED % (shape, shape, ", ".join(st["key"] for st in stages)) + if stops: + runs = any(st["key"] == c.get("stage") and st["tool"] == "run_trajectory" for c in stops for st in stages) + footer += STAGED_STOP % (', and, for a run, "step": the last step its run is sealed to (steps_landed), a whole number' if runs else "") + elif design.get("tool") == "solve": # group 4 + footer = SOLVE_DESIGN + (SOLVE_STOP_G4 if stops else "") + elif design.get("kind") == "solve": # group 5 + footer = SOLVE_ONLY + (STOP_BINDS_SOLVE if stops else "") + elif chain.get("kind") == "continuation" and "carried" in chain: # group 1 + footer = CONTINUED_CARRIED + if stops: + footer += STOP_BINDS + " In a chain the stop and the step are those of the failing design's next run." + elif chain.get("kind") == "continuation": # group 4 + footer = CONTINUED_HANDED + if stops: + footer += STOP_BINDS.replace("the run completes", "the second run completes").replace( + "the last step its run is sealed to", "the last step its next run is sealed to") + elif (chain.get("layout") or {}).get("kind") == "continue": # group 5 + footer = CONTINUED_CARRY + (CARRY_STOP_G5 if stops else "") + else: + return None + if check.get("budget"): + footer += BUDGET_WORDS + return footer + + +def prompt(environment): + """The whole text an agent is given for one environment.""" + family = environment["family"] + shaped = shaped_footer(environment) + if shaped is not None: + return environment["task"] + "\n\n" + shaped + footer = FOOTERS[family] + check = environment.get("check") or {} + if family in ("tradeoff", "chain_design") and any(c.get("on") == "outcome" for c in check.get("constraints") or []): + footer += STOP_BINDS + if family in ("tradeoff", "chain_design", "forensics") and check.get("budget"): + footer += " Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all." + if family == "forensics" and check.get("reasons"): + footer = footer.replace("Name every false row, each with its one reason from value_altered, seal_wrong, flag_omitted, retired_model, stop_hidden.", + "Name every false row, each with its one reason from %s (the first of them, in that order, that is true of the row)." % ", ".join(check["reasons"])) + return environment["task"] + "\n\n" + footer + + +def main(): + argv = sys.argv[1:] + if len(argv) < 3 or argv[0] != "--environments": + sys.exit(__doc__) + environments = load_environments(argv[1]) + argv = argv[2:] + if argv[0] == "--list": + print("\n".join(e["id"] for e in environments)) + elif argv[0] == "--all": + if len(argv) < 2: + sys.exit("give the folder to write into") + os.makedirs(argv[1], exist_ok=True) + for e in environments: + with open(os.path.join(argv[1], e["id"] + ".txt"), "w", encoding="utf-8") as f: + f.write(prompt(e) + "\n") + print("wrote %d prompts to %s" % (len(environments), argv[1])) + else: + found = [e for e in environments if e["id"] == argv[0]] + if not found: + sys.exit("no environment with the id %s; --list names them" % argv[0]) + print(prompt(found[0])) + + +if __name__ == "__main__": + main() diff --git a/sample/scorer/run_cheat_suite.py b/sample/scorer/run_cheat_suite.py new file mode 100644 index 0000000000000000000000000000000000000000..694040c86592b7badbe78b94caa530f935d0f193 --- /dev/null +++ b/sample/scorer/run_cheat_suite.py @@ -0,0 +1,436 @@ +"""Cheat suite: every way of faking an answer, built from the honest reference and scored. Every cheat scores 0. + + python3 run_cheat_suite.py --environments F --reference DIR --engine ENGINE [--only id,id] [--out F] + +DIR holds the honest reference replies made through the harness proxy by run_reference.py: +.txt and .harness.jsonl (made here, on the verifier, for any task that has none). For every +task, each vector below that applies to its family is built from the honest reply and scored by +score.py with the harness log as the call record. The honest reply must score reward 1 and graded 1; +every cheat reward 0 and graded 0. One JSON line per task and vector to --out; exit 1 on any cheat +above 0 or an honest reply below 1. + + honest the reference reply and its harness log (control: 1) + honest_reply_log_matches with a reply-side calls.jsonl equal to the harness log (control: 1) + honest_numbers_respelled the harness log with whole numbers spelt 18 where the card has 18.0 (control: 1) + copied_proof_other_task a proof copied from another task's card + nudged_figure the design value moved inside the bracket, the original proof kept + figure_plus_10_percent the design value times 1.1, the original proof kept + no_request_behind the card with no calls in the harness log (forensics: free calls only) + card_request_not_run the card's request differs from the one the harness log shows was run + edited_call_log a reply-side calls.jsonl that differs from the harness log (a call dropped) + over_budget more computing calls than the budget + forbidden_tool a ruled-out tool (find_flip) in the log + no_harness_log no harness log; only the reply-side log + harness_log_edited the harness log edited after the run (its chain breaks) + stale_engine_tag the task's reference marked as built on engine 0.15.0 + swapped_sides passing and failing (holds and stops) swapped + binding_misnamed another constraint named as binding + proof_from_other_design the failing design (stops side) carrying the passing one's proof + failing_given_as_passing the failing design given for both + proof_uppercase the proof in upper-case hex + extra_argument a request with one argument more than the template + stop_misnamed, step_misnamed the stop or step the card must name, wrong + missing_solve a chained design without its solve (coupled) or its next run (continued) or its + last stage (staged) + solve_handed_other_run a solve (coupled), a next run (continued) or a later stage (staged) handed the other + design's first request and its proof + next_start_rounded continued: the next run's start state rounded to 9 significant figures (as sent) + next_proof_copied continued: the failing design's next proof replaced by the passing design's + next_request_edited continued: the next run's last segment one step longer than the task's (as sent) + +The design shapes (score.design_shape): run, coupled, continued, solve, staged. A vector that edits "the first +request" edits the design's first entry: run, solve, or the first stage. + every_row_genuine forensics: {"false_rows": {}} + every_row_false forensics: every row named false with the first reason + every_row_false_true_reasons forensics: the false rows with their reasons and every genuine row too + +Licence: Apache-2.0. +""" +import argparse +import copy +import json +import math +import os +import sys +import tempfile + +HERE = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, HERE) +from score import (FREE_TOOLS, Replay, canonical, close_verifier, continuation_of, design_shape, # noqa: E402 + load_environments, open_verifier, read_card, read_harness_log, score, set_path, write_harness_log) + + +def respelled(value): + """Whole floats written as ints (18.0 -> 18), as a client may send what a card writes as 18.0.""" + if isinstance(value, dict): + return {k: respelled(v) for k, v in value.items()} + if isinstance(value, list): + return [respelled(v) for v in value] + if isinstance(value, float) and value.is_integer() and abs(value) < 2 ** 53: + return int(value) + return value + + +def computing(calls): + return [(t, a) for t, a in calls if t not in FREE_TOOLS] + + +def replace_call(calls, tool, old, new): + """The log with the first call of tool with arguments old sent with new instead.""" + out, done = [], False + for t, a in calls: + if not done and t == tool and canonical(a) == canonical(old): + out.append((t, new)) + done = True + else: + out.append((t, a)) + if not done: + raise ValueError("the call to replace is not in the log") + return out + + +def parts_of(env): + """The keys of one design on the card, in order, and the tool of each.""" + spec = env["check"]["design"] + shape = design_shape(spec) + if shape == "staged": + return [(st["key"], st["tool"]) for st in spec["stages"]] + return {"solve": [("solve", "solve")], "continued": [("run", "run_trajectory"), ("next", "run_trajectory")], + "coupled": [("run", "run_trajectory"), ("solve", "solve")]}.get(shape, [("run", "run_trajectory")]) + + +def moved_design(env, design, x): + """(design, [(tool, old arguments, new arguments)]): one boundary design with its value set to x.""" + spec = env["check"]["design"] + var = spec["variable"] + shape = design_shape(spec) + new = copy.deepcopy(design) + changes = [] + if shape in ("staged", "solve") or (shape == "continued" and var.get("on") == "next"): + key = var["stage"] if shape == "staged" else ("solve" if shape == "solve" else "next") + tool = dict(parts_of(env))[key] + for place in [var["path"]] + list(var.get("also") or []): + set_path(new[key]["request"]["arguments"], place, x) + return new, [(tool, design[key]["request"]["arguments"], new[key]["request"]["arguments"])] + run_old = design["run"]["request"]["arguments"] + run_new = new["run"]["request"]["arguments"] + if var["kind"] == "entry_angle_deg": + g = math.radians(x) + run_new["initial"]["radial_speed_m_s"] = -var["speed_m_s"] * math.sin(g) + run_new["initial"]["transverse_speed_m_s"] = var["speed_m_s"] * math.cos(g) + elif var.get("on", "run") == "run": + for place in [var["path"]] + list(var.get("also") or []): + set_path(run_new, place, x) + if var.get("on", "run") == "run" or var["kind"] == "entry_angle_deg": + changes.append(("run_trajectory", run_old, run_new)) + for key in ("solve", "next"): + if new.get(key): + new[key]["request"]["arguments"]["from"]["request"] = copy.deepcopy(run_new) + if key == "next": + for place in continuation_of(spec)[3]: + set_path(new[key]["request"]["arguments"], place, x) + changes.append((dict(parts_of(env)).get(key, "solve"), design[key]["request"]["arguments"], + new[key]["request"]["arguments"])) + else: + set_path(new["solve"]["request"]["arguments"], var["path"], x) + changes.append(("solve", design["solve"]["request"]["arguments"], new["solve"]["request"]["arguments"])) + return new, changes + + +def moved_budget(env, side, x): + check = env["check"] + new = copy.deepcopy(side) + for place in [check["variable"]] + list(check.get("also") or []): + set_path(new["request"]["arguments"], place, x) + return new, [(check["tool"], side["request"]["arguments"], new["request"]["arguments"])] + + +def apply_changes(calls, changes): + for tool, old, new in changes: + calls = replace_call(calls, tool, old, new) + return calls + + +def other_proof(env, others, family_tool): + """A proof from another task's honest card, for the same kind of request (any part of any design or side).""" + for other_id, other_card in others: + if other_id == env["id"] or not isinstance(other_card, dict): + continue + for side in ("passing", "failing", "holds", "stops"): + part = other_card.get(side) + candidates = [part] if side in ("holds", "stops") else (list(part.values()) if isinstance(part, dict) else []) + for one in candidates: + if (isinstance(one, dict) and isinstance(one.get("proof"), str) and isinstance(one.get("request"), dict) + and one["request"].get("tool") == family_tool): + return other_id, one["proof"] + return None, None + + +def stale(env): + out = copy.deepcopy(env) + out["reference"]["engine_tag"] = "v0.15.0" + out["reference"]["gateway_version"] = "0.15.0" + return out + + +def edited_log_file(calls, folder): + """A harness log of calls, chained, then one line's arguments edited without its chain.""" + path = os.path.join(folder, "edited.harness.jsonl") + write_harness_log(path, calls) + lines = open(path).read().splitlines() + pick = max(i for i, l in enumerate(lines) if json.loads(l)["tool"] not in FREE_TOOLS) + entry = json.loads(lines[pick]) + entry["arguments"] = dict(entry["arguments"], edited=True) + lines[pick] = json.dumps(entry, sort_keys=True) + open(path, "w").write("\n".join(lines) + "\n") + return read_harness_log(path) + + +def vectors(env, card, calls, others, scratch): + """[(name, expect, env, card, calls, reply_calls, log_problem)] and [(name, why not)].""" + family, check, ref = env["family"], env["check"], env["reference"] + out, skipped = [], [] + add = lambda name, expect, card_, calls_, reply_calls=None, env_=None, log_problem=None: out.append( # noqa: E731 + (name, expect, env_ or env, card_, calls_, reply_calls, log_problem)) + add("honest", 1, card, calls) + add("honest_reply_log_matches", 1, card, calls, reply_calls=list(calls)) + add("honest_numbers_respelled", 1, card, [(t, respelled(a)) for t, a in calls]) + comp = computing(calls) + + # ---- the call record, the same for every family + if family == "forensics": + add("no_request_behind", 0, card, [c for c in calls if c[0] in FREE_TOOLS]) + else: + add("no_request_behind", 0, card, []) + last = max(i for i, c in enumerate(calls) if c[0] not in FREE_TOOLS) + add("edited_call_log", 0, card, calls, reply_calls=calls[:last] + calls[last + 1:]) + if check.get("budget"): + add("over_budget", 0, card, calls + [comp[0]] * (check["budget"] - len(comp) + 1)) + else: + skipped.append(("over_budget", "the task has no call budget")) + forbidden = check.get("forbidden") or [] + if forbidden: + tool = "find_flip" if "find_flip" in forbidden else forbidden[0] + add("forbidden_tool", 0, card, [(tool, {})] + list(calls)) + else: + skipped.append(("forbidden_tool", "the task rules out no tool")) + add("no_harness_log", 0, card, None, reply_calls=list(calls)) + edited_calls, problem = edited_log_file(calls, scratch) + add("harness_log_edited", 0, card, edited_calls, log_problem=problem) + add("stale_engine_tag", 0, card, calls, env_=stale(env)) + + if family in ("tradeoff", "chain_design"): + xp, xf = ref["passing"]["x"], ref["failing"]["x"] + parts = parts_of(env) + first, first_tool = parts[0] + shape = design_shape(check["design"]) + oid, proof = other_proof(env, others, first_tool) + bad = copy.deepcopy(card) + bad["passing"][first]["proof"] = proof + add("copied_proof_other_task", 0, bad, calls) + for name, x in (("nudged_figure", 0.5 * (xp + xf)), ("figure_plus_10_percent", xp * 1.1)): + design, changes = moved_design(env, card["passing"], x) + add(name, 0, dict(card, passing=design), apply_changes(calls, changes)) + design, changes = moved_design(env, card["passing"], 0.5 * (xp + xf)) + add("card_request_not_run", 0, card, apply_changes(calls, changes[:1])) + add("swapped_sides", 0, dict(card, passing=card["failing"], failing=card["passing"]), calls) + other = [c["id"] for c in check["constraints"] if c["id"] != card["binding"]] + add("binding_misnamed", 0, dict(card, binding=other[0] if other else "none"), calls) + bad = copy.deepcopy(card) + for key, _ in parts: + if bad["failing"][key]["proof"] != card["passing"][key]["proof"]: + bad["failing"][key]["proof"] = card["passing"][key]["proof"] + break + add("proof_from_other_design", 0, bad, calls) + add("failing_given_as_passing", 0, dict(card, passing=copy.deepcopy(card["failing"])), calls) + bad = copy.deepcopy(card) + bad["passing"][first]["proof"] = bad["passing"][first]["proof"].upper() + add("proof_uppercase", 0, bad, calls) + bad = copy.deepcopy(card) + bad["passing"][first]["request"]["arguments"]["note"] = "the same run" + changes = [(first_tool, card["passing"][first]["request"]["arguments"], bad["passing"][first]["request"]["arguments"])] + add("extra_argument", 0, bad, apply_changes(calls, changes)) + if card["failing"].get("stopped"): + bad = copy.deepcopy(card) + bad["failing"]["stopped"] = "SomeOtherStop" + add("stop_misnamed", 0, bad, calls) + if "step" in card["failing"]: + bad = copy.deepcopy(card) + bad["failing"]["step"] = card["failing"]["step"] + 1 + add("step_misnamed", 0, bad, calls) + else: + skipped.append(("step_misnamed", "the stop that binds is a solve's: it has no step")) + else: + skipped += [("stop_misnamed", "no stop binds"), ("step_misnamed", "no stop binds")] + if len(parts) > 1: + last = parts[-1][0] + bad = copy.deepcopy(card) + del bad["passing"][last] + add("missing_solve", 0, bad, calls) + # the later request handed the other design's earlier request and proof (or, staged, its later request) + bad = copy.deepcopy(card) + later = bad["passing"][last]["request"]["arguments"] + if shape in ("coupled", "continued"): + later["from"]["run_seal"] = card["failing"]["run"]["proof"] + later["from"]["request"] = copy.deepcopy(card["failing"]["run"]["request"]["arguments"]) + same = card["failing"]["run"]["proof"] == card["passing"]["run"]["proof"] + else: + bad["passing"][last] = copy.deepcopy(card["failing"][last]) + same = card["failing"][parts[0][0]]["proof"] == card["passing"][parts[0][0]]["proof"] + if same: + skipped.append(("solve_handed_other_run", "the two designs share one first request")) + else: + add("solve_handed_other_run", 0, bad, apply_changes(calls, [(parts[-1][1], card["passing"][last]["request"]["arguments"], + bad["passing"][last]["request"]["arguments"])]) + if shape in ("coupled", "continued") else calls) + else: + skipped += [("missing_solve", "a design of one request"), ("solve_handed_other_run", "a design of one request")] + if shape == "continued": + bad = copy.deepcopy(card) + start = bad["failing"]["next"]["request"]["arguments"]["initial"] + for k, v in start.items(): + if isinstance(v, float) and v != 0.0: + start[k] = float("%.9g" % v) + if start == card["failing"]["next"]["request"]["arguments"]["initial"]: + for k, v in start.items(): + if isinstance(v, float): + start[k] = v * (1 + 1e-12) if v else 1e-12 + break + add("next_start_rounded", 0, bad, apply_changes(calls, [("run_trajectory", card["failing"]["next"]["request"]["arguments"], + bad["failing"]["next"]["request"]["arguments"])])) + bad = copy.deepcopy(card) + bad["failing"]["next"]["proof"] = card["passing"]["next"]["proof"] + add("next_proof_copied", 0, bad, calls) + bad = copy.deepcopy(card) + bad["failing"]["next"]["request"]["arguments"]["segments"][-1]["steps"] += 1 + add("next_request_edited", 0, bad, apply_changes(calls, [("run_trajectory", card["failing"]["next"]["request"]["arguments"], + bad["failing"]["next"]["request"]["arguments"])])) + else: + skipped += [(v, "not a continued design") for v in ("next_start_rounded", "next_proof_copied", "next_request_edited")] + skipped += [(v, "forensics only") for v in ("every_row_genuine", "every_row_false", "every_row_false_true_reasons")] + + elif family == "budget": + xh, xs = ref["holds"]["x"], ref["stops"]["x"] + oid, proof = other_proof(env, others, check["tool"]) + bad = copy.deepcopy(card) + bad["holds"]["proof"] = proof + add("copied_proof_other_task", 0, bad, calls) + for name, x in (("nudged_figure", 0.5 * (xh + xs)), ("figure_plus_10_percent", xs * 1.1)): + side, changes = moved_budget(env, card["stops"], x) + add(name, 0, dict(card, stops=side), apply_changes(calls, changes)) + side, changes = moved_budget(env, card["stops"], 0.5 * (xh + xs)) + add("card_request_not_run", 0, card, apply_changes(calls, changes)) + add("swapped_sides", 0, dict(card, holds={k: v for k, v in card["stops"].items() if k != "stopped"}, + stops=dict(card["holds"], stopped=check["stop"])), calls) + bad = copy.deepcopy(card) + bad["stops"]["stopped"] = "SomeOtherStop" + add("stop_misnamed", 0, bad, calls) + bad = copy.deepcopy(card) + bad["stops"]["proof"] = card["holds"]["proof"] + add("proof_from_other_design", 0, bad, calls) + bad = copy.deepcopy(card) + bad["holds"]["proof"] = bad["holds"]["proof"].upper() + add("proof_uppercase", 0, bad, calls) + bad = copy.deepcopy(card) + bad["holds"]["request"]["arguments"]["note"] = "the same run" + add("extra_argument", 0, bad, apply_changes(calls, [(check["tool"], card["holds"]["request"]["arguments"], + bad["holds"]["request"]["arguments"])])) + skipped += [(v, "not a budget card") for v in ("binding_misnamed", "failing_given_as_passing", "step_misnamed", + "missing_solve", "solve_handed_other_run", "every_row_genuine", + "every_row_false", "every_row_false_true_reasons", + "next_start_rounded", "next_proof_copied", "next_request_edited")] + else: + rows = [r["row"] for r in check["rows"]] + reasons = check.get("reasons") or ["value_altered"] + truth = ref["false_rows"] + if truth: + add("every_row_genuine", 0, {"false_rows": {}}, calls) + else: + skipped.append(("every_row_genuine", "the table has no false row: that is the right answer")) + add("every_row_false", 0, {"false_rows": {r: reasons[0] for r in rows}}, calls) + add("every_row_false_true_reasons", 0, {"false_rows": {r: truth.get(r, reasons[0]) for r in rows}}, calls) + skipped += [(v, "a forensics card carries no request or proof") for v in ( + "copied_proof_other_task", "nudged_figure", "figure_plus_10_percent", "card_request_not_run", "swapped_sides", + "binding_misnamed", "proof_from_other_design", "failing_given_as_passing", "proof_uppercase", "extra_argument", + "stop_misnamed", "step_misnamed", "missing_solve", "solve_handed_other_run", + "next_start_rounded", "next_proof_copied", "next_request_edited")] + return out, skipped + + +def ensure_reference(env, folder, engine): + reply_path = os.path.join(folder, env["id"] + ".txt") + log_path = os.path.join(folder, env["id"] + ".harness.jsonl") + if os.path.isfile(reply_path) and os.path.isfile(log_path): + return + from run_reference import proxied, reference_reply + verifier = proxied(engine, log_path) + try: + reply, calls = reference_reply(env, verifier) + finally: + close_verifier(verifier) + open(reply_path, "w", encoding="utf-8").write(reply + "\n") + + +def main(): + parser = argparse.ArgumentParser(description=__doc__.split("\n")[0]) + parser.add_argument("--environments", required=True) + parser.add_argument("--reference", required=True) + parser.add_argument("--engine", required=True) + parser.add_argument("--only") + parser.add_argument("--out") + args = parser.parse_args() + environments = load_environments(args.environments) + os.makedirs(args.reference, exist_ok=True) + for env in environments: + ensure_reference(env, args.reference, args.engine) + honest = {} + for env in environments: + card, problem = read_card(open(os.path.join(args.reference, env["id"] + ".txt"), encoding="utf-8").read()) + calls, log_problem = read_harness_log(os.path.join(args.reference, env["id"] + ".harness.jsonl")) + if problem or log_problem or calls is None: + sys.exit("the honest reference of %s cannot be read: %s" % (env["id"], problem or log_problem or "no harness log")) + honest[env["id"]] = (card, calls) + others = [(i, c) for i, (c, _) in honest.items()] + if args.only: + wanted = set(args.only.split(",")) + environments = [e for e in environments if e["id"] in wanted] + verifier = open_verifier(args.engine) + rows, failures, by_vector = [], 0, {} + scratch = tempfile.mkdtemp(prefix="ztp_cheats_") + try: + for env in environments: + card, calls = honest[env["id"]] + replay = Replay(verifier) + built, skipped = vectors(env, card, calls, others, scratch) + for name, expect, env_, card_, calls_, reply_calls, log_problem in built: + row = score(env_, "A reply.\n\n" + json.dumps(card_), replay, calls_, reply_calls, "harness", log_problem) + ok = (row["reward"] == 1 and row["graded"] == 1.0) if expect else (row["reward"] == 0 and row["graded"] == 0.0) + failures += not ok + one = {"task": env["id"], "family": env["family"], "vector": name, "applies": True, "expect": expect, + "reward": row["reward"], "graded": row["graded"], "verdict": row["verdict"], "reason": row["reason"], "ok": ok} + rows.append(one) + tally = by_vector.setdefault(name, [0, 0, 0]) + tally[0] += 1 + tally[1] += not ok + print("%-4s %-52s %-30s reward %d graded %.4f %s" % ("ok" if ok else "FAIL", env["id"], name, row["reward"], + row["graded"], (row["reason"] or "")[:110]), flush=True) + for name, why in skipped: + rows.append({"task": env["id"], "family": env["family"], "vector": name, "applies": False, "why": why}) + by_vector.setdefault(name, [0, 0, 0])[2] += 1 + finally: + close_verifier(verifier) + if args.out: + with open(args.out, "w", encoding="utf-8") as f: + for row in rows: + f.write(json.dumps(row) + "\n") + print("\n%-30s %6s %6s %6s" % ("vector", "tasks", "fail", "n/a")) + for name in sorted(by_vector): + print("%-30s %6d %6d %6d" % (name, *by_vector[name])) + scored = [r for r in rows if r["applies"]] + print("\n%d tasks, %d scored attempts (%d honest controls, %d cheats); %d failures" % ( + len(environments), len(scored), sum(1 for r in scored if r["expect"]), sum(1 for r in scored if not r["expect"]), failures)) + sys.exit(1 if failures else 0) + + +if __name__ == "__main__": + main() diff --git a/sample/scorer/run_naive.py b/sample/scorer/run_naive.py new file mode 100644 index 0000000000000000000000000000000000000000..a8ccc29abc9ddf51103db6cfd37254367bddbb1a --- /dev/null +++ b/sample/scorer/run_naive.py @@ -0,0 +1,175 @@ +"""A one-call agent: one forward request at a plausible default, and its answer reported. + + python3 run_naive.py --engine ENGINE --environments F --out DIR [--only id,id] + +It shows what a single tool call earns on a set. For a tradeoff or chain_design environment it sends +one run at the middle of the design's range (no solve: one call) and gives it as both designs; a staged design +sends its first stage's request that way, and a solve design a solve. For a +budget environment it sends the task's request at the middle of the stated span and gives it as both +sides, naming the task's stop. For a forensics table it sends the first row's request and calls every +row genuine. Calls go through harness/mcp_log_proxy.py, as in run_reference.py. + + python3 score.py DIR --engine ENGINE --environments F --calls-from harness + python3 run_naive.py --gate DIR --environments F --scores F + +--gate reads what the run left. A task with no reply, no logged call, or no score row, or a score of "the reply is empty", +stops it with exit 1: a 0 with nothing behind it is not a one-call score. It prints the counts, solve-shape rows and calls +the verifier answered with an error among them. + +Licence: Apache-2.0. +""" +import argparse +import copy +import json +import math +import os +import sys + +HERE = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, HERE) +from run_reference import proxied # noqa: E402 +from score import close_verifier, load_environments, open_verifier, set_path # noqa: E402 + +DEFAULTS = {"aerospace/capsule_stardust": 8.21, "energy/reactor_triga_jsi": 2.5, "energy/reactor_spert3": 1.0, + "energy/cell_2170_model3": 5.0, "energy/grid_gb": 1000.0} + + +def middle(env, spec): + if spec.get("range"): + return 0.5 * sum(spec["range"]) + if env["models"][0] in DEFAULTS: + return DEFAULTS[env["models"][0]] + return float(env["reference"]["boundary"]) * 0.9 # a guess near the answer, one call only + + +def naive_reply(env, verifier): + calls = [] + family = env["family"] + if family in ("tradeoff", "chain_design"): + spec = env["check"]["design"] + var = spec["variable"] + if spec.get("stages") or spec.get("tool") == "solve" or spec.get("kind") == "solve": + # a staged design has no check.design.template (its first stage is sent), and a solve design is sent as a solve, not a run + key, tool, template = (spec["stages"][0]["key"], spec["stages"][0]["tool"], spec["stages"][0]["template"]) if spec.get("stages") else ("solve", "solve", spec["template"]) + q = copy.deepcopy(template) + if not spec.get("stages") or var.get("stage") == key: + for place in [var["path"]] + list(var.get("also") or []): + set_path(q, place, middle(env, spec)) + calls.append({"tool": tool, "arguments": q}) + body, is_error = verifier.call_json(tool, q) + proof = (body.get("run_seal") or body.get("solution_seal")) if isinstance(body, dict) else None + one = {key: {"request": {"tool": tool, "arguments": q}, "proof": proof}} + card = {"passing": one, "failing": one, "binding": env["check"]["constraints"][0]["id"]} + return "One request at the middle of the range.\n\n" + json.dumps(card), calls + run = copy.deepcopy(spec["template"]) + if var["kind"] == "entry_angle_deg": + g = math.radians(middle(env, spec)) + run["initial"]["radial_speed_m_s"] = -var["speed_m_s"] * math.sin(g) + run["initial"]["transverse_speed_m_s"] = var["speed_m_s"] * math.cos(g) + elif var.get("on", "run") == "run" and var["path"].startswith("initial.start_temperature_k"): + set_path(run, var["path"], 296.15) + elif var.get("on", "run") == "run": + value = middle(env, spec) + for place in [var["path"]] + list(var.get("also") or []): + set_path(run, place, value) + calls.append({"tool": "run_trajectory", "arguments": run}) + body, is_error = verifier.call_json("run_trajectory", run) + proof = body.get("run_seal") if isinstance(body, dict) else None + one = {"run": {"request": {"tool": "run_trajectory", "arguments": run}, "proof": proof}} + card = {"passing": one, "failing": one, "binding": env["check"]["constraints"][0]["id"]} + words = "One run at the default design." + elif family == "budget": + lo, hi = env["reference"].get("span") or (env["reference"]["boundary"] * 0.9, env["reference"]["boundary"] * 1.1) + request = copy.deepcopy(env["check"]["template"]) + for place in [env["check"]["variable"]] + list(env["check"].get("also") or []): + set_path(request, place, 0.5 * (lo + hi)) + calls.append({"tool": env["check"]["tool"], "arguments": request}) + body, is_error = verifier.call_json(env["check"]["tool"], request) + proof = (body.get("run_seal") or body.get("solution_seal")) if isinstance(body, dict) else None + side = {"request": {"tool": env["check"]["tool"], "arguments": request}, "proof": proof} + card = {"holds": side, "stops": dict(side, stopped=env["check"]["stop"])} + words = "One run at the middle of the span." + else: + first = env["check"]["rows"][0]["request"] + calls.append(first) + verifier.call_json(first["tool"], first["arguments"]) + card = {"false_rows": {}} + words = "The first row came back; every row is taken as genuine." + return words + "\n\n" + json.dumps(card), calls + + +def gate(folder, environments_path, scores_path): + environments = load_environments(environments_path) + scores = {} + if os.path.isfile(scores_path): + with open(scores_path, encoding="utf-8") as f: + scores = {r["id"]: r for r in (json.loads(line) for line in f if line.strip())} + missing, errors, solve_shape, staged = [], 0, 0, 0 + for env in environments: + tid = env["id"] + spec = env["check"].get("design") or {} + staged += bool(spec.get("stages")) + solve_shape += spec.get("tool") == "solve" or spec.get("kind") == "solve" or env["check"].get("tool") == "solve" + reply = os.path.join(folder, tid + ".txt") + log = os.path.join(folder, tid + ".harness.jsonl") + lines = [] + if os.path.isfile(log): + with open(log, encoding="utf-8") as f: + lines = [json.loads(line) for line in f if line.strip()] + errors += sum(1 for line in lines if line.get("is_error")) + row = scores.get(tid) + if not os.path.isfile(reply) or not open(reply, encoding="utf-8").read().strip(): + missing.append(tid + " (no reply)") + elif not lines: + missing.append(tid + " (no call)") + elif row is None: + missing.append(tid + " (no score)") + elif row.get("reason") == "the reply is empty": + missing.append(tid + " (empty reply)") + rows = [scores[e["id"]] for e in environments if e["id"] in scores] + print("one-call agent: replied on %d of %d; reward above 0 on %d, graded above 0 on %d; solve-shape rows %d, staged rows %d; calls answered with an error %d" % ( + len(environments) - len(missing), len(environments), sum(1 for r in rows if r.get("reward")), sum(1 for r in rows if r.get("graded")), solve_shape, staged, errors)) + if missing: + sys.exit("NOT a one-call score: " + ", ".join(missing[:8])) + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--engine") + parser.add_argument("--environments", required=True) + parser.add_argument("--out") + parser.add_argument("--only") + parser.add_argument("--direct", action="store_true") + parser.add_argument("--gate", metavar="DIR") + parser.add_argument("--scores") + args = parser.parse_args() + if args.gate: + return gate(args.gate, args.environments, args.scores or "") + if not args.engine or not args.out: + parser.error("give --engine and --out") + environments = load_environments(args.environments) + if args.only: + wanted = set(args.only.split(",")) + environments = [e for e in environments if e["id"] in wanted] + os.makedirs(args.out, exist_ok=True) + shared = open_verifier(args.engine) if args.direct else None + try: + for env in environments: + verifier = shared or proxied(args.engine, os.path.join(args.out, env["id"] + ".harness.jsonl")) + try: + reply, calls = naive_reply(env, verifier) + finally: + if not shared: + close_verifier(verifier) + with open(os.path.join(args.out, env["id"] + ".txt"), "w", encoding="utf-8") as f: + f.write(reply + "\n") + with open(os.path.join(args.out, env["id"] + ".calls.jsonl"), "w", encoding="utf-8") as f: + for c in calls: + f.write(json.dumps(c) + "\n") + finally: + if shared: + close_verifier(shared) + + +if __name__ == "__main__": + main() diff --git a/sample/scorer/run_reference.py b/sample/scorer/run_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..0dc7d591e31fb27d4a9ccc2c2a50f5436eb503b2 --- /dev/null +++ b/sample/scorer/run_reference.py @@ -0,0 +1,208 @@ +"""An agent with no model in it: answer every environment from its reference, through the harness proxy. + + python3 run_reference.py --engine ENGINE --environments F --out DIR [--only id,id] [--direct] + +For a tradeoff or chain_design environment it sends the reference passing and failing runs to the +verifier, hands each run to its solve through the task's coupling where the task has one, and writes +the card with the seals this verifier gives. For a budget environment it sends the two reference +requests. For a forensics table it puts the table to the verifier (each row's request as sent, up to +the task's budget) and names the false rows the build recorded. + +Every call goes through harness/mcp_log_proxy.py, started in an empty working folder, so the +authoritative call record is DIR/.harness.jsonl, as in a pass@k attempt. The same calls are also +written beside the reply, DIR/.calls.jsonl. --direct talks to ENGINE with no proxy and writes the +reply-side log only. + + python3 score.py DIR --engine ENGINE --environments F --calls-from harness + +Licence: Apache-2.0. +""" +import argparse +import copy +import json +import os +import subprocess +import sys +import tempfile + +HERE = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, HERE) +import chainlib # noqa: E402 +from score import (FREE_TOOLS, NOT_STOPPED, build_stage_request, close_verifier, continuation_of, design_shape, # noqa: E402 + file_sha256, get_path, load_environments, open_verifier) +from ztp_mcp import McpError, StdioVerifier # noqa: E402 + +PROXY = os.path.join(HERE, "..", "harness", "mcp_log_proxy.py") + + +class ProxiedVerifier(StdioVerifier): + """The engine behind the logging proxy, the proxy started in its own empty working folder.""" + + def __init__(self, engine, log, cwd=None, **kwargs): + self.cwd = cwd or tempfile.mkdtemp(prefix="ztp_ref_cwd_") + if engine.startswith("http://") or engine.startswith("https://"): + # an MCP address: the proxy runs the stdio bridge to it (ztp_open_bridge.py, beside this file) + child = [sys.executable, os.path.join(HERE, "ztp_open_bridge.py"), engine] + else: + child = [os.path.abspath(engine)] + command = [sys.executable, os.path.abspath(PROXY), "--log", os.path.abspath(log), "--"] + child + super(StdioVerifier, self).__init__(url="stdio: " + " ".join(command), timeout_s=600, **kwargs) + self.proc = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, cwd=self.cwd) + self.binary_sha256 = None if len(child) > 1 else file_sha256(engine) + + def close(self): + try: + self.proc.stdin.close() + except OSError: + pass + try: + self.proc.wait(timeout=60) + except subprocess.TimeoutExpired: + self.proc.kill() + + +def proxied(engine, log, cwd=None): + if os.path.exists(log): + os.remove(log) + verifier = ProxiedVerifier(engine, log, cwd) + try: + verifier.connect() + except McpError as problem: + sys.exit("the proxied verifier failed: %s" % problem) + return verifier + + +class Logged: + def __init__(self, verifier): + self.verifier, self.calls, self.seen = verifier, [], {} + + def call(self, tool, arguments, refused_ok=False): + # the same request twice is one call: a chain with its value in the next run has one first run for both designs + key = json.dumps([tool, arguments], sort_keys=True) + if key in self.seen and not self.seen[key][1]: + return self.seen[key][0] + self.calls.append({"tool": tool, "arguments": arguments}) + body, is_error = self.verifier.call_json(tool, arguments) + self.seen[key] = (body, is_error) + if is_error and not refused_ok: + raise SystemExit("the reference request was refused: %s %s" % (tool, str(body)[:300])) + return body + + +def design_staged(env, ref, agent): + """A staged design: each stage sent in order, handed values and continuations built from this verifier's answers.""" + spec = env["check"]["design"] + answers, requests, out = {}, {}, {} + for stage in spec["stages"]: + q = build_stage_request(spec, stage, ref["x"], answers, requests) + body = agent.call(stage["tool"], q, refused_ok=True) + stopped = body.get("outcome") not in NOT_STOPPED + answers[stage["key"]] = {"body": body, "proof": body.get("run_seal") or body.get("solution_seal"), + "outcome": body.get("outcome"), "stop": body.get("reject") if stopped else None, "stopped": stopped} + requests[stage["key"]] = q + out[stage["key"]] = {"request": {"tool": stage["tool"], "arguments": q}, "proof": answers[stage["key"]]["proof"]} + return out + + +def design(env, ref, agent): + spec = env["check"]["design"] + shape = design_shape(spec) + if shape == "staged": + return design_staged(env, ref, agent) + if shape == "solve": + solved = agent.call("solve", ref["solve"], refused_ok=True) + return {"solve": {"request": {"tool": "solve", "arguments": ref["solve"]}, "proof": solved["solution_seal"]}} + run_args = ref["run"] + run = agent.call("run_trajectory", run_args) + out = {"run": {"request": {"tool": "run_trajectory", "arguments": run_args}, "proof": run["run_seal"]}} + if shape == "continued": + # the run that continues this design's own sealed run: the reference's next run, its start fields and from + # set from this verifier's answer to the first run + _, carried, _, _ = continuation_of(spec) + next_args = copy.deepcopy(ref["next"]) + next_args["initial"] = {name: get_path(run, source) for name, source in carried.items()} + next_args["from"] = {"request": run_args, "run_seal": run["run_seal"]} + nxt = agent.call("run_trajectory", next_args, refused_ok=True) + out["next"] = {"request": {"tool": "run_trajectory", "arguments": next_args}, "proof": nxt["run_seal"]} + elif spec.get("chain"): + overrides = {} + if spec["variable"]["kind"] == "path" and spec["variable"].get("on") == "solve": + overrides[spec["variable"]["path"].split(".", 1)[1]] = ref["x"] + solve_args = chainlib.chained_solve(spec["chain"], run_args, run, overrides) + solved = agent.call("solve", solve_args) + out["solve"] = {"request": {"tool": "solve", "arguments": solve_args}, "proof": solved["solution_seal"]} + return out + + +def reference_reply(env, verifier): + """(reply text, calls [{"tool", "arguments"}]).""" + agent = Logged(verifier) + family, ref = env["family"], env["reference"] + if family in ("tradeoff", "chain_design"): + card = {"passing": design(env, ref["passing"], agent), "failing": design(env, ref["failing"], agent), "binding": ref["binding"]} + if ref["failing"].get("stopped"): + card["failing"]["stopped"] = ref["failing"]["stopped"] + if ref["failing"].get("steps_landed") is not None: + card["failing"]["step"] = ref["failing"]["steps_landed"] + words = "The boundary lies between the two designs below; %s binds." % ref["binding"] + elif family == "budget": + card = {} + for side in ("holds", "stops"): + request = ref[side]["request"] + answer = agent.call(request["tool"], request["arguments"]) + card[side] = {"request": request, "proof": answer.get("run_seal") or answer.get("solution_seal")} + card["stops"]["stopped"] = env["check"]["stop"] + words = "The stop %s lies between the two requests below." % env["check"]["stop"] + else: + agent.call("list_cards", {}, refused_ok=True) + rows = env["check"]["rows"] + budget = env["check"].get("budget") or len(rows) + computing = 0 + for row in rows: + request = row["request"] + if computing >= budget: + break + if request["tool"] in FREE_TOOLS: + continue + agent.call(request["tool"], request["arguments"], refused_ok=True) + computing += 1 + card = {"false_rows": ref["false_rows"]} + words = "%d of the %d rows are false." % (len(ref["false_rows"]), len(rows)) + return words + "\n\n" + json.dumps(card), agent.calls + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--engine", required=True) + parser.add_argument("--environments", required=True) + parser.add_argument("--out", required=True) + parser.add_argument("--only") + parser.add_argument("--direct", action="store_true", help="no proxy: the reply-side log only") + args = parser.parse_args() + environments = load_environments(args.environments) + if args.only: + wanted = set(args.only.split(",")) + environments = [e for e in environments if e["id"] in wanted] + os.makedirs(args.out, exist_ok=True) + shared = open_verifier(args.engine) if args.direct else None + try: + for env in environments: + verifier = shared or proxied(args.engine, os.path.join(args.out, env["id"] + ".harness.jsonl")) + try: + reply, calls = reference_reply(env, verifier) + finally: + if not shared: + close_verifier(verifier) + with open(os.path.join(args.out, env["id"] + ".txt"), "w", encoding="utf-8") as f: + f.write(reply + "\n") + with open(os.path.join(args.out, env["id"] + ".calls.jsonl"), "w", encoding="utf-8") as f: + for c in calls: + f.write(json.dumps(c) + "\n") + print("%-60s %d calls" % (env["id"], len(calls)), flush=True) + finally: + if shared: + close_verifier(shared) + + +if __name__ == "__main__": + main() diff --git a/sample/scorer/score.py b/sample/scorer/score.py new file mode 100644 index 0000000000000000000000000000000000000000..4403f043313037d26927b89db218b4718ffcf3d2 --- /dev/null +++ b/sample/scorer/score.py @@ -0,0 +1,1199 @@ +"""Score replies to the multi-step environments with no judge: a program and the verifier. + + python3 score.py REPLIES --engine ENGINE [--environments F] [--only id,id] [--out F] + [--calls-from reply|harness] [--harness-dir DIR] + + REPLIES is a folder with one file per environment, .txt, the whole text of a reply. + --calls-from harness the call record is the harness's own: .harness.jsonl, written by + harness/mcp_log_proxy.py outside the solver's working directory (in + --harness-dir, default REPLIES). A .calls.jsonl beside the reply, + when there is one, is read only to catch an edit: it must equal the + harness log call for call. + --calls-from reply (the earlier set's way) the call record is .calls.jsonl beside the reply: + one JSON object a line, {"tool": "", "arguments": {...}}. + + ENGINE is the verifier: the path to mcp_stdio (MCP over stdio, no network), or an MCP address + beginning http. A task is scored only on the engine it was built on: the verifier's version must + be the task's reference.gateway_version (engine_tag), and a local binary's SHA-256 the task's + reference.engine_binary_sha256. + +The answer card is one JSON object on the reply's last line. Its shape is the family's: + + tradeoff, chain_design (kind design_to_limit, chained_design) + {"passing": DESIGN, "failing": DESIGN, "binding": ""} + DESIGN = {"run": {"request": R, "proof": ""}, + "solve": {"request": R, "proof": ""}} (solve only where the task has one) + Where a constraint is that the run completes and it binds, the failing DESIGN also carries + "stopped": "" and "step": . R = {"tool": ..., "arguments": {...}} + The design shapes, one scorer for every group (check.design says which): + run a run alone. + coupled check.design.chain names a solver and coupling: the run, then a solve handed that sealed run. + continued check.design.chain.kind "continuation", or chain.layout.kind "continue": the run, then a run of + the same card that continues it through from, starting from its sealed final state, + DESIGN = {"run": {...}, "next": {"request": R, "proof": ""}}. The next run's template + is chain.next_template, chain.template or chain.next; its start fields are chain.carried + ({field: where the first run's answer holds it}), chain.handed (with chain.handed_from) or + chain.carry and chain.clock, each equal to the first run's answer bit for bit. A constraint on + "next" reads the next run, and a stop constraint judges it. + solve check.design.tool or check.design.kind "solve": DESIGN = {"solve": {...}}, one solve and no + run. A binding refusal is named ("stopped") with no step. + staged check.design.stages: DESIGN = {"": {"request": R, "proof": ...}, ...}, one entry per + stage in order; a later stage carries an earlier stage's answer at a named input (handed) or + continues an earlier run (continues), bit for bit. + A constraint's read may carry "index": one entry of an output the verifier returns as a list. + budget (kind budgeted_search) + {"holds": {"request": R, "proof": ""}, + "stops": {"request": R, "proof": "", "stopped": ""}} + forensics + {"false_rows": {"": "", ...}} ({} when every row is genuine) + +Every proof is verified on the verifier (verify_tape for a run_seal, verify_solution for a +solution_seal, short form) and every number judged is read from the verifier's own answer to the +card's request, sent again here, never from the reply. + +Scores per environment +---------------------- +reward 0 or 1, exactly as the earlier scorer: 1 only when correct and proofs_hold are both 1. + proofs_hold: every proof on the card verifies. correct: the card is the right answer and + nothing below under "integrity" failed. +graded in [0, 1], beside reward. + + Integrity (graded 0 and reward 0, whatever the answer): the card cannot be read; a proof does not + verify (a copied, nudged, edited or stale proof); a request differs from the task's template other + than at the design variable; a chained solve not handed its own design's sealed run; no call log; + a call log beside the reply that differs from the harness log; a harness log whose chain breaks; + a forbidden tool called; more computing calls than the budget; a request on the card that is not + among the calls; a forensics answer with no computing call behind it; a task built on another + engine than the verifier. + + tradeoff, chain_design, budget. With integrity held, the sides are judged on the verifier: the + passing design meets every constraint and the failing one breaks the named binding constraint + (budget: holds completes, stops ends with the task's stop, named on the card), on the side the + task asks for, inside its range, with any stop and step the card must name. Wrong sides score 0. + With the sides right: + + e = the length of the smallest interval holding both designs' values and the reference + boundary (for a bracket that straddles the boundary, its width) + tol = the task's tolerance (tradeoff, chain_design) or relative width x |boundary| (budget) + r = e / tol + graded = 1 when reward is 1 (r <= 1 and the bracket straddles it) + = 0.5 ** log10(r) when r > 1: each tenfold of looseness halves the score + (r 1.35 -> 0.914, 2 -> 0.811, 10 -> 0.5, 100 -> 0.25) + = 0.5 when r <= 1 but the bracket misses the reference boundary + by more than the slack (another crossing than the one asked) + + The decay is smooth and falls monotonically with r, and a near miss scores near the top. + + forensics. With integrity held, graded is F1 over the (row, reason) pairs: a row counts as found + only with its right reason. precision = found / named, recall = found / false rows; an empty + answer to a table with no false row scores 1. A card that names every row of the table false is + a blanket answer and scores 0, as do unknown rows and reasons outside the task's list. + +Licence: Apache-2.0. +""" +import argparse +import copy +import hashlib +import json +import math +import os +import re +import sys + +HERE = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, HERE) +from ztp_mcp import McpError, StdioVerifier, Verifier # noqa: E402 + +FAMILIES = ("tradeoff", "chain_design", "budget", "forensics") +KINDS = {"tradeoff": "design_to_limit", "chain_design": "chained_design", "budget": "budgeted_search", "forensics": "forensics"} +NOT_STOPPED = ("completed", "converged") +PREFIX_ENDS = ("__", ".", ":", "/") +VERIFIER_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite", + "run_trajectory", "compute_step", "verify_step", "design_run", "solve", "run_dataset", + "validate_series", "verify_tape", "verify_solution", "verify_dataset", "verify_receipt", "find_flip") +# Calls that read the catalogue compute nothing and are free in a call budget. +FREE_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite", "verify_receipt") +REASONS = ("value_altered", "seal_wrong", "flag_omitted", "retired_model", "stop_hidden") +GRADED_DECAY = 0.5 # graded = GRADED_DECAY ** log10(r) +OTHER_CROSSING = 0.5 # right sides, tight, around another crossing than the reference boundary + + +class Integrity(Exception): + """The answer cannot be trusted: graded 0 and reward 0.""" + + +class Wrong(Exception): + """The answer is trusted and wrong: graded 0 and reward 0.""" + + +def load_environments(path): + with open(path, encoding="utf-8") as f: + return [json.loads(line) for line in f if line.strip()] + + +def row_problems(env): + """What a task row lacks against the shared row contract (empty when none).""" + out = [] + for key in ("id", "family", "models", "real_thing", "task", "check", "seed", "reference"): + if key not in env: + out.append("no %s" % key) + family = env.get("family") + if family not in FAMILIES: + out.append("family %r" % family) + elif "kind" in env and env["kind"] != KINDS[family]: + out.append("kind %r for family %s (want %s)" % (env["kind"], family, KINDS[family])) + ref = env.get("reference") or {} + for key in ("engine_tag", "engine_commit", "engine_binary_sha256"): + if not ref.get(key): + out.append("reference.%s missing" % key) + return out + + +def file_sha256(path): + h = hashlib.sha256() + with open(path, "rb") as f: + for block in iter(lambda: f.read(1 << 20), b""): + h.update(block) + return h.hexdigest() + + +def open_verifier(engine): + if engine.startswith("http://") or engine.startswith("https://"): + verifier = Verifier(engine, pause_s=0.5) + verifier.binary_sha256 = None + else: + if not os.path.isfile(engine): + sys.exit("no file at %s: give the path to mcp_stdio, or an MCP address beginning http" % engine) + verifier = StdioVerifier([engine]) + verifier.binary_sha256 = file_sha256(engine) + try: + verifier.connect() + except McpError as problem: + sys.exit("the verifier failed, so nothing was scored: %s" % problem) + if not isinstance(verifier.server, dict) or not verifier.server.get("name"): + close_verifier(verifier) + sys.exit("the verifier failed, so nothing was scored: %s did not answer as an MCP server" % engine) + return verifier + + +def close_verifier(verifier): + if hasattr(verifier, "close"): + verifier.close() + + +# ------------------------------------------------------------------------------------------ +# reading the reply and the call logs +# ------------------------------------------------------------------------------------------ +def _no_constant(name): + raise ValueError("%s is not a number" % name) + + +def read_card(reply): + """(card, problem): the JSON object on the reply's last line. A closing code fence is passed over.""" + lines = [line.strip() for line in (reply or "").replace("\r", "\n").split("\n") if line.strip()] + while lines and lines[-1].startswith("```"): + lines.pop() + if not lines: + return None, "the reply is empty" + try: + card = json.loads(lines[-1], parse_constant=_no_constant) + except ValueError: + return None, "the last line is not one JSON object" + if not isinstance(card, dict): + return None, "the last line is not one JSON object" + return card, None + + +def tool_name(name): + """The verifier's own name for a tool an agent's program may have prefixed (mcp__zerotrust__solve).""" + if not isinstance(name, str): + return None + if name in VERIFIER_TOOLS: + return name + for tool in VERIFIER_TOOLS: + for joint in PREFIX_ENDS: + if name.endswith(joint + tool): + return tool + return name + + +def without_readout(arguments): + """A run's arguments as sealed: a readout is not part of a run's seal.""" + if not isinstance(arguments, dict): + return arguments + return {k: v for k, v in arguments.items() if k != "readout"} + + +def numbers_by_value(value): + """Every number as a float, so 18 and 18.0 (one request to the engine) compare equal; bools kept.""" + if isinstance(value, dict): + return {k: numbers_by_value(v) for k, v in value.items()} + if isinstance(value, list): + return [numbers_by_value(v) for v in value] + if isinstance(value, int) and not isinstance(value, bool): + return float(value) + return value + + +def canonical(arguments): + """A request's arguments as compared with the call log: no readout, keys sorted, numbers by value.""" + return json.dumps(numbers_by_value(without_readout(arguments)), sort_keys=True, separators=(",", ":")) + + +def _arguments(one): + arguments = one.get("arguments") + if isinstance(arguments, str): + try: + arguments = json.loads(arguments) + except ValueError: + arguments = {} + return arguments if isinstance(arguments, dict) else {} + + +def read_calls(path): + """Every call in a reply-side call log, [(tool, arguments)], or None when there is no log.""" + if not path or not os.path.isfile(path): + return None + calls = [] + with open(path, encoding="utf-8", errors="replace") as f: + for line in f: + line = line.strip() + if not line: + continue + try: + one = json.loads(line) + except ValueError: + continue + if isinstance(one, dict): + calls.append((tool_name(one.get("tool")), _arguments(one))) + return calls + + +def chain_of(previous, entry): + payload = json.dumps(entry, sort_keys=True, separators=(",", ":")) + return hashlib.sha384(((previous or "") + payload).encode("utf-8")).hexdigest() + + +def read_harness_log(path): + """(calls, problem) from a log written by harness/mcp_log_proxy.py. calls is None when there is no log; + problem names the first line whose chain does not follow (an edit, a line taken out or put in).""" + if not path or not os.path.isfile(path): + return None, None + calls, previous = [], None + with open(path, encoding="utf-8", errors="replace") as f: + for number_, line in enumerate(f, 1): + if not line.strip(): + continue + try: + entry = json.loads(line) + except ValueError: + return calls, "line %d of the harness log is not JSON" % number_ + if not isinstance(entry, dict) or "chain" not in entry: + return calls, "line %d of the harness log carries no chain" % number_ + chain = entry.pop("chain") + if chain != chain_of(previous, entry) or entry.get("seq") != len(calls) + 1: + return calls, "the harness log's chain breaks at line %d" % number_ + previous = chain + calls.append((tool_name(entry.get("tool")), _arguments(entry))) + return calls, None + + +def write_harness_log(path, calls): + """A chained log in the proxy's format, for tests and the cheat suite: calls [(tool, arguments)].""" + previous = None + with open(path, "w", encoding="utf-8") as f: + for seq, (tool, arguments) in enumerate(calls, 1): + entry = {"seq": seq, "jsonrpc_id": seq, "tool": tool, "arguments": arguments, "ts_request": None, + "ts_response": None, "duration_s": None, "response_sha384": None, "text_sha384": None, "is_error": False} + entry["chain"] = chain_of(previous, entry) + previous = entry["chain"] + f.write(json.dumps(entry, sort_keys=True) + "\n") + + +# ------------------------------------------------------------------------------------------ +# the verifier, asked again +# ------------------------------------------------------------------------------------------ +def stop_name_in(sentence): + names = re.findall(r"\(([A-Z][A-Za-z0-9]*[a-z][A-Za-z0-9]*)\)", sentence or "") + return names[-1] if names else None + + +class Replay: + """The verifier, with every answer remembered: the same request is sent once.""" + + def __init__(self, verifier): + self.verifier = verifier + self.seen = {} + server = getattr(verifier, "server", None) or {} + self.version = server.get("version") + self.binary_sha256 = getattr(verifier, "binary_sha256", None) + + def call(self, tool, arguments): + key = tool + "\x00" + json.dumps(arguments, sort_keys=True) + if key not in self.seen: + try: + self.seen[key] = self.verifier.call_json(tool, arguments) + except McpError as problem: + if not str(problem).startswith("protocol error"): + raise SystemExit("the verifier failed, so nothing was scored: %s" % problem) + self.seen[key] = ("the verifier did not take the request: %s" % problem, True) + return self.seen[key] + + def answer(self, tool, arguments, readout=None): + """One run or solve computed again: {"stopped", "outcome", "stop", "proof", "body"}.""" + arguments = copy.deepcopy(without_readout(arguments)) + if readout is not None and tool == "run_trajectory": + arguments["readout"] = readout + body, is_error = self.call(tool, arguments) + if is_error or not isinstance(body, dict): + sentence = body if isinstance(body, str) else json.dumps(body) + return {"stopped": True, "outcome": "stopped before computing", "stop": stop_name_in(sentence), + "proof": None, "body": None, "sentence": sentence} + outcome = body.get("outcome") + stopped = outcome not in NOT_STOPPED + return {"stopped": stopped, "outcome": outcome, "stop": body.get("reject") if stopped else None, + "proof": body.get("run_seal") or body.get("solution_seal"), "body": body, + "sentence": body.get("reject_detail")} + + def proof_holds(self, tool, arguments, proof): + """(holds, words): the card's seal verified by verify_tape or verify_solution, short form.""" + if not isinstance(proof, str) or not re.fullmatch(r"[0-9a-f]{96}", proof): + return False, "the proof is not a SHA-384 seal of 96 hex digits" + if tool == "run_trajectory": + body, is_error = self.call("verify_tape", {"request": without_readout(arguments), "run_seal": proof}) + elif tool == "solve": + body, is_error = self.call("verify_solution", {"request": arguments, "solution_seal": proof}) + else: + return False, "a proof is verified for run_trajectory or solve only, not %s" % tool + if is_error or not isinstance(body, dict): + return False, "the verifier would not verify it: %s" % (str(body)[:200]) + if body.get("holds") is True: + return True, None + return False, "the verifier says the seal does not hold (cause %s)" % body.get("cause") + + +def engine_problem(env, replay): + """None when the verifier is the engine the task was built on; else what differs.""" + ref = env.get("reference") or {} + tag = ref.get("gateway_version") or (ref.get("engine_tag") or "").lstrip("v") + if not tag: + return "the task names no engine it was built on" + if (ref.get("engine_tag") or "v" + tag).lstrip("v") != tag: + return "the task's engine_tag %s and gateway_version %s disagree" % (ref.get("engine_tag"), ref.get("gateway_version")) + if replay.version != tag: + return "the task was built on engine %s; the verifier is %s" % (tag, replay.version) + want = ref.get("engine_binary_sha256") + if replay.binary_sha256 and want and replay.binary_sha256 != want: + return "the verifier's binary is not the one the task was built on (sha256 %s..., want %s...)" % (replay.binary_sha256[:12], want[:12]) + return None + + +# ------------------------------------------------------------------------------------------ +# requests and their inputs +# ------------------------------------------------------------------------------------------ +_PART = re.compile(r"([A-Za-z_0-9]+)((?:\[\d+\])*)") + + +def get_path(obj, path): + here = obj + for part in path.split("."): + found = _PART.fullmatch(part) + if not found or not isinstance(here, dict) or found.group(1) not in here: + return None + here = here[found.group(1)] + for index in re.findall(r"\[(\d+)\]", found.group(2)): + if not isinstance(here, list) or int(index) >= len(here): + return None + here = here[int(index)] + return here + + +def set_path(obj, path, value): + parts = path.split(".") + here = obj + for i, part in enumerate(parts): + m = _PART.fullmatch(part) + name, idx = m.group(1), [int(k) for k in re.findall(r"\[(\d+)\]", m.group(2))] + last = i == len(parts) - 1 + if not idx: + if last: + here[name] = value + else: + here = here[name] + else: + here = here[name] + for j, k in enumerate(idx): + if last and j == len(idx) - 1: + here[k] = value + else: + here = here[k] + + +def number(value): + return isinstance(value, (int, float)) and not isinstance(value, bool) and math.isfinite(value) + + +def differs(template, given, free, where=""): + """The first place where a request differs from the task's, other than the free places. None when none.""" + if where in free: + return None + if isinstance(template, dict): + if not isinstance(given, dict): + return where or "the request" + for key in set(template) | set(given): + place = "%s.%s" % (where, key) if where else key + if place in free: + continue + if key not in given or key not in template: + return place + found = differs(template[key], given[key], free, place) + if found: + return found + return None + if isinstance(template, list): + if not isinstance(given, list) or len(given) != len(template): + return where + for index, (a, b) in enumerate(zip(template, given)): + found = differs(a, b, free, "%s[%d]" % (where, index)) + if found: + return found + return None + if number(template) and number(given): + return None if float(template) == float(given) else where + return None if template == given else where + + +def design_value(variable, run_arguments, solve_arguments, next_arguments=None): + """The design variable of one design, read from its requests (on: run, solve, or next, a continued run).""" + kind = variable["kind"] + if kind == "path": + on = variable.get("on", "run") + source = {"solve": solve_arguments, "next": next_arguments}.get(on, run_arguments) or {} + value = get_path(source, variable["path"]) + for place in variable.get("also") or []: + again = get_path(source, place) + if not (number(again) and number(value) and float(again) == float(value)): + return None + return float(value) if number(value) else None + if kind == "entry_angle_deg": + radial = get_path(run_arguments or {}, "initial.radial_speed_m_s") + transverse = get_path(run_arguments or {}, "initial.transverse_speed_m_s") + if not (number(radial) and number(transverse)) or transverse <= 0: + return None + speed = math.hypot(radial, transverse) + if abs(speed - variable["speed_m_s"]) > 1e-6 * variable["speed_m_s"]: + return None + return math.degrees(math.atan2(-radial, transverse)) + return None + + +def variable_places(variable): + if variable["kind"] == "entry_angle_deg": + return {"initial.radial_speed_m_s", "initial.transverse_speed_m_s"} + if variable["kind"] == "path" and variable.get("on", "run") == "run": + return {variable["path"]} | set(variable.get("also") or []) + return set() + + +def read_value(read, answer): + """One number from a replayed answer: final, result, or the extreme of a run's readout.""" + body = answer["body"] + if body is None: + return None + kind = read["kind"] + value = None + if kind == "final": + value = (body.get("final_state") or {}).get(read["quantity"]) + elif kind == "result": + value = (body.get("result") or {}).get(read["quantity"]) + elif kind == "flag_extent": + # an advisory flag the run raised, at its largest extent; 0 when the run does not raise it + value = max([x.get("extent") or 0.0 for x in body.get("exceedance_extremes") or [] + if isinstance(x, dict) and x.get("flag") == read["quantity"]] or [0.0]) + elif kind == "extreme": + for quantity in (body.get("readout") or {}).get("quantities") or []: + if quantity.get("quantity") == read["quantity"]: + value = quantity.get(read["which"]) + if "index" in read: + # one entry of an output the verifier returns as a list (a hose's modes, a solve asked at several points) + k = read["index"] + value = value[k] if isinstance(value, list) and isinstance(k, int) and -len(value) <= k < len(value) else None + return value if number(value) else None + + +def readout_for(constraints, on="run"): + """The readout a run is sent with: the extremes its constraints read (on: run, next, or a stage key).""" + quantities = sorted({c["read"]["quantity"] for c in constraints if c["on"] == on and c["read"]["kind"] == "extreme"}) + return {"quantities": quantities} if quantities else None + + +def design_shape(spec): + """Which of the design shapes a task's check.design is: run, coupled, continued, solve or staged.""" + if spec.get("stages"): + return "staged" + if spec.get("tool") == "solve" or spec.get("kind") == "solve": + return "solve" + chain = spec.get("chain") or {} + if chain.get("kind") == "continuation" or (chain.get("layout") or {}).get("kind") == "continue": + return "continued" + return "coupled" if chain else "run" + + +def continuation_of(spec): + """A continued design's chain in one form: (next template, {start field: where the first run's answer holds it}, + next outcomes, the next run's places that also hold a first-run design value).""" + chain = spec["chain"] + template = chain.get("next_template") or chain.get("template") or chain.get("next") + if "carried" in chain: # group 1 + carried = dict(chain["carried"]) + elif "handed" in chain: # group 4 + named = chain.get("handed_from") or {} + carried = {k: "final_state." + named.get(k, k) for k in chain["handed"]} + else: # group 5 + carried = {k: "final_state." + k for k in chain.get("carry") or []} + if chain.get("clock"): + carried[chain["clock"]["field"]] = "final_state." + chain["clock"]["from"] + outcomes = chain.get("next_outcomes") or spec["run_outcomes"] + return template, carried, outcomes, list(chain.get("next_also") or []) + + +def meets(constraint, value): + if value is None: + return False + return value <= constraint["limit"] if constraint["op"] == "<=" else value >= constraint["limit"] + + +def history_layout_problem(layout, parameters, frames_count): + """None when the arrays of a chained solve are laid out as the task states; else what is not.""" + if layout is None: + return None + if layout["kind"] == "stardust_slab": + names = ("history_time_s", "history_pressure_pa", "history_heat_transfer_coefficient_kg_per_m2_s", + "history_flow_enthalpy_j_per_kg", "history_radiative_heating_w_per_m2") + columns = [parameters.get(name) for name in names] + if not all(isinstance(c, list) and all(number(v) for v in c) for c in columns): + return "the history columns are not all lists of numbers" + time, pressure, coefficient, enthalpy, radiative = columns + rows = frames_count + 3 + if any(len(c) != rows for c in columns): + return "the history has not one row before the %d frames handed and two after them" % frames_count + if time[0] != 0.0 or coefficient[0] != 0.0: + return "row 0 is not at 0 s with no heating" + if pressure[0] != pressure[1] or enthalpy[0] != enthalpy[1]: + return "row 0 does not repeat the first frame's pressure and enthalpy" + if abs(time[-2] - (time[-3] + 1.0)) > 1e-9 or time[-1] != layout["cool_to_s"]: + return "the rows after the frames are not at 1 s after the last frame and at %g s" % layout["cool_to_s"] + if coefficient[-2] != 0.0 or coefficient[-1] != 0.0: + return "the stream is not off after the frames" + if pressure[-1] != pressure[-3] or pressure[-2] != pressure[-3] or enthalpy[-1] != enthalpy[-3] or enthalpy[-2] != enthalpy[-3]: + return "the rows after the frames do not hold the last frame's pressure and enthalpy" + if any(v != 0.0 for v in radiative): + return "a row of the history holds radiative heating" + return None + if layout["kind"] == "triga_element": + return None # every array is handed by the coupling and held to its bits by the verifier + return "an unknown layout" + + +# ------------------------------------------------------------------------------------------ +# the call record +# ------------------------------------------------------------------------------------------ +def card_requests(env, card): + """Every request on the card, [(tool, arguments)], read leniently (for the call log).""" + out = [] + + def take(part): + if isinstance(part, dict) and isinstance(part.get("request"), dict) and isinstance(part["request"].get("arguments"), dict): + out.append((tool_name(part["request"].get("tool")), part["request"]["arguments"])) + + if env["family"] in ("tradeoff", "chain_design"): + stages = [s["key"] for s in (env["check"].get("design") or {}).get("stages") or []] + for side in ("passing", "failing"): + design = card.get(side) if isinstance(card.get(side), dict) else {} + for key in stages or ("run", "solve", "next"): + take(design.get(key)) + elif env["family"] == "budget": + take(card.get("holds")) + take(card.get("stops")) + return out + + +def sequence(calls): + return [(tool_name(t), json.dumps(numbers_by_value(a), sort_keys=True)) for t, a in calls] + + +def call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row): + """None when the call record holds; else why not (an integrity failure).""" + check = env["check"] + if calls_from == "harness": + if calls is None: + return "no harness call log: every attempt is scored with the calls the harness recorded" + if log_problem: + return log_problem + if reply_calls is not None and sequence(reply_calls) != sequence(calls): + return "the call log beside the reply differs from the harness log" + elif calls is None: + return "no call log: every environment is scored with the agent's calls" + calls = [(tool_name(t), a) for t, a in calls] + banned = sorted({t for t, _ in calls if t in (check.get("forbidden") or [])}) + if banned: + return "the log holds calls of %s, which the task rules out" % ", ".join(banned) + computing = [(t, a) for t, a in calls if t not in FREE_TOOLS] + row["computing_calls"] = len(computing) + if check.get("budget") and len(computing) > check["budget"]: + return "%d computing calls; the budget is %d" % (len(computing), check["budget"]) + sent = {(t, canonical(a)) for t, a in computing} + for tool, arguments in card_requests(env, card): + if (tool, canonical(arguments)) not in sent: + return "a %s request on the card is not among the calls in the log" % tool + if env["family"] == "forensics" and not computing: + return "no computing call behind the answer: the table was not put to the verifier" + return None + + +# ------------------------------------------------------------------------------------------ +# the families +# ------------------------------------------------------------------------------------------ +def request_of(part, tool, what): + """The arguments of one request on the card (Integrity when it is not one).""" + if not isinstance(part, dict): + raise Integrity("%s is missing" % what) + request = part.get("request") + if not (isinstance(request, dict) and isinstance(request.get("arguments"), dict)): + raise Integrity("%s has no request {\"tool\": ..., \"arguments\": {...}}" % what) + if tool_name(request.get("tool")) != tool: + raise Integrity("%s is a request of %s, not %s" % (what, request.get("tool"), tool)) + return request["arguments"] + + +def score_design(env, design, which, replay, proofs): + """One design of a boundary family: facts {x, met, values, stopped, steps_landed}.""" + check = env["check"] + spec = check["design"] + shape = design_shape(spec) + if shape in ("solve", "staged", "continued") and not isinstance(design, dict): + raise Integrity("the %s design is missing" % which) + if shape == "solve": + return score_solve_design(env, design, which, replay, proofs) + if shape == "staged": + return score_staged_design(env, design, which, replay, proofs) + if shape == "continued": + return score_continued_design(env, design, which, replay, proofs) + chain = spec.get("chain") + run_args = request_of((design or {}).get("run") if isinstance(design, dict) else None, "run_trajectory", + "the %s design's run" % which) + free = set(spec.get("free") or []) | variable_places(spec["variable"]) + where = differs(spec["template"], without_readout(run_args), free) + if where: + raise Integrity("the %s design's run differs from the task's at %s" % (which, where)) + for place in spec.get("free") or []: + if place.endswith(".steps"): + steps = get_path(run_args, place) + if not (isinstance(steps, int) and not isinstance(steps, bool) and 1 <= steps <= spec.get("most_steps", 10 ** 7)): + raise Integrity("the %s design's run has no whole number of steps at %s" % (which, place)) + run_proof = design["run"].get("proof") + holds, words = replay.proof_holds("run_trajectory", run_args, run_proof) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's run_seal: %s" % (which, words)) + run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"])) + stop_names = [c["stop"] for c in check["constraints"] if c["on"] == "outcome"] + stopped_by_name = run["outcome"] == "refused" and run["stop"] in stop_names + if run["outcome"] not in spec["run_outcomes"] and not stopped_by_name: + raise Wrong("the %s design's run comes back %s%s, not %s" % ( + which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"]))) + solve_args, solve = None, None + if chain: + solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which) + if solve_args.get("solver") != chain["solver"]: + raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver"))) + handed = solve_args.get("from") + if not isinstance(handed, dict) or handed.get("coupling") != chain["coupling"]: + raise Integrity("the %s design's solve is not handed its run through the coupling %s" % (which, chain["coupling"])) + if canonical(handed.get("request")) != canonical(run_args) or handed.get("run_seal") != run_proof: + raise Integrity("the %s design's solve is not handed the design's own sealed run" % which) + parameters = solve_args.get("parameters") + if not isinstance(parameters, dict): + raise Integrity("the %s design's solve has no parameters" % which) + solve_free = set(chain.get("handed") or []) + if spec["variable"]["kind"] == "path" and spec["variable"].get("on") == "solve": + solve_free.add(spec["variable"]["path"].split(".", 1)[1]) + where = differs(chain["parameters"], parameters, solve_free) + if where: + raise Integrity("the %s design's solve differs from the task's at parameters.%s" % (which, where)) + frames = len((run["body"] or {}).get("frames") or []) + problem = history_layout_problem(chain.get("layout"), parameters, frames) + if problem: + raise Integrity("the %s design's solve: %s" % (which, problem)) + holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's solution_seal: %s" % (which, words)) + solve = replay.answer("solve", solve_args) + if solve["outcome"] != "converged": + raise Wrong("the %s design's solve comes back %s%s, not converged" % ( + which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else "")) + x = design_value(spec["variable"], run_args, solve_args) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, spec["variable"].get("words", ""))) + met, values = {}, {} + for constraint in check["constraints"]: + if constraint["on"] == "outcome": + values[constraint["id"]] = run["outcome"] if not run["stop"] else "%s (%s)" % (run["outcome"], run["stop"]) + met[constraint["id"]] = not (run["outcome"] == "refused" and run["stop"] == constraint["stop"]) + continue + value = read_value(constraint["read"], run if constraint["on"] == "run" else solve) + values[constraint["id"]] = value + met[constraint["id"]] = meets(constraint, value) + facts = {"x": x, "met": met, "values": values} + if run["outcome"] not in NOT_STOPPED and run["body"]: + facts["stopped"], facts["steps_landed"] = run["stop"], run["body"].get("steps_landed") + return facts + + +def halted(answer, stop, staged=False): + """True when an answer is stopped by the stop named: a refusal ("refused"); for a staged design, any outcome that + is not completed or converged (group 3's rule, kept as built).""" + if staged: + return answer["outcome"] not in NOT_STOPPED and answer["stop"] == stop + return answer["outcome"] == "refused" and answer["stop"] == stop + + +def constraint_facts(check, answers, judged, staged=False): + """met and values of every constraint: each read from the answer its "on" names (answers: {on: answer}); a stop + constraint ("on": "outcome") is judged on the answer judged, or on its stage's answer for a staged design.""" + met, values = {}, {} + for c in check["constraints"]: + if c["on"] == "outcome": + a = answers.get(c["stage"]) if c.get("stage") else judged + values[c["id"]] = None if a is None else (a["outcome"] if not a["stop"] else "%s (%s)" % (a["outcome"], a["stop"])) + met[c["id"]] = a is not None and not halted(a, c["stop"], staged) + continue + a = answers.get(c["on"]) + value = read_value(c["read"], a) if a is not None else None + values[c["id"]] = value + met[c["id"]] = meets(c, value) if c.get("limit") is not None else None + return met, values + + +def stopped_by(answer, constraints, stage=None): + """True when an answer is stopped by a stop one of the task's stop constraints names (for the stage given).""" + return any(halted(answer, c["stop"], stage is not None) for c in constraints + if c["on"] == "outcome" and (stage is None or c.get("stage") == stage)) + + +def score_solve_design(env, design, which, replay, proofs): + """One design that is one solve and no run (check.design.tool or kind "solve").""" + check = env["check"] + spec = check["design"] + var = spec["variable"] + solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which) + if solve_args.get("solver") != spec["template"].get("solver"): + raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver"))) + free = set(spec.get("free") or []) | {var["path"]} | set(var.get("also") or []) + where = differs(spec["template"], solve_args, free) + if where: + raise Integrity("the %s design's solve differs from the task's at %s" % (which, where)) + holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's solution_seal: %s" % (which, words)) + solve = replay.answer("solve", solve_args) + if solve["outcome"] not in spec["run_outcomes"] and not stopped_by(solve, check["constraints"]): + raise Wrong("the %s design's solve comes back %s%s, not %s" % ( + which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else "", " or ".join(spec["run_outcomes"]))) + x = design_value(dict(var, on="solve"), None, solve_args) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", ""))) + met, values = constraint_facts(check, {"solve": solve}, solve) + facts = {"x": x, "met": met, "values": values} + if solve["outcome"] not in NOT_STOPPED and solve["body"]: + facts["stopped"], facts["steps_landed"], facts["no_step"] = solve["stop"], None, True + return facts + + +def score_continued_design(env, design, which, replay, proofs): + """One design of a run and the run that continues it through from. The verifier holds the hand-off: it computes + the first run again, compares its seal and refuses a start that is not the first run's final state; the scorer + also holds each carried start field to the first run's answer, bit for bit.""" + check = env["check"] + spec = check["design"] + var = spec["variable"] + on_next = var["kind"] == "path" and var.get("on") == "next" + template, carried, next_outcomes, next_also = continuation_of(spec) + run_args = request_of(design.get("run"), "run_trajectory", "the %s design's run" % which) + free = set(spec.get("free") or []) | (set() if on_next else variable_places(var)) + where = differs(spec["template"], without_readout(run_args), free) + if where: + raise Integrity("the %s design's run differs from the task's at %s" % (which, where)) + run_proof = design["run"].get("proof") + holds, words = replay.proof_holds("run_trajectory", run_args, run_proof) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's run_seal: %s" % (which, words)) + run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"], "run")) + if run["outcome"] not in spec["run_outcomes"]: + raise Wrong("the %s design's first run comes back %s%s, not %s" % ( + which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"]))) + next_args = request_of(design.get("next"), "run_trajectory", "the %s design's next run" % which) + handed = next_args.get("from") + if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(run_args) + or handed.get("run_seal") != run_proof): + raise Integrity("the %s design's next run does not continue the design's own sealed run (from)" % which) + next_free = {"initial." + name for name in carried} | {"from"} | set(next_also) + if on_next: + next_free |= {var["path"]} | set(var.get("also") or []) + where = differs(template, without_readout(next_args), next_free) + if where: + raise Integrity("the %s design's next run differs from the task's at %s" % (which, where)) + start = next_args.get("initial") if isinstance(next_args.get("initial"), dict) else {} + for name, source in carried.items(): + held, given = get_path(run["body"] or {}, source), start.get(name) + if name not in start or not (given == held or (number(given) and number(held) and float(given) == float(held))): + raise Integrity("the %s design's next run does not start from its run's %s, bit for bit" % (which, source)) + holds, words = replay.proof_holds("run_trajectory", next_args, design["next"].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's next run_seal: %s" % (which, words)) + nxt = replay.answer("run_trajectory", next_args, readout_for(check["constraints"], "next")) + if nxt["outcome"] not in next_outcomes and not stopped_by(nxt, check["constraints"]): + raise Wrong("the %s design's next run comes back %s%s, not %s" % ( + which, nxt["outcome"], " (%s)" % nxt["stop"] if nxt["stop"] else "", " or ".join(next_outcomes))) + x = design_value(var, run_args, None, next_args) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", ""))) + for place in next_also: + again = get_path(next_args, place) + if not (number(again) and float(again) == float(x)): + raise Integrity("the %s design's next run does not hold the design value at %s" % (which, place)) + met, values = constraint_facts(check, {"run": run, "next": nxt}, nxt) + facts = {"x": x, "met": met, "values": values} + if nxt["outcome"] not in NOT_STOPPED and nxt["body"]: + facts["stopped"], facts["steps_landed"] = nxt["stop"], nxt["body"].get("steps_landed") + return facts + + +def build_stage_request(spec, stage, x, answers, requests): + """One stage's request of a staged design at x: the template, x at the variable's places, the values handed from + earlier stages' answers, and a continuation's start and from (used by run_reference.py).""" + q = copy.deepcopy(stage["template"]) + var = spec["variable"] + if var.get("stage") == stage["key"]: + for place in [var["path"]] + list(var.get("also") or []): + set_path(q, place, x) + for h in stage.get("handed") or []: + set_path(q, h["to"], read_value(h["read"], answers[h["from"]])) + if stage.get("continues"): + parent = stage["continues"] + final = answers[parent]["body"]["final_state"] + q["initial"] = {k: final[k] for k in stage["template"]["initial"]} + q["from"] = {"request": copy.deepcopy(requests[parent]), "run_seal": answers[parent]["proof"]} + return q + + +def score_staged_design(env, design, which, replay, proofs): + """One staged design (check.design.stages): each stage a run or a solve, in order.""" + check = env["check"] + spec = check["design"] + var = spec["variable"] + stages = spec["stages"] + answers, requests, facts = {}, {}, {} + for i, stage in enumerate(stages): + key, tool = stage["key"], stage["tool"] + sent = without_readout(request_of(design.get(key), tool, "the %s design's %s" % (which, key))) + free = set(stage.get("free") or []) | {h["to"] for h in stage.get("handed") or []} + if var.get("stage") == key: + free |= {var["path"]} | set(var.get("also") or []) + if stage.get("continues"): + free |= {"initial", "from"} + where = differs(stage["template"], sent, free) + if where: + raise Integrity("the %s design's %s differs from the task's at %s" % (which, key, where)) + for h in stage.get("handed") or []: + want = read_value(h["read"], answers[h["from"]]) + got = get_path(sent, h["to"]) + if want is None or not number(got) or float(got) != float(want): + raise Integrity("the %s design's %s does not carry %s's %s at %s, bit for bit" % ( + which, key, h["from"], h["read"]["quantity"], h["to"])) + if stage.get("continues"): + parent = stage["continues"] + handed = sent.get("from") + if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(requests[parent]) + or handed.get("run_seal") != design[parent].get("proof")): + raise Integrity("the %s design's %s does not continue the design's own sealed %s run (from)" % (which, key, parent)) + final = (answers[parent]["body"] or {}).get("final_state") or {} + start = sent.get("initial") + keys = set(stage["template"]["initial"]) + if not isinstance(start, dict) or set(start) != keys or any( + not number(start[k]) or float(start[k]) != final.get(k) for k in keys): + raise Integrity("the %s design's %s does not start from the final state of its %s run, bit for bit" % (which, key, parent)) + holds, words = replay.proof_holds(tool, sent, design[key].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's %s proof: %s" % (which, key, words)) + answer = replay.answer(tool, sent, readout_for(check["constraints"], key) if tool == "run_trajectory" else None) + named = stopped_by(answer, check["constraints"], stage=key) + if answer["outcome"] not in stage["outcomes"] and not named: + raise Wrong("the %s design's %s comes back %s%s, not %s" % ( + which, key, answer["outcome"], " (%s)" % answer["stop"] if answer["stop"] else "", " or ".join(stage["outcomes"]))) + answers[key], requests[key] = answer, sent + if named: + facts["stopped"], facts["stopped_stage"] = answer["stop"], key + facts["steps_landed"] = (answer["body"] or {}).get("steps_landed") if tool == "run_trajectory" else None + facts["no_step"] = tool != "run_trajectory" + if i != len(stages) - 1: + raise Wrong("the %s design's %s stops (%s) before its last stage" % (which, key, answer["stop"])) + x = design_value(dict(var, on="run"), requests.get(var["stage"]), None) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", ""))) + met, values = constraint_facts(check, answers, None, staged=True) + facts.update({"x": x, "met": met, "values": values}) + return facts + + +def grade_bracket(a, b, star, tol, slack, row): + """(reward_ok, graded) for a bracket [a, b] with its sides right.""" + width = abs(b - a) + straddles = min(a, b) - slack <= star <= max(a, b) + slack + within = width <= tol * (1 + 1e-9) + e = max(a, b, star) - min(a, b, star) + r = e / tol if tol > 0 else float("inf") + row["width"], row["width_ratio"] = width, r + if within and straddles: + return True, 1.0 + if r <= 1: + return False, OTHER_CROSSING + return False, GRADED_DECAY ** math.log10(r) + + +def score_boundary(env, card, replay, row, proofs): + check, reference = env["check"], env["reference"] + passing = score_design(env, card.get("passing"), "passing", replay, proofs) + failing = score_design(env, card.get("failing"), "failing", replay, proofs) + row["passing"], row["failing"] = passing, failing + span = check["design"].get("range") + if span and not all(span[0] <= x <= span[1] for x in (passing["x"], failing["x"])): + raise Wrong("a design lies outside the range the task states, %g to %g" % tuple(span)) + broken = [c for c, ok in passing["met"].items() if not ok] + if broken: + raise Wrong("the passing design breaks %s" % ", ".join(broken)) + broken = [c for c, ok in failing["met"].items() if not ok] + if not broken: + raise Wrong("the failing design meets every constraint") + binding = card.get("binding") + if binding != reference["binding"]: + raise Wrong("binding names %r; the constraint that binds is another" % (binding,)) + if binding not in broken: + raise Wrong("the failing design does not break %s, the constraint named binding" % binding) + if binding in [c["id"] for c in check["constraints"] if c["on"] == "outcome"]: + said = card.get("failing") or {} + if said.get("stopped") != failing.get("stopped"): + raise Wrong("the failing design's run stops with %s; the card says %r" % (failing.get("stopped"), said.get("stopped"))) + if failing.get("no_step"): + pass # a solve that is refused has no step: its stop's name is stated + elif not (isinstance(said.get("step"), int) and not isinstance(said.get("step"), bool) and said["step"] == failing.get("steps_landed")): + raise Wrong("the failing design's run is sealed to step %s; the card says %r" % (failing.get("steps_landed"), said.get("step"))) + spec = check["design"] + xp, xf = passing["x"], failing["x"] + if spec["direction"] == "largest" and not xf > xp: + raise Wrong("the task asks for the largest value that holds: the failing design must lie above the passing one") + if spec["direction"] == "smallest" and not xf < xp: + raise Wrong("the task asks for the smallest value that holds: the failing design must lie below the passing one") + ok, graded = grade_bracket(xp, xf, reference["boundary"], spec["tolerance"], spec["tolerance"] * 0.5, row) + if not ok: + return graded, "the two designs are %.6g apart; the task asks for %.6g or less, and they must straddle the boundary" % ( + abs(xf - xp), spec["tolerance"]) + return 1.0, None + + +def score_budget(env, card, replay, row, proofs): + check, reference = env["check"], env["reference"] + template, path, tool = check["template"], check["variable"], check["tool"] + sides = {} + for side in ("holds", "stops"): + arguments = request_of(card.get(side), tool, side) + also = check.get("also") or [] + where = differs(template, without_readout(arguments), {path} | set(also)) + if where: + raise Integrity("the %s request differs from the task's at %s" % (side, where)) + x = get_path(arguments, path) + if not number(x): + raise Integrity("the %s request has no number at %s" % (side, path)) + for place in also: + again = get_path(arguments, place) + if not (number(again) and float(again) == float(x)): + raise Integrity("the %s request does not hold the same value at %s as at %s" % (side, place, path)) + holds, words = replay.proof_holds(tool, arguments, card[side].get("proof")) + proofs.append(holds) + sides[side] = (float(x), arguments, holds, words) + for side in ("holds", "stops"): + if not sides[side][2]: + raise Integrity("the %s seal: %s" % (side, sides[side][3])) + held = replay.answer(tool, sides["holds"][1]) + stopped = replay.answer(tool, sides["stops"][1]) + row["holds_outcome"], row["stops_outcome"] = held["outcome"], "%s (%s)" % (stopped["outcome"], stopped["stop"]) + if held["outcome"] not in NOT_STOPPED: + raise Wrong("the holds request comes back %s (%s)" % (held["outcome"], held["stop"])) + if stopped["stop"] != check["stop"]: + raise Wrong("the stops request comes back %s (%s), not the stop %s" % (stopped["outcome"], stopped["stop"], check["stop"])) + if card["stops"].get("stopped") != check["stop"]: + raise Wrong("the card names the stop %r; the verifier names %s" % (card["stops"].get("stopped"), check["stop"])) + xh, xs = sides["holds"][0], sides["stops"][0] + star = reference["boundary"] + row["holds_value"], row["stops_value"] = xh, xs + tol = check["relative_width"] * abs(star) + ok, graded = grade_bracket(xh, xs, star, tol, 1e-9 * abs(star), row) + if not ok: + return graded, "the bracket is %.6g wide; the task asks for %.3g of the value or less, and it must hold the stop" % ( + abs(xs - xh), check["relative_width"]) + return 1.0, None + + +def forensics_f1(env, named): + """(graded, problem): F1 over (row, reason) pairs; problem when the card is not a usable answer.""" + if not isinstance(named, dict): + return 0.0, "false_rows is not an object of row and reason" + rows = [c["row"] for c in env["check"]["rows"]] + truth = env["reference"]["false_rows"] + unknown = [r for r in named if r not in set(rows)] + if unknown: + return 0.0, "no rows %s in the table" % ", ".join(sorted(unknown)) + reasons = env["check"].get("reasons") or REASONS + bad = [r for r, why in named.items() if why not in reasons] + if bad: + return 0.0, "the reason for %s is not one of %s" % (", ".join(sorted(bad)), ", ".join(reasons)) + if rows and set(named) == set(rows): + return 0.0, "every row of the table is named false: a blanket answer" + found = sum(1 for r, why in named.items() if truth.get(r) == why) + if not truth and not named: + return 1.0, None + precision = found / len(named) if named else 0.0 + recall = found / len(truth) if truth else 0.0 + f1 = 2 * precision * recall / (precision + recall) if precision + recall else 0.0 + if f1 >= 1.0: + return 1.0, None + missed = sorted(set(truth) - set(named)) + wrongly = sorted(set(named) - set(truth)) + wrong_reason = sorted(r for r in set(truth) & set(named) if truth[r] != named[r]) + said = [] + if missed: + said.append("%d false row(s) not named" % len(missed)) + if wrongly: + said.append("%d genuine row(s) named false" % len(wrongly)) + if wrong_reason: + said.append("%d false row(s) with another reason" % len(wrong_reason)) + return f1, "; ".join(said) + + +def score(env, reply, replay, calls=None, reply_calls=None, calls_from="reply", log_problem=None): + """One environment scored. calls: the authoritative record [(tool, arguments)] (None: no record); + reply_calls: the reply-side log, compared with calls under calls_from="harness".""" + row = {"id": env["id"], "family": env["family"], "kind": KINDS.get(env["family"]), "calls_from": calls_from, + "correct": 0, "proofs_hold": 0, "reward": 0, "graded": 0.0, "verdict": None, "reason": None} + card, problem = read_card(reply) + if problem: + row.update(verdict="no_card", reason=problem) + return row + proofs = [] + try: + problem = engine_problem(env, replay) + if problem: + raise Integrity(problem) + problem = call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row) + if problem: + raise Integrity(problem) + family = env["family"] + if family in ("tradeoff", "chain_design"): + graded, reason = score_boundary(env, card, replay, row, proofs) + elif family == "budget": + graded, reason = score_budget(env, card, replay, row, proofs) + elif family == "forensics": + named = card.get("false_rows") + if isinstance(named, dict): + row["named"] = named + graded, reason = forensics_f1(env, named) + proofs = [True] + if reason and graded == 0.0 and not isinstance(named, dict): + raise Wrong(reason) + else: + raise Wrong("unknown family %s" % family) + except Integrity as problem: + row.update(verdict="integrity", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs))) + return row + except Wrong as problem: + row.update(verdict="wrong", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs))) + return row + proofs_hold = int(bool(proofs) and all(proofs)) + correct = int(graded >= 1.0 and reason is None) + row.update(correct=correct, proofs_hold=proofs_hold, reward=int(correct == 1 and proofs_hold == 1), + graded=round(graded, 6) if proofs_hold else 0.0, + verdict="pass" if correct and proofs_hold else ("near" if graded > 0 else "wrong"), reason=reason) + return row + + +def records_for(folder, env_id, calls_from, harness_dir=None): + """(calls, reply_calls, log_problem) for one environment's reply in folder.""" + reply_calls = read_calls(os.path.join(folder, env_id + ".calls.jsonl")) + if calls_from == "harness": + calls, log_problem = read_harness_log(os.path.join(harness_dir or folder, env_id + ".harness.jsonl")) + return calls, reply_calls, log_problem + return reply_calls, None, None + + +def main(): + parser = argparse.ArgumentParser(description=__doc__.split("\n")[0]) + parser.add_argument("replies") + parser.add_argument("--engine", required=True) + parser.add_argument("--only") + parser.add_argument("--environments", required=True) + parser.add_argument("--out") + parser.add_argument("--calls-from", choices=("reply", "harness"), default="harness") + parser.add_argument("--harness-dir") + parser.add_argument("--quiet", action="store_true") + args = parser.parse_args() + environments = load_environments(args.environments) + if args.only: + wanted = set(args.only.split(",")) + environments = [e for e in environments if e["id"] in wanted] + missing = wanted - {e["id"] for e in environments} + if missing: + sys.exit("no environments %s in %s" % (", ".join(sorted(missing)), args.environments)) + for env in environments: + for problem in row_problems(env): + print("warning: %s: %s" % (env.get("id"), problem), file=sys.stderr) + verifier = open_verifier(args.engine) + replay = Replay(verifier) + rows = [] + try: + for env in environments: + path = os.path.join(args.replies, env["id"] + ".txt") + reply = open(path, encoding="utf-8", errors="replace").read() if os.path.isfile(path) else "" + calls, reply_calls, log_problem = records_for(args.replies, env["id"], args.calls_from, args.harness_dir) + row = score(env, reply, replay, calls, reply_calls, args.calls_from, log_problem) + rows.append(row) + if not args.quiet: + print("%-58s reward %d graded %.4f %-9s %s" % (env["id"], row["reward"], row["graded"], row["verdict"], + row["reason"] or ""), flush=True) + replay.seen.clear() + finally: + close_verifier(verifier) + if args.out: + with open(args.out, "w", encoding="utf-8") as f: + for row in rows: + f.write(json.dumps(row) + "\n") + total = len(rows) + print("\n%d environments: reward %d, graded %.4f (mean %.4f), correct %d, proofs_hold %d" % ( + total, sum(r["reward"] for r in rows), sum(r["graded"] for r in rows), + sum(r["graded"] for r in rows) / total if total else 0.0, + sum(r["correct"] for r in rows), sum(r["proofs_hold"] for r in rows))) + by = {} + for r in rows: + by.setdefault(r["family"], []).append(r) + for family in FAMILIES: + if family in by: + print(" %-13s reward %d of %d, mean graded %.4f" % (family, sum(r["reward"] for r in by[family]), len(by[family]), + sum(r["graded"] for r in by[family]) / len(by[family]))) + + +if __name__ == "__main__": + main() diff --git a/sample/scorer/ztp_mcp.py b/sample/scorer/ztp_mcp.py new file mode 100644 index 0000000000000000000000000000000000000000..0cde73653317c847cd361ad0ca9d4f1f785bc3a7 --- /dev/null +++ b/sample/scorer/ztp_mcp.py @@ -0,0 +1,188 @@ +"""A small Model Context Protocol client for the Zero-Trust Physics verifier. + +Standard library only. It speaks MCP two ways: + + stdio to a verifier built from the public source and started here as a program + (target/release/mcp_stdio): one JSON-RPC message a line, no network. + HTTP to an MCP address (JSON-RPC in a POST), such as + + https://mcp.zerotrustphysics.com/mcp Open to any agent. + +The open address gives each network address one place in the physics pool at a +time and answers "Too many concurrent physics tasks." or HTTP 429 when it is +busy; nothing waits on the server, so this client sends one request at a time +and, when it is told to come back, waits and sends the same request again. + +Licence: Apache-2.0. +""" +import json +import select +import shlex +import subprocess +import time +import urllib.error +import urllib.request + +OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp" +BUSY = "Too many concurrent physics tasks." + + +class McpError(RuntimeError): + pass + + +class Verifier: + """One MCP endpoint. call(tool, arguments) returns (text, is_error).""" + + def __init__(self, url=OPEN_ADDRESS, timeout_s=90, patience_s=600, pause_s=0.0, headers=None, quiet=True): + self.url = url + self.timeout_s = timeout_s + self.patience_s = patience_s # how long to keep asking politely before giving up on one request + self.pause_s = pause_s # a fixed pause after every request, for a shared address + self.headers = dict(headers or {}) + self.quiet = quiet + self.session = None + self.server = None + self.requests_sent = 0 + self.times_asked_to_wait = 0 + self._id = 0 + + # -- transport ------------------------------------------------------------------------- + def _post(self, message): + body = json.dumps(message).encode() + headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream", + "User-Agent": "zero-trust-physics-environments/1.0", **self.headers} + if self.session: + headers["Mcp-Session-Id"] = self.session + request = urllib.request.Request(self.url, data=body, headers=headers, method="POST") + self.requests_sent += 1 + with urllib.request.urlopen(request, timeout=self.timeout_s) as response: + session = response.headers.get("Mcp-Session-Id") + if session: + self.session = session + raw = response.read().decode("utf-8") + kind = response.headers.get("Content-Type", "") + if "text/event-stream" in kind: + for line in raw.splitlines(): + if line.startswith("data:"): + found = json.loads(line[5:].strip()) + if found.get("id") == message.get("id"): + return found + raise McpError("the event stream held no answer to the request") + return json.loads(raw) if raw.strip() else {} + + def _ask(self, method, params=None): + """Send one request; on 429, a busy pool, a 5xx or a dropped connection, wait and send it again.""" + self._id += 1 + message = {"jsonrpc": "2.0", "id": self._id, "method": method} + if params is not None: + message["params"] = params + started, wait = time.time(), 2.0 + while True: + reason = None + try: + answer = self._post(message) + if "error" in answer: + raise McpError("protocol error: %s" % json.dumps(answer["error"])[:300]) + result = answer.get("result", {}) + text = "".join(c.get("text", "") for c in result.get("content", []) or []) + if method == "tools/call" and BUSY in text and len(text) < 400: + reason = "the physics pool is busy" + else: + if self.pause_s: + time.sleep(self.pause_s) + return result + except urllib.error.HTTPError as problem: + if problem.code == 429 or problem.code >= 500: + after = problem.headers.get("Retry-After") + reason = "HTTP %d" % problem.code + if after and after.isdigit(): + wait = max(wait, float(after)) + else: + raise McpError("HTTP %d: %s" % (problem.code, problem.read().decode("utf-8", "replace")[:300])) + except (urllib.error.URLError, TimeoutError, ConnectionError, OSError) as problem: + reason = "no connection (%s)" % problem + self.times_asked_to_wait += 1 + if time.time() - started + wait > self.patience_s: + raise McpError("gave up after %d s: %s" % (self.patience_s, reason)) + if not self.quiet: + print(" %s; asking again in %.0f s" % (reason, wait), flush=True) + time.sleep(wait) + wait = min(wait * 1.6, 30.0) + + # -- protocol -------------------------------------------------------------------------- + def connect(self): + result = self._ask("initialize", {"protocolVersion": "2025-06-18", "capabilities": {}, + "clientInfo": {"name": "zero-trust-physics-environments", "version": "1.0"}}) + self.server = result.get("serverInfo") + try: + self._post({"jsonrpc": "2.0", "method": "notifications/initialized"}) + except Exception: # a notification has no answer; some servers close without one + pass + return result + + def tools(self): + """The tool declarations exactly as the endpoint gives them.""" + return self._ask("tools/list").get("tools", []) + + def call(self, tool, arguments=None): + """Call one tool. Returns (text, is_error): the text of the answer and the MCP isError flag.""" + result = self._ask("tools/call", {"name": tool, "arguments": arguments or {}}) + text = "".join(c.get("text", "") for c in result.get("content", []) or []) + return text, bool(result.get("isError")) + + def call_json(self, tool, arguments=None): + """Call one tool. Returns (body, is_error): the parsed JSON, or the text when it is not JSON.""" + text, is_error = self.call(tool, arguments) + try: + return json.loads(text), is_error + except ValueError: + return text, is_error + + +class StdioVerifier(Verifier): + """The same interface over MCP stdio: a program started here that speaks JSON-RPC, one message a line. + For anyone who holds an MCP server as a program; the open address needs none of this.""" + + def __init__(self, command, timeout_s=600, **kwargs): + super().__init__(url="stdio: " + (command if isinstance(command, str) else " ".join(command)), timeout_s=timeout_s, **kwargs) + self.proc = subprocess.Popen(shlex.split(command) if isinstance(command, str) else command, + stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) + + def _post(self, message): + self.requests_sent += 1 + try: + self.proc.stdin.write((json.dumps(message) + "\n").encode()) + self.proc.stdin.flush() + except OSError: # a program that has stopped reading will not start again + try: + self.proc.stdin.close() + except OSError: + pass + raise McpError("the program stopped reading") + if "id" not in message: + return {} + while True: + ready, _, _ = select.select([self.proc.stdout], [], [], self.timeout_s) + if not ready: + raise McpError("no answer in %d s" % self.timeout_s) + line = self.proc.stdout.readline() + if not line: + raise McpError("the program closed its output") + found = json.loads(line) + if found.get("id") == message["id"]: + return found + + def close(self): + self.proc.terminate() + try: + self.proc.wait(timeout=5) + except subprocess.TimeoutExpired: + self.proc.kill() + + +def connect(endpoint=OPEN_ADDRESS, **kwargs): + """A connected verifier: an http(s) address, or "stdio:" for a program.""" + verifier = StdioVerifier(endpoint[len("stdio:"):].strip(), **kwargs) if endpoint.startswith("stdio:") else Verifier(endpoint, **kwargs) + verifier.connect() + return verifier diff --git a/sample/scorer/ztp_open_bridge.py b/sample/scorer/ztp_open_bridge.py new file mode 100644 index 0000000000000000000000000000000000000000..9e4330e54ed33d8cf1f9a1078d9f36e5f96c2996 --- /dev/null +++ b/sample/scorer/ztp_open_bridge.py @@ -0,0 +1,109 @@ +"""The open address as a stdio MCP server: every JSON-RPC line read on stdin is posted, unchanged, to the verifier's +MCP address, and its answer written back on stdout, one line each. Standard library only. + + python3 ztp_open_bridge.py [URL] URL defaults to https://mcp.zerotrustphysics.com/mcp + +It is for a client that starts its MCP server as a program (an MCP config's command and args, a Harbor task's stdio +server, the harness's logging proxy in front of it) when the verifier it is to use is the served one. The bridge adds +nothing and drops nothing: a request goes out byte for byte as JSON, its answer comes back as the address gave it; a +notification (no id) is posted and answered by nothing. The session the address opens (Mcp-Session-Id) is kept for +every later message. On HTTP 429, a 5xx, a busy physics pool or a dropped connection it waits and posts the same +message again, as ztp_mcp.Verifier does, so a client sees one answer per request. + +Optional: ZTP_API_KEY in the environment sends "Authorization: Bearer " on every post, for a keyed door. With no +key set the bridge sends what it always sent. No key is ever written into a pack, a task or an image. + +Licence: Apache-2.0. +""" +import json +import os +import sys +import time +import urllib.error +import urllib.request + +OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp" +BUSY = "Too many concurrent physics tasks." +PATIENCE_S = float(os.environ.get("ZTP_BRIDGE_PATIENCE_S", "900")) +API_KEY = os.environ.get("ZTP_API_KEY") or None + + +class Bridge: + def __init__(self, url): + self.url = url + self.session = None + self.extra_headers = {} + + def post(self, message): + body = json.dumps(message).encode() + headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream", + "User-Agent": "zero-trust-physics-bridge/1.0"} + if self.session: + headers["Mcp-Session-Id"] = self.session + if API_KEY: + headers["Authorization"] = "Bearer " + API_KEY + headers.update(self.extra_headers) + request = urllib.request.Request(self.url, data=body, headers=headers, method="POST") + with urllib.request.urlopen(request, timeout=600) as response: + if response.headers.get("Mcp-Session-Id"): + self.session = response.headers["Mcp-Session-Id"] + raw = response.read().decode("utf-8") + kind = response.headers.get("Content-Type", "") + if "id" not in message: + return None + if "text/event-stream" in kind: + for line in raw.splitlines(): + if line.startswith("data:"): + found = json.loads(line[5:].strip()) + if found.get("id") == message.get("id"): + return found + return {"jsonrpc": "2.0", "id": message.get("id"), "error": {"code": -32603, "message": "the address's event stream held no answer"}} + return json.loads(raw) if raw.strip() else None + + def forward(self, message): + started, wait = time.time(), 2.0 + while True: + try: + answer = self.post(message) + text = "" + if isinstance(answer, dict) and isinstance(answer.get("result"), dict): + text = "".join(c.get("text", "") for c in answer["result"].get("content", []) or [] if isinstance(c, dict)) + if not (BUSY in text and len(text) < 400): + return answer + except urllib.error.HTTPError as problem: + if not (problem.code == 429 or problem.code >= 500): + if "id" not in message: + return None + return {"jsonrpc": "2.0", "id": message.get("id"), + "error": {"code": -32603, "message": "HTTP %d from the verifier's address" % problem.code}} + after = problem.headers.get("Retry-After") + if after and after.isdigit(): + wait = max(wait, float(after)) + except (urllib.error.URLError, TimeoutError, ConnectionError, OSError): + pass + if time.time() - started + wait > PATIENCE_S: + if "id" not in message: + return None + return {"jsonrpc": "2.0", "id": message.get("id"), + "error": {"code": -32603, "message": "the verifier's address did not answer in %d s" % PATIENCE_S}} + time.sleep(wait) + wait = min(wait * 1.6, 30.0) + + +def main(): + bridge = Bridge(sys.argv[1] if len(sys.argv) > 1 else OPEN_ADDRESS) + for line in sys.stdin: + if not line.strip(): + continue + try: + message = json.loads(line) + except ValueError: + continue + answer = bridge.forward(message) + if answer is not None: + sys.stdout.write(json.dumps(answer, separators=(",", ":")) + "\n") + sys.stdout.flush() + + +if __name__ == "__main__": + main() diff --git a/sample/tasks/harbor/hud_taskset.json b/sample/tasks/harbor/hud_taskset.json new file mode 100644 index 0000000000000000000000000000000000000000..ff8e8e8cc6f509757c0ee8862158f5d9a9c79aee --- /dev/null +++ b/sample/tasks/harbor/hud_taskset.json @@ -0,0 +1,214 @@ +{ + "format": "Harbor task directories, for HUD's Harbor import", + "rests_on": "HUD imports Harbor tasks; this file indexes them", + "dataset": "zero-trust-physics-sample-orbital-space-atmospheric-entry@2026-11-13", + "hud_export": "tasks/hud/tasks", + "hud_runtime": { + "runs_as_shipped": false, + "harbor_tasks": "HUD's adapter (hud 0.6.21) takes these Harbor directories, but they declare a stdio MCP server, which HUD's agents are not given: to run a task on HUD use tasks/hud/tasks.", + "export": "tasks/hud/tasks takes HUD's adapter (hud 0.6.21) and its proxy and grader images have run with no route out. HUD's hosted runtime has not run these tasks with an agent.", + "docs": "https://docs.hud.ai/v6/experimental/harbor" + }, + "tasks": [ + { + "id": "g2-budget-sd-airspeed-sink-e-t3", + "harbor_path": "tasks/g2-budget-sd-airspeed-sink-e-t3", + "family": "budget", + "kind": "budgeted_search", + "prompt_file": "tasks/g2-budget-sd-airspeed-sink-e-t3/instruction.md", + "prompt": "The Stardust sample return capsule enters the Earth's air at 6495650 m from the Earth's centre, with a transverse speed of 12604.2 m/s and a radial (sink) speed that you set (negative, downward), and is followed for 71 s (1420 steps of 0.05 s). Above some radial velocity (a shallower entry, smaller downward sink magnitude) the speed through the air leaves the card's drag table before the run's end and the run is stopped (AirSpeedOutsideCard). Find the radial speed at which that begins, in m/s.\n\nBracket it: give a value that completes and a value that stops with AirSpeedOutsideCard, no more than 0.0075 percent of the value apart. It lies between -2000 and -1910 m/s.\n\nThe request, with the one input you change:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_stardust\", \"initial\": {\"radius_m\": 6495650.0, \"radial_speed_m_s\": \"\", \"transverse_speed_m_s\": 12604.2}, \"dt_s\": 0.05, \"segments\": [{\"steps\": 1420, \"load\": {}}], \"record_every\": 1420}}\n\nBudget: at most 3 calls that compute, counted over every call you make; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Both requests on your card must be among your calls.\n\nYou have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.\n\nEnd your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {\"tool\": \"\", \"arguments\": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.\n\nThe card:\n{\"holds\": {\"request\": ..., \"proof\": ...}, \"stops\": {\"request\": ..., \"proof\": ..., \"stopped\": \"\"}}\n\nholds: a request, the task's request with only the open input set, whose run completes. stops: the same request with another value of that input, whose run stops with the stop the task names. The two values are no further apart than the task's width, and both requests are among the calls you made. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.\n\nAlso write that answer card, by itself, to the file `/app/answer.json`.\n", + "grader": { + "command": "bash /tests/test.sh", + "file": "tasks/g2-budget-sd-airspeed-sink-e-t3/tests/test.sh", + "runs_in": "a fresh copy of the task image (environment_mode separate)", + "reward_file": "/logs/verifier/reward.json", + "scores": [ + "reward", + "correct", + "proofs_hold" + ] + }, + "mcp_servers": [ + { + "name": "verifier", + "transport": "stdio", + "command": "/usr/local/bin/mcp_stdio", + "args": [] + } + ], + "hud_export": "tasks/hud/tasks/g2-budget-sd-airspeed-sink-e-t3", + "artifacts": [ + "/app/answer.json", + "/app/calls.jsonl", + "/logs/agent/trajectory.json" + ], + "engine": { + "source": "https://github.com/johnkruze/zero-trust-physics-engine", + "tag": "v0.15.3", + "commit": "664d68f426ccdfd0159e5f91857edba3872390d1" + }, + "sha256": "a0cce3ce7940097238e77d9fea5fe57f764c987879768eac43feb9799d1ed1ce" + }, + { + "id": "g2-chain-sd-slab-radius-halfchar-h-r7", + "harbor_path": "tasks/g2-chain-sd-slab-radius-halfchar-h-r7", + "family": "chain_design", + "kind": "chained_design", + "prompt_file": "tasks/g2-chain-sd-slab-radius-halfchar-h-r7/instruction.md", + "prompt": "The Stardust sample return capsule enters the Earth's air with a radial speed of -2175.4 m/s (negative, downward) and a transverse speed of 12641.2 m/s, at a distance from the Earth's centre that you choose. Its heat shield's near-nose core is a slab of PICA, open record, version 3, 0.0434 m (43.4 mm) thick, starting at 281 K, heated by the capsule's own entry as the verifier hands it from the capsule's sealed run to the slab through their coupling, stardust_entry_to_pica_slab, radiating to surroundings at 294.4 K, and cooling with the stream off until 545 s.\n\nFind the largest starting distance from the Earth's centre, from 6482000 to 6494000 m, for which every constraint below holds. Give the passing design and the first failing design, no more than 12 m apart, and name the constraint that binds. The design that holds need not lie at either end of the range.\n\nConstraints (id (the request it is read from): what, limit):\n- half_char (solve): the depth at which the slab's density is half-way from char to virgin, in metres, at or below 0.0089922 m (8.9922 mm)\n- peak_load (run): the peak load on the capsule, in Earth g, over the whole entry, at or below 52.33 g\nEach design is two requests. The run of the capsule must end at the drogue-deployment condition (outcome ended, PastFlightDeployment). The run:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_stardust\", \"initial\": {\"radius_m\": \"\", \"radial_speed_m_s\": -2175.4, \"transverse_speed_m_s\": 12641.2}, \"dt_s\": 0.03125, \"segments\": [{\"steps\": \"\", \"load\": {}}], \"record_every\": 720}}\nThen the slab, a solve handed that run through the coupling, with these parameters:\n{\"tool\": \"solve\", \"arguments\": {\"solver\": \"ablator_slab\", \"parameters\": {\"material\": \"PICA, open record, version 3\", \"thickness_m\": 0.0434, \"start_temperature_k\": 281.0, \"face\": \"gas_stream\", \"stream_gas\": \"air\", \"surroundings_temperature_k\": 294.4, \"face_wears\": true}, \"from\": {\"request\": \"\", \"run_seal\": \"\", \"coupling\": \"stardust_entry_to_pica_slab\"}}}\nand its heating history laid out as the coupling's worked chain lays it: row 0 at 0 s with the first frame's pressure and enthalpy and a heat-transfer coefficient of 0; then one row per recorded frame, handed bit for bit (time, stagnation pressure, heat-transfer coefficient, recovery enthalpy); then a row 1 s after the last frame and a row at 545 s, each with the last frame's pressure and enthalpy and a heat-transfer coefficient of 0; a radiative heating of 0 in every row. thermocouple_depths_m and the return_ flags are yours to set. The run's record_every of 720 is the frames the coupling hands: keep it.\nThe run reports the largest and smallest of a quantity over all its steps when it is sent with \"readout\": {\"quantities\": [\"load_g\"]}; a readout is not part of the request or its seal, so the same run with or without one has one seal.\n\nBudget: at most 10 calls that compute, counted over every call you make, each run and each solve one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.\n\nYou have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.\n\nEnd your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {\"tool\": \"\", \"arguments\": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.\n\nThe card:\n{\"passing\": {\"run\": {\"request\": ..., \"proof\": ...}, \"solve\": {\"request\": ..., \"proof\": ...}}, \"failing\": {\"run\": {\"request\": ..., \"proof\": ...}, \"solve\": {\"request\": ..., \"proof\": ...}}, \"binding\": \"\"}\n\npassing: the design that keeps the constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks the constraint, no further from passing than the task's tolerance. binding: the id of the constraint. Each solve is the one handed its own design's sealed run through the coupling the task names. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.\n\nAlso write that answer card, by itself, to the file `/app/answer.json`.\n", + "grader": { + "command": "bash /tests/test.sh", + "file": "tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/test.sh", + "runs_in": "a fresh copy of the task image (environment_mode separate)", + "reward_file": "/logs/verifier/reward.json", + "scores": [ + "reward", + "correct", + "proofs_hold" + ] + }, + "mcp_servers": [ + { + "name": "verifier", + "transport": "stdio", + "command": "/usr/local/bin/mcp_stdio", + "args": [] + } + ], + "hud_export": "tasks/hud/tasks/g2-chain-sd-slab-radius-halfchar-h-r7", + "artifacts": [ + "/app/answer.json", + "/app/calls.jsonl", + "/logs/agent/trajectory.json" + ], + "engine": { + "source": "https://github.com/johnkruze/zero-trust-physics-engine", + "tag": "v0.15.3", + "commit": "664d68f426ccdfd0159e5f91857edba3872390d1" + }, + "sha256": "d8c783fdbec8158f99fbe8c4127a888f6f28845cf9261e817c6ea3b00f8036ab" + }, + { + "id": "g2-sd-slab-shallowest-char-load-v3", + "harbor_path": "tasks/g2-sd-slab-shallowest-char-load-v3", + "family": "tradeoff", + "kind": "design_to_limit", + "prompt_file": "tasks/g2-sd-slab-shallowest-char-load-v3/instruction.md", + "prompt": "The Stardust sample return capsule enters the Earth's air at 6501730 m from the Earth's centre, at 12837.7 m/s, at a flight-path angle below the horizontal that you choose. Its heat shield's near-nose core is a slab of PICA, open record, version 3, 59.4 mm thick, starting at 263.6 K, heated by the capsule's own entry as the verifier hands it from the capsule's sealed run to the slab through their coupling, stardust_entry_to_pica_slab, radiating to surroundings at 265.4 K, and cooling with the stream off until 580 s.\n\nFind the shallowest entry, from 8.58 to 9.28 degrees below the horizontal, for which every constraint below holds. Give the passing design and the first failing design, no more than 0.012 degrees of flight-path angle apart, and name the constraint that binds.\n\nConstraints (id, what, limit):\n- char_depth, the depth at which the slab's material is back within 2 percent of virgin density, in metres: at or below 0.016987 m (16.987 mm)\n- peak_load, the peak load on the capsule, in Earth g, over the whole entry: at or below 40.48 g\nEach design is two requests. The run of the capsule must end at the drogue-deployment condition (outcome ended, PastFlightDeployment). The run:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_stardust\", \"initial\": {\"radius_m\": 6501730.0, \"radial_speed_m_s\": \"-V sin(angle)\", \"transverse_speed_m_s\": \"V cos(angle)\"}, \"dt_s\": 0.03125, \"segments\": [{\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": 240, \"load\": {}}, {\"steps\": \"\", \"load\": {}}], \"record_every\": 720}}\nwith V = 12837.7 m/s and the angle in degrees below the horizontal.\nThen the slab, a solve handed that run through the coupling, with these parameters:\n{\"tool\": \"solve\", \"arguments\": {\"solver\": \"ablator_slab\", \"parameters\": {\"material\": \"PICA, open record, version 3\", \"thickness_m\": 0.0594, \"start_temperature_k\": 263.6, \"face\": \"gas_stream\", \"stream_gas\": \"air\", \"surroundings_temperature_k\": 265.4, \"face_wears\": true}, \"from\": {\"request\": \"\", \"run_seal\": \"\", \"coupling\": \"stardust_entry_to_pica_slab\"}}}\nand its heating history laid out as the coupling's worked chain lays it: row 0 at 0 s with the first frame's pressure and enthalpy and a heat-transfer coefficient of 0; then one row per recorded frame, handed bit for bit (time, stagnation pressure, heat-transfer coefficient, recovery enthalpy); then a row 1 s after the last frame and a row at 580 s, each with the last frame's pressure and enthalpy and a heat-transfer coefficient of 0; a radiative heating of 0 in every row. thermocouple_depths_m and the return_ flags are yours to set.\n\nBudget: at most 8 calls that compute, counted over every call you make, each run and each solve one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.\n\nYou have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.\n\nEnd your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {\"tool\": \"\", \"arguments\": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.\n\nThe card:\n{\"passing\": {\"run\": {\"request\": ..., \"proof\": ...}, \"solve\": {\"request\": ..., \"proof\": ...}}, \"failing\": {\"run\": {\"request\": ..., \"proof\": ...}, \"solve\": {\"request\": ..., \"proof\": ...}}, \"binding\": \"\"}\n\npassing: the design that keeps every constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks at least one constraint, no further from passing than the task's tolerance. binding: the id of the constraint that the failing design breaks and that sets the boundary. Leave out \"solve\" when the task has no solve. A solve is the one handed its own design's sealed run through the coupling the task names. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.\n\nAlso write that answer card, by itself, to the file `/app/answer.json`.\n", + "grader": { + "command": "bash /tests/test.sh", + "file": "tasks/g2-sd-slab-shallowest-char-load-v3/tests/test.sh", + "runs_in": "a fresh copy of the task image (environment_mode separate)", + "reward_file": "/logs/verifier/reward.json", + "scores": [ + "reward", + "correct", + "proofs_hold" + ] + }, + "mcp_servers": [ + { + "name": "verifier", + "transport": "stdio", + "command": "/usr/local/bin/mcp_stdio", + "args": [] + } + ], + "hud_export": "tasks/hud/tasks/g2-sd-slab-shallowest-char-load-v3", + "artifacts": [ + "/app/answer.json", + "/app/calls.jsonl", + "/logs/agent/trajectory.json" + ], + "engine": { + "source": "https://github.com/johnkruze/zero-trust-physics-engine", + "tag": "v0.15.3", + "commit": "664d68f426ccdfd0159e5f91857edba3872390d1" + }, + "sha256": "b82b0ccf091bd0046bfb5b531484795b8ae6109edef60e977b4413dc34b6c025" + }, + { + "id": "g2-forensics7-10", + "harbor_path": "tasks/g2-forensics7-10", + "family": "forensics", + "kind": "forensics", + "prompt_file": "tasks/g2-forensics7-10/instruction.md", + "prompt": "A report hands you ten claims about answers of the verifier. Each row gives the model, the request as it was sent, what its answer is claimed to say and the proof claimed for it. claim.outcome and claim.stop are the run's outcome and the name of its stop or declared end (null when it completed); claim.steps_landed is the last step the run is sealed to; claim.quantity and claim.value are one number of the final state of a run (of the result, for a solve); claim.flags are the advisory flags the run carried, each with the quantity it is on, its extent at the largest (extent) and the number of steps it was raised on (steps).\nSome rows are false. A false row may be wrong in more than one way; its reason is the first of these, in this order, that is true of it:\n1. retired_model: the request names a model ID the verifier does not serve (one it no longer serves, or a name it never served).\n2. parent_wrong: the request continues a run (from) that is not the parent it names: its start state, or the seal it gives for its parent, belongs to another run, and the verifier refuses the continuation.\n3. seal_wrong: the proof is not the seal of this request.\n4. stop_hidden: the run stops part way and the claim says it completed.\n5. step_wrong: the claim names the run's stop, but not the last step the run is sealed to.\n6. flag_omitted: the run carries an advisory flag (a name on a quantity) that the claim leaves out altogether.\n7. flag_altered: the flags the claim lists are not the run's, entry for entry: an extent or a count of steps differs, or an entry is missing or added where its name on that quantity is listed too (the verifier may list one flag on one quantity more than once, each with its own extent).\n8. value_altered: the claimed value is not the one the request gives, to the last digit.\nA row that is none of these is genuine, whatever else differs in how it is written (the order of its flags, a readout sent with the request, the spelling of a number). Name every false row with its reason.\nThe rows, one a line:\n{\"row\": \"R1\", \"model\": \"aerospace/solar_system\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"solar_system\", \"initial\": {\"sun_position_m\": [-863637229.4106485, -588455255.8381735, -225852694.17788354], \"sun_velocity_m_s\": [12.397135730588673, -8.676658356669796, -4.0448914054830265], \"mercury_position_m\": [30544984580.541214, 31538497612.618702, 13677667513.450943], \"mercury_velocity_m_s\": [-45893.79576346148, 28907.37310381068, 20202.882077964397], \"venus_position_m\": [-106439655769.27072, 15156574441.51891, 13539171068.575262], \"venus_velocity_m_s\": [-6662.526312895438, -31691.929801737846, -13835.48559151052], \"earth_position_m\": [102407858815.46872, -102611923461.79506, -44458723871.361084], \"earth_velocity_m_s\": [21351.990015305262, 18497.83118201897, 8019.230891774351], \"moon_position_m\": [102047097668.78308, -102736187163.71382, -44474590914.85404], \"moon_velocity_m_s\": [21609.833460848902, 17579.38315631339, 7638.85449892693], \"mars_position_m\": [-108034816249.35658, 196931821387.40118, 93267362532.8832], \"mars_velocity_m_s\": [-20818.954980749113, -8043.795945699443, -3126.300559642824], \"jupiter_position_m\": [419113155659.17053, 572916852927.5242, 235366142766.89377], \"jupiter_velocity_m_s\": [-10981.451664109512, 7203.166125214057, 3354.981129871713], \"saturn_position_m\": [810247233830.7081, 1028692408157.641, 390011764585.78156], \"saturn_velocity_m_s\": [-8280.517996609125, 5149.719611471784, 2483.289801876904], \"uranus_position_m\": [2242902225084.655, -1790169184837.4873, -815772837485.7194], \"uranus_velocity_m_s\": [4440.090766223361, 4422.709890451177, 1874.2294942165538], \"neptune_position_m\": [2597044231109.891, -3383482727434.8364, -1449535655907.9255], \"neptune_velocity_m_s\": [4405.7539005103245, 2969.8264977576428, 1105.8807943842667], \"ceres_position_m\": [-322236661229.9761, -227977183777.5967, -41837637472.4793], \"ceres_velocity_m_s\": [9380.707730841985, -13838.379917110064, -8421.170529908282], \"pallas_position_m\": [-351293366602.40656, -24289147273.497444, 28702819004.877907], \"pallas_velocity_m_s\": [-1948.7381903754856, -20307.781285208814, 4156.606512462996], \"vesta_position_m\": [166331403121.10275, -256906652758.2719, -124134856049.41298], \"vesta_velocity_m_s\": [18295.602252098583, 9577.160570429965, 1423.2851008847358], \"energy_anchor\": -1.321940998513625e+25, \"booked_work\": 0.0, \"angular_momentum_anchor\": [5.490282510087069e+31, -8.153754585822945e+32, 1.9244191261307657e+33], \"booked_torque\": [0.0, 0.0, 0.0]}, \"dt_s\": 1677.0, \"segments\": [{\"steps\": 9, \"load\": {}}, {\"steps\": 10, \"load\": {}}, {\"steps\": 11, \"load\": {}}, {\"steps\": 12, \"load\": {}}, {\"steps\": 13, \"load\": {}}, {\"steps\": 14, \"load\": {}}, {\"steps\": 15, \"load\": {}}], \"record_every\": 84, \"readout\": {\"quantities\": [\"earth_mars_distance_m\"]}}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 84, \"quantity\": \"earth_mars_distance_m\", \"value\": 390895599447.7874, \"flags\": []}, \"proof\": \"0cc96b6596b63629b419c167374ae7ab4a2b01eea6b41026478ecd3e3e3519f0257c279d9ee2b73cf297642b476eecb4\"}\n{\"row\": \"R2\", \"model\": \"aerospace/capsule_insight\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_insight\", \"initial\": {\"radius_m\": 3519545.0, \"radial_speed_m_s\": -1340.4281, \"transverse_speed_m_s\": 5819.933}, \"dt_s\": 0.1, \"segments\": [{\"steps\": 2195, \"load\": {\"lift_over_drag\": 0.0}}], \"record_every\": 2195}}, \"claim\": {\"outcome\": \"ended\", \"stop\": \"PastFlightDeployment\", \"steps_landed\": 1975, \"quantity\": \"mach\", \"value\": 1.414380813182044, \"flags\": []}, \"proof\": \"caf9fef4f3cfb1be4d6d1234fb1484c1525d788b0f09706c6f48f9d4be552533f0c55af43f8dda1ae3d7869b6a3f82c5\"}\n{\"row\": \"R3\", \"model\": \"aerospace/crater_ryugu_sci\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"crater_ryugu_sci\", \"initial\": {\"radius_m\": 3.395}, \"dt_s\": 0.163, \"segments\": [{\"steps\": 201, \"load\": {}}, {\"steps\": 222, \"load\": {}}, {\"steps\": 243, \"load\": {}}], \"record_every\": 666}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 666, \"quantity\": \"radius_m\", \"value\": 6.8729656389716265, \"flags\": []}, \"proof\": \"6d6b45da8cf15848762712a1d05b1b8f3b1b9d6303f2c0162e30dfa6d44ec950766e5b6bf074c739440ff306f1889a0a\"}\n{\"row\": \"R4\", \"model\": \"aerospace/capsule_stardust\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_stardust\", \"initial\": {\"radius_m\": 6488061.0, \"radial_speed_m_s\": -2105.71, \"transverse_speed_m_s\": 12576.74}, \"dt_s\": 0.05, \"segments\": [{\"steps\": 3193, \"load\": {}}], \"record_every\": 3193, \"readout\": {\"quantities\": [\"altitude_m\"]}}}, \"claim\": {\"outcome\": \"ended\", \"stop\": \"PastFlightDeployment\", \"steps_landed\": 1929, \"quantity\": \"altitude_m\", \"value\": 31025.876497731544, \"flags\": [{\"flag\": \"FLAG_DROGUE_MACH_WINDOW\", \"quantity\": \"mach\", \"extent\": 0.39864147264033933, \"steps\": 190}, {\"flag\": \"FLAG_DROGUE_MACH_WINDOW\", \"quantity\": \"mach\", \"extent\": 0.39990473030213836, \"steps\": 190}, {\"flag\": \"FLAG_MACH_TABLE_HELD\", \"quantity\": \"mach\", \"extent\": 0.02429835996056795, \"steps\": 2}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"air_speed_m_s\", \"extent\": 155.89247760455874, \"steps\": 484}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"air_speed_m_s\", \"extent\": 1697.5036915755654, \"steps\": 1243}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"path_sine\", \"extent\": 0.048142951009741516, \"steps\": 1005}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"path_sine\", \"extent\": 0.06286079576874015, \"steps\": 851}]}, \"proof\": \"fa2be55cda475420e0f90829833bea259ff32039b96724066963ad9de7ee75937d6f50458965183ad3962d5197a6062b\"}\n{\"row\": \"R5\", \"model\": \"plasma_sheath_ram_c2\", \"request\": {\"tool\": \"solve\", \"arguments\": {\"solver\": \"plasma_sheath_ram_c2\", \"parameters\": {\"altitude_m\": 55180.0, \"velocity_m_s\": 6896.0, \"signal_frequency_hz\": 4157000000.0}}}, \"claim\": {\"outcome\": \"converged\", \"stop\": null, \"steps_landed\": null, \"quantity\": \"stagnation_temperature_k\", \"value\": 6383.526355576421, \"flags\": []}, \"proof\": \"70b0239e697034b92172ce494691215f79d0c4a56078257a3e624b2ee111ef7e94ef97df0177ac97270ec674bda20422\"}\n{\"row\": \"R6\", \"model\": \"ablator_slab\", \"request\": {\"tool\": \"solve\", \"arguments\": {\"solver\": \"ablator_slab\", \"parameters\": {\"material\": \"PICA, open record, version 5\", \"thickness_m\": 0.04845, \"start_temperature_k\": 308.75, \"thermocouple_depths_m\": [], \"face\": \"held_temperature\", \"held_temperature_k\": 1976.0, \"hold_duration_s\": 63.85, \"continue_after_s\": 43.15, \"return_face_history\": false, \"return_thermocouple_histories\": false, \"return_final_profile\": false}}}, \"claim\": {\"outcome\": \"converged\", \"stop\": null, \"steps_landed\": null, \"quantity\": \"depth_within_2_percent_of_virgin_m\", \"value\": 0.014116399858056352, \"flags\": []}, \"proof\": \"96e1a407a5dcf744722373aa7715f472762d5816c796d3073ee9f8970fc1ce3ed5bb10c6cc151e88ee32c13bc1cb681b\"}\n{\"row\": \"R7\", \"model\": \"aerospace/momentum_jwst_dihedral\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_dihedral\", \"initial\": {\"h_eci_nms\": [-1.429, 1.053, -1.498]}, \"dt_s\": 1910.0, \"segments\": [{\"steps\": 49, \"load\": {\"q1\": 0.638559, \"q2\": -0.019, \"q3\": -0.652891, \"q4\": 0.406959, \"sun_x\": 0.616092, \"sun_y\": 0.703148, \"sun_z\": 0.354984, \"sun_distance_au\": 1.01415}}, {\"steps\": 45, \"load\": {\"q1\": 0.748856, \"q2\": -0.003607, \"q3\": -0.560934, \"q4\": 0.352923, \"sun_x\": 0.674752, \"sun_y\": 0.668222, \"sun_z\": 0.313352, \"sun_distance_au\": 1.01415}}], \"record_every\": 94, \"readout\": {\"quantities\": [\"h_magnitude_nms\"]}}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 94, \"quantity\": \"h_magnitude_nms\", \"value\": 5.002332004564212, \"flags\": []}, \"proof\": \"a93f9cd7a27d8851a5b9c4996bfa3d1f7c1c31622907a4c743501d5727ba57a8d39f657eca88e8928d1a19ee417ca01d\"}\n{\"row\": \"R8\", \"model\": \"aerospace/momentum_jwst_srp\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_srp\", \"initial\": {\"h_eci_nms\": [0.918, -1.255, 0.815]}, \"dt_s\": 874.0, \"segments\": [{\"steps\": 44, \"load\": {\"q1\": 0.685819, \"q2\": 0.011638, \"q3\": -0.603055, \"q4\": 0.407236, \"sun_x\": 0.616092, \"sun_y\": 0.713107, \"sun_z\": 0.334528, \"sun_distance_au\": 1.01161}}, {\"steps\": 32, \"load\": {\"q1\": 0.659909, \"q2\": -0.005461, \"q3\": -0.631303, \"q4\": 0.407365, \"sun_x\": 0.634305, \"sun_y\": 0.70673, \"sun_z\": 0.313352, \"sun_distance_au\": 0.1851}}], \"record_every\": 76}}, \"claim\": {\"outcome\": \"refused\", \"stop\": \"SunshieldAboveKaptonLimit\", \"steps_landed\": 118, \"quantity\": \"h_magnitude_nms\", \"value\": 1.6088350681235042, \"flags\": []}, \"proof\": \"2802624f097f31c406fcd6c90107e0c92b0856ada8ab7aefd2a74b0db13c863229e6ac88939c9df175a48db8856bbc9d\"}\n{\"row\": \"R9\", \"model\": \"aerospace/satellite_lageos1_twin\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"satellite_lageos1_twin\", \"initial\": {\"epoch_utc_s\": 844432990.0, \"forecast_elapsed_s\": 0.0, \"position_m\": [-5947439.326, 2555567.396, 10470793.788], \"velocity_m_s\": [4754.057, 2345.016, 2292.947]}, \"dt_s\": 10.0, \"segments\": [{\"steps\": 1614, \"load\": {}}], \"record_every\": 1614}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 1614, \"quantity\": \"semi_major_axis_m\", \"value\": 11400874.582902145, \"flags\": [{\"flag\": \"FLAG_BELOW_COMPARED_RADIUS\", \"quantity\": \"radius_m\", \"extent\": 1559062.143708026, \"steps\": 994}, {\"flag\": \"FLAG_EARTH_SHADOW\", \"quantity\": \"distance_from_shadow_axis_m\", \"extent\": 1409415.657917643, \"steps\": 183}]}, \"proof\": \"760e36d0a9c7ce7d7bc1e45f15334a31f23e242ce276c2b84454dfdcf21ca745576a3557773a024e0d7bedcd90133779\"}\n{\"row\": \"R10\", \"model\": \"aerospace/crater_ryugu_sci\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"crater_ryugu_sci\", \"initial\": {\"radius_m\": 1.25}, \"dt_s\": 0.1285, \"segments\": [{\"steps\": 210, \"load\": {}}, {\"steps\": 231, \"load\": {}}, {\"steps\": 252, \"load\": {}}, {\"steps\": 273, \"load\": {}}, {\"steps\": 294, \"load\": {}}, {\"steps\": 315, \"load\": {}}], \"record_every\": 1575}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 1575, \"quantity\": \"radius_m\", \"value\": 7.823494707379572, \"flags\": []}, \"proof\": \"e6950ae5d4f4d0953321d1013624d3ce599b23249db4d6075c705be83c6b66f37cbf9a67bb109ddbf36bd7003945bd86\"}\n\nBudget: at most 4 calls that compute, counted over every call you make (every run_trajectory, solve, compute_step and verify_ call counts, refused or not); list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all.\n\nYou have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.\n\nEnd your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {\"tool\": \"\", \"arguments\": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.\n\nThe card:\n{\"false_rows\": {\"\": \"\", ...}}\n\nName every false row, each with its one reason from retired_model, parent_wrong, seal_wrong, stop_hidden, step_wrong, flag_omitted, flag_altered, value_altered (the first of them, in that order, that is true of the row). Leave the genuine rows out. {\"false_rows\": {}} says every row is genuine. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.\n\nAlso write that answer card, by itself, to the file `/app/answer.json`.\n", + "grader": { + "command": "bash /tests/test.sh", + "file": "tasks/g2-forensics7-10/tests/test.sh", + "runs_in": "a fresh copy of the task image (environment_mode separate)", + "reward_file": "/logs/verifier/reward.json", + "scores": [ + "reward", + "correct", + "proofs_hold" + ] + }, + "mcp_servers": [ + { + "name": "verifier", + "transport": "stdio", + "command": "/usr/local/bin/mcp_stdio", + "args": [] + } + ], + "hud_export": "tasks/hud/tasks/g2-forensics7-10", + "artifacts": [ + "/app/answer.json", + "/app/calls.jsonl", + "/logs/agent/trajectory.json" + ], + "engine": { + "source": "https://github.com/johnkruze/zero-trust-physics-engine", + "tag": "v0.15.3", + "commit": "664d68f426ccdfd0159e5f91857edba3872390d1" + }, + "sha256": "f75bc62ade60abfef552868fd25cc660492cbc65b1db91d70b6d432ac9defba2" + }, + { + "id": "g2-forensics6-07", + "harbor_path": "tasks/g2-forensics6-07", + "family": "forensics", + "kind": "forensics", + "prompt_file": "tasks/g2-forensics6-07/instruction.md", + "prompt": "A report hands you twelve claims about answers of the verifier. Each row gives the model, the request as it was sent, what its answer is claimed to say and the proof claimed for it. claim.outcome and claim.stop are the run's outcome and the name of its stop or declared end (null when it completed); claim.steps_landed is the last step the run is sealed to; claim.quantity and claim.value are one number of the final state of a run (of the result, for a solve); claim.flags are the advisory flags the run carried, each with the quantity it is on, its extent at the largest (extent) and the number of steps it was raised on (steps).\nSome rows are false. A false row may be wrong in more than one way; its reason is the first of these, in this order, that is true of it:\n1. retired_model: the request names a model ID the verifier does not serve (one it no longer serves, or a name it never served).\n2. parent_wrong: the request continues a run (from) that is not the parent it names: its start state, or the seal it gives for its parent, belongs to another run, and the verifier refuses the continuation.\n3. seal_wrong: the proof is not the seal of this request.\n4. stop_hidden: the run stops part way and the claim says it completed.\n5. step_wrong: the claim names the run's stop, but not the last step the run is sealed to.\n6. flag_omitted: the run carries an advisory flag (a name on a quantity) that the claim leaves out altogether.\n7. flag_altered: the flags the claim lists are not the run's, entry for entry: an extent or a count of steps differs, or an entry is missing or added where its name on that quantity is listed too (the verifier may list one flag on one quantity more than once, each with its own extent).\n8. value_altered: the claimed value is not the one the request gives, to the last digit.\nA row that is none of these is genuine, whatever else differs in how it is written (the order of its flags, a readout sent with the request, the spelling of a number). Name every false row with its reason.\nThe rows, one a line:\n{\"row\": \"R1\", \"model\": \"aerospace/momentum_jwst_srp\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_srp\", \"initial\": {\"h_eci_nms\": [-1.244, -0.73, 1.098]}, \"dt_s\": 1599.0, \"segments\": [{\"steps\": 69, \"load\": {\"q1\": 0.655763, \"q2\": -0.008127, \"q3\": -0.635608, \"q4\": 0.407321, \"sun_x\": 0.616092, \"sun_y\": 0.711198, \"sun_z\": 0.338568, \"sun_distance_au\": 1.00863}}], \"record_every\": 69}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 69, \"quantity\": \"h_magnitude_nms\", \"value\": 2.2890861976984564, \"flags\": []}, \"proof\": \"949c987ad62f835ca215267699517ed2e659b5e776277779896aaf721a03f139d674ea7e0f671e6160f37eaca17eaade\"}\n{\"row\": \"R2\", \"model\": \"aerospace/capsule_insight\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_insight\", \"initial\": {\"radius_m\": 3522956.0, \"radial_speed_m_s\": -1294.7972, \"transverse_speed_m_s\": 5730.5432}, \"dt_s\": 0.1, \"segments\": [{\"steps\": 2152, \"load\": {\"lift_over_drag\": 0.0}}], \"record_every\": 2152}}, \"claim\": {\"outcome\": \"ended\", \"stop\": \"PastFlightDeployment\", \"steps_landed\": 2115, \"quantity\": \"mach\", \"value\": 1.3960519703767567, \"flags\": []}, \"proof\": \"a4065183ea2043a6b9568252634e364467b059fc61f9a23478a29d53c70035b9b199b77f07d277aa257df8e292b9ce3b\"}\n{\"row\": \"R3\", \"model\": \"ablator_slab\", \"request\": {\"tool\": \"solve\", \"arguments\": {\"solver\": \"ablator_slab\", \"parameters\": {\"material\": \"TACOT 3.0\", \"thickness_m\": 0.0461, \"start_temperature_k\": 306.3, \"thermocouple_depths_m\": [], \"face\": \"held_temperature\", \"held_temperature_k\": 1920.0, \"hold_duration_s\": 60.0, \"continue_after_s\": 40.0, \"return_face_history\": false, \"return_thermocouple_histories\": false, \"return_final_profile\": false}}}, \"claim\": {\"outcome\": \"converged\", \"stop\": null, \"steps_landed\": null, \"quantity\": \"heat_in_through_face_j_per_m2\", \"value\": 7320760.59153902, \"flags\": []}, \"proof\": \"eec6980868952c49cd6a1017930f98d396e4452a470c6fa0eacd9b4e00d4aa1c3c32a4c83a59d23ebb96511b2071cec9\"}\n{\"row\": \"R4\", \"model\": \"aerospace/satellite_lageos1\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"satellite_lageos1\", \"initial\": {\"epoch_utc_s\": 844014880.0, \"forecast_elapsed_s\": 0.0, \"position_m\": [4229354.428, 1727500.405, 11440357.84], \"velocity_m_s\": [4061.944, -1496.84, -849.917]}, \"dt_s\": 10.0, \"segments\": [{\"steps\": 1742, \"load\": {}}], \"record_every\": 1742}}, \"claim\": {\"outcome\": \"refused\", \"stop\": \"RadiusBelowEarthRadius\", \"steps_landed\": 1810, \"quantity\": \"radius_m\", \"value\": 6394735.022733123, \"flags\": [{\"flag\": \"FLAG_BELOW_COMPARED_RADIUS\", \"quantity\": \"radius_m\", \"extent\": 5602264.977266877, \"steps\": 232}, {\"flag\": \"FLAG_EARTH_SHADOW\", \"quantity\": \"distance_from_shadow_axis_m\", \"extent\": 1013479.6278764848, \"steps\": 36}]}, \"proof\": \"7d233dcfc07a2e1911dfb85fa0fea029ca687f3514cbba06fdf88864e906828e6417cdfe59a34263e9a9936df3787eeb\"}\n{\"row\": \"R5\", \"model\": \"aerospace/momentum_jwst_srp\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_srp\", \"initial\": {\"h_eci_nms\": [-1.622, -0.964, 1.404]}, \"dt_s\": 1941.0, \"segments\": [{\"steps\": 105, \"load\": {\"q1\": 0.613497, \"q2\": -0.034325, \"q3\": -0.676494, \"q4\": 0.405953, \"sun_x\": 0.616092, \"sun_y\": 0.704136, \"sun_z\": 0.353019, \"sun_distance_au\": 1.01277}}], \"record_every\": 105}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 105, \"quantity\": \"h_magnitude_nms\", \"value\": 6.973018347360404, \"flags\": []}, \"proof\": \"ad1969f7ba7bdeb622e3b8e1d44f0d24ec27d0e37940f1b0109488c8a140a98d6b533e80d8516dd6570125efcd1661ca\"}\n{\"row\": \"R6\", \"model\": \"aerospace/momentum_jwst_srp\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_srp\", \"initial\": {\"h_eci_nms\": [-1.055, -0.613, 0.945]}, \"dt_s\": 1428.0, \"segments\": [{\"steps\": 51, \"load\": {\"q1\": 0.675887, \"q2\": 0.004991, \"q3\": -0.614166, \"q4\": 0.407371, \"sun_x\": 0.616092, \"sun_y\": 0.714618, \"sun_z\": 0.331289, \"sun_distance_au\": 1.00656}}], \"record_every\": 51, \"readout\": {\"quantities\": [\"h_magnitude_nms\"]}}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 51, \"quantity\": \"h_magnitude_nms\", \"value\": 1.2538931414748378, \"flags\": []}, \"proof\": \"03d88323f8f93f53797cbc48775f27fd6a07de18484442a71b7150623946a49b71ae478a13981aefc1278e97d0ba94e7\"}\n{\"row\": \"R7\", \"model\": \"aerospace/solar_system\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"solar_system\", \"initial\": {\"sun_position_m\": [-972177542.8424704, -500214545.81043047, -185162850.5512162], \"sun_velocity_m_s\": [10.943471273744956, -10.354907507003432, -4.725295041665638], \"mercury_position_m\": [44347944047.32132, -35386831719.91674, -23520589495.944], \"mercury_velocity_m_s\": [23179.557544578543, 34737.11717051704, 16153.15243244726], \"venus_position_m\": [107378854594.44405, -3855694027.194445, -8551901158.778554], \"venus_velocity_m_s\": [1922.5971467016116, 31772.25497050463, 14172.860625157742], \"earth_position_m\": [-131048132650.02007, -69568840294.57173, -30130222428.765972], \"earth_velocity_m_s\": [14439.696511929173, -23759.193577978716, -10300.838662315398], \"moon_position_m\": [-131336010046.59302, -69827768665.01813, -30206075001.525085], \"moon_velocity_m_s\": [15090.044579869322, -24450.210577738573, -10619.619444665168], \"mars_position_m\": [99849753635.60847, 183319992199.24744, 81400974963.10365], \"mars_velocity_m_s\": [-20727.719446230996, 11533.19274335954, 5850.623327698212], \"jupiter_position_m\": [514628857491.4813, 498738500952.13635, 201244273740.58517], \"jupiter_velocity_m_s\": [-9599.899310141725, 8786.610935350978, 4000.0870026696048], \"saturn_position_m\": [885052478191.6257, 978750373225.096, 366165774373.12665], \"saturn_velocity_m_s\": [-7872.030702860459, 5633.288132226103, 2665.365518089133], \"uranus_position_m\": [2201312313161.7573, -1830733084174.7542, -832950501719.338], \"uranus_velocity_m_s\": [4543.09354375023, 4338.812277392898, 1836.0266601992553], \"neptune_position_m\": [2556089531027.0625, -3410769562986.1963, -1459684701878.0127], \"neptune_velocity_m_s\": [4440.424297199966, 2924.108717975938, 1086.3053554716744], \"ceres_position_m\": [-376564661494.9705, -82793770650.16934, 37539835502.66692], \"ceres_velocity_m_s\": [2078.7472741961246, -17061.59058649498, -8451.939414743216], \"pallas_position_m\": [-285475111420.94836, 157884218572.5715, -11922623410.065147], \"pallas_velocity_m_s\": [-12324.053945853098, -17981.78998150534, 4412.172020403093], \"vesta_position_m\": [-20413884754.428905, -300115898744.55383, -116942553506.93321], \"vesta_velocity_m_s\": [20962.21629618035, -627.1836731673636, -2988.3711172821936], \"energy_anchor\": -1.3219409983492277e+25, \"booked_work\": 0.0, \"angular_momentum_anchor\": [5.490282510021932e+31, -8.153754585664557e+32, 1.9244191260936244e+33], \"booked_torque\": [0.0, 0.0, 0.0]}, \"dt_s\": 1444.0, \"segments\": [{\"steps\": 6, \"load\": {}}, {\"steps\": 7, \"load\": {}}, {\"steps\": 8, \"load\": {}}, {\"steps\": 9, \"load\": {}}], \"record_every\": 30, \"readout\": {\"quantities\": [\"earth_mars_distance_m\"]}}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 30, \"quantity\": \"earth_mars_distance_m\", \"value\": 360459888729.46576, \"flags\": []}, \"proof\": \"e584421f53f10db28a78d74a117cfc06b70f10a6cd5a8edfccbd8f76cbd63845b21a93ee0d2b86eac20331f5a33cc32b\"}\n{\"row\": \"R8\", \"model\": \"aerospace/capsule_stardust\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_stardust\", \"initial\": {\"radius_m\": 6487681.0, \"radial_speed_m_s\": -2026.81, \"transverse_speed_m_s\": 12555.79}, \"dt_s\": 0.05, \"segments\": [{\"steps\": 3073, \"load\": {}}], \"record_every\": 3073, \"readout\": {\"quantities\": [\"ground_distance_m\"]}}}, \"claim\": {\"outcome\": \"ended\", \"stop\": \"PastFlightDeployment\", \"steps_landed\": 2015, \"quantity\": \"ground_distance_m\", \"value\": 617475.7093449463, \"flags\": [{\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"path_sine\", \"extent\": 0.049833167255976536, \"steps\": 880}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"path_sine\", \"extent\": 0.040780280423902485, \"steps\": 1050}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"air_speed_m_s\", \"extent\": 1431.0624296764208, \"steps\": 1231}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"air_speed_m_s\", \"extent\": 189.96215207054047, \"steps\": 524}, {\"flag\": \"FLAG_DROGUE_MACH_WINDOW\", \"quantity\": \"mach\", \"extent\": 0.39949110594929116, \"steps\": 195}, {\"flag\": \"FLAG_DROGUE_MACH_WINDOW\", \"quantity\": \"mach\", \"extent\": 0.3987609440499196, \"steps\": 195}]}, \"proof\": \"3c2f0b68016777a8ea47683b523e67425743046af710d339be26b0801f7acb6a63bd125f2dc439ead5719719ecc90dbb\"}\n{\"row\": \"R9\", \"model\": \"plasma_sheath_ramc2\", \"request\": {\"tool\": \"solve\", \"arguments\": {\"solver\": \"plasma_sheath_ramc2\", \"parameters\": {\"altitude_m\": 65260.0, \"velocity_m_s\": 8582.0, \"signal_frequency_hz\": 8234000000.0}}}, \"claim\": {\"outcome\": \"converged\", \"stop\": null, \"steps_landed\": null, \"quantity\": \"station2_electron_density_m3\", \"value\": 5.665499503721301e+18, \"flags\": []}, \"proof\": \"0835e993c83234e8ed833a8d39db824f039eb71ea77c309c76720162a6e41a59ccd8190b85384a21a3bb84183f442fbf\"}\n{\"row\": \"R10\", \"model\": \"aerospace/los_jwst_fine_guide\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"los_jwst_fine_guide\", \"initial\": {\"lock_x_arcsec\": 29.207, \"lock_y_arcsec\": -11.348, \"quiet_before_start_s\": 38.16}, \"dt_s\": 0.064, \"segments\": [{\"steps\": 3, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20685, \"centroid_y_arcsec\": -11.34796, \"counts_per_s\": 293200.0}}, {\"steps\": 1, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20706, \"centroid_y_arcsec\": -11.34813, \"counts_per_s\": 293200.0}}, {\"steps\": 2, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20727, \"centroid_y_arcsec\": -11.34796, \"counts_per_s\": 293200.0}}, {\"steps\": 3, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20685, \"centroid_y_arcsec\": -11.34813, \"counts_per_s\": 293200.0}}, {\"steps\": 1, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20706, \"centroid_y_arcsec\": -11.34796, \"counts_per_s\": 293200.0}}, {\"steps\": 2, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20727, \"centroid_y_arcsec\": -11.34813, \"counts_per_s\": 293200.0}}, {\"steps\": 3, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20685, \"centroid_y_arcsec\": -11.34796, \"counts_per_s\": 293200.0}}, {\"steps\": 1, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20706, \"centroid_y_arcsec\": -11.34813, \"counts_per_s\": 293200.0}}, {\"steps\": 2, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20727, \"centroid_y_arcsec\": -11.34796, \"counts_per_s\": 293200.0}}], \"record_every\": 18}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 18, \"quantity\": \"estimate_y_mas\", \"value\": 0.000761549984910976, \"flags\": []}, \"proof\": \"f3de03ad5a49c1f27c156b8d58a2d143f777aa5fb5c459524b72678085d6f40a16eb5b8dade2b6ec34aa9865f4368bc7\"}\n{\"row\": \"R11\", \"model\": \"aerospace/momentum_jwst_dihedral\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_dihedral\", \"initial\": {\"h_eci_nms\": [1.121506850922792, 0.4000086686906281, 1.2782357873204517]}, \"dt_s\": 1620.0, \"segments\": [{\"steps\": 57, \"load\": {\"q1\": 0.626313, \"q2\": -0.026561, \"q3\": -0.664647, \"q4\": 0.406535, \"sun_x\": 0.581366, \"sun_y\": 0.750882, \"sun_z\": 0.313352, \"sun_distance_au\": 1.0106}}], \"record_every\": 57, \"from\": {\"request\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_dihedral\", \"initial\": {\"h_eci_nms\": [1.057, 0.661, -1.263]}, \"dt_s\": 1620.0, \"segments\": [{\"steps\": 45, \"load\": {\"q1\": 0.705492, \"q2\": 0.058115, \"q3\": -0.557927, \"q4\": 0.433151, \"sun_x\": 0.629673, \"sun_y\": 0.722662, \"sun_z\": 0.285081, \"sun_distance_au\": 1.0104}}], \"record_every\": 45}, \"run_seal\": \"50be7c19d63da96301f1e0edfd5ed2ff425a426e8fe4e4acc9cd6269d4ff5667db7e0b37f14ad3215a9741526ee2b189\"}}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 57, \"quantity\": \"h_magnitude_nms\", \"value\": 2.5762879795193383, \"flags\": []}, \"proof\": \"647a4baa677e63010302d970dec4c6d51f25ade699b52280cee7ff1ff0403679a724f0e0fd0d7643bf5d0d037e42b424\"}\n{\"row\": \"R12\", \"model\": \"aerospace/crater_ryugu_sci\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"crater_ryugu_sci\", \"initial\": {\"radius_m\": 1.155}, \"dt_s\": 0.1415, \"segments\": [{\"steps\": 215, \"load\": {}}, {\"steps\": 238, \"load\": {}}, {\"steps\": 261, \"load\": {}}, {\"steps\": 284, \"load\": {}}, {\"steps\": 307, \"load\": {}}, {\"steps\": 330, \"load\": {}}], \"record_every\": 1635, \"readout\": {\"quantities\": [\"radius_m\"]}}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 1635, \"quantity\": \"radius_m\", \"value\": 8.038589347556837, \"flags\": []}, \"proof\": \"4e66884da3bdfb79ac5594a27861f9a025d797903b4d2f127f503fd89a7bc9e96639f499b3eb8e87a6b36e0c3c12d38e\"}\n\nBudget: at most 4 calls that compute, counted over every call you make (every run_trajectory, solve, compute_step and verify_ call counts, refused or not); list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all.\n\nYou have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card.\n\nEnd your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {\"tool\": \"\", \"arguments\": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request.\n\nThe card:\n{\"false_rows\": {\"\": \"\", ...}}\n\nName every false row, each with its one reason from retired_model, parent_wrong, seal_wrong, stop_hidden, step_wrong, flag_omitted, flag_altered, value_altered (the first of them, in that order, that is true of the row). Leave the genuine rows out. {\"false_rows\": {}} says every row is genuine. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all.\n\nAlso write that answer card, by itself, to the file `/app/answer.json`.\n", + "grader": { + "command": "bash /tests/test.sh", + "file": "tasks/g2-forensics6-07/tests/test.sh", + "runs_in": "a fresh copy of the task image (environment_mode separate)", + "reward_file": "/logs/verifier/reward.json", + "scores": [ + "reward", + "correct", + "proofs_hold" + ] + }, + "mcp_servers": [ + { + "name": "verifier", + "transport": "stdio", + "command": "/usr/local/bin/mcp_stdio", + "args": [] + } + ], + "hud_export": "tasks/hud/tasks/g2-forensics6-07", + "artifacts": [ + "/app/answer.json", + "/app/calls.jsonl", + "/logs/agent/trajectory.json" + ], + "engine": { + "source": "https://github.com/johnkruze/zero-trust-physics-engine", + "tag": "v0.15.3", + "commit": "664d68f426ccdfd0159e5f91857edba3872390d1" + }, + "sha256": "9496dc0eb603f9bf46343d422416253a17b0d04dfbcedddbd765332ef58685db" + } + ], + "hud_import": { + "command": "hud harbor import tasks/harbor/tasks --taskset ", + "docs": "https://docs.hud.ai/platform/harbor-import", + "gives": "browse, compare and QA on HUD; HUD does not run imported Harbor tasks" + } +} \ No newline at end of file diff --git a/sample/tasks/harbor/registry.json b/sample/tasks/harbor/registry.json new file mode 100644 index 0000000000000000000000000000000000000000..3536c48aff6bdde448ae84bc6ba634710e2eef60 --- /dev/null +++ b/sample/tasks/harbor/registry.json @@ -0,0 +1,29 @@ +[ + { + "name": "zero-trust-physics-sample-orbital-space-atmospheric-entry", + "version": "2026-11-13", + "description": "Free sample of Protocol Company's Group 2 Domain Pack: 5 multi-step physics environments (a budgeted search, a design to a limit, a chained design, two forensics audits), each scored by a program on the Zero-Trust Physics verifier (v0.15.3).", + "tasks": [ + { + "name": "g2-budget-sd-airspeed-sink-e-t3", + "path": "tasks/g2-budget-sd-airspeed-sink-e-t3" + }, + { + "name": "g2-chain-sd-slab-radius-halfchar-h-r7", + "path": "tasks/g2-chain-sd-slab-radius-halfchar-h-r7" + }, + { + "name": "g2-sd-slab-shallowest-char-load-v3", + "path": "tasks/g2-sd-slab-shallowest-char-load-v3" + }, + { + "name": "g2-forensics7-10", + "path": "tasks/g2-forensics7-10" + }, + { + "name": "g2-forensics6-07", + "path": "tasks/g2-forensics6-07" + } + ] + } +] diff --git a/sample/tasks/harbor/task_checksums.json b/sample/tasks/harbor/task_checksums.json new file mode 100644 index 0000000000000000000000000000000000000000..62bd05efdc660d8f4d682777d498988feabc696a --- /dev/null +++ b/sample/tasks/harbor/task_checksums.json @@ -0,0 +1,45 @@ +{ + "algorithm": "sha256 and sha384 over every file of the task: relative path, NUL, bytes, in sorted path order", + "tasks": { + "g2-budget-sd-airspeed-sink-e-t3": { + "path": "tasks/g2-budget-sd-airspeed-sink-e-t3", + "sha256": "a0cce3ce7940097238e77d9fea5fe57f764c987879768eac43feb9799d1ed1ce", + "sha384": "dce078617db66570521e3d603a5060b23ca75a1dd0c20703234affd8a3c0f57692bc8f7e0f6b1efe019b7024fe4a71cd", + "row_sha256": "4559af9ec6da8de3222aeac4fa145e8ae24e218b71b019b602e36246c55034c9", + "row_sha384": "4c80776dc378202d6610e7806aae6e6bc8995ed2af61c3e9aebe0e9519009cf8f389e564ff71e96ee639f0ee11732a94", + "files": 18 + }, + "g2-chain-sd-slab-radius-halfchar-h-r7": { + "path": "tasks/g2-chain-sd-slab-radius-halfchar-h-r7", + "sha256": "d8c783fdbec8158f99fbe8c4127a888f6f28845cf9261e817c6ea3b00f8036ab", + "sha384": "597d6b47a8c2cbdb245aad2aac7ce496d5790bef7f9dfbdcd9f201078a9d55a9aa69f47d5944e10ac39f927ced7a45aa", + "row_sha256": "78049096d10266290151d85077e2305570a085f3afb1e8241a8948e717ea3f04", + "row_sha384": "8a59112e526860afa257d56f2748f27d33691d4bd7d18bd65cc48e0810f4366c61d8cc8958696dbb71b38cee8e3e0a49", + "files": 18 + }, + "g2-sd-slab-shallowest-char-load-v3": { + "path": "tasks/g2-sd-slab-shallowest-char-load-v3", + "sha256": "b82b0ccf091bd0046bfb5b531484795b8ae6109edef60e977b4413dc34b6c025", + "sha384": "bd448d6db770c32198051befef8b5eb57917c14a9a6cf364c1e148e3158a03c4416ab19b04badab160233ad17644be6a", + "row_sha256": "47398ee9fcb4691950b624fbc4cd69090766f717eef127cae21f58380acffeb4", + "row_sha384": "a633e7dcea8515e1500f80a0469fef480dec300ccac658d90a338547e6f6f8441a469400f5450dab6333e97af5d7ad00", + "files": 18 + }, + "g2-forensics7-10": { + "path": "tasks/g2-forensics7-10", + "sha256": "f75bc62ade60abfef552868fd25cc660492cbc65b1db91d70b6d432ac9defba2", + "sha384": "553c07b7d11077311f2eb8598d9dfacf769b0d0f22ecbe2240a88b62c57ed71f5a84d90ceb9ca9d015ce632701704c8e", + "row_sha256": "05abcfea040cd550654ac242f94a1e884252d4d68bdc9cc5217bdbc614c92110", + "row_sha384": "10a026d647bf094ca3a0a04fb7d8c60213c4ed99458b98696edffa991e0b88ad3eb21120adc928acbe45ae77710c0919", + "files": 18 + }, + "g2-forensics6-07": { + "path": "tasks/g2-forensics6-07", + "sha256": "9496dc0eb603f9bf46343d422416253a17b0d04dfbcedddbd765332ef58685db", + "sha384": "ce815cc0f5549d362bdfdee6f240ab1420fe79630d02d0b2a7fcd67d5124a7cc70bdd98220768b23fab0ed05f6c29ac4", + "row_sha256": "6b5b17ae1cb8c2a65ad0b7898e0e2e2f194b6f3a27a173890eb4e57d296d0bfb", + "row_sha384": "b48b3cbbe5803b4775a5066c7933d76976d7462557a940729c4782de09c1fc431294fca313187cc753e0d0e6ea004da2", + "files": 18 + } + } +} diff --git a/sample/tasks/harbor/task_checksums.sha256 b/sample/tasks/harbor/task_checksums.sha256 new file mode 100644 index 0000000000000000000000000000000000000000..13793b36b70cf47d32c031df450ce7e98203e393 --- /dev/null +++ b/sample/tasks/harbor/task_checksums.sha256 @@ -0,0 +1,5 @@ +a0cce3ce7940097238e77d9fea5fe57f764c987879768eac43feb9799d1ed1ce tasks/g2-budget-sd-airspeed-sink-e-t3 +d8c783fdbec8158f99fbe8c4127a888f6f28845cf9261e817c6ea3b00f8036ab tasks/g2-chain-sd-slab-radius-halfchar-h-r7 +b82b0ccf091bd0046bfb5b531484795b8ae6109edef60e977b4413dc34b6c025 tasks/g2-sd-slab-shallowest-char-load-v3 +f75bc62ade60abfef552868fd25cc660492cbc65b1db91d70b6d432ac9defba2 tasks/g2-forensics7-10 +9496dc0eb603f9bf46343d422416253a17b0d04dfbcedddbd765332ef58685db tasks/g2-forensics6-07 diff --git a/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/environment/Dockerfile b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..c807fbade805136032ff63002e2cc8d31376f95f --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/environment/Dockerfile @@ -0,0 +1,14 @@ +# Harbor environment image for Zero-Trust Physics release v0.15.3 (commit 664d68f4). +# Public 5-crate Rust engine reference source is at https://github.com/johnkruze/zero-trust-physics-engine (tag v0.15.2); +# read-only source audit of the pack verifier build is available under NDA (https://zerotrustphysics.com/offers/#licence). +# In this free evaluation sample, /usr/local/bin/mcp_stdio bridges JSON-RPC over stdio to the public MCP endpoint +# (ztp_open_bridge.py), and the scorer verifies release 0.15.3 version and kernel invariants on every reply. +# Paid Domain Packs ship compiled static Linux/macOS rollout binaries for --network none execution. +FROM python:3.12-slim-bookworm +ARG ZTP_ENGINE_TAG=v0.15.3 +ARG ZTP_ENGINE_COMMIT=664d68f426ccdfd0159e5f91857edba3872390d1 +ARG ZTP_VERIFIER_URL=https://mcp.zerotrustphysics.com/mcp +COPY ztp_open_bridge.py /usr/local/lib/ztp/ztp_open_bridge.py +RUN printf '#!/bin/sh\nexec python3 /usr/local/lib/ztp/ztp_open_bridge.py "%s"\n' "$ZTP_VERIFIER_URL" > /usr/local/bin/mcp_stdio \ + && chmod +x /usr/local/bin/mcp_stdio +WORKDIR /app diff --git a/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/environment/ztp_open_bridge.py b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/environment/ztp_open_bridge.py new file mode 100644 index 0000000000000000000000000000000000000000..9e4330e54ed33d8cf1f9a1078d9f36e5f96c2996 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/environment/ztp_open_bridge.py @@ -0,0 +1,109 @@ +"""The open address as a stdio MCP server: every JSON-RPC line read on stdin is posted, unchanged, to the verifier's +MCP address, and its answer written back on stdout, one line each. Standard library only. + + python3 ztp_open_bridge.py [URL] URL defaults to https://mcp.zerotrustphysics.com/mcp + +It is for a client that starts its MCP server as a program (an MCP config's command and args, a Harbor task's stdio +server, the harness's logging proxy in front of it) when the verifier it is to use is the served one. The bridge adds +nothing and drops nothing: a request goes out byte for byte as JSON, its answer comes back as the address gave it; a +notification (no id) is posted and answered by nothing. The session the address opens (Mcp-Session-Id) is kept for +every later message. On HTTP 429, a 5xx, a busy physics pool or a dropped connection it waits and posts the same +message again, as ztp_mcp.Verifier does, so a client sees one answer per request. + +Optional: ZTP_API_KEY in the environment sends "Authorization: Bearer " on every post, for a keyed door. With no +key set the bridge sends what it always sent. No key is ever written into a pack, a task or an image. + +Licence: Apache-2.0. +""" +import json +import os +import sys +import time +import urllib.error +import urllib.request + +OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp" +BUSY = "Too many concurrent physics tasks." +PATIENCE_S = float(os.environ.get("ZTP_BRIDGE_PATIENCE_S", "900")) +API_KEY = os.environ.get("ZTP_API_KEY") or None + + +class Bridge: + def __init__(self, url): + self.url = url + self.session = None + self.extra_headers = {} + + def post(self, message): + body = json.dumps(message).encode() + headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream", + "User-Agent": "zero-trust-physics-bridge/1.0"} + if self.session: + headers["Mcp-Session-Id"] = self.session + if API_KEY: + headers["Authorization"] = "Bearer " + API_KEY + headers.update(self.extra_headers) + request = urllib.request.Request(self.url, data=body, headers=headers, method="POST") + with urllib.request.urlopen(request, timeout=600) as response: + if response.headers.get("Mcp-Session-Id"): + self.session = response.headers["Mcp-Session-Id"] + raw = response.read().decode("utf-8") + kind = response.headers.get("Content-Type", "") + if "id" not in message: + return None + if "text/event-stream" in kind: + for line in raw.splitlines(): + if line.startswith("data:"): + found = json.loads(line[5:].strip()) + if found.get("id") == message.get("id"): + return found + return {"jsonrpc": "2.0", "id": message.get("id"), "error": {"code": -32603, "message": "the address's event stream held no answer"}} + return json.loads(raw) if raw.strip() else None + + def forward(self, message): + started, wait = time.time(), 2.0 + while True: + try: + answer = self.post(message) + text = "" + if isinstance(answer, dict) and isinstance(answer.get("result"), dict): + text = "".join(c.get("text", "") for c in answer["result"].get("content", []) or [] if isinstance(c, dict)) + if not (BUSY in text and len(text) < 400): + return answer + except urllib.error.HTTPError as problem: + if not (problem.code == 429 or problem.code >= 500): + if "id" not in message: + return None + return {"jsonrpc": "2.0", "id": message.get("id"), + "error": {"code": -32603, "message": "HTTP %d from the verifier's address" % problem.code}} + after = problem.headers.get("Retry-After") + if after and after.isdigit(): + wait = max(wait, float(after)) + except (urllib.error.URLError, TimeoutError, ConnectionError, OSError): + pass + if time.time() - started + wait > PATIENCE_S: + if "id" not in message: + return None + return {"jsonrpc": "2.0", "id": message.get("id"), + "error": {"code": -32603, "message": "the verifier's address did not answer in %d s" % PATIENCE_S}} + time.sleep(wait) + wait = min(wait * 1.6, 30.0) + + +def main(): + bridge = Bridge(sys.argv[1] if len(sys.argv) > 1 else OPEN_ADDRESS) + for line in sys.stdin: + if not line.strip(): + continue + try: + message = json.loads(line) + except ValueError: + continue + answer = bridge.forward(message) + if answer is not None: + sys.stdout.write(json.dumps(answer, separators=(",", ":")) + "\n") + sys.stdout.flush() + + +if __name__ == "__main__": + main() diff --git a/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/instruction.md b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f9dd4cfa7db874f6280301536cee7f4cec767c17 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/instruction.md @@ -0,0 +1,19 @@ +The Stardust sample return capsule enters the Earth's air at 6495650 m from the Earth's centre, with a transverse speed of 12604.2 m/s and a radial (sink) speed that you set (negative, downward), and is followed for 71 s (1420 steps of 0.05 s). Above some radial velocity (a shallower entry, smaller downward sink magnitude) the speed through the air leaves the card's drag table before the run's end and the run is stopped (AirSpeedOutsideCard). Find the radial speed at which that begins, in m/s. + +Bracket it: give a value that completes and a value that stops with AirSpeedOutsideCard, no more than 0.0075 percent of the value apart. It lies between -2000 and -1910 m/s. + +The request, with the one input you change: +{"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6495650.0, "radial_speed_m_s": "", "transverse_speed_m_s": 12604.2}, "dt_s": 0.05, "segments": [{"steps": 1420, "load": {}}], "record_every": 1420}} + +Budget: at most 3 calls that compute, counted over every call you make; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Both requests on your card must be among your calls. + +You have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card. + +End your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {"tool": "", "arguments": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request. + +The card: +{"holds": {"request": ..., "proof": ...}, "stops": {"request": ..., "proof": ..., "stopped": ""}} + +holds: a request, the task's request with only the open input set, whose run completes. stops: the same request with another value of that input, whose run stops with the stop the task names. The two values are no further apart than the task's width, and both requests are among the calls you made. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all. + +Also write that answer card, by itself, to the file `/app/answer.json`. diff --git a/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/solution/chainlib.py b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/solution/chainlib.py new file mode 100644 index 0000000000000000000000000000000000000000..3c8dc60513d8f8f0372b1ff80d49884754a1d0e5 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/solution/chainlib.py @@ -0,0 +1,63 @@ +"""Build the solve request of a chained design from a run's answer: the history its coupling hands over. + +A coupling hands values from the run's recorded frames into the solve bit for bit: each frame's +32-bit slot widened exactly to 64 bits. The frame layout is in describe_card (frame_slots). This +module reads the slots from frame_hex with the standard library and lays the history out the way a +task states it. + + chained_solve(layout, parameters, run_request, run_answer) -> the solve's arguments, with from + +layout is the task's check.design.chain.layout: {"kind": "stardust_slab", "cool_to_s": 600.0} or +{"kind": "triga_element"}. + +Licence: Apache-2.0. +""" +import copy +import struct + + +def _slots(run_answer, f64_at, f32_at): + """Per recorded frame: the f64 at f64_at and each f32 at f32_at, widened.""" + out = [[] for _ in range(1 + len(f32_at))] + for frame in run_answer["frames"]: + raw = bytes.fromhex(frame["frame_hex"]) + out[0].append(struct.unpack(" the one input you change:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_stardust\", \"initial\": {\"radius_m\": 6495650.0, \"radial_speed_m_s\": \"\", \"transverse_speed_m_s\": 12604.2}, \"dt_s\": 0.05, \"segments\": [{\"steps\": 1420, \"load\": {}}], \"record_every\": 1420}}\n\nBudget: at most 3 calls that compute, counted over every call you make; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Both requests on your card must be among your calls.", "check": {"tool": "run_trajectory", "template": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6495650.0, "radial_speed_m_s": null, "transverse_speed_m_s": 12604.2}, "dt_s": 0.05, "segments": [{"steps": 1420, "load": {}}], "record_every": 1420}, "variable": "initial.radial_speed_m_s", "also": [], "stop": "AirSpeedOutsideCard", "relative_width": 7.5e-05, "budget": 3, "forbidden": ["find_flip", "design_run", "run_dataset", "validate_series"]}, "seed": {"kind": "g2_candidates_0.15.3", "seed": 20261029153, "note": "Stop located by halving to 1e-12 on engine v0.15.3; span set unevenly about it (seeded); search tools forbidden; budget 4 computing calls."}, "reference": {"boundary": -1959.9936173069582, "bisect_width": 1.57160684466362e-09, "holds": {"x": -1960.0377171633477, "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6495650.0, "radial_speed_m_s": -1960.0377171633477, "transverse_speed_m_s": 12604.2}, "dt_s": 0.05, "segments": [{"steps": 1420, "load": {}}], "record_every": 1420}}, "proof": "39af98b965eaa02888d1b8f06e4967c06ce8b28980ec0baa56304fdad7ef4dabfb9bf6f270d80a945a2841868301048f", "outcome": "completed", "steps_landed": 1420}, "stops": {"x": -1959.9495174505687, "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6495650.0, "radial_speed_m_s": -1959.9495174505687, "transverse_speed_m_s": 12604.2}, "dt_s": 0.05, "segments": [{"steps": 1420, "load": {}}], "record_every": 1420}}, "proof": "141a97476638dfc739c43ca3715b5a1a4378eade9969a5dbec3d702e39aeebc0697f848dd3da0947a2a03989d76d6e40", "outcome": "refused", "steps_landed": 678}, "span_pattern": "hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhsssssssssssssssssssssssssssssssssss", "span": [-2000.0, -1910.0], "engine_source": "https://github.com/johnkruze/zero-trust-physics-engine", "engine_tag": "v0.15.3", "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1", "gateway_version": "0.15.3", "engine_binary_sha256": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076"}} diff --git a/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/solution/run_reference.py b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/solution/run_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..0dc7d591e31fb27d4a9ccc2c2a50f5436eb503b2 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/solution/run_reference.py @@ -0,0 +1,208 @@ +"""An agent with no model in it: answer every environment from its reference, through the harness proxy. + + python3 run_reference.py --engine ENGINE --environments F --out DIR [--only id,id] [--direct] + +For a tradeoff or chain_design environment it sends the reference passing and failing runs to the +verifier, hands each run to its solve through the task's coupling where the task has one, and writes +the card with the seals this verifier gives. For a budget environment it sends the two reference +requests. For a forensics table it puts the table to the verifier (each row's request as sent, up to +the task's budget) and names the false rows the build recorded. + +Every call goes through harness/mcp_log_proxy.py, started in an empty working folder, so the +authoritative call record is DIR/.harness.jsonl, as in a pass@k attempt. The same calls are also +written beside the reply, DIR/.calls.jsonl. --direct talks to ENGINE with no proxy and writes the +reply-side log only. + + python3 score.py DIR --engine ENGINE --environments F --calls-from harness + +Licence: Apache-2.0. +""" +import argparse +import copy +import json +import os +import subprocess +import sys +import tempfile + +HERE = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, HERE) +import chainlib # noqa: E402 +from score import (FREE_TOOLS, NOT_STOPPED, build_stage_request, close_verifier, continuation_of, design_shape, # noqa: E402 + file_sha256, get_path, load_environments, open_verifier) +from ztp_mcp import McpError, StdioVerifier # noqa: E402 + +PROXY = os.path.join(HERE, "..", "harness", "mcp_log_proxy.py") + + +class ProxiedVerifier(StdioVerifier): + """The engine behind the logging proxy, the proxy started in its own empty working folder.""" + + def __init__(self, engine, log, cwd=None, **kwargs): + self.cwd = cwd or tempfile.mkdtemp(prefix="ztp_ref_cwd_") + if engine.startswith("http://") or engine.startswith("https://"): + # an MCP address: the proxy runs the stdio bridge to it (ztp_open_bridge.py, beside this file) + child = [sys.executable, os.path.join(HERE, "ztp_open_bridge.py"), engine] + else: + child = [os.path.abspath(engine)] + command = [sys.executable, os.path.abspath(PROXY), "--log", os.path.abspath(log), "--"] + child + super(StdioVerifier, self).__init__(url="stdio: " + " ".join(command), timeout_s=600, **kwargs) + self.proc = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, cwd=self.cwd) + self.binary_sha256 = None if len(child) > 1 else file_sha256(engine) + + def close(self): + try: + self.proc.stdin.close() + except OSError: + pass + try: + self.proc.wait(timeout=60) + except subprocess.TimeoutExpired: + self.proc.kill() + + +def proxied(engine, log, cwd=None): + if os.path.exists(log): + os.remove(log) + verifier = ProxiedVerifier(engine, log, cwd) + try: + verifier.connect() + except McpError as problem: + sys.exit("the proxied verifier failed: %s" % problem) + return verifier + + +class Logged: + def __init__(self, verifier): + self.verifier, self.calls, self.seen = verifier, [], {} + + def call(self, tool, arguments, refused_ok=False): + # the same request twice is one call: a chain with its value in the next run has one first run for both designs + key = json.dumps([tool, arguments], sort_keys=True) + if key in self.seen and not self.seen[key][1]: + return self.seen[key][0] + self.calls.append({"tool": tool, "arguments": arguments}) + body, is_error = self.verifier.call_json(tool, arguments) + self.seen[key] = (body, is_error) + if is_error and not refused_ok: + raise SystemExit("the reference request was refused: %s %s" % (tool, str(body)[:300])) + return body + + +def design_staged(env, ref, agent): + """A staged design: each stage sent in order, handed values and continuations built from this verifier's answers.""" + spec = env["check"]["design"] + answers, requests, out = {}, {}, {} + for stage in spec["stages"]: + q = build_stage_request(spec, stage, ref["x"], answers, requests) + body = agent.call(stage["tool"], q, refused_ok=True) + stopped = body.get("outcome") not in NOT_STOPPED + answers[stage["key"]] = {"body": body, "proof": body.get("run_seal") or body.get("solution_seal"), + "outcome": body.get("outcome"), "stop": body.get("reject") if stopped else None, "stopped": stopped} + requests[stage["key"]] = q + out[stage["key"]] = {"request": {"tool": stage["tool"], "arguments": q}, "proof": answers[stage["key"]]["proof"]} + return out + + +def design(env, ref, agent): + spec = env["check"]["design"] + shape = design_shape(spec) + if shape == "staged": + return design_staged(env, ref, agent) + if shape == "solve": + solved = agent.call("solve", ref["solve"], refused_ok=True) + return {"solve": {"request": {"tool": "solve", "arguments": ref["solve"]}, "proof": solved["solution_seal"]}} + run_args = ref["run"] + run = agent.call("run_trajectory", run_args) + out = {"run": {"request": {"tool": "run_trajectory", "arguments": run_args}, "proof": run["run_seal"]}} + if shape == "continued": + # the run that continues this design's own sealed run: the reference's next run, its start fields and from + # set from this verifier's answer to the first run + _, carried, _, _ = continuation_of(spec) + next_args = copy.deepcopy(ref["next"]) + next_args["initial"] = {name: get_path(run, source) for name, source in carried.items()} + next_args["from"] = {"request": run_args, "run_seal": run["run_seal"]} + nxt = agent.call("run_trajectory", next_args, refused_ok=True) + out["next"] = {"request": {"tool": "run_trajectory", "arguments": next_args}, "proof": nxt["run_seal"]} + elif spec.get("chain"): + overrides = {} + if spec["variable"]["kind"] == "path" and spec["variable"].get("on") == "solve": + overrides[spec["variable"]["path"].split(".", 1)[1]] = ref["x"] + solve_args = chainlib.chained_solve(spec["chain"], run_args, run, overrides) + solved = agent.call("solve", solve_args) + out["solve"] = {"request": {"tool": "solve", "arguments": solve_args}, "proof": solved["solution_seal"]} + return out + + +def reference_reply(env, verifier): + """(reply text, calls [{"tool", "arguments"}]).""" + agent = Logged(verifier) + family, ref = env["family"], env["reference"] + if family in ("tradeoff", "chain_design"): + card = {"passing": design(env, ref["passing"], agent), "failing": design(env, ref["failing"], agent), "binding": ref["binding"]} + if ref["failing"].get("stopped"): + card["failing"]["stopped"] = ref["failing"]["stopped"] + if ref["failing"].get("steps_landed") is not None: + card["failing"]["step"] = ref["failing"]["steps_landed"] + words = "The boundary lies between the two designs below; %s binds." % ref["binding"] + elif family == "budget": + card = {} + for side in ("holds", "stops"): + request = ref[side]["request"] + answer = agent.call(request["tool"], request["arguments"]) + card[side] = {"request": request, "proof": answer.get("run_seal") or answer.get("solution_seal")} + card["stops"]["stopped"] = env["check"]["stop"] + words = "The stop %s lies between the two requests below." % env["check"]["stop"] + else: + agent.call("list_cards", {}, refused_ok=True) + rows = env["check"]["rows"] + budget = env["check"].get("budget") or len(rows) + computing = 0 + for row in rows: + request = row["request"] + if computing >= budget: + break + if request["tool"] in FREE_TOOLS: + continue + agent.call(request["tool"], request["arguments"], refused_ok=True) + computing += 1 + card = {"false_rows": ref["false_rows"]} + words = "%d of the %d rows are false." % (len(ref["false_rows"]), len(rows)) + return words + "\n\n" + json.dumps(card), agent.calls + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--engine", required=True) + parser.add_argument("--environments", required=True) + parser.add_argument("--out", required=True) + parser.add_argument("--only") + parser.add_argument("--direct", action="store_true", help="no proxy: the reply-side log only") + args = parser.parse_args() + environments = load_environments(args.environments) + if args.only: + wanted = set(args.only.split(",")) + environments = [e for e in environments if e["id"] in wanted] + os.makedirs(args.out, exist_ok=True) + shared = open_verifier(args.engine) if args.direct else None + try: + for env in environments: + verifier = shared or proxied(args.engine, os.path.join(args.out, env["id"] + ".harness.jsonl")) + try: + reply, calls = reference_reply(env, verifier) + finally: + if not shared: + close_verifier(verifier) + with open(os.path.join(args.out, env["id"] + ".txt"), "w", encoding="utf-8") as f: + f.write(reply + "\n") + with open(os.path.join(args.out, env["id"] + ".calls.jsonl"), "w", encoding="utf-8") as f: + for c in calls: + f.write(json.dumps(c) + "\n") + print("%-60s %d calls" % (env["id"], len(calls)), flush=True) + finally: + if shared: + close_verifier(shared) + + +if __name__ == "__main__": + main() diff --git a/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/solution/score.py b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/solution/score.py new file mode 100644 index 0000000000000000000000000000000000000000..4403f043313037d26927b89db218b4718ffcf3d2 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/solution/score.py @@ -0,0 +1,1199 @@ +"""Score replies to the multi-step environments with no judge: a program and the verifier. + + python3 score.py REPLIES --engine ENGINE [--environments F] [--only id,id] [--out F] + [--calls-from reply|harness] [--harness-dir DIR] + + REPLIES is a folder with one file per environment, .txt, the whole text of a reply. + --calls-from harness the call record is the harness's own: .harness.jsonl, written by + harness/mcp_log_proxy.py outside the solver's working directory (in + --harness-dir, default REPLIES). A .calls.jsonl beside the reply, + when there is one, is read only to catch an edit: it must equal the + harness log call for call. + --calls-from reply (the earlier set's way) the call record is .calls.jsonl beside the reply: + one JSON object a line, {"tool": "", "arguments": {...}}. + + ENGINE is the verifier: the path to mcp_stdio (MCP over stdio, no network), or an MCP address + beginning http. A task is scored only on the engine it was built on: the verifier's version must + be the task's reference.gateway_version (engine_tag), and a local binary's SHA-256 the task's + reference.engine_binary_sha256. + +The answer card is one JSON object on the reply's last line. Its shape is the family's: + + tradeoff, chain_design (kind design_to_limit, chained_design) + {"passing": DESIGN, "failing": DESIGN, "binding": ""} + DESIGN = {"run": {"request": R, "proof": ""}, + "solve": {"request": R, "proof": ""}} (solve only where the task has one) + Where a constraint is that the run completes and it binds, the failing DESIGN also carries + "stopped": "" and "step": . R = {"tool": ..., "arguments": {...}} + The design shapes, one scorer for every group (check.design says which): + run a run alone. + coupled check.design.chain names a solver and coupling: the run, then a solve handed that sealed run. + continued check.design.chain.kind "continuation", or chain.layout.kind "continue": the run, then a run of + the same card that continues it through from, starting from its sealed final state, + DESIGN = {"run": {...}, "next": {"request": R, "proof": ""}}. The next run's template + is chain.next_template, chain.template or chain.next; its start fields are chain.carried + ({field: where the first run's answer holds it}), chain.handed (with chain.handed_from) or + chain.carry and chain.clock, each equal to the first run's answer bit for bit. A constraint on + "next" reads the next run, and a stop constraint judges it. + solve check.design.tool or check.design.kind "solve": DESIGN = {"solve": {...}}, one solve and no + run. A binding refusal is named ("stopped") with no step. + staged check.design.stages: DESIGN = {"": {"request": R, "proof": ...}, ...}, one entry per + stage in order; a later stage carries an earlier stage's answer at a named input (handed) or + continues an earlier run (continues), bit for bit. + A constraint's read may carry "index": one entry of an output the verifier returns as a list. + budget (kind budgeted_search) + {"holds": {"request": R, "proof": ""}, + "stops": {"request": R, "proof": "", "stopped": ""}} + forensics + {"false_rows": {"": "", ...}} ({} when every row is genuine) + +Every proof is verified on the verifier (verify_tape for a run_seal, verify_solution for a +solution_seal, short form) and every number judged is read from the verifier's own answer to the +card's request, sent again here, never from the reply. + +Scores per environment +---------------------- +reward 0 or 1, exactly as the earlier scorer: 1 only when correct and proofs_hold are both 1. + proofs_hold: every proof on the card verifies. correct: the card is the right answer and + nothing below under "integrity" failed. +graded in [0, 1], beside reward. + + Integrity (graded 0 and reward 0, whatever the answer): the card cannot be read; a proof does not + verify (a copied, nudged, edited or stale proof); a request differs from the task's template other + than at the design variable; a chained solve not handed its own design's sealed run; no call log; + a call log beside the reply that differs from the harness log; a harness log whose chain breaks; + a forbidden tool called; more computing calls than the budget; a request on the card that is not + among the calls; a forensics answer with no computing call behind it; a task built on another + engine than the verifier. + + tradeoff, chain_design, budget. With integrity held, the sides are judged on the verifier: the + passing design meets every constraint and the failing one breaks the named binding constraint + (budget: holds completes, stops ends with the task's stop, named on the card), on the side the + task asks for, inside its range, with any stop and step the card must name. Wrong sides score 0. + With the sides right: + + e = the length of the smallest interval holding both designs' values and the reference + boundary (for a bracket that straddles the boundary, its width) + tol = the task's tolerance (tradeoff, chain_design) or relative width x |boundary| (budget) + r = e / tol + graded = 1 when reward is 1 (r <= 1 and the bracket straddles it) + = 0.5 ** log10(r) when r > 1: each tenfold of looseness halves the score + (r 1.35 -> 0.914, 2 -> 0.811, 10 -> 0.5, 100 -> 0.25) + = 0.5 when r <= 1 but the bracket misses the reference boundary + by more than the slack (another crossing than the one asked) + + The decay is smooth and falls monotonically with r, and a near miss scores near the top. + + forensics. With integrity held, graded is F1 over the (row, reason) pairs: a row counts as found + only with its right reason. precision = found / named, recall = found / false rows; an empty + answer to a table with no false row scores 1. A card that names every row of the table false is + a blanket answer and scores 0, as do unknown rows and reasons outside the task's list. + +Licence: Apache-2.0. +""" +import argparse +import copy +import hashlib +import json +import math +import os +import re +import sys + +HERE = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, HERE) +from ztp_mcp import McpError, StdioVerifier, Verifier # noqa: E402 + +FAMILIES = ("tradeoff", "chain_design", "budget", "forensics") +KINDS = {"tradeoff": "design_to_limit", "chain_design": "chained_design", "budget": "budgeted_search", "forensics": "forensics"} +NOT_STOPPED = ("completed", "converged") +PREFIX_ENDS = ("__", ".", ":", "/") +VERIFIER_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite", + "run_trajectory", "compute_step", "verify_step", "design_run", "solve", "run_dataset", + "validate_series", "verify_tape", "verify_solution", "verify_dataset", "verify_receipt", "find_flip") +# Calls that read the catalogue compute nothing and are free in a call budget. +FREE_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite", "verify_receipt") +REASONS = ("value_altered", "seal_wrong", "flag_omitted", "retired_model", "stop_hidden") +GRADED_DECAY = 0.5 # graded = GRADED_DECAY ** log10(r) +OTHER_CROSSING = 0.5 # right sides, tight, around another crossing than the reference boundary + + +class Integrity(Exception): + """The answer cannot be trusted: graded 0 and reward 0.""" + + +class Wrong(Exception): + """The answer is trusted and wrong: graded 0 and reward 0.""" + + +def load_environments(path): + with open(path, encoding="utf-8") as f: + return [json.loads(line) for line in f if line.strip()] + + +def row_problems(env): + """What a task row lacks against the shared row contract (empty when none).""" + out = [] + for key in ("id", "family", "models", "real_thing", "task", "check", "seed", "reference"): + if key not in env: + out.append("no %s" % key) + family = env.get("family") + if family not in FAMILIES: + out.append("family %r" % family) + elif "kind" in env and env["kind"] != KINDS[family]: + out.append("kind %r for family %s (want %s)" % (env["kind"], family, KINDS[family])) + ref = env.get("reference") or {} + for key in ("engine_tag", "engine_commit", "engine_binary_sha256"): + if not ref.get(key): + out.append("reference.%s missing" % key) + return out + + +def file_sha256(path): + h = hashlib.sha256() + with open(path, "rb") as f: + for block in iter(lambda: f.read(1 << 20), b""): + h.update(block) + return h.hexdigest() + + +def open_verifier(engine): + if engine.startswith("http://") or engine.startswith("https://"): + verifier = Verifier(engine, pause_s=0.5) + verifier.binary_sha256 = None + else: + if not os.path.isfile(engine): + sys.exit("no file at %s: give the path to mcp_stdio, or an MCP address beginning http" % engine) + verifier = StdioVerifier([engine]) + verifier.binary_sha256 = file_sha256(engine) + try: + verifier.connect() + except McpError as problem: + sys.exit("the verifier failed, so nothing was scored: %s" % problem) + if not isinstance(verifier.server, dict) or not verifier.server.get("name"): + close_verifier(verifier) + sys.exit("the verifier failed, so nothing was scored: %s did not answer as an MCP server" % engine) + return verifier + + +def close_verifier(verifier): + if hasattr(verifier, "close"): + verifier.close() + + +# ------------------------------------------------------------------------------------------ +# reading the reply and the call logs +# ------------------------------------------------------------------------------------------ +def _no_constant(name): + raise ValueError("%s is not a number" % name) + + +def read_card(reply): + """(card, problem): the JSON object on the reply's last line. A closing code fence is passed over.""" + lines = [line.strip() for line in (reply or "").replace("\r", "\n").split("\n") if line.strip()] + while lines and lines[-1].startswith("```"): + lines.pop() + if not lines: + return None, "the reply is empty" + try: + card = json.loads(lines[-1], parse_constant=_no_constant) + except ValueError: + return None, "the last line is not one JSON object" + if not isinstance(card, dict): + return None, "the last line is not one JSON object" + return card, None + + +def tool_name(name): + """The verifier's own name for a tool an agent's program may have prefixed (mcp__zerotrust__solve).""" + if not isinstance(name, str): + return None + if name in VERIFIER_TOOLS: + return name + for tool in VERIFIER_TOOLS: + for joint in PREFIX_ENDS: + if name.endswith(joint + tool): + return tool + return name + + +def without_readout(arguments): + """A run's arguments as sealed: a readout is not part of a run's seal.""" + if not isinstance(arguments, dict): + return arguments + return {k: v for k, v in arguments.items() if k != "readout"} + + +def numbers_by_value(value): + """Every number as a float, so 18 and 18.0 (one request to the engine) compare equal; bools kept.""" + if isinstance(value, dict): + return {k: numbers_by_value(v) for k, v in value.items()} + if isinstance(value, list): + return [numbers_by_value(v) for v in value] + if isinstance(value, int) and not isinstance(value, bool): + return float(value) + return value + + +def canonical(arguments): + """A request's arguments as compared with the call log: no readout, keys sorted, numbers by value.""" + return json.dumps(numbers_by_value(without_readout(arguments)), sort_keys=True, separators=(",", ":")) + + +def _arguments(one): + arguments = one.get("arguments") + if isinstance(arguments, str): + try: + arguments = json.loads(arguments) + except ValueError: + arguments = {} + return arguments if isinstance(arguments, dict) else {} + + +def read_calls(path): + """Every call in a reply-side call log, [(tool, arguments)], or None when there is no log.""" + if not path or not os.path.isfile(path): + return None + calls = [] + with open(path, encoding="utf-8", errors="replace") as f: + for line in f: + line = line.strip() + if not line: + continue + try: + one = json.loads(line) + except ValueError: + continue + if isinstance(one, dict): + calls.append((tool_name(one.get("tool")), _arguments(one))) + return calls + + +def chain_of(previous, entry): + payload = json.dumps(entry, sort_keys=True, separators=(",", ":")) + return hashlib.sha384(((previous or "") + payload).encode("utf-8")).hexdigest() + + +def read_harness_log(path): + """(calls, problem) from a log written by harness/mcp_log_proxy.py. calls is None when there is no log; + problem names the first line whose chain does not follow (an edit, a line taken out or put in).""" + if not path or not os.path.isfile(path): + return None, None + calls, previous = [], None + with open(path, encoding="utf-8", errors="replace") as f: + for number_, line in enumerate(f, 1): + if not line.strip(): + continue + try: + entry = json.loads(line) + except ValueError: + return calls, "line %d of the harness log is not JSON" % number_ + if not isinstance(entry, dict) or "chain" not in entry: + return calls, "line %d of the harness log carries no chain" % number_ + chain = entry.pop("chain") + if chain != chain_of(previous, entry) or entry.get("seq") != len(calls) + 1: + return calls, "the harness log's chain breaks at line %d" % number_ + previous = chain + calls.append((tool_name(entry.get("tool")), _arguments(entry))) + return calls, None + + +def write_harness_log(path, calls): + """A chained log in the proxy's format, for tests and the cheat suite: calls [(tool, arguments)].""" + previous = None + with open(path, "w", encoding="utf-8") as f: + for seq, (tool, arguments) in enumerate(calls, 1): + entry = {"seq": seq, "jsonrpc_id": seq, "tool": tool, "arguments": arguments, "ts_request": None, + "ts_response": None, "duration_s": None, "response_sha384": None, "text_sha384": None, "is_error": False} + entry["chain"] = chain_of(previous, entry) + previous = entry["chain"] + f.write(json.dumps(entry, sort_keys=True) + "\n") + + +# ------------------------------------------------------------------------------------------ +# the verifier, asked again +# ------------------------------------------------------------------------------------------ +def stop_name_in(sentence): + names = re.findall(r"\(([A-Z][A-Za-z0-9]*[a-z][A-Za-z0-9]*)\)", sentence or "") + return names[-1] if names else None + + +class Replay: + """The verifier, with every answer remembered: the same request is sent once.""" + + def __init__(self, verifier): + self.verifier = verifier + self.seen = {} + server = getattr(verifier, "server", None) or {} + self.version = server.get("version") + self.binary_sha256 = getattr(verifier, "binary_sha256", None) + + def call(self, tool, arguments): + key = tool + "\x00" + json.dumps(arguments, sort_keys=True) + if key not in self.seen: + try: + self.seen[key] = self.verifier.call_json(tool, arguments) + except McpError as problem: + if not str(problem).startswith("protocol error"): + raise SystemExit("the verifier failed, so nothing was scored: %s" % problem) + self.seen[key] = ("the verifier did not take the request: %s" % problem, True) + return self.seen[key] + + def answer(self, tool, arguments, readout=None): + """One run or solve computed again: {"stopped", "outcome", "stop", "proof", "body"}.""" + arguments = copy.deepcopy(without_readout(arguments)) + if readout is not None and tool == "run_trajectory": + arguments["readout"] = readout + body, is_error = self.call(tool, arguments) + if is_error or not isinstance(body, dict): + sentence = body if isinstance(body, str) else json.dumps(body) + return {"stopped": True, "outcome": "stopped before computing", "stop": stop_name_in(sentence), + "proof": None, "body": None, "sentence": sentence} + outcome = body.get("outcome") + stopped = outcome not in NOT_STOPPED + return {"stopped": stopped, "outcome": outcome, "stop": body.get("reject") if stopped else None, + "proof": body.get("run_seal") or body.get("solution_seal"), "body": body, + "sentence": body.get("reject_detail")} + + def proof_holds(self, tool, arguments, proof): + """(holds, words): the card's seal verified by verify_tape or verify_solution, short form.""" + if not isinstance(proof, str) or not re.fullmatch(r"[0-9a-f]{96}", proof): + return False, "the proof is not a SHA-384 seal of 96 hex digits" + if tool == "run_trajectory": + body, is_error = self.call("verify_tape", {"request": without_readout(arguments), "run_seal": proof}) + elif tool == "solve": + body, is_error = self.call("verify_solution", {"request": arguments, "solution_seal": proof}) + else: + return False, "a proof is verified for run_trajectory or solve only, not %s" % tool + if is_error or not isinstance(body, dict): + return False, "the verifier would not verify it: %s" % (str(body)[:200]) + if body.get("holds") is True: + return True, None + return False, "the verifier says the seal does not hold (cause %s)" % body.get("cause") + + +def engine_problem(env, replay): + """None when the verifier is the engine the task was built on; else what differs.""" + ref = env.get("reference") or {} + tag = ref.get("gateway_version") or (ref.get("engine_tag") or "").lstrip("v") + if not tag: + return "the task names no engine it was built on" + if (ref.get("engine_tag") or "v" + tag).lstrip("v") != tag: + return "the task's engine_tag %s and gateway_version %s disagree" % (ref.get("engine_tag"), ref.get("gateway_version")) + if replay.version != tag: + return "the task was built on engine %s; the verifier is %s" % (tag, replay.version) + want = ref.get("engine_binary_sha256") + if replay.binary_sha256 and want and replay.binary_sha256 != want: + return "the verifier's binary is not the one the task was built on (sha256 %s..., want %s...)" % (replay.binary_sha256[:12], want[:12]) + return None + + +# ------------------------------------------------------------------------------------------ +# requests and their inputs +# ------------------------------------------------------------------------------------------ +_PART = re.compile(r"([A-Za-z_0-9]+)((?:\[\d+\])*)") + + +def get_path(obj, path): + here = obj + for part in path.split("."): + found = _PART.fullmatch(part) + if not found or not isinstance(here, dict) or found.group(1) not in here: + return None + here = here[found.group(1)] + for index in re.findall(r"\[(\d+)\]", found.group(2)): + if not isinstance(here, list) or int(index) >= len(here): + return None + here = here[int(index)] + return here + + +def set_path(obj, path, value): + parts = path.split(".") + here = obj + for i, part in enumerate(parts): + m = _PART.fullmatch(part) + name, idx = m.group(1), [int(k) for k in re.findall(r"\[(\d+)\]", m.group(2))] + last = i == len(parts) - 1 + if not idx: + if last: + here[name] = value + else: + here = here[name] + else: + here = here[name] + for j, k in enumerate(idx): + if last and j == len(idx) - 1: + here[k] = value + else: + here = here[k] + + +def number(value): + return isinstance(value, (int, float)) and not isinstance(value, bool) and math.isfinite(value) + + +def differs(template, given, free, where=""): + """The first place where a request differs from the task's, other than the free places. None when none.""" + if where in free: + return None + if isinstance(template, dict): + if not isinstance(given, dict): + return where or "the request" + for key in set(template) | set(given): + place = "%s.%s" % (where, key) if where else key + if place in free: + continue + if key not in given or key not in template: + return place + found = differs(template[key], given[key], free, place) + if found: + return found + return None + if isinstance(template, list): + if not isinstance(given, list) or len(given) != len(template): + return where + for index, (a, b) in enumerate(zip(template, given)): + found = differs(a, b, free, "%s[%d]" % (where, index)) + if found: + return found + return None + if number(template) and number(given): + return None if float(template) == float(given) else where + return None if template == given else where + + +def design_value(variable, run_arguments, solve_arguments, next_arguments=None): + """The design variable of one design, read from its requests (on: run, solve, or next, a continued run).""" + kind = variable["kind"] + if kind == "path": + on = variable.get("on", "run") + source = {"solve": solve_arguments, "next": next_arguments}.get(on, run_arguments) or {} + value = get_path(source, variable["path"]) + for place in variable.get("also") or []: + again = get_path(source, place) + if not (number(again) and number(value) and float(again) == float(value)): + return None + return float(value) if number(value) else None + if kind == "entry_angle_deg": + radial = get_path(run_arguments or {}, "initial.radial_speed_m_s") + transverse = get_path(run_arguments or {}, "initial.transverse_speed_m_s") + if not (number(radial) and number(transverse)) or transverse <= 0: + return None + speed = math.hypot(radial, transverse) + if abs(speed - variable["speed_m_s"]) > 1e-6 * variable["speed_m_s"]: + return None + return math.degrees(math.atan2(-radial, transverse)) + return None + + +def variable_places(variable): + if variable["kind"] == "entry_angle_deg": + return {"initial.radial_speed_m_s", "initial.transverse_speed_m_s"} + if variable["kind"] == "path" and variable.get("on", "run") == "run": + return {variable["path"]} | set(variable.get("also") or []) + return set() + + +def read_value(read, answer): + """One number from a replayed answer: final, result, or the extreme of a run's readout.""" + body = answer["body"] + if body is None: + return None + kind = read["kind"] + value = None + if kind == "final": + value = (body.get("final_state") or {}).get(read["quantity"]) + elif kind == "result": + value = (body.get("result") or {}).get(read["quantity"]) + elif kind == "flag_extent": + # an advisory flag the run raised, at its largest extent; 0 when the run does not raise it + value = max([x.get("extent") or 0.0 for x in body.get("exceedance_extremes") or [] + if isinstance(x, dict) and x.get("flag") == read["quantity"]] or [0.0]) + elif kind == "extreme": + for quantity in (body.get("readout") or {}).get("quantities") or []: + if quantity.get("quantity") == read["quantity"]: + value = quantity.get(read["which"]) + if "index" in read: + # one entry of an output the verifier returns as a list (a hose's modes, a solve asked at several points) + k = read["index"] + value = value[k] if isinstance(value, list) and isinstance(k, int) and -len(value) <= k < len(value) else None + return value if number(value) else None + + +def readout_for(constraints, on="run"): + """The readout a run is sent with: the extremes its constraints read (on: run, next, or a stage key).""" + quantities = sorted({c["read"]["quantity"] for c in constraints if c["on"] == on and c["read"]["kind"] == "extreme"}) + return {"quantities": quantities} if quantities else None + + +def design_shape(spec): + """Which of the design shapes a task's check.design is: run, coupled, continued, solve or staged.""" + if spec.get("stages"): + return "staged" + if spec.get("tool") == "solve" or spec.get("kind") == "solve": + return "solve" + chain = spec.get("chain") or {} + if chain.get("kind") == "continuation" or (chain.get("layout") or {}).get("kind") == "continue": + return "continued" + return "coupled" if chain else "run" + + +def continuation_of(spec): + """A continued design's chain in one form: (next template, {start field: where the first run's answer holds it}, + next outcomes, the next run's places that also hold a first-run design value).""" + chain = spec["chain"] + template = chain.get("next_template") or chain.get("template") or chain.get("next") + if "carried" in chain: # group 1 + carried = dict(chain["carried"]) + elif "handed" in chain: # group 4 + named = chain.get("handed_from") or {} + carried = {k: "final_state." + named.get(k, k) for k in chain["handed"]} + else: # group 5 + carried = {k: "final_state." + k for k in chain.get("carry") or []} + if chain.get("clock"): + carried[chain["clock"]["field"]] = "final_state." + chain["clock"]["from"] + outcomes = chain.get("next_outcomes") or spec["run_outcomes"] + return template, carried, outcomes, list(chain.get("next_also") or []) + + +def meets(constraint, value): + if value is None: + return False + return value <= constraint["limit"] if constraint["op"] == "<=" else value >= constraint["limit"] + + +def history_layout_problem(layout, parameters, frames_count): + """None when the arrays of a chained solve are laid out as the task states; else what is not.""" + if layout is None: + return None + if layout["kind"] == "stardust_slab": + names = ("history_time_s", "history_pressure_pa", "history_heat_transfer_coefficient_kg_per_m2_s", + "history_flow_enthalpy_j_per_kg", "history_radiative_heating_w_per_m2") + columns = [parameters.get(name) for name in names] + if not all(isinstance(c, list) and all(number(v) for v in c) for c in columns): + return "the history columns are not all lists of numbers" + time, pressure, coefficient, enthalpy, radiative = columns + rows = frames_count + 3 + if any(len(c) != rows for c in columns): + return "the history has not one row before the %d frames handed and two after them" % frames_count + if time[0] != 0.0 or coefficient[0] != 0.0: + return "row 0 is not at 0 s with no heating" + if pressure[0] != pressure[1] or enthalpy[0] != enthalpy[1]: + return "row 0 does not repeat the first frame's pressure and enthalpy" + if abs(time[-2] - (time[-3] + 1.0)) > 1e-9 or time[-1] != layout["cool_to_s"]: + return "the rows after the frames are not at 1 s after the last frame and at %g s" % layout["cool_to_s"] + if coefficient[-2] != 0.0 or coefficient[-1] != 0.0: + return "the stream is not off after the frames" + if pressure[-1] != pressure[-3] or pressure[-2] != pressure[-3] or enthalpy[-1] != enthalpy[-3] or enthalpy[-2] != enthalpy[-3]: + return "the rows after the frames do not hold the last frame's pressure and enthalpy" + if any(v != 0.0 for v in radiative): + return "a row of the history holds radiative heating" + return None + if layout["kind"] == "triga_element": + return None # every array is handed by the coupling and held to its bits by the verifier + return "an unknown layout" + + +# ------------------------------------------------------------------------------------------ +# the call record +# ------------------------------------------------------------------------------------------ +def card_requests(env, card): + """Every request on the card, [(tool, arguments)], read leniently (for the call log).""" + out = [] + + def take(part): + if isinstance(part, dict) and isinstance(part.get("request"), dict) and isinstance(part["request"].get("arguments"), dict): + out.append((tool_name(part["request"].get("tool")), part["request"]["arguments"])) + + if env["family"] in ("tradeoff", "chain_design"): + stages = [s["key"] for s in (env["check"].get("design") or {}).get("stages") or []] + for side in ("passing", "failing"): + design = card.get(side) if isinstance(card.get(side), dict) else {} + for key in stages or ("run", "solve", "next"): + take(design.get(key)) + elif env["family"] == "budget": + take(card.get("holds")) + take(card.get("stops")) + return out + + +def sequence(calls): + return [(tool_name(t), json.dumps(numbers_by_value(a), sort_keys=True)) for t, a in calls] + + +def call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row): + """None when the call record holds; else why not (an integrity failure).""" + check = env["check"] + if calls_from == "harness": + if calls is None: + return "no harness call log: every attempt is scored with the calls the harness recorded" + if log_problem: + return log_problem + if reply_calls is not None and sequence(reply_calls) != sequence(calls): + return "the call log beside the reply differs from the harness log" + elif calls is None: + return "no call log: every environment is scored with the agent's calls" + calls = [(tool_name(t), a) for t, a in calls] + banned = sorted({t for t, _ in calls if t in (check.get("forbidden") or [])}) + if banned: + return "the log holds calls of %s, which the task rules out" % ", ".join(banned) + computing = [(t, a) for t, a in calls if t not in FREE_TOOLS] + row["computing_calls"] = len(computing) + if check.get("budget") and len(computing) > check["budget"]: + return "%d computing calls; the budget is %d" % (len(computing), check["budget"]) + sent = {(t, canonical(a)) for t, a in computing} + for tool, arguments in card_requests(env, card): + if (tool, canonical(arguments)) not in sent: + return "a %s request on the card is not among the calls in the log" % tool + if env["family"] == "forensics" and not computing: + return "no computing call behind the answer: the table was not put to the verifier" + return None + + +# ------------------------------------------------------------------------------------------ +# the families +# ------------------------------------------------------------------------------------------ +def request_of(part, tool, what): + """The arguments of one request on the card (Integrity when it is not one).""" + if not isinstance(part, dict): + raise Integrity("%s is missing" % what) + request = part.get("request") + if not (isinstance(request, dict) and isinstance(request.get("arguments"), dict)): + raise Integrity("%s has no request {\"tool\": ..., \"arguments\": {...}}" % what) + if tool_name(request.get("tool")) != tool: + raise Integrity("%s is a request of %s, not %s" % (what, request.get("tool"), tool)) + return request["arguments"] + + +def score_design(env, design, which, replay, proofs): + """One design of a boundary family: facts {x, met, values, stopped, steps_landed}.""" + check = env["check"] + spec = check["design"] + shape = design_shape(spec) + if shape in ("solve", "staged", "continued") and not isinstance(design, dict): + raise Integrity("the %s design is missing" % which) + if shape == "solve": + return score_solve_design(env, design, which, replay, proofs) + if shape == "staged": + return score_staged_design(env, design, which, replay, proofs) + if shape == "continued": + return score_continued_design(env, design, which, replay, proofs) + chain = spec.get("chain") + run_args = request_of((design or {}).get("run") if isinstance(design, dict) else None, "run_trajectory", + "the %s design's run" % which) + free = set(spec.get("free") or []) | variable_places(spec["variable"]) + where = differs(spec["template"], without_readout(run_args), free) + if where: + raise Integrity("the %s design's run differs from the task's at %s" % (which, where)) + for place in spec.get("free") or []: + if place.endswith(".steps"): + steps = get_path(run_args, place) + if not (isinstance(steps, int) and not isinstance(steps, bool) and 1 <= steps <= spec.get("most_steps", 10 ** 7)): + raise Integrity("the %s design's run has no whole number of steps at %s" % (which, place)) + run_proof = design["run"].get("proof") + holds, words = replay.proof_holds("run_trajectory", run_args, run_proof) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's run_seal: %s" % (which, words)) + run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"])) + stop_names = [c["stop"] for c in check["constraints"] if c["on"] == "outcome"] + stopped_by_name = run["outcome"] == "refused" and run["stop"] in stop_names + if run["outcome"] not in spec["run_outcomes"] and not stopped_by_name: + raise Wrong("the %s design's run comes back %s%s, not %s" % ( + which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"]))) + solve_args, solve = None, None + if chain: + solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which) + if solve_args.get("solver") != chain["solver"]: + raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver"))) + handed = solve_args.get("from") + if not isinstance(handed, dict) or handed.get("coupling") != chain["coupling"]: + raise Integrity("the %s design's solve is not handed its run through the coupling %s" % (which, chain["coupling"])) + if canonical(handed.get("request")) != canonical(run_args) or handed.get("run_seal") != run_proof: + raise Integrity("the %s design's solve is not handed the design's own sealed run" % which) + parameters = solve_args.get("parameters") + if not isinstance(parameters, dict): + raise Integrity("the %s design's solve has no parameters" % which) + solve_free = set(chain.get("handed") or []) + if spec["variable"]["kind"] == "path" and spec["variable"].get("on") == "solve": + solve_free.add(spec["variable"]["path"].split(".", 1)[1]) + where = differs(chain["parameters"], parameters, solve_free) + if where: + raise Integrity("the %s design's solve differs from the task's at parameters.%s" % (which, where)) + frames = len((run["body"] or {}).get("frames") or []) + problem = history_layout_problem(chain.get("layout"), parameters, frames) + if problem: + raise Integrity("the %s design's solve: %s" % (which, problem)) + holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's solution_seal: %s" % (which, words)) + solve = replay.answer("solve", solve_args) + if solve["outcome"] != "converged": + raise Wrong("the %s design's solve comes back %s%s, not converged" % ( + which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else "")) + x = design_value(spec["variable"], run_args, solve_args) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, spec["variable"].get("words", ""))) + met, values = {}, {} + for constraint in check["constraints"]: + if constraint["on"] == "outcome": + values[constraint["id"]] = run["outcome"] if not run["stop"] else "%s (%s)" % (run["outcome"], run["stop"]) + met[constraint["id"]] = not (run["outcome"] == "refused" and run["stop"] == constraint["stop"]) + continue + value = read_value(constraint["read"], run if constraint["on"] == "run" else solve) + values[constraint["id"]] = value + met[constraint["id"]] = meets(constraint, value) + facts = {"x": x, "met": met, "values": values} + if run["outcome"] not in NOT_STOPPED and run["body"]: + facts["stopped"], facts["steps_landed"] = run["stop"], run["body"].get("steps_landed") + return facts + + +def halted(answer, stop, staged=False): + """True when an answer is stopped by the stop named: a refusal ("refused"); for a staged design, any outcome that + is not completed or converged (group 3's rule, kept as built).""" + if staged: + return answer["outcome"] not in NOT_STOPPED and answer["stop"] == stop + return answer["outcome"] == "refused" and answer["stop"] == stop + + +def constraint_facts(check, answers, judged, staged=False): + """met and values of every constraint: each read from the answer its "on" names (answers: {on: answer}); a stop + constraint ("on": "outcome") is judged on the answer judged, or on its stage's answer for a staged design.""" + met, values = {}, {} + for c in check["constraints"]: + if c["on"] == "outcome": + a = answers.get(c["stage"]) if c.get("stage") else judged + values[c["id"]] = None if a is None else (a["outcome"] if not a["stop"] else "%s (%s)" % (a["outcome"], a["stop"])) + met[c["id"]] = a is not None and not halted(a, c["stop"], staged) + continue + a = answers.get(c["on"]) + value = read_value(c["read"], a) if a is not None else None + values[c["id"]] = value + met[c["id"]] = meets(c, value) if c.get("limit") is not None else None + return met, values + + +def stopped_by(answer, constraints, stage=None): + """True when an answer is stopped by a stop one of the task's stop constraints names (for the stage given).""" + return any(halted(answer, c["stop"], stage is not None) for c in constraints + if c["on"] == "outcome" and (stage is None or c.get("stage") == stage)) + + +def score_solve_design(env, design, which, replay, proofs): + """One design that is one solve and no run (check.design.tool or kind "solve").""" + check = env["check"] + spec = check["design"] + var = spec["variable"] + solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which) + if solve_args.get("solver") != spec["template"].get("solver"): + raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver"))) + free = set(spec.get("free") or []) | {var["path"]} | set(var.get("also") or []) + where = differs(spec["template"], solve_args, free) + if where: + raise Integrity("the %s design's solve differs from the task's at %s" % (which, where)) + holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's solution_seal: %s" % (which, words)) + solve = replay.answer("solve", solve_args) + if solve["outcome"] not in spec["run_outcomes"] and not stopped_by(solve, check["constraints"]): + raise Wrong("the %s design's solve comes back %s%s, not %s" % ( + which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else "", " or ".join(spec["run_outcomes"]))) + x = design_value(dict(var, on="solve"), None, solve_args) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", ""))) + met, values = constraint_facts(check, {"solve": solve}, solve) + facts = {"x": x, "met": met, "values": values} + if solve["outcome"] not in NOT_STOPPED and solve["body"]: + facts["stopped"], facts["steps_landed"], facts["no_step"] = solve["stop"], None, True + return facts + + +def score_continued_design(env, design, which, replay, proofs): + """One design of a run and the run that continues it through from. The verifier holds the hand-off: it computes + the first run again, compares its seal and refuses a start that is not the first run's final state; the scorer + also holds each carried start field to the first run's answer, bit for bit.""" + check = env["check"] + spec = check["design"] + var = spec["variable"] + on_next = var["kind"] == "path" and var.get("on") == "next" + template, carried, next_outcomes, next_also = continuation_of(spec) + run_args = request_of(design.get("run"), "run_trajectory", "the %s design's run" % which) + free = set(spec.get("free") or []) | (set() if on_next else variable_places(var)) + where = differs(spec["template"], without_readout(run_args), free) + if where: + raise Integrity("the %s design's run differs from the task's at %s" % (which, where)) + run_proof = design["run"].get("proof") + holds, words = replay.proof_holds("run_trajectory", run_args, run_proof) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's run_seal: %s" % (which, words)) + run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"], "run")) + if run["outcome"] not in spec["run_outcomes"]: + raise Wrong("the %s design's first run comes back %s%s, not %s" % ( + which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"]))) + next_args = request_of(design.get("next"), "run_trajectory", "the %s design's next run" % which) + handed = next_args.get("from") + if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(run_args) + or handed.get("run_seal") != run_proof): + raise Integrity("the %s design's next run does not continue the design's own sealed run (from)" % which) + next_free = {"initial." + name for name in carried} | {"from"} | set(next_also) + if on_next: + next_free |= {var["path"]} | set(var.get("also") or []) + where = differs(template, without_readout(next_args), next_free) + if where: + raise Integrity("the %s design's next run differs from the task's at %s" % (which, where)) + start = next_args.get("initial") if isinstance(next_args.get("initial"), dict) else {} + for name, source in carried.items(): + held, given = get_path(run["body"] or {}, source), start.get(name) + if name not in start or not (given == held or (number(given) and number(held) and float(given) == float(held))): + raise Integrity("the %s design's next run does not start from its run's %s, bit for bit" % (which, source)) + holds, words = replay.proof_holds("run_trajectory", next_args, design["next"].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's next run_seal: %s" % (which, words)) + nxt = replay.answer("run_trajectory", next_args, readout_for(check["constraints"], "next")) + if nxt["outcome"] not in next_outcomes and not stopped_by(nxt, check["constraints"]): + raise Wrong("the %s design's next run comes back %s%s, not %s" % ( + which, nxt["outcome"], " (%s)" % nxt["stop"] if nxt["stop"] else "", " or ".join(next_outcomes))) + x = design_value(var, run_args, None, next_args) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", ""))) + for place in next_also: + again = get_path(next_args, place) + if not (number(again) and float(again) == float(x)): + raise Integrity("the %s design's next run does not hold the design value at %s" % (which, place)) + met, values = constraint_facts(check, {"run": run, "next": nxt}, nxt) + facts = {"x": x, "met": met, "values": values} + if nxt["outcome"] not in NOT_STOPPED and nxt["body"]: + facts["stopped"], facts["steps_landed"] = nxt["stop"], nxt["body"].get("steps_landed") + return facts + + +def build_stage_request(spec, stage, x, answers, requests): + """One stage's request of a staged design at x: the template, x at the variable's places, the values handed from + earlier stages' answers, and a continuation's start and from (used by run_reference.py).""" + q = copy.deepcopy(stage["template"]) + var = spec["variable"] + if var.get("stage") == stage["key"]: + for place in [var["path"]] + list(var.get("also") or []): + set_path(q, place, x) + for h in stage.get("handed") or []: + set_path(q, h["to"], read_value(h["read"], answers[h["from"]])) + if stage.get("continues"): + parent = stage["continues"] + final = answers[parent]["body"]["final_state"] + q["initial"] = {k: final[k] for k in stage["template"]["initial"]} + q["from"] = {"request": copy.deepcopy(requests[parent]), "run_seal": answers[parent]["proof"]} + return q + + +def score_staged_design(env, design, which, replay, proofs): + """One staged design (check.design.stages): each stage a run or a solve, in order.""" + check = env["check"] + spec = check["design"] + var = spec["variable"] + stages = spec["stages"] + answers, requests, facts = {}, {}, {} + for i, stage in enumerate(stages): + key, tool = stage["key"], stage["tool"] + sent = without_readout(request_of(design.get(key), tool, "the %s design's %s" % (which, key))) + free = set(stage.get("free") or []) | {h["to"] for h in stage.get("handed") or []} + if var.get("stage") == key: + free |= {var["path"]} | set(var.get("also") or []) + if stage.get("continues"): + free |= {"initial", "from"} + where = differs(stage["template"], sent, free) + if where: + raise Integrity("the %s design's %s differs from the task's at %s" % (which, key, where)) + for h in stage.get("handed") or []: + want = read_value(h["read"], answers[h["from"]]) + got = get_path(sent, h["to"]) + if want is None or not number(got) or float(got) != float(want): + raise Integrity("the %s design's %s does not carry %s's %s at %s, bit for bit" % ( + which, key, h["from"], h["read"]["quantity"], h["to"])) + if stage.get("continues"): + parent = stage["continues"] + handed = sent.get("from") + if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(requests[parent]) + or handed.get("run_seal") != design[parent].get("proof")): + raise Integrity("the %s design's %s does not continue the design's own sealed %s run (from)" % (which, key, parent)) + final = (answers[parent]["body"] or {}).get("final_state") or {} + start = sent.get("initial") + keys = set(stage["template"]["initial"]) + if not isinstance(start, dict) or set(start) != keys or any( + not number(start[k]) or float(start[k]) != final.get(k) for k in keys): + raise Integrity("the %s design's %s does not start from the final state of its %s run, bit for bit" % (which, key, parent)) + holds, words = replay.proof_holds(tool, sent, design[key].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's %s proof: %s" % (which, key, words)) + answer = replay.answer(tool, sent, readout_for(check["constraints"], key) if tool == "run_trajectory" else None) + named = stopped_by(answer, check["constraints"], stage=key) + if answer["outcome"] not in stage["outcomes"] and not named: + raise Wrong("the %s design's %s comes back %s%s, not %s" % ( + which, key, answer["outcome"], " (%s)" % answer["stop"] if answer["stop"] else "", " or ".join(stage["outcomes"]))) + answers[key], requests[key] = answer, sent + if named: + facts["stopped"], facts["stopped_stage"] = answer["stop"], key + facts["steps_landed"] = (answer["body"] or {}).get("steps_landed") if tool == "run_trajectory" else None + facts["no_step"] = tool != "run_trajectory" + if i != len(stages) - 1: + raise Wrong("the %s design's %s stops (%s) before its last stage" % (which, key, answer["stop"])) + x = design_value(dict(var, on="run"), requests.get(var["stage"]), None) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", ""))) + met, values = constraint_facts(check, answers, None, staged=True) + facts.update({"x": x, "met": met, "values": values}) + return facts + + +def grade_bracket(a, b, star, tol, slack, row): + """(reward_ok, graded) for a bracket [a, b] with its sides right.""" + width = abs(b - a) + straddles = min(a, b) - slack <= star <= max(a, b) + slack + within = width <= tol * (1 + 1e-9) + e = max(a, b, star) - min(a, b, star) + r = e / tol if tol > 0 else float("inf") + row["width"], row["width_ratio"] = width, r + if within and straddles: + return True, 1.0 + if r <= 1: + return False, OTHER_CROSSING + return False, GRADED_DECAY ** math.log10(r) + + +def score_boundary(env, card, replay, row, proofs): + check, reference = env["check"], env["reference"] + passing = score_design(env, card.get("passing"), "passing", replay, proofs) + failing = score_design(env, card.get("failing"), "failing", replay, proofs) + row["passing"], row["failing"] = passing, failing + span = check["design"].get("range") + if span and not all(span[0] <= x <= span[1] for x in (passing["x"], failing["x"])): + raise Wrong("a design lies outside the range the task states, %g to %g" % tuple(span)) + broken = [c for c, ok in passing["met"].items() if not ok] + if broken: + raise Wrong("the passing design breaks %s" % ", ".join(broken)) + broken = [c for c, ok in failing["met"].items() if not ok] + if not broken: + raise Wrong("the failing design meets every constraint") + binding = card.get("binding") + if binding != reference["binding"]: + raise Wrong("binding names %r; the constraint that binds is another" % (binding,)) + if binding not in broken: + raise Wrong("the failing design does not break %s, the constraint named binding" % binding) + if binding in [c["id"] for c in check["constraints"] if c["on"] == "outcome"]: + said = card.get("failing") or {} + if said.get("stopped") != failing.get("stopped"): + raise Wrong("the failing design's run stops with %s; the card says %r" % (failing.get("stopped"), said.get("stopped"))) + if failing.get("no_step"): + pass # a solve that is refused has no step: its stop's name is stated + elif not (isinstance(said.get("step"), int) and not isinstance(said.get("step"), bool) and said["step"] == failing.get("steps_landed")): + raise Wrong("the failing design's run is sealed to step %s; the card says %r" % (failing.get("steps_landed"), said.get("step"))) + spec = check["design"] + xp, xf = passing["x"], failing["x"] + if spec["direction"] == "largest" and not xf > xp: + raise Wrong("the task asks for the largest value that holds: the failing design must lie above the passing one") + if spec["direction"] == "smallest" and not xf < xp: + raise Wrong("the task asks for the smallest value that holds: the failing design must lie below the passing one") + ok, graded = grade_bracket(xp, xf, reference["boundary"], spec["tolerance"], spec["tolerance"] * 0.5, row) + if not ok: + return graded, "the two designs are %.6g apart; the task asks for %.6g or less, and they must straddle the boundary" % ( + abs(xf - xp), spec["tolerance"]) + return 1.0, None + + +def score_budget(env, card, replay, row, proofs): + check, reference = env["check"], env["reference"] + template, path, tool = check["template"], check["variable"], check["tool"] + sides = {} + for side in ("holds", "stops"): + arguments = request_of(card.get(side), tool, side) + also = check.get("also") or [] + where = differs(template, without_readout(arguments), {path} | set(also)) + if where: + raise Integrity("the %s request differs from the task's at %s" % (side, where)) + x = get_path(arguments, path) + if not number(x): + raise Integrity("the %s request has no number at %s" % (side, path)) + for place in also: + again = get_path(arguments, place) + if not (number(again) and float(again) == float(x)): + raise Integrity("the %s request does not hold the same value at %s as at %s" % (side, place, path)) + holds, words = replay.proof_holds(tool, arguments, card[side].get("proof")) + proofs.append(holds) + sides[side] = (float(x), arguments, holds, words) + for side in ("holds", "stops"): + if not sides[side][2]: + raise Integrity("the %s seal: %s" % (side, sides[side][3])) + held = replay.answer(tool, sides["holds"][1]) + stopped = replay.answer(tool, sides["stops"][1]) + row["holds_outcome"], row["stops_outcome"] = held["outcome"], "%s (%s)" % (stopped["outcome"], stopped["stop"]) + if held["outcome"] not in NOT_STOPPED: + raise Wrong("the holds request comes back %s (%s)" % (held["outcome"], held["stop"])) + if stopped["stop"] != check["stop"]: + raise Wrong("the stops request comes back %s (%s), not the stop %s" % (stopped["outcome"], stopped["stop"], check["stop"])) + if card["stops"].get("stopped") != check["stop"]: + raise Wrong("the card names the stop %r; the verifier names %s" % (card["stops"].get("stopped"), check["stop"])) + xh, xs = sides["holds"][0], sides["stops"][0] + star = reference["boundary"] + row["holds_value"], row["stops_value"] = xh, xs + tol = check["relative_width"] * abs(star) + ok, graded = grade_bracket(xh, xs, star, tol, 1e-9 * abs(star), row) + if not ok: + return graded, "the bracket is %.6g wide; the task asks for %.3g of the value or less, and it must hold the stop" % ( + abs(xs - xh), check["relative_width"]) + return 1.0, None + + +def forensics_f1(env, named): + """(graded, problem): F1 over (row, reason) pairs; problem when the card is not a usable answer.""" + if not isinstance(named, dict): + return 0.0, "false_rows is not an object of row and reason" + rows = [c["row"] for c in env["check"]["rows"]] + truth = env["reference"]["false_rows"] + unknown = [r for r in named if r not in set(rows)] + if unknown: + return 0.0, "no rows %s in the table" % ", ".join(sorted(unknown)) + reasons = env["check"].get("reasons") or REASONS + bad = [r for r, why in named.items() if why not in reasons] + if bad: + return 0.0, "the reason for %s is not one of %s" % (", ".join(sorted(bad)), ", ".join(reasons)) + if rows and set(named) == set(rows): + return 0.0, "every row of the table is named false: a blanket answer" + found = sum(1 for r, why in named.items() if truth.get(r) == why) + if not truth and not named: + return 1.0, None + precision = found / len(named) if named else 0.0 + recall = found / len(truth) if truth else 0.0 + f1 = 2 * precision * recall / (precision + recall) if precision + recall else 0.0 + if f1 >= 1.0: + return 1.0, None + missed = sorted(set(truth) - set(named)) + wrongly = sorted(set(named) - set(truth)) + wrong_reason = sorted(r for r in set(truth) & set(named) if truth[r] != named[r]) + said = [] + if missed: + said.append("%d false row(s) not named" % len(missed)) + if wrongly: + said.append("%d genuine row(s) named false" % len(wrongly)) + if wrong_reason: + said.append("%d false row(s) with another reason" % len(wrong_reason)) + return f1, "; ".join(said) + + +def score(env, reply, replay, calls=None, reply_calls=None, calls_from="reply", log_problem=None): + """One environment scored. calls: the authoritative record [(tool, arguments)] (None: no record); + reply_calls: the reply-side log, compared with calls under calls_from="harness".""" + row = {"id": env["id"], "family": env["family"], "kind": KINDS.get(env["family"]), "calls_from": calls_from, + "correct": 0, "proofs_hold": 0, "reward": 0, "graded": 0.0, "verdict": None, "reason": None} + card, problem = read_card(reply) + if problem: + row.update(verdict="no_card", reason=problem) + return row + proofs = [] + try: + problem = engine_problem(env, replay) + if problem: + raise Integrity(problem) + problem = call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row) + if problem: + raise Integrity(problem) + family = env["family"] + if family in ("tradeoff", "chain_design"): + graded, reason = score_boundary(env, card, replay, row, proofs) + elif family == "budget": + graded, reason = score_budget(env, card, replay, row, proofs) + elif family == "forensics": + named = card.get("false_rows") + if isinstance(named, dict): + row["named"] = named + graded, reason = forensics_f1(env, named) + proofs = [True] + if reason and graded == 0.0 and not isinstance(named, dict): + raise Wrong(reason) + else: + raise Wrong("unknown family %s" % family) + except Integrity as problem: + row.update(verdict="integrity", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs))) + return row + except Wrong as problem: + row.update(verdict="wrong", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs))) + return row + proofs_hold = int(bool(proofs) and all(proofs)) + correct = int(graded >= 1.0 and reason is None) + row.update(correct=correct, proofs_hold=proofs_hold, reward=int(correct == 1 and proofs_hold == 1), + graded=round(graded, 6) if proofs_hold else 0.0, + verdict="pass" if correct and proofs_hold else ("near" if graded > 0 else "wrong"), reason=reason) + return row + + +def records_for(folder, env_id, calls_from, harness_dir=None): + """(calls, reply_calls, log_problem) for one environment's reply in folder.""" + reply_calls = read_calls(os.path.join(folder, env_id + ".calls.jsonl")) + if calls_from == "harness": + calls, log_problem = read_harness_log(os.path.join(harness_dir or folder, env_id + ".harness.jsonl")) + return calls, reply_calls, log_problem + return reply_calls, None, None + + +def main(): + parser = argparse.ArgumentParser(description=__doc__.split("\n")[0]) + parser.add_argument("replies") + parser.add_argument("--engine", required=True) + parser.add_argument("--only") + parser.add_argument("--environments", required=True) + parser.add_argument("--out") + parser.add_argument("--calls-from", choices=("reply", "harness"), default="harness") + parser.add_argument("--harness-dir") + parser.add_argument("--quiet", action="store_true") + args = parser.parse_args() + environments = load_environments(args.environments) + if args.only: + wanted = set(args.only.split(",")) + environments = [e for e in environments if e["id"] in wanted] + missing = wanted - {e["id"] for e in environments} + if missing: + sys.exit("no environments %s in %s" % (", ".join(sorted(missing)), args.environments)) + for env in environments: + for problem in row_problems(env): + print("warning: %s: %s" % (env.get("id"), problem), file=sys.stderr) + verifier = open_verifier(args.engine) + replay = Replay(verifier) + rows = [] + try: + for env in environments: + path = os.path.join(args.replies, env["id"] + ".txt") + reply = open(path, encoding="utf-8", errors="replace").read() if os.path.isfile(path) else "" + calls, reply_calls, log_problem = records_for(args.replies, env["id"], args.calls_from, args.harness_dir) + row = score(env, reply, replay, calls, reply_calls, args.calls_from, log_problem) + rows.append(row) + if not args.quiet: + print("%-58s reward %d graded %.4f %-9s %s" % (env["id"], row["reward"], row["graded"], row["verdict"], + row["reason"] or ""), flush=True) + replay.seen.clear() + finally: + close_verifier(verifier) + if args.out: + with open(args.out, "w", encoding="utf-8") as f: + for row in rows: + f.write(json.dumps(row) + "\n") + total = len(rows) + print("\n%d environments: reward %d, graded %.4f (mean %.4f), correct %d, proofs_hold %d" % ( + total, sum(r["reward"] for r in rows), sum(r["graded"] for r in rows), + sum(r["graded"] for r in rows) / total if total else 0.0, + sum(r["correct"] for r in rows), sum(r["proofs_hold"] for r in rows))) + by = {} + for r in rows: + by.setdefault(r["family"], []).append(r) + for family in FAMILIES: + if family in by: + print(" %-13s reward %d of %d, mean graded %.4f" % (family, sum(r["reward"] for r in by[family]), len(by[family]), + sum(r["graded"] for r in by[family]) / len(by[family]))) + + +if __name__ == "__main__": + main() diff --git a/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/solution/solve.sh b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..72cbff6116b4373dcb5a275b10f1ea91c863186a --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/solution/solve.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# Harbor's oracle agent copies solution/ to /solution and runs this. +# +# It makes the reference answer card here, on the verifier of this machine: the +# dataset's own run_reference.py sends this environment's reference requests to +# /usr/local/bin/mcp_stdio (and, for a chained design, hands each run to its solve +# through the task's coupling) and writes a reply that ends with the card. The card +# is saved where the instruction asks for it, and the calls it made beside it, so +# that a call-budget environment is scored on them: the oracle runs no model, and +# Harbor's record of its run holds no tool call. +# +# The four paths can be moved with environment variables, so this runs outside a container. +set -euo pipefail +HERE="${ZTP_SOLUTION_DIR:-$(cd "$(dirname "$0")" && pwd)}" +ENGINE="${ZTP_ENGINE:-/usr/local/bin/mcp_stdio}" +ANSWER="${ZTP_ANSWER_FILE:-/app/answer.json}" +CALLS="${ZTP_CALLS_FILE:-/app/calls.jsonl}" +WORK="$(mktemp -d)" +trap 'rm -rf "$WORK"' EXIT + +cd "$HERE" +FLAGS=() +grep -q -- '"--environments"' run_reference.py && FLAGS+=(--environments data/environments.jsonl) +grep -q -- '"--direct"' run_reference.py && FLAGS+=(--direct) # no proxy in here: the oracle's own call log +python3 -B run_reference.py --engine "$ENGINE" ${FLAGS[@]+"${FLAGS[@]}"} --out "$WORK/replies" +REPLY="$(ls "$WORK"/replies/*.txt)" # one environment here, so one reply +cat "$REPLY" +mkdir -p "$(dirname "$ANSWER")" "$(dirname "$CALLS")" +tail -n 1 "$REPLY" > "$ANSWER" +cp "$WORK"/replies/*.calls.jsonl "$CALLS" diff --git a/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/solution/ztp_mcp.py b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/solution/ztp_mcp.py new file mode 100644 index 0000000000000000000000000000000000000000..0cde73653317c847cd361ad0ca9d4f1f785bc3a7 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/solution/ztp_mcp.py @@ -0,0 +1,188 @@ +"""A small Model Context Protocol client for the Zero-Trust Physics verifier. + +Standard library only. It speaks MCP two ways: + + stdio to a verifier built from the public source and started here as a program + (target/release/mcp_stdio): one JSON-RPC message a line, no network. + HTTP to an MCP address (JSON-RPC in a POST), such as + + https://mcp.zerotrustphysics.com/mcp Open to any agent. + +The open address gives each network address one place in the physics pool at a +time and answers "Too many concurrent physics tasks." or HTTP 429 when it is +busy; nothing waits on the server, so this client sends one request at a time +and, when it is told to come back, waits and sends the same request again. + +Licence: Apache-2.0. +""" +import json +import select +import shlex +import subprocess +import time +import urllib.error +import urllib.request + +OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp" +BUSY = "Too many concurrent physics tasks." + + +class McpError(RuntimeError): + pass + + +class Verifier: + """One MCP endpoint. call(tool, arguments) returns (text, is_error).""" + + def __init__(self, url=OPEN_ADDRESS, timeout_s=90, patience_s=600, pause_s=0.0, headers=None, quiet=True): + self.url = url + self.timeout_s = timeout_s + self.patience_s = patience_s # how long to keep asking politely before giving up on one request + self.pause_s = pause_s # a fixed pause after every request, for a shared address + self.headers = dict(headers or {}) + self.quiet = quiet + self.session = None + self.server = None + self.requests_sent = 0 + self.times_asked_to_wait = 0 + self._id = 0 + + # -- transport ------------------------------------------------------------------------- + def _post(self, message): + body = json.dumps(message).encode() + headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream", + "User-Agent": "zero-trust-physics-environments/1.0", **self.headers} + if self.session: + headers["Mcp-Session-Id"] = self.session + request = urllib.request.Request(self.url, data=body, headers=headers, method="POST") + self.requests_sent += 1 + with urllib.request.urlopen(request, timeout=self.timeout_s) as response: + session = response.headers.get("Mcp-Session-Id") + if session: + self.session = session + raw = response.read().decode("utf-8") + kind = response.headers.get("Content-Type", "") + if "text/event-stream" in kind: + for line in raw.splitlines(): + if line.startswith("data:"): + found = json.loads(line[5:].strip()) + if found.get("id") == message.get("id"): + return found + raise McpError("the event stream held no answer to the request") + return json.loads(raw) if raw.strip() else {} + + def _ask(self, method, params=None): + """Send one request; on 429, a busy pool, a 5xx or a dropped connection, wait and send it again.""" + self._id += 1 + message = {"jsonrpc": "2.0", "id": self._id, "method": method} + if params is not None: + message["params"] = params + started, wait = time.time(), 2.0 + while True: + reason = None + try: + answer = self._post(message) + if "error" in answer: + raise McpError("protocol error: %s" % json.dumps(answer["error"])[:300]) + result = answer.get("result", {}) + text = "".join(c.get("text", "") for c in result.get("content", []) or []) + if method == "tools/call" and BUSY in text and len(text) < 400: + reason = "the physics pool is busy" + else: + if self.pause_s: + time.sleep(self.pause_s) + return result + except urllib.error.HTTPError as problem: + if problem.code == 429 or problem.code >= 500: + after = problem.headers.get("Retry-After") + reason = "HTTP %d" % problem.code + if after and after.isdigit(): + wait = max(wait, float(after)) + else: + raise McpError("HTTP %d: %s" % (problem.code, problem.read().decode("utf-8", "replace")[:300])) + except (urllib.error.URLError, TimeoutError, ConnectionError, OSError) as problem: + reason = "no connection (%s)" % problem + self.times_asked_to_wait += 1 + if time.time() - started + wait > self.patience_s: + raise McpError("gave up after %d s: %s" % (self.patience_s, reason)) + if not self.quiet: + print(" %s; asking again in %.0f s" % (reason, wait), flush=True) + time.sleep(wait) + wait = min(wait * 1.6, 30.0) + + # -- protocol -------------------------------------------------------------------------- + def connect(self): + result = self._ask("initialize", {"protocolVersion": "2025-06-18", "capabilities": {}, + "clientInfo": {"name": "zero-trust-physics-environments", "version": "1.0"}}) + self.server = result.get("serverInfo") + try: + self._post({"jsonrpc": "2.0", "method": "notifications/initialized"}) + except Exception: # a notification has no answer; some servers close without one + pass + return result + + def tools(self): + """The tool declarations exactly as the endpoint gives them.""" + return self._ask("tools/list").get("tools", []) + + def call(self, tool, arguments=None): + """Call one tool. Returns (text, is_error): the text of the answer and the MCP isError flag.""" + result = self._ask("tools/call", {"name": tool, "arguments": arguments or {}}) + text = "".join(c.get("text", "") for c in result.get("content", []) or []) + return text, bool(result.get("isError")) + + def call_json(self, tool, arguments=None): + """Call one tool. Returns (body, is_error): the parsed JSON, or the text when it is not JSON.""" + text, is_error = self.call(tool, arguments) + try: + return json.loads(text), is_error + except ValueError: + return text, is_error + + +class StdioVerifier(Verifier): + """The same interface over MCP stdio: a program started here that speaks JSON-RPC, one message a line. + For anyone who holds an MCP server as a program; the open address needs none of this.""" + + def __init__(self, command, timeout_s=600, **kwargs): + super().__init__(url="stdio: " + (command if isinstance(command, str) else " ".join(command)), timeout_s=timeout_s, **kwargs) + self.proc = subprocess.Popen(shlex.split(command) if isinstance(command, str) else command, + stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) + + def _post(self, message): + self.requests_sent += 1 + try: + self.proc.stdin.write((json.dumps(message) + "\n").encode()) + self.proc.stdin.flush() + except OSError: # a program that has stopped reading will not start again + try: + self.proc.stdin.close() + except OSError: + pass + raise McpError("the program stopped reading") + if "id" not in message: + return {} + while True: + ready, _, _ = select.select([self.proc.stdout], [], [], self.timeout_s) + if not ready: + raise McpError("no answer in %d s" % self.timeout_s) + line = self.proc.stdout.readline() + if not line: + raise McpError("the program closed its output") + found = json.loads(line) + if found.get("id") == message["id"]: + return found + + def close(self): + self.proc.terminate() + try: + self.proc.wait(timeout=5) + except subprocess.TimeoutExpired: + self.proc.kill() + + +def connect(endpoint=OPEN_ADDRESS, **kwargs): + """A connected verifier: an http(s) address, or "stdio:" for a program.""" + verifier = StdioVerifier(endpoint[len("stdio:"):].strip(), **kwargs) if endpoint.startswith("stdio:") else Verifier(endpoint, **kwargs) + verifier.connect() + return verifier diff --git a/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/task.toml b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..f8ca0ce0d16d58d6dea388f9965700e223742618 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/task.toml @@ -0,0 +1,40 @@ +schema_version = "1.4" +artifacts = ["/app/answer.json", "/app/calls.jsonl", "/logs/agent/trajectory.json", "/logs/agent/oracle.txt"] + +[task] +name = "protocol-company/g2-budget-sd-airspeed-sink-e-t3" +version = "1.0.0" +description = "Budgeted search: a named physical stop bracketed to the task's width within the task's call budget, scored on the bracket and the call log." +authors = [{ name = "Protocol Company" }] +keywords = ["zero-trust-physics", "physics", "mcp", "tool-use", "verifier", "multi-step", "budgeted_search"] + +[metadata] +environment_id = "g2-budget-sd-airspeed-sink-e-t3" +family = "budget" +kind = "budgeted_search" +engine_source = "https://github.com/johnkruze/zero-trust-physics-engine" +engine_tag = "v0.15.3" +engine_commit = "664d68f426ccdfd0159e5f91857edba3872390d1" +engine_binary_sha256 = "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076" +gateway_version = "0.15.3" +scores = ["correct", "proofs_hold"] + +[agent] +timeout_sec = 1200.0 + +[verifier] +timeout_sec = 900.0 +environment_mode = "separate" + +[environment] +build_timeout_sec = 1800.0 +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +workdir = "/app" + +[[environment.mcp_servers]] +name = "verifier" +transport = "stdio" +command = "/usr/local/bin/mcp_stdio" +args = [] diff --git a/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/Dockerfile b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..a455d9232114f3794e779f59ca8648029bb057f4 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/Dockerfile @@ -0,0 +1,11 @@ +# The grader's image: the task's tests at /tests and the verifier of release v0.15.3 as an MCP stdio server at +# /usr/local/bin/mcp_stdio (a bridge to its address). +FROM python:3.12-slim-bookworm +ARG ZTP_ENGINE_TAG=v0.15.3 +ARG ZTP_ENGINE_COMMIT=664d68f426ccdfd0159e5f91857edba3872390d1 +COPY ztp_open_bridge.py /usr/local/lib/ztp/ztp_open_bridge.py +RUN printf '#!/bin/sh\nexec python3 /usr/local/lib/ztp/ztp_open_bridge.py "${ZTP_VERIFIER_URL:-https://mcp.zerotrustphysics.com/mcp}"\n' > /usr/local/bin/mcp_stdio \ + && chmod +x /usr/local/bin/mcp_stdio +COPY . /tests +RUN mkdir -p /logs/verifier /logs/agent /logs/artifacts /app +WORKDIR /app diff --git a/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/environment.jsonl b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/environment.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..f128ad78d3b4b219ff8526579c72d9f6eb3c4ee4 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/environment.jsonl @@ -0,0 +1 @@ +{"id": "g2-budget-sd-airspeed-sink-e-t3", "family": "budget", "kind": "budgeted_search", "models": ["aerospace/capsule_stardust"], "real_thing": "Entry of the Stardust sample return capsule on 15 January 2006, as a point mass with tabulated drag, no lift, no wind and a yearly standard atmosphere: altitude, speed through the air, Mach number, load, heat flux, and at the nose the stagnation pressure, recovery enthalpy and heat-transfer coefficient a heat shield takes, from entry interface to the drogue-deployment condition the radar recorded. Compared with NASA's reconstruction of the entry and the radar record of parachute opening: peak load 32.17 g against 32.89 g, within 0.72 g (target 3.64 g); the drogue altitude, 31.03 km, reached at 138.909 s and Mach 1.23 at 136.953 s against 137.9 s recorded, within 1.01 s (target 7.4 s). Gap: heat flux 696 W/cm2 against NASA's computed 762 to 1000; the yearly standard atmosphere in place of that morning's air is worth about 1 g of peak load either way.", "task": "The Stardust sample return capsule enters the Earth's air at 6495650 m from the Earth's centre, with a transverse speed of 12604.2 m/s and a radial (sink) speed that you set (negative, downward), and is followed for 71 s (1420 steps of 0.05 s). Above some radial velocity (a shallower entry, smaller downward sink magnitude) the speed through the air leaves the card's drag table before the run's end and the run is stopped (AirSpeedOutsideCard). Find the radial speed at which that begins, in m/s.\n\nBracket it: give a value that completes and a value that stops with AirSpeedOutsideCard, no more than 0.0075 percent of the value apart. It lies between -2000 and -1910 m/s.\n\nThe request, with the one input you change:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_stardust\", \"initial\": {\"radius_m\": 6495650.0, \"radial_speed_m_s\": \"\", \"transverse_speed_m_s\": 12604.2}, \"dt_s\": 0.05, \"segments\": [{\"steps\": 1420, \"load\": {}}], \"record_every\": 1420}}\n\nBudget: at most 3 calls that compute, counted over every call you make; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Both requests on your card must be among your calls.", "check": {"tool": "run_trajectory", "template": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6495650.0, "radial_speed_m_s": null, "transverse_speed_m_s": 12604.2}, "dt_s": 0.05, "segments": [{"steps": 1420, "load": {}}], "record_every": 1420}, "variable": "initial.radial_speed_m_s", "also": [], "stop": "AirSpeedOutsideCard", "relative_width": 7.5e-05, "budget": 3, "forbidden": ["find_flip", "design_run", "run_dataset", "validate_series"]}, "seed": {"kind": "g2_candidates_0.15.3", "seed": 20261029153, "note": "Stop located by halving to 1e-12 on engine v0.15.3; span set unevenly about it (seeded); search tools forbidden; budget 4 computing calls."}, "reference": {"boundary": -1959.9936173069582, "bisect_width": 1.57160684466362e-09, "holds": {"x": -1960.0377171633477, "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6495650.0, "radial_speed_m_s": -1960.0377171633477, "transverse_speed_m_s": 12604.2}, "dt_s": 0.05, "segments": [{"steps": 1420, "load": {}}], "record_every": 1420}}, "proof": "39af98b965eaa02888d1b8f06e4967c06ce8b28980ec0baa56304fdad7ef4dabfb9bf6f270d80a945a2841868301048f", "outcome": "completed", "steps_landed": 1420}, "stops": {"x": -1959.9495174505687, "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6495650.0, "radial_speed_m_s": -1959.9495174505687, "transverse_speed_m_s": 12604.2}, "dt_s": 0.05, "segments": [{"steps": 1420, "load": {}}], "record_every": 1420}}, "proof": "141a97476638dfc739c43ca3715b5a1a4378eade9969a5dbec3d702e39aeebc0697f848dd3da0947a2a03989d76d6e40", "outcome": "refused", "steps_landed": 678}, "span_pattern": "hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhsssssssssssssssssssssssssssssssssss", "span": [-2000.0, -1910.0], "engine_source": "https://github.com/johnkruze/zero-trust-physics-engine", "engine_tag": "v0.15.3", "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1", "gateway_version": "0.15.3", "engine_binary_sha256": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076"}} diff --git a/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/grade.py b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/grade.py new file mode 100644 index 0000000000000000000000000000000000000000..88564e4e42982627e805eb8e50bd600ae052dd80 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/grade.py @@ -0,0 +1,272 @@ +"""Harbor glue: find the agent's reply and its calls, hand them to the dataset's score.py, write the reward. + +Standard library only. Every path can be moved with an environment variable, so the +same file runs outside a container: + + ZTP_TESTS_DIR this folder: environment.jsonl (and score.py, ztp_mcp.py) (default: where this file is) + ZTP_SCORER_DIR where score.py and ztp_mcp.py sit (default: ZTP_TESTS_DIR) + ZTP_ANSWER_FILE the card the instruction asks the agent to save (default /app/answer.json) + ZTP_CALLS_FILE a call log written by the oracle's solve.sh (default /app/calls.jsonl) + ZTP_ORACLE_LOG Harbor's log of the oracle agent's run (default /logs/agent/oracle.txt) + ZTP_TRAJECTORY_FILE Harbor's record of the run, in ATIF (default /logs/agent/trajectory.json) + ZTP_VERIFIER_DIR where the reward is written (default /logs/verifier) + ZTP_ENGINE the verifier, MCP over stdio (default /usr/local/bin/mcp_stdio) + ZTP_SCORE_TIMEOUT_S how long the scorer may take, in seconds (default 600) + +The reply, first found: the answer file when it is there and not empty (one JSON object over +several lines is put on one line first); else the last agent message with text in the +trajectory; else none, and the scorer gives 0. + +The calls, for every environment (a call budget, and a forensics answer, are scored on them): the agent's calls of the +verifier's own tools in the trajectory's agent steps, in order, by function name and arguments (mcp__verifier__solve is +read as solve). The agent's other tools (a shell, a file editor, writing /app/answer.json) are left out of the record: +they are not verifier calls and are not counted against a budget. When there is no trajectory file at all and Harbor's +oracle has run (its log /logs/agent/oracle.txt is there), the log solution/solve.sh wrote is read instead: the oracle +runs no model, so Harbor records no tool call for it. Any other run with no trajectory is scored with no call record, +and a budget or forensics answer then scores 0. + +The verifier is held to its release by what it answers (version 0.15.3, kernel genesis_kernel_v0.13.1); the binary's +sha256 is recorded on the score row. pack_score.py, beside score.py, holds that rule; --strict-binary is not used here +because this image builds the verifier from source, a different file from the served build. + +The reward, reward.json in ZTP_VERIFIER_DIR: {"reward": 0 or 1, "correct": 0 or 1, "proofs_hold": 0 or 1}. +reward is 1 only when both scores are 1. score.json holds the scorer's line (the reason for a 0). +If the scorer itself fails, no reward is written and this exits non-zero. +""" +import json +import os +import re +import signal +import subprocess +import sys +import tempfile + +TESTS = os.environ.get("ZTP_TESTS_DIR") or os.path.dirname(os.path.abspath(__file__)) +SCORER = os.environ.get("ZTP_SCORER_DIR") or TESTS +ANSWER = os.environ.get("ZTP_ANSWER_FILE") or "/app/answer.json" +CALLS = os.environ.get("ZTP_CALLS_FILE") or "/app/calls.jsonl" +TRAJECTORY = os.environ.get("ZTP_TRAJECTORY_FILE") or "/logs/agent/trajectory.json" +ORACLE_LOG = os.environ.get("ZTP_ORACLE_LOG") or "/logs/agent/oracle.txt" +OUT = os.environ.get("ZTP_VERIFIER_DIR") or "/logs/verifier" +ENGINE = os.environ.get("ZTP_ENGINE") or "/usr/local/bin/mcp_stdio" +TIMEOUT_S = float(os.environ.get("ZTP_SCORE_TIMEOUT_S") or 600) +SCORES = ("correct", "proofs_hold") + + +class ScorerFailed(Exception): + """The check could not be made. No reward is written.""" + + +def on_one_line(text): + try: + whole = json.loads(text) + except ValueError: + return text + if not isinstance(whole, dict): + return text + return re.sub(r"[\r\n]+", " ", text.strip()) + + +def text_of(message): + if isinstance(message, str): + return message + if isinstance(message, list): + return "\n".join(part.get("text") or "" for part in message if isinstance(part, dict) and part.get("type") == "text") + return "" + + +def trajectory_steps(): + try: + with open(TRAJECTORY, encoding="utf-8", errors="replace") as f: + return json.load(f).get("steps") or [] + except (OSError, ValueError, AttributeError, TypeError): + return [] + + +def find_reply(): + try: + with open(ANSWER, encoding="utf-8-sig", errors="replace") as f: + text = f.read() + if text.strip(): + return on_one_line(text), "the answer file %s" % ANSWER + except OSError: + pass + for step in reversed(trajectory_steps()): + if isinstance(step, dict) and step.get("source") == "agent" and text_of(step.get("message")).strip(): + return text_of(step["message"]), "the last agent message in %s" % TRAJECTORY + return None, "nowhere: no answer file and no agent message in a trajectory file" + + +def verifier_tool(name): + """The verifier's own name for a tool call (mcp__verifier__solve -> solve), or None for any other tool.""" + sys.path.insert(0, SCORER) + from score import VERIFIER_TOOLS, tool_name + tool = tool_name(name) + return tool if tool in VERIFIER_TOOLS else None + + +def find_calls(): + """(list of {"tool", "arguments"} or None, where they were found).""" + if os.path.isfile(TRAJECTORY): + calls, other = [], 0 + for step in trajectory_steps(): + if not isinstance(step, dict) or step.get("source") != "agent": + continue + for call in step.get("tool_calls") or []: + if not isinstance(call, dict): + continue + tool = verifier_tool(call.get("function_name")) + if tool is None: + other += 1 + continue + arguments = call.get("arguments") + if isinstance(arguments, str): + try: + arguments = json.loads(arguments) + except ValueError: + arguments = {} + calls.append({"tool": tool, "arguments": arguments if isinstance(arguments, dict) else {}}) + return calls, "%d verifier calls in %s (%d calls of other tools left out)" % (len(calls), TRAJECTORY, other) + if os.path.isfile(ORACLE_LOG): + try: + with open(CALLS, encoding="utf-8", errors="replace") as f: + logged = [json.loads(line) for line in f if line.strip()] + return logged, "the oracle's call log %s (no trajectory; %s is there)" % (CALLS, ORACLE_LOG) + except (OSError, ValueError): + return None, "nowhere: the oracle ran and wrote no call log" + return None, "nowhere: no trajectory file, and the oracle did not run" + + +def the_environment(): + path = os.path.join(TESTS, "environment.jsonl") + try: + with open(path, encoding="utf-8") as f: + rows = [json.loads(line) for line in f if line.strip()] + except (OSError, ValueError) as problem: + raise ScorerFailed("%s cannot be read: %s" % (path, problem)) + if len(rows) != 1 or not isinstance(rows[0], dict) or not isinstance(rows[0].get("id"), str): + raise ScorerFailed("%s does not hold exactly one environment" % path) + return rows[0], path + + +def verifier_answers(): + if ENGINE.startswith("http://") or ENGINE.startswith("https://"): + return "an MCP address, not asked here" + if not os.path.isfile(ENGINE): + raise ScorerFailed("there is no verifier at %s" % ENGINE) + sys.path.insert(0, SCORER) + try: + from ztp_mcp import StdioVerifier + verifier = StdioVerifier([ENGINE], timeout_s=60, patience_s=0) + try: + verifier.connect() + server = verifier.server + finally: + verifier.close() + except Exception as problem: + raise ScorerFailed("the verifier at %s did not answer as an MCP server: %s" % (ENGINE, problem)) + if not isinstance(server, dict) or not server.get("name"): + raise ScorerFailed("the program at %s answered and did not say what it is; it is not the verifier" % ENGINE) + return "%s %s" % (server.get("name"), server.get("version")) + + +def run_scorer(command): + environment = dict(os.environ, PYTHONIOENCODING="utf-8") + process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=environment, + encoding="utf-8", errors="replace", start_new_session=True) + try: + stdout, stderr = process.communicate(timeout=TIMEOUT_S) + except subprocess.TimeoutExpired: + try: + os.killpg(process.pid, signal.SIGKILL) + except OSError: + process.kill() + stdout, stderr = process.communicate() + return None, stdout, stderr + return process.returncode, stdout, stderr + + +def grade(log): + environment, environment_path = the_environment() + name = environment["id"] + reply, found = find_reply() + log.append("environment: %s" % name) + log.append("reply from: %s" % found) + log.append("verifier: %s (%s)" % (ENGINE, verifier_answers())) + with tempfile.TemporaryDirectory() as work: + replies = os.path.join(work, "replies") + os.mkdir(replies) + if reply is not None: + with open(os.path.join(replies, name + ".txt"), "w", encoding="utf-8") as f: + f.write(reply) + calls, where = find_calls() + log.append("calls from: %s" % where) + if calls is not None: + with open(os.path.join(replies, name + ".calls.jsonl"), "w", encoding="utf-8") as f: + for call in calls: + f.write(json.dumps(call) + "\n") + scores_path = os.path.join(work, "scores.jsonl") + score_py = os.path.join(SCORER, "score.py") + entry = os.path.join(SCORER, "pack_score.py") + command = [sys.executable, "-B", entry if os.path.isfile(entry) else score_py, replies, "--engine", ENGINE, + "--environments", environment_path, "--only", name, "--out", scores_path] + with open(score_py, encoding="utf-8") as f: + if "--calls-from" in f.read(): + # the call record here is the one this file found: Harbor's trajectory, or the oracle's log + command += ["--calls-from", "reply"] + code, stdout, stderr = run_scorer(command) + log.append("score.py exit: %s" % ("none, ended after %g s" % TIMEOUT_S if code is None else code)) + log.append("score.py stdout:\n%s" % stdout) + log.append("score.py stderr:\n%s" % stderr) + if code is None: + raise ScorerFailed("score.py did not finish in %g s" % TIMEOUT_S) + if code != 0: + raise ScorerFailed("score.py exited %d: %s" % (code, (stderr.strip().splitlines() or ["no message"])[-1])) + try: + with open(scores_path, encoding="utf-8") as f: + rows = [json.loads(line) for line in f if line.strip()] + except (OSError, ValueError) as problem: + raise ScorerFailed("score.py wrote no scores that can be read: %s" % problem) + if len(rows) != 1 or not isinstance(rows[0], dict) or rows[0].get("id") != name: + raise ScorerFailed("score.py did not write one line for %s" % name) + row = rows[0] + if any(type(row.get(score)) is not int or row[score] not in (0, 1) for score in SCORES): + raise ScorerFailed("score.py did not give %s as 0 or 1" % " and ".join(SCORES)) + row["reply_from"] = found + reward = {"reward": int(all(row[score] == 1 for score in SCORES))} + reward.update((score, row[score]) for score in SCORES) + if isinstance(row.get("graded"), (int, float)): + reward["graded"] = row["graded"] + return reward, row + + +def main(): + os.makedirs(OUT, exist_ok=True) + for name in ("reward.json", "reward.txt", "score.json"): + try: + os.remove(os.path.join(OUT, name)) + except OSError: + pass + log, failure = [], None + try: + reward, row = grade(log) + except ScorerFailed as problem: + failure = "the scorer failed, no reward written: %s" % problem + log.append(failure) + with open(os.path.join(OUT, "score.log"), "w", encoding="utf-8") as f: + f.write("\n".join(log) + "\n") + if failure: + sys.exit(failure) + with open(os.path.join(OUT, "score.json"), "w", encoding="utf-8") as f: + json.dump(row, f) + f.write("\n") + with open(os.path.join(OUT, "reward.json"), "w", encoding="utf-8") as f: + json.dump(reward, f) + f.write("\n") + print(json.dumps(reward)) + if row.get("reason"): + print(row["reason"].encode("ascii", "backslashreplace").decode("ascii")) + + +if __name__ == "__main__": + main() diff --git a/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/pack_score.py b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/pack_score.py new file mode 100644 index 0000000000000000000000000000000000000000..b41382aa52ca13dbeccd56097b08175a0fed19a2 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/pack_score.py @@ -0,0 +1,105 @@ +"""Cross-platform release-pinned scorer wrapper for Zero-Trust Physics packs (macOS arm64, Linux amd64, Linux arm64, HTTP). + + python3 pack_score.py REPLIES --engine ENGINE --environments F [score.py's options] [--strict-binary] + python3 pack_score.py --run run_cheat_suite.py [its options] [--strict-binary] + +Verifies that the target verifier answers MCP initialize as release 0.15.3 (matching reference.gateway_version and +engine_tag) on kernel genesis_kernel_v0.13.1, while recording engine_binary_sha256_seen and engine_binary_is_reference on +every score row. Pass --strict-binary to additionally require exact SHA-256 identity with reference.engine_binary_sha256. +All deterministic recomputation, seal, budget, and grading invariants of score.py apply unchanged. + +Standard library only. Licence: Apache-2.0. +""" +import inspect +import os +import re +import runpy +import sys + +HERE = os.path.dirname(os.path.abspath(__file__)) +if HERE not in sys.path: + sys.path.insert(0, HERE) + +KERNEL = "genesis_kernel_v0.13.1" +STRICT = False + + +def _kernel_of(replay): + """The kernel the verifier names: its serverInfo.description is the kernel's name (0.15.2), or one line that ends + with it ("... Cards: genesis_kernel_v0.13.1", 0.15.3).""" + server = getattr(getattr(replay, "verifier", None), "server", None) or {} + found = re.findall(r"genesis_kernel_v[0-9][0-9.]*[0-9]", server.get("description") or "") + return found[-1] if found else server.get("description") + + +def install(strict=False): + """Configure cross-platform release identity verification on score (idempotent). Returns the score module.""" + global STRICT + STRICT = bool(strict) + import score + if getattr(score, "_pack_engine_identity", False): + return score + original = score.engine_problem + original_score = score.score + + def engine_problem(env, replay): + ref = env.get("reference") or {} + want = ref.get("engine_binary_sha256") + seen = getattr(replay, "binary_sha256", None) + if STRICT or not (seen and want and seen != want): + return original(env, replay) + # a different file: held to the release by what it says it is, every other rule as score.py's + saved = replay.binary_sha256 + replay.binary_sha256 = None + try: + problem = original(env, replay) + finally: + replay.binary_sha256 = saved + if problem: + return problem + kernel = _kernel_of(replay) + if kernel != KERNEL: + return "the verifier reports kernel %s; release %s runs %s" % (kernel, replay.version, KERNEL) + return None + + def scored(env, reply, replay, *args, **kwargs): + row = original_score(env, reply, replay, *args, **kwargs) + if isinstance(row, dict): + want = (env.get("reference") or {}).get("engine_binary_sha256") + seen = getattr(replay, "binary_sha256", None) + row["engine_binary_sha256_seen"] = seen + row["engine_binary_is_reference"] = None if not seen else (seen == want) + return row + + # score.py may one day hold its own source-build rule; then it is left as it is + if "strict" in inspect.getsource(original).lower(): + return score + score.engine_problem = engine_problem + score.score = scored + score._pack_engine_identity = True + return score + + +def main(): + argv = sys.argv[1:] + strict = "--strict-binary" in argv + argv = [a for a in argv if a != "--strict-binary"] + if argv[:1] == ["--run"]: + if len(argv) < 2: + sys.exit("give the program: --run run_cheat_suite.py [options]") + program = argv[1] if os.path.isabs(argv[1]) or os.path.isfile(argv[1]) else os.path.join(HERE, argv[1]) + folder = os.path.dirname(os.path.abspath(program)) + if folder not in sys.path: + sys.path.insert(0, folder) + install(strict) + # a program that does `from score import score` takes the replaced function, as the module now holds it + sys.argv = [program] + argv[2:] + runpy.run_path(program, run_name="__main__") + return + score = install(strict) + sys.argv = [os.path.join(HERE, "score.py")] + argv + score.main() + + +if __name__ == "__main__": + main() diff --git a/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/score.py b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/score.py new file mode 100644 index 0000000000000000000000000000000000000000..4403f043313037d26927b89db218b4718ffcf3d2 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/score.py @@ -0,0 +1,1199 @@ +"""Score replies to the multi-step environments with no judge: a program and the verifier. + + python3 score.py REPLIES --engine ENGINE [--environments F] [--only id,id] [--out F] + [--calls-from reply|harness] [--harness-dir DIR] + + REPLIES is a folder with one file per environment, .txt, the whole text of a reply. + --calls-from harness the call record is the harness's own: .harness.jsonl, written by + harness/mcp_log_proxy.py outside the solver's working directory (in + --harness-dir, default REPLIES). A .calls.jsonl beside the reply, + when there is one, is read only to catch an edit: it must equal the + harness log call for call. + --calls-from reply (the earlier set's way) the call record is .calls.jsonl beside the reply: + one JSON object a line, {"tool": "", "arguments": {...}}. + + ENGINE is the verifier: the path to mcp_stdio (MCP over stdio, no network), or an MCP address + beginning http. A task is scored only on the engine it was built on: the verifier's version must + be the task's reference.gateway_version (engine_tag), and a local binary's SHA-256 the task's + reference.engine_binary_sha256. + +The answer card is one JSON object on the reply's last line. Its shape is the family's: + + tradeoff, chain_design (kind design_to_limit, chained_design) + {"passing": DESIGN, "failing": DESIGN, "binding": ""} + DESIGN = {"run": {"request": R, "proof": ""}, + "solve": {"request": R, "proof": ""}} (solve only where the task has one) + Where a constraint is that the run completes and it binds, the failing DESIGN also carries + "stopped": "" and "step": . R = {"tool": ..., "arguments": {...}} + The design shapes, one scorer for every group (check.design says which): + run a run alone. + coupled check.design.chain names a solver and coupling: the run, then a solve handed that sealed run. + continued check.design.chain.kind "continuation", or chain.layout.kind "continue": the run, then a run of + the same card that continues it through from, starting from its sealed final state, + DESIGN = {"run": {...}, "next": {"request": R, "proof": ""}}. The next run's template + is chain.next_template, chain.template or chain.next; its start fields are chain.carried + ({field: where the first run's answer holds it}), chain.handed (with chain.handed_from) or + chain.carry and chain.clock, each equal to the first run's answer bit for bit. A constraint on + "next" reads the next run, and a stop constraint judges it. + solve check.design.tool or check.design.kind "solve": DESIGN = {"solve": {...}}, one solve and no + run. A binding refusal is named ("stopped") with no step. + staged check.design.stages: DESIGN = {"": {"request": R, "proof": ...}, ...}, one entry per + stage in order; a later stage carries an earlier stage's answer at a named input (handed) or + continues an earlier run (continues), bit for bit. + A constraint's read may carry "index": one entry of an output the verifier returns as a list. + budget (kind budgeted_search) + {"holds": {"request": R, "proof": ""}, + "stops": {"request": R, "proof": "", "stopped": ""}} + forensics + {"false_rows": {"": "", ...}} ({} when every row is genuine) + +Every proof is verified on the verifier (verify_tape for a run_seal, verify_solution for a +solution_seal, short form) and every number judged is read from the verifier's own answer to the +card's request, sent again here, never from the reply. + +Scores per environment +---------------------- +reward 0 or 1, exactly as the earlier scorer: 1 only when correct and proofs_hold are both 1. + proofs_hold: every proof on the card verifies. correct: the card is the right answer and + nothing below under "integrity" failed. +graded in [0, 1], beside reward. + + Integrity (graded 0 and reward 0, whatever the answer): the card cannot be read; a proof does not + verify (a copied, nudged, edited or stale proof); a request differs from the task's template other + than at the design variable; a chained solve not handed its own design's sealed run; no call log; + a call log beside the reply that differs from the harness log; a harness log whose chain breaks; + a forbidden tool called; more computing calls than the budget; a request on the card that is not + among the calls; a forensics answer with no computing call behind it; a task built on another + engine than the verifier. + + tradeoff, chain_design, budget. With integrity held, the sides are judged on the verifier: the + passing design meets every constraint and the failing one breaks the named binding constraint + (budget: holds completes, stops ends with the task's stop, named on the card), on the side the + task asks for, inside its range, with any stop and step the card must name. Wrong sides score 0. + With the sides right: + + e = the length of the smallest interval holding both designs' values and the reference + boundary (for a bracket that straddles the boundary, its width) + tol = the task's tolerance (tradeoff, chain_design) or relative width x |boundary| (budget) + r = e / tol + graded = 1 when reward is 1 (r <= 1 and the bracket straddles it) + = 0.5 ** log10(r) when r > 1: each tenfold of looseness halves the score + (r 1.35 -> 0.914, 2 -> 0.811, 10 -> 0.5, 100 -> 0.25) + = 0.5 when r <= 1 but the bracket misses the reference boundary + by more than the slack (another crossing than the one asked) + + The decay is smooth and falls monotonically with r, and a near miss scores near the top. + + forensics. With integrity held, graded is F1 over the (row, reason) pairs: a row counts as found + only with its right reason. precision = found / named, recall = found / false rows; an empty + answer to a table with no false row scores 1. A card that names every row of the table false is + a blanket answer and scores 0, as do unknown rows and reasons outside the task's list. + +Licence: Apache-2.0. +""" +import argparse +import copy +import hashlib +import json +import math +import os +import re +import sys + +HERE = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, HERE) +from ztp_mcp import McpError, StdioVerifier, Verifier # noqa: E402 + +FAMILIES = ("tradeoff", "chain_design", "budget", "forensics") +KINDS = {"tradeoff": "design_to_limit", "chain_design": "chained_design", "budget": "budgeted_search", "forensics": "forensics"} +NOT_STOPPED = ("completed", "converged") +PREFIX_ENDS = ("__", ".", ":", "/") +VERIFIER_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite", + "run_trajectory", "compute_step", "verify_step", "design_run", "solve", "run_dataset", + "validate_series", "verify_tape", "verify_solution", "verify_dataset", "verify_receipt", "find_flip") +# Calls that read the catalogue compute nothing and are free in a call budget. +FREE_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite", "verify_receipt") +REASONS = ("value_altered", "seal_wrong", "flag_omitted", "retired_model", "stop_hidden") +GRADED_DECAY = 0.5 # graded = GRADED_DECAY ** log10(r) +OTHER_CROSSING = 0.5 # right sides, tight, around another crossing than the reference boundary + + +class Integrity(Exception): + """The answer cannot be trusted: graded 0 and reward 0.""" + + +class Wrong(Exception): + """The answer is trusted and wrong: graded 0 and reward 0.""" + + +def load_environments(path): + with open(path, encoding="utf-8") as f: + return [json.loads(line) for line in f if line.strip()] + + +def row_problems(env): + """What a task row lacks against the shared row contract (empty when none).""" + out = [] + for key in ("id", "family", "models", "real_thing", "task", "check", "seed", "reference"): + if key not in env: + out.append("no %s" % key) + family = env.get("family") + if family not in FAMILIES: + out.append("family %r" % family) + elif "kind" in env and env["kind"] != KINDS[family]: + out.append("kind %r for family %s (want %s)" % (env["kind"], family, KINDS[family])) + ref = env.get("reference") or {} + for key in ("engine_tag", "engine_commit", "engine_binary_sha256"): + if not ref.get(key): + out.append("reference.%s missing" % key) + return out + + +def file_sha256(path): + h = hashlib.sha256() + with open(path, "rb") as f: + for block in iter(lambda: f.read(1 << 20), b""): + h.update(block) + return h.hexdigest() + + +def open_verifier(engine): + if engine.startswith("http://") or engine.startswith("https://"): + verifier = Verifier(engine, pause_s=0.5) + verifier.binary_sha256 = None + else: + if not os.path.isfile(engine): + sys.exit("no file at %s: give the path to mcp_stdio, or an MCP address beginning http" % engine) + verifier = StdioVerifier([engine]) + verifier.binary_sha256 = file_sha256(engine) + try: + verifier.connect() + except McpError as problem: + sys.exit("the verifier failed, so nothing was scored: %s" % problem) + if not isinstance(verifier.server, dict) or not verifier.server.get("name"): + close_verifier(verifier) + sys.exit("the verifier failed, so nothing was scored: %s did not answer as an MCP server" % engine) + return verifier + + +def close_verifier(verifier): + if hasattr(verifier, "close"): + verifier.close() + + +# ------------------------------------------------------------------------------------------ +# reading the reply and the call logs +# ------------------------------------------------------------------------------------------ +def _no_constant(name): + raise ValueError("%s is not a number" % name) + + +def read_card(reply): + """(card, problem): the JSON object on the reply's last line. A closing code fence is passed over.""" + lines = [line.strip() for line in (reply or "").replace("\r", "\n").split("\n") if line.strip()] + while lines and lines[-1].startswith("```"): + lines.pop() + if not lines: + return None, "the reply is empty" + try: + card = json.loads(lines[-1], parse_constant=_no_constant) + except ValueError: + return None, "the last line is not one JSON object" + if not isinstance(card, dict): + return None, "the last line is not one JSON object" + return card, None + + +def tool_name(name): + """The verifier's own name for a tool an agent's program may have prefixed (mcp__zerotrust__solve).""" + if not isinstance(name, str): + return None + if name in VERIFIER_TOOLS: + return name + for tool in VERIFIER_TOOLS: + for joint in PREFIX_ENDS: + if name.endswith(joint + tool): + return tool + return name + + +def without_readout(arguments): + """A run's arguments as sealed: a readout is not part of a run's seal.""" + if not isinstance(arguments, dict): + return arguments + return {k: v for k, v in arguments.items() if k != "readout"} + + +def numbers_by_value(value): + """Every number as a float, so 18 and 18.0 (one request to the engine) compare equal; bools kept.""" + if isinstance(value, dict): + return {k: numbers_by_value(v) for k, v in value.items()} + if isinstance(value, list): + return [numbers_by_value(v) for v in value] + if isinstance(value, int) and not isinstance(value, bool): + return float(value) + return value + + +def canonical(arguments): + """A request's arguments as compared with the call log: no readout, keys sorted, numbers by value.""" + return json.dumps(numbers_by_value(without_readout(arguments)), sort_keys=True, separators=(",", ":")) + + +def _arguments(one): + arguments = one.get("arguments") + if isinstance(arguments, str): + try: + arguments = json.loads(arguments) + except ValueError: + arguments = {} + return arguments if isinstance(arguments, dict) else {} + + +def read_calls(path): + """Every call in a reply-side call log, [(tool, arguments)], or None when there is no log.""" + if not path or not os.path.isfile(path): + return None + calls = [] + with open(path, encoding="utf-8", errors="replace") as f: + for line in f: + line = line.strip() + if not line: + continue + try: + one = json.loads(line) + except ValueError: + continue + if isinstance(one, dict): + calls.append((tool_name(one.get("tool")), _arguments(one))) + return calls + + +def chain_of(previous, entry): + payload = json.dumps(entry, sort_keys=True, separators=(",", ":")) + return hashlib.sha384(((previous or "") + payload).encode("utf-8")).hexdigest() + + +def read_harness_log(path): + """(calls, problem) from a log written by harness/mcp_log_proxy.py. calls is None when there is no log; + problem names the first line whose chain does not follow (an edit, a line taken out or put in).""" + if not path or not os.path.isfile(path): + return None, None + calls, previous = [], None + with open(path, encoding="utf-8", errors="replace") as f: + for number_, line in enumerate(f, 1): + if not line.strip(): + continue + try: + entry = json.loads(line) + except ValueError: + return calls, "line %d of the harness log is not JSON" % number_ + if not isinstance(entry, dict) or "chain" not in entry: + return calls, "line %d of the harness log carries no chain" % number_ + chain = entry.pop("chain") + if chain != chain_of(previous, entry) or entry.get("seq") != len(calls) + 1: + return calls, "the harness log's chain breaks at line %d" % number_ + previous = chain + calls.append((tool_name(entry.get("tool")), _arguments(entry))) + return calls, None + + +def write_harness_log(path, calls): + """A chained log in the proxy's format, for tests and the cheat suite: calls [(tool, arguments)].""" + previous = None + with open(path, "w", encoding="utf-8") as f: + for seq, (tool, arguments) in enumerate(calls, 1): + entry = {"seq": seq, "jsonrpc_id": seq, "tool": tool, "arguments": arguments, "ts_request": None, + "ts_response": None, "duration_s": None, "response_sha384": None, "text_sha384": None, "is_error": False} + entry["chain"] = chain_of(previous, entry) + previous = entry["chain"] + f.write(json.dumps(entry, sort_keys=True) + "\n") + + +# ------------------------------------------------------------------------------------------ +# the verifier, asked again +# ------------------------------------------------------------------------------------------ +def stop_name_in(sentence): + names = re.findall(r"\(([A-Z][A-Za-z0-9]*[a-z][A-Za-z0-9]*)\)", sentence or "") + return names[-1] if names else None + + +class Replay: + """The verifier, with every answer remembered: the same request is sent once.""" + + def __init__(self, verifier): + self.verifier = verifier + self.seen = {} + server = getattr(verifier, "server", None) or {} + self.version = server.get("version") + self.binary_sha256 = getattr(verifier, "binary_sha256", None) + + def call(self, tool, arguments): + key = tool + "\x00" + json.dumps(arguments, sort_keys=True) + if key not in self.seen: + try: + self.seen[key] = self.verifier.call_json(tool, arguments) + except McpError as problem: + if not str(problem).startswith("protocol error"): + raise SystemExit("the verifier failed, so nothing was scored: %s" % problem) + self.seen[key] = ("the verifier did not take the request: %s" % problem, True) + return self.seen[key] + + def answer(self, tool, arguments, readout=None): + """One run or solve computed again: {"stopped", "outcome", "stop", "proof", "body"}.""" + arguments = copy.deepcopy(without_readout(arguments)) + if readout is not None and tool == "run_trajectory": + arguments["readout"] = readout + body, is_error = self.call(tool, arguments) + if is_error or not isinstance(body, dict): + sentence = body if isinstance(body, str) else json.dumps(body) + return {"stopped": True, "outcome": "stopped before computing", "stop": stop_name_in(sentence), + "proof": None, "body": None, "sentence": sentence} + outcome = body.get("outcome") + stopped = outcome not in NOT_STOPPED + return {"stopped": stopped, "outcome": outcome, "stop": body.get("reject") if stopped else None, + "proof": body.get("run_seal") or body.get("solution_seal"), "body": body, + "sentence": body.get("reject_detail")} + + def proof_holds(self, tool, arguments, proof): + """(holds, words): the card's seal verified by verify_tape or verify_solution, short form.""" + if not isinstance(proof, str) or not re.fullmatch(r"[0-9a-f]{96}", proof): + return False, "the proof is not a SHA-384 seal of 96 hex digits" + if tool == "run_trajectory": + body, is_error = self.call("verify_tape", {"request": without_readout(arguments), "run_seal": proof}) + elif tool == "solve": + body, is_error = self.call("verify_solution", {"request": arguments, "solution_seal": proof}) + else: + return False, "a proof is verified for run_trajectory or solve only, not %s" % tool + if is_error or not isinstance(body, dict): + return False, "the verifier would not verify it: %s" % (str(body)[:200]) + if body.get("holds") is True: + return True, None + return False, "the verifier says the seal does not hold (cause %s)" % body.get("cause") + + +def engine_problem(env, replay): + """None when the verifier is the engine the task was built on; else what differs.""" + ref = env.get("reference") or {} + tag = ref.get("gateway_version") or (ref.get("engine_tag") or "").lstrip("v") + if not tag: + return "the task names no engine it was built on" + if (ref.get("engine_tag") or "v" + tag).lstrip("v") != tag: + return "the task's engine_tag %s and gateway_version %s disagree" % (ref.get("engine_tag"), ref.get("gateway_version")) + if replay.version != tag: + return "the task was built on engine %s; the verifier is %s" % (tag, replay.version) + want = ref.get("engine_binary_sha256") + if replay.binary_sha256 and want and replay.binary_sha256 != want: + return "the verifier's binary is not the one the task was built on (sha256 %s..., want %s...)" % (replay.binary_sha256[:12], want[:12]) + return None + + +# ------------------------------------------------------------------------------------------ +# requests and their inputs +# ------------------------------------------------------------------------------------------ +_PART = re.compile(r"([A-Za-z_0-9]+)((?:\[\d+\])*)") + + +def get_path(obj, path): + here = obj + for part in path.split("."): + found = _PART.fullmatch(part) + if not found or not isinstance(here, dict) or found.group(1) not in here: + return None + here = here[found.group(1)] + for index in re.findall(r"\[(\d+)\]", found.group(2)): + if not isinstance(here, list) or int(index) >= len(here): + return None + here = here[int(index)] + return here + + +def set_path(obj, path, value): + parts = path.split(".") + here = obj + for i, part in enumerate(parts): + m = _PART.fullmatch(part) + name, idx = m.group(1), [int(k) for k in re.findall(r"\[(\d+)\]", m.group(2))] + last = i == len(parts) - 1 + if not idx: + if last: + here[name] = value + else: + here = here[name] + else: + here = here[name] + for j, k in enumerate(idx): + if last and j == len(idx) - 1: + here[k] = value + else: + here = here[k] + + +def number(value): + return isinstance(value, (int, float)) and not isinstance(value, bool) and math.isfinite(value) + + +def differs(template, given, free, where=""): + """The first place where a request differs from the task's, other than the free places. None when none.""" + if where in free: + return None + if isinstance(template, dict): + if not isinstance(given, dict): + return where or "the request" + for key in set(template) | set(given): + place = "%s.%s" % (where, key) if where else key + if place in free: + continue + if key not in given or key not in template: + return place + found = differs(template[key], given[key], free, place) + if found: + return found + return None + if isinstance(template, list): + if not isinstance(given, list) or len(given) != len(template): + return where + for index, (a, b) in enumerate(zip(template, given)): + found = differs(a, b, free, "%s[%d]" % (where, index)) + if found: + return found + return None + if number(template) and number(given): + return None if float(template) == float(given) else where + return None if template == given else where + + +def design_value(variable, run_arguments, solve_arguments, next_arguments=None): + """The design variable of one design, read from its requests (on: run, solve, or next, a continued run).""" + kind = variable["kind"] + if kind == "path": + on = variable.get("on", "run") + source = {"solve": solve_arguments, "next": next_arguments}.get(on, run_arguments) or {} + value = get_path(source, variable["path"]) + for place in variable.get("also") or []: + again = get_path(source, place) + if not (number(again) and number(value) and float(again) == float(value)): + return None + return float(value) if number(value) else None + if kind == "entry_angle_deg": + radial = get_path(run_arguments or {}, "initial.radial_speed_m_s") + transverse = get_path(run_arguments or {}, "initial.transverse_speed_m_s") + if not (number(radial) and number(transverse)) or transverse <= 0: + return None + speed = math.hypot(radial, transverse) + if abs(speed - variable["speed_m_s"]) > 1e-6 * variable["speed_m_s"]: + return None + return math.degrees(math.atan2(-radial, transverse)) + return None + + +def variable_places(variable): + if variable["kind"] == "entry_angle_deg": + return {"initial.radial_speed_m_s", "initial.transverse_speed_m_s"} + if variable["kind"] == "path" and variable.get("on", "run") == "run": + return {variable["path"]} | set(variable.get("also") or []) + return set() + + +def read_value(read, answer): + """One number from a replayed answer: final, result, or the extreme of a run's readout.""" + body = answer["body"] + if body is None: + return None + kind = read["kind"] + value = None + if kind == "final": + value = (body.get("final_state") or {}).get(read["quantity"]) + elif kind == "result": + value = (body.get("result") or {}).get(read["quantity"]) + elif kind == "flag_extent": + # an advisory flag the run raised, at its largest extent; 0 when the run does not raise it + value = max([x.get("extent") or 0.0 for x in body.get("exceedance_extremes") or [] + if isinstance(x, dict) and x.get("flag") == read["quantity"]] or [0.0]) + elif kind == "extreme": + for quantity in (body.get("readout") or {}).get("quantities") or []: + if quantity.get("quantity") == read["quantity"]: + value = quantity.get(read["which"]) + if "index" in read: + # one entry of an output the verifier returns as a list (a hose's modes, a solve asked at several points) + k = read["index"] + value = value[k] if isinstance(value, list) and isinstance(k, int) and -len(value) <= k < len(value) else None + return value if number(value) else None + + +def readout_for(constraints, on="run"): + """The readout a run is sent with: the extremes its constraints read (on: run, next, or a stage key).""" + quantities = sorted({c["read"]["quantity"] for c in constraints if c["on"] == on and c["read"]["kind"] == "extreme"}) + return {"quantities": quantities} if quantities else None + + +def design_shape(spec): + """Which of the design shapes a task's check.design is: run, coupled, continued, solve or staged.""" + if spec.get("stages"): + return "staged" + if spec.get("tool") == "solve" or spec.get("kind") == "solve": + return "solve" + chain = spec.get("chain") or {} + if chain.get("kind") == "continuation" or (chain.get("layout") or {}).get("kind") == "continue": + return "continued" + return "coupled" if chain else "run" + + +def continuation_of(spec): + """A continued design's chain in one form: (next template, {start field: where the first run's answer holds it}, + next outcomes, the next run's places that also hold a first-run design value).""" + chain = spec["chain"] + template = chain.get("next_template") or chain.get("template") or chain.get("next") + if "carried" in chain: # group 1 + carried = dict(chain["carried"]) + elif "handed" in chain: # group 4 + named = chain.get("handed_from") or {} + carried = {k: "final_state." + named.get(k, k) for k in chain["handed"]} + else: # group 5 + carried = {k: "final_state." + k for k in chain.get("carry") or []} + if chain.get("clock"): + carried[chain["clock"]["field"]] = "final_state." + chain["clock"]["from"] + outcomes = chain.get("next_outcomes") or spec["run_outcomes"] + return template, carried, outcomes, list(chain.get("next_also") or []) + + +def meets(constraint, value): + if value is None: + return False + return value <= constraint["limit"] if constraint["op"] == "<=" else value >= constraint["limit"] + + +def history_layout_problem(layout, parameters, frames_count): + """None when the arrays of a chained solve are laid out as the task states; else what is not.""" + if layout is None: + return None + if layout["kind"] == "stardust_slab": + names = ("history_time_s", "history_pressure_pa", "history_heat_transfer_coefficient_kg_per_m2_s", + "history_flow_enthalpy_j_per_kg", "history_radiative_heating_w_per_m2") + columns = [parameters.get(name) for name in names] + if not all(isinstance(c, list) and all(number(v) for v in c) for c in columns): + return "the history columns are not all lists of numbers" + time, pressure, coefficient, enthalpy, radiative = columns + rows = frames_count + 3 + if any(len(c) != rows for c in columns): + return "the history has not one row before the %d frames handed and two after them" % frames_count + if time[0] != 0.0 or coefficient[0] != 0.0: + return "row 0 is not at 0 s with no heating" + if pressure[0] != pressure[1] or enthalpy[0] != enthalpy[1]: + return "row 0 does not repeat the first frame's pressure and enthalpy" + if abs(time[-2] - (time[-3] + 1.0)) > 1e-9 or time[-1] != layout["cool_to_s"]: + return "the rows after the frames are not at 1 s after the last frame and at %g s" % layout["cool_to_s"] + if coefficient[-2] != 0.0 or coefficient[-1] != 0.0: + return "the stream is not off after the frames" + if pressure[-1] != pressure[-3] or pressure[-2] != pressure[-3] or enthalpy[-1] != enthalpy[-3] or enthalpy[-2] != enthalpy[-3]: + return "the rows after the frames do not hold the last frame's pressure and enthalpy" + if any(v != 0.0 for v in radiative): + return "a row of the history holds radiative heating" + return None + if layout["kind"] == "triga_element": + return None # every array is handed by the coupling and held to its bits by the verifier + return "an unknown layout" + + +# ------------------------------------------------------------------------------------------ +# the call record +# ------------------------------------------------------------------------------------------ +def card_requests(env, card): + """Every request on the card, [(tool, arguments)], read leniently (for the call log).""" + out = [] + + def take(part): + if isinstance(part, dict) and isinstance(part.get("request"), dict) and isinstance(part["request"].get("arguments"), dict): + out.append((tool_name(part["request"].get("tool")), part["request"]["arguments"])) + + if env["family"] in ("tradeoff", "chain_design"): + stages = [s["key"] for s in (env["check"].get("design") or {}).get("stages") or []] + for side in ("passing", "failing"): + design = card.get(side) if isinstance(card.get(side), dict) else {} + for key in stages or ("run", "solve", "next"): + take(design.get(key)) + elif env["family"] == "budget": + take(card.get("holds")) + take(card.get("stops")) + return out + + +def sequence(calls): + return [(tool_name(t), json.dumps(numbers_by_value(a), sort_keys=True)) for t, a in calls] + + +def call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row): + """None when the call record holds; else why not (an integrity failure).""" + check = env["check"] + if calls_from == "harness": + if calls is None: + return "no harness call log: every attempt is scored with the calls the harness recorded" + if log_problem: + return log_problem + if reply_calls is not None and sequence(reply_calls) != sequence(calls): + return "the call log beside the reply differs from the harness log" + elif calls is None: + return "no call log: every environment is scored with the agent's calls" + calls = [(tool_name(t), a) for t, a in calls] + banned = sorted({t for t, _ in calls if t in (check.get("forbidden") or [])}) + if banned: + return "the log holds calls of %s, which the task rules out" % ", ".join(banned) + computing = [(t, a) for t, a in calls if t not in FREE_TOOLS] + row["computing_calls"] = len(computing) + if check.get("budget") and len(computing) > check["budget"]: + return "%d computing calls; the budget is %d" % (len(computing), check["budget"]) + sent = {(t, canonical(a)) for t, a in computing} + for tool, arguments in card_requests(env, card): + if (tool, canonical(arguments)) not in sent: + return "a %s request on the card is not among the calls in the log" % tool + if env["family"] == "forensics" and not computing: + return "no computing call behind the answer: the table was not put to the verifier" + return None + + +# ------------------------------------------------------------------------------------------ +# the families +# ------------------------------------------------------------------------------------------ +def request_of(part, tool, what): + """The arguments of one request on the card (Integrity when it is not one).""" + if not isinstance(part, dict): + raise Integrity("%s is missing" % what) + request = part.get("request") + if not (isinstance(request, dict) and isinstance(request.get("arguments"), dict)): + raise Integrity("%s has no request {\"tool\": ..., \"arguments\": {...}}" % what) + if tool_name(request.get("tool")) != tool: + raise Integrity("%s is a request of %s, not %s" % (what, request.get("tool"), tool)) + return request["arguments"] + + +def score_design(env, design, which, replay, proofs): + """One design of a boundary family: facts {x, met, values, stopped, steps_landed}.""" + check = env["check"] + spec = check["design"] + shape = design_shape(spec) + if shape in ("solve", "staged", "continued") and not isinstance(design, dict): + raise Integrity("the %s design is missing" % which) + if shape == "solve": + return score_solve_design(env, design, which, replay, proofs) + if shape == "staged": + return score_staged_design(env, design, which, replay, proofs) + if shape == "continued": + return score_continued_design(env, design, which, replay, proofs) + chain = spec.get("chain") + run_args = request_of((design or {}).get("run") if isinstance(design, dict) else None, "run_trajectory", + "the %s design's run" % which) + free = set(spec.get("free") or []) | variable_places(spec["variable"]) + where = differs(spec["template"], without_readout(run_args), free) + if where: + raise Integrity("the %s design's run differs from the task's at %s" % (which, where)) + for place in spec.get("free") or []: + if place.endswith(".steps"): + steps = get_path(run_args, place) + if not (isinstance(steps, int) and not isinstance(steps, bool) and 1 <= steps <= spec.get("most_steps", 10 ** 7)): + raise Integrity("the %s design's run has no whole number of steps at %s" % (which, place)) + run_proof = design["run"].get("proof") + holds, words = replay.proof_holds("run_trajectory", run_args, run_proof) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's run_seal: %s" % (which, words)) + run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"])) + stop_names = [c["stop"] for c in check["constraints"] if c["on"] == "outcome"] + stopped_by_name = run["outcome"] == "refused" and run["stop"] in stop_names + if run["outcome"] not in spec["run_outcomes"] and not stopped_by_name: + raise Wrong("the %s design's run comes back %s%s, not %s" % ( + which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"]))) + solve_args, solve = None, None + if chain: + solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which) + if solve_args.get("solver") != chain["solver"]: + raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver"))) + handed = solve_args.get("from") + if not isinstance(handed, dict) or handed.get("coupling") != chain["coupling"]: + raise Integrity("the %s design's solve is not handed its run through the coupling %s" % (which, chain["coupling"])) + if canonical(handed.get("request")) != canonical(run_args) or handed.get("run_seal") != run_proof: + raise Integrity("the %s design's solve is not handed the design's own sealed run" % which) + parameters = solve_args.get("parameters") + if not isinstance(parameters, dict): + raise Integrity("the %s design's solve has no parameters" % which) + solve_free = set(chain.get("handed") or []) + if spec["variable"]["kind"] == "path" and spec["variable"].get("on") == "solve": + solve_free.add(spec["variable"]["path"].split(".", 1)[1]) + where = differs(chain["parameters"], parameters, solve_free) + if where: + raise Integrity("the %s design's solve differs from the task's at parameters.%s" % (which, where)) + frames = len((run["body"] or {}).get("frames") or []) + problem = history_layout_problem(chain.get("layout"), parameters, frames) + if problem: + raise Integrity("the %s design's solve: %s" % (which, problem)) + holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's solution_seal: %s" % (which, words)) + solve = replay.answer("solve", solve_args) + if solve["outcome"] != "converged": + raise Wrong("the %s design's solve comes back %s%s, not converged" % ( + which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else "")) + x = design_value(spec["variable"], run_args, solve_args) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, spec["variable"].get("words", ""))) + met, values = {}, {} + for constraint in check["constraints"]: + if constraint["on"] == "outcome": + values[constraint["id"]] = run["outcome"] if not run["stop"] else "%s (%s)" % (run["outcome"], run["stop"]) + met[constraint["id"]] = not (run["outcome"] == "refused" and run["stop"] == constraint["stop"]) + continue + value = read_value(constraint["read"], run if constraint["on"] == "run" else solve) + values[constraint["id"]] = value + met[constraint["id"]] = meets(constraint, value) + facts = {"x": x, "met": met, "values": values} + if run["outcome"] not in NOT_STOPPED and run["body"]: + facts["stopped"], facts["steps_landed"] = run["stop"], run["body"].get("steps_landed") + return facts + + +def halted(answer, stop, staged=False): + """True when an answer is stopped by the stop named: a refusal ("refused"); for a staged design, any outcome that + is not completed or converged (group 3's rule, kept as built).""" + if staged: + return answer["outcome"] not in NOT_STOPPED and answer["stop"] == stop + return answer["outcome"] == "refused" and answer["stop"] == stop + + +def constraint_facts(check, answers, judged, staged=False): + """met and values of every constraint: each read from the answer its "on" names (answers: {on: answer}); a stop + constraint ("on": "outcome") is judged on the answer judged, or on its stage's answer for a staged design.""" + met, values = {}, {} + for c in check["constraints"]: + if c["on"] == "outcome": + a = answers.get(c["stage"]) if c.get("stage") else judged + values[c["id"]] = None if a is None else (a["outcome"] if not a["stop"] else "%s (%s)" % (a["outcome"], a["stop"])) + met[c["id"]] = a is not None and not halted(a, c["stop"], staged) + continue + a = answers.get(c["on"]) + value = read_value(c["read"], a) if a is not None else None + values[c["id"]] = value + met[c["id"]] = meets(c, value) if c.get("limit") is not None else None + return met, values + + +def stopped_by(answer, constraints, stage=None): + """True when an answer is stopped by a stop one of the task's stop constraints names (for the stage given).""" + return any(halted(answer, c["stop"], stage is not None) for c in constraints + if c["on"] == "outcome" and (stage is None or c.get("stage") == stage)) + + +def score_solve_design(env, design, which, replay, proofs): + """One design that is one solve and no run (check.design.tool or kind "solve").""" + check = env["check"] + spec = check["design"] + var = spec["variable"] + solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which) + if solve_args.get("solver") != spec["template"].get("solver"): + raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver"))) + free = set(spec.get("free") or []) | {var["path"]} | set(var.get("also") or []) + where = differs(spec["template"], solve_args, free) + if where: + raise Integrity("the %s design's solve differs from the task's at %s" % (which, where)) + holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's solution_seal: %s" % (which, words)) + solve = replay.answer("solve", solve_args) + if solve["outcome"] not in spec["run_outcomes"] and not stopped_by(solve, check["constraints"]): + raise Wrong("the %s design's solve comes back %s%s, not %s" % ( + which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else "", " or ".join(spec["run_outcomes"]))) + x = design_value(dict(var, on="solve"), None, solve_args) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", ""))) + met, values = constraint_facts(check, {"solve": solve}, solve) + facts = {"x": x, "met": met, "values": values} + if solve["outcome"] not in NOT_STOPPED and solve["body"]: + facts["stopped"], facts["steps_landed"], facts["no_step"] = solve["stop"], None, True + return facts + + +def score_continued_design(env, design, which, replay, proofs): + """One design of a run and the run that continues it through from. The verifier holds the hand-off: it computes + the first run again, compares its seal and refuses a start that is not the first run's final state; the scorer + also holds each carried start field to the first run's answer, bit for bit.""" + check = env["check"] + spec = check["design"] + var = spec["variable"] + on_next = var["kind"] == "path" and var.get("on") == "next" + template, carried, next_outcomes, next_also = continuation_of(spec) + run_args = request_of(design.get("run"), "run_trajectory", "the %s design's run" % which) + free = set(spec.get("free") or []) | (set() if on_next else variable_places(var)) + where = differs(spec["template"], without_readout(run_args), free) + if where: + raise Integrity("the %s design's run differs from the task's at %s" % (which, where)) + run_proof = design["run"].get("proof") + holds, words = replay.proof_holds("run_trajectory", run_args, run_proof) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's run_seal: %s" % (which, words)) + run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"], "run")) + if run["outcome"] not in spec["run_outcomes"]: + raise Wrong("the %s design's first run comes back %s%s, not %s" % ( + which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"]))) + next_args = request_of(design.get("next"), "run_trajectory", "the %s design's next run" % which) + handed = next_args.get("from") + if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(run_args) + or handed.get("run_seal") != run_proof): + raise Integrity("the %s design's next run does not continue the design's own sealed run (from)" % which) + next_free = {"initial." + name for name in carried} | {"from"} | set(next_also) + if on_next: + next_free |= {var["path"]} | set(var.get("also") or []) + where = differs(template, without_readout(next_args), next_free) + if where: + raise Integrity("the %s design's next run differs from the task's at %s" % (which, where)) + start = next_args.get("initial") if isinstance(next_args.get("initial"), dict) else {} + for name, source in carried.items(): + held, given = get_path(run["body"] or {}, source), start.get(name) + if name not in start or not (given == held or (number(given) and number(held) and float(given) == float(held))): + raise Integrity("the %s design's next run does not start from its run's %s, bit for bit" % (which, source)) + holds, words = replay.proof_holds("run_trajectory", next_args, design["next"].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's next run_seal: %s" % (which, words)) + nxt = replay.answer("run_trajectory", next_args, readout_for(check["constraints"], "next")) + if nxt["outcome"] not in next_outcomes and not stopped_by(nxt, check["constraints"]): + raise Wrong("the %s design's next run comes back %s%s, not %s" % ( + which, nxt["outcome"], " (%s)" % nxt["stop"] if nxt["stop"] else "", " or ".join(next_outcomes))) + x = design_value(var, run_args, None, next_args) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", ""))) + for place in next_also: + again = get_path(next_args, place) + if not (number(again) and float(again) == float(x)): + raise Integrity("the %s design's next run does not hold the design value at %s" % (which, place)) + met, values = constraint_facts(check, {"run": run, "next": nxt}, nxt) + facts = {"x": x, "met": met, "values": values} + if nxt["outcome"] not in NOT_STOPPED and nxt["body"]: + facts["stopped"], facts["steps_landed"] = nxt["stop"], nxt["body"].get("steps_landed") + return facts + + +def build_stage_request(spec, stage, x, answers, requests): + """One stage's request of a staged design at x: the template, x at the variable's places, the values handed from + earlier stages' answers, and a continuation's start and from (used by run_reference.py).""" + q = copy.deepcopy(stage["template"]) + var = spec["variable"] + if var.get("stage") == stage["key"]: + for place in [var["path"]] + list(var.get("also") or []): + set_path(q, place, x) + for h in stage.get("handed") or []: + set_path(q, h["to"], read_value(h["read"], answers[h["from"]])) + if stage.get("continues"): + parent = stage["continues"] + final = answers[parent]["body"]["final_state"] + q["initial"] = {k: final[k] for k in stage["template"]["initial"]} + q["from"] = {"request": copy.deepcopy(requests[parent]), "run_seal": answers[parent]["proof"]} + return q + + +def score_staged_design(env, design, which, replay, proofs): + """One staged design (check.design.stages): each stage a run or a solve, in order.""" + check = env["check"] + spec = check["design"] + var = spec["variable"] + stages = spec["stages"] + answers, requests, facts = {}, {}, {} + for i, stage in enumerate(stages): + key, tool = stage["key"], stage["tool"] + sent = without_readout(request_of(design.get(key), tool, "the %s design's %s" % (which, key))) + free = set(stage.get("free") or []) | {h["to"] for h in stage.get("handed") or []} + if var.get("stage") == key: + free |= {var["path"]} | set(var.get("also") or []) + if stage.get("continues"): + free |= {"initial", "from"} + where = differs(stage["template"], sent, free) + if where: + raise Integrity("the %s design's %s differs from the task's at %s" % (which, key, where)) + for h in stage.get("handed") or []: + want = read_value(h["read"], answers[h["from"]]) + got = get_path(sent, h["to"]) + if want is None or not number(got) or float(got) != float(want): + raise Integrity("the %s design's %s does not carry %s's %s at %s, bit for bit" % ( + which, key, h["from"], h["read"]["quantity"], h["to"])) + if stage.get("continues"): + parent = stage["continues"] + handed = sent.get("from") + if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(requests[parent]) + or handed.get("run_seal") != design[parent].get("proof")): + raise Integrity("the %s design's %s does not continue the design's own sealed %s run (from)" % (which, key, parent)) + final = (answers[parent]["body"] or {}).get("final_state") or {} + start = sent.get("initial") + keys = set(stage["template"]["initial"]) + if not isinstance(start, dict) or set(start) != keys or any( + not number(start[k]) or float(start[k]) != final.get(k) for k in keys): + raise Integrity("the %s design's %s does not start from the final state of its %s run, bit for bit" % (which, key, parent)) + holds, words = replay.proof_holds(tool, sent, design[key].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's %s proof: %s" % (which, key, words)) + answer = replay.answer(tool, sent, readout_for(check["constraints"], key) if tool == "run_trajectory" else None) + named = stopped_by(answer, check["constraints"], stage=key) + if answer["outcome"] not in stage["outcomes"] and not named: + raise Wrong("the %s design's %s comes back %s%s, not %s" % ( + which, key, answer["outcome"], " (%s)" % answer["stop"] if answer["stop"] else "", " or ".join(stage["outcomes"]))) + answers[key], requests[key] = answer, sent + if named: + facts["stopped"], facts["stopped_stage"] = answer["stop"], key + facts["steps_landed"] = (answer["body"] or {}).get("steps_landed") if tool == "run_trajectory" else None + facts["no_step"] = tool != "run_trajectory" + if i != len(stages) - 1: + raise Wrong("the %s design's %s stops (%s) before its last stage" % (which, key, answer["stop"])) + x = design_value(dict(var, on="run"), requests.get(var["stage"]), None) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", ""))) + met, values = constraint_facts(check, answers, None, staged=True) + facts.update({"x": x, "met": met, "values": values}) + return facts + + +def grade_bracket(a, b, star, tol, slack, row): + """(reward_ok, graded) for a bracket [a, b] with its sides right.""" + width = abs(b - a) + straddles = min(a, b) - slack <= star <= max(a, b) + slack + within = width <= tol * (1 + 1e-9) + e = max(a, b, star) - min(a, b, star) + r = e / tol if tol > 0 else float("inf") + row["width"], row["width_ratio"] = width, r + if within and straddles: + return True, 1.0 + if r <= 1: + return False, OTHER_CROSSING + return False, GRADED_DECAY ** math.log10(r) + + +def score_boundary(env, card, replay, row, proofs): + check, reference = env["check"], env["reference"] + passing = score_design(env, card.get("passing"), "passing", replay, proofs) + failing = score_design(env, card.get("failing"), "failing", replay, proofs) + row["passing"], row["failing"] = passing, failing + span = check["design"].get("range") + if span and not all(span[0] <= x <= span[1] for x in (passing["x"], failing["x"])): + raise Wrong("a design lies outside the range the task states, %g to %g" % tuple(span)) + broken = [c for c, ok in passing["met"].items() if not ok] + if broken: + raise Wrong("the passing design breaks %s" % ", ".join(broken)) + broken = [c for c, ok in failing["met"].items() if not ok] + if not broken: + raise Wrong("the failing design meets every constraint") + binding = card.get("binding") + if binding != reference["binding"]: + raise Wrong("binding names %r; the constraint that binds is another" % (binding,)) + if binding not in broken: + raise Wrong("the failing design does not break %s, the constraint named binding" % binding) + if binding in [c["id"] for c in check["constraints"] if c["on"] == "outcome"]: + said = card.get("failing") or {} + if said.get("stopped") != failing.get("stopped"): + raise Wrong("the failing design's run stops with %s; the card says %r" % (failing.get("stopped"), said.get("stopped"))) + if failing.get("no_step"): + pass # a solve that is refused has no step: its stop's name is stated + elif not (isinstance(said.get("step"), int) and not isinstance(said.get("step"), bool) and said["step"] == failing.get("steps_landed")): + raise Wrong("the failing design's run is sealed to step %s; the card says %r" % (failing.get("steps_landed"), said.get("step"))) + spec = check["design"] + xp, xf = passing["x"], failing["x"] + if spec["direction"] == "largest" and not xf > xp: + raise Wrong("the task asks for the largest value that holds: the failing design must lie above the passing one") + if spec["direction"] == "smallest" and not xf < xp: + raise Wrong("the task asks for the smallest value that holds: the failing design must lie below the passing one") + ok, graded = grade_bracket(xp, xf, reference["boundary"], spec["tolerance"], spec["tolerance"] * 0.5, row) + if not ok: + return graded, "the two designs are %.6g apart; the task asks for %.6g or less, and they must straddle the boundary" % ( + abs(xf - xp), spec["tolerance"]) + return 1.0, None + + +def score_budget(env, card, replay, row, proofs): + check, reference = env["check"], env["reference"] + template, path, tool = check["template"], check["variable"], check["tool"] + sides = {} + for side in ("holds", "stops"): + arguments = request_of(card.get(side), tool, side) + also = check.get("also") or [] + where = differs(template, without_readout(arguments), {path} | set(also)) + if where: + raise Integrity("the %s request differs from the task's at %s" % (side, where)) + x = get_path(arguments, path) + if not number(x): + raise Integrity("the %s request has no number at %s" % (side, path)) + for place in also: + again = get_path(arguments, place) + if not (number(again) and float(again) == float(x)): + raise Integrity("the %s request does not hold the same value at %s as at %s" % (side, place, path)) + holds, words = replay.proof_holds(tool, arguments, card[side].get("proof")) + proofs.append(holds) + sides[side] = (float(x), arguments, holds, words) + for side in ("holds", "stops"): + if not sides[side][2]: + raise Integrity("the %s seal: %s" % (side, sides[side][3])) + held = replay.answer(tool, sides["holds"][1]) + stopped = replay.answer(tool, sides["stops"][1]) + row["holds_outcome"], row["stops_outcome"] = held["outcome"], "%s (%s)" % (stopped["outcome"], stopped["stop"]) + if held["outcome"] not in NOT_STOPPED: + raise Wrong("the holds request comes back %s (%s)" % (held["outcome"], held["stop"])) + if stopped["stop"] != check["stop"]: + raise Wrong("the stops request comes back %s (%s), not the stop %s" % (stopped["outcome"], stopped["stop"], check["stop"])) + if card["stops"].get("stopped") != check["stop"]: + raise Wrong("the card names the stop %r; the verifier names %s" % (card["stops"].get("stopped"), check["stop"])) + xh, xs = sides["holds"][0], sides["stops"][0] + star = reference["boundary"] + row["holds_value"], row["stops_value"] = xh, xs + tol = check["relative_width"] * abs(star) + ok, graded = grade_bracket(xh, xs, star, tol, 1e-9 * abs(star), row) + if not ok: + return graded, "the bracket is %.6g wide; the task asks for %.3g of the value or less, and it must hold the stop" % ( + abs(xs - xh), check["relative_width"]) + return 1.0, None + + +def forensics_f1(env, named): + """(graded, problem): F1 over (row, reason) pairs; problem when the card is not a usable answer.""" + if not isinstance(named, dict): + return 0.0, "false_rows is not an object of row and reason" + rows = [c["row"] for c in env["check"]["rows"]] + truth = env["reference"]["false_rows"] + unknown = [r for r in named if r not in set(rows)] + if unknown: + return 0.0, "no rows %s in the table" % ", ".join(sorted(unknown)) + reasons = env["check"].get("reasons") or REASONS + bad = [r for r, why in named.items() if why not in reasons] + if bad: + return 0.0, "the reason for %s is not one of %s" % (", ".join(sorted(bad)), ", ".join(reasons)) + if rows and set(named) == set(rows): + return 0.0, "every row of the table is named false: a blanket answer" + found = sum(1 for r, why in named.items() if truth.get(r) == why) + if not truth and not named: + return 1.0, None + precision = found / len(named) if named else 0.0 + recall = found / len(truth) if truth else 0.0 + f1 = 2 * precision * recall / (precision + recall) if precision + recall else 0.0 + if f1 >= 1.0: + return 1.0, None + missed = sorted(set(truth) - set(named)) + wrongly = sorted(set(named) - set(truth)) + wrong_reason = sorted(r for r in set(truth) & set(named) if truth[r] != named[r]) + said = [] + if missed: + said.append("%d false row(s) not named" % len(missed)) + if wrongly: + said.append("%d genuine row(s) named false" % len(wrongly)) + if wrong_reason: + said.append("%d false row(s) with another reason" % len(wrong_reason)) + return f1, "; ".join(said) + + +def score(env, reply, replay, calls=None, reply_calls=None, calls_from="reply", log_problem=None): + """One environment scored. calls: the authoritative record [(tool, arguments)] (None: no record); + reply_calls: the reply-side log, compared with calls under calls_from="harness".""" + row = {"id": env["id"], "family": env["family"], "kind": KINDS.get(env["family"]), "calls_from": calls_from, + "correct": 0, "proofs_hold": 0, "reward": 0, "graded": 0.0, "verdict": None, "reason": None} + card, problem = read_card(reply) + if problem: + row.update(verdict="no_card", reason=problem) + return row + proofs = [] + try: + problem = engine_problem(env, replay) + if problem: + raise Integrity(problem) + problem = call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row) + if problem: + raise Integrity(problem) + family = env["family"] + if family in ("tradeoff", "chain_design"): + graded, reason = score_boundary(env, card, replay, row, proofs) + elif family == "budget": + graded, reason = score_budget(env, card, replay, row, proofs) + elif family == "forensics": + named = card.get("false_rows") + if isinstance(named, dict): + row["named"] = named + graded, reason = forensics_f1(env, named) + proofs = [True] + if reason and graded == 0.0 and not isinstance(named, dict): + raise Wrong(reason) + else: + raise Wrong("unknown family %s" % family) + except Integrity as problem: + row.update(verdict="integrity", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs))) + return row + except Wrong as problem: + row.update(verdict="wrong", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs))) + return row + proofs_hold = int(bool(proofs) and all(proofs)) + correct = int(graded >= 1.0 and reason is None) + row.update(correct=correct, proofs_hold=proofs_hold, reward=int(correct == 1 and proofs_hold == 1), + graded=round(graded, 6) if proofs_hold else 0.0, + verdict="pass" if correct and proofs_hold else ("near" if graded > 0 else "wrong"), reason=reason) + return row + + +def records_for(folder, env_id, calls_from, harness_dir=None): + """(calls, reply_calls, log_problem) for one environment's reply in folder.""" + reply_calls = read_calls(os.path.join(folder, env_id + ".calls.jsonl")) + if calls_from == "harness": + calls, log_problem = read_harness_log(os.path.join(harness_dir or folder, env_id + ".harness.jsonl")) + return calls, reply_calls, log_problem + return reply_calls, None, None + + +def main(): + parser = argparse.ArgumentParser(description=__doc__.split("\n")[0]) + parser.add_argument("replies") + parser.add_argument("--engine", required=True) + parser.add_argument("--only") + parser.add_argument("--environments", required=True) + parser.add_argument("--out") + parser.add_argument("--calls-from", choices=("reply", "harness"), default="harness") + parser.add_argument("--harness-dir") + parser.add_argument("--quiet", action="store_true") + args = parser.parse_args() + environments = load_environments(args.environments) + if args.only: + wanted = set(args.only.split(",")) + environments = [e for e in environments if e["id"] in wanted] + missing = wanted - {e["id"] for e in environments} + if missing: + sys.exit("no environments %s in %s" % (", ".join(sorted(missing)), args.environments)) + for env in environments: + for problem in row_problems(env): + print("warning: %s: %s" % (env.get("id"), problem), file=sys.stderr) + verifier = open_verifier(args.engine) + replay = Replay(verifier) + rows = [] + try: + for env in environments: + path = os.path.join(args.replies, env["id"] + ".txt") + reply = open(path, encoding="utf-8", errors="replace").read() if os.path.isfile(path) else "" + calls, reply_calls, log_problem = records_for(args.replies, env["id"], args.calls_from, args.harness_dir) + row = score(env, reply, replay, calls, reply_calls, args.calls_from, log_problem) + rows.append(row) + if not args.quiet: + print("%-58s reward %d graded %.4f %-9s %s" % (env["id"], row["reward"], row["graded"], row["verdict"], + row["reason"] or ""), flush=True) + replay.seen.clear() + finally: + close_verifier(verifier) + if args.out: + with open(args.out, "w", encoding="utf-8") as f: + for row in rows: + f.write(json.dumps(row) + "\n") + total = len(rows) + print("\n%d environments: reward %d, graded %.4f (mean %.4f), correct %d, proofs_hold %d" % ( + total, sum(r["reward"] for r in rows), sum(r["graded"] for r in rows), + sum(r["graded"] for r in rows) / total if total else 0.0, + sum(r["correct"] for r in rows), sum(r["proofs_hold"] for r in rows))) + by = {} + for r in rows: + by.setdefault(r["family"], []).append(r) + for family in FAMILIES: + if family in by: + print(" %-13s reward %d of %d, mean graded %.4f" % (family, sum(r["reward"] for r in by[family]), len(by[family]), + sum(r["graded"] for r in by[family]) / len(by[family]))) + + +if __name__ == "__main__": + main() diff --git a/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/test.sh b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..4e4008f0a93d9c230856a9c0e0ecf5cd5cef1066 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Harbor runs this after the agent has finished, in a fresh copy of the image +# (task.toml: [verifier] environment_mode = "separate"). By then Harbor has +# copied tests/ to /tests and the declared artifacts, where they exist, to +# their own paths: /app/answer.json and /logs/agent/trajectory.json. +# grade.py writes /logs/verifier/reward.json. If the scorer itself fails it +# writes no reward and this script exits non-zero. +HERE="$(cd "$(dirname "$0")" && pwd)" +exec python3 -B "$HERE/grade.py" diff --git a/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/ztp_mcp.py b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/ztp_mcp.py new file mode 100644 index 0000000000000000000000000000000000000000..0cde73653317c847cd361ad0ca9d4f1f785bc3a7 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/ztp_mcp.py @@ -0,0 +1,188 @@ +"""A small Model Context Protocol client for the Zero-Trust Physics verifier. + +Standard library only. It speaks MCP two ways: + + stdio to a verifier built from the public source and started here as a program + (target/release/mcp_stdio): one JSON-RPC message a line, no network. + HTTP to an MCP address (JSON-RPC in a POST), such as + + https://mcp.zerotrustphysics.com/mcp Open to any agent. + +The open address gives each network address one place in the physics pool at a +time and answers "Too many concurrent physics tasks." or HTTP 429 when it is +busy; nothing waits on the server, so this client sends one request at a time +and, when it is told to come back, waits and sends the same request again. + +Licence: Apache-2.0. +""" +import json +import select +import shlex +import subprocess +import time +import urllib.error +import urllib.request + +OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp" +BUSY = "Too many concurrent physics tasks." + + +class McpError(RuntimeError): + pass + + +class Verifier: + """One MCP endpoint. call(tool, arguments) returns (text, is_error).""" + + def __init__(self, url=OPEN_ADDRESS, timeout_s=90, patience_s=600, pause_s=0.0, headers=None, quiet=True): + self.url = url + self.timeout_s = timeout_s + self.patience_s = patience_s # how long to keep asking politely before giving up on one request + self.pause_s = pause_s # a fixed pause after every request, for a shared address + self.headers = dict(headers or {}) + self.quiet = quiet + self.session = None + self.server = None + self.requests_sent = 0 + self.times_asked_to_wait = 0 + self._id = 0 + + # -- transport ------------------------------------------------------------------------- + def _post(self, message): + body = json.dumps(message).encode() + headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream", + "User-Agent": "zero-trust-physics-environments/1.0", **self.headers} + if self.session: + headers["Mcp-Session-Id"] = self.session + request = urllib.request.Request(self.url, data=body, headers=headers, method="POST") + self.requests_sent += 1 + with urllib.request.urlopen(request, timeout=self.timeout_s) as response: + session = response.headers.get("Mcp-Session-Id") + if session: + self.session = session + raw = response.read().decode("utf-8") + kind = response.headers.get("Content-Type", "") + if "text/event-stream" in kind: + for line in raw.splitlines(): + if line.startswith("data:"): + found = json.loads(line[5:].strip()) + if found.get("id") == message.get("id"): + return found + raise McpError("the event stream held no answer to the request") + return json.loads(raw) if raw.strip() else {} + + def _ask(self, method, params=None): + """Send one request; on 429, a busy pool, a 5xx or a dropped connection, wait and send it again.""" + self._id += 1 + message = {"jsonrpc": "2.0", "id": self._id, "method": method} + if params is not None: + message["params"] = params + started, wait = time.time(), 2.0 + while True: + reason = None + try: + answer = self._post(message) + if "error" in answer: + raise McpError("protocol error: %s" % json.dumps(answer["error"])[:300]) + result = answer.get("result", {}) + text = "".join(c.get("text", "") for c in result.get("content", []) or []) + if method == "tools/call" and BUSY in text and len(text) < 400: + reason = "the physics pool is busy" + else: + if self.pause_s: + time.sleep(self.pause_s) + return result + except urllib.error.HTTPError as problem: + if problem.code == 429 or problem.code >= 500: + after = problem.headers.get("Retry-After") + reason = "HTTP %d" % problem.code + if after and after.isdigit(): + wait = max(wait, float(after)) + else: + raise McpError("HTTP %d: %s" % (problem.code, problem.read().decode("utf-8", "replace")[:300])) + except (urllib.error.URLError, TimeoutError, ConnectionError, OSError) as problem: + reason = "no connection (%s)" % problem + self.times_asked_to_wait += 1 + if time.time() - started + wait > self.patience_s: + raise McpError("gave up after %d s: %s" % (self.patience_s, reason)) + if not self.quiet: + print(" %s; asking again in %.0f s" % (reason, wait), flush=True) + time.sleep(wait) + wait = min(wait * 1.6, 30.0) + + # -- protocol -------------------------------------------------------------------------- + def connect(self): + result = self._ask("initialize", {"protocolVersion": "2025-06-18", "capabilities": {}, + "clientInfo": {"name": "zero-trust-physics-environments", "version": "1.0"}}) + self.server = result.get("serverInfo") + try: + self._post({"jsonrpc": "2.0", "method": "notifications/initialized"}) + except Exception: # a notification has no answer; some servers close without one + pass + return result + + def tools(self): + """The tool declarations exactly as the endpoint gives them.""" + return self._ask("tools/list").get("tools", []) + + def call(self, tool, arguments=None): + """Call one tool. Returns (text, is_error): the text of the answer and the MCP isError flag.""" + result = self._ask("tools/call", {"name": tool, "arguments": arguments or {}}) + text = "".join(c.get("text", "") for c in result.get("content", []) or []) + return text, bool(result.get("isError")) + + def call_json(self, tool, arguments=None): + """Call one tool. Returns (body, is_error): the parsed JSON, or the text when it is not JSON.""" + text, is_error = self.call(tool, arguments) + try: + return json.loads(text), is_error + except ValueError: + return text, is_error + + +class StdioVerifier(Verifier): + """The same interface over MCP stdio: a program started here that speaks JSON-RPC, one message a line. + For anyone who holds an MCP server as a program; the open address needs none of this.""" + + def __init__(self, command, timeout_s=600, **kwargs): + super().__init__(url="stdio: " + (command if isinstance(command, str) else " ".join(command)), timeout_s=timeout_s, **kwargs) + self.proc = subprocess.Popen(shlex.split(command) if isinstance(command, str) else command, + stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) + + def _post(self, message): + self.requests_sent += 1 + try: + self.proc.stdin.write((json.dumps(message) + "\n").encode()) + self.proc.stdin.flush() + except OSError: # a program that has stopped reading will not start again + try: + self.proc.stdin.close() + except OSError: + pass + raise McpError("the program stopped reading") + if "id" not in message: + return {} + while True: + ready, _, _ = select.select([self.proc.stdout], [], [], self.timeout_s) + if not ready: + raise McpError("no answer in %d s" % self.timeout_s) + line = self.proc.stdout.readline() + if not line: + raise McpError("the program closed its output") + found = json.loads(line) + if found.get("id") == message["id"]: + return found + + def close(self): + self.proc.terminate() + try: + self.proc.wait(timeout=5) + except subprocess.TimeoutExpired: + self.proc.kill() + + +def connect(endpoint=OPEN_ADDRESS, **kwargs): + """A connected verifier: an http(s) address, or "stdio:" for a program.""" + verifier = StdioVerifier(endpoint[len("stdio:"):].strip(), **kwargs) if endpoint.startswith("stdio:") else Verifier(endpoint, **kwargs) + verifier.connect() + return verifier diff --git a/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/ztp_open_bridge.py b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/ztp_open_bridge.py new file mode 100644 index 0000000000000000000000000000000000000000..9e4330e54ed33d8cf1f9a1078d9f36e5f96c2996 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-budget-sd-airspeed-sink-e-t3/tests/ztp_open_bridge.py @@ -0,0 +1,109 @@ +"""The open address as a stdio MCP server: every JSON-RPC line read on stdin is posted, unchanged, to the verifier's +MCP address, and its answer written back on stdout, one line each. Standard library only. + + python3 ztp_open_bridge.py [URL] URL defaults to https://mcp.zerotrustphysics.com/mcp + +It is for a client that starts its MCP server as a program (an MCP config's command and args, a Harbor task's stdio +server, the harness's logging proxy in front of it) when the verifier it is to use is the served one. The bridge adds +nothing and drops nothing: a request goes out byte for byte as JSON, its answer comes back as the address gave it; a +notification (no id) is posted and answered by nothing. The session the address opens (Mcp-Session-Id) is kept for +every later message. On HTTP 429, a 5xx, a busy physics pool or a dropped connection it waits and posts the same +message again, as ztp_mcp.Verifier does, so a client sees one answer per request. + +Optional: ZTP_API_KEY in the environment sends "Authorization: Bearer " on every post, for a keyed door. With no +key set the bridge sends what it always sent. No key is ever written into a pack, a task or an image. + +Licence: Apache-2.0. +""" +import json +import os +import sys +import time +import urllib.error +import urllib.request + +OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp" +BUSY = "Too many concurrent physics tasks." +PATIENCE_S = float(os.environ.get("ZTP_BRIDGE_PATIENCE_S", "900")) +API_KEY = os.environ.get("ZTP_API_KEY") or None + + +class Bridge: + def __init__(self, url): + self.url = url + self.session = None + self.extra_headers = {} + + def post(self, message): + body = json.dumps(message).encode() + headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream", + "User-Agent": "zero-trust-physics-bridge/1.0"} + if self.session: + headers["Mcp-Session-Id"] = self.session + if API_KEY: + headers["Authorization"] = "Bearer " + API_KEY + headers.update(self.extra_headers) + request = urllib.request.Request(self.url, data=body, headers=headers, method="POST") + with urllib.request.urlopen(request, timeout=600) as response: + if response.headers.get("Mcp-Session-Id"): + self.session = response.headers["Mcp-Session-Id"] + raw = response.read().decode("utf-8") + kind = response.headers.get("Content-Type", "") + if "id" not in message: + return None + if "text/event-stream" in kind: + for line in raw.splitlines(): + if line.startswith("data:"): + found = json.loads(line[5:].strip()) + if found.get("id") == message.get("id"): + return found + return {"jsonrpc": "2.0", "id": message.get("id"), "error": {"code": -32603, "message": "the address's event stream held no answer"}} + return json.loads(raw) if raw.strip() else None + + def forward(self, message): + started, wait = time.time(), 2.0 + while True: + try: + answer = self.post(message) + text = "" + if isinstance(answer, dict) and isinstance(answer.get("result"), dict): + text = "".join(c.get("text", "") for c in answer["result"].get("content", []) or [] if isinstance(c, dict)) + if not (BUSY in text and len(text) < 400): + return answer + except urllib.error.HTTPError as problem: + if not (problem.code == 429 or problem.code >= 500): + if "id" not in message: + return None + return {"jsonrpc": "2.0", "id": message.get("id"), + "error": {"code": -32603, "message": "HTTP %d from the verifier's address" % problem.code}} + after = problem.headers.get("Retry-After") + if after and after.isdigit(): + wait = max(wait, float(after)) + except (urllib.error.URLError, TimeoutError, ConnectionError, OSError): + pass + if time.time() - started + wait > PATIENCE_S: + if "id" not in message: + return None + return {"jsonrpc": "2.0", "id": message.get("id"), + "error": {"code": -32603, "message": "the verifier's address did not answer in %d s" % PATIENCE_S}} + time.sleep(wait) + wait = min(wait * 1.6, 30.0) + + +def main(): + bridge = Bridge(sys.argv[1] if len(sys.argv) > 1 else OPEN_ADDRESS) + for line in sys.stdin: + if not line.strip(): + continue + try: + message = json.loads(line) + except ValueError: + continue + answer = bridge.forward(message) + if answer is not None: + sys.stdout.write(json.dumps(answer, separators=(",", ":")) + "\n") + sys.stdout.flush() + + +if __name__ == "__main__": + main() diff --git a/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/environment/Dockerfile b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..c807fbade805136032ff63002e2cc8d31376f95f --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/environment/Dockerfile @@ -0,0 +1,14 @@ +# Harbor environment image for Zero-Trust Physics release v0.15.3 (commit 664d68f4). +# Public 5-crate Rust engine reference source is at https://github.com/johnkruze/zero-trust-physics-engine (tag v0.15.2); +# read-only source audit of the pack verifier build is available under NDA (https://zerotrustphysics.com/offers/#licence). +# In this free evaluation sample, /usr/local/bin/mcp_stdio bridges JSON-RPC over stdio to the public MCP endpoint +# (ztp_open_bridge.py), and the scorer verifies release 0.15.3 version and kernel invariants on every reply. +# Paid Domain Packs ship compiled static Linux/macOS rollout binaries for --network none execution. +FROM python:3.12-slim-bookworm +ARG ZTP_ENGINE_TAG=v0.15.3 +ARG ZTP_ENGINE_COMMIT=664d68f426ccdfd0159e5f91857edba3872390d1 +ARG ZTP_VERIFIER_URL=https://mcp.zerotrustphysics.com/mcp +COPY ztp_open_bridge.py /usr/local/lib/ztp/ztp_open_bridge.py +RUN printf '#!/bin/sh\nexec python3 /usr/local/lib/ztp/ztp_open_bridge.py "%s"\n' "$ZTP_VERIFIER_URL" > /usr/local/bin/mcp_stdio \ + && chmod +x /usr/local/bin/mcp_stdio +WORKDIR /app diff --git a/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/environment/ztp_open_bridge.py b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/environment/ztp_open_bridge.py new file mode 100644 index 0000000000000000000000000000000000000000..9e4330e54ed33d8cf1f9a1078d9f36e5f96c2996 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/environment/ztp_open_bridge.py @@ -0,0 +1,109 @@ +"""The open address as a stdio MCP server: every JSON-RPC line read on stdin is posted, unchanged, to the verifier's +MCP address, and its answer written back on stdout, one line each. Standard library only. + + python3 ztp_open_bridge.py [URL] URL defaults to https://mcp.zerotrustphysics.com/mcp + +It is for a client that starts its MCP server as a program (an MCP config's command and args, a Harbor task's stdio +server, the harness's logging proxy in front of it) when the verifier it is to use is the served one. The bridge adds +nothing and drops nothing: a request goes out byte for byte as JSON, its answer comes back as the address gave it; a +notification (no id) is posted and answered by nothing. The session the address opens (Mcp-Session-Id) is kept for +every later message. On HTTP 429, a 5xx, a busy physics pool or a dropped connection it waits and posts the same +message again, as ztp_mcp.Verifier does, so a client sees one answer per request. + +Optional: ZTP_API_KEY in the environment sends "Authorization: Bearer " on every post, for a keyed door. With no +key set the bridge sends what it always sent. No key is ever written into a pack, a task or an image. + +Licence: Apache-2.0. +""" +import json +import os +import sys +import time +import urllib.error +import urllib.request + +OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp" +BUSY = "Too many concurrent physics tasks." +PATIENCE_S = float(os.environ.get("ZTP_BRIDGE_PATIENCE_S", "900")) +API_KEY = os.environ.get("ZTP_API_KEY") or None + + +class Bridge: + def __init__(self, url): + self.url = url + self.session = None + self.extra_headers = {} + + def post(self, message): + body = json.dumps(message).encode() + headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream", + "User-Agent": "zero-trust-physics-bridge/1.0"} + if self.session: + headers["Mcp-Session-Id"] = self.session + if API_KEY: + headers["Authorization"] = "Bearer " + API_KEY + headers.update(self.extra_headers) + request = urllib.request.Request(self.url, data=body, headers=headers, method="POST") + with urllib.request.urlopen(request, timeout=600) as response: + if response.headers.get("Mcp-Session-Id"): + self.session = response.headers["Mcp-Session-Id"] + raw = response.read().decode("utf-8") + kind = response.headers.get("Content-Type", "") + if "id" not in message: + return None + if "text/event-stream" in kind: + for line in raw.splitlines(): + if line.startswith("data:"): + found = json.loads(line[5:].strip()) + if found.get("id") == message.get("id"): + return found + return {"jsonrpc": "2.0", "id": message.get("id"), "error": {"code": -32603, "message": "the address's event stream held no answer"}} + return json.loads(raw) if raw.strip() else None + + def forward(self, message): + started, wait = time.time(), 2.0 + while True: + try: + answer = self.post(message) + text = "" + if isinstance(answer, dict) and isinstance(answer.get("result"), dict): + text = "".join(c.get("text", "") for c in answer["result"].get("content", []) or [] if isinstance(c, dict)) + if not (BUSY in text and len(text) < 400): + return answer + except urllib.error.HTTPError as problem: + if not (problem.code == 429 or problem.code >= 500): + if "id" not in message: + return None + return {"jsonrpc": "2.0", "id": message.get("id"), + "error": {"code": -32603, "message": "HTTP %d from the verifier's address" % problem.code}} + after = problem.headers.get("Retry-After") + if after and after.isdigit(): + wait = max(wait, float(after)) + except (urllib.error.URLError, TimeoutError, ConnectionError, OSError): + pass + if time.time() - started + wait > PATIENCE_S: + if "id" not in message: + return None + return {"jsonrpc": "2.0", "id": message.get("id"), + "error": {"code": -32603, "message": "the verifier's address did not answer in %d s" % PATIENCE_S}} + time.sleep(wait) + wait = min(wait * 1.6, 30.0) + + +def main(): + bridge = Bridge(sys.argv[1] if len(sys.argv) > 1 else OPEN_ADDRESS) + for line in sys.stdin: + if not line.strip(): + continue + try: + message = json.loads(line) + except ValueError: + continue + answer = bridge.forward(message) + if answer is not None: + sys.stdout.write(json.dumps(answer, separators=(",", ":")) + "\n") + sys.stdout.flush() + + +if __name__ == "__main__": + main() diff --git a/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/instruction.md b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..f46243aa48c2efe508f2f7080f287106729ad457 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/instruction.md @@ -0,0 +1,26 @@ +The Stardust sample return capsule enters the Earth's air with a radial speed of -2175.4 m/s (negative, downward) and a transverse speed of 12641.2 m/s, at a distance from the Earth's centre that you choose. Its heat shield's near-nose core is a slab of PICA, open record, version 3, 0.0434 m (43.4 mm) thick, starting at 281 K, heated by the capsule's own entry as the verifier hands it from the capsule's sealed run to the slab through their coupling, stardust_entry_to_pica_slab, radiating to surroundings at 294.4 K, and cooling with the stream off until 545 s. + +Find the largest starting distance from the Earth's centre, from 6482000 to 6494000 m, for which every constraint below holds. Give the passing design and the first failing design, no more than 12 m apart, and name the constraint that binds. The design that holds need not lie at either end of the range. + +Constraints (id (the request it is read from): what, limit): +- half_char (solve): the depth at which the slab's density is half-way from char to virgin, in metres, at or below 0.0089922 m (8.9922 mm) +- peak_load (run): the peak load on the capsule, in Earth g, over the whole entry, at or below 52.33 g +Each design is two requests. The run of the capsule must end at the drogue-deployment condition (outcome ended, PastFlightDeployment). The run: +{"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": "", "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": "", "load": {}}], "record_every": 720}} +Then the slab, a solve handed that run through the coupling, with these parameters: +{"tool": "solve", "arguments": {"solver": "ablator_slab", "parameters": {"material": "PICA, open record, version 3", "thickness_m": 0.0434, "start_temperature_k": 281.0, "face": "gas_stream", "stream_gas": "air", "surroundings_temperature_k": 294.4, "face_wears": true}, "from": {"request": "", "run_seal": "", "coupling": "stardust_entry_to_pica_slab"}}} +and its heating history laid out as the coupling's worked chain lays it: row 0 at 0 s with the first frame's pressure and enthalpy and a heat-transfer coefficient of 0; then one row per recorded frame, handed bit for bit (time, stagnation pressure, heat-transfer coefficient, recovery enthalpy); then a row 1 s after the last frame and a row at 545 s, each with the last frame's pressure and enthalpy and a heat-transfer coefficient of 0; a radiative heating of 0 in every row. thermocouple_depths_m and the return_ flags are yours to set. The run's record_every of 720 is the frames the coupling hands: keep it. +The run reports the largest and smallest of a quantity over all its steps when it is sent with "readout": {"quantities": ["load_g"]}; a readout is not part of the request or its seal, so the same run with or without one has one seal. + +Budget: at most 10 calls that compute, counted over every call you make, each run and each solve one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls. + +You have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card. + +End your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {"tool": "", "arguments": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request. + +The card: +{"passing": {"run": {"request": ..., "proof": ...}, "solve": {"request": ..., "proof": ...}}, "failing": {"run": {"request": ..., "proof": ...}, "solve": {"request": ..., "proof": ...}}, "binding": ""} + +passing: the design that keeps the constraint, nearest the boundary you were asked for. failing: the design just past it, which breaks the constraint, no further from passing than the task's tolerance. binding: the id of the constraint. Each solve is the one handed its own design's sealed run through the coupling the task names. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all. + +Also write that answer card, by itself, to the file `/app/answer.json`. diff --git a/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/solution/chainlib.py b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/solution/chainlib.py new file mode 100644 index 0000000000000000000000000000000000000000..3c8dc60513d8f8f0372b1ff80d49884754a1d0e5 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/solution/chainlib.py @@ -0,0 +1,63 @@ +"""Build the solve request of a chained design from a run's answer: the history its coupling hands over. + +A coupling hands values from the run's recorded frames into the solve bit for bit: each frame's +32-bit slot widened exactly to 64 bits. The frame layout is in describe_card (frame_slots). This +module reads the slots from frame_hex with the standard library and lays the history out the way a +task states it. + + chained_solve(layout, parameters, run_request, run_answer) -> the solve's arguments, with from + +layout is the task's check.design.chain.layout: {"kind": "stardust_slab", "cool_to_s": 600.0} or +{"kind": "triga_element"}. + +Licence: Apache-2.0. +""" +import copy +import struct + + +def _slots(run_answer, f64_at, f32_at): + """Per recorded frame: the f64 at f64_at and each f32 at f32_at, widened.""" + out = [[] for _ in range(1 + len(f32_at))] + for frame in run_answer["frames"]: + raw = bytes.fromhex(frame["frame_hex"]) + out[0].append(struct.unpack("\", \"radial_speed_m_s\": -2175.4, \"transverse_speed_m_s\": 12641.2}, \"dt_s\": 0.03125, \"segments\": [{\"steps\": \"\", \"load\": {}}], \"record_every\": 720}}\nThen the slab, a solve handed that run through the coupling, with these parameters:\n{\"tool\": \"solve\", \"arguments\": {\"solver\": \"ablator_slab\", \"parameters\": {\"material\": \"PICA, open record, version 3\", \"thickness_m\": 0.0434, \"start_temperature_k\": 281.0, \"face\": \"gas_stream\", \"stream_gas\": \"air\", \"surroundings_temperature_k\": 294.4, \"face_wears\": true}, \"from\": {\"request\": \"\", \"run_seal\": \"\", \"coupling\": \"stardust_entry_to_pica_slab\"}}}\nand its heating history laid out as the coupling's worked chain lays it: row 0 at 0 s with the first frame's pressure and enthalpy and a heat-transfer coefficient of 0; then one row per recorded frame, handed bit for bit (time, stagnation pressure, heat-transfer coefficient, recovery enthalpy); then a row 1 s after the last frame and a row at 545 s, each with the last frame's pressure and enthalpy and a heat-transfer coefficient of 0; a radiative heating of 0 in every row. thermocouple_depths_m and the return_ flags are yours to set. The run's record_every of 720 is the frames the coupling hands: keep it.\nThe run reports the largest and smallest of a quantity over all its steps when it is sent with \"readout\": {\"quantities\": [\"load_g\"]}; a readout is not part of the request or its seal, so the same run with or without one has one seal.\n\nBudget: at most 10 calls that compute, counted over every call you make, each run and each solve one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.", "check": {"design": {"variable": {"kind": "path", "on": "run", "path": "initial.radius_m", "words": "the capsule's distance from the Earth's centre at the start, in metres"}, "template": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": null, "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": 8000, "load": {}}], "record_every": 720}, "free": ["segments[0].steps"], "most_steps": 8000, "run_outcomes": ["ended"], "direction": "largest", "tolerance": 12.0, "units": "m", "range": [6482000.0, 6494000.0], "chain": {"solver": "ablator_slab", "coupling": "stardust_entry_to_pica_slab", "parameters": {"material": "PICA, open record, version 3", "thickness_m": 0.0434, "start_temperature_k": 281.0, "face": "gas_stream", "stream_gas": "air", "surroundings_temperature_k": 294.4, "face_wears": true, "thermocouple_depths_m": [], "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false}, "handed": ["history_time_s", "history_pressure_pa", "history_heat_transfer_coefficient_kg_per_m2_s", "history_flow_enthalpy_j_per_kg", "history_radiative_heating_w_per_m2", "thermocouple_depths_m", "return_face_history", "return_thermocouple_histories", "return_final_profile"], "layout": {"kind": "stardust_slab", "cool_to_s": 545.0}}}, "constraints": [{"id": "half_char", "on": "solve", "read": {"kind": "result", "quantity": "depth_half_way_to_virgin_m"}, "op": "<=", "words": "the depth at which the slab's density is half-way from char to virgin, in metres", "unit": "m", "limit": 0.0089922}, {"id": "peak_load", "on": "run", "read": {"kind": "extreme", "quantity": "load_g", "which": "maximum"}, "op": "<=", "words": "the peak load on the capsule, in Earth g, over the whole entry", "unit": "g", "limit": 52.33}], "budget": 10, "forbidden": ["find_flip", "design_run", "run_dataset", "validate_series"]}, "seed": {"kind": "g2_round7_0.15.3", "seed": 20261102055, "from": "g2-chain-sd-slab-radius-halfchar-h-r5", "note": "Rebuilt from g2-chain-sd-slab-radius-halfchar-h-r5 (0/3 on the calibrating model in round 5 at budget 8) with +1 reading (+2 computing calls -> budget 10); tolerance, template, constraints and engine v0.15.3 reference unchanged."}, "reference": {"boundary": 6488833.180236816, "binding": "half_char", "window_pattern": "..............HHHHHHHHH..................", "band": [6486200.0, 6488600.0], "near_pattern": "HHHHHHHHHHH..........", "passing": {"x": 6488829.580236817, "values": {"half_char": 0.008992161781351305, "peak_load": 49.5781877582101}, "run": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488829.580236817, "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": 8000, "load": {}}], "record_every": 720}, "run_seal": "1fa78aec5d3e09d24456d17b17ae3d5cbe4ad1d98f7f613fe5e80c1b855d017e435fb45dc30ed730eef198f5590ec173", "solve": {"solver": "ablator_slab", "parameters": {"material": "PICA, open record, version 3", "thickness_m": 0.0434, "start_temperature_k": 281.0, "face": "gas_stream", "stream_gas": "air", "surroundings_temperature_k": 294.4, "face_wears": true, "thermocouple_depths_m": [], "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false, "history_time_s": [0.0, 22.5, 45.0, 67.5, 90.0, 93.6875, 94.6875, 545.0], "history_pressure_pa": [5909.919921875, 5909.919921875, 42409.2421875, 6625.830078125, 2544.8134765625, 2450.75341796875, 2450.75341796875, 2450.75341796875], "history_heat_transfer_coefficient_kg_per_m2_s": [0.0, 0.058212701231241226, 0.1558331996202469, 0.06065985932946205, 0.03434406593441963, 0.03284108266234398, 0.0, 0.0], "history_flow_enthalpy_j_per_kg": [75923648.0, 75923648.0, 12139213.0, 541897.6875, 80255.8046875, 64982.50390625, 64982.50390625, 64982.50390625], "history_radiative_heating_w_per_m2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}, "from": {"request": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488829.580236817, "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": 8000, "load": {}}], "record_every": 720}, "run_seal": "1fa78aec5d3e09d24456d17b17ae3d5cbe4ad1d98f7f613fe5e80c1b855d017e435fb45dc30ed730eef198f5590ec173", "coupling": "stardust_entry_to_pica_slab"}}, "solution_seal": "8944591b390b2d9995dcb1a1be61b04f621892856ef97dcd58537f920d66d2e9ee56d3d8adb8c2adae41ed224478f86c", "next": null, "next_seal": null}, "failing": {"x": 6488836.780236816, "values": {"half_char": 0.00899223837130888, "peak_load": 49.57632648317198}, "run": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488836.780236816, "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": 8000, "load": {}}], "record_every": 720}, "run_seal": "abce34b40ba1868cb29f0015f8de509f678546c4dfaad17ae251df0486469b4bdac80244df56c2071b13c31c4db6d6db", "solve": {"solver": "ablator_slab", "parameters": {"material": "PICA, open record, version 3", "thickness_m": 0.0434, "start_temperature_k": 281.0, "face": "gas_stream", "stream_gas": "air", "surroundings_temperature_k": 294.4, "face_wears": true, "thermocouple_depths_m": [], "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false, "history_time_s": [0.0, 22.5, 45.0, 67.5, 90.0, 93.6875, 94.6875, 545.0], "history_pressure_pa": [5903.89697265625, 5903.89697265625, 42420.40234375, 6628.06396484375, 2545.021240234375, 2450.830078125, 2450.830078125, 2450.830078125], "history_heat_transfer_coefficient_kg_per_m2_s": [0.0, 0.05818302929401398, 0.15585379302501678, 0.0606706440448761, 0.03434683755040169, 0.032843057066202164, 0.0, 0.0], "history_flow_enthalpy_j_per_kg": [75926248.0, 75926248.0, 12148022.0, 542217.125, 80285.0625, 65003.5703125, 65003.5703125, 65003.5703125], "history_radiative_heating_w_per_m2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}, "from": {"request": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488836.780236816, "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": 8000, "load": {}}], "record_every": 720}, "run_seal": "abce34b40ba1868cb29f0015f8de509f678546c4dfaad17ae251df0486469b4bdac80244df56c2071b13c31c4db6d6db", "coupling": "stardust_entry_to_pica_slab"}}, "solution_seal": "705c1b2d8ec16c133318905bc8e1d23ea9ab535153210729aec9c9942e18eaa2b52ace04dc2874d53b055d722fbcad6d", "next": null, "next_seal": null, "outcome": "ended", "stopped": null, "steps_landed": 2998}, "engine_source": "https://github.com/johnkruze/zero-trust-physics-engine", "engine_tag": "v0.15.3", "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1", "gateway_version": "0.15.3", "engine_binary_sha256": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076"}} diff --git a/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/solution/run_reference.py b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/solution/run_reference.py new file mode 100644 index 0000000000000000000000000000000000000000..0dc7d591e31fb27d4a9ccc2c2a50f5436eb503b2 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/solution/run_reference.py @@ -0,0 +1,208 @@ +"""An agent with no model in it: answer every environment from its reference, through the harness proxy. + + python3 run_reference.py --engine ENGINE --environments F --out DIR [--only id,id] [--direct] + +For a tradeoff or chain_design environment it sends the reference passing and failing runs to the +verifier, hands each run to its solve through the task's coupling where the task has one, and writes +the card with the seals this verifier gives. For a budget environment it sends the two reference +requests. For a forensics table it puts the table to the verifier (each row's request as sent, up to +the task's budget) and names the false rows the build recorded. + +Every call goes through harness/mcp_log_proxy.py, started in an empty working folder, so the +authoritative call record is DIR/.harness.jsonl, as in a pass@k attempt. The same calls are also +written beside the reply, DIR/.calls.jsonl. --direct talks to ENGINE with no proxy and writes the +reply-side log only. + + python3 score.py DIR --engine ENGINE --environments F --calls-from harness + +Licence: Apache-2.0. +""" +import argparse +import copy +import json +import os +import subprocess +import sys +import tempfile + +HERE = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, HERE) +import chainlib # noqa: E402 +from score import (FREE_TOOLS, NOT_STOPPED, build_stage_request, close_verifier, continuation_of, design_shape, # noqa: E402 + file_sha256, get_path, load_environments, open_verifier) +from ztp_mcp import McpError, StdioVerifier # noqa: E402 + +PROXY = os.path.join(HERE, "..", "harness", "mcp_log_proxy.py") + + +class ProxiedVerifier(StdioVerifier): + """The engine behind the logging proxy, the proxy started in its own empty working folder.""" + + def __init__(self, engine, log, cwd=None, **kwargs): + self.cwd = cwd or tempfile.mkdtemp(prefix="ztp_ref_cwd_") + if engine.startswith("http://") or engine.startswith("https://"): + # an MCP address: the proxy runs the stdio bridge to it (ztp_open_bridge.py, beside this file) + child = [sys.executable, os.path.join(HERE, "ztp_open_bridge.py"), engine] + else: + child = [os.path.abspath(engine)] + command = [sys.executable, os.path.abspath(PROXY), "--log", os.path.abspath(log), "--"] + child + super(StdioVerifier, self).__init__(url="stdio: " + " ".join(command), timeout_s=600, **kwargs) + self.proc = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, cwd=self.cwd) + self.binary_sha256 = None if len(child) > 1 else file_sha256(engine) + + def close(self): + try: + self.proc.stdin.close() + except OSError: + pass + try: + self.proc.wait(timeout=60) + except subprocess.TimeoutExpired: + self.proc.kill() + + +def proxied(engine, log, cwd=None): + if os.path.exists(log): + os.remove(log) + verifier = ProxiedVerifier(engine, log, cwd) + try: + verifier.connect() + except McpError as problem: + sys.exit("the proxied verifier failed: %s" % problem) + return verifier + + +class Logged: + def __init__(self, verifier): + self.verifier, self.calls, self.seen = verifier, [], {} + + def call(self, tool, arguments, refused_ok=False): + # the same request twice is one call: a chain with its value in the next run has one first run for both designs + key = json.dumps([tool, arguments], sort_keys=True) + if key in self.seen and not self.seen[key][1]: + return self.seen[key][0] + self.calls.append({"tool": tool, "arguments": arguments}) + body, is_error = self.verifier.call_json(tool, arguments) + self.seen[key] = (body, is_error) + if is_error and not refused_ok: + raise SystemExit("the reference request was refused: %s %s" % (tool, str(body)[:300])) + return body + + +def design_staged(env, ref, agent): + """A staged design: each stage sent in order, handed values and continuations built from this verifier's answers.""" + spec = env["check"]["design"] + answers, requests, out = {}, {}, {} + for stage in spec["stages"]: + q = build_stage_request(spec, stage, ref["x"], answers, requests) + body = agent.call(stage["tool"], q, refused_ok=True) + stopped = body.get("outcome") not in NOT_STOPPED + answers[stage["key"]] = {"body": body, "proof": body.get("run_seal") or body.get("solution_seal"), + "outcome": body.get("outcome"), "stop": body.get("reject") if stopped else None, "stopped": stopped} + requests[stage["key"]] = q + out[stage["key"]] = {"request": {"tool": stage["tool"], "arguments": q}, "proof": answers[stage["key"]]["proof"]} + return out + + +def design(env, ref, agent): + spec = env["check"]["design"] + shape = design_shape(spec) + if shape == "staged": + return design_staged(env, ref, agent) + if shape == "solve": + solved = agent.call("solve", ref["solve"], refused_ok=True) + return {"solve": {"request": {"tool": "solve", "arguments": ref["solve"]}, "proof": solved["solution_seal"]}} + run_args = ref["run"] + run = agent.call("run_trajectory", run_args) + out = {"run": {"request": {"tool": "run_trajectory", "arguments": run_args}, "proof": run["run_seal"]}} + if shape == "continued": + # the run that continues this design's own sealed run: the reference's next run, its start fields and from + # set from this verifier's answer to the first run + _, carried, _, _ = continuation_of(spec) + next_args = copy.deepcopy(ref["next"]) + next_args["initial"] = {name: get_path(run, source) for name, source in carried.items()} + next_args["from"] = {"request": run_args, "run_seal": run["run_seal"]} + nxt = agent.call("run_trajectory", next_args, refused_ok=True) + out["next"] = {"request": {"tool": "run_trajectory", "arguments": next_args}, "proof": nxt["run_seal"]} + elif spec.get("chain"): + overrides = {} + if spec["variable"]["kind"] == "path" and spec["variable"].get("on") == "solve": + overrides[spec["variable"]["path"].split(".", 1)[1]] = ref["x"] + solve_args = chainlib.chained_solve(spec["chain"], run_args, run, overrides) + solved = agent.call("solve", solve_args) + out["solve"] = {"request": {"tool": "solve", "arguments": solve_args}, "proof": solved["solution_seal"]} + return out + + +def reference_reply(env, verifier): + """(reply text, calls [{"tool", "arguments"}]).""" + agent = Logged(verifier) + family, ref = env["family"], env["reference"] + if family in ("tradeoff", "chain_design"): + card = {"passing": design(env, ref["passing"], agent), "failing": design(env, ref["failing"], agent), "binding": ref["binding"]} + if ref["failing"].get("stopped"): + card["failing"]["stopped"] = ref["failing"]["stopped"] + if ref["failing"].get("steps_landed") is not None: + card["failing"]["step"] = ref["failing"]["steps_landed"] + words = "The boundary lies between the two designs below; %s binds." % ref["binding"] + elif family == "budget": + card = {} + for side in ("holds", "stops"): + request = ref[side]["request"] + answer = agent.call(request["tool"], request["arguments"]) + card[side] = {"request": request, "proof": answer.get("run_seal") or answer.get("solution_seal")} + card["stops"]["stopped"] = env["check"]["stop"] + words = "The stop %s lies between the two requests below." % env["check"]["stop"] + else: + agent.call("list_cards", {}, refused_ok=True) + rows = env["check"]["rows"] + budget = env["check"].get("budget") or len(rows) + computing = 0 + for row in rows: + request = row["request"] + if computing >= budget: + break + if request["tool"] in FREE_TOOLS: + continue + agent.call(request["tool"], request["arguments"], refused_ok=True) + computing += 1 + card = {"false_rows": ref["false_rows"]} + words = "%d of the %d rows are false." % (len(ref["false_rows"]), len(rows)) + return words + "\n\n" + json.dumps(card), agent.calls + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--engine", required=True) + parser.add_argument("--environments", required=True) + parser.add_argument("--out", required=True) + parser.add_argument("--only") + parser.add_argument("--direct", action="store_true", help="no proxy: the reply-side log only") + args = parser.parse_args() + environments = load_environments(args.environments) + if args.only: + wanted = set(args.only.split(",")) + environments = [e for e in environments if e["id"] in wanted] + os.makedirs(args.out, exist_ok=True) + shared = open_verifier(args.engine) if args.direct else None + try: + for env in environments: + verifier = shared or proxied(args.engine, os.path.join(args.out, env["id"] + ".harness.jsonl")) + try: + reply, calls = reference_reply(env, verifier) + finally: + if not shared: + close_verifier(verifier) + with open(os.path.join(args.out, env["id"] + ".txt"), "w", encoding="utf-8") as f: + f.write(reply + "\n") + with open(os.path.join(args.out, env["id"] + ".calls.jsonl"), "w", encoding="utf-8") as f: + for c in calls: + f.write(json.dumps(c) + "\n") + print("%-60s %d calls" % (env["id"], len(calls)), flush=True) + finally: + if shared: + close_verifier(shared) + + +if __name__ == "__main__": + main() diff --git a/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/solution/score.py b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/solution/score.py new file mode 100644 index 0000000000000000000000000000000000000000..4403f043313037d26927b89db218b4718ffcf3d2 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/solution/score.py @@ -0,0 +1,1199 @@ +"""Score replies to the multi-step environments with no judge: a program and the verifier. + + python3 score.py REPLIES --engine ENGINE [--environments F] [--only id,id] [--out F] + [--calls-from reply|harness] [--harness-dir DIR] + + REPLIES is a folder with one file per environment, .txt, the whole text of a reply. + --calls-from harness the call record is the harness's own: .harness.jsonl, written by + harness/mcp_log_proxy.py outside the solver's working directory (in + --harness-dir, default REPLIES). A .calls.jsonl beside the reply, + when there is one, is read only to catch an edit: it must equal the + harness log call for call. + --calls-from reply (the earlier set's way) the call record is .calls.jsonl beside the reply: + one JSON object a line, {"tool": "", "arguments": {...}}. + + ENGINE is the verifier: the path to mcp_stdio (MCP over stdio, no network), or an MCP address + beginning http. A task is scored only on the engine it was built on: the verifier's version must + be the task's reference.gateway_version (engine_tag), and a local binary's SHA-256 the task's + reference.engine_binary_sha256. + +The answer card is one JSON object on the reply's last line. Its shape is the family's: + + tradeoff, chain_design (kind design_to_limit, chained_design) + {"passing": DESIGN, "failing": DESIGN, "binding": ""} + DESIGN = {"run": {"request": R, "proof": ""}, + "solve": {"request": R, "proof": ""}} (solve only where the task has one) + Where a constraint is that the run completes and it binds, the failing DESIGN also carries + "stopped": "" and "step": . R = {"tool": ..., "arguments": {...}} + The design shapes, one scorer for every group (check.design says which): + run a run alone. + coupled check.design.chain names a solver and coupling: the run, then a solve handed that sealed run. + continued check.design.chain.kind "continuation", or chain.layout.kind "continue": the run, then a run of + the same card that continues it through from, starting from its sealed final state, + DESIGN = {"run": {...}, "next": {"request": R, "proof": ""}}. The next run's template + is chain.next_template, chain.template or chain.next; its start fields are chain.carried + ({field: where the first run's answer holds it}), chain.handed (with chain.handed_from) or + chain.carry and chain.clock, each equal to the first run's answer bit for bit. A constraint on + "next" reads the next run, and a stop constraint judges it. + solve check.design.tool or check.design.kind "solve": DESIGN = {"solve": {...}}, one solve and no + run. A binding refusal is named ("stopped") with no step. + staged check.design.stages: DESIGN = {"": {"request": R, "proof": ...}, ...}, one entry per + stage in order; a later stage carries an earlier stage's answer at a named input (handed) or + continues an earlier run (continues), bit for bit. + A constraint's read may carry "index": one entry of an output the verifier returns as a list. + budget (kind budgeted_search) + {"holds": {"request": R, "proof": ""}, + "stops": {"request": R, "proof": "", "stopped": ""}} + forensics + {"false_rows": {"": "", ...}} ({} when every row is genuine) + +Every proof is verified on the verifier (verify_tape for a run_seal, verify_solution for a +solution_seal, short form) and every number judged is read from the verifier's own answer to the +card's request, sent again here, never from the reply. + +Scores per environment +---------------------- +reward 0 or 1, exactly as the earlier scorer: 1 only when correct and proofs_hold are both 1. + proofs_hold: every proof on the card verifies. correct: the card is the right answer and + nothing below under "integrity" failed. +graded in [0, 1], beside reward. + + Integrity (graded 0 and reward 0, whatever the answer): the card cannot be read; a proof does not + verify (a copied, nudged, edited or stale proof); a request differs from the task's template other + than at the design variable; a chained solve not handed its own design's sealed run; no call log; + a call log beside the reply that differs from the harness log; a harness log whose chain breaks; + a forbidden tool called; more computing calls than the budget; a request on the card that is not + among the calls; a forensics answer with no computing call behind it; a task built on another + engine than the verifier. + + tradeoff, chain_design, budget. With integrity held, the sides are judged on the verifier: the + passing design meets every constraint and the failing one breaks the named binding constraint + (budget: holds completes, stops ends with the task's stop, named on the card), on the side the + task asks for, inside its range, with any stop and step the card must name. Wrong sides score 0. + With the sides right: + + e = the length of the smallest interval holding both designs' values and the reference + boundary (for a bracket that straddles the boundary, its width) + tol = the task's tolerance (tradeoff, chain_design) or relative width x |boundary| (budget) + r = e / tol + graded = 1 when reward is 1 (r <= 1 and the bracket straddles it) + = 0.5 ** log10(r) when r > 1: each tenfold of looseness halves the score + (r 1.35 -> 0.914, 2 -> 0.811, 10 -> 0.5, 100 -> 0.25) + = 0.5 when r <= 1 but the bracket misses the reference boundary + by more than the slack (another crossing than the one asked) + + The decay is smooth and falls monotonically with r, and a near miss scores near the top. + + forensics. With integrity held, graded is F1 over the (row, reason) pairs: a row counts as found + only with its right reason. precision = found / named, recall = found / false rows; an empty + answer to a table with no false row scores 1. A card that names every row of the table false is + a blanket answer and scores 0, as do unknown rows and reasons outside the task's list. + +Licence: Apache-2.0. +""" +import argparse +import copy +import hashlib +import json +import math +import os +import re +import sys + +HERE = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, HERE) +from ztp_mcp import McpError, StdioVerifier, Verifier # noqa: E402 + +FAMILIES = ("tradeoff", "chain_design", "budget", "forensics") +KINDS = {"tradeoff": "design_to_limit", "chain_design": "chained_design", "budget": "budgeted_search", "forensics": "forensics"} +NOT_STOPPED = ("completed", "converged") +PREFIX_ENDS = ("__", ".", ":", "/") +VERIFIER_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite", + "run_trajectory", "compute_step", "verify_step", "design_run", "solve", "run_dataset", + "validate_series", "verify_tape", "verify_solution", "verify_dataset", "verify_receipt", "find_flip") +# Calls that read the catalogue compute nothing and are free in a call budget. +FREE_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite", "verify_receipt") +REASONS = ("value_altered", "seal_wrong", "flag_omitted", "retired_model", "stop_hidden") +GRADED_DECAY = 0.5 # graded = GRADED_DECAY ** log10(r) +OTHER_CROSSING = 0.5 # right sides, tight, around another crossing than the reference boundary + + +class Integrity(Exception): + """The answer cannot be trusted: graded 0 and reward 0.""" + + +class Wrong(Exception): + """The answer is trusted and wrong: graded 0 and reward 0.""" + + +def load_environments(path): + with open(path, encoding="utf-8") as f: + return [json.loads(line) for line in f if line.strip()] + + +def row_problems(env): + """What a task row lacks against the shared row contract (empty when none).""" + out = [] + for key in ("id", "family", "models", "real_thing", "task", "check", "seed", "reference"): + if key not in env: + out.append("no %s" % key) + family = env.get("family") + if family not in FAMILIES: + out.append("family %r" % family) + elif "kind" in env and env["kind"] != KINDS[family]: + out.append("kind %r for family %s (want %s)" % (env["kind"], family, KINDS[family])) + ref = env.get("reference") or {} + for key in ("engine_tag", "engine_commit", "engine_binary_sha256"): + if not ref.get(key): + out.append("reference.%s missing" % key) + return out + + +def file_sha256(path): + h = hashlib.sha256() + with open(path, "rb") as f: + for block in iter(lambda: f.read(1 << 20), b""): + h.update(block) + return h.hexdigest() + + +def open_verifier(engine): + if engine.startswith("http://") or engine.startswith("https://"): + verifier = Verifier(engine, pause_s=0.5) + verifier.binary_sha256 = None + else: + if not os.path.isfile(engine): + sys.exit("no file at %s: give the path to mcp_stdio, or an MCP address beginning http" % engine) + verifier = StdioVerifier([engine]) + verifier.binary_sha256 = file_sha256(engine) + try: + verifier.connect() + except McpError as problem: + sys.exit("the verifier failed, so nothing was scored: %s" % problem) + if not isinstance(verifier.server, dict) or not verifier.server.get("name"): + close_verifier(verifier) + sys.exit("the verifier failed, so nothing was scored: %s did not answer as an MCP server" % engine) + return verifier + + +def close_verifier(verifier): + if hasattr(verifier, "close"): + verifier.close() + + +# ------------------------------------------------------------------------------------------ +# reading the reply and the call logs +# ------------------------------------------------------------------------------------------ +def _no_constant(name): + raise ValueError("%s is not a number" % name) + + +def read_card(reply): + """(card, problem): the JSON object on the reply's last line. A closing code fence is passed over.""" + lines = [line.strip() for line in (reply or "").replace("\r", "\n").split("\n") if line.strip()] + while lines and lines[-1].startswith("```"): + lines.pop() + if not lines: + return None, "the reply is empty" + try: + card = json.loads(lines[-1], parse_constant=_no_constant) + except ValueError: + return None, "the last line is not one JSON object" + if not isinstance(card, dict): + return None, "the last line is not one JSON object" + return card, None + + +def tool_name(name): + """The verifier's own name for a tool an agent's program may have prefixed (mcp__zerotrust__solve).""" + if not isinstance(name, str): + return None + if name in VERIFIER_TOOLS: + return name + for tool in VERIFIER_TOOLS: + for joint in PREFIX_ENDS: + if name.endswith(joint + tool): + return tool + return name + + +def without_readout(arguments): + """A run's arguments as sealed: a readout is not part of a run's seal.""" + if not isinstance(arguments, dict): + return arguments + return {k: v for k, v in arguments.items() if k != "readout"} + + +def numbers_by_value(value): + """Every number as a float, so 18 and 18.0 (one request to the engine) compare equal; bools kept.""" + if isinstance(value, dict): + return {k: numbers_by_value(v) for k, v in value.items()} + if isinstance(value, list): + return [numbers_by_value(v) for v in value] + if isinstance(value, int) and not isinstance(value, bool): + return float(value) + return value + + +def canonical(arguments): + """A request's arguments as compared with the call log: no readout, keys sorted, numbers by value.""" + return json.dumps(numbers_by_value(without_readout(arguments)), sort_keys=True, separators=(",", ":")) + + +def _arguments(one): + arguments = one.get("arguments") + if isinstance(arguments, str): + try: + arguments = json.loads(arguments) + except ValueError: + arguments = {} + return arguments if isinstance(arguments, dict) else {} + + +def read_calls(path): + """Every call in a reply-side call log, [(tool, arguments)], or None when there is no log.""" + if not path or not os.path.isfile(path): + return None + calls = [] + with open(path, encoding="utf-8", errors="replace") as f: + for line in f: + line = line.strip() + if not line: + continue + try: + one = json.loads(line) + except ValueError: + continue + if isinstance(one, dict): + calls.append((tool_name(one.get("tool")), _arguments(one))) + return calls + + +def chain_of(previous, entry): + payload = json.dumps(entry, sort_keys=True, separators=(",", ":")) + return hashlib.sha384(((previous or "") + payload).encode("utf-8")).hexdigest() + + +def read_harness_log(path): + """(calls, problem) from a log written by harness/mcp_log_proxy.py. calls is None when there is no log; + problem names the first line whose chain does not follow (an edit, a line taken out or put in).""" + if not path or not os.path.isfile(path): + return None, None + calls, previous = [], None + with open(path, encoding="utf-8", errors="replace") as f: + for number_, line in enumerate(f, 1): + if not line.strip(): + continue + try: + entry = json.loads(line) + except ValueError: + return calls, "line %d of the harness log is not JSON" % number_ + if not isinstance(entry, dict) or "chain" not in entry: + return calls, "line %d of the harness log carries no chain" % number_ + chain = entry.pop("chain") + if chain != chain_of(previous, entry) or entry.get("seq") != len(calls) + 1: + return calls, "the harness log's chain breaks at line %d" % number_ + previous = chain + calls.append((tool_name(entry.get("tool")), _arguments(entry))) + return calls, None + + +def write_harness_log(path, calls): + """A chained log in the proxy's format, for tests and the cheat suite: calls [(tool, arguments)].""" + previous = None + with open(path, "w", encoding="utf-8") as f: + for seq, (tool, arguments) in enumerate(calls, 1): + entry = {"seq": seq, "jsonrpc_id": seq, "tool": tool, "arguments": arguments, "ts_request": None, + "ts_response": None, "duration_s": None, "response_sha384": None, "text_sha384": None, "is_error": False} + entry["chain"] = chain_of(previous, entry) + previous = entry["chain"] + f.write(json.dumps(entry, sort_keys=True) + "\n") + + +# ------------------------------------------------------------------------------------------ +# the verifier, asked again +# ------------------------------------------------------------------------------------------ +def stop_name_in(sentence): + names = re.findall(r"\(([A-Z][A-Za-z0-9]*[a-z][A-Za-z0-9]*)\)", sentence or "") + return names[-1] if names else None + + +class Replay: + """The verifier, with every answer remembered: the same request is sent once.""" + + def __init__(self, verifier): + self.verifier = verifier + self.seen = {} + server = getattr(verifier, "server", None) or {} + self.version = server.get("version") + self.binary_sha256 = getattr(verifier, "binary_sha256", None) + + def call(self, tool, arguments): + key = tool + "\x00" + json.dumps(arguments, sort_keys=True) + if key not in self.seen: + try: + self.seen[key] = self.verifier.call_json(tool, arguments) + except McpError as problem: + if not str(problem).startswith("protocol error"): + raise SystemExit("the verifier failed, so nothing was scored: %s" % problem) + self.seen[key] = ("the verifier did not take the request: %s" % problem, True) + return self.seen[key] + + def answer(self, tool, arguments, readout=None): + """One run or solve computed again: {"stopped", "outcome", "stop", "proof", "body"}.""" + arguments = copy.deepcopy(without_readout(arguments)) + if readout is not None and tool == "run_trajectory": + arguments["readout"] = readout + body, is_error = self.call(tool, arguments) + if is_error or not isinstance(body, dict): + sentence = body if isinstance(body, str) else json.dumps(body) + return {"stopped": True, "outcome": "stopped before computing", "stop": stop_name_in(sentence), + "proof": None, "body": None, "sentence": sentence} + outcome = body.get("outcome") + stopped = outcome not in NOT_STOPPED + return {"stopped": stopped, "outcome": outcome, "stop": body.get("reject") if stopped else None, + "proof": body.get("run_seal") or body.get("solution_seal"), "body": body, + "sentence": body.get("reject_detail")} + + def proof_holds(self, tool, arguments, proof): + """(holds, words): the card's seal verified by verify_tape or verify_solution, short form.""" + if not isinstance(proof, str) or not re.fullmatch(r"[0-9a-f]{96}", proof): + return False, "the proof is not a SHA-384 seal of 96 hex digits" + if tool == "run_trajectory": + body, is_error = self.call("verify_tape", {"request": without_readout(arguments), "run_seal": proof}) + elif tool == "solve": + body, is_error = self.call("verify_solution", {"request": arguments, "solution_seal": proof}) + else: + return False, "a proof is verified for run_trajectory or solve only, not %s" % tool + if is_error or not isinstance(body, dict): + return False, "the verifier would not verify it: %s" % (str(body)[:200]) + if body.get("holds") is True: + return True, None + return False, "the verifier says the seal does not hold (cause %s)" % body.get("cause") + + +def engine_problem(env, replay): + """None when the verifier is the engine the task was built on; else what differs.""" + ref = env.get("reference") or {} + tag = ref.get("gateway_version") or (ref.get("engine_tag") or "").lstrip("v") + if not tag: + return "the task names no engine it was built on" + if (ref.get("engine_tag") or "v" + tag).lstrip("v") != tag: + return "the task's engine_tag %s and gateway_version %s disagree" % (ref.get("engine_tag"), ref.get("gateway_version")) + if replay.version != tag: + return "the task was built on engine %s; the verifier is %s" % (tag, replay.version) + want = ref.get("engine_binary_sha256") + if replay.binary_sha256 and want and replay.binary_sha256 != want: + return "the verifier's binary is not the one the task was built on (sha256 %s..., want %s...)" % (replay.binary_sha256[:12], want[:12]) + return None + + +# ------------------------------------------------------------------------------------------ +# requests and their inputs +# ------------------------------------------------------------------------------------------ +_PART = re.compile(r"([A-Za-z_0-9]+)((?:\[\d+\])*)") + + +def get_path(obj, path): + here = obj + for part in path.split("."): + found = _PART.fullmatch(part) + if not found or not isinstance(here, dict) or found.group(1) not in here: + return None + here = here[found.group(1)] + for index in re.findall(r"\[(\d+)\]", found.group(2)): + if not isinstance(here, list) or int(index) >= len(here): + return None + here = here[int(index)] + return here + + +def set_path(obj, path, value): + parts = path.split(".") + here = obj + for i, part in enumerate(parts): + m = _PART.fullmatch(part) + name, idx = m.group(1), [int(k) for k in re.findall(r"\[(\d+)\]", m.group(2))] + last = i == len(parts) - 1 + if not idx: + if last: + here[name] = value + else: + here = here[name] + else: + here = here[name] + for j, k in enumerate(idx): + if last and j == len(idx) - 1: + here[k] = value + else: + here = here[k] + + +def number(value): + return isinstance(value, (int, float)) and not isinstance(value, bool) and math.isfinite(value) + + +def differs(template, given, free, where=""): + """The first place where a request differs from the task's, other than the free places. None when none.""" + if where in free: + return None + if isinstance(template, dict): + if not isinstance(given, dict): + return where or "the request" + for key in set(template) | set(given): + place = "%s.%s" % (where, key) if where else key + if place in free: + continue + if key not in given or key not in template: + return place + found = differs(template[key], given[key], free, place) + if found: + return found + return None + if isinstance(template, list): + if not isinstance(given, list) or len(given) != len(template): + return where + for index, (a, b) in enumerate(zip(template, given)): + found = differs(a, b, free, "%s[%d]" % (where, index)) + if found: + return found + return None + if number(template) and number(given): + return None if float(template) == float(given) else where + return None if template == given else where + + +def design_value(variable, run_arguments, solve_arguments, next_arguments=None): + """The design variable of one design, read from its requests (on: run, solve, or next, a continued run).""" + kind = variable["kind"] + if kind == "path": + on = variable.get("on", "run") + source = {"solve": solve_arguments, "next": next_arguments}.get(on, run_arguments) or {} + value = get_path(source, variable["path"]) + for place in variable.get("also") or []: + again = get_path(source, place) + if not (number(again) and number(value) and float(again) == float(value)): + return None + return float(value) if number(value) else None + if kind == "entry_angle_deg": + radial = get_path(run_arguments or {}, "initial.radial_speed_m_s") + transverse = get_path(run_arguments or {}, "initial.transverse_speed_m_s") + if not (number(radial) and number(transverse)) or transverse <= 0: + return None + speed = math.hypot(radial, transverse) + if abs(speed - variable["speed_m_s"]) > 1e-6 * variable["speed_m_s"]: + return None + return math.degrees(math.atan2(-radial, transverse)) + return None + + +def variable_places(variable): + if variable["kind"] == "entry_angle_deg": + return {"initial.radial_speed_m_s", "initial.transverse_speed_m_s"} + if variable["kind"] == "path" and variable.get("on", "run") == "run": + return {variable["path"]} | set(variable.get("also") or []) + return set() + + +def read_value(read, answer): + """One number from a replayed answer: final, result, or the extreme of a run's readout.""" + body = answer["body"] + if body is None: + return None + kind = read["kind"] + value = None + if kind == "final": + value = (body.get("final_state") or {}).get(read["quantity"]) + elif kind == "result": + value = (body.get("result") or {}).get(read["quantity"]) + elif kind == "flag_extent": + # an advisory flag the run raised, at its largest extent; 0 when the run does not raise it + value = max([x.get("extent") or 0.0 for x in body.get("exceedance_extremes") or [] + if isinstance(x, dict) and x.get("flag") == read["quantity"]] or [0.0]) + elif kind == "extreme": + for quantity in (body.get("readout") or {}).get("quantities") or []: + if quantity.get("quantity") == read["quantity"]: + value = quantity.get(read["which"]) + if "index" in read: + # one entry of an output the verifier returns as a list (a hose's modes, a solve asked at several points) + k = read["index"] + value = value[k] if isinstance(value, list) and isinstance(k, int) and -len(value) <= k < len(value) else None + return value if number(value) else None + + +def readout_for(constraints, on="run"): + """The readout a run is sent with: the extremes its constraints read (on: run, next, or a stage key).""" + quantities = sorted({c["read"]["quantity"] for c in constraints if c["on"] == on and c["read"]["kind"] == "extreme"}) + return {"quantities": quantities} if quantities else None + + +def design_shape(spec): + """Which of the design shapes a task's check.design is: run, coupled, continued, solve or staged.""" + if spec.get("stages"): + return "staged" + if spec.get("tool") == "solve" or spec.get("kind") == "solve": + return "solve" + chain = spec.get("chain") or {} + if chain.get("kind") == "continuation" or (chain.get("layout") or {}).get("kind") == "continue": + return "continued" + return "coupled" if chain else "run" + + +def continuation_of(spec): + """A continued design's chain in one form: (next template, {start field: where the first run's answer holds it}, + next outcomes, the next run's places that also hold a first-run design value).""" + chain = spec["chain"] + template = chain.get("next_template") or chain.get("template") or chain.get("next") + if "carried" in chain: # group 1 + carried = dict(chain["carried"]) + elif "handed" in chain: # group 4 + named = chain.get("handed_from") or {} + carried = {k: "final_state." + named.get(k, k) for k in chain["handed"]} + else: # group 5 + carried = {k: "final_state." + k for k in chain.get("carry") or []} + if chain.get("clock"): + carried[chain["clock"]["field"]] = "final_state." + chain["clock"]["from"] + outcomes = chain.get("next_outcomes") or spec["run_outcomes"] + return template, carried, outcomes, list(chain.get("next_also") or []) + + +def meets(constraint, value): + if value is None: + return False + return value <= constraint["limit"] if constraint["op"] == "<=" else value >= constraint["limit"] + + +def history_layout_problem(layout, parameters, frames_count): + """None when the arrays of a chained solve are laid out as the task states; else what is not.""" + if layout is None: + return None + if layout["kind"] == "stardust_slab": + names = ("history_time_s", "history_pressure_pa", "history_heat_transfer_coefficient_kg_per_m2_s", + "history_flow_enthalpy_j_per_kg", "history_radiative_heating_w_per_m2") + columns = [parameters.get(name) for name in names] + if not all(isinstance(c, list) and all(number(v) for v in c) for c in columns): + return "the history columns are not all lists of numbers" + time, pressure, coefficient, enthalpy, radiative = columns + rows = frames_count + 3 + if any(len(c) != rows for c in columns): + return "the history has not one row before the %d frames handed and two after them" % frames_count + if time[0] != 0.0 or coefficient[0] != 0.0: + return "row 0 is not at 0 s with no heating" + if pressure[0] != pressure[1] or enthalpy[0] != enthalpy[1]: + return "row 0 does not repeat the first frame's pressure and enthalpy" + if abs(time[-2] - (time[-3] + 1.0)) > 1e-9 or time[-1] != layout["cool_to_s"]: + return "the rows after the frames are not at 1 s after the last frame and at %g s" % layout["cool_to_s"] + if coefficient[-2] != 0.0 or coefficient[-1] != 0.0: + return "the stream is not off after the frames" + if pressure[-1] != pressure[-3] or pressure[-2] != pressure[-3] or enthalpy[-1] != enthalpy[-3] or enthalpy[-2] != enthalpy[-3]: + return "the rows after the frames do not hold the last frame's pressure and enthalpy" + if any(v != 0.0 for v in radiative): + return "a row of the history holds radiative heating" + return None + if layout["kind"] == "triga_element": + return None # every array is handed by the coupling and held to its bits by the verifier + return "an unknown layout" + + +# ------------------------------------------------------------------------------------------ +# the call record +# ------------------------------------------------------------------------------------------ +def card_requests(env, card): + """Every request on the card, [(tool, arguments)], read leniently (for the call log).""" + out = [] + + def take(part): + if isinstance(part, dict) and isinstance(part.get("request"), dict) and isinstance(part["request"].get("arguments"), dict): + out.append((tool_name(part["request"].get("tool")), part["request"]["arguments"])) + + if env["family"] in ("tradeoff", "chain_design"): + stages = [s["key"] for s in (env["check"].get("design") or {}).get("stages") or []] + for side in ("passing", "failing"): + design = card.get(side) if isinstance(card.get(side), dict) else {} + for key in stages or ("run", "solve", "next"): + take(design.get(key)) + elif env["family"] == "budget": + take(card.get("holds")) + take(card.get("stops")) + return out + + +def sequence(calls): + return [(tool_name(t), json.dumps(numbers_by_value(a), sort_keys=True)) for t, a in calls] + + +def call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row): + """None when the call record holds; else why not (an integrity failure).""" + check = env["check"] + if calls_from == "harness": + if calls is None: + return "no harness call log: every attempt is scored with the calls the harness recorded" + if log_problem: + return log_problem + if reply_calls is not None and sequence(reply_calls) != sequence(calls): + return "the call log beside the reply differs from the harness log" + elif calls is None: + return "no call log: every environment is scored with the agent's calls" + calls = [(tool_name(t), a) for t, a in calls] + banned = sorted({t for t, _ in calls if t in (check.get("forbidden") or [])}) + if banned: + return "the log holds calls of %s, which the task rules out" % ", ".join(banned) + computing = [(t, a) for t, a in calls if t not in FREE_TOOLS] + row["computing_calls"] = len(computing) + if check.get("budget") and len(computing) > check["budget"]: + return "%d computing calls; the budget is %d" % (len(computing), check["budget"]) + sent = {(t, canonical(a)) for t, a in computing} + for tool, arguments in card_requests(env, card): + if (tool, canonical(arguments)) not in sent: + return "a %s request on the card is not among the calls in the log" % tool + if env["family"] == "forensics" and not computing: + return "no computing call behind the answer: the table was not put to the verifier" + return None + + +# ------------------------------------------------------------------------------------------ +# the families +# ------------------------------------------------------------------------------------------ +def request_of(part, tool, what): + """The arguments of one request on the card (Integrity when it is not one).""" + if not isinstance(part, dict): + raise Integrity("%s is missing" % what) + request = part.get("request") + if not (isinstance(request, dict) and isinstance(request.get("arguments"), dict)): + raise Integrity("%s has no request {\"tool\": ..., \"arguments\": {...}}" % what) + if tool_name(request.get("tool")) != tool: + raise Integrity("%s is a request of %s, not %s" % (what, request.get("tool"), tool)) + return request["arguments"] + + +def score_design(env, design, which, replay, proofs): + """One design of a boundary family: facts {x, met, values, stopped, steps_landed}.""" + check = env["check"] + spec = check["design"] + shape = design_shape(spec) + if shape in ("solve", "staged", "continued") and not isinstance(design, dict): + raise Integrity("the %s design is missing" % which) + if shape == "solve": + return score_solve_design(env, design, which, replay, proofs) + if shape == "staged": + return score_staged_design(env, design, which, replay, proofs) + if shape == "continued": + return score_continued_design(env, design, which, replay, proofs) + chain = spec.get("chain") + run_args = request_of((design or {}).get("run") if isinstance(design, dict) else None, "run_trajectory", + "the %s design's run" % which) + free = set(spec.get("free") or []) | variable_places(spec["variable"]) + where = differs(spec["template"], without_readout(run_args), free) + if where: + raise Integrity("the %s design's run differs from the task's at %s" % (which, where)) + for place in spec.get("free") or []: + if place.endswith(".steps"): + steps = get_path(run_args, place) + if not (isinstance(steps, int) and not isinstance(steps, bool) and 1 <= steps <= spec.get("most_steps", 10 ** 7)): + raise Integrity("the %s design's run has no whole number of steps at %s" % (which, place)) + run_proof = design["run"].get("proof") + holds, words = replay.proof_holds("run_trajectory", run_args, run_proof) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's run_seal: %s" % (which, words)) + run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"])) + stop_names = [c["stop"] for c in check["constraints"] if c["on"] == "outcome"] + stopped_by_name = run["outcome"] == "refused" and run["stop"] in stop_names + if run["outcome"] not in spec["run_outcomes"] and not stopped_by_name: + raise Wrong("the %s design's run comes back %s%s, not %s" % ( + which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"]))) + solve_args, solve = None, None + if chain: + solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which) + if solve_args.get("solver") != chain["solver"]: + raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver"))) + handed = solve_args.get("from") + if not isinstance(handed, dict) or handed.get("coupling") != chain["coupling"]: + raise Integrity("the %s design's solve is not handed its run through the coupling %s" % (which, chain["coupling"])) + if canonical(handed.get("request")) != canonical(run_args) or handed.get("run_seal") != run_proof: + raise Integrity("the %s design's solve is not handed the design's own sealed run" % which) + parameters = solve_args.get("parameters") + if not isinstance(parameters, dict): + raise Integrity("the %s design's solve has no parameters" % which) + solve_free = set(chain.get("handed") or []) + if spec["variable"]["kind"] == "path" and spec["variable"].get("on") == "solve": + solve_free.add(spec["variable"]["path"].split(".", 1)[1]) + where = differs(chain["parameters"], parameters, solve_free) + if where: + raise Integrity("the %s design's solve differs from the task's at parameters.%s" % (which, where)) + frames = len((run["body"] or {}).get("frames") or []) + problem = history_layout_problem(chain.get("layout"), parameters, frames) + if problem: + raise Integrity("the %s design's solve: %s" % (which, problem)) + holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's solution_seal: %s" % (which, words)) + solve = replay.answer("solve", solve_args) + if solve["outcome"] != "converged": + raise Wrong("the %s design's solve comes back %s%s, not converged" % ( + which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else "")) + x = design_value(spec["variable"], run_args, solve_args) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, spec["variable"].get("words", ""))) + met, values = {}, {} + for constraint in check["constraints"]: + if constraint["on"] == "outcome": + values[constraint["id"]] = run["outcome"] if not run["stop"] else "%s (%s)" % (run["outcome"], run["stop"]) + met[constraint["id"]] = not (run["outcome"] == "refused" and run["stop"] == constraint["stop"]) + continue + value = read_value(constraint["read"], run if constraint["on"] == "run" else solve) + values[constraint["id"]] = value + met[constraint["id"]] = meets(constraint, value) + facts = {"x": x, "met": met, "values": values} + if run["outcome"] not in NOT_STOPPED and run["body"]: + facts["stopped"], facts["steps_landed"] = run["stop"], run["body"].get("steps_landed") + return facts + + +def halted(answer, stop, staged=False): + """True when an answer is stopped by the stop named: a refusal ("refused"); for a staged design, any outcome that + is not completed or converged (group 3's rule, kept as built).""" + if staged: + return answer["outcome"] not in NOT_STOPPED and answer["stop"] == stop + return answer["outcome"] == "refused" and answer["stop"] == stop + + +def constraint_facts(check, answers, judged, staged=False): + """met and values of every constraint: each read from the answer its "on" names (answers: {on: answer}); a stop + constraint ("on": "outcome") is judged on the answer judged, or on its stage's answer for a staged design.""" + met, values = {}, {} + for c in check["constraints"]: + if c["on"] == "outcome": + a = answers.get(c["stage"]) if c.get("stage") else judged + values[c["id"]] = None if a is None else (a["outcome"] if not a["stop"] else "%s (%s)" % (a["outcome"], a["stop"])) + met[c["id"]] = a is not None and not halted(a, c["stop"], staged) + continue + a = answers.get(c["on"]) + value = read_value(c["read"], a) if a is not None else None + values[c["id"]] = value + met[c["id"]] = meets(c, value) if c.get("limit") is not None else None + return met, values + + +def stopped_by(answer, constraints, stage=None): + """True when an answer is stopped by a stop one of the task's stop constraints names (for the stage given).""" + return any(halted(answer, c["stop"], stage is not None) for c in constraints + if c["on"] == "outcome" and (stage is None or c.get("stage") == stage)) + + +def score_solve_design(env, design, which, replay, proofs): + """One design that is one solve and no run (check.design.tool or kind "solve").""" + check = env["check"] + spec = check["design"] + var = spec["variable"] + solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which) + if solve_args.get("solver") != spec["template"].get("solver"): + raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver"))) + free = set(spec.get("free") or []) | {var["path"]} | set(var.get("also") or []) + where = differs(spec["template"], solve_args, free) + if where: + raise Integrity("the %s design's solve differs from the task's at %s" % (which, where)) + holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's solution_seal: %s" % (which, words)) + solve = replay.answer("solve", solve_args) + if solve["outcome"] not in spec["run_outcomes"] and not stopped_by(solve, check["constraints"]): + raise Wrong("the %s design's solve comes back %s%s, not %s" % ( + which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else "", " or ".join(spec["run_outcomes"]))) + x = design_value(dict(var, on="solve"), None, solve_args) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", ""))) + met, values = constraint_facts(check, {"solve": solve}, solve) + facts = {"x": x, "met": met, "values": values} + if solve["outcome"] not in NOT_STOPPED and solve["body"]: + facts["stopped"], facts["steps_landed"], facts["no_step"] = solve["stop"], None, True + return facts + + +def score_continued_design(env, design, which, replay, proofs): + """One design of a run and the run that continues it through from. The verifier holds the hand-off: it computes + the first run again, compares its seal and refuses a start that is not the first run's final state; the scorer + also holds each carried start field to the first run's answer, bit for bit.""" + check = env["check"] + spec = check["design"] + var = spec["variable"] + on_next = var["kind"] == "path" and var.get("on") == "next" + template, carried, next_outcomes, next_also = continuation_of(spec) + run_args = request_of(design.get("run"), "run_trajectory", "the %s design's run" % which) + free = set(spec.get("free") or []) | (set() if on_next else variable_places(var)) + where = differs(spec["template"], without_readout(run_args), free) + if where: + raise Integrity("the %s design's run differs from the task's at %s" % (which, where)) + run_proof = design["run"].get("proof") + holds, words = replay.proof_holds("run_trajectory", run_args, run_proof) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's run_seal: %s" % (which, words)) + run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"], "run")) + if run["outcome"] not in spec["run_outcomes"]: + raise Wrong("the %s design's first run comes back %s%s, not %s" % ( + which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"]))) + next_args = request_of(design.get("next"), "run_trajectory", "the %s design's next run" % which) + handed = next_args.get("from") + if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(run_args) + or handed.get("run_seal") != run_proof): + raise Integrity("the %s design's next run does not continue the design's own sealed run (from)" % which) + next_free = {"initial." + name for name in carried} | {"from"} | set(next_also) + if on_next: + next_free |= {var["path"]} | set(var.get("also") or []) + where = differs(template, without_readout(next_args), next_free) + if where: + raise Integrity("the %s design's next run differs from the task's at %s" % (which, where)) + start = next_args.get("initial") if isinstance(next_args.get("initial"), dict) else {} + for name, source in carried.items(): + held, given = get_path(run["body"] or {}, source), start.get(name) + if name not in start or not (given == held or (number(given) and number(held) and float(given) == float(held))): + raise Integrity("the %s design's next run does not start from its run's %s, bit for bit" % (which, source)) + holds, words = replay.proof_holds("run_trajectory", next_args, design["next"].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's next run_seal: %s" % (which, words)) + nxt = replay.answer("run_trajectory", next_args, readout_for(check["constraints"], "next")) + if nxt["outcome"] not in next_outcomes and not stopped_by(nxt, check["constraints"]): + raise Wrong("the %s design's next run comes back %s%s, not %s" % ( + which, nxt["outcome"], " (%s)" % nxt["stop"] if nxt["stop"] else "", " or ".join(next_outcomes))) + x = design_value(var, run_args, None, next_args) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", ""))) + for place in next_also: + again = get_path(next_args, place) + if not (number(again) and float(again) == float(x)): + raise Integrity("the %s design's next run does not hold the design value at %s" % (which, place)) + met, values = constraint_facts(check, {"run": run, "next": nxt}, nxt) + facts = {"x": x, "met": met, "values": values} + if nxt["outcome"] not in NOT_STOPPED and nxt["body"]: + facts["stopped"], facts["steps_landed"] = nxt["stop"], nxt["body"].get("steps_landed") + return facts + + +def build_stage_request(spec, stage, x, answers, requests): + """One stage's request of a staged design at x: the template, x at the variable's places, the values handed from + earlier stages' answers, and a continuation's start and from (used by run_reference.py).""" + q = copy.deepcopy(stage["template"]) + var = spec["variable"] + if var.get("stage") == stage["key"]: + for place in [var["path"]] + list(var.get("also") or []): + set_path(q, place, x) + for h in stage.get("handed") or []: + set_path(q, h["to"], read_value(h["read"], answers[h["from"]])) + if stage.get("continues"): + parent = stage["continues"] + final = answers[parent]["body"]["final_state"] + q["initial"] = {k: final[k] for k in stage["template"]["initial"]} + q["from"] = {"request": copy.deepcopy(requests[parent]), "run_seal": answers[parent]["proof"]} + return q + + +def score_staged_design(env, design, which, replay, proofs): + """One staged design (check.design.stages): each stage a run or a solve, in order.""" + check = env["check"] + spec = check["design"] + var = spec["variable"] + stages = spec["stages"] + answers, requests, facts = {}, {}, {} + for i, stage in enumerate(stages): + key, tool = stage["key"], stage["tool"] + sent = without_readout(request_of(design.get(key), tool, "the %s design's %s" % (which, key))) + free = set(stage.get("free") or []) | {h["to"] for h in stage.get("handed") or []} + if var.get("stage") == key: + free |= {var["path"]} | set(var.get("also") or []) + if stage.get("continues"): + free |= {"initial", "from"} + where = differs(stage["template"], sent, free) + if where: + raise Integrity("the %s design's %s differs from the task's at %s" % (which, key, where)) + for h in stage.get("handed") or []: + want = read_value(h["read"], answers[h["from"]]) + got = get_path(sent, h["to"]) + if want is None or not number(got) or float(got) != float(want): + raise Integrity("the %s design's %s does not carry %s's %s at %s, bit for bit" % ( + which, key, h["from"], h["read"]["quantity"], h["to"])) + if stage.get("continues"): + parent = stage["continues"] + handed = sent.get("from") + if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(requests[parent]) + or handed.get("run_seal") != design[parent].get("proof")): + raise Integrity("the %s design's %s does not continue the design's own sealed %s run (from)" % (which, key, parent)) + final = (answers[parent]["body"] or {}).get("final_state") or {} + start = sent.get("initial") + keys = set(stage["template"]["initial"]) + if not isinstance(start, dict) or set(start) != keys or any( + not number(start[k]) or float(start[k]) != final.get(k) for k in keys): + raise Integrity("the %s design's %s does not start from the final state of its %s run, bit for bit" % (which, key, parent)) + holds, words = replay.proof_holds(tool, sent, design[key].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's %s proof: %s" % (which, key, words)) + answer = replay.answer(tool, sent, readout_for(check["constraints"], key) if tool == "run_trajectory" else None) + named = stopped_by(answer, check["constraints"], stage=key) + if answer["outcome"] not in stage["outcomes"] and not named: + raise Wrong("the %s design's %s comes back %s%s, not %s" % ( + which, key, answer["outcome"], " (%s)" % answer["stop"] if answer["stop"] else "", " or ".join(stage["outcomes"]))) + answers[key], requests[key] = answer, sent + if named: + facts["stopped"], facts["stopped_stage"] = answer["stop"], key + facts["steps_landed"] = (answer["body"] or {}).get("steps_landed") if tool == "run_trajectory" else None + facts["no_step"] = tool != "run_trajectory" + if i != len(stages) - 1: + raise Wrong("the %s design's %s stops (%s) before its last stage" % (which, key, answer["stop"])) + x = design_value(dict(var, on="run"), requests.get(var["stage"]), None) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", ""))) + met, values = constraint_facts(check, answers, None, staged=True) + facts.update({"x": x, "met": met, "values": values}) + return facts + + +def grade_bracket(a, b, star, tol, slack, row): + """(reward_ok, graded) for a bracket [a, b] with its sides right.""" + width = abs(b - a) + straddles = min(a, b) - slack <= star <= max(a, b) + slack + within = width <= tol * (1 + 1e-9) + e = max(a, b, star) - min(a, b, star) + r = e / tol if tol > 0 else float("inf") + row["width"], row["width_ratio"] = width, r + if within and straddles: + return True, 1.0 + if r <= 1: + return False, OTHER_CROSSING + return False, GRADED_DECAY ** math.log10(r) + + +def score_boundary(env, card, replay, row, proofs): + check, reference = env["check"], env["reference"] + passing = score_design(env, card.get("passing"), "passing", replay, proofs) + failing = score_design(env, card.get("failing"), "failing", replay, proofs) + row["passing"], row["failing"] = passing, failing + span = check["design"].get("range") + if span and not all(span[0] <= x <= span[1] for x in (passing["x"], failing["x"])): + raise Wrong("a design lies outside the range the task states, %g to %g" % tuple(span)) + broken = [c for c, ok in passing["met"].items() if not ok] + if broken: + raise Wrong("the passing design breaks %s" % ", ".join(broken)) + broken = [c for c, ok in failing["met"].items() if not ok] + if not broken: + raise Wrong("the failing design meets every constraint") + binding = card.get("binding") + if binding != reference["binding"]: + raise Wrong("binding names %r; the constraint that binds is another" % (binding,)) + if binding not in broken: + raise Wrong("the failing design does not break %s, the constraint named binding" % binding) + if binding in [c["id"] for c in check["constraints"] if c["on"] == "outcome"]: + said = card.get("failing") or {} + if said.get("stopped") != failing.get("stopped"): + raise Wrong("the failing design's run stops with %s; the card says %r" % (failing.get("stopped"), said.get("stopped"))) + if failing.get("no_step"): + pass # a solve that is refused has no step: its stop's name is stated + elif not (isinstance(said.get("step"), int) and not isinstance(said.get("step"), bool) and said["step"] == failing.get("steps_landed")): + raise Wrong("the failing design's run is sealed to step %s; the card says %r" % (failing.get("steps_landed"), said.get("step"))) + spec = check["design"] + xp, xf = passing["x"], failing["x"] + if spec["direction"] == "largest" and not xf > xp: + raise Wrong("the task asks for the largest value that holds: the failing design must lie above the passing one") + if spec["direction"] == "smallest" and not xf < xp: + raise Wrong("the task asks for the smallest value that holds: the failing design must lie below the passing one") + ok, graded = grade_bracket(xp, xf, reference["boundary"], spec["tolerance"], spec["tolerance"] * 0.5, row) + if not ok: + return graded, "the two designs are %.6g apart; the task asks for %.6g or less, and they must straddle the boundary" % ( + abs(xf - xp), spec["tolerance"]) + return 1.0, None + + +def score_budget(env, card, replay, row, proofs): + check, reference = env["check"], env["reference"] + template, path, tool = check["template"], check["variable"], check["tool"] + sides = {} + for side in ("holds", "stops"): + arguments = request_of(card.get(side), tool, side) + also = check.get("also") or [] + where = differs(template, without_readout(arguments), {path} | set(also)) + if where: + raise Integrity("the %s request differs from the task's at %s" % (side, where)) + x = get_path(arguments, path) + if not number(x): + raise Integrity("the %s request has no number at %s" % (side, path)) + for place in also: + again = get_path(arguments, place) + if not (number(again) and float(again) == float(x)): + raise Integrity("the %s request does not hold the same value at %s as at %s" % (side, place, path)) + holds, words = replay.proof_holds(tool, arguments, card[side].get("proof")) + proofs.append(holds) + sides[side] = (float(x), arguments, holds, words) + for side in ("holds", "stops"): + if not sides[side][2]: + raise Integrity("the %s seal: %s" % (side, sides[side][3])) + held = replay.answer(tool, sides["holds"][1]) + stopped = replay.answer(tool, sides["stops"][1]) + row["holds_outcome"], row["stops_outcome"] = held["outcome"], "%s (%s)" % (stopped["outcome"], stopped["stop"]) + if held["outcome"] not in NOT_STOPPED: + raise Wrong("the holds request comes back %s (%s)" % (held["outcome"], held["stop"])) + if stopped["stop"] != check["stop"]: + raise Wrong("the stops request comes back %s (%s), not the stop %s" % (stopped["outcome"], stopped["stop"], check["stop"])) + if card["stops"].get("stopped") != check["stop"]: + raise Wrong("the card names the stop %r; the verifier names %s" % (card["stops"].get("stopped"), check["stop"])) + xh, xs = sides["holds"][0], sides["stops"][0] + star = reference["boundary"] + row["holds_value"], row["stops_value"] = xh, xs + tol = check["relative_width"] * abs(star) + ok, graded = grade_bracket(xh, xs, star, tol, 1e-9 * abs(star), row) + if not ok: + return graded, "the bracket is %.6g wide; the task asks for %.3g of the value or less, and it must hold the stop" % ( + abs(xs - xh), check["relative_width"]) + return 1.0, None + + +def forensics_f1(env, named): + """(graded, problem): F1 over (row, reason) pairs; problem when the card is not a usable answer.""" + if not isinstance(named, dict): + return 0.0, "false_rows is not an object of row and reason" + rows = [c["row"] for c in env["check"]["rows"]] + truth = env["reference"]["false_rows"] + unknown = [r for r in named if r not in set(rows)] + if unknown: + return 0.0, "no rows %s in the table" % ", ".join(sorted(unknown)) + reasons = env["check"].get("reasons") or REASONS + bad = [r for r, why in named.items() if why not in reasons] + if bad: + return 0.0, "the reason for %s is not one of %s" % (", ".join(sorted(bad)), ", ".join(reasons)) + if rows and set(named) == set(rows): + return 0.0, "every row of the table is named false: a blanket answer" + found = sum(1 for r, why in named.items() if truth.get(r) == why) + if not truth and not named: + return 1.0, None + precision = found / len(named) if named else 0.0 + recall = found / len(truth) if truth else 0.0 + f1 = 2 * precision * recall / (precision + recall) if precision + recall else 0.0 + if f1 >= 1.0: + return 1.0, None + missed = sorted(set(truth) - set(named)) + wrongly = sorted(set(named) - set(truth)) + wrong_reason = sorted(r for r in set(truth) & set(named) if truth[r] != named[r]) + said = [] + if missed: + said.append("%d false row(s) not named" % len(missed)) + if wrongly: + said.append("%d genuine row(s) named false" % len(wrongly)) + if wrong_reason: + said.append("%d false row(s) with another reason" % len(wrong_reason)) + return f1, "; ".join(said) + + +def score(env, reply, replay, calls=None, reply_calls=None, calls_from="reply", log_problem=None): + """One environment scored. calls: the authoritative record [(tool, arguments)] (None: no record); + reply_calls: the reply-side log, compared with calls under calls_from="harness".""" + row = {"id": env["id"], "family": env["family"], "kind": KINDS.get(env["family"]), "calls_from": calls_from, + "correct": 0, "proofs_hold": 0, "reward": 0, "graded": 0.0, "verdict": None, "reason": None} + card, problem = read_card(reply) + if problem: + row.update(verdict="no_card", reason=problem) + return row + proofs = [] + try: + problem = engine_problem(env, replay) + if problem: + raise Integrity(problem) + problem = call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row) + if problem: + raise Integrity(problem) + family = env["family"] + if family in ("tradeoff", "chain_design"): + graded, reason = score_boundary(env, card, replay, row, proofs) + elif family == "budget": + graded, reason = score_budget(env, card, replay, row, proofs) + elif family == "forensics": + named = card.get("false_rows") + if isinstance(named, dict): + row["named"] = named + graded, reason = forensics_f1(env, named) + proofs = [True] + if reason and graded == 0.0 and not isinstance(named, dict): + raise Wrong(reason) + else: + raise Wrong("unknown family %s" % family) + except Integrity as problem: + row.update(verdict="integrity", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs))) + return row + except Wrong as problem: + row.update(verdict="wrong", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs))) + return row + proofs_hold = int(bool(proofs) and all(proofs)) + correct = int(graded >= 1.0 and reason is None) + row.update(correct=correct, proofs_hold=proofs_hold, reward=int(correct == 1 and proofs_hold == 1), + graded=round(graded, 6) if proofs_hold else 0.0, + verdict="pass" if correct and proofs_hold else ("near" if graded > 0 else "wrong"), reason=reason) + return row + + +def records_for(folder, env_id, calls_from, harness_dir=None): + """(calls, reply_calls, log_problem) for one environment's reply in folder.""" + reply_calls = read_calls(os.path.join(folder, env_id + ".calls.jsonl")) + if calls_from == "harness": + calls, log_problem = read_harness_log(os.path.join(harness_dir or folder, env_id + ".harness.jsonl")) + return calls, reply_calls, log_problem + return reply_calls, None, None + + +def main(): + parser = argparse.ArgumentParser(description=__doc__.split("\n")[0]) + parser.add_argument("replies") + parser.add_argument("--engine", required=True) + parser.add_argument("--only") + parser.add_argument("--environments", required=True) + parser.add_argument("--out") + parser.add_argument("--calls-from", choices=("reply", "harness"), default="harness") + parser.add_argument("--harness-dir") + parser.add_argument("--quiet", action="store_true") + args = parser.parse_args() + environments = load_environments(args.environments) + if args.only: + wanted = set(args.only.split(",")) + environments = [e for e in environments if e["id"] in wanted] + missing = wanted - {e["id"] for e in environments} + if missing: + sys.exit("no environments %s in %s" % (", ".join(sorted(missing)), args.environments)) + for env in environments: + for problem in row_problems(env): + print("warning: %s: %s" % (env.get("id"), problem), file=sys.stderr) + verifier = open_verifier(args.engine) + replay = Replay(verifier) + rows = [] + try: + for env in environments: + path = os.path.join(args.replies, env["id"] + ".txt") + reply = open(path, encoding="utf-8", errors="replace").read() if os.path.isfile(path) else "" + calls, reply_calls, log_problem = records_for(args.replies, env["id"], args.calls_from, args.harness_dir) + row = score(env, reply, replay, calls, reply_calls, args.calls_from, log_problem) + rows.append(row) + if not args.quiet: + print("%-58s reward %d graded %.4f %-9s %s" % (env["id"], row["reward"], row["graded"], row["verdict"], + row["reason"] or ""), flush=True) + replay.seen.clear() + finally: + close_verifier(verifier) + if args.out: + with open(args.out, "w", encoding="utf-8") as f: + for row in rows: + f.write(json.dumps(row) + "\n") + total = len(rows) + print("\n%d environments: reward %d, graded %.4f (mean %.4f), correct %d, proofs_hold %d" % ( + total, sum(r["reward"] for r in rows), sum(r["graded"] for r in rows), + sum(r["graded"] for r in rows) / total if total else 0.0, + sum(r["correct"] for r in rows), sum(r["proofs_hold"] for r in rows))) + by = {} + for r in rows: + by.setdefault(r["family"], []).append(r) + for family in FAMILIES: + if family in by: + print(" %-13s reward %d of %d, mean graded %.4f" % (family, sum(r["reward"] for r in by[family]), len(by[family]), + sum(r["graded"] for r in by[family]) / len(by[family]))) + + +if __name__ == "__main__": + main() diff --git a/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/solution/solve.sh b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..72cbff6116b4373dcb5a275b10f1ea91c863186a --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/solution/solve.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# Harbor's oracle agent copies solution/ to /solution and runs this. +# +# It makes the reference answer card here, on the verifier of this machine: the +# dataset's own run_reference.py sends this environment's reference requests to +# /usr/local/bin/mcp_stdio (and, for a chained design, hands each run to its solve +# through the task's coupling) and writes a reply that ends with the card. The card +# is saved where the instruction asks for it, and the calls it made beside it, so +# that a call-budget environment is scored on them: the oracle runs no model, and +# Harbor's record of its run holds no tool call. +# +# The four paths can be moved with environment variables, so this runs outside a container. +set -euo pipefail +HERE="${ZTP_SOLUTION_DIR:-$(cd "$(dirname "$0")" && pwd)}" +ENGINE="${ZTP_ENGINE:-/usr/local/bin/mcp_stdio}" +ANSWER="${ZTP_ANSWER_FILE:-/app/answer.json}" +CALLS="${ZTP_CALLS_FILE:-/app/calls.jsonl}" +WORK="$(mktemp -d)" +trap 'rm -rf "$WORK"' EXIT + +cd "$HERE" +FLAGS=() +grep -q -- '"--environments"' run_reference.py && FLAGS+=(--environments data/environments.jsonl) +grep -q -- '"--direct"' run_reference.py && FLAGS+=(--direct) # no proxy in here: the oracle's own call log +python3 -B run_reference.py --engine "$ENGINE" ${FLAGS[@]+"${FLAGS[@]}"} --out "$WORK/replies" +REPLY="$(ls "$WORK"/replies/*.txt)" # one environment here, so one reply +cat "$REPLY" +mkdir -p "$(dirname "$ANSWER")" "$(dirname "$CALLS")" +tail -n 1 "$REPLY" > "$ANSWER" +cp "$WORK"/replies/*.calls.jsonl "$CALLS" diff --git a/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/solution/ztp_mcp.py b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/solution/ztp_mcp.py new file mode 100644 index 0000000000000000000000000000000000000000..0cde73653317c847cd361ad0ca9d4f1f785bc3a7 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/solution/ztp_mcp.py @@ -0,0 +1,188 @@ +"""A small Model Context Protocol client for the Zero-Trust Physics verifier. + +Standard library only. It speaks MCP two ways: + + stdio to a verifier built from the public source and started here as a program + (target/release/mcp_stdio): one JSON-RPC message a line, no network. + HTTP to an MCP address (JSON-RPC in a POST), such as + + https://mcp.zerotrustphysics.com/mcp Open to any agent. + +The open address gives each network address one place in the physics pool at a +time and answers "Too many concurrent physics tasks." or HTTP 429 when it is +busy; nothing waits on the server, so this client sends one request at a time +and, when it is told to come back, waits and sends the same request again. + +Licence: Apache-2.0. +""" +import json +import select +import shlex +import subprocess +import time +import urllib.error +import urllib.request + +OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp" +BUSY = "Too many concurrent physics tasks." + + +class McpError(RuntimeError): + pass + + +class Verifier: + """One MCP endpoint. call(tool, arguments) returns (text, is_error).""" + + def __init__(self, url=OPEN_ADDRESS, timeout_s=90, patience_s=600, pause_s=0.0, headers=None, quiet=True): + self.url = url + self.timeout_s = timeout_s + self.patience_s = patience_s # how long to keep asking politely before giving up on one request + self.pause_s = pause_s # a fixed pause after every request, for a shared address + self.headers = dict(headers or {}) + self.quiet = quiet + self.session = None + self.server = None + self.requests_sent = 0 + self.times_asked_to_wait = 0 + self._id = 0 + + # -- transport ------------------------------------------------------------------------- + def _post(self, message): + body = json.dumps(message).encode() + headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream", + "User-Agent": "zero-trust-physics-environments/1.0", **self.headers} + if self.session: + headers["Mcp-Session-Id"] = self.session + request = urllib.request.Request(self.url, data=body, headers=headers, method="POST") + self.requests_sent += 1 + with urllib.request.urlopen(request, timeout=self.timeout_s) as response: + session = response.headers.get("Mcp-Session-Id") + if session: + self.session = session + raw = response.read().decode("utf-8") + kind = response.headers.get("Content-Type", "") + if "text/event-stream" in kind: + for line in raw.splitlines(): + if line.startswith("data:"): + found = json.loads(line[5:].strip()) + if found.get("id") == message.get("id"): + return found + raise McpError("the event stream held no answer to the request") + return json.loads(raw) if raw.strip() else {} + + def _ask(self, method, params=None): + """Send one request; on 429, a busy pool, a 5xx or a dropped connection, wait and send it again.""" + self._id += 1 + message = {"jsonrpc": "2.0", "id": self._id, "method": method} + if params is not None: + message["params"] = params + started, wait = time.time(), 2.0 + while True: + reason = None + try: + answer = self._post(message) + if "error" in answer: + raise McpError("protocol error: %s" % json.dumps(answer["error"])[:300]) + result = answer.get("result", {}) + text = "".join(c.get("text", "") for c in result.get("content", []) or []) + if method == "tools/call" and BUSY in text and len(text) < 400: + reason = "the physics pool is busy" + else: + if self.pause_s: + time.sleep(self.pause_s) + return result + except urllib.error.HTTPError as problem: + if problem.code == 429 or problem.code >= 500: + after = problem.headers.get("Retry-After") + reason = "HTTP %d" % problem.code + if after and after.isdigit(): + wait = max(wait, float(after)) + else: + raise McpError("HTTP %d: %s" % (problem.code, problem.read().decode("utf-8", "replace")[:300])) + except (urllib.error.URLError, TimeoutError, ConnectionError, OSError) as problem: + reason = "no connection (%s)" % problem + self.times_asked_to_wait += 1 + if time.time() - started + wait > self.patience_s: + raise McpError("gave up after %d s: %s" % (self.patience_s, reason)) + if not self.quiet: + print(" %s; asking again in %.0f s" % (reason, wait), flush=True) + time.sleep(wait) + wait = min(wait * 1.6, 30.0) + + # -- protocol -------------------------------------------------------------------------- + def connect(self): + result = self._ask("initialize", {"protocolVersion": "2025-06-18", "capabilities": {}, + "clientInfo": {"name": "zero-trust-physics-environments", "version": "1.0"}}) + self.server = result.get("serverInfo") + try: + self._post({"jsonrpc": "2.0", "method": "notifications/initialized"}) + except Exception: # a notification has no answer; some servers close without one + pass + return result + + def tools(self): + """The tool declarations exactly as the endpoint gives them.""" + return self._ask("tools/list").get("tools", []) + + def call(self, tool, arguments=None): + """Call one tool. Returns (text, is_error): the text of the answer and the MCP isError flag.""" + result = self._ask("tools/call", {"name": tool, "arguments": arguments or {}}) + text = "".join(c.get("text", "") for c in result.get("content", []) or []) + return text, bool(result.get("isError")) + + def call_json(self, tool, arguments=None): + """Call one tool. Returns (body, is_error): the parsed JSON, or the text when it is not JSON.""" + text, is_error = self.call(tool, arguments) + try: + return json.loads(text), is_error + except ValueError: + return text, is_error + + +class StdioVerifier(Verifier): + """The same interface over MCP stdio: a program started here that speaks JSON-RPC, one message a line. + For anyone who holds an MCP server as a program; the open address needs none of this.""" + + def __init__(self, command, timeout_s=600, **kwargs): + super().__init__(url="stdio: " + (command if isinstance(command, str) else " ".join(command)), timeout_s=timeout_s, **kwargs) + self.proc = subprocess.Popen(shlex.split(command) if isinstance(command, str) else command, + stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) + + def _post(self, message): + self.requests_sent += 1 + try: + self.proc.stdin.write((json.dumps(message) + "\n").encode()) + self.proc.stdin.flush() + except OSError: # a program that has stopped reading will not start again + try: + self.proc.stdin.close() + except OSError: + pass + raise McpError("the program stopped reading") + if "id" not in message: + return {} + while True: + ready, _, _ = select.select([self.proc.stdout], [], [], self.timeout_s) + if not ready: + raise McpError("no answer in %d s" % self.timeout_s) + line = self.proc.stdout.readline() + if not line: + raise McpError("the program closed its output") + found = json.loads(line) + if found.get("id") == message["id"]: + return found + + def close(self): + self.proc.terminate() + try: + self.proc.wait(timeout=5) + except subprocess.TimeoutExpired: + self.proc.kill() + + +def connect(endpoint=OPEN_ADDRESS, **kwargs): + """A connected verifier: an http(s) address, or "stdio:" for a program.""" + verifier = StdioVerifier(endpoint[len("stdio:"):].strip(), **kwargs) if endpoint.startswith("stdio:") else Verifier(endpoint, **kwargs) + verifier.connect() + return verifier diff --git a/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/task.toml b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..cc4adc304b93a4a015ca2fb36b2baf8d27338974 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/task.toml @@ -0,0 +1,40 @@ +schema_version = "1.4" +artifacts = ["/app/answer.json", "/app/calls.jsonl", "/logs/agent/trajectory.json", "/logs/agent/oracle.txt"] + +[task] +name = "protocol-company/g2-chain-sd-slab-radius-halfchar-h-r7" +version = "1.0.0" +description = "Chained design: a design whose sealed run is handed on, to the next run of the same model (from) or to the next model through a coupling, scored by computing the chain again." +authors = [{ name = "Protocol Company" }] +keywords = ["zero-trust-physics", "physics", "mcp", "tool-use", "verifier", "multi-step", "chained_design"] + +[metadata] +environment_id = "g2-chain-sd-slab-radius-halfchar-h-r7" +family = "chain_design" +kind = "chained_design" +engine_source = "https://github.com/johnkruze/zero-trust-physics-engine" +engine_tag = "v0.15.3" +engine_commit = "664d68f426ccdfd0159e5f91857edba3872390d1" +engine_binary_sha256 = "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076" +gateway_version = "0.15.3" +scores = ["correct", "proofs_hold"] + +[agent] +timeout_sec = 3600.0 + +[verifier] +timeout_sec = 900.0 +environment_mode = "separate" + +[environment] +build_timeout_sec = 1800.0 +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +workdir = "/app" + +[[environment.mcp_servers]] +name = "verifier" +transport = "stdio" +command = "/usr/local/bin/mcp_stdio" +args = [] diff --git a/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/Dockerfile b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..a455d9232114f3794e779f59ca8648029bb057f4 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/Dockerfile @@ -0,0 +1,11 @@ +# The grader's image: the task's tests at /tests and the verifier of release v0.15.3 as an MCP stdio server at +# /usr/local/bin/mcp_stdio (a bridge to its address). +FROM python:3.12-slim-bookworm +ARG ZTP_ENGINE_TAG=v0.15.3 +ARG ZTP_ENGINE_COMMIT=664d68f426ccdfd0159e5f91857edba3872390d1 +COPY ztp_open_bridge.py /usr/local/lib/ztp/ztp_open_bridge.py +RUN printf '#!/bin/sh\nexec python3 /usr/local/lib/ztp/ztp_open_bridge.py "${ZTP_VERIFIER_URL:-https://mcp.zerotrustphysics.com/mcp}"\n' > /usr/local/bin/mcp_stdio \ + && chmod +x /usr/local/bin/mcp_stdio +COPY . /tests +RUN mkdir -p /logs/verifier /logs/agent /logs/artifacts /app +WORKDIR /app diff --git a/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/environment.jsonl b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/environment.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..48e2b35aa02c6cdac463fe2dba405777a30fce09 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/environment.jsonl @@ -0,0 +1 @@ +{"id": "g2-chain-sd-slab-radius-halfchar-h-r7", "family": "chain_design", "kind": "chained_design", "models": ["aerospace/capsule_stardust", "ablator_slab"], "real_thing": "Entry of the Stardust sample return capsule on 15 January 2006, as a point mass with tabulated drag, no lift, no wind and a yearly standard atmosphere: altitude, speed through the air, Mach number, load, heat flux, and at the nose the stagnation pressure, recovery enthalpy and heat-transfer coefficient a heat shield takes, from entry interface to the drogue-deployment condition the radar recorded. Compared with NASA's reconstruction of the entry and the radar record of parachute opening: peak load 32.17 g against 32.89 g, within 0.72 g (target 3.64 g); the drogue altitude, 31.03 km, reached at 138.909 s and Mach 1.23 at 136.953 s against 137.9 s recorded, within 1.01 s (target 7.4 s). Gap: heat flux 696 W/cm2 against NASA's computed 762 to 1000; the yearly standard atmosphere in place of that morning's air is worth about 1 g of peak load either way. / A flat slab of charring heat-shield material heated on one face: wear, face temperature, depth of charring and the heat and mass accounts, for a PICA model built from the open record or the test material TACOT 3.0. Compared with 31 arc-jet tests outside the fit: wear within its target on 28 of 31 (target 25), mean \u22125.3 percent over all 31 (\u22122.6 over the 30 without the pure-nitrogen test; target within 8); hottest face within 7 percent on 24 of 28 (target 23); Stardust wear 7.58 and 3.32 mm against 5.7 and 3.2; fed by capsule_stardust through stardust_entry_to_pica_slab, nose wear 4.65 mm and face within 156 K RMS of the airborne spectra. Gap: the face runs 4.1 percent hot on average (target 3.5), and Stardust nose wear is a third high.", "task": "The Stardust sample return capsule enters the Earth's air with a radial speed of -2175.4 m/s (negative, downward) and a transverse speed of 12641.2 m/s, at a distance from the Earth's centre that you choose. Its heat shield's near-nose core is a slab of PICA, open record, version 3, 0.0434 m (43.4 mm) thick, starting at 281 K, heated by the capsule's own entry as the verifier hands it from the capsule's sealed run to the slab through their coupling, stardust_entry_to_pica_slab, radiating to surroundings at 294.4 K, and cooling with the stream off until 545 s.\n\nFind the largest starting distance from the Earth's centre, from 6482000 to 6494000 m, for which every constraint below holds. Give the passing design and the first failing design, no more than 12 m apart, and name the constraint that binds. The design that holds need not lie at either end of the range.\n\nConstraints (id (the request it is read from): what, limit):\n- half_char (solve): the depth at which the slab's density is half-way from char to virgin, in metres, at or below 0.0089922 m (8.9922 mm)\n- peak_load (run): the peak load on the capsule, in Earth g, over the whole entry, at or below 52.33 g\nEach design is two requests. The run of the capsule must end at the drogue-deployment condition (outcome ended, PastFlightDeployment). The run:\n{\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_stardust\", \"initial\": {\"radius_m\": \"\", \"radial_speed_m_s\": -2175.4, \"transverse_speed_m_s\": 12641.2}, \"dt_s\": 0.03125, \"segments\": [{\"steps\": \"\", \"load\": {}}], \"record_every\": 720}}\nThen the slab, a solve handed that run through the coupling, with these parameters:\n{\"tool\": \"solve\", \"arguments\": {\"solver\": \"ablator_slab\", \"parameters\": {\"material\": \"PICA, open record, version 3\", \"thickness_m\": 0.0434, \"start_temperature_k\": 281.0, \"face\": \"gas_stream\", \"stream_gas\": \"air\", \"surroundings_temperature_k\": 294.4, \"face_wears\": true}, \"from\": {\"request\": \"\", \"run_seal\": \"\", \"coupling\": \"stardust_entry_to_pica_slab\"}}}\nand its heating history laid out as the coupling's worked chain lays it: row 0 at 0 s with the first frame's pressure and enthalpy and a heat-transfer coefficient of 0; then one row per recorded frame, handed bit for bit (time, stagnation pressure, heat-transfer coefficient, recovery enthalpy); then a row 1 s after the last frame and a row at 545 s, each with the last frame's pressure and enthalpy and a heat-transfer coefficient of 0; a radiative heating of 0 in every row. thermocouple_depths_m and the return_ flags are yours to set. The run's record_every of 720 is the frames the coupling hands: keep it.\nThe run reports the largest and smallest of a quantity over all its steps when it is sent with \"readout\": {\"quantities\": [\"load_g\"]}; a readout is not part of the request or its seal, so the same run with or without one has one seal.\n\nBudget: at most 10 calls that compute, counted over every call you make, each run and each solve one call; list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. Every request on your card must be among your calls.", "check": {"design": {"variable": {"kind": "path", "on": "run", "path": "initial.radius_m", "words": "the capsule's distance from the Earth's centre at the start, in metres"}, "template": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": null, "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": 8000, "load": {}}], "record_every": 720}, "free": ["segments[0].steps"], "most_steps": 8000, "run_outcomes": ["ended"], "direction": "largest", "tolerance": 12.0, "units": "m", "range": [6482000.0, 6494000.0], "chain": {"solver": "ablator_slab", "coupling": "stardust_entry_to_pica_slab", "parameters": {"material": "PICA, open record, version 3", "thickness_m": 0.0434, "start_temperature_k": 281.0, "face": "gas_stream", "stream_gas": "air", "surroundings_temperature_k": 294.4, "face_wears": true, "thermocouple_depths_m": [], "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false}, "handed": ["history_time_s", "history_pressure_pa", "history_heat_transfer_coefficient_kg_per_m2_s", "history_flow_enthalpy_j_per_kg", "history_radiative_heating_w_per_m2", "thermocouple_depths_m", "return_face_history", "return_thermocouple_histories", "return_final_profile"], "layout": {"kind": "stardust_slab", "cool_to_s": 545.0}}}, "constraints": [{"id": "half_char", "on": "solve", "read": {"kind": "result", "quantity": "depth_half_way_to_virgin_m"}, "op": "<=", "words": "the depth at which the slab's density is half-way from char to virgin, in metres", "unit": "m", "limit": 0.0089922}, {"id": "peak_load", "on": "run", "read": {"kind": "extreme", "quantity": "load_g", "which": "maximum"}, "op": "<=", "words": "the peak load on the capsule, in Earth g, over the whole entry", "unit": "g", "limit": 52.33}], "budget": 10, "forbidden": ["find_flip", "design_run", "run_dataset", "validate_series"]}, "seed": {"kind": "g2_round7_0.15.3", "seed": 20261102055, "from": "g2-chain-sd-slab-radius-halfchar-h-r5", "note": "Rebuilt from g2-chain-sd-slab-radius-halfchar-h-r5 (0/3 on the calibrating model in round 5 at budget 8) with +1 reading (+2 computing calls -> budget 10); tolerance, template, constraints and engine v0.15.3 reference unchanged."}, "reference": {"boundary": 6488833.180236816, "binding": "half_char", "window_pattern": "..............HHHHHHHHH..................", "band": [6486200.0, 6488600.0], "near_pattern": "HHHHHHHHHHH..........", "passing": {"x": 6488829.580236817, "values": {"half_char": 0.008992161781351305, "peak_load": 49.5781877582101}, "run": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488829.580236817, "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": 8000, "load": {}}], "record_every": 720}, "run_seal": "1fa78aec5d3e09d24456d17b17ae3d5cbe4ad1d98f7f613fe5e80c1b855d017e435fb45dc30ed730eef198f5590ec173", "solve": {"solver": "ablator_slab", "parameters": {"material": "PICA, open record, version 3", "thickness_m": 0.0434, "start_temperature_k": 281.0, "face": "gas_stream", "stream_gas": "air", "surroundings_temperature_k": 294.4, "face_wears": true, "thermocouple_depths_m": [], "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false, "history_time_s": [0.0, 22.5, 45.0, 67.5, 90.0, 93.6875, 94.6875, 545.0], "history_pressure_pa": [5909.919921875, 5909.919921875, 42409.2421875, 6625.830078125, 2544.8134765625, 2450.75341796875, 2450.75341796875, 2450.75341796875], "history_heat_transfer_coefficient_kg_per_m2_s": [0.0, 0.058212701231241226, 0.1558331996202469, 0.06065985932946205, 0.03434406593441963, 0.03284108266234398, 0.0, 0.0], "history_flow_enthalpy_j_per_kg": [75923648.0, 75923648.0, 12139213.0, 541897.6875, 80255.8046875, 64982.50390625, 64982.50390625, 64982.50390625], "history_radiative_heating_w_per_m2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}, "from": {"request": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488829.580236817, "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": 8000, "load": {}}], "record_every": 720}, "run_seal": "1fa78aec5d3e09d24456d17b17ae3d5cbe4ad1d98f7f613fe5e80c1b855d017e435fb45dc30ed730eef198f5590ec173", "coupling": "stardust_entry_to_pica_slab"}}, "solution_seal": "8944591b390b2d9995dcb1a1be61b04f621892856ef97dcd58537f920d66d2e9ee56d3d8adb8c2adae41ed224478f86c", "next": null, "next_seal": null}, "failing": {"x": 6488836.780236816, "values": {"half_char": 0.00899223837130888, "peak_load": 49.57632648317198}, "run": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488836.780236816, "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": 8000, "load": {}}], "record_every": 720}, "run_seal": "abce34b40ba1868cb29f0015f8de509f678546c4dfaad17ae251df0486469b4bdac80244df56c2071b13c31c4db6d6db", "solve": {"solver": "ablator_slab", "parameters": {"material": "PICA, open record, version 3", "thickness_m": 0.0434, "start_temperature_k": 281.0, "face": "gas_stream", "stream_gas": "air", "surroundings_temperature_k": 294.4, "face_wears": true, "thermocouple_depths_m": [], "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false, "history_time_s": [0.0, 22.5, 45.0, 67.5, 90.0, 93.6875, 94.6875, 545.0], "history_pressure_pa": [5903.89697265625, 5903.89697265625, 42420.40234375, 6628.06396484375, 2545.021240234375, 2450.830078125, 2450.830078125, 2450.830078125], "history_heat_transfer_coefficient_kg_per_m2_s": [0.0, 0.05818302929401398, 0.15585379302501678, 0.0606706440448761, 0.03434683755040169, 0.032843057066202164, 0.0, 0.0], "history_flow_enthalpy_j_per_kg": [75926248.0, 75926248.0, 12148022.0, 542217.125, 80285.0625, 65003.5703125, 65003.5703125, 65003.5703125], "history_radiative_heating_w_per_m2": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]}, "from": {"request": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488836.780236816, "radial_speed_m_s": -2175.4, "transverse_speed_m_s": 12641.2}, "dt_s": 0.03125, "segments": [{"steps": 8000, "load": {}}], "record_every": 720}, "run_seal": "abce34b40ba1868cb29f0015f8de509f678546c4dfaad17ae251df0486469b4bdac80244df56c2071b13c31c4db6d6db", "coupling": "stardust_entry_to_pica_slab"}}, "solution_seal": "705c1b2d8ec16c133318905bc8e1d23ea9ab535153210729aec9c9942e18eaa2b52ace04dc2874d53b055d722fbcad6d", "next": null, "next_seal": null, "outcome": "ended", "stopped": null, "steps_landed": 2998}, "engine_source": "https://github.com/johnkruze/zero-trust-physics-engine", "engine_tag": "v0.15.3", "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1", "gateway_version": "0.15.3", "engine_binary_sha256": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076"}} diff --git a/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/grade.py b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/grade.py new file mode 100644 index 0000000000000000000000000000000000000000..88564e4e42982627e805eb8e50bd600ae052dd80 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/grade.py @@ -0,0 +1,272 @@ +"""Harbor glue: find the agent's reply and its calls, hand them to the dataset's score.py, write the reward. + +Standard library only. Every path can be moved with an environment variable, so the +same file runs outside a container: + + ZTP_TESTS_DIR this folder: environment.jsonl (and score.py, ztp_mcp.py) (default: where this file is) + ZTP_SCORER_DIR where score.py and ztp_mcp.py sit (default: ZTP_TESTS_DIR) + ZTP_ANSWER_FILE the card the instruction asks the agent to save (default /app/answer.json) + ZTP_CALLS_FILE a call log written by the oracle's solve.sh (default /app/calls.jsonl) + ZTP_ORACLE_LOG Harbor's log of the oracle agent's run (default /logs/agent/oracle.txt) + ZTP_TRAJECTORY_FILE Harbor's record of the run, in ATIF (default /logs/agent/trajectory.json) + ZTP_VERIFIER_DIR where the reward is written (default /logs/verifier) + ZTP_ENGINE the verifier, MCP over stdio (default /usr/local/bin/mcp_stdio) + ZTP_SCORE_TIMEOUT_S how long the scorer may take, in seconds (default 600) + +The reply, first found: the answer file when it is there and not empty (one JSON object over +several lines is put on one line first); else the last agent message with text in the +trajectory; else none, and the scorer gives 0. + +The calls, for every environment (a call budget, and a forensics answer, are scored on them): the agent's calls of the +verifier's own tools in the trajectory's agent steps, in order, by function name and arguments (mcp__verifier__solve is +read as solve). The agent's other tools (a shell, a file editor, writing /app/answer.json) are left out of the record: +they are not verifier calls and are not counted against a budget. When there is no trajectory file at all and Harbor's +oracle has run (its log /logs/agent/oracle.txt is there), the log solution/solve.sh wrote is read instead: the oracle +runs no model, so Harbor records no tool call for it. Any other run with no trajectory is scored with no call record, +and a budget or forensics answer then scores 0. + +The verifier is held to its release by what it answers (version 0.15.3, kernel genesis_kernel_v0.13.1); the binary's +sha256 is recorded on the score row. pack_score.py, beside score.py, holds that rule; --strict-binary is not used here +because this image builds the verifier from source, a different file from the served build. + +The reward, reward.json in ZTP_VERIFIER_DIR: {"reward": 0 or 1, "correct": 0 or 1, "proofs_hold": 0 or 1}. +reward is 1 only when both scores are 1. score.json holds the scorer's line (the reason for a 0). +If the scorer itself fails, no reward is written and this exits non-zero. +""" +import json +import os +import re +import signal +import subprocess +import sys +import tempfile + +TESTS = os.environ.get("ZTP_TESTS_DIR") or os.path.dirname(os.path.abspath(__file__)) +SCORER = os.environ.get("ZTP_SCORER_DIR") or TESTS +ANSWER = os.environ.get("ZTP_ANSWER_FILE") or "/app/answer.json" +CALLS = os.environ.get("ZTP_CALLS_FILE") or "/app/calls.jsonl" +TRAJECTORY = os.environ.get("ZTP_TRAJECTORY_FILE") or "/logs/agent/trajectory.json" +ORACLE_LOG = os.environ.get("ZTP_ORACLE_LOG") or "/logs/agent/oracle.txt" +OUT = os.environ.get("ZTP_VERIFIER_DIR") or "/logs/verifier" +ENGINE = os.environ.get("ZTP_ENGINE") or "/usr/local/bin/mcp_stdio" +TIMEOUT_S = float(os.environ.get("ZTP_SCORE_TIMEOUT_S") or 600) +SCORES = ("correct", "proofs_hold") + + +class ScorerFailed(Exception): + """The check could not be made. No reward is written.""" + + +def on_one_line(text): + try: + whole = json.loads(text) + except ValueError: + return text + if not isinstance(whole, dict): + return text + return re.sub(r"[\r\n]+", " ", text.strip()) + + +def text_of(message): + if isinstance(message, str): + return message + if isinstance(message, list): + return "\n".join(part.get("text") or "" for part in message if isinstance(part, dict) and part.get("type") == "text") + return "" + + +def trajectory_steps(): + try: + with open(TRAJECTORY, encoding="utf-8", errors="replace") as f: + return json.load(f).get("steps") or [] + except (OSError, ValueError, AttributeError, TypeError): + return [] + + +def find_reply(): + try: + with open(ANSWER, encoding="utf-8-sig", errors="replace") as f: + text = f.read() + if text.strip(): + return on_one_line(text), "the answer file %s" % ANSWER + except OSError: + pass + for step in reversed(trajectory_steps()): + if isinstance(step, dict) and step.get("source") == "agent" and text_of(step.get("message")).strip(): + return text_of(step["message"]), "the last agent message in %s" % TRAJECTORY + return None, "nowhere: no answer file and no agent message in a trajectory file" + + +def verifier_tool(name): + """The verifier's own name for a tool call (mcp__verifier__solve -> solve), or None for any other tool.""" + sys.path.insert(0, SCORER) + from score import VERIFIER_TOOLS, tool_name + tool = tool_name(name) + return tool if tool in VERIFIER_TOOLS else None + + +def find_calls(): + """(list of {"tool", "arguments"} or None, where they were found).""" + if os.path.isfile(TRAJECTORY): + calls, other = [], 0 + for step in trajectory_steps(): + if not isinstance(step, dict) or step.get("source") != "agent": + continue + for call in step.get("tool_calls") or []: + if not isinstance(call, dict): + continue + tool = verifier_tool(call.get("function_name")) + if tool is None: + other += 1 + continue + arguments = call.get("arguments") + if isinstance(arguments, str): + try: + arguments = json.loads(arguments) + except ValueError: + arguments = {} + calls.append({"tool": tool, "arguments": arguments if isinstance(arguments, dict) else {}}) + return calls, "%d verifier calls in %s (%d calls of other tools left out)" % (len(calls), TRAJECTORY, other) + if os.path.isfile(ORACLE_LOG): + try: + with open(CALLS, encoding="utf-8", errors="replace") as f: + logged = [json.loads(line) for line in f if line.strip()] + return logged, "the oracle's call log %s (no trajectory; %s is there)" % (CALLS, ORACLE_LOG) + except (OSError, ValueError): + return None, "nowhere: the oracle ran and wrote no call log" + return None, "nowhere: no trajectory file, and the oracle did not run" + + +def the_environment(): + path = os.path.join(TESTS, "environment.jsonl") + try: + with open(path, encoding="utf-8") as f: + rows = [json.loads(line) for line in f if line.strip()] + except (OSError, ValueError) as problem: + raise ScorerFailed("%s cannot be read: %s" % (path, problem)) + if len(rows) != 1 or not isinstance(rows[0], dict) or not isinstance(rows[0].get("id"), str): + raise ScorerFailed("%s does not hold exactly one environment" % path) + return rows[0], path + + +def verifier_answers(): + if ENGINE.startswith("http://") or ENGINE.startswith("https://"): + return "an MCP address, not asked here" + if not os.path.isfile(ENGINE): + raise ScorerFailed("there is no verifier at %s" % ENGINE) + sys.path.insert(0, SCORER) + try: + from ztp_mcp import StdioVerifier + verifier = StdioVerifier([ENGINE], timeout_s=60, patience_s=0) + try: + verifier.connect() + server = verifier.server + finally: + verifier.close() + except Exception as problem: + raise ScorerFailed("the verifier at %s did not answer as an MCP server: %s" % (ENGINE, problem)) + if not isinstance(server, dict) or not server.get("name"): + raise ScorerFailed("the program at %s answered and did not say what it is; it is not the verifier" % ENGINE) + return "%s %s" % (server.get("name"), server.get("version")) + + +def run_scorer(command): + environment = dict(os.environ, PYTHONIOENCODING="utf-8") + process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=environment, + encoding="utf-8", errors="replace", start_new_session=True) + try: + stdout, stderr = process.communicate(timeout=TIMEOUT_S) + except subprocess.TimeoutExpired: + try: + os.killpg(process.pid, signal.SIGKILL) + except OSError: + process.kill() + stdout, stderr = process.communicate() + return None, stdout, stderr + return process.returncode, stdout, stderr + + +def grade(log): + environment, environment_path = the_environment() + name = environment["id"] + reply, found = find_reply() + log.append("environment: %s" % name) + log.append("reply from: %s" % found) + log.append("verifier: %s (%s)" % (ENGINE, verifier_answers())) + with tempfile.TemporaryDirectory() as work: + replies = os.path.join(work, "replies") + os.mkdir(replies) + if reply is not None: + with open(os.path.join(replies, name + ".txt"), "w", encoding="utf-8") as f: + f.write(reply) + calls, where = find_calls() + log.append("calls from: %s" % where) + if calls is not None: + with open(os.path.join(replies, name + ".calls.jsonl"), "w", encoding="utf-8") as f: + for call in calls: + f.write(json.dumps(call) + "\n") + scores_path = os.path.join(work, "scores.jsonl") + score_py = os.path.join(SCORER, "score.py") + entry = os.path.join(SCORER, "pack_score.py") + command = [sys.executable, "-B", entry if os.path.isfile(entry) else score_py, replies, "--engine", ENGINE, + "--environments", environment_path, "--only", name, "--out", scores_path] + with open(score_py, encoding="utf-8") as f: + if "--calls-from" in f.read(): + # the call record here is the one this file found: Harbor's trajectory, or the oracle's log + command += ["--calls-from", "reply"] + code, stdout, stderr = run_scorer(command) + log.append("score.py exit: %s" % ("none, ended after %g s" % TIMEOUT_S if code is None else code)) + log.append("score.py stdout:\n%s" % stdout) + log.append("score.py stderr:\n%s" % stderr) + if code is None: + raise ScorerFailed("score.py did not finish in %g s" % TIMEOUT_S) + if code != 0: + raise ScorerFailed("score.py exited %d: %s" % (code, (stderr.strip().splitlines() or ["no message"])[-1])) + try: + with open(scores_path, encoding="utf-8") as f: + rows = [json.loads(line) for line in f if line.strip()] + except (OSError, ValueError) as problem: + raise ScorerFailed("score.py wrote no scores that can be read: %s" % problem) + if len(rows) != 1 or not isinstance(rows[0], dict) or rows[0].get("id") != name: + raise ScorerFailed("score.py did not write one line for %s" % name) + row = rows[0] + if any(type(row.get(score)) is not int or row[score] not in (0, 1) for score in SCORES): + raise ScorerFailed("score.py did not give %s as 0 or 1" % " and ".join(SCORES)) + row["reply_from"] = found + reward = {"reward": int(all(row[score] == 1 for score in SCORES))} + reward.update((score, row[score]) for score in SCORES) + if isinstance(row.get("graded"), (int, float)): + reward["graded"] = row["graded"] + return reward, row + + +def main(): + os.makedirs(OUT, exist_ok=True) + for name in ("reward.json", "reward.txt", "score.json"): + try: + os.remove(os.path.join(OUT, name)) + except OSError: + pass + log, failure = [], None + try: + reward, row = grade(log) + except ScorerFailed as problem: + failure = "the scorer failed, no reward written: %s" % problem + log.append(failure) + with open(os.path.join(OUT, "score.log"), "w", encoding="utf-8") as f: + f.write("\n".join(log) + "\n") + if failure: + sys.exit(failure) + with open(os.path.join(OUT, "score.json"), "w", encoding="utf-8") as f: + json.dump(row, f) + f.write("\n") + with open(os.path.join(OUT, "reward.json"), "w", encoding="utf-8") as f: + json.dump(reward, f) + f.write("\n") + print(json.dumps(reward)) + if row.get("reason"): + print(row["reason"].encode("ascii", "backslashreplace").decode("ascii")) + + +if __name__ == "__main__": + main() diff --git a/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/pack_score.py b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/pack_score.py new file mode 100644 index 0000000000000000000000000000000000000000..b41382aa52ca13dbeccd56097b08175a0fed19a2 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/pack_score.py @@ -0,0 +1,105 @@ +"""Cross-platform release-pinned scorer wrapper for Zero-Trust Physics packs (macOS arm64, Linux amd64, Linux arm64, HTTP). + + python3 pack_score.py REPLIES --engine ENGINE --environments F [score.py's options] [--strict-binary] + python3 pack_score.py --run run_cheat_suite.py [its options] [--strict-binary] + +Verifies that the target verifier answers MCP initialize as release 0.15.3 (matching reference.gateway_version and +engine_tag) on kernel genesis_kernel_v0.13.1, while recording engine_binary_sha256_seen and engine_binary_is_reference on +every score row. Pass --strict-binary to additionally require exact SHA-256 identity with reference.engine_binary_sha256. +All deterministic recomputation, seal, budget, and grading invariants of score.py apply unchanged. + +Standard library only. Licence: Apache-2.0. +""" +import inspect +import os +import re +import runpy +import sys + +HERE = os.path.dirname(os.path.abspath(__file__)) +if HERE not in sys.path: + sys.path.insert(0, HERE) + +KERNEL = "genesis_kernel_v0.13.1" +STRICT = False + + +def _kernel_of(replay): + """The kernel the verifier names: its serverInfo.description is the kernel's name (0.15.2), or one line that ends + with it ("... Cards: genesis_kernel_v0.13.1", 0.15.3).""" + server = getattr(getattr(replay, "verifier", None), "server", None) or {} + found = re.findall(r"genesis_kernel_v[0-9][0-9.]*[0-9]", server.get("description") or "") + return found[-1] if found else server.get("description") + + +def install(strict=False): + """Configure cross-platform release identity verification on score (idempotent). Returns the score module.""" + global STRICT + STRICT = bool(strict) + import score + if getattr(score, "_pack_engine_identity", False): + return score + original = score.engine_problem + original_score = score.score + + def engine_problem(env, replay): + ref = env.get("reference") or {} + want = ref.get("engine_binary_sha256") + seen = getattr(replay, "binary_sha256", None) + if STRICT or not (seen and want and seen != want): + return original(env, replay) + # a different file: held to the release by what it says it is, every other rule as score.py's + saved = replay.binary_sha256 + replay.binary_sha256 = None + try: + problem = original(env, replay) + finally: + replay.binary_sha256 = saved + if problem: + return problem + kernel = _kernel_of(replay) + if kernel != KERNEL: + return "the verifier reports kernel %s; release %s runs %s" % (kernel, replay.version, KERNEL) + return None + + def scored(env, reply, replay, *args, **kwargs): + row = original_score(env, reply, replay, *args, **kwargs) + if isinstance(row, dict): + want = (env.get("reference") or {}).get("engine_binary_sha256") + seen = getattr(replay, "binary_sha256", None) + row["engine_binary_sha256_seen"] = seen + row["engine_binary_is_reference"] = None if not seen else (seen == want) + return row + + # score.py may one day hold its own source-build rule; then it is left as it is + if "strict" in inspect.getsource(original).lower(): + return score + score.engine_problem = engine_problem + score.score = scored + score._pack_engine_identity = True + return score + + +def main(): + argv = sys.argv[1:] + strict = "--strict-binary" in argv + argv = [a for a in argv if a != "--strict-binary"] + if argv[:1] == ["--run"]: + if len(argv) < 2: + sys.exit("give the program: --run run_cheat_suite.py [options]") + program = argv[1] if os.path.isabs(argv[1]) or os.path.isfile(argv[1]) else os.path.join(HERE, argv[1]) + folder = os.path.dirname(os.path.abspath(program)) + if folder not in sys.path: + sys.path.insert(0, folder) + install(strict) + # a program that does `from score import score` takes the replaced function, as the module now holds it + sys.argv = [program] + argv[2:] + runpy.run_path(program, run_name="__main__") + return + score = install(strict) + sys.argv = [os.path.join(HERE, "score.py")] + argv + score.main() + + +if __name__ == "__main__": + main() diff --git a/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/score.py b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/score.py new file mode 100644 index 0000000000000000000000000000000000000000..4403f043313037d26927b89db218b4718ffcf3d2 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/score.py @@ -0,0 +1,1199 @@ +"""Score replies to the multi-step environments with no judge: a program and the verifier. + + python3 score.py REPLIES --engine ENGINE [--environments F] [--only id,id] [--out F] + [--calls-from reply|harness] [--harness-dir DIR] + + REPLIES is a folder with one file per environment, .txt, the whole text of a reply. + --calls-from harness the call record is the harness's own: .harness.jsonl, written by + harness/mcp_log_proxy.py outside the solver's working directory (in + --harness-dir, default REPLIES). A .calls.jsonl beside the reply, + when there is one, is read only to catch an edit: it must equal the + harness log call for call. + --calls-from reply (the earlier set's way) the call record is .calls.jsonl beside the reply: + one JSON object a line, {"tool": "", "arguments": {...}}. + + ENGINE is the verifier: the path to mcp_stdio (MCP over stdio, no network), or an MCP address + beginning http. A task is scored only on the engine it was built on: the verifier's version must + be the task's reference.gateway_version (engine_tag), and a local binary's SHA-256 the task's + reference.engine_binary_sha256. + +The answer card is one JSON object on the reply's last line. Its shape is the family's: + + tradeoff, chain_design (kind design_to_limit, chained_design) + {"passing": DESIGN, "failing": DESIGN, "binding": ""} + DESIGN = {"run": {"request": R, "proof": ""}, + "solve": {"request": R, "proof": ""}} (solve only where the task has one) + Where a constraint is that the run completes and it binds, the failing DESIGN also carries + "stopped": "" and "step": . R = {"tool": ..., "arguments": {...}} + The design shapes, one scorer for every group (check.design says which): + run a run alone. + coupled check.design.chain names a solver and coupling: the run, then a solve handed that sealed run. + continued check.design.chain.kind "continuation", or chain.layout.kind "continue": the run, then a run of + the same card that continues it through from, starting from its sealed final state, + DESIGN = {"run": {...}, "next": {"request": R, "proof": ""}}. The next run's template + is chain.next_template, chain.template or chain.next; its start fields are chain.carried + ({field: where the first run's answer holds it}), chain.handed (with chain.handed_from) or + chain.carry and chain.clock, each equal to the first run's answer bit for bit. A constraint on + "next" reads the next run, and a stop constraint judges it. + solve check.design.tool or check.design.kind "solve": DESIGN = {"solve": {...}}, one solve and no + run. A binding refusal is named ("stopped") with no step. + staged check.design.stages: DESIGN = {"": {"request": R, "proof": ...}, ...}, one entry per + stage in order; a later stage carries an earlier stage's answer at a named input (handed) or + continues an earlier run (continues), bit for bit. + A constraint's read may carry "index": one entry of an output the verifier returns as a list. + budget (kind budgeted_search) + {"holds": {"request": R, "proof": ""}, + "stops": {"request": R, "proof": "", "stopped": ""}} + forensics + {"false_rows": {"": "", ...}} ({} when every row is genuine) + +Every proof is verified on the verifier (verify_tape for a run_seal, verify_solution for a +solution_seal, short form) and every number judged is read from the verifier's own answer to the +card's request, sent again here, never from the reply. + +Scores per environment +---------------------- +reward 0 or 1, exactly as the earlier scorer: 1 only when correct and proofs_hold are both 1. + proofs_hold: every proof on the card verifies. correct: the card is the right answer and + nothing below under "integrity" failed. +graded in [0, 1], beside reward. + + Integrity (graded 0 and reward 0, whatever the answer): the card cannot be read; a proof does not + verify (a copied, nudged, edited or stale proof); a request differs from the task's template other + than at the design variable; a chained solve not handed its own design's sealed run; no call log; + a call log beside the reply that differs from the harness log; a harness log whose chain breaks; + a forbidden tool called; more computing calls than the budget; a request on the card that is not + among the calls; a forensics answer with no computing call behind it; a task built on another + engine than the verifier. + + tradeoff, chain_design, budget. With integrity held, the sides are judged on the verifier: the + passing design meets every constraint and the failing one breaks the named binding constraint + (budget: holds completes, stops ends with the task's stop, named on the card), on the side the + task asks for, inside its range, with any stop and step the card must name. Wrong sides score 0. + With the sides right: + + e = the length of the smallest interval holding both designs' values and the reference + boundary (for a bracket that straddles the boundary, its width) + tol = the task's tolerance (tradeoff, chain_design) or relative width x |boundary| (budget) + r = e / tol + graded = 1 when reward is 1 (r <= 1 and the bracket straddles it) + = 0.5 ** log10(r) when r > 1: each tenfold of looseness halves the score + (r 1.35 -> 0.914, 2 -> 0.811, 10 -> 0.5, 100 -> 0.25) + = 0.5 when r <= 1 but the bracket misses the reference boundary + by more than the slack (another crossing than the one asked) + + The decay is smooth and falls monotonically with r, and a near miss scores near the top. + + forensics. With integrity held, graded is F1 over the (row, reason) pairs: a row counts as found + only with its right reason. precision = found / named, recall = found / false rows; an empty + answer to a table with no false row scores 1. A card that names every row of the table false is + a blanket answer and scores 0, as do unknown rows and reasons outside the task's list. + +Licence: Apache-2.0. +""" +import argparse +import copy +import hashlib +import json +import math +import os +import re +import sys + +HERE = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, HERE) +from ztp_mcp import McpError, StdioVerifier, Verifier # noqa: E402 + +FAMILIES = ("tradeoff", "chain_design", "budget", "forensics") +KINDS = {"tradeoff": "design_to_limit", "chain_design": "chained_design", "budget": "budgeted_search", "forensics": "forensics"} +NOT_STOPPED = ("completed", "converged") +PREFIX_ENDS = ("__", ".", ":", "/") +VERIFIER_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite", + "run_trajectory", "compute_step", "verify_step", "design_run", "solve", "run_dataset", + "validate_series", "verify_tape", "verify_solution", "verify_dataset", "verify_receipt", "find_flip") +# Calls that read the catalogue compute nothing and are free in a call budget. +FREE_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite", "verify_receipt") +REASONS = ("value_altered", "seal_wrong", "flag_omitted", "retired_model", "stop_hidden") +GRADED_DECAY = 0.5 # graded = GRADED_DECAY ** log10(r) +OTHER_CROSSING = 0.5 # right sides, tight, around another crossing than the reference boundary + + +class Integrity(Exception): + """The answer cannot be trusted: graded 0 and reward 0.""" + + +class Wrong(Exception): + """The answer is trusted and wrong: graded 0 and reward 0.""" + + +def load_environments(path): + with open(path, encoding="utf-8") as f: + return [json.loads(line) for line in f if line.strip()] + + +def row_problems(env): + """What a task row lacks against the shared row contract (empty when none).""" + out = [] + for key in ("id", "family", "models", "real_thing", "task", "check", "seed", "reference"): + if key not in env: + out.append("no %s" % key) + family = env.get("family") + if family not in FAMILIES: + out.append("family %r" % family) + elif "kind" in env and env["kind"] != KINDS[family]: + out.append("kind %r for family %s (want %s)" % (env["kind"], family, KINDS[family])) + ref = env.get("reference") or {} + for key in ("engine_tag", "engine_commit", "engine_binary_sha256"): + if not ref.get(key): + out.append("reference.%s missing" % key) + return out + + +def file_sha256(path): + h = hashlib.sha256() + with open(path, "rb") as f: + for block in iter(lambda: f.read(1 << 20), b""): + h.update(block) + return h.hexdigest() + + +def open_verifier(engine): + if engine.startswith("http://") or engine.startswith("https://"): + verifier = Verifier(engine, pause_s=0.5) + verifier.binary_sha256 = None + else: + if not os.path.isfile(engine): + sys.exit("no file at %s: give the path to mcp_stdio, or an MCP address beginning http" % engine) + verifier = StdioVerifier([engine]) + verifier.binary_sha256 = file_sha256(engine) + try: + verifier.connect() + except McpError as problem: + sys.exit("the verifier failed, so nothing was scored: %s" % problem) + if not isinstance(verifier.server, dict) or not verifier.server.get("name"): + close_verifier(verifier) + sys.exit("the verifier failed, so nothing was scored: %s did not answer as an MCP server" % engine) + return verifier + + +def close_verifier(verifier): + if hasattr(verifier, "close"): + verifier.close() + + +# ------------------------------------------------------------------------------------------ +# reading the reply and the call logs +# ------------------------------------------------------------------------------------------ +def _no_constant(name): + raise ValueError("%s is not a number" % name) + + +def read_card(reply): + """(card, problem): the JSON object on the reply's last line. A closing code fence is passed over.""" + lines = [line.strip() for line in (reply or "").replace("\r", "\n").split("\n") if line.strip()] + while lines and lines[-1].startswith("```"): + lines.pop() + if not lines: + return None, "the reply is empty" + try: + card = json.loads(lines[-1], parse_constant=_no_constant) + except ValueError: + return None, "the last line is not one JSON object" + if not isinstance(card, dict): + return None, "the last line is not one JSON object" + return card, None + + +def tool_name(name): + """The verifier's own name for a tool an agent's program may have prefixed (mcp__zerotrust__solve).""" + if not isinstance(name, str): + return None + if name in VERIFIER_TOOLS: + return name + for tool in VERIFIER_TOOLS: + for joint in PREFIX_ENDS: + if name.endswith(joint + tool): + return tool + return name + + +def without_readout(arguments): + """A run's arguments as sealed: a readout is not part of a run's seal.""" + if not isinstance(arguments, dict): + return arguments + return {k: v for k, v in arguments.items() if k != "readout"} + + +def numbers_by_value(value): + """Every number as a float, so 18 and 18.0 (one request to the engine) compare equal; bools kept.""" + if isinstance(value, dict): + return {k: numbers_by_value(v) for k, v in value.items()} + if isinstance(value, list): + return [numbers_by_value(v) for v in value] + if isinstance(value, int) and not isinstance(value, bool): + return float(value) + return value + + +def canonical(arguments): + """A request's arguments as compared with the call log: no readout, keys sorted, numbers by value.""" + return json.dumps(numbers_by_value(without_readout(arguments)), sort_keys=True, separators=(",", ":")) + + +def _arguments(one): + arguments = one.get("arguments") + if isinstance(arguments, str): + try: + arguments = json.loads(arguments) + except ValueError: + arguments = {} + return arguments if isinstance(arguments, dict) else {} + + +def read_calls(path): + """Every call in a reply-side call log, [(tool, arguments)], or None when there is no log.""" + if not path or not os.path.isfile(path): + return None + calls = [] + with open(path, encoding="utf-8", errors="replace") as f: + for line in f: + line = line.strip() + if not line: + continue + try: + one = json.loads(line) + except ValueError: + continue + if isinstance(one, dict): + calls.append((tool_name(one.get("tool")), _arguments(one))) + return calls + + +def chain_of(previous, entry): + payload = json.dumps(entry, sort_keys=True, separators=(",", ":")) + return hashlib.sha384(((previous or "") + payload).encode("utf-8")).hexdigest() + + +def read_harness_log(path): + """(calls, problem) from a log written by harness/mcp_log_proxy.py. calls is None when there is no log; + problem names the first line whose chain does not follow (an edit, a line taken out or put in).""" + if not path or not os.path.isfile(path): + return None, None + calls, previous = [], None + with open(path, encoding="utf-8", errors="replace") as f: + for number_, line in enumerate(f, 1): + if not line.strip(): + continue + try: + entry = json.loads(line) + except ValueError: + return calls, "line %d of the harness log is not JSON" % number_ + if not isinstance(entry, dict) or "chain" not in entry: + return calls, "line %d of the harness log carries no chain" % number_ + chain = entry.pop("chain") + if chain != chain_of(previous, entry) or entry.get("seq") != len(calls) + 1: + return calls, "the harness log's chain breaks at line %d" % number_ + previous = chain + calls.append((tool_name(entry.get("tool")), _arguments(entry))) + return calls, None + + +def write_harness_log(path, calls): + """A chained log in the proxy's format, for tests and the cheat suite: calls [(tool, arguments)].""" + previous = None + with open(path, "w", encoding="utf-8") as f: + for seq, (tool, arguments) in enumerate(calls, 1): + entry = {"seq": seq, "jsonrpc_id": seq, "tool": tool, "arguments": arguments, "ts_request": None, + "ts_response": None, "duration_s": None, "response_sha384": None, "text_sha384": None, "is_error": False} + entry["chain"] = chain_of(previous, entry) + previous = entry["chain"] + f.write(json.dumps(entry, sort_keys=True) + "\n") + + +# ------------------------------------------------------------------------------------------ +# the verifier, asked again +# ------------------------------------------------------------------------------------------ +def stop_name_in(sentence): + names = re.findall(r"\(([A-Z][A-Za-z0-9]*[a-z][A-Za-z0-9]*)\)", sentence or "") + return names[-1] if names else None + + +class Replay: + """The verifier, with every answer remembered: the same request is sent once.""" + + def __init__(self, verifier): + self.verifier = verifier + self.seen = {} + server = getattr(verifier, "server", None) or {} + self.version = server.get("version") + self.binary_sha256 = getattr(verifier, "binary_sha256", None) + + def call(self, tool, arguments): + key = tool + "\x00" + json.dumps(arguments, sort_keys=True) + if key not in self.seen: + try: + self.seen[key] = self.verifier.call_json(tool, arguments) + except McpError as problem: + if not str(problem).startswith("protocol error"): + raise SystemExit("the verifier failed, so nothing was scored: %s" % problem) + self.seen[key] = ("the verifier did not take the request: %s" % problem, True) + return self.seen[key] + + def answer(self, tool, arguments, readout=None): + """One run or solve computed again: {"stopped", "outcome", "stop", "proof", "body"}.""" + arguments = copy.deepcopy(without_readout(arguments)) + if readout is not None and tool == "run_trajectory": + arguments["readout"] = readout + body, is_error = self.call(tool, arguments) + if is_error or not isinstance(body, dict): + sentence = body if isinstance(body, str) else json.dumps(body) + return {"stopped": True, "outcome": "stopped before computing", "stop": stop_name_in(sentence), + "proof": None, "body": None, "sentence": sentence} + outcome = body.get("outcome") + stopped = outcome not in NOT_STOPPED + return {"stopped": stopped, "outcome": outcome, "stop": body.get("reject") if stopped else None, + "proof": body.get("run_seal") or body.get("solution_seal"), "body": body, + "sentence": body.get("reject_detail")} + + def proof_holds(self, tool, arguments, proof): + """(holds, words): the card's seal verified by verify_tape or verify_solution, short form.""" + if not isinstance(proof, str) or not re.fullmatch(r"[0-9a-f]{96}", proof): + return False, "the proof is not a SHA-384 seal of 96 hex digits" + if tool == "run_trajectory": + body, is_error = self.call("verify_tape", {"request": without_readout(arguments), "run_seal": proof}) + elif tool == "solve": + body, is_error = self.call("verify_solution", {"request": arguments, "solution_seal": proof}) + else: + return False, "a proof is verified for run_trajectory or solve only, not %s" % tool + if is_error or not isinstance(body, dict): + return False, "the verifier would not verify it: %s" % (str(body)[:200]) + if body.get("holds") is True: + return True, None + return False, "the verifier says the seal does not hold (cause %s)" % body.get("cause") + + +def engine_problem(env, replay): + """None when the verifier is the engine the task was built on; else what differs.""" + ref = env.get("reference") or {} + tag = ref.get("gateway_version") or (ref.get("engine_tag") or "").lstrip("v") + if not tag: + return "the task names no engine it was built on" + if (ref.get("engine_tag") or "v" + tag).lstrip("v") != tag: + return "the task's engine_tag %s and gateway_version %s disagree" % (ref.get("engine_tag"), ref.get("gateway_version")) + if replay.version != tag: + return "the task was built on engine %s; the verifier is %s" % (tag, replay.version) + want = ref.get("engine_binary_sha256") + if replay.binary_sha256 and want and replay.binary_sha256 != want: + return "the verifier's binary is not the one the task was built on (sha256 %s..., want %s...)" % (replay.binary_sha256[:12], want[:12]) + return None + + +# ------------------------------------------------------------------------------------------ +# requests and their inputs +# ------------------------------------------------------------------------------------------ +_PART = re.compile(r"([A-Za-z_0-9]+)((?:\[\d+\])*)") + + +def get_path(obj, path): + here = obj + for part in path.split("."): + found = _PART.fullmatch(part) + if not found or not isinstance(here, dict) or found.group(1) not in here: + return None + here = here[found.group(1)] + for index in re.findall(r"\[(\d+)\]", found.group(2)): + if not isinstance(here, list) or int(index) >= len(here): + return None + here = here[int(index)] + return here + + +def set_path(obj, path, value): + parts = path.split(".") + here = obj + for i, part in enumerate(parts): + m = _PART.fullmatch(part) + name, idx = m.group(1), [int(k) for k in re.findall(r"\[(\d+)\]", m.group(2))] + last = i == len(parts) - 1 + if not idx: + if last: + here[name] = value + else: + here = here[name] + else: + here = here[name] + for j, k in enumerate(idx): + if last and j == len(idx) - 1: + here[k] = value + else: + here = here[k] + + +def number(value): + return isinstance(value, (int, float)) and not isinstance(value, bool) and math.isfinite(value) + + +def differs(template, given, free, where=""): + """The first place where a request differs from the task's, other than the free places. None when none.""" + if where in free: + return None + if isinstance(template, dict): + if not isinstance(given, dict): + return where or "the request" + for key in set(template) | set(given): + place = "%s.%s" % (where, key) if where else key + if place in free: + continue + if key not in given or key not in template: + return place + found = differs(template[key], given[key], free, place) + if found: + return found + return None + if isinstance(template, list): + if not isinstance(given, list) or len(given) != len(template): + return where + for index, (a, b) in enumerate(zip(template, given)): + found = differs(a, b, free, "%s[%d]" % (where, index)) + if found: + return found + return None + if number(template) and number(given): + return None if float(template) == float(given) else where + return None if template == given else where + + +def design_value(variable, run_arguments, solve_arguments, next_arguments=None): + """The design variable of one design, read from its requests (on: run, solve, or next, a continued run).""" + kind = variable["kind"] + if kind == "path": + on = variable.get("on", "run") + source = {"solve": solve_arguments, "next": next_arguments}.get(on, run_arguments) or {} + value = get_path(source, variable["path"]) + for place in variable.get("also") or []: + again = get_path(source, place) + if not (number(again) and number(value) and float(again) == float(value)): + return None + return float(value) if number(value) else None + if kind == "entry_angle_deg": + radial = get_path(run_arguments or {}, "initial.radial_speed_m_s") + transverse = get_path(run_arguments or {}, "initial.transverse_speed_m_s") + if not (number(radial) and number(transverse)) or transverse <= 0: + return None + speed = math.hypot(radial, transverse) + if abs(speed - variable["speed_m_s"]) > 1e-6 * variable["speed_m_s"]: + return None + return math.degrees(math.atan2(-radial, transverse)) + return None + + +def variable_places(variable): + if variable["kind"] == "entry_angle_deg": + return {"initial.radial_speed_m_s", "initial.transverse_speed_m_s"} + if variable["kind"] == "path" and variable.get("on", "run") == "run": + return {variable["path"]} | set(variable.get("also") or []) + return set() + + +def read_value(read, answer): + """One number from a replayed answer: final, result, or the extreme of a run's readout.""" + body = answer["body"] + if body is None: + return None + kind = read["kind"] + value = None + if kind == "final": + value = (body.get("final_state") or {}).get(read["quantity"]) + elif kind == "result": + value = (body.get("result") or {}).get(read["quantity"]) + elif kind == "flag_extent": + # an advisory flag the run raised, at its largest extent; 0 when the run does not raise it + value = max([x.get("extent") or 0.0 for x in body.get("exceedance_extremes") or [] + if isinstance(x, dict) and x.get("flag") == read["quantity"]] or [0.0]) + elif kind == "extreme": + for quantity in (body.get("readout") or {}).get("quantities") or []: + if quantity.get("quantity") == read["quantity"]: + value = quantity.get(read["which"]) + if "index" in read: + # one entry of an output the verifier returns as a list (a hose's modes, a solve asked at several points) + k = read["index"] + value = value[k] if isinstance(value, list) and isinstance(k, int) and -len(value) <= k < len(value) else None + return value if number(value) else None + + +def readout_for(constraints, on="run"): + """The readout a run is sent with: the extremes its constraints read (on: run, next, or a stage key).""" + quantities = sorted({c["read"]["quantity"] for c in constraints if c["on"] == on and c["read"]["kind"] == "extreme"}) + return {"quantities": quantities} if quantities else None + + +def design_shape(spec): + """Which of the design shapes a task's check.design is: run, coupled, continued, solve or staged.""" + if spec.get("stages"): + return "staged" + if spec.get("tool") == "solve" or spec.get("kind") == "solve": + return "solve" + chain = spec.get("chain") or {} + if chain.get("kind") == "continuation" or (chain.get("layout") or {}).get("kind") == "continue": + return "continued" + return "coupled" if chain else "run" + + +def continuation_of(spec): + """A continued design's chain in one form: (next template, {start field: where the first run's answer holds it}, + next outcomes, the next run's places that also hold a first-run design value).""" + chain = spec["chain"] + template = chain.get("next_template") or chain.get("template") or chain.get("next") + if "carried" in chain: # group 1 + carried = dict(chain["carried"]) + elif "handed" in chain: # group 4 + named = chain.get("handed_from") or {} + carried = {k: "final_state." + named.get(k, k) for k in chain["handed"]} + else: # group 5 + carried = {k: "final_state." + k for k in chain.get("carry") or []} + if chain.get("clock"): + carried[chain["clock"]["field"]] = "final_state." + chain["clock"]["from"] + outcomes = chain.get("next_outcomes") or spec["run_outcomes"] + return template, carried, outcomes, list(chain.get("next_also") or []) + + +def meets(constraint, value): + if value is None: + return False + return value <= constraint["limit"] if constraint["op"] == "<=" else value >= constraint["limit"] + + +def history_layout_problem(layout, parameters, frames_count): + """None when the arrays of a chained solve are laid out as the task states; else what is not.""" + if layout is None: + return None + if layout["kind"] == "stardust_slab": + names = ("history_time_s", "history_pressure_pa", "history_heat_transfer_coefficient_kg_per_m2_s", + "history_flow_enthalpy_j_per_kg", "history_radiative_heating_w_per_m2") + columns = [parameters.get(name) for name in names] + if not all(isinstance(c, list) and all(number(v) for v in c) for c in columns): + return "the history columns are not all lists of numbers" + time, pressure, coefficient, enthalpy, radiative = columns + rows = frames_count + 3 + if any(len(c) != rows for c in columns): + return "the history has not one row before the %d frames handed and two after them" % frames_count + if time[0] != 0.0 or coefficient[0] != 0.0: + return "row 0 is not at 0 s with no heating" + if pressure[0] != pressure[1] or enthalpy[0] != enthalpy[1]: + return "row 0 does not repeat the first frame's pressure and enthalpy" + if abs(time[-2] - (time[-3] + 1.0)) > 1e-9 or time[-1] != layout["cool_to_s"]: + return "the rows after the frames are not at 1 s after the last frame and at %g s" % layout["cool_to_s"] + if coefficient[-2] != 0.0 or coefficient[-1] != 0.0: + return "the stream is not off after the frames" + if pressure[-1] != pressure[-3] or pressure[-2] != pressure[-3] or enthalpy[-1] != enthalpy[-3] or enthalpy[-2] != enthalpy[-3]: + return "the rows after the frames do not hold the last frame's pressure and enthalpy" + if any(v != 0.0 for v in radiative): + return "a row of the history holds radiative heating" + return None + if layout["kind"] == "triga_element": + return None # every array is handed by the coupling and held to its bits by the verifier + return "an unknown layout" + + +# ------------------------------------------------------------------------------------------ +# the call record +# ------------------------------------------------------------------------------------------ +def card_requests(env, card): + """Every request on the card, [(tool, arguments)], read leniently (for the call log).""" + out = [] + + def take(part): + if isinstance(part, dict) and isinstance(part.get("request"), dict) and isinstance(part["request"].get("arguments"), dict): + out.append((tool_name(part["request"].get("tool")), part["request"]["arguments"])) + + if env["family"] in ("tradeoff", "chain_design"): + stages = [s["key"] for s in (env["check"].get("design") or {}).get("stages") or []] + for side in ("passing", "failing"): + design = card.get(side) if isinstance(card.get(side), dict) else {} + for key in stages or ("run", "solve", "next"): + take(design.get(key)) + elif env["family"] == "budget": + take(card.get("holds")) + take(card.get("stops")) + return out + + +def sequence(calls): + return [(tool_name(t), json.dumps(numbers_by_value(a), sort_keys=True)) for t, a in calls] + + +def call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row): + """None when the call record holds; else why not (an integrity failure).""" + check = env["check"] + if calls_from == "harness": + if calls is None: + return "no harness call log: every attempt is scored with the calls the harness recorded" + if log_problem: + return log_problem + if reply_calls is not None and sequence(reply_calls) != sequence(calls): + return "the call log beside the reply differs from the harness log" + elif calls is None: + return "no call log: every environment is scored with the agent's calls" + calls = [(tool_name(t), a) for t, a in calls] + banned = sorted({t for t, _ in calls if t in (check.get("forbidden") or [])}) + if banned: + return "the log holds calls of %s, which the task rules out" % ", ".join(banned) + computing = [(t, a) for t, a in calls if t not in FREE_TOOLS] + row["computing_calls"] = len(computing) + if check.get("budget") and len(computing) > check["budget"]: + return "%d computing calls; the budget is %d" % (len(computing), check["budget"]) + sent = {(t, canonical(a)) for t, a in computing} + for tool, arguments in card_requests(env, card): + if (tool, canonical(arguments)) not in sent: + return "a %s request on the card is not among the calls in the log" % tool + if env["family"] == "forensics" and not computing: + return "no computing call behind the answer: the table was not put to the verifier" + return None + + +# ------------------------------------------------------------------------------------------ +# the families +# ------------------------------------------------------------------------------------------ +def request_of(part, tool, what): + """The arguments of one request on the card (Integrity when it is not one).""" + if not isinstance(part, dict): + raise Integrity("%s is missing" % what) + request = part.get("request") + if not (isinstance(request, dict) and isinstance(request.get("arguments"), dict)): + raise Integrity("%s has no request {\"tool\": ..., \"arguments\": {...}}" % what) + if tool_name(request.get("tool")) != tool: + raise Integrity("%s is a request of %s, not %s" % (what, request.get("tool"), tool)) + return request["arguments"] + + +def score_design(env, design, which, replay, proofs): + """One design of a boundary family: facts {x, met, values, stopped, steps_landed}.""" + check = env["check"] + spec = check["design"] + shape = design_shape(spec) + if shape in ("solve", "staged", "continued") and not isinstance(design, dict): + raise Integrity("the %s design is missing" % which) + if shape == "solve": + return score_solve_design(env, design, which, replay, proofs) + if shape == "staged": + return score_staged_design(env, design, which, replay, proofs) + if shape == "continued": + return score_continued_design(env, design, which, replay, proofs) + chain = spec.get("chain") + run_args = request_of((design or {}).get("run") if isinstance(design, dict) else None, "run_trajectory", + "the %s design's run" % which) + free = set(spec.get("free") or []) | variable_places(spec["variable"]) + where = differs(spec["template"], without_readout(run_args), free) + if where: + raise Integrity("the %s design's run differs from the task's at %s" % (which, where)) + for place in spec.get("free") or []: + if place.endswith(".steps"): + steps = get_path(run_args, place) + if not (isinstance(steps, int) and not isinstance(steps, bool) and 1 <= steps <= spec.get("most_steps", 10 ** 7)): + raise Integrity("the %s design's run has no whole number of steps at %s" % (which, place)) + run_proof = design["run"].get("proof") + holds, words = replay.proof_holds("run_trajectory", run_args, run_proof) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's run_seal: %s" % (which, words)) + run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"])) + stop_names = [c["stop"] for c in check["constraints"] if c["on"] == "outcome"] + stopped_by_name = run["outcome"] == "refused" and run["stop"] in stop_names + if run["outcome"] not in spec["run_outcomes"] and not stopped_by_name: + raise Wrong("the %s design's run comes back %s%s, not %s" % ( + which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"]))) + solve_args, solve = None, None + if chain: + solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which) + if solve_args.get("solver") != chain["solver"]: + raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver"))) + handed = solve_args.get("from") + if not isinstance(handed, dict) or handed.get("coupling") != chain["coupling"]: + raise Integrity("the %s design's solve is not handed its run through the coupling %s" % (which, chain["coupling"])) + if canonical(handed.get("request")) != canonical(run_args) or handed.get("run_seal") != run_proof: + raise Integrity("the %s design's solve is not handed the design's own sealed run" % which) + parameters = solve_args.get("parameters") + if not isinstance(parameters, dict): + raise Integrity("the %s design's solve has no parameters" % which) + solve_free = set(chain.get("handed") or []) + if spec["variable"]["kind"] == "path" and spec["variable"].get("on") == "solve": + solve_free.add(spec["variable"]["path"].split(".", 1)[1]) + where = differs(chain["parameters"], parameters, solve_free) + if where: + raise Integrity("the %s design's solve differs from the task's at parameters.%s" % (which, where)) + frames = len((run["body"] or {}).get("frames") or []) + problem = history_layout_problem(chain.get("layout"), parameters, frames) + if problem: + raise Integrity("the %s design's solve: %s" % (which, problem)) + holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's solution_seal: %s" % (which, words)) + solve = replay.answer("solve", solve_args) + if solve["outcome"] != "converged": + raise Wrong("the %s design's solve comes back %s%s, not converged" % ( + which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else "")) + x = design_value(spec["variable"], run_args, solve_args) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, spec["variable"].get("words", ""))) + met, values = {}, {} + for constraint in check["constraints"]: + if constraint["on"] == "outcome": + values[constraint["id"]] = run["outcome"] if not run["stop"] else "%s (%s)" % (run["outcome"], run["stop"]) + met[constraint["id"]] = not (run["outcome"] == "refused" and run["stop"] == constraint["stop"]) + continue + value = read_value(constraint["read"], run if constraint["on"] == "run" else solve) + values[constraint["id"]] = value + met[constraint["id"]] = meets(constraint, value) + facts = {"x": x, "met": met, "values": values} + if run["outcome"] not in NOT_STOPPED and run["body"]: + facts["stopped"], facts["steps_landed"] = run["stop"], run["body"].get("steps_landed") + return facts + + +def halted(answer, stop, staged=False): + """True when an answer is stopped by the stop named: a refusal ("refused"); for a staged design, any outcome that + is not completed or converged (group 3's rule, kept as built).""" + if staged: + return answer["outcome"] not in NOT_STOPPED and answer["stop"] == stop + return answer["outcome"] == "refused" and answer["stop"] == stop + + +def constraint_facts(check, answers, judged, staged=False): + """met and values of every constraint: each read from the answer its "on" names (answers: {on: answer}); a stop + constraint ("on": "outcome") is judged on the answer judged, or on its stage's answer for a staged design.""" + met, values = {}, {} + for c in check["constraints"]: + if c["on"] == "outcome": + a = answers.get(c["stage"]) if c.get("stage") else judged + values[c["id"]] = None if a is None else (a["outcome"] if not a["stop"] else "%s (%s)" % (a["outcome"], a["stop"])) + met[c["id"]] = a is not None and not halted(a, c["stop"], staged) + continue + a = answers.get(c["on"]) + value = read_value(c["read"], a) if a is not None else None + values[c["id"]] = value + met[c["id"]] = meets(c, value) if c.get("limit") is not None else None + return met, values + + +def stopped_by(answer, constraints, stage=None): + """True when an answer is stopped by a stop one of the task's stop constraints names (for the stage given).""" + return any(halted(answer, c["stop"], stage is not None) for c in constraints + if c["on"] == "outcome" and (stage is None or c.get("stage") == stage)) + + +def score_solve_design(env, design, which, replay, proofs): + """One design that is one solve and no run (check.design.tool or kind "solve").""" + check = env["check"] + spec = check["design"] + var = spec["variable"] + solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which) + if solve_args.get("solver") != spec["template"].get("solver"): + raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver"))) + free = set(spec.get("free") or []) | {var["path"]} | set(var.get("also") or []) + where = differs(spec["template"], solve_args, free) + if where: + raise Integrity("the %s design's solve differs from the task's at %s" % (which, where)) + holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's solution_seal: %s" % (which, words)) + solve = replay.answer("solve", solve_args) + if solve["outcome"] not in spec["run_outcomes"] and not stopped_by(solve, check["constraints"]): + raise Wrong("the %s design's solve comes back %s%s, not %s" % ( + which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else "", " or ".join(spec["run_outcomes"]))) + x = design_value(dict(var, on="solve"), None, solve_args) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", ""))) + met, values = constraint_facts(check, {"solve": solve}, solve) + facts = {"x": x, "met": met, "values": values} + if solve["outcome"] not in NOT_STOPPED and solve["body"]: + facts["stopped"], facts["steps_landed"], facts["no_step"] = solve["stop"], None, True + return facts + + +def score_continued_design(env, design, which, replay, proofs): + """One design of a run and the run that continues it through from. The verifier holds the hand-off: it computes + the first run again, compares its seal and refuses a start that is not the first run's final state; the scorer + also holds each carried start field to the first run's answer, bit for bit.""" + check = env["check"] + spec = check["design"] + var = spec["variable"] + on_next = var["kind"] == "path" and var.get("on") == "next" + template, carried, next_outcomes, next_also = continuation_of(spec) + run_args = request_of(design.get("run"), "run_trajectory", "the %s design's run" % which) + free = set(spec.get("free") or []) | (set() if on_next else variable_places(var)) + where = differs(spec["template"], without_readout(run_args), free) + if where: + raise Integrity("the %s design's run differs from the task's at %s" % (which, where)) + run_proof = design["run"].get("proof") + holds, words = replay.proof_holds("run_trajectory", run_args, run_proof) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's run_seal: %s" % (which, words)) + run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"], "run")) + if run["outcome"] not in spec["run_outcomes"]: + raise Wrong("the %s design's first run comes back %s%s, not %s" % ( + which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"]))) + next_args = request_of(design.get("next"), "run_trajectory", "the %s design's next run" % which) + handed = next_args.get("from") + if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(run_args) + or handed.get("run_seal") != run_proof): + raise Integrity("the %s design's next run does not continue the design's own sealed run (from)" % which) + next_free = {"initial." + name for name in carried} | {"from"} | set(next_also) + if on_next: + next_free |= {var["path"]} | set(var.get("also") or []) + where = differs(template, without_readout(next_args), next_free) + if where: + raise Integrity("the %s design's next run differs from the task's at %s" % (which, where)) + start = next_args.get("initial") if isinstance(next_args.get("initial"), dict) else {} + for name, source in carried.items(): + held, given = get_path(run["body"] or {}, source), start.get(name) + if name not in start or not (given == held or (number(given) and number(held) and float(given) == float(held))): + raise Integrity("the %s design's next run does not start from its run's %s, bit for bit" % (which, source)) + holds, words = replay.proof_holds("run_trajectory", next_args, design["next"].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's next run_seal: %s" % (which, words)) + nxt = replay.answer("run_trajectory", next_args, readout_for(check["constraints"], "next")) + if nxt["outcome"] not in next_outcomes and not stopped_by(nxt, check["constraints"]): + raise Wrong("the %s design's next run comes back %s%s, not %s" % ( + which, nxt["outcome"], " (%s)" % nxt["stop"] if nxt["stop"] else "", " or ".join(next_outcomes))) + x = design_value(var, run_args, None, next_args) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", ""))) + for place in next_also: + again = get_path(next_args, place) + if not (number(again) and float(again) == float(x)): + raise Integrity("the %s design's next run does not hold the design value at %s" % (which, place)) + met, values = constraint_facts(check, {"run": run, "next": nxt}, nxt) + facts = {"x": x, "met": met, "values": values} + if nxt["outcome"] not in NOT_STOPPED and nxt["body"]: + facts["stopped"], facts["steps_landed"] = nxt["stop"], nxt["body"].get("steps_landed") + return facts + + +def build_stage_request(spec, stage, x, answers, requests): + """One stage's request of a staged design at x: the template, x at the variable's places, the values handed from + earlier stages' answers, and a continuation's start and from (used by run_reference.py).""" + q = copy.deepcopy(stage["template"]) + var = spec["variable"] + if var.get("stage") == stage["key"]: + for place in [var["path"]] + list(var.get("also") or []): + set_path(q, place, x) + for h in stage.get("handed") or []: + set_path(q, h["to"], read_value(h["read"], answers[h["from"]])) + if stage.get("continues"): + parent = stage["continues"] + final = answers[parent]["body"]["final_state"] + q["initial"] = {k: final[k] for k in stage["template"]["initial"]} + q["from"] = {"request": copy.deepcopy(requests[parent]), "run_seal": answers[parent]["proof"]} + return q + + +def score_staged_design(env, design, which, replay, proofs): + """One staged design (check.design.stages): each stage a run or a solve, in order.""" + check = env["check"] + spec = check["design"] + var = spec["variable"] + stages = spec["stages"] + answers, requests, facts = {}, {}, {} + for i, stage in enumerate(stages): + key, tool = stage["key"], stage["tool"] + sent = without_readout(request_of(design.get(key), tool, "the %s design's %s" % (which, key))) + free = set(stage.get("free") or []) | {h["to"] for h in stage.get("handed") or []} + if var.get("stage") == key: + free |= {var["path"]} | set(var.get("also") or []) + if stage.get("continues"): + free |= {"initial", "from"} + where = differs(stage["template"], sent, free) + if where: + raise Integrity("the %s design's %s differs from the task's at %s" % (which, key, where)) + for h in stage.get("handed") or []: + want = read_value(h["read"], answers[h["from"]]) + got = get_path(sent, h["to"]) + if want is None or not number(got) or float(got) != float(want): + raise Integrity("the %s design's %s does not carry %s's %s at %s, bit for bit" % ( + which, key, h["from"], h["read"]["quantity"], h["to"])) + if stage.get("continues"): + parent = stage["continues"] + handed = sent.get("from") + if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(requests[parent]) + or handed.get("run_seal") != design[parent].get("proof")): + raise Integrity("the %s design's %s does not continue the design's own sealed %s run (from)" % (which, key, parent)) + final = (answers[parent]["body"] or {}).get("final_state") or {} + start = sent.get("initial") + keys = set(stage["template"]["initial"]) + if not isinstance(start, dict) or set(start) != keys or any( + not number(start[k]) or float(start[k]) != final.get(k) for k in keys): + raise Integrity("the %s design's %s does not start from the final state of its %s run, bit for bit" % (which, key, parent)) + holds, words = replay.proof_holds(tool, sent, design[key].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's %s proof: %s" % (which, key, words)) + answer = replay.answer(tool, sent, readout_for(check["constraints"], key) if tool == "run_trajectory" else None) + named = stopped_by(answer, check["constraints"], stage=key) + if answer["outcome"] not in stage["outcomes"] and not named: + raise Wrong("the %s design's %s comes back %s%s, not %s" % ( + which, key, answer["outcome"], " (%s)" % answer["stop"] if answer["stop"] else "", " or ".join(stage["outcomes"]))) + answers[key], requests[key] = answer, sent + if named: + facts["stopped"], facts["stopped_stage"] = answer["stop"], key + facts["steps_landed"] = (answer["body"] or {}).get("steps_landed") if tool == "run_trajectory" else None + facts["no_step"] = tool != "run_trajectory" + if i != len(stages) - 1: + raise Wrong("the %s design's %s stops (%s) before its last stage" % (which, key, answer["stop"])) + x = design_value(dict(var, on="run"), requests.get(var["stage"]), None) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", ""))) + met, values = constraint_facts(check, answers, None, staged=True) + facts.update({"x": x, "met": met, "values": values}) + return facts + + +def grade_bracket(a, b, star, tol, slack, row): + """(reward_ok, graded) for a bracket [a, b] with its sides right.""" + width = abs(b - a) + straddles = min(a, b) - slack <= star <= max(a, b) + slack + within = width <= tol * (1 + 1e-9) + e = max(a, b, star) - min(a, b, star) + r = e / tol if tol > 0 else float("inf") + row["width"], row["width_ratio"] = width, r + if within and straddles: + return True, 1.0 + if r <= 1: + return False, OTHER_CROSSING + return False, GRADED_DECAY ** math.log10(r) + + +def score_boundary(env, card, replay, row, proofs): + check, reference = env["check"], env["reference"] + passing = score_design(env, card.get("passing"), "passing", replay, proofs) + failing = score_design(env, card.get("failing"), "failing", replay, proofs) + row["passing"], row["failing"] = passing, failing + span = check["design"].get("range") + if span and not all(span[0] <= x <= span[1] for x in (passing["x"], failing["x"])): + raise Wrong("a design lies outside the range the task states, %g to %g" % tuple(span)) + broken = [c for c, ok in passing["met"].items() if not ok] + if broken: + raise Wrong("the passing design breaks %s" % ", ".join(broken)) + broken = [c for c, ok in failing["met"].items() if not ok] + if not broken: + raise Wrong("the failing design meets every constraint") + binding = card.get("binding") + if binding != reference["binding"]: + raise Wrong("binding names %r; the constraint that binds is another" % (binding,)) + if binding not in broken: + raise Wrong("the failing design does not break %s, the constraint named binding" % binding) + if binding in [c["id"] for c in check["constraints"] if c["on"] == "outcome"]: + said = card.get("failing") or {} + if said.get("stopped") != failing.get("stopped"): + raise Wrong("the failing design's run stops with %s; the card says %r" % (failing.get("stopped"), said.get("stopped"))) + if failing.get("no_step"): + pass # a solve that is refused has no step: its stop's name is stated + elif not (isinstance(said.get("step"), int) and not isinstance(said.get("step"), bool) and said["step"] == failing.get("steps_landed")): + raise Wrong("the failing design's run is sealed to step %s; the card says %r" % (failing.get("steps_landed"), said.get("step"))) + spec = check["design"] + xp, xf = passing["x"], failing["x"] + if spec["direction"] == "largest" and not xf > xp: + raise Wrong("the task asks for the largest value that holds: the failing design must lie above the passing one") + if spec["direction"] == "smallest" and not xf < xp: + raise Wrong("the task asks for the smallest value that holds: the failing design must lie below the passing one") + ok, graded = grade_bracket(xp, xf, reference["boundary"], spec["tolerance"], spec["tolerance"] * 0.5, row) + if not ok: + return graded, "the two designs are %.6g apart; the task asks for %.6g or less, and they must straddle the boundary" % ( + abs(xf - xp), spec["tolerance"]) + return 1.0, None + + +def score_budget(env, card, replay, row, proofs): + check, reference = env["check"], env["reference"] + template, path, tool = check["template"], check["variable"], check["tool"] + sides = {} + for side in ("holds", "stops"): + arguments = request_of(card.get(side), tool, side) + also = check.get("also") or [] + where = differs(template, without_readout(arguments), {path} | set(also)) + if where: + raise Integrity("the %s request differs from the task's at %s" % (side, where)) + x = get_path(arguments, path) + if not number(x): + raise Integrity("the %s request has no number at %s" % (side, path)) + for place in also: + again = get_path(arguments, place) + if not (number(again) and float(again) == float(x)): + raise Integrity("the %s request does not hold the same value at %s as at %s" % (side, place, path)) + holds, words = replay.proof_holds(tool, arguments, card[side].get("proof")) + proofs.append(holds) + sides[side] = (float(x), arguments, holds, words) + for side in ("holds", "stops"): + if not sides[side][2]: + raise Integrity("the %s seal: %s" % (side, sides[side][3])) + held = replay.answer(tool, sides["holds"][1]) + stopped = replay.answer(tool, sides["stops"][1]) + row["holds_outcome"], row["stops_outcome"] = held["outcome"], "%s (%s)" % (stopped["outcome"], stopped["stop"]) + if held["outcome"] not in NOT_STOPPED: + raise Wrong("the holds request comes back %s (%s)" % (held["outcome"], held["stop"])) + if stopped["stop"] != check["stop"]: + raise Wrong("the stops request comes back %s (%s), not the stop %s" % (stopped["outcome"], stopped["stop"], check["stop"])) + if card["stops"].get("stopped") != check["stop"]: + raise Wrong("the card names the stop %r; the verifier names %s" % (card["stops"].get("stopped"), check["stop"])) + xh, xs = sides["holds"][0], sides["stops"][0] + star = reference["boundary"] + row["holds_value"], row["stops_value"] = xh, xs + tol = check["relative_width"] * abs(star) + ok, graded = grade_bracket(xh, xs, star, tol, 1e-9 * abs(star), row) + if not ok: + return graded, "the bracket is %.6g wide; the task asks for %.3g of the value or less, and it must hold the stop" % ( + abs(xs - xh), check["relative_width"]) + return 1.0, None + + +def forensics_f1(env, named): + """(graded, problem): F1 over (row, reason) pairs; problem when the card is not a usable answer.""" + if not isinstance(named, dict): + return 0.0, "false_rows is not an object of row and reason" + rows = [c["row"] for c in env["check"]["rows"]] + truth = env["reference"]["false_rows"] + unknown = [r for r in named if r not in set(rows)] + if unknown: + return 0.0, "no rows %s in the table" % ", ".join(sorted(unknown)) + reasons = env["check"].get("reasons") or REASONS + bad = [r for r, why in named.items() if why not in reasons] + if bad: + return 0.0, "the reason for %s is not one of %s" % (", ".join(sorted(bad)), ", ".join(reasons)) + if rows and set(named) == set(rows): + return 0.0, "every row of the table is named false: a blanket answer" + found = sum(1 for r, why in named.items() if truth.get(r) == why) + if not truth and not named: + return 1.0, None + precision = found / len(named) if named else 0.0 + recall = found / len(truth) if truth else 0.0 + f1 = 2 * precision * recall / (precision + recall) if precision + recall else 0.0 + if f1 >= 1.0: + return 1.0, None + missed = sorted(set(truth) - set(named)) + wrongly = sorted(set(named) - set(truth)) + wrong_reason = sorted(r for r in set(truth) & set(named) if truth[r] != named[r]) + said = [] + if missed: + said.append("%d false row(s) not named" % len(missed)) + if wrongly: + said.append("%d genuine row(s) named false" % len(wrongly)) + if wrong_reason: + said.append("%d false row(s) with another reason" % len(wrong_reason)) + return f1, "; ".join(said) + + +def score(env, reply, replay, calls=None, reply_calls=None, calls_from="reply", log_problem=None): + """One environment scored. calls: the authoritative record [(tool, arguments)] (None: no record); + reply_calls: the reply-side log, compared with calls under calls_from="harness".""" + row = {"id": env["id"], "family": env["family"], "kind": KINDS.get(env["family"]), "calls_from": calls_from, + "correct": 0, "proofs_hold": 0, "reward": 0, "graded": 0.0, "verdict": None, "reason": None} + card, problem = read_card(reply) + if problem: + row.update(verdict="no_card", reason=problem) + return row + proofs = [] + try: + problem = engine_problem(env, replay) + if problem: + raise Integrity(problem) + problem = call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row) + if problem: + raise Integrity(problem) + family = env["family"] + if family in ("tradeoff", "chain_design"): + graded, reason = score_boundary(env, card, replay, row, proofs) + elif family == "budget": + graded, reason = score_budget(env, card, replay, row, proofs) + elif family == "forensics": + named = card.get("false_rows") + if isinstance(named, dict): + row["named"] = named + graded, reason = forensics_f1(env, named) + proofs = [True] + if reason and graded == 0.0 and not isinstance(named, dict): + raise Wrong(reason) + else: + raise Wrong("unknown family %s" % family) + except Integrity as problem: + row.update(verdict="integrity", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs))) + return row + except Wrong as problem: + row.update(verdict="wrong", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs))) + return row + proofs_hold = int(bool(proofs) and all(proofs)) + correct = int(graded >= 1.0 and reason is None) + row.update(correct=correct, proofs_hold=proofs_hold, reward=int(correct == 1 and proofs_hold == 1), + graded=round(graded, 6) if proofs_hold else 0.0, + verdict="pass" if correct and proofs_hold else ("near" if graded > 0 else "wrong"), reason=reason) + return row + + +def records_for(folder, env_id, calls_from, harness_dir=None): + """(calls, reply_calls, log_problem) for one environment's reply in folder.""" + reply_calls = read_calls(os.path.join(folder, env_id + ".calls.jsonl")) + if calls_from == "harness": + calls, log_problem = read_harness_log(os.path.join(harness_dir or folder, env_id + ".harness.jsonl")) + return calls, reply_calls, log_problem + return reply_calls, None, None + + +def main(): + parser = argparse.ArgumentParser(description=__doc__.split("\n")[0]) + parser.add_argument("replies") + parser.add_argument("--engine", required=True) + parser.add_argument("--only") + parser.add_argument("--environments", required=True) + parser.add_argument("--out") + parser.add_argument("--calls-from", choices=("reply", "harness"), default="harness") + parser.add_argument("--harness-dir") + parser.add_argument("--quiet", action="store_true") + args = parser.parse_args() + environments = load_environments(args.environments) + if args.only: + wanted = set(args.only.split(",")) + environments = [e for e in environments if e["id"] in wanted] + missing = wanted - {e["id"] for e in environments} + if missing: + sys.exit("no environments %s in %s" % (", ".join(sorted(missing)), args.environments)) + for env in environments: + for problem in row_problems(env): + print("warning: %s: %s" % (env.get("id"), problem), file=sys.stderr) + verifier = open_verifier(args.engine) + replay = Replay(verifier) + rows = [] + try: + for env in environments: + path = os.path.join(args.replies, env["id"] + ".txt") + reply = open(path, encoding="utf-8", errors="replace").read() if os.path.isfile(path) else "" + calls, reply_calls, log_problem = records_for(args.replies, env["id"], args.calls_from, args.harness_dir) + row = score(env, reply, replay, calls, reply_calls, args.calls_from, log_problem) + rows.append(row) + if not args.quiet: + print("%-58s reward %d graded %.4f %-9s %s" % (env["id"], row["reward"], row["graded"], row["verdict"], + row["reason"] or ""), flush=True) + replay.seen.clear() + finally: + close_verifier(verifier) + if args.out: + with open(args.out, "w", encoding="utf-8") as f: + for row in rows: + f.write(json.dumps(row) + "\n") + total = len(rows) + print("\n%d environments: reward %d, graded %.4f (mean %.4f), correct %d, proofs_hold %d" % ( + total, sum(r["reward"] for r in rows), sum(r["graded"] for r in rows), + sum(r["graded"] for r in rows) / total if total else 0.0, + sum(r["correct"] for r in rows), sum(r["proofs_hold"] for r in rows))) + by = {} + for r in rows: + by.setdefault(r["family"], []).append(r) + for family in FAMILIES: + if family in by: + print(" %-13s reward %d of %d, mean graded %.4f" % (family, sum(r["reward"] for r in by[family]), len(by[family]), + sum(r["graded"] for r in by[family]) / len(by[family]))) + + +if __name__ == "__main__": + main() diff --git a/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/test.sh b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..4e4008f0a93d9c230856a9c0e0ecf5cd5cef1066 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Harbor runs this after the agent has finished, in a fresh copy of the image +# (task.toml: [verifier] environment_mode = "separate"). By then Harbor has +# copied tests/ to /tests and the declared artifacts, where they exist, to +# their own paths: /app/answer.json and /logs/agent/trajectory.json. +# grade.py writes /logs/verifier/reward.json. If the scorer itself fails it +# writes no reward and this script exits non-zero. +HERE="$(cd "$(dirname "$0")" && pwd)" +exec python3 -B "$HERE/grade.py" diff --git a/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/ztp_mcp.py b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/ztp_mcp.py new file mode 100644 index 0000000000000000000000000000000000000000..0cde73653317c847cd361ad0ca9d4f1f785bc3a7 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/ztp_mcp.py @@ -0,0 +1,188 @@ +"""A small Model Context Protocol client for the Zero-Trust Physics verifier. + +Standard library only. It speaks MCP two ways: + + stdio to a verifier built from the public source and started here as a program + (target/release/mcp_stdio): one JSON-RPC message a line, no network. + HTTP to an MCP address (JSON-RPC in a POST), such as + + https://mcp.zerotrustphysics.com/mcp Open to any agent. + +The open address gives each network address one place in the physics pool at a +time and answers "Too many concurrent physics tasks." or HTTP 429 when it is +busy; nothing waits on the server, so this client sends one request at a time +and, when it is told to come back, waits and sends the same request again. + +Licence: Apache-2.0. +""" +import json +import select +import shlex +import subprocess +import time +import urllib.error +import urllib.request + +OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp" +BUSY = "Too many concurrent physics tasks." + + +class McpError(RuntimeError): + pass + + +class Verifier: + """One MCP endpoint. call(tool, arguments) returns (text, is_error).""" + + def __init__(self, url=OPEN_ADDRESS, timeout_s=90, patience_s=600, pause_s=0.0, headers=None, quiet=True): + self.url = url + self.timeout_s = timeout_s + self.patience_s = patience_s # how long to keep asking politely before giving up on one request + self.pause_s = pause_s # a fixed pause after every request, for a shared address + self.headers = dict(headers or {}) + self.quiet = quiet + self.session = None + self.server = None + self.requests_sent = 0 + self.times_asked_to_wait = 0 + self._id = 0 + + # -- transport ------------------------------------------------------------------------- + def _post(self, message): + body = json.dumps(message).encode() + headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream", + "User-Agent": "zero-trust-physics-environments/1.0", **self.headers} + if self.session: + headers["Mcp-Session-Id"] = self.session + request = urllib.request.Request(self.url, data=body, headers=headers, method="POST") + self.requests_sent += 1 + with urllib.request.urlopen(request, timeout=self.timeout_s) as response: + session = response.headers.get("Mcp-Session-Id") + if session: + self.session = session + raw = response.read().decode("utf-8") + kind = response.headers.get("Content-Type", "") + if "text/event-stream" in kind: + for line in raw.splitlines(): + if line.startswith("data:"): + found = json.loads(line[5:].strip()) + if found.get("id") == message.get("id"): + return found + raise McpError("the event stream held no answer to the request") + return json.loads(raw) if raw.strip() else {} + + def _ask(self, method, params=None): + """Send one request; on 429, a busy pool, a 5xx or a dropped connection, wait and send it again.""" + self._id += 1 + message = {"jsonrpc": "2.0", "id": self._id, "method": method} + if params is not None: + message["params"] = params + started, wait = time.time(), 2.0 + while True: + reason = None + try: + answer = self._post(message) + if "error" in answer: + raise McpError("protocol error: %s" % json.dumps(answer["error"])[:300]) + result = answer.get("result", {}) + text = "".join(c.get("text", "") for c in result.get("content", []) or []) + if method == "tools/call" and BUSY in text and len(text) < 400: + reason = "the physics pool is busy" + else: + if self.pause_s: + time.sleep(self.pause_s) + return result + except urllib.error.HTTPError as problem: + if problem.code == 429 or problem.code >= 500: + after = problem.headers.get("Retry-After") + reason = "HTTP %d" % problem.code + if after and after.isdigit(): + wait = max(wait, float(after)) + else: + raise McpError("HTTP %d: %s" % (problem.code, problem.read().decode("utf-8", "replace")[:300])) + except (urllib.error.URLError, TimeoutError, ConnectionError, OSError) as problem: + reason = "no connection (%s)" % problem + self.times_asked_to_wait += 1 + if time.time() - started + wait > self.patience_s: + raise McpError("gave up after %d s: %s" % (self.patience_s, reason)) + if not self.quiet: + print(" %s; asking again in %.0f s" % (reason, wait), flush=True) + time.sleep(wait) + wait = min(wait * 1.6, 30.0) + + # -- protocol -------------------------------------------------------------------------- + def connect(self): + result = self._ask("initialize", {"protocolVersion": "2025-06-18", "capabilities": {}, + "clientInfo": {"name": "zero-trust-physics-environments", "version": "1.0"}}) + self.server = result.get("serverInfo") + try: + self._post({"jsonrpc": "2.0", "method": "notifications/initialized"}) + except Exception: # a notification has no answer; some servers close without one + pass + return result + + def tools(self): + """The tool declarations exactly as the endpoint gives them.""" + return self._ask("tools/list").get("tools", []) + + def call(self, tool, arguments=None): + """Call one tool. Returns (text, is_error): the text of the answer and the MCP isError flag.""" + result = self._ask("tools/call", {"name": tool, "arguments": arguments or {}}) + text = "".join(c.get("text", "") for c in result.get("content", []) or []) + return text, bool(result.get("isError")) + + def call_json(self, tool, arguments=None): + """Call one tool. Returns (body, is_error): the parsed JSON, or the text when it is not JSON.""" + text, is_error = self.call(tool, arguments) + try: + return json.loads(text), is_error + except ValueError: + return text, is_error + + +class StdioVerifier(Verifier): + """The same interface over MCP stdio: a program started here that speaks JSON-RPC, one message a line. + For anyone who holds an MCP server as a program; the open address needs none of this.""" + + def __init__(self, command, timeout_s=600, **kwargs): + super().__init__(url="stdio: " + (command if isinstance(command, str) else " ".join(command)), timeout_s=timeout_s, **kwargs) + self.proc = subprocess.Popen(shlex.split(command) if isinstance(command, str) else command, + stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) + + def _post(self, message): + self.requests_sent += 1 + try: + self.proc.stdin.write((json.dumps(message) + "\n").encode()) + self.proc.stdin.flush() + except OSError: # a program that has stopped reading will not start again + try: + self.proc.stdin.close() + except OSError: + pass + raise McpError("the program stopped reading") + if "id" not in message: + return {} + while True: + ready, _, _ = select.select([self.proc.stdout], [], [], self.timeout_s) + if not ready: + raise McpError("no answer in %d s" % self.timeout_s) + line = self.proc.stdout.readline() + if not line: + raise McpError("the program closed its output") + found = json.loads(line) + if found.get("id") == message["id"]: + return found + + def close(self): + self.proc.terminate() + try: + self.proc.wait(timeout=5) + except subprocess.TimeoutExpired: + self.proc.kill() + + +def connect(endpoint=OPEN_ADDRESS, **kwargs): + """A connected verifier: an http(s) address, or "stdio:" for a program.""" + verifier = StdioVerifier(endpoint[len("stdio:"):].strip(), **kwargs) if endpoint.startswith("stdio:") else Verifier(endpoint, **kwargs) + verifier.connect() + return verifier diff --git a/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/ztp_open_bridge.py b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/ztp_open_bridge.py new file mode 100644 index 0000000000000000000000000000000000000000..9e4330e54ed33d8cf1f9a1078d9f36e5f96c2996 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-chain-sd-slab-radius-halfchar-h-r7/tests/ztp_open_bridge.py @@ -0,0 +1,109 @@ +"""The open address as a stdio MCP server: every JSON-RPC line read on stdin is posted, unchanged, to the verifier's +MCP address, and its answer written back on stdout, one line each. Standard library only. + + python3 ztp_open_bridge.py [URL] URL defaults to https://mcp.zerotrustphysics.com/mcp + +It is for a client that starts its MCP server as a program (an MCP config's command and args, a Harbor task's stdio +server, the harness's logging proxy in front of it) when the verifier it is to use is the served one. The bridge adds +nothing and drops nothing: a request goes out byte for byte as JSON, its answer comes back as the address gave it; a +notification (no id) is posted and answered by nothing. The session the address opens (Mcp-Session-Id) is kept for +every later message. On HTTP 429, a 5xx, a busy physics pool or a dropped connection it waits and posts the same +message again, as ztp_mcp.Verifier does, so a client sees one answer per request. + +Optional: ZTP_API_KEY in the environment sends "Authorization: Bearer " on every post, for a keyed door. With no +key set the bridge sends what it always sent. No key is ever written into a pack, a task or an image. + +Licence: Apache-2.0. +""" +import json +import os +import sys +import time +import urllib.error +import urllib.request + +OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp" +BUSY = "Too many concurrent physics tasks." +PATIENCE_S = float(os.environ.get("ZTP_BRIDGE_PATIENCE_S", "900")) +API_KEY = os.environ.get("ZTP_API_KEY") or None + + +class Bridge: + def __init__(self, url): + self.url = url + self.session = None + self.extra_headers = {} + + def post(self, message): + body = json.dumps(message).encode() + headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream", + "User-Agent": "zero-trust-physics-bridge/1.0"} + if self.session: + headers["Mcp-Session-Id"] = self.session + if API_KEY: + headers["Authorization"] = "Bearer " + API_KEY + headers.update(self.extra_headers) + request = urllib.request.Request(self.url, data=body, headers=headers, method="POST") + with urllib.request.urlopen(request, timeout=600) as response: + if response.headers.get("Mcp-Session-Id"): + self.session = response.headers["Mcp-Session-Id"] + raw = response.read().decode("utf-8") + kind = response.headers.get("Content-Type", "") + if "id" not in message: + return None + if "text/event-stream" in kind: + for line in raw.splitlines(): + if line.startswith("data:"): + found = json.loads(line[5:].strip()) + if found.get("id") == message.get("id"): + return found + return {"jsonrpc": "2.0", "id": message.get("id"), "error": {"code": -32603, "message": "the address's event stream held no answer"}} + return json.loads(raw) if raw.strip() else None + + def forward(self, message): + started, wait = time.time(), 2.0 + while True: + try: + answer = self.post(message) + text = "" + if isinstance(answer, dict) and isinstance(answer.get("result"), dict): + text = "".join(c.get("text", "") for c in answer["result"].get("content", []) or [] if isinstance(c, dict)) + if not (BUSY in text and len(text) < 400): + return answer + except urllib.error.HTTPError as problem: + if not (problem.code == 429 or problem.code >= 500): + if "id" not in message: + return None + return {"jsonrpc": "2.0", "id": message.get("id"), + "error": {"code": -32603, "message": "HTTP %d from the verifier's address" % problem.code}} + after = problem.headers.get("Retry-After") + if after and after.isdigit(): + wait = max(wait, float(after)) + except (urllib.error.URLError, TimeoutError, ConnectionError, OSError): + pass + if time.time() - started + wait > PATIENCE_S: + if "id" not in message: + return None + return {"jsonrpc": "2.0", "id": message.get("id"), + "error": {"code": -32603, "message": "the verifier's address did not answer in %d s" % PATIENCE_S}} + time.sleep(wait) + wait = min(wait * 1.6, 30.0) + + +def main(): + bridge = Bridge(sys.argv[1] if len(sys.argv) > 1 else OPEN_ADDRESS) + for line in sys.stdin: + if not line.strip(): + continue + try: + message = json.loads(line) + except ValueError: + continue + answer = bridge.forward(message) + if answer is not None: + sys.stdout.write(json.dumps(answer, separators=(",", ":")) + "\n") + sys.stdout.flush() + + +if __name__ == "__main__": + main() diff --git a/sample/tasks/harbor/tasks/g2-forensics6-07/environment/Dockerfile b/sample/tasks/harbor/tasks/g2-forensics6-07/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..c807fbade805136032ff63002e2cc8d31376f95f --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-forensics6-07/environment/Dockerfile @@ -0,0 +1,14 @@ +# Harbor environment image for Zero-Trust Physics release v0.15.3 (commit 664d68f4). +# Public 5-crate Rust engine reference source is at https://github.com/johnkruze/zero-trust-physics-engine (tag v0.15.2); +# read-only source audit of the pack verifier build is available under NDA (https://zerotrustphysics.com/offers/#licence). +# In this free evaluation sample, /usr/local/bin/mcp_stdio bridges JSON-RPC over stdio to the public MCP endpoint +# (ztp_open_bridge.py), and the scorer verifies release 0.15.3 version and kernel invariants on every reply. +# Paid Domain Packs ship compiled static Linux/macOS rollout binaries for --network none execution. +FROM python:3.12-slim-bookworm +ARG ZTP_ENGINE_TAG=v0.15.3 +ARG ZTP_ENGINE_COMMIT=664d68f426ccdfd0159e5f91857edba3872390d1 +ARG ZTP_VERIFIER_URL=https://mcp.zerotrustphysics.com/mcp +COPY ztp_open_bridge.py /usr/local/lib/ztp/ztp_open_bridge.py +RUN printf '#!/bin/sh\nexec python3 /usr/local/lib/ztp/ztp_open_bridge.py "%s"\n' "$ZTP_VERIFIER_URL" > /usr/local/bin/mcp_stdio \ + && chmod +x /usr/local/bin/mcp_stdio +WORKDIR /app diff --git a/sample/tasks/harbor/tasks/g2-forensics6-07/environment/ztp_open_bridge.py b/sample/tasks/harbor/tasks/g2-forensics6-07/environment/ztp_open_bridge.py new file mode 100644 index 0000000000000000000000000000000000000000..9e4330e54ed33d8cf1f9a1078d9f36e5f96c2996 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-forensics6-07/environment/ztp_open_bridge.py @@ -0,0 +1,109 @@ +"""The open address as a stdio MCP server: every JSON-RPC line read on stdin is posted, unchanged, to the verifier's +MCP address, and its answer written back on stdout, one line each. Standard library only. + + python3 ztp_open_bridge.py [URL] URL defaults to https://mcp.zerotrustphysics.com/mcp + +It is for a client that starts its MCP server as a program (an MCP config's command and args, a Harbor task's stdio +server, the harness's logging proxy in front of it) when the verifier it is to use is the served one. The bridge adds +nothing and drops nothing: a request goes out byte for byte as JSON, its answer comes back as the address gave it; a +notification (no id) is posted and answered by nothing. The session the address opens (Mcp-Session-Id) is kept for +every later message. On HTTP 429, a 5xx, a busy physics pool or a dropped connection it waits and posts the same +message again, as ztp_mcp.Verifier does, so a client sees one answer per request. + +Optional: ZTP_API_KEY in the environment sends "Authorization: Bearer " on every post, for a keyed door. With no +key set the bridge sends what it always sent. No key is ever written into a pack, a task or an image. + +Licence: Apache-2.0. +""" +import json +import os +import sys +import time +import urllib.error +import urllib.request + +OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp" +BUSY = "Too many concurrent physics tasks." +PATIENCE_S = float(os.environ.get("ZTP_BRIDGE_PATIENCE_S", "900")) +API_KEY = os.environ.get("ZTP_API_KEY") or None + + +class Bridge: + def __init__(self, url): + self.url = url + self.session = None + self.extra_headers = {} + + def post(self, message): + body = json.dumps(message).encode() + headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream", + "User-Agent": "zero-trust-physics-bridge/1.0"} + if self.session: + headers["Mcp-Session-Id"] = self.session + if API_KEY: + headers["Authorization"] = "Bearer " + API_KEY + headers.update(self.extra_headers) + request = urllib.request.Request(self.url, data=body, headers=headers, method="POST") + with urllib.request.urlopen(request, timeout=600) as response: + if response.headers.get("Mcp-Session-Id"): + self.session = response.headers["Mcp-Session-Id"] + raw = response.read().decode("utf-8") + kind = response.headers.get("Content-Type", "") + if "id" not in message: + return None + if "text/event-stream" in kind: + for line in raw.splitlines(): + if line.startswith("data:"): + found = json.loads(line[5:].strip()) + if found.get("id") == message.get("id"): + return found + return {"jsonrpc": "2.0", "id": message.get("id"), "error": {"code": -32603, "message": "the address's event stream held no answer"}} + return json.loads(raw) if raw.strip() else None + + def forward(self, message): + started, wait = time.time(), 2.0 + while True: + try: + answer = self.post(message) + text = "" + if isinstance(answer, dict) and isinstance(answer.get("result"), dict): + text = "".join(c.get("text", "") for c in answer["result"].get("content", []) or [] if isinstance(c, dict)) + if not (BUSY in text and len(text) < 400): + return answer + except urllib.error.HTTPError as problem: + if not (problem.code == 429 or problem.code >= 500): + if "id" not in message: + return None + return {"jsonrpc": "2.0", "id": message.get("id"), + "error": {"code": -32603, "message": "HTTP %d from the verifier's address" % problem.code}} + after = problem.headers.get("Retry-After") + if after and after.isdigit(): + wait = max(wait, float(after)) + except (urllib.error.URLError, TimeoutError, ConnectionError, OSError): + pass + if time.time() - started + wait > PATIENCE_S: + if "id" not in message: + return None + return {"jsonrpc": "2.0", "id": message.get("id"), + "error": {"code": -32603, "message": "the verifier's address did not answer in %d s" % PATIENCE_S}} + time.sleep(wait) + wait = min(wait * 1.6, 30.0) + + +def main(): + bridge = Bridge(sys.argv[1] if len(sys.argv) > 1 else OPEN_ADDRESS) + for line in sys.stdin: + if not line.strip(): + continue + try: + message = json.loads(line) + except ValueError: + continue + answer = bridge.forward(message) + if answer is not None: + sys.stdout.write(json.dumps(answer, separators=(",", ":")) + "\n") + sys.stdout.flush() + + +if __name__ == "__main__": + main() diff --git a/sample/tasks/harbor/tasks/g2-forensics6-07/instruction.md b/sample/tasks/harbor/tasks/g2-forensics6-07/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..26f91841a22b43b012d9f555123e26df2923b5ac --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-forensics6-07/instruction.md @@ -0,0 +1,37 @@ +A report hands you twelve claims about answers of the verifier. Each row gives the model, the request as it was sent, what its answer is claimed to say and the proof claimed for it. claim.outcome and claim.stop are the run's outcome and the name of its stop or declared end (null when it completed); claim.steps_landed is the last step the run is sealed to; claim.quantity and claim.value are one number of the final state of a run (of the result, for a solve); claim.flags are the advisory flags the run carried, each with the quantity it is on, its extent at the largest (extent) and the number of steps it was raised on (steps). +Some rows are false. A false row may be wrong in more than one way; its reason is the first of these, in this order, that is true of it: +1. retired_model: the request names a model ID the verifier does not serve (one it no longer serves, or a name it never served). +2. parent_wrong: the request continues a run (from) that is not the parent it names: its start state, or the seal it gives for its parent, belongs to another run, and the verifier refuses the continuation. +3. seal_wrong: the proof is not the seal of this request. +4. stop_hidden: the run stops part way and the claim says it completed. +5. step_wrong: the claim names the run's stop, but not the last step the run is sealed to. +6. flag_omitted: the run carries an advisory flag (a name on a quantity) that the claim leaves out altogether. +7. flag_altered: the flags the claim lists are not the run's, entry for entry: an extent or a count of steps differs, or an entry is missing or added where its name on that quantity is listed too (the verifier may list one flag on one quantity more than once, each with its own extent). +8. value_altered: the claimed value is not the one the request gives, to the last digit. +A row that is none of these is genuine, whatever else differs in how it is written (the order of its flags, a readout sent with the request, the spelling of a number). Name every false row with its reason. +The rows, one a line: +{"row": "R1", "model": "aerospace/momentum_jwst_srp", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "momentum_jwst_srp", "initial": {"h_eci_nms": [-1.244, -0.73, 1.098]}, "dt_s": 1599.0, "segments": [{"steps": 69, "load": {"q1": 0.655763, "q2": -0.008127, "q3": -0.635608, "q4": 0.407321, "sun_x": 0.616092, "sun_y": 0.711198, "sun_z": 0.338568, "sun_distance_au": 1.00863}}], "record_every": 69}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 69, "quantity": "h_magnitude_nms", "value": 2.2890861976984564, "flags": []}, "proof": "949c987ad62f835ca215267699517ed2e659b5e776277779896aaf721a03f139d674ea7e0f671e6160f37eaca17eaade"} +{"row": "R2", "model": "aerospace/capsule_insight", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_insight", "initial": {"radius_m": 3522956.0, "radial_speed_m_s": -1294.7972, "transverse_speed_m_s": 5730.5432}, "dt_s": 0.1, "segments": [{"steps": 2152, "load": {"lift_over_drag": 0.0}}], "record_every": 2152}}, "claim": {"outcome": "ended", "stop": "PastFlightDeployment", "steps_landed": 2115, "quantity": "mach", "value": 1.3960519703767567, "flags": []}, "proof": "a4065183ea2043a6b9568252634e364467b059fc61f9a23478a29d53c70035b9b199b77f07d277aa257df8e292b9ce3b"} +{"row": "R3", "model": "ablator_slab", "request": {"tool": "solve", "arguments": {"solver": "ablator_slab", "parameters": {"material": "TACOT 3.0", "thickness_m": 0.0461, "start_temperature_k": 306.3, "thermocouple_depths_m": [], "face": "held_temperature", "held_temperature_k": 1920.0, "hold_duration_s": 60.0, "continue_after_s": 40.0, "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false}}}, "claim": {"outcome": "converged", "stop": null, "steps_landed": null, "quantity": "heat_in_through_face_j_per_m2", "value": 7320760.59153902, "flags": []}, "proof": "eec6980868952c49cd6a1017930f98d396e4452a470c6fa0eacd9b4e00d4aa1c3c32a4c83a59d23ebb96511b2071cec9"} +{"row": "R4", "model": "aerospace/satellite_lageos1", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "satellite_lageos1", "initial": {"epoch_utc_s": 844014880.0, "forecast_elapsed_s": 0.0, "position_m": [4229354.428, 1727500.405, 11440357.84], "velocity_m_s": [4061.944, -1496.84, -849.917]}, "dt_s": 10.0, "segments": [{"steps": 1742, "load": {}}], "record_every": 1742}}, "claim": {"outcome": "refused", "stop": "RadiusBelowEarthRadius", "steps_landed": 1810, "quantity": "radius_m", "value": 6394735.022733123, "flags": [{"flag": "FLAG_BELOW_COMPARED_RADIUS", "quantity": "radius_m", "extent": 5602264.977266877, "steps": 232}, {"flag": "FLAG_EARTH_SHADOW", "quantity": "distance_from_shadow_axis_m", "extent": 1013479.6278764848, "steps": 36}]}, "proof": "7d233dcfc07a2e1911dfb85fa0fea029ca687f3514cbba06fdf88864e906828e6417cdfe59a34263e9a9936df3787eeb"} +{"row": "R5", "model": "aerospace/momentum_jwst_srp", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "momentum_jwst_srp", "initial": {"h_eci_nms": [-1.622, -0.964, 1.404]}, "dt_s": 1941.0, "segments": [{"steps": 105, "load": {"q1": 0.613497, "q2": -0.034325, "q3": -0.676494, "q4": 0.405953, "sun_x": 0.616092, "sun_y": 0.704136, "sun_z": 0.353019, "sun_distance_au": 1.01277}}], "record_every": 105}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 105, "quantity": "h_magnitude_nms", "value": 6.973018347360404, "flags": []}, "proof": "ad1969f7ba7bdeb622e3b8e1d44f0d24ec27d0e37940f1b0109488c8a140a98d6b533e80d8516dd6570125efcd1661ca"} +{"row": "R6", "model": "aerospace/momentum_jwst_srp", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "momentum_jwst_srp", "initial": {"h_eci_nms": [-1.055, -0.613, 0.945]}, "dt_s": 1428.0, "segments": [{"steps": 51, "load": {"q1": 0.675887, "q2": 0.004991, "q3": -0.614166, "q4": 0.407371, "sun_x": 0.616092, "sun_y": 0.714618, "sun_z": 0.331289, "sun_distance_au": 1.00656}}], "record_every": 51, "readout": {"quantities": ["h_magnitude_nms"]}}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 51, "quantity": "h_magnitude_nms", "value": 1.2538931414748378, "flags": []}, "proof": "03d88323f8f93f53797cbc48775f27fd6a07de18484442a71b7150623946a49b71ae478a13981aefc1278e97d0ba94e7"} +{"row": "R7", "model": "aerospace/solar_system", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "solar_system", "initial": {"sun_position_m": [-972177542.8424704, -500214545.81043047, -185162850.5512162], "sun_velocity_m_s": [10.943471273744956, -10.354907507003432, -4.725295041665638], "mercury_position_m": [44347944047.32132, -35386831719.91674, -23520589495.944], "mercury_velocity_m_s": [23179.557544578543, 34737.11717051704, 16153.15243244726], "venus_position_m": [107378854594.44405, -3855694027.194445, -8551901158.778554], "venus_velocity_m_s": [1922.5971467016116, 31772.25497050463, 14172.860625157742], "earth_position_m": [-131048132650.02007, -69568840294.57173, -30130222428.765972], "earth_velocity_m_s": [14439.696511929173, -23759.193577978716, -10300.838662315398], "moon_position_m": [-131336010046.59302, -69827768665.01813, -30206075001.525085], "moon_velocity_m_s": [15090.044579869322, -24450.210577738573, -10619.619444665168], "mars_position_m": [99849753635.60847, 183319992199.24744, 81400974963.10365], "mars_velocity_m_s": [-20727.719446230996, 11533.19274335954, 5850.623327698212], "jupiter_position_m": [514628857491.4813, 498738500952.13635, 201244273740.58517], "jupiter_velocity_m_s": [-9599.899310141725, 8786.610935350978, 4000.0870026696048], "saturn_position_m": [885052478191.6257, 978750373225.096, 366165774373.12665], "saturn_velocity_m_s": [-7872.030702860459, 5633.288132226103, 2665.365518089133], "uranus_position_m": [2201312313161.7573, -1830733084174.7542, -832950501719.338], "uranus_velocity_m_s": [4543.09354375023, 4338.812277392898, 1836.0266601992553], "neptune_position_m": [2556089531027.0625, -3410769562986.1963, -1459684701878.0127], "neptune_velocity_m_s": [4440.424297199966, 2924.108717975938, 1086.3053554716744], "ceres_position_m": [-376564661494.9705, -82793770650.16934, 37539835502.66692], "ceres_velocity_m_s": [2078.7472741961246, -17061.59058649498, -8451.939414743216], "pallas_position_m": [-285475111420.94836, 157884218572.5715, -11922623410.065147], "pallas_velocity_m_s": [-12324.053945853098, -17981.78998150534, 4412.172020403093], "vesta_position_m": [-20413884754.428905, -300115898744.55383, -116942553506.93321], "vesta_velocity_m_s": [20962.21629618035, -627.1836731673636, -2988.3711172821936], "energy_anchor": -1.3219409983492277e+25, "booked_work": 0.0, "angular_momentum_anchor": [5.490282510021932e+31, -8.153754585664557e+32, 1.9244191260936244e+33], "booked_torque": [0.0, 0.0, 0.0]}, "dt_s": 1444.0, "segments": [{"steps": 6, "load": {}}, {"steps": 7, "load": {}}, {"steps": 8, "load": {}}, {"steps": 9, "load": {}}], "record_every": 30, "readout": {"quantities": ["earth_mars_distance_m"]}}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 30, "quantity": "earth_mars_distance_m", "value": 360459888729.46576, "flags": []}, "proof": "e584421f53f10db28a78d74a117cfc06b70f10a6cd5a8edfccbd8f76cbd63845b21a93ee0d2b86eac20331f5a33cc32b"} +{"row": "R8", "model": "aerospace/capsule_stardust", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6487681.0, "radial_speed_m_s": -2026.81, "transverse_speed_m_s": 12555.79}, "dt_s": 0.05, "segments": [{"steps": 3073, "load": {}}], "record_every": 3073, "readout": {"quantities": ["ground_distance_m"]}}}, "claim": {"outcome": "ended", "stop": "PastFlightDeployment", "steps_landed": 2015, "quantity": "ground_distance_m", "value": 617475.7093449463, "flags": [{"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "path_sine", "extent": 0.049833167255976536, "steps": 880}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "path_sine", "extent": 0.040780280423902485, "steps": 1050}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "air_speed_m_s", "extent": 1431.0624296764208, "steps": 1231}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "air_speed_m_s", "extent": 189.96215207054047, "steps": 524}, {"flag": "FLAG_DROGUE_MACH_WINDOW", "quantity": "mach", "extent": 0.39949110594929116, "steps": 195}, {"flag": "FLAG_DROGUE_MACH_WINDOW", "quantity": "mach", "extent": 0.3987609440499196, "steps": 195}]}, "proof": "3c2f0b68016777a8ea47683b523e67425743046af710d339be26b0801f7acb6a63bd125f2dc439ead5719719ecc90dbb"} +{"row": "R9", "model": "plasma_sheath_ramc2", "request": {"tool": "solve", "arguments": {"solver": "plasma_sheath_ramc2", "parameters": {"altitude_m": 65260.0, "velocity_m_s": 8582.0, "signal_frequency_hz": 8234000000.0}}}, "claim": {"outcome": "converged", "stop": null, "steps_landed": null, "quantity": "station2_electron_density_m3", "value": 5.665499503721301e+18, "flags": []}, "proof": "0835e993c83234e8ed833a8d39db824f039eb71ea77c309c76720162a6e41a59ccd8190b85384a21a3bb84183f442fbf"} +{"row": "R10", "model": "aerospace/los_jwst_fine_guide", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "los_jwst_fine_guide", "initial": {"lock_x_arcsec": 29.207, "lock_y_arcsec": -11.348, "quiet_before_start_s": 38.16}, "dt_s": 0.064, "segments": [{"steps": 3, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20685, "centroid_y_arcsec": -11.34796, "counts_per_s": 293200.0}}, {"steps": 1, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20706, "centroid_y_arcsec": -11.34813, "counts_per_s": 293200.0}}, {"steps": 2, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20727, "centroid_y_arcsec": -11.34796, "counts_per_s": 293200.0}}, {"steps": 3, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20685, "centroid_y_arcsec": -11.34813, "counts_per_s": 293200.0}}, {"steps": 1, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20706, "centroid_y_arcsec": -11.34796, "counts_per_s": 293200.0}}, {"steps": 2, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20727, "centroid_y_arcsec": -11.34813, "counts_per_s": 293200.0}}, {"steps": 3, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20685, "centroid_y_arcsec": -11.34796, "counts_per_s": 293200.0}}, {"steps": 1, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20706, "centroid_y_arcsec": -11.34813, "counts_per_s": 293200.0}}, {"steps": 2, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20727, "centroid_y_arcsec": -11.34796, "counts_per_s": 293200.0}}], "record_every": 18}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 18, "quantity": "estimate_y_mas", "value": 0.000761549984910976, "flags": []}, "proof": "f3de03ad5a49c1f27c156b8d58a2d143f777aa5fb5c459524b72678085d6f40a16eb5b8dade2b6ec34aa9865f4368bc7"} +{"row": "R11", "model": "aerospace/momentum_jwst_dihedral", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "momentum_jwst_dihedral", "initial": {"h_eci_nms": [1.121506850922792, 0.4000086686906281, 1.2782357873204517]}, "dt_s": 1620.0, "segments": [{"steps": 57, "load": {"q1": 0.626313, "q2": -0.026561, "q3": -0.664647, "q4": 0.406535, "sun_x": 0.581366, "sun_y": 0.750882, "sun_z": 0.313352, "sun_distance_au": 1.0106}}], "record_every": 57, "from": {"request": {"domain": "aerospace", "card": "momentum_jwst_dihedral", "initial": {"h_eci_nms": [1.057, 0.661, -1.263]}, "dt_s": 1620.0, "segments": [{"steps": 45, "load": {"q1": 0.705492, "q2": 0.058115, "q3": -0.557927, "q4": 0.433151, "sun_x": 0.629673, "sun_y": 0.722662, "sun_z": 0.285081, "sun_distance_au": 1.0104}}], "record_every": 45}, "run_seal": "50be7c19d63da96301f1e0edfd5ed2ff425a426e8fe4e4acc9cd6269d4ff5667db7e0b37f14ad3215a9741526ee2b189"}}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 57, "quantity": "h_magnitude_nms", "value": 2.5762879795193383, "flags": []}, "proof": "647a4baa677e63010302d970dec4c6d51f25ade699b52280cee7ff1ff0403679a724f0e0fd0d7643bf5d0d037e42b424"} +{"row": "R12", "model": "aerospace/crater_ryugu_sci", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "crater_ryugu_sci", "initial": {"radius_m": 1.155}, "dt_s": 0.1415, "segments": [{"steps": 215, "load": {}}, {"steps": 238, "load": {}}, {"steps": 261, "load": {}}, {"steps": 284, "load": {}}, {"steps": 307, "load": {}}, {"steps": 330, "load": {}}], "record_every": 1635, "readout": {"quantities": ["radius_m"]}}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 1635, "quantity": "radius_m", "value": 8.038589347556837, "flags": []}, "proof": "4e66884da3bdfb79ac5594a27861f9a025d797903b4d2f127f503fd89a7bc9e96639f499b3eb8e87a6b36e0c3c12d38e"} + +Budget: at most 4 calls that compute, counted over every call you make (every run_trajectory, solve, compute_step and verify_ call counts, refused or not); list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. + +You have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card. + +End your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {"tool": "", "arguments": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request. + +The card: +{"false_rows": {"": "", ...}} + +Name every false row, each with its one reason from retired_model, parent_wrong, seal_wrong, stop_hidden, step_wrong, flag_omitted, flag_altered, value_altered (the first of them, in that order, that is true of the row). Leave the genuine rows out. {"false_rows": {}} says every row is genuine. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all. + +Also write that answer card, by itself, to the file `/app/answer.json`. diff --git a/sample/tasks/harbor/tasks/g2-forensics6-07/solution/chainlib.py b/sample/tasks/harbor/tasks/g2-forensics6-07/solution/chainlib.py new file mode 100644 index 0000000000000000000000000000000000000000..3c8dc60513d8f8f0372b1ff80d49884754a1d0e5 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-forensics6-07/solution/chainlib.py @@ -0,0 +1,63 @@ +"""Build the solve request of a chained design from a run's answer: the history its coupling hands over. + +A coupling hands values from the run's recorded frames into the solve bit for bit: each frame's +32-bit slot widened exactly to 64 bits. The frame layout is in describe_card (frame_slots). This +module reads the slots from frame_hex with the standard library and lays the history out the way a +task states it. + + chained_solve(layout, parameters, run_request, run_answer) -> the solve's arguments, with from + +layout is the task's check.design.chain.layout: {"kind": "stardust_slab", "cool_to_s": 600.0} or +{"kind": "triga_element"}. + +Licence: Apache-2.0. +""" +import copy +import struct + + +def _slots(run_answer, f64_at, f32_at): + """Per recorded frame: the f64 at f64_at and each f32 at f32_at, widened.""" + out = [[] for _ in range(1 + len(f32_at))] + for frame in run_answer["frames"]: + raw = bytes.fromhex(frame["frame_hex"]) + out[0].append(struct.unpack(".harness.jsonl, as in a pass@k attempt. The same calls are also +written beside the reply, DIR/.calls.jsonl. --direct talks to ENGINE with no proxy and writes the +reply-side log only. + + python3 score.py DIR --engine ENGINE --environments F --calls-from harness + +Licence: Apache-2.0. +""" +import argparse +import copy +import json +import os +import subprocess +import sys +import tempfile + +HERE = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, HERE) +import chainlib # noqa: E402 +from score import (FREE_TOOLS, NOT_STOPPED, build_stage_request, close_verifier, continuation_of, design_shape, # noqa: E402 + file_sha256, get_path, load_environments, open_verifier) +from ztp_mcp import McpError, StdioVerifier # noqa: E402 + +PROXY = os.path.join(HERE, "..", "harness", "mcp_log_proxy.py") + + +class ProxiedVerifier(StdioVerifier): + """The engine behind the logging proxy, the proxy started in its own empty working folder.""" + + def __init__(self, engine, log, cwd=None, **kwargs): + self.cwd = cwd or tempfile.mkdtemp(prefix="ztp_ref_cwd_") + if engine.startswith("http://") or engine.startswith("https://"): + # an MCP address: the proxy runs the stdio bridge to it (ztp_open_bridge.py, beside this file) + child = [sys.executable, os.path.join(HERE, "ztp_open_bridge.py"), engine] + else: + child = [os.path.abspath(engine)] + command = [sys.executable, os.path.abspath(PROXY), "--log", os.path.abspath(log), "--"] + child + super(StdioVerifier, self).__init__(url="stdio: " + " ".join(command), timeout_s=600, **kwargs) + self.proc = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, cwd=self.cwd) + self.binary_sha256 = None if len(child) > 1 else file_sha256(engine) + + def close(self): + try: + self.proc.stdin.close() + except OSError: + pass + try: + self.proc.wait(timeout=60) + except subprocess.TimeoutExpired: + self.proc.kill() + + +def proxied(engine, log, cwd=None): + if os.path.exists(log): + os.remove(log) + verifier = ProxiedVerifier(engine, log, cwd) + try: + verifier.connect() + except McpError as problem: + sys.exit("the proxied verifier failed: %s" % problem) + return verifier + + +class Logged: + def __init__(self, verifier): + self.verifier, self.calls, self.seen = verifier, [], {} + + def call(self, tool, arguments, refused_ok=False): + # the same request twice is one call: a chain with its value in the next run has one first run for both designs + key = json.dumps([tool, arguments], sort_keys=True) + if key in self.seen and not self.seen[key][1]: + return self.seen[key][0] + self.calls.append({"tool": tool, "arguments": arguments}) + body, is_error = self.verifier.call_json(tool, arguments) + self.seen[key] = (body, is_error) + if is_error and not refused_ok: + raise SystemExit("the reference request was refused: %s %s" % (tool, str(body)[:300])) + return body + + +def design_staged(env, ref, agent): + """A staged design: each stage sent in order, handed values and continuations built from this verifier's answers.""" + spec = env["check"]["design"] + answers, requests, out = {}, {}, {} + for stage in spec["stages"]: + q = build_stage_request(spec, stage, ref["x"], answers, requests) + body = agent.call(stage["tool"], q, refused_ok=True) + stopped = body.get("outcome") not in NOT_STOPPED + answers[stage["key"]] = {"body": body, "proof": body.get("run_seal") or body.get("solution_seal"), + "outcome": body.get("outcome"), "stop": body.get("reject") if stopped else None, "stopped": stopped} + requests[stage["key"]] = q + out[stage["key"]] = {"request": {"tool": stage["tool"], "arguments": q}, "proof": answers[stage["key"]]["proof"]} + return out + + +def design(env, ref, agent): + spec = env["check"]["design"] + shape = design_shape(spec) + if shape == "staged": + return design_staged(env, ref, agent) + if shape == "solve": + solved = agent.call("solve", ref["solve"], refused_ok=True) + return {"solve": {"request": {"tool": "solve", "arguments": ref["solve"]}, "proof": solved["solution_seal"]}} + run_args = ref["run"] + run = agent.call("run_trajectory", run_args) + out = {"run": {"request": {"tool": "run_trajectory", "arguments": run_args}, "proof": run["run_seal"]}} + if shape == "continued": + # the run that continues this design's own sealed run: the reference's next run, its start fields and from + # set from this verifier's answer to the first run + _, carried, _, _ = continuation_of(spec) + next_args = copy.deepcopy(ref["next"]) + next_args["initial"] = {name: get_path(run, source) for name, source in carried.items()} + next_args["from"] = {"request": run_args, "run_seal": run["run_seal"]} + nxt = agent.call("run_trajectory", next_args, refused_ok=True) + out["next"] = {"request": {"tool": "run_trajectory", "arguments": next_args}, "proof": nxt["run_seal"]} + elif spec.get("chain"): + overrides = {} + if spec["variable"]["kind"] == "path" and spec["variable"].get("on") == "solve": + overrides[spec["variable"]["path"].split(".", 1)[1]] = ref["x"] + solve_args = chainlib.chained_solve(spec["chain"], run_args, run, overrides) + solved = agent.call("solve", solve_args) + out["solve"] = {"request": {"tool": "solve", "arguments": solve_args}, "proof": solved["solution_seal"]} + return out + + +def reference_reply(env, verifier): + """(reply text, calls [{"tool", "arguments"}]).""" + agent = Logged(verifier) + family, ref = env["family"], env["reference"] + if family in ("tradeoff", "chain_design"): + card = {"passing": design(env, ref["passing"], agent), "failing": design(env, ref["failing"], agent), "binding": ref["binding"]} + if ref["failing"].get("stopped"): + card["failing"]["stopped"] = ref["failing"]["stopped"] + if ref["failing"].get("steps_landed") is not None: + card["failing"]["step"] = ref["failing"]["steps_landed"] + words = "The boundary lies between the two designs below; %s binds." % ref["binding"] + elif family == "budget": + card = {} + for side in ("holds", "stops"): + request = ref[side]["request"] + answer = agent.call(request["tool"], request["arguments"]) + card[side] = {"request": request, "proof": answer.get("run_seal") or answer.get("solution_seal")} + card["stops"]["stopped"] = env["check"]["stop"] + words = "The stop %s lies between the two requests below." % env["check"]["stop"] + else: + agent.call("list_cards", {}, refused_ok=True) + rows = env["check"]["rows"] + budget = env["check"].get("budget") or len(rows) + computing = 0 + for row in rows: + request = row["request"] + if computing >= budget: + break + if request["tool"] in FREE_TOOLS: + continue + agent.call(request["tool"], request["arguments"], refused_ok=True) + computing += 1 + card = {"false_rows": ref["false_rows"]} + words = "%d of the %d rows are false." % (len(ref["false_rows"]), len(rows)) + return words + "\n\n" + json.dumps(card), agent.calls + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--engine", required=True) + parser.add_argument("--environments", required=True) + parser.add_argument("--out", required=True) + parser.add_argument("--only") + parser.add_argument("--direct", action="store_true", help="no proxy: the reply-side log only") + args = parser.parse_args() + environments = load_environments(args.environments) + if args.only: + wanted = set(args.only.split(",")) + environments = [e for e in environments if e["id"] in wanted] + os.makedirs(args.out, exist_ok=True) + shared = open_verifier(args.engine) if args.direct else None + try: + for env in environments: + verifier = shared or proxied(args.engine, os.path.join(args.out, env["id"] + ".harness.jsonl")) + try: + reply, calls = reference_reply(env, verifier) + finally: + if not shared: + close_verifier(verifier) + with open(os.path.join(args.out, env["id"] + ".txt"), "w", encoding="utf-8") as f: + f.write(reply + "\n") + with open(os.path.join(args.out, env["id"] + ".calls.jsonl"), "w", encoding="utf-8") as f: + for c in calls: + f.write(json.dumps(c) + "\n") + print("%-60s %d calls" % (env["id"], len(calls)), flush=True) + finally: + if shared: + close_verifier(shared) + + +if __name__ == "__main__": + main() diff --git a/sample/tasks/harbor/tasks/g2-forensics6-07/solution/score.py b/sample/tasks/harbor/tasks/g2-forensics6-07/solution/score.py new file mode 100644 index 0000000000000000000000000000000000000000..4403f043313037d26927b89db218b4718ffcf3d2 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-forensics6-07/solution/score.py @@ -0,0 +1,1199 @@ +"""Score replies to the multi-step environments with no judge: a program and the verifier. + + python3 score.py REPLIES --engine ENGINE [--environments F] [--only id,id] [--out F] + [--calls-from reply|harness] [--harness-dir DIR] + + REPLIES is a folder with one file per environment, .txt, the whole text of a reply. + --calls-from harness the call record is the harness's own: .harness.jsonl, written by + harness/mcp_log_proxy.py outside the solver's working directory (in + --harness-dir, default REPLIES). A .calls.jsonl beside the reply, + when there is one, is read only to catch an edit: it must equal the + harness log call for call. + --calls-from reply (the earlier set's way) the call record is .calls.jsonl beside the reply: + one JSON object a line, {"tool": "", "arguments": {...}}. + + ENGINE is the verifier: the path to mcp_stdio (MCP over stdio, no network), or an MCP address + beginning http. A task is scored only on the engine it was built on: the verifier's version must + be the task's reference.gateway_version (engine_tag), and a local binary's SHA-256 the task's + reference.engine_binary_sha256. + +The answer card is one JSON object on the reply's last line. Its shape is the family's: + + tradeoff, chain_design (kind design_to_limit, chained_design) + {"passing": DESIGN, "failing": DESIGN, "binding": ""} + DESIGN = {"run": {"request": R, "proof": ""}, + "solve": {"request": R, "proof": ""}} (solve only where the task has one) + Where a constraint is that the run completes and it binds, the failing DESIGN also carries + "stopped": "" and "step": . R = {"tool": ..., "arguments": {...}} + The design shapes, one scorer for every group (check.design says which): + run a run alone. + coupled check.design.chain names a solver and coupling: the run, then a solve handed that sealed run. + continued check.design.chain.kind "continuation", or chain.layout.kind "continue": the run, then a run of + the same card that continues it through from, starting from its sealed final state, + DESIGN = {"run": {...}, "next": {"request": R, "proof": ""}}. The next run's template + is chain.next_template, chain.template or chain.next; its start fields are chain.carried + ({field: where the first run's answer holds it}), chain.handed (with chain.handed_from) or + chain.carry and chain.clock, each equal to the first run's answer bit for bit. A constraint on + "next" reads the next run, and a stop constraint judges it. + solve check.design.tool or check.design.kind "solve": DESIGN = {"solve": {...}}, one solve and no + run. A binding refusal is named ("stopped") with no step. + staged check.design.stages: DESIGN = {"": {"request": R, "proof": ...}, ...}, one entry per + stage in order; a later stage carries an earlier stage's answer at a named input (handed) or + continues an earlier run (continues), bit for bit. + A constraint's read may carry "index": one entry of an output the verifier returns as a list. + budget (kind budgeted_search) + {"holds": {"request": R, "proof": ""}, + "stops": {"request": R, "proof": "", "stopped": ""}} + forensics + {"false_rows": {"": "", ...}} ({} when every row is genuine) + +Every proof is verified on the verifier (verify_tape for a run_seal, verify_solution for a +solution_seal, short form) and every number judged is read from the verifier's own answer to the +card's request, sent again here, never from the reply. + +Scores per environment +---------------------- +reward 0 or 1, exactly as the earlier scorer: 1 only when correct and proofs_hold are both 1. + proofs_hold: every proof on the card verifies. correct: the card is the right answer and + nothing below under "integrity" failed. +graded in [0, 1], beside reward. + + Integrity (graded 0 and reward 0, whatever the answer): the card cannot be read; a proof does not + verify (a copied, nudged, edited or stale proof); a request differs from the task's template other + than at the design variable; a chained solve not handed its own design's sealed run; no call log; + a call log beside the reply that differs from the harness log; a harness log whose chain breaks; + a forbidden tool called; more computing calls than the budget; a request on the card that is not + among the calls; a forensics answer with no computing call behind it; a task built on another + engine than the verifier. + + tradeoff, chain_design, budget. With integrity held, the sides are judged on the verifier: the + passing design meets every constraint and the failing one breaks the named binding constraint + (budget: holds completes, stops ends with the task's stop, named on the card), on the side the + task asks for, inside its range, with any stop and step the card must name. Wrong sides score 0. + With the sides right: + + e = the length of the smallest interval holding both designs' values and the reference + boundary (for a bracket that straddles the boundary, its width) + tol = the task's tolerance (tradeoff, chain_design) or relative width x |boundary| (budget) + r = e / tol + graded = 1 when reward is 1 (r <= 1 and the bracket straddles it) + = 0.5 ** log10(r) when r > 1: each tenfold of looseness halves the score + (r 1.35 -> 0.914, 2 -> 0.811, 10 -> 0.5, 100 -> 0.25) + = 0.5 when r <= 1 but the bracket misses the reference boundary + by more than the slack (another crossing than the one asked) + + The decay is smooth and falls monotonically with r, and a near miss scores near the top. + + forensics. With integrity held, graded is F1 over the (row, reason) pairs: a row counts as found + only with its right reason. precision = found / named, recall = found / false rows; an empty + answer to a table with no false row scores 1. A card that names every row of the table false is + a blanket answer and scores 0, as do unknown rows and reasons outside the task's list. + +Licence: Apache-2.0. +""" +import argparse +import copy +import hashlib +import json +import math +import os +import re +import sys + +HERE = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, HERE) +from ztp_mcp import McpError, StdioVerifier, Verifier # noqa: E402 + +FAMILIES = ("tradeoff", "chain_design", "budget", "forensics") +KINDS = {"tradeoff": "design_to_limit", "chain_design": "chained_design", "budget": "budgeted_search", "forensics": "forensics"} +NOT_STOPPED = ("completed", "converged") +PREFIX_ENDS = ("__", ".", ":", "/") +VERIFIER_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite", + "run_trajectory", "compute_step", "verify_step", "design_run", "solve", "run_dataset", + "validate_series", "verify_tape", "verify_solution", "verify_dataset", "verify_receipt", "find_flip") +# Calls that read the catalogue compute nothing and are free in a call budget. +FREE_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite", "verify_receipt") +REASONS = ("value_altered", "seal_wrong", "flag_omitted", "retired_model", "stop_hidden") +GRADED_DECAY = 0.5 # graded = GRADED_DECAY ** log10(r) +OTHER_CROSSING = 0.5 # right sides, tight, around another crossing than the reference boundary + + +class Integrity(Exception): + """The answer cannot be trusted: graded 0 and reward 0.""" + + +class Wrong(Exception): + """The answer is trusted and wrong: graded 0 and reward 0.""" + + +def load_environments(path): + with open(path, encoding="utf-8") as f: + return [json.loads(line) for line in f if line.strip()] + + +def row_problems(env): + """What a task row lacks against the shared row contract (empty when none).""" + out = [] + for key in ("id", "family", "models", "real_thing", "task", "check", "seed", "reference"): + if key not in env: + out.append("no %s" % key) + family = env.get("family") + if family not in FAMILIES: + out.append("family %r" % family) + elif "kind" in env and env["kind"] != KINDS[family]: + out.append("kind %r for family %s (want %s)" % (env["kind"], family, KINDS[family])) + ref = env.get("reference") or {} + for key in ("engine_tag", "engine_commit", "engine_binary_sha256"): + if not ref.get(key): + out.append("reference.%s missing" % key) + return out + + +def file_sha256(path): + h = hashlib.sha256() + with open(path, "rb") as f: + for block in iter(lambda: f.read(1 << 20), b""): + h.update(block) + return h.hexdigest() + + +def open_verifier(engine): + if engine.startswith("http://") or engine.startswith("https://"): + verifier = Verifier(engine, pause_s=0.5) + verifier.binary_sha256 = None + else: + if not os.path.isfile(engine): + sys.exit("no file at %s: give the path to mcp_stdio, or an MCP address beginning http" % engine) + verifier = StdioVerifier([engine]) + verifier.binary_sha256 = file_sha256(engine) + try: + verifier.connect() + except McpError as problem: + sys.exit("the verifier failed, so nothing was scored: %s" % problem) + if not isinstance(verifier.server, dict) or not verifier.server.get("name"): + close_verifier(verifier) + sys.exit("the verifier failed, so nothing was scored: %s did not answer as an MCP server" % engine) + return verifier + + +def close_verifier(verifier): + if hasattr(verifier, "close"): + verifier.close() + + +# ------------------------------------------------------------------------------------------ +# reading the reply and the call logs +# ------------------------------------------------------------------------------------------ +def _no_constant(name): + raise ValueError("%s is not a number" % name) + + +def read_card(reply): + """(card, problem): the JSON object on the reply's last line. A closing code fence is passed over.""" + lines = [line.strip() for line in (reply or "").replace("\r", "\n").split("\n") if line.strip()] + while lines and lines[-1].startswith("```"): + lines.pop() + if not lines: + return None, "the reply is empty" + try: + card = json.loads(lines[-1], parse_constant=_no_constant) + except ValueError: + return None, "the last line is not one JSON object" + if not isinstance(card, dict): + return None, "the last line is not one JSON object" + return card, None + + +def tool_name(name): + """The verifier's own name for a tool an agent's program may have prefixed (mcp__zerotrust__solve).""" + if not isinstance(name, str): + return None + if name in VERIFIER_TOOLS: + return name + for tool in VERIFIER_TOOLS: + for joint in PREFIX_ENDS: + if name.endswith(joint + tool): + return tool + return name + + +def without_readout(arguments): + """A run's arguments as sealed: a readout is not part of a run's seal.""" + if not isinstance(arguments, dict): + return arguments + return {k: v for k, v in arguments.items() if k != "readout"} + + +def numbers_by_value(value): + """Every number as a float, so 18 and 18.0 (one request to the engine) compare equal; bools kept.""" + if isinstance(value, dict): + return {k: numbers_by_value(v) for k, v in value.items()} + if isinstance(value, list): + return [numbers_by_value(v) for v in value] + if isinstance(value, int) and not isinstance(value, bool): + return float(value) + return value + + +def canonical(arguments): + """A request's arguments as compared with the call log: no readout, keys sorted, numbers by value.""" + return json.dumps(numbers_by_value(without_readout(arguments)), sort_keys=True, separators=(",", ":")) + + +def _arguments(one): + arguments = one.get("arguments") + if isinstance(arguments, str): + try: + arguments = json.loads(arguments) + except ValueError: + arguments = {} + return arguments if isinstance(arguments, dict) else {} + + +def read_calls(path): + """Every call in a reply-side call log, [(tool, arguments)], or None when there is no log.""" + if not path or not os.path.isfile(path): + return None + calls = [] + with open(path, encoding="utf-8", errors="replace") as f: + for line in f: + line = line.strip() + if not line: + continue + try: + one = json.loads(line) + except ValueError: + continue + if isinstance(one, dict): + calls.append((tool_name(one.get("tool")), _arguments(one))) + return calls + + +def chain_of(previous, entry): + payload = json.dumps(entry, sort_keys=True, separators=(",", ":")) + return hashlib.sha384(((previous or "") + payload).encode("utf-8")).hexdigest() + + +def read_harness_log(path): + """(calls, problem) from a log written by harness/mcp_log_proxy.py. calls is None when there is no log; + problem names the first line whose chain does not follow (an edit, a line taken out or put in).""" + if not path or not os.path.isfile(path): + return None, None + calls, previous = [], None + with open(path, encoding="utf-8", errors="replace") as f: + for number_, line in enumerate(f, 1): + if not line.strip(): + continue + try: + entry = json.loads(line) + except ValueError: + return calls, "line %d of the harness log is not JSON" % number_ + if not isinstance(entry, dict) or "chain" not in entry: + return calls, "line %d of the harness log carries no chain" % number_ + chain = entry.pop("chain") + if chain != chain_of(previous, entry) or entry.get("seq") != len(calls) + 1: + return calls, "the harness log's chain breaks at line %d" % number_ + previous = chain + calls.append((tool_name(entry.get("tool")), _arguments(entry))) + return calls, None + + +def write_harness_log(path, calls): + """A chained log in the proxy's format, for tests and the cheat suite: calls [(tool, arguments)].""" + previous = None + with open(path, "w", encoding="utf-8") as f: + for seq, (tool, arguments) in enumerate(calls, 1): + entry = {"seq": seq, "jsonrpc_id": seq, "tool": tool, "arguments": arguments, "ts_request": None, + "ts_response": None, "duration_s": None, "response_sha384": None, "text_sha384": None, "is_error": False} + entry["chain"] = chain_of(previous, entry) + previous = entry["chain"] + f.write(json.dumps(entry, sort_keys=True) + "\n") + + +# ------------------------------------------------------------------------------------------ +# the verifier, asked again +# ------------------------------------------------------------------------------------------ +def stop_name_in(sentence): + names = re.findall(r"\(([A-Z][A-Za-z0-9]*[a-z][A-Za-z0-9]*)\)", sentence or "") + return names[-1] if names else None + + +class Replay: + """The verifier, with every answer remembered: the same request is sent once.""" + + def __init__(self, verifier): + self.verifier = verifier + self.seen = {} + server = getattr(verifier, "server", None) or {} + self.version = server.get("version") + self.binary_sha256 = getattr(verifier, "binary_sha256", None) + + def call(self, tool, arguments): + key = tool + "\x00" + json.dumps(arguments, sort_keys=True) + if key not in self.seen: + try: + self.seen[key] = self.verifier.call_json(tool, arguments) + except McpError as problem: + if not str(problem).startswith("protocol error"): + raise SystemExit("the verifier failed, so nothing was scored: %s" % problem) + self.seen[key] = ("the verifier did not take the request: %s" % problem, True) + return self.seen[key] + + def answer(self, tool, arguments, readout=None): + """One run or solve computed again: {"stopped", "outcome", "stop", "proof", "body"}.""" + arguments = copy.deepcopy(without_readout(arguments)) + if readout is not None and tool == "run_trajectory": + arguments["readout"] = readout + body, is_error = self.call(tool, arguments) + if is_error or not isinstance(body, dict): + sentence = body if isinstance(body, str) else json.dumps(body) + return {"stopped": True, "outcome": "stopped before computing", "stop": stop_name_in(sentence), + "proof": None, "body": None, "sentence": sentence} + outcome = body.get("outcome") + stopped = outcome not in NOT_STOPPED + return {"stopped": stopped, "outcome": outcome, "stop": body.get("reject") if stopped else None, + "proof": body.get("run_seal") or body.get("solution_seal"), "body": body, + "sentence": body.get("reject_detail")} + + def proof_holds(self, tool, arguments, proof): + """(holds, words): the card's seal verified by verify_tape or verify_solution, short form.""" + if not isinstance(proof, str) or not re.fullmatch(r"[0-9a-f]{96}", proof): + return False, "the proof is not a SHA-384 seal of 96 hex digits" + if tool == "run_trajectory": + body, is_error = self.call("verify_tape", {"request": without_readout(arguments), "run_seal": proof}) + elif tool == "solve": + body, is_error = self.call("verify_solution", {"request": arguments, "solution_seal": proof}) + else: + return False, "a proof is verified for run_trajectory or solve only, not %s" % tool + if is_error or not isinstance(body, dict): + return False, "the verifier would not verify it: %s" % (str(body)[:200]) + if body.get("holds") is True: + return True, None + return False, "the verifier says the seal does not hold (cause %s)" % body.get("cause") + + +def engine_problem(env, replay): + """None when the verifier is the engine the task was built on; else what differs.""" + ref = env.get("reference") or {} + tag = ref.get("gateway_version") or (ref.get("engine_tag") or "").lstrip("v") + if not tag: + return "the task names no engine it was built on" + if (ref.get("engine_tag") or "v" + tag).lstrip("v") != tag: + return "the task's engine_tag %s and gateway_version %s disagree" % (ref.get("engine_tag"), ref.get("gateway_version")) + if replay.version != tag: + return "the task was built on engine %s; the verifier is %s" % (tag, replay.version) + want = ref.get("engine_binary_sha256") + if replay.binary_sha256 and want and replay.binary_sha256 != want: + return "the verifier's binary is not the one the task was built on (sha256 %s..., want %s...)" % (replay.binary_sha256[:12], want[:12]) + return None + + +# ------------------------------------------------------------------------------------------ +# requests and their inputs +# ------------------------------------------------------------------------------------------ +_PART = re.compile(r"([A-Za-z_0-9]+)((?:\[\d+\])*)") + + +def get_path(obj, path): + here = obj + for part in path.split("."): + found = _PART.fullmatch(part) + if not found or not isinstance(here, dict) or found.group(1) not in here: + return None + here = here[found.group(1)] + for index in re.findall(r"\[(\d+)\]", found.group(2)): + if not isinstance(here, list) or int(index) >= len(here): + return None + here = here[int(index)] + return here + + +def set_path(obj, path, value): + parts = path.split(".") + here = obj + for i, part in enumerate(parts): + m = _PART.fullmatch(part) + name, idx = m.group(1), [int(k) for k in re.findall(r"\[(\d+)\]", m.group(2))] + last = i == len(parts) - 1 + if not idx: + if last: + here[name] = value + else: + here = here[name] + else: + here = here[name] + for j, k in enumerate(idx): + if last and j == len(idx) - 1: + here[k] = value + else: + here = here[k] + + +def number(value): + return isinstance(value, (int, float)) and not isinstance(value, bool) and math.isfinite(value) + + +def differs(template, given, free, where=""): + """The first place where a request differs from the task's, other than the free places. None when none.""" + if where in free: + return None + if isinstance(template, dict): + if not isinstance(given, dict): + return where or "the request" + for key in set(template) | set(given): + place = "%s.%s" % (where, key) if where else key + if place in free: + continue + if key not in given or key not in template: + return place + found = differs(template[key], given[key], free, place) + if found: + return found + return None + if isinstance(template, list): + if not isinstance(given, list) or len(given) != len(template): + return where + for index, (a, b) in enumerate(zip(template, given)): + found = differs(a, b, free, "%s[%d]" % (where, index)) + if found: + return found + return None + if number(template) and number(given): + return None if float(template) == float(given) else where + return None if template == given else where + + +def design_value(variable, run_arguments, solve_arguments, next_arguments=None): + """The design variable of one design, read from its requests (on: run, solve, or next, a continued run).""" + kind = variable["kind"] + if kind == "path": + on = variable.get("on", "run") + source = {"solve": solve_arguments, "next": next_arguments}.get(on, run_arguments) or {} + value = get_path(source, variable["path"]) + for place in variable.get("also") or []: + again = get_path(source, place) + if not (number(again) and number(value) and float(again) == float(value)): + return None + return float(value) if number(value) else None + if kind == "entry_angle_deg": + radial = get_path(run_arguments or {}, "initial.radial_speed_m_s") + transverse = get_path(run_arguments or {}, "initial.transverse_speed_m_s") + if not (number(radial) and number(transverse)) or transverse <= 0: + return None + speed = math.hypot(radial, transverse) + if abs(speed - variable["speed_m_s"]) > 1e-6 * variable["speed_m_s"]: + return None + return math.degrees(math.atan2(-radial, transverse)) + return None + + +def variable_places(variable): + if variable["kind"] == "entry_angle_deg": + return {"initial.radial_speed_m_s", "initial.transverse_speed_m_s"} + if variable["kind"] == "path" and variable.get("on", "run") == "run": + return {variable["path"]} | set(variable.get("also") or []) + return set() + + +def read_value(read, answer): + """One number from a replayed answer: final, result, or the extreme of a run's readout.""" + body = answer["body"] + if body is None: + return None + kind = read["kind"] + value = None + if kind == "final": + value = (body.get("final_state") or {}).get(read["quantity"]) + elif kind == "result": + value = (body.get("result") or {}).get(read["quantity"]) + elif kind == "flag_extent": + # an advisory flag the run raised, at its largest extent; 0 when the run does not raise it + value = max([x.get("extent") or 0.0 for x in body.get("exceedance_extremes") or [] + if isinstance(x, dict) and x.get("flag") == read["quantity"]] or [0.0]) + elif kind == "extreme": + for quantity in (body.get("readout") or {}).get("quantities") or []: + if quantity.get("quantity") == read["quantity"]: + value = quantity.get(read["which"]) + if "index" in read: + # one entry of an output the verifier returns as a list (a hose's modes, a solve asked at several points) + k = read["index"] + value = value[k] if isinstance(value, list) and isinstance(k, int) and -len(value) <= k < len(value) else None + return value if number(value) else None + + +def readout_for(constraints, on="run"): + """The readout a run is sent with: the extremes its constraints read (on: run, next, or a stage key).""" + quantities = sorted({c["read"]["quantity"] for c in constraints if c["on"] == on and c["read"]["kind"] == "extreme"}) + return {"quantities": quantities} if quantities else None + + +def design_shape(spec): + """Which of the design shapes a task's check.design is: run, coupled, continued, solve or staged.""" + if spec.get("stages"): + return "staged" + if spec.get("tool") == "solve" or spec.get("kind") == "solve": + return "solve" + chain = spec.get("chain") or {} + if chain.get("kind") == "continuation" or (chain.get("layout") or {}).get("kind") == "continue": + return "continued" + return "coupled" if chain else "run" + + +def continuation_of(spec): + """A continued design's chain in one form: (next template, {start field: where the first run's answer holds it}, + next outcomes, the next run's places that also hold a first-run design value).""" + chain = spec["chain"] + template = chain.get("next_template") or chain.get("template") or chain.get("next") + if "carried" in chain: # group 1 + carried = dict(chain["carried"]) + elif "handed" in chain: # group 4 + named = chain.get("handed_from") or {} + carried = {k: "final_state." + named.get(k, k) for k in chain["handed"]} + else: # group 5 + carried = {k: "final_state." + k for k in chain.get("carry") or []} + if chain.get("clock"): + carried[chain["clock"]["field"]] = "final_state." + chain["clock"]["from"] + outcomes = chain.get("next_outcomes") or spec["run_outcomes"] + return template, carried, outcomes, list(chain.get("next_also") or []) + + +def meets(constraint, value): + if value is None: + return False + return value <= constraint["limit"] if constraint["op"] == "<=" else value >= constraint["limit"] + + +def history_layout_problem(layout, parameters, frames_count): + """None when the arrays of a chained solve are laid out as the task states; else what is not.""" + if layout is None: + return None + if layout["kind"] == "stardust_slab": + names = ("history_time_s", "history_pressure_pa", "history_heat_transfer_coefficient_kg_per_m2_s", + "history_flow_enthalpy_j_per_kg", "history_radiative_heating_w_per_m2") + columns = [parameters.get(name) for name in names] + if not all(isinstance(c, list) and all(number(v) for v in c) for c in columns): + return "the history columns are not all lists of numbers" + time, pressure, coefficient, enthalpy, radiative = columns + rows = frames_count + 3 + if any(len(c) != rows for c in columns): + return "the history has not one row before the %d frames handed and two after them" % frames_count + if time[0] != 0.0 or coefficient[0] != 0.0: + return "row 0 is not at 0 s with no heating" + if pressure[0] != pressure[1] or enthalpy[0] != enthalpy[1]: + return "row 0 does not repeat the first frame's pressure and enthalpy" + if abs(time[-2] - (time[-3] + 1.0)) > 1e-9 or time[-1] != layout["cool_to_s"]: + return "the rows after the frames are not at 1 s after the last frame and at %g s" % layout["cool_to_s"] + if coefficient[-2] != 0.0 or coefficient[-1] != 0.0: + return "the stream is not off after the frames" + if pressure[-1] != pressure[-3] or pressure[-2] != pressure[-3] or enthalpy[-1] != enthalpy[-3] or enthalpy[-2] != enthalpy[-3]: + return "the rows after the frames do not hold the last frame's pressure and enthalpy" + if any(v != 0.0 for v in radiative): + return "a row of the history holds radiative heating" + return None + if layout["kind"] == "triga_element": + return None # every array is handed by the coupling and held to its bits by the verifier + return "an unknown layout" + + +# ------------------------------------------------------------------------------------------ +# the call record +# ------------------------------------------------------------------------------------------ +def card_requests(env, card): + """Every request on the card, [(tool, arguments)], read leniently (for the call log).""" + out = [] + + def take(part): + if isinstance(part, dict) and isinstance(part.get("request"), dict) and isinstance(part["request"].get("arguments"), dict): + out.append((tool_name(part["request"].get("tool")), part["request"]["arguments"])) + + if env["family"] in ("tradeoff", "chain_design"): + stages = [s["key"] for s in (env["check"].get("design") or {}).get("stages") or []] + for side in ("passing", "failing"): + design = card.get(side) if isinstance(card.get(side), dict) else {} + for key in stages or ("run", "solve", "next"): + take(design.get(key)) + elif env["family"] == "budget": + take(card.get("holds")) + take(card.get("stops")) + return out + + +def sequence(calls): + return [(tool_name(t), json.dumps(numbers_by_value(a), sort_keys=True)) for t, a in calls] + + +def call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row): + """None when the call record holds; else why not (an integrity failure).""" + check = env["check"] + if calls_from == "harness": + if calls is None: + return "no harness call log: every attempt is scored with the calls the harness recorded" + if log_problem: + return log_problem + if reply_calls is not None and sequence(reply_calls) != sequence(calls): + return "the call log beside the reply differs from the harness log" + elif calls is None: + return "no call log: every environment is scored with the agent's calls" + calls = [(tool_name(t), a) for t, a in calls] + banned = sorted({t for t, _ in calls if t in (check.get("forbidden") or [])}) + if banned: + return "the log holds calls of %s, which the task rules out" % ", ".join(banned) + computing = [(t, a) for t, a in calls if t not in FREE_TOOLS] + row["computing_calls"] = len(computing) + if check.get("budget") and len(computing) > check["budget"]: + return "%d computing calls; the budget is %d" % (len(computing), check["budget"]) + sent = {(t, canonical(a)) for t, a in computing} + for tool, arguments in card_requests(env, card): + if (tool, canonical(arguments)) not in sent: + return "a %s request on the card is not among the calls in the log" % tool + if env["family"] == "forensics" and not computing: + return "no computing call behind the answer: the table was not put to the verifier" + return None + + +# ------------------------------------------------------------------------------------------ +# the families +# ------------------------------------------------------------------------------------------ +def request_of(part, tool, what): + """The arguments of one request on the card (Integrity when it is not one).""" + if not isinstance(part, dict): + raise Integrity("%s is missing" % what) + request = part.get("request") + if not (isinstance(request, dict) and isinstance(request.get("arguments"), dict)): + raise Integrity("%s has no request {\"tool\": ..., \"arguments\": {...}}" % what) + if tool_name(request.get("tool")) != tool: + raise Integrity("%s is a request of %s, not %s" % (what, request.get("tool"), tool)) + return request["arguments"] + + +def score_design(env, design, which, replay, proofs): + """One design of a boundary family: facts {x, met, values, stopped, steps_landed}.""" + check = env["check"] + spec = check["design"] + shape = design_shape(spec) + if shape in ("solve", "staged", "continued") and not isinstance(design, dict): + raise Integrity("the %s design is missing" % which) + if shape == "solve": + return score_solve_design(env, design, which, replay, proofs) + if shape == "staged": + return score_staged_design(env, design, which, replay, proofs) + if shape == "continued": + return score_continued_design(env, design, which, replay, proofs) + chain = spec.get("chain") + run_args = request_of((design or {}).get("run") if isinstance(design, dict) else None, "run_trajectory", + "the %s design's run" % which) + free = set(spec.get("free") or []) | variable_places(spec["variable"]) + where = differs(spec["template"], without_readout(run_args), free) + if where: + raise Integrity("the %s design's run differs from the task's at %s" % (which, where)) + for place in spec.get("free") or []: + if place.endswith(".steps"): + steps = get_path(run_args, place) + if not (isinstance(steps, int) and not isinstance(steps, bool) and 1 <= steps <= spec.get("most_steps", 10 ** 7)): + raise Integrity("the %s design's run has no whole number of steps at %s" % (which, place)) + run_proof = design["run"].get("proof") + holds, words = replay.proof_holds("run_trajectory", run_args, run_proof) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's run_seal: %s" % (which, words)) + run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"])) + stop_names = [c["stop"] for c in check["constraints"] if c["on"] == "outcome"] + stopped_by_name = run["outcome"] == "refused" and run["stop"] in stop_names + if run["outcome"] not in spec["run_outcomes"] and not stopped_by_name: + raise Wrong("the %s design's run comes back %s%s, not %s" % ( + which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"]))) + solve_args, solve = None, None + if chain: + solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which) + if solve_args.get("solver") != chain["solver"]: + raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver"))) + handed = solve_args.get("from") + if not isinstance(handed, dict) or handed.get("coupling") != chain["coupling"]: + raise Integrity("the %s design's solve is not handed its run through the coupling %s" % (which, chain["coupling"])) + if canonical(handed.get("request")) != canonical(run_args) or handed.get("run_seal") != run_proof: + raise Integrity("the %s design's solve is not handed the design's own sealed run" % which) + parameters = solve_args.get("parameters") + if not isinstance(parameters, dict): + raise Integrity("the %s design's solve has no parameters" % which) + solve_free = set(chain.get("handed") or []) + if spec["variable"]["kind"] == "path" and spec["variable"].get("on") == "solve": + solve_free.add(spec["variable"]["path"].split(".", 1)[1]) + where = differs(chain["parameters"], parameters, solve_free) + if where: + raise Integrity("the %s design's solve differs from the task's at parameters.%s" % (which, where)) + frames = len((run["body"] or {}).get("frames") or []) + problem = history_layout_problem(chain.get("layout"), parameters, frames) + if problem: + raise Integrity("the %s design's solve: %s" % (which, problem)) + holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's solution_seal: %s" % (which, words)) + solve = replay.answer("solve", solve_args) + if solve["outcome"] != "converged": + raise Wrong("the %s design's solve comes back %s%s, not converged" % ( + which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else "")) + x = design_value(spec["variable"], run_args, solve_args) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, spec["variable"].get("words", ""))) + met, values = {}, {} + for constraint in check["constraints"]: + if constraint["on"] == "outcome": + values[constraint["id"]] = run["outcome"] if not run["stop"] else "%s (%s)" % (run["outcome"], run["stop"]) + met[constraint["id"]] = not (run["outcome"] == "refused" and run["stop"] == constraint["stop"]) + continue + value = read_value(constraint["read"], run if constraint["on"] == "run" else solve) + values[constraint["id"]] = value + met[constraint["id"]] = meets(constraint, value) + facts = {"x": x, "met": met, "values": values} + if run["outcome"] not in NOT_STOPPED and run["body"]: + facts["stopped"], facts["steps_landed"] = run["stop"], run["body"].get("steps_landed") + return facts + + +def halted(answer, stop, staged=False): + """True when an answer is stopped by the stop named: a refusal ("refused"); for a staged design, any outcome that + is not completed or converged (group 3's rule, kept as built).""" + if staged: + return answer["outcome"] not in NOT_STOPPED and answer["stop"] == stop + return answer["outcome"] == "refused" and answer["stop"] == stop + + +def constraint_facts(check, answers, judged, staged=False): + """met and values of every constraint: each read from the answer its "on" names (answers: {on: answer}); a stop + constraint ("on": "outcome") is judged on the answer judged, or on its stage's answer for a staged design.""" + met, values = {}, {} + for c in check["constraints"]: + if c["on"] == "outcome": + a = answers.get(c["stage"]) if c.get("stage") else judged + values[c["id"]] = None if a is None else (a["outcome"] if not a["stop"] else "%s (%s)" % (a["outcome"], a["stop"])) + met[c["id"]] = a is not None and not halted(a, c["stop"], staged) + continue + a = answers.get(c["on"]) + value = read_value(c["read"], a) if a is not None else None + values[c["id"]] = value + met[c["id"]] = meets(c, value) if c.get("limit") is not None else None + return met, values + + +def stopped_by(answer, constraints, stage=None): + """True when an answer is stopped by a stop one of the task's stop constraints names (for the stage given).""" + return any(halted(answer, c["stop"], stage is not None) for c in constraints + if c["on"] == "outcome" and (stage is None or c.get("stage") == stage)) + + +def score_solve_design(env, design, which, replay, proofs): + """One design that is one solve and no run (check.design.tool or kind "solve").""" + check = env["check"] + spec = check["design"] + var = spec["variable"] + solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which) + if solve_args.get("solver") != spec["template"].get("solver"): + raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver"))) + free = set(spec.get("free") or []) | {var["path"]} | set(var.get("also") or []) + where = differs(spec["template"], solve_args, free) + if where: + raise Integrity("the %s design's solve differs from the task's at %s" % (which, where)) + holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's solution_seal: %s" % (which, words)) + solve = replay.answer("solve", solve_args) + if solve["outcome"] not in spec["run_outcomes"] and not stopped_by(solve, check["constraints"]): + raise Wrong("the %s design's solve comes back %s%s, not %s" % ( + which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else "", " or ".join(spec["run_outcomes"]))) + x = design_value(dict(var, on="solve"), None, solve_args) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", ""))) + met, values = constraint_facts(check, {"solve": solve}, solve) + facts = {"x": x, "met": met, "values": values} + if solve["outcome"] not in NOT_STOPPED and solve["body"]: + facts["stopped"], facts["steps_landed"], facts["no_step"] = solve["stop"], None, True + return facts + + +def score_continued_design(env, design, which, replay, proofs): + """One design of a run and the run that continues it through from. The verifier holds the hand-off: it computes + the first run again, compares its seal and refuses a start that is not the first run's final state; the scorer + also holds each carried start field to the first run's answer, bit for bit.""" + check = env["check"] + spec = check["design"] + var = spec["variable"] + on_next = var["kind"] == "path" and var.get("on") == "next" + template, carried, next_outcomes, next_also = continuation_of(spec) + run_args = request_of(design.get("run"), "run_trajectory", "the %s design's run" % which) + free = set(spec.get("free") or []) | (set() if on_next else variable_places(var)) + where = differs(spec["template"], without_readout(run_args), free) + if where: + raise Integrity("the %s design's run differs from the task's at %s" % (which, where)) + run_proof = design["run"].get("proof") + holds, words = replay.proof_holds("run_trajectory", run_args, run_proof) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's run_seal: %s" % (which, words)) + run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"], "run")) + if run["outcome"] not in spec["run_outcomes"]: + raise Wrong("the %s design's first run comes back %s%s, not %s" % ( + which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"]))) + next_args = request_of(design.get("next"), "run_trajectory", "the %s design's next run" % which) + handed = next_args.get("from") + if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(run_args) + or handed.get("run_seal") != run_proof): + raise Integrity("the %s design's next run does not continue the design's own sealed run (from)" % which) + next_free = {"initial." + name for name in carried} | {"from"} | set(next_also) + if on_next: + next_free |= {var["path"]} | set(var.get("also") or []) + where = differs(template, without_readout(next_args), next_free) + if where: + raise Integrity("the %s design's next run differs from the task's at %s" % (which, where)) + start = next_args.get("initial") if isinstance(next_args.get("initial"), dict) else {} + for name, source in carried.items(): + held, given = get_path(run["body"] or {}, source), start.get(name) + if name not in start or not (given == held or (number(given) and number(held) and float(given) == float(held))): + raise Integrity("the %s design's next run does not start from its run's %s, bit for bit" % (which, source)) + holds, words = replay.proof_holds("run_trajectory", next_args, design["next"].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's next run_seal: %s" % (which, words)) + nxt = replay.answer("run_trajectory", next_args, readout_for(check["constraints"], "next")) + if nxt["outcome"] not in next_outcomes and not stopped_by(nxt, check["constraints"]): + raise Wrong("the %s design's next run comes back %s%s, not %s" % ( + which, nxt["outcome"], " (%s)" % nxt["stop"] if nxt["stop"] else "", " or ".join(next_outcomes))) + x = design_value(var, run_args, None, next_args) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", ""))) + for place in next_also: + again = get_path(next_args, place) + if not (number(again) and float(again) == float(x)): + raise Integrity("the %s design's next run does not hold the design value at %s" % (which, place)) + met, values = constraint_facts(check, {"run": run, "next": nxt}, nxt) + facts = {"x": x, "met": met, "values": values} + if nxt["outcome"] not in NOT_STOPPED and nxt["body"]: + facts["stopped"], facts["steps_landed"] = nxt["stop"], nxt["body"].get("steps_landed") + return facts + + +def build_stage_request(spec, stage, x, answers, requests): + """One stage's request of a staged design at x: the template, x at the variable's places, the values handed from + earlier stages' answers, and a continuation's start and from (used by run_reference.py).""" + q = copy.deepcopy(stage["template"]) + var = spec["variable"] + if var.get("stage") == stage["key"]: + for place in [var["path"]] + list(var.get("also") or []): + set_path(q, place, x) + for h in stage.get("handed") or []: + set_path(q, h["to"], read_value(h["read"], answers[h["from"]])) + if stage.get("continues"): + parent = stage["continues"] + final = answers[parent]["body"]["final_state"] + q["initial"] = {k: final[k] for k in stage["template"]["initial"]} + q["from"] = {"request": copy.deepcopy(requests[parent]), "run_seal": answers[parent]["proof"]} + return q + + +def score_staged_design(env, design, which, replay, proofs): + """One staged design (check.design.stages): each stage a run or a solve, in order.""" + check = env["check"] + spec = check["design"] + var = spec["variable"] + stages = spec["stages"] + answers, requests, facts = {}, {}, {} + for i, stage in enumerate(stages): + key, tool = stage["key"], stage["tool"] + sent = without_readout(request_of(design.get(key), tool, "the %s design's %s" % (which, key))) + free = set(stage.get("free") or []) | {h["to"] for h in stage.get("handed") or []} + if var.get("stage") == key: + free |= {var["path"]} | set(var.get("also") or []) + if stage.get("continues"): + free |= {"initial", "from"} + where = differs(stage["template"], sent, free) + if where: + raise Integrity("the %s design's %s differs from the task's at %s" % (which, key, where)) + for h in stage.get("handed") or []: + want = read_value(h["read"], answers[h["from"]]) + got = get_path(sent, h["to"]) + if want is None or not number(got) or float(got) != float(want): + raise Integrity("the %s design's %s does not carry %s's %s at %s, bit for bit" % ( + which, key, h["from"], h["read"]["quantity"], h["to"])) + if stage.get("continues"): + parent = stage["continues"] + handed = sent.get("from") + if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(requests[parent]) + or handed.get("run_seal") != design[parent].get("proof")): + raise Integrity("the %s design's %s does not continue the design's own sealed %s run (from)" % (which, key, parent)) + final = (answers[parent]["body"] or {}).get("final_state") or {} + start = sent.get("initial") + keys = set(stage["template"]["initial"]) + if not isinstance(start, dict) or set(start) != keys or any( + not number(start[k]) or float(start[k]) != final.get(k) for k in keys): + raise Integrity("the %s design's %s does not start from the final state of its %s run, bit for bit" % (which, key, parent)) + holds, words = replay.proof_holds(tool, sent, design[key].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's %s proof: %s" % (which, key, words)) + answer = replay.answer(tool, sent, readout_for(check["constraints"], key) if tool == "run_trajectory" else None) + named = stopped_by(answer, check["constraints"], stage=key) + if answer["outcome"] not in stage["outcomes"] and not named: + raise Wrong("the %s design's %s comes back %s%s, not %s" % ( + which, key, answer["outcome"], " (%s)" % answer["stop"] if answer["stop"] else "", " or ".join(stage["outcomes"]))) + answers[key], requests[key] = answer, sent + if named: + facts["stopped"], facts["stopped_stage"] = answer["stop"], key + facts["steps_landed"] = (answer["body"] or {}).get("steps_landed") if tool == "run_trajectory" else None + facts["no_step"] = tool != "run_trajectory" + if i != len(stages) - 1: + raise Wrong("the %s design's %s stops (%s) before its last stage" % (which, key, answer["stop"])) + x = design_value(dict(var, on="run"), requests.get(var["stage"]), None) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", ""))) + met, values = constraint_facts(check, answers, None, staged=True) + facts.update({"x": x, "met": met, "values": values}) + return facts + + +def grade_bracket(a, b, star, tol, slack, row): + """(reward_ok, graded) for a bracket [a, b] with its sides right.""" + width = abs(b - a) + straddles = min(a, b) - slack <= star <= max(a, b) + slack + within = width <= tol * (1 + 1e-9) + e = max(a, b, star) - min(a, b, star) + r = e / tol if tol > 0 else float("inf") + row["width"], row["width_ratio"] = width, r + if within and straddles: + return True, 1.0 + if r <= 1: + return False, OTHER_CROSSING + return False, GRADED_DECAY ** math.log10(r) + + +def score_boundary(env, card, replay, row, proofs): + check, reference = env["check"], env["reference"] + passing = score_design(env, card.get("passing"), "passing", replay, proofs) + failing = score_design(env, card.get("failing"), "failing", replay, proofs) + row["passing"], row["failing"] = passing, failing + span = check["design"].get("range") + if span and not all(span[0] <= x <= span[1] for x in (passing["x"], failing["x"])): + raise Wrong("a design lies outside the range the task states, %g to %g" % tuple(span)) + broken = [c for c, ok in passing["met"].items() if not ok] + if broken: + raise Wrong("the passing design breaks %s" % ", ".join(broken)) + broken = [c for c, ok in failing["met"].items() if not ok] + if not broken: + raise Wrong("the failing design meets every constraint") + binding = card.get("binding") + if binding != reference["binding"]: + raise Wrong("binding names %r; the constraint that binds is another" % (binding,)) + if binding not in broken: + raise Wrong("the failing design does not break %s, the constraint named binding" % binding) + if binding in [c["id"] for c in check["constraints"] if c["on"] == "outcome"]: + said = card.get("failing") or {} + if said.get("stopped") != failing.get("stopped"): + raise Wrong("the failing design's run stops with %s; the card says %r" % (failing.get("stopped"), said.get("stopped"))) + if failing.get("no_step"): + pass # a solve that is refused has no step: its stop's name is stated + elif not (isinstance(said.get("step"), int) and not isinstance(said.get("step"), bool) and said["step"] == failing.get("steps_landed")): + raise Wrong("the failing design's run is sealed to step %s; the card says %r" % (failing.get("steps_landed"), said.get("step"))) + spec = check["design"] + xp, xf = passing["x"], failing["x"] + if spec["direction"] == "largest" and not xf > xp: + raise Wrong("the task asks for the largest value that holds: the failing design must lie above the passing one") + if spec["direction"] == "smallest" and not xf < xp: + raise Wrong("the task asks for the smallest value that holds: the failing design must lie below the passing one") + ok, graded = grade_bracket(xp, xf, reference["boundary"], spec["tolerance"], spec["tolerance"] * 0.5, row) + if not ok: + return graded, "the two designs are %.6g apart; the task asks for %.6g or less, and they must straddle the boundary" % ( + abs(xf - xp), spec["tolerance"]) + return 1.0, None + + +def score_budget(env, card, replay, row, proofs): + check, reference = env["check"], env["reference"] + template, path, tool = check["template"], check["variable"], check["tool"] + sides = {} + for side in ("holds", "stops"): + arguments = request_of(card.get(side), tool, side) + also = check.get("also") or [] + where = differs(template, without_readout(arguments), {path} | set(also)) + if where: + raise Integrity("the %s request differs from the task's at %s" % (side, where)) + x = get_path(arguments, path) + if not number(x): + raise Integrity("the %s request has no number at %s" % (side, path)) + for place in also: + again = get_path(arguments, place) + if not (number(again) and float(again) == float(x)): + raise Integrity("the %s request does not hold the same value at %s as at %s" % (side, place, path)) + holds, words = replay.proof_holds(tool, arguments, card[side].get("proof")) + proofs.append(holds) + sides[side] = (float(x), arguments, holds, words) + for side in ("holds", "stops"): + if not sides[side][2]: + raise Integrity("the %s seal: %s" % (side, sides[side][3])) + held = replay.answer(tool, sides["holds"][1]) + stopped = replay.answer(tool, sides["stops"][1]) + row["holds_outcome"], row["stops_outcome"] = held["outcome"], "%s (%s)" % (stopped["outcome"], stopped["stop"]) + if held["outcome"] not in NOT_STOPPED: + raise Wrong("the holds request comes back %s (%s)" % (held["outcome"], held["stop"])) + if stopped["stop"] != check["stop"]: + raise Wrong("the stops request comes back %s (%s), not the stop %s" % (stopped["outcome"], stopped["stop"], check["stop"])) + if card["stops"].get("stopped") != check["stop"]: + raise Wrong("the card names the stop %r; the verifier names %s" % (card["stops"].get("stopped"), check["stop"])) + xh, xs = sides["holds"][0], sides["stops"][0] + star = reference["boundary"] + row["holds_value"], row["stops_value"] = xh, xs + tol = check["relative_width"] * abs(star) + ok, graded = grade_bracket(xh, xs, star, tol, 1e-9 * abs(star), row) + if not ok: + return graded, "the bracket is %.6g wide; the task asks for %.3g of the value or less, and it must hold the stop" % ( + abs(xs - xh), check["relative_width"]) + return 1.0, None + + +def forensics_f1(env, named): + """(graded, problem): F1 over (row, reason) pairs; problem when the card is not a usable answer.""" + if not isinstance(named, dict): + return 0.0, "false_rows is not an object of row and reason" + rows = [c["row"] for c in env["check"]["rows"]] + truth = env["reference"]["false_rows"] + unknown = [r for r in named if r not in set(rows)] + if unknown: + return 0.0, "no rows %s in the table" % ", ".join(sorted(unknown)) + reasons = env["check"].get("reasons") or REASONS + bad = [r for r, why in named.items() if why not in reasons] + if bad: + return 0.0, "the reason for %s is not one of %s" % (", ".join(sorted(bad)), ", ".join(reasons)) + if rows and set(named) == set(rows): + return 0.0, "every row of the table is named false: a blanket answer" + found = sum(1 for r, why in named.items() if truth.get(r) == why) + if not truth and not named: + return 1.0, None + precision = found / len(named) if named else 0.0 + recall = found / len(truth) if truth else 0.0 + f1 = 2 * precision * recall / (precision + recall) if precision + recall else 0.0 + if f1 >= 1.0: + return 1.0, None + missed = sorted(set(truth) - set(named)) + wrongly = sorted(set(named) - set(truth)) + wrong_reason = sorted(r for r in set(truth) & set(named) if truth[r] != named[r]) + said = [] + if missed: + said.append("%d false row(s) not named" % len(missed)) + if wrongly: + said.append("%d genuine row(s) named false" % len(wrongly)) + if wrong_reason: + said.append("%d false row(s) with another reason" % len(wrong_reason)) + return f1, "; ".join(said) + + +def score(env, reply, replay, calls=None, reply_calls=None, calls_from="reply", log_problem=None): + """One environment scored. calls: the authoritative record [(tool, arguments)] (None: no record); + reply_calls: the reply-side log, compared with calls under calls_from="harness".""" + row = {"id": env["id"], "family": env["family"], "kind": KINDS.get(env["family"]), "calls_from": calls_from, + "correct": 0, "proofs_hold": 0, "reward": 0, "graded": 0.0, "verdict": None, "reason": None} + card, problem = read_card(reply) + if problem: + row.update(verdict="no_card", reason=problem) + return row + proofs = [] + try: + problem = engine_problem(env, replay) + if problem: + raise Integrity(problem) + problem = call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row) + if problem: + raise Integrity(problem) + family = env["family"] + if family in ("tradeoff", "chain_design"): + graded, reason = score_boundary(env, card, replay, row, proofs) + elif family == "budget": + graded, reason = score_budget(env, card, replay, row, proofs) + elif family == "forensics": + named = card.get("false_rows") + if isinstance(named, dict): + row["named"] = named + graded, reason = forensics_f1(env, named) + proofs = [True] + if reason and graded == 0.0 and not isinstance(named, dict): + raise Wrong(reason) + else: + raise Wrong("unknown family %s" % family) + except Integrity as problem: + row.update(verdict="integrity", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs))) + return row + except Wrong as problem: + row.update(verdict="wrong", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs))) + return row + proofs_hold = int(bool(proofs) and all(proofs)) + correct = int(graded >= 1.0 and reason is None) + row.update(correct=correct, proofs_hold=proofs_hold, reward=int(correct == 1 and proofs_hold == 1), + graded=round(graded, 6) if proofs_hold else 0.0, + verdict="pass" if correct and proofs_hold else ("near" if graded > 0 else "wrong"), reason=reason) + return row + + +def records_for(folder, env_id, calls_from, harness_dir=None): + """(calls, reply_calls, log_problem) for one environment's reply in folder.""" + reply_calls = read_calls(os.path.join(folder, env_id + ".calls.jsonl")) + if calls_from == "harness": + calls, log_problem = read_harness_log(os.path.join(harness_dir or folder, env_id + ".harness.jsonl")) + return calls, reply_calls, log_problem + return reply_calls, None, None + + +def main(): + parser = argparse.ArgumentParser(description=__doc__.split("\n")[0]) + parser.add_argument("replies") + parser.add_argument("--engine", required=True) + parser.add_argument("--only") + parser.add_argument("--environments", required=True) + parser.add_argument("--out") + parser.add_argument("--calls-from", choices=("reply", "harness"), default="harness") + parser.add_argument("--harness-dir") + parser.add_argument("--quiet", action="store_true") + args = parser.parse_args() + environments = load_environments(args.environments) + if args.only: + wanted = set(args.only.split(",")) + environments = [e for e in environments if e["id"] in wanted] + missing = wanted - {e["id"] for e in environments} + if missing: + sys.exit("no environments %s in %s" % (", ".join(sorted(missing)), args.environments)) + for env in environments: + for problem in row_problems(env): + print("warning: %s: %s" % (env.get("id"), problem), file=sys.stderr) + verifier = open_verifier(args.engine) + replay = Replay(verifier) + rows = [] + try: + for env in environments: + path = os.path.join(args.replies, env["id"] + ".txt") + reply = open(path, encoding="utf-8", errors="replace").read() if os.path.isfile(path) else "" + calls, reply_calls, log_problem = records_for(args.replies, env["id"], args.calls_from, args.harness_dir) + row = score(env, reply, replay, calls, reply_calls, args.calls_from, log_problem) + rows.append(row) + if not args.quiet: + print("%-58s reward %d graded %.4f %-9s %s" % (env["id"], row["reward"], row["graded"], row["verdict"], + row["reason"] or ""), flush=True) + replay.seen.clear() + finally: + close_verifier(verifier) + if args.out: + with open(args.out, "w", encoding="utf-8") as f: + for row in rows: + f.write(json.dumps(row) + "\n") + total = len(rows) + print("\n%d environments: reward %d, graded %.4f (mean %.4f), correct %d, proofs_hold %d" % ( + total, sum(r["reward"] for r in rows), sum(r["graded"] for r in rows), + sum(r["graded"] for r in rows) / total if total else 0.0, + sum(r["correct"] for r in rows), sum(r["proofs_hold"] for r in rows))) + by = {} + for r in rows: + by.setdefault(r["family"], []).append(r) + for family in FAMILIES: + if family in by: + print(" %-13s reward %d of %d, mean graded %.4f" % (family, sum(r["reward"] for r in by[family]), len(by[family]), + sum(r["graded"] for r in by[family]) / len(by[family]))) + + +if __name__ == "__main__": + main() diff --git a/sample/tasks/harbor/tasks/g2-forensics6-07/solution/solve.sh b/sample/tasks/harbor/tasks/g2-forensics6-07/solution/solve.sh new file mode 100644 index 0000000000000000000000000000000000000000..72cbff6116b4373dcb5a275b10f1ea91c863186a --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-forensics6-07/solution/solve.sh @@ -0,0 +1,30 @@ +#!/bin/bash +# Harbor's oracle agent copies solution/ to /solution and runs this. +# +# It makes the reference answer card here, on the verifier of this machine: the +# dataset's own run_reference.py sends this environment's reference requests to +# /usr/local/bin/mcp_stdio (and, for a chained design, hands each run to its solve +# through the task's coupling) and writes a reply that ends with the card. The card +# is saved where the instruction asks for it, and the calls it made beside it, so +# that a call-budget environment is scored on them: the oracle runs no model, and +# Harbor's record of its run holds no tool call. +# +# The four paths can be moved with environment variables, so this runs outside a container. +set -euo pipefail +HERE="${ZTP_SOLUTION_DIR:-$(cd "$(dirname "$0")" && pwd)}" +ENGINE="${ZTP_ENGINE:-/usr/local/bin/mcp_stdio}" +ANSWER="${ZTP_ANSWER_FILE:-/app/answer.json}" +CALLS="${ZTP_CALLS_FILE:-/app/calls.jsonl}" +WORK="$(mktemp -d)" +trap 'rm -rf "$WORK"' EXIT + +cd "$HERE" +FLAGS=() +grep -q -- '"--environments"' run_reference.py && FLAGS+=(--environments data/environments.jsonl) +grep -q -- '"--direct"' run_reference.py && FLAGS+=(--direct) # no proxy in here: the oracle's own call log +python3 -B run_reference.py --engine "$ENGINE" ${FLAGS[@]+"${FLAGS[@]}"} --out "$WORK/replies" +REPLY="$(ls "$WORK"/replies/*.txt)" # one environment here, so one reply +cat "$REPLY" +mkdir -p "$(dirname "$ANSWER")" "$(dirname "$CALLS")" +tail -n 1 "$REPLY" > "$ANSWER" +cp "$WORK"/replies/*.calls.jsonl "$CALLS" diff --git a/sample/tasks/harbor/tasks/g2-forensics6-07/solution/ztp_mcp.py b/sample/tasks/harbor/tasks/g2-forensics6-07/solution/ztp_mcp.py new file mode 100644 index 0000000000000000000000000000000000000000..0cde73653317c847cd361ad0ca9d4f1f785bc3a7 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-forensics6-07/solution/ztp_mcp.py @@ -0,0 +1,188 @@ +"""A small Model Context Protocol client for the Zero-Trust Physics verifier. + +Standard library only. It speaks MCP two ways: + + stdio to a verifier built from the public source and started here as a program + (target/release/mcp_stdio): one JSON-RPC message a line, no network. + HTTP to an MCP address (JSON-RPC in a POST), such as + + https://mcp.zerotrustphysics.com/mcp Open to any agent. + +The open address gives each network address one place in the physics pool at a +time and answers "Too many concurrent physics tasks." or HTTP 429 when it is +busy; nothing waits on the server, so this client sends one request at a time +and, when it is told to come back, waits and sends the same request again. + +Licence: Apache-2.0. +""" +import json +import select +import shlex +import subprocess +import time +import urllib.error +import urllib.request + +OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp" +BUSY = "Too many concurrent physics tasks." + + +class McpError(RuntimeError): + pass + + +class Verifier: + """One MCP endpoint. call(tool, arguments) returns (text, is_error).""" + + def __init__(self, url=OPEN_ADDRESS, timeout_s=90, patience_s=600, pause_s=0.0, headers=None, quiet=True): + self.url = url + self.timeout_s = timeout_s + self.patience_s = patience_s # how long to keep asking politely before giving up on one request + self.pause_s = pause_s # a fixed pause after every request, for a shared address + self.headers = dict(headers or {}) + self.quiet = quiet + self.session = None + self.server = None + self.requests_sent = 0 + self.times_asked_to_wait = 0 + self._id = 0 + + # -- transport ------------------------------------------------------------------------- + def _post(self, message): + body = json.dumps(message).encode() + headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream", + "User-Agent": "zero-trust-physics-environments/1.0", **self.headers} + if self.session: + headers["Mcp-Session-Id"] = self.session + request = urllib.request.Request(self.url, data=body, headers=headers, method="POST") + self.requests_sent += 1 + with urllib.request.urlopen(request, timeout=self.timeout_s) as response: + session = response.headers.get("Mcp-Session-Id") + if session: + self.session = session + raw = response.read().decode("utf-8") + kind = response.headers.get("Content-Type", "") + if "text/event-stream" in kind: + for line in raw.splitlines(): + if line.startswith("data:"): + found = json.loads(line[5:].strip()) + if found.get("id") == message.get("id"): + return found + raise McpError("the event stream held no answer to the request") + return json.loads(raw) if raw.strip() else {} + + def _ask(self, method, params=None): + """Send one request; on 429, a busy pool, a 5xx or a dropped connection, wait and send it again.""" + self._id += 1 + message = {"jsonrpc": "2.0", "id": self._id, "method": method} + if params is not None: + message["params"] = params + started, wait = time.time(), 2.0 + while True: + reason = None + try: + answer = self._post(message) + if "error" in answer: + raise McpError("protocol error: %s" % json.dumps(answer["error"])[:300]) + result = answer.get("result", {}) + text = "".join(c.get("text", "") for c in result.get("content", []) or []) + if method == "tools/call" and BUSY in text and len(text) < 400: + reason = "the physics pool is busy" + else: + if self.pause_s: + time.sleep(self.pause_s) + return result + except urllib.error.HTTPError as problem: + if problem.code == 429 or problem.code >= 500: + after = problem.headers.get("Retry-After") + reason = "HTTP %d" % problem.code + if after and after.isdigit(): + wait = max(wait, float(after)) + else: + raise McpError("HTTP %d: %s" % (problem.code, problem.read().decode("utf-8", "replace")[:300])) + except (urllib.error.URLError, TimeoutError, ConnectionError, OSError) as problem: + reason = "no connection (%s)" % problem + self.times_asked_to_wait += 1 + if time.time() - started + wait > self.patience_s: + raise McpError("gave up after %d s: %s" % (self.patience_s, reason)) + if not self.quiet: + print(" %s; asking again in %.0f s" % (reason, wait), flush=True) + time.sleep(wait) + wait = min(wait * 1.6, 30.0) + + # -- protocol -------------------------------------------------------------------------- + def connect(self): + result = self._ask("initialize", {"protocolVersion": "2025-06-18", "capabilities": {}, + "clientInfo": {"name": "zero-trust-physics-environments", "version": "1.0"}}) + self.server = result.get("serverInfo") + try: + self._post({"jsonrpc": "2.0", "method": "notifications/initialized"}) + except Exception: # a notification has no answer; some servers close without one + pass + return result + + def tools(self): + """The tool declarations exactly as the endpoint gives them.""" + return self._ask("tools/list").get("tools", []) + + def call(self, tool, arguments=None): + """Call one tool. Returns (text, is_error): the text of the answer and the MCP isError flag.""" + result = self._ask("tools/call", {"name": tool, "arguments": arguments or {}}) + text = "".join(c.get("text", "") for c in result.get("content", []) or []) + return text, bool(result.get("isError")) + + def call_json(self, tool, arguments=None): + """Call one tool. Returns (body, is_error): the parsed JSON, or the text when it is not JSON.""" + text, is_error = self.call(tool, arguments) + try: + return json.loads(text), is_error + except ValueError: + return text, is_error + + +class StdioVerifier(Verifier): + """The same interface over MCP stdio: a program started here that speaks JSON-RPC, one message a line. + For anyone who holds an MCP server as a program; the open address needs none of this.""" + + def __init__(self, command, timeout_s=600, **kwargs): + super().__init__(url="stdio: " + (command if isinstance(command, str) else " ".join(command)), timeout_s=timeout_s, **kwargs) + self.proc = subprocess.Popen(shlex.split(command) if isinstance(command, str) else command, + stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) + + def _post(self, message): + self.requests_sent += 1 + try: + self.proc.stdin.write((json.dumps(message) + "\n").encode()) + self.proc.stdin.flush() + except OSError: # a program that has stopped reading will not start again + try: + self.proc.stdin.close() + except OSError: + pass + raise McpError("the program stopped reading") + if "id" not in message: + return {} + while True: + ready, _, _ = select.select([self.proc.stdout], [], [], self.timeout_s) + if not ready: + raise McpError("no answer in %d s" % self.timeout_s) + line = self.proc.stdout.readline() + if not line: + raise McpError("the program closed its output") + found = json.loads(line) + if found.get("id") == message["id"]: + return found + + def close(self): + self.proc.terminate() + try: + self.proc.wait(timeout=5) + except subprocess.TimeoutExpired: + self.proc.kill() + + +def connect(endpoint=OPEN_ADDRESS, **kwargs): + """A connected verifier: an http(s) address, or "stdio:" for a program.""" + verifier = StdioVerifier(endpoint[len("stdio:"):].strip(), **kwargs) if endpoint.startswith("stdio:") else Verifier(endpoint, **kwargs) + verifier.connect() + return verifier diff --git a/sample/tasks/harbor/tasks/g2-forensics6-07/task.toml b/sample/tasks/harbor/tasks/g2-forensics6-07/task.toml new file mode 100644 index 0000000000000000000000000000000000000000..86cf52994142cb48455b5933240c5f70053ce406 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-forensics6-07/task.toml @@ -0,0 +1,40 @@ +schema_version = "1.4" +artifacts = ["/app/answer.json", "/app/calls.jsonl", "/logs/agent/trajectory.json", "/logs/agent/oracle.txt"] + +[task] +name = "protocol-company/g2-forensics6-07" +version = "1.0.0" +description = "Forensics: claims about sealed answers, some falsified, each verified against the verifier and named, scored against the recorded truth." +authors = [{ name = "Protocol Company" }] +keywords = ["zero-trust-physics", "physics", "mcp", "tool-use", "verifier", "multi-step", "forensics"] + +[metadata] +environment_id = "g2-forensics6-07" +family = "forensics" +kind = "forensics" +engine_source = "https://github.com/johnkruze/zero-trust-physics-engine" +engine_tag = "v0.15.3" +engine_commit = "664d68f426ccdfd0159e5f91857edba3872390d1" +engine_binary_sha256 = "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076" +gateway_version = "0.15.3" +scores = ["correct", "proofs_hold"] + +[agent] +timeout_sec = 1800.0 + +[verifier] +timeout_sec = 900.0 +environment_mode = "separate" + +[environment] +build_timeout_sec = 1800.0 +cpus = 1 +memory_mb = 2048 +storage_mb = 10240 +workdir = "/app" + +[[environment.mcp_servers]] +name = "verifier" +transport = "stdio" +command = "/usr/local/bin/mcp_stdio" +args = [] diff --git a/sample/tasks/harbor/tasks/g2-forensics6-07/tests/Dockerfile b/sample/tasks/harbor/tasks/g2-forensics6-07/tests/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..a455d9232114f3794e779f59ca8648029bb057f4 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-forensics6-07/tests/Dockerfile @@ -0,0 +1,11 @@ +# The grader's image: the task's tests at /tests and the verifier of release v0.15.3 as an MCP stdio server at +# /usr/local/bin/mcp_stdio (a bridge to its address). +FROM python:3.12-slim-bookworm +ARG ZTP_ENGINE_TAG=v0.15.3 +ARG ZTP_ENGINE_COMMIT=664d68f426ccdfd0159e5f91857edba3872390d1 +COPY ztp_open_bridge.py /usr/local/lib/ztp/ztp_open_bridge.py +RUN printf '#!/bin/sh\nexec python3 /usr/local/lib/ztp/ztp_open_bridge.py "${ZTP_VERIFIER_URL:-https://mcp.zerotrustphysics.com/mcp}"\n' > /usr/local/bin/mcp_stdio \ + && chmod +x /usr/local/bin/mcp_stdio +COPY . /tests +RUN mkdir -p /logs/verifier /logs/agent /logs/artifacts /app +WORKDIR /app diff --git a/sample/tasks/harbor/tasks/g2-forensics6-07/tests/environment.jsonl b/sample/tasks/harbor/tasks/g2-forensics6-07/tests/environment.jsonl new file mode 100644 index 0000000000000000000000000000000000000000..370eda010ccac04c187e441c128b2e85e0b7282e --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-forensics6-07/tests/environment.jsonl @@ -0,0 +1 @@ +{"id": "g2-forensics6-07", "family": "forensics", "kind": "forensics", "models": ["ablator_slab", "aerospace/capsule_insight", "aerospace/capsule_stardust", "aerospace/crater_ryugu_sci", "aerospace/los_jwst_fine_guide", "aerospace/momentum_jwst_dihedral", "aerospace/momentum_jwst_srp", "aerospace/satellite_lageos1", "aerospace/solar_system", "plasma_sheath_ram_c2"], "real_thing": "Twelve answers of the verifier over 10 models of entry, orbit and space.", "task": "A report hands you twelve claims about answers of the verifier. Each row gives the model, the request as it was sent, what its answer is claimed to say and the proof claimed for it. claim.outcome and claim.stop are the run's outcome and the name of its stop or declared end (null when it completed); claim.steps_landed is the last step the run is sealed to; claim.quantity and claim.value are one number of the final state of a run (of the result, for a solve); claim.flags are the advisory flags the run carried, each with the quantity it is on, its extent at the largest (extent) and the number of steps it was raised on (steps).\nSome rows are false. A false row may be wrong in more than one way; its reason is the first of these, in this order, that is true of it:\n1. retired_model: the request names a model ID the verifier does not serve (one it no longer serves, or a name it never served).\n2. parent_wrong: the request continues a run (from) that is not the parent it names: its start state, or the seal it gives for its parent, belongs to another run, and the verifier refuses the continuation.\n3. seal_wrong: the proof is not the seal of this request.\n4. stop_hidden: the run stops part way and the claim says it completed.\n5. step_wrong: the claim names the run's stop, but not the last step the run is sealed to.\n6. flag_omitted: the run carries an advisory flag (a name on a quantity) that the claim leaves out altogether.\n7. flag_altered: the flags the claim lists are not the run's, entry for entry: an extent or a count of steps differs, or an entry is missing or added where its name on that quantity is listed too (the verifier may list one flag on one quantity more than once, each with its own extent).\n8. value_altered: the claimed value is not the one the request gives, to the last digit.\nA row that is none of these is genuine, whatever else differs in how it is written (the order of its flags, a readout sent with the request, the spelling of a number). Name every false row with its reason.\nThe rows, one a line:\n{\"row\": \"R1\", \"model\": \"aerospace/momentum_jwst_srp\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_srp\", \"initial\": {\"h_eci_nms\": [-1.244, -0.73, 1.098]}, \"dt_s\": 1599.0, \"segments\": [{\"steps\": 69, \"load\": {\"q1\": 0.655763, \"q2\": -0.008127, \"q3\": -0.635608, \"q4\": 0.407321, \"sun_x\": 0.616092, \"sun_y\": 0.711198, \"sun_z\": 0.338568, \"sun_distance_au\": 1.00863}}], \"record_every\": 69}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 69, \"quantity\": \"h_magnitude_nms\", \"value\": 2.2890861976984564, \"flags\": []}, \"proof\": \"949c987ad62f835ca215267699517ed2e659b5e776277779896aaf721a03f139d674ea7e0f671e6160f37eaca17eaade\"}\n{\"row\": \"R2\", \"model\": \"aerospace/capsule_insight\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_insight\", \"initial\": {\"radius_m\": 3522956.0, \"radial_speed_m_s\": -1294.7972, \"transverse_speed_m_s\": 5730.5432}, \"dt_s\": 0.1, \"segments\": [{\"steps\": 2152, \"load\": {\"lift_over_drag\": 0.0}}], \"record_every\": 2152}}, \"claim\": {\"outcome\": \"ended\", \"stop\": \"PastFlightDeployment\", \"steps_landed\": 2115, \"quantity\": \"mach\", \"value\": 1.3960519703767567, \"flags\": []}, \"proof\": \"a4065183ea2043a6b9568252634e364467b059fc61f9a23478a29d53c70035b9b199b77f07d277aa257df8e292b9ce3b\"}\n{\"row\": \"R3\", \"model\": \"ablator_slab\", \"request\": {\"tool\": \"solve\", \"arguments\": {\"solver\": \"ablator_slab\", \"parameters\": {\"material\": \"TACOT 3.0\", \"thickness_m\": 0.0461, \"start_temperature_k\": 306.3, \"thermocouple_depths_m\": [], \"face\": \"held_temperature\", \"held_temperature_k\": 1920.0, \"hold_duration_s\": 60.0, \"continue_after_s\": 40.0, \"return_face_history\": false, \"return_thermocouple_histories\": false, \"return_final_profile\": false}}}, \"claim\": {\"outcome\": \"converged\", \"stop\": null, \"steps_landed\": null, \"quantity\": \"heat_in_through_face_j_per_m2\", \"value\": 7320760.59153902, \"flags\": []}, \"proof\": \"eec6980868952c49cd6a1017930f98d396e4452a470c6fa0eacd9b4e00d4aa1c3c32a4c83a59d23ebb96511b2071cec9\"}\n{\"row\": \"R4\", \"model\": \"aerospace/satellite_lageos1\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"satellite_lageos1\", \"initial\": {\"epoch_utc_s\": 844014880.0, \"forecast_elapsed_s\": 0.0, \"position_m\": [4229354.428, 1727500.405, 11440357.84], \"velocity_m_s\": [4061.944, -1496.84, -849.917]}, \"dt_s\": 10.0, \"segments\": [{\"steps\": 1742, \"load\": {}}], \"record_every\": 1742}}, \"claim\": {\"outcome\": \"refused\", \"stop\": \"RadiusBelowEarthRadius\", \"steps_landed\": 1810, \"quantity\": \"radius_m\", \"value\": 6394735.022733123, \"flags\": [{\"flag\": \"FLAG_BELOW_COMPARED_RADIUS\", \"quantity\": \"radius_m\", \"extent\": 5602264.977266877, \"steps\": 232}, {\"flag\": \"FLAG_EARTH_SHADOW\", \"quantity\": \"distance_from_shadow_axis_m\", \"extent\": 1013479.6278764848, \"steps\": 36}]}, \"proof\": \"7d233dcfc07a2e1911dfb85fa0fea029ca687f3514cbba06fdf88864e906828e6417cdfe59a34263e9a9936df3787eeb\"}\n{\"row\": \"R5\", \"model\": \"aerospace/momentum_jwst_srp\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_srp\", \"initial\": {\"h_eci_nms\": [-1.622, -0.964, 1.404]}, \"dt_s\": 1941.0, \"segments\": [{\"steps\": 105, \"load\": {\"q1\": 0.613497, \"q2\": -0.034325, \"q3\": -0.676494, \"q4\": 0.405953, \"sun_x\": 0.616092, \"sun_y\": 0.704136, \"sun_z\": 0.353019, \"sun_distance_au\": 1.01277}}], \"record_every\": 105}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 105, \"quantity\": \"h_magnitude_nms\", \"value\": 6.973018347360404, \"flags\": []}, \"proof\": \"ad1969f7ba7bdeb622e3b8e1d44f0d24ec27d0e37940f1b0109488c8a140a98d6b533e80d8516dd6570125efcd1661ca\"}\n{\"row\": \"R6\", \"model\": \"aerospace/momentum_jwst_srp\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_srp\", \"initial\": {\"h_eci_nms\": [-1.055, -0.613, 0.945]}, \"dt_s\": 1428.0, \"segments\": [{\"steps\": 51, \"load\": {\"q1\": 0.675887, \"q2\": 0.004991, \"q3\": -0.614166, \"q4\": 0.407371, \"sun_x\": 0.616092, \"sun_y\": 0.714618, \"sun_z\": 0.331289, \"sun_distance_au\": 1.00656}}], \"record_every\": 51, \"readout\": {\"quantities\": [\"h_magnitude_nms\"]}}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 51, \"quantity\": \"h_magnitude_nms\", \"value\": 1.2538931414748378, \"flags\": []}, \"proof\": \"03d88323f8f93f53797cbc48775f27fd6a07de18484442a71b7150623946a49b71ae478a13981aefc1278e97d0ba94e7\"}\n{\"row\": \"R7\", \"model\": \"aerospace/solar_system\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"solar_system\", \"initial\": {\"sun_position_m\": [-972177542.8424704, -500214545.81043047, -185162850.5512162], \"sun_velocity_m_s\": [10.943471273744956, -10.354907507003432, -4.725295041665638], \"mercury_position_m\": [44347944047.32132, -35386831719.91674, -23520589495.944], \"mercury_velocity_m_s\": [23179.557544578543, 34737.11717051704, 16153.15243244726], \"venus_position_m\": [107378854594.44405, -3855694027.194445, -8551901158.778554], \"venus_velocity_m_s\": [1922.5971467016116, 31772.25497050463, 14172.860625157742], \"earth_position_m\": [-131048132650.02007, -69568840294.57173, -30130222428.765972], \"earth_velocity_m_s\": [14439.696511929173, -23759.193577978716, -10300.838662315398], \"moon_position_m\": [-131336010046.59302, -69827768665.01813, -30206075001.525085], \"moon_velocity_m_s\": [15090.044579869322, -24450.210577738573, -10619.619444665168], \"mars_position_m\": [99849753635.60847, 183319992199.24744, 81400974963.10365], \"mars_velocity_m_s\": [-20727.719446230996, 11533.19274335954, 5850.623327698212], \"jupiter_position_m\": [514628857491.4813, 498738500952.13635, 201244273740.58517], \"jupiter_velocity_m_s\": [-9599.899310141725, 8786.610935350978, 4000.0870026696048], \"saturn_position_m\": [885052478191.6257, 978750373225.096, 366165774373.12665], \"saturn_velocity_m_s\": [-7872.030702860459, 5633.288132226103, 2665.365518089133], \"uranus_position_m\": [2201312313161.7573, -1830733084174.7542, -832950501719.338], \"uranus_velocity_m_s\": [4543.09354375023, 4338.812277392898, 1836.0266601992553], \"neptune_position_m\": [2556089531027.0625, -3410769562986.1963, -1459684701878.0127], \"neptune_velocity_m_s\": [4440.424297199966, 2924.108717975938, 1086.3053554716744], \"ceres_position_m\": [-376564661494.9705, -82793770650.16934, 37539835502.66692], \"ceres_velocity_m_s\": [2078.7472741961246, -17061.59058649498, -8451.939414743216], \"pallas_position_m\": [-285475111420.94836, 157884218572.5715, -11922623410.065147], \"pallas_velocity_m_s\": [-12324.053945853098, -17981.78998150534, 4412.172020403093], \"vesta_position_m\": [-20413884754.428905, -300115898744.55383, -116942553506.93321], \"vesta_velocity_m_s\": [20962.21629618035, -627.1836731673636, -2988.3711172821936], \"energy_anchor\": -1.3219409983492277e+25, \"booked_work\": 0.0, \"angular_momentum_anchor\": [5.490282510021932e+31, -8.153754585664557e+32, 1.9244191260936244e+33], \"booked_torque\": [0.0, 0.0, 0.0]}, \"dt_s\": 1444.0, \"segments\": [{\"steps\": 6, \"load\": {}}, {\"steps\": 7, \"load\": {}}, {\"steps\": 8, \"load\": {}}, {\"steps\": 9, \"load\": {}}], \"record_every\": 30, \"readout\": {\"quantities\": [\"earth_mars_distance_m\"]}}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 30, \"quantity\": \"earth_mars_distance_m\", \"value\": 360459888729.46576, \"flags\": []}, \"proof\": \"e584421f53f10db28a78d74a117cfc06b70f10a6cd5a8edfccbd8f76cbd63845b21a93ee0d2b86eac20331f5a33cc32b\"}\n{\"row\": \"R8\", \"model\": \"aerospace/capsule_stardust\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"capsule_stardust\", \"initial\": {\"radius_m\": 6487681.0, \"radial_speed_m_s\": -2026.81, \"transverse_speed_m_s\": 12555.79}, \"dt_s\": 0.05, \"segments\": [{\"steps\": 3073, \"load\": {}}], \"record_every\": 3073, \"readout\": {\"quantities\": [\"ground_distance_m\"]}}}, \"claim\": {\"outcome\": \"ended\", \"stop\": \"PastFlightDeployment\", \"steps_landed\": 2015, \"quantity\": \"ground_distance_m\", \"value\": 617475.7093449463, \"flags\": [{\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"path_sine\", \"extent\": 0.049833167255976536, \"steps\": 880}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"path_sine\", \"extent\": 0.040780280423902485, \"steps\": 1050}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"air_speed_m_s\", \"extent\": 1431.0624296764208, \"steps\": 1231}, {\"flag\": \"FLAG_OFF_FLOWN_ENTRY\", \"quantity\": \"air_speed_m_s\", \"extent\": 189.96215207054047, \"steps\": 524}, {\"flag\": \"FLAG_DROGUE_MACH_WINDOW\", \"quantity\": \"mach\", \"extent\": 0.39949110594929116, \"steps\": 195}, {\"flag\": \"FLAG_DROGUE_MACH_WINDOW\", \"quantity\": \"mach\", \"extent\": 0.3987609440499196, \"steps\": 195}]}, \"proof\": \"3c2f0b68016777a8ea47683b523e67425743046af710d339be26b0801f7acb6a63bd125f2dc439ead5719719ecc90dbb\"}\n{\"row\": \"R9\", \"model\": \"plasma_sheath_ramc2\", \"request\": {\"tool\": \"solve\", \"arguments\": {\"solver\": \"plasma_sheath_ramc2\", \"parameters\": {\"altitude_m\": 65260.0, \"velocity_m_s\": 8582.0, \"signal_frequency_hz\": 8234000000.0}}}, \"claim\": {\"outcome\": \"converged\", \"stop\": null, \"steps_landed\": null, \"quantity\": \"station2_electron_density_m3\", \"value\": 5.665499503721301e+18, \"flags\": []}, \"proof\": \"0835e993c83234e8ed833a8d39db824f039eb71ea77c309c76720162a6e41a59ccd8190b85384a21a3bb84183f442fbf\"}\n{\"row\": \"R10\", \"model\": \"aerospace/los_jwst_fine_guide\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"los_jwst_fine_guide\", \"initial\": {\"lock_x_arcsec\": 29.207, \"lock_y_arcsec\": -11.348, \"quiet_before_start_s\": 38.16}, \"dt_s\": 0.064, \"segments\": [{\"steps\": 3, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20685, \"centroid_y_arcsec\": -11.34796, \"counts_per_s\": 293200.0}}, {\"steps\": 1, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20706, \"centroid_y_arcsec\": -11.34813, \"counts_per_s\": 293200.0}}, {\"steps\": 2, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20727, \"centroid_y_arcsec\": -11.34796, \"counts_per_s\": 293200.0}}, {\"steps\": 3, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20685, \"centroid_y_arcsec\": -11.34813, \"counts_per_s\": 293200.0}}, {\"steps\": 1, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20706, \"centroid_y_arcsec\": -11.34796, \"counts_per_s\": 293200.0}}, {\"steps\": 2, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20727, \"centroid_y_arcsec\": -11.34813, \"counts_per_s\": 293200.0}}, {\"steps\": 3, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20685, \"centroid_y_arcsec\": -11.34796, \"counts_per_s\": 293200.0}}, {\"steps\": 1, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20706, \"centroid_y_arcsec\": -11.34813, \"counts_per_s\": 293200.0}}, {\"steps\": 2, \"load\": {\"measured\": 1.0, \"centroid_x_arcsec\": 29.20727, \"centroid_y_arcsec\": -11.34796, \"counts_per_s\": 293200.0}}], \"record_every\": 18}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 18, \"quantity\": \"estimate_y_mas\", \"value\": 0.000761549984910976, \"flags\": []}, \"proof\": \"f3de03ad5a49c1f27c156b8d58a2d143f777aa5fb5c459524b72678085d6f40a16eb5b8dade2b6ec34aa9865f4368bc7\"}\n{\"row\": \"R11\", \"model\": \"aerospace/momentum_jwst_dihedral\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_dihedral\", \"initial\": {\"h_eci_nms\": [1.121506850922792, 0.4000086686906281, 1.2782357873204517]}, \"dt_s\": 1620.0, \"segments\": [{\"steps\": 57, \"load\": {\"q1\": 0.626313, \"q2\": -0.026561, \"q3\": -0.664647, \"q4\": 0.406535, \"sun_x\": 0.581366, \"sun_y\": 0.750882, \"sun_z\": 0.313352, \"sun_distance_au\": 1.0106}}], \"record_every\": 57, \"from\": {\"request\": {\"domain\": \"aerospace\", \"card\": \"momentum_jwst_dihedral\", \"initial\": {\"h_eci_nms\": [1.057, 0.661, -1.263]}, \"dt_s\": 1620.0, \"segments\": [{\"steps\": 45, \"load\": {\"q1\": 0.705492, \"q2\": 0.058115, \"q3\": -0.557927, \"q4\": 0.433151, \"sun_x\": 0.629673, \"sun_y\": 0.722662, \"sun_z\": 0.285081, \"sun_distance_au\": 1.0104}}], \"record_every\": 45}, \"run_seal\": \"50be7c19d63da96301f1e0edfd5ed2ff425a426e8fe4e4acc9cd6269d4ff5667db7e0b37f14ad3215a9741526ee2b189\"}}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 57, \"quantity\": \"h_magnitude_nms\", \"value\": 2.5762879795193383, \"flags\": []}, \"proof\": \"647a4baa677e63010302d970dec4c6d51f25ade699b52280cee7ff1ff0403679a724f0e0fd0d7643bf5d0d037e42b424\"}\n{\"row\": \"R12\", \"model\": \"aerospace/crater_ryugu_sci\", \"request\": {\"tool\": \"run_trajectory\", \"arguments\": {\"domain\": \"aerospace\", \"card\": \"crater_ryugu_sci\", \"initial\": {\"radius_m\": 1.155}, \"dt_s\": 0.1415, \"segments\": [{\"steps\": 215, \"load\": {}}, {\"steps\": 238, \"load\": {}}, {\"steps\": 261, \"load\": {}}, {\"steps\": 284, \"load\": {}}, {\"steps\": 307, \"load\": {}}, {\"steps\": 330, \"load\": {}}], \"record_every\": 1635, \"readout\": {\"quantities\": [\"radius_m\"]}}}, \"claim\": {\"outcome\": \"completed\", \"stop\": null, \"steps_landed\": 1635, \"quantity\": \"radius_m\", \"value\": 8.038589347556837, \"flags\": []}, \"proof\": \"4e66884da3bdfb79ac5594a27861f9a025d797903b4d2f127f503fd89a7bc9e96639f499b3eb8e87a6b36e0c3c12d38e\"}\n\nBudget: at most 4 calls that compute, counted over every call you make (every run_trajectory, solve, compute_step and verify_ call counts, refused or not); list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all.", "check": {"rows": [{"row": "R1", "model": "aerospace/momentum_jwst_srp", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "momentum_jwst_srp", "initial": {"h_eci_nms": [-1.244, -0.73, 1.098]}, "dt_s": 1599.0, "segments": [{"steps": 69, "load": {"q1": 0.655763, "q2": -0.008127, "q3": -0.635608, "q4": 0.407321, "sun_x": 0.616092, "sun_y": 0.711198, "sun_z": 0.338568, "sun_distance_au": 1.00863}}], "record_every": 69}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 69, "quantity": "h_magnitude_nms", "value": 2.2890861976984564, "flags": []}, "proof": "949c987ad62f835ca215267699517ed2e659b5e776277779896aaf721a03f139d674ea7e0f671e6160f37eaca17eaade"}, {"row": "R2", "model": "aerospace/capsule_insight", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_insight", "initial": {"radius_m": 3522956.0, "radial_speed_m_s": -1294.7972, "transverse_speed_m_s": 5730.5432}, "dt_s": 0.1, "segments": [{"steps": 2152, "load": {"lift_over_drag": 0.0}}], "record_every": 2152}}, "claim": {"outcome": "ended", "stop": "PastFlightDeployment", "steps_landed": 2115, "quantity": "mach", "value": 1.3960519703767567, "flags": []}, "proof": "a4065183ea2043a6b9568252634e364467b059fc61f9a23478a29d53c70035b9b199b77f07d277aa257df8e292b9ce3b"}, {"row": "R3", "model": "ablator_slab", "request": {"tool": "solve", "arguments": {"solver": "ablator_slab", "parameters": {"material": "TACOT 3.0", "thickness_m": 0.0461, "start_temperature_k": 306.3, "thermocouple_depths_m": [], "face": "held_temperature", "held_temperature_k": 1920.0, "hold_duration_s": 60.0, "continue_after_s": 40.0, "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false}}}, "claim": {"outcome": "converged", "stop": null, "steps_landed": null, "quantity": "heat_in_through_face_j_per_m2", "value": 7320760.59153902, "flags": []}, "proof": "eec6980868952c49cd6a1017930f98d396e4452a470c6fa0eacd9b4e00d4aa1c3c32a4c83a59d23ebb96511b2071cec9"}, {"row": "R4", "model": "aerospace/satellite_lageos1", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "satellite_lageos1", "initial": {"epoch_utc_s": 844014880.0, "forecast_elapsed_s": 0.0, "position_m": [4229354.428, 1727500.405, 11440357.84], "velocity_m_s": [4061.944, -1496.84, -849.917]}, "dt_s": 10.0, "segments": [{"steps": 1742, "load": {}}], "record_every": 1742}}, "claim": {"outcome": "refused", "stop": "RadiusBelowEarthRadius", "steps_landed": 1810, "quantity": "radius_m", "value": 6394735.022733123, "flags": [{"flag": "FLAG_BELOW_COMPARED_RADIUS", "quantity": "radius_m", "extent": 5602264.977266877, "steps": 232}, {"flag": "FLAG_EARTH_SHADOW", "quantity": "distance_from_shadow_axis_m", "extent": 1013479.6278764848, "steps": 36}]}, "proof": "7d233dcfc07a2e1911dfb85fa0fea029ca687f3514cbba06fdf88864e906828e6417cdfe59a34263e9a9936df3787eeb"}, {"row": "R5", "model": "aerospace/momentum_jwst_srp", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "momentum_jwst_srp", "initial": {"h_eci_nms": [-1.622, -0.964, 1.404]}, "dt_s": 1941.0, "segments": [{"steps": 105, "load": {"q1": 0.613497, "q2": -0.034325, "q3": -0.676494, "q4": 0.405953, "sun_x": 0.616092, "sun_y": 0.704136, "sun_z": 0.353019, "sun_distance_au": 1.01277}}], "record_every": 105}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 105, "quantity": "h_magnitude_nms", "value": 6.973018347360404, "flags": []}, "proof": "ad1969f7ba7bdeb622e3b8e1d44f0d24ec27d0e37940f1b0109488c8a140a98d6b533e80d8516dd6570125efcd1661ca"}, {"row": "R6", "model": "aerospace/momentum_jwst_srp", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "momentum_jwst_srp", "initial": {"h_eci_nms": [-1.055, -0.613, 0.945]}, "dt_s": 1428.0, "segments": [{"steps": 51, "load": {"q1": 0.675887, "q2": 0.004991, "q3": -0.614166, "q4": 0.407371, "sun_x": 0.616092, "sun_y": 0.714618, "sun_z": 0.331289, "sun_distance_au": 1.00656}}], "record_every": 51, "readout": {"quantities": ["h_magnitude_nms"]}}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 51, "quantity": "h_magnitude_nms", "value": 1.2538931414748378, "flags": []}, "proof": "03d88323f8f93f53797cbc48775f27fd6a07de18484442a71b7150623946a49b71ae478a13981aefc1278e97d0ba94e7"}, {"row": "R7", "model": "aerospace/solar_system", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "solar_system", "initial": {"sun_position_m": [-972177542.8424704, -500214545.81043047, -185162850.5512162], "sun_velocity_m_s": [10.943471273744956, -10.354907507003432, -4.725295041665638], "mercury_position_m": [44347944047.32132, -35386831719.91674, -23520589495.944], "mercury_velocity_m_s": [23179.557544578543, 34737.11717051704, 16153.15243244726], "venus_position_m": [107378854594.44405, -3855694027.194445, -8551901158.778554], "venus_velocity_m_s": [1922.5971467016116, 31772.25497050463, 14172.860625157742], "earth_position_m": [-131048132650.02007, -69568840294.57173, -30130222428.765972], "earth_velocity_m_s": [14439.696511929173, -23759.193577978716, -10300.838662315398], "moon_position_m": [-131336010046.59302, -69827768665.01813, -30206075001.525085], "moon_velocity_m_s": [15090.044579869322, -24450.210577738573, -10619.619444665168], "mars_position_m": [99849753635.60847, 183319992199.24744, 81400974963.10365], "mars_velocity_m_s": [-20727.719446230996, 11533.19274335954, 5850.623327698212], "jupiter_position_m": [514628857491.4813, 498738500952.13635, 201244273740.58517], "jupiter_velocity_m_s": [-9599.899310141725, 8786.610935350978, 4000.0870026696048], "saturn_position_m": [885052478191.6257, 978750373225.096, 366165774373.12665], "saturn_velocity_m_s": [-7872.030702860459, 5633.288132226103, 2665.365518089133], "uranus_position_m": [2201312313161.7573, -1830733084174.7542, -832950501719.338], "uranus_velocity_m_s": [4543.09354375023, 4338.812277392898, 1836.0266601992553], "neptune_position_m": [2556089531027.0625, -3410769562986.1963, -1459684701878.0127], "neptune_velocity_m_s": [4440.424297199966, 2924.108717975938, 1086.3053554716744], "ceres_position_m": [-376564661494.9705, -82793770650.16934, 37539835502.66692], "ceres_velocity_m_s": [2078.7472741961246, -17061.59058649498, -8451.939414743216], "pallas_position_m": [-285475111420.94836, 157884218572.5715, -11922623410.065147], "pallas_velocity_m_s": [-12324.053945853098, -17981.78998150534, 4412.172020403093], "vesta_position_m": [-20413884754.428905, -300115898744.55383, -116942553506.93321], "vesta_velocity_m_s": [20962.21629618035, -627.1836731673636, -2988.3711172821936], "energy_anchor": -1.3219409983492277e+25, "booked_work": 0.0, "angular_momentum_anchor": [5.490282510021932e+31, -8.153754585664557e+32, 1.9244191260936244e+33], "booked_torque": [0.0, 0.0, 0.0]}, "dt_s": 1444.0, "segments": [{"steps": 6, "load": {}}, {"steps": 7, "load": {}}, {"steps": 8, "load": {}}, {"steps": 9, "load": {}}], "record_every": 30, "readout": {"quantities": ["earth_mars_distance_m"]}}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 30, "quantity": "earth_mars_distance_m", "value": 360459888729.46576, "flags": []}, "proof": "e584421f53f10db28a78d74a117cfc06b70f10a6cd5a8edfccbd8f76cbd63845b21a93ee0d2b86eac20331f5a33cc32b"}, {"row": "R8", "model": "aerospace/capsule_stardust", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6487681.0, "radial_speed_m_s": -2026.81, "transverse_speed_m_s": 12555.79}, "dt_s": 0.05, "segments": [{"steps": 3073, "load": {}}], "record_every": 3073, "readout": {"quantities": ["ground_distance_m"]}}}, "claim": {"outcome": "ended", "stop": "PastFlightDeployment", "steps_landed": 2015, "quantity": "ground_distance_m", "value": 617475.7093449463, "flags": [{"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "path_sine", "extent": 0.049833167255976536, "steps": 880}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "path_sine", "extent": 0.040780280423902485, "steps": 1050}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "air_speed_m_s", "extent": 1431.0624296764208, "steps": 1231}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "air_speed_m_s", "extent": 189.96215207054047, "steps": 524}, {"flag": "FLAG_DROGUE_MACH_WINDOW", "quantity": "mach", "extent": 0.39949110594929116, "steps": 195}, {"flag": "FLAG_DROGUE_MACH_WINDOW", "quantity": "mach", "extent": 0.3987609440499196, "steps": 195}]}, "proof": "3c2f0b68016777a8ea47683b523e67425743046af710d339be26b0801f7acb6a63bd125f2dc439ead5719719ecc90dbb"}, {"row": "R9", "model": "plasma_sheath_ramc2", "request": {"tool": "solve", "arguments": {"solver": "plasma_sheath_ramc2", "parameters": {"altitude_m": 65260.0, "velocity_m_s": 8582.0, "signal_frequency_hz": 8234000000.0}}}, "claim": {"outcome": "converged", "stop": null, "steps_landed": null, "quantity": "station2_electron_density_m3", "value": 5.665499503721301e+18, "flags": []}, "proof": "0835e993c83234e8ed833a8d39db824f039eb71ea77c309c76720162a6e41a59ccd8190b85384a21a3bb84183f442fbf"}, {"row": "R10", "model": "aerospace/los_jwst_fine_guide", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "los_jwst_fine_guide", "initial": {"lock_x_arcsec": 29.207, "lock_y_arcsec": -11.348, "quiet_before_start_s": 38.16}, "dt_s": 0.064, "segments": [{"steps": 3, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20685, "centroid_y_arcsec": -11.34796, "counts_per_s": 293200.0}}, {"steps": 1, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20706, "centroid_y_arcsec": -11.34813, "counts_per_s": 293200.0}}, {"steps": 2, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20727, "centroid_y_arcsec": -11.34796, "counts_per_s": 293200.0}}, {"steps": 3, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20685, "centroid_y_arcsec": -11.34813, "counts_per_s": 293200.0}}, {"steps": 1, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20706, "centroid_y_arcsec": -11.34796, "counts_per_s": 293200.0}}, {"steps": 2, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20727, "centroid_y_arcsec": -11.34813, "counts_per_s": 293200.0}}, {"steps": 3, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20685, "centroid_y_arcsec": -11.34796, "counts_per_s": 293200.0}}, {"steps": 1, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20706, "centroid_y_arcsec": -11.34813, "counts_per_s": 293200.0}}, {"steps": 2, "load": {"measured": 1.0, "centroid_x_arcsec": 29.20727, "centroid_y_arcsec": -11.34796, "counts_per_s": 293200.0}}], "record_every": 18}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 18, "quantity": "estimate_y_mas", "value": 0.000761549984910976, "flags": []}, "proof": "f3de03ad5a49c1f27c156b8d58a2d143f777aa5fb5c459524b72678085d6f40a16eb5b8dade2b6ec34aa9865f4368bc7"}, {"row": "R11", "model": "aerospace/momentum_jwst_dihedral", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "momentum_jwst_dihedral", "initial": {"h_eci_nms": [1.121506850922792, 0.4000086686906281, 1.2782357873204517]}, "dt_s": 1620.0, "segments": [{"steps": 57, "load": {"q1": 0.626313, "q2": -0.026561, "q3": -0.664647, "q4": 0.406535, "sun_x": 0.581366, "sun_y": 0.750882, "sun_z": 0.313352, "sun_distance_au": 1.0106}}], "record_every": 57, "from": {"request": {"domain": "aerospace", "card": "momentum_jwst_dihedral", "initial": {"h_eci_nms": [1.057, 0.661, -1.263]}, "dt_s": 1620.0, "segments": [{"steps": 45, "load": {"q1": 0.705492, "q2": 0.058115, "q3": -0.557927, "q4": 0.433151, "sun_x": 0.629673, "sun_y": 0.722662, "sun_z": 0.285081, "sun_distance_au": 1.0104}}], "record_every": 45}, "run_seal": "50be7c19d63da96301f1e0edfd5ed2ff425a426e8fe4e4acc9cd6269d4ff5667db7e0b37f14ad3215a9741526ee2b189"}}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 57, "quantity": "h_magnitude_nms", "value": 2.5762879795193383, "flags": []}, "proof": "647a4baa677e63010302d970dec4c6d51f25ade699b52280cee7ff1ff0403679a724f0e0fd0d7643bf5d0d037e42b424"}, {"row": "R12", "model": "aerospace/crater_ryugu_sci", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "crater_ryugu_sci", "initial": {"radius_m": 1.155}, "dt_s": 0.1415, "segments": [{"steps": 215, "load": {}}, {"steps": 238, "load": {}}, {"steps": 261, "load": {}}, {"steps": 284, "load": {}}, {"steps": 307, "load": {}}, {"steps": 330, "load": {}}], "record_every": 1635, "readout": {"quantities": ["radius_m"]}}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 1635, "quantity": "radius_m", "value": 8.038589347556837, "flags": []}, "proof": "4e66884da3bdfb79ac5594a27861f9a025d797903b4d2f127f503fd89a7bc9e96639f499b3eb8e87a6b36e0c3c12d38e"}], "reasons": ["retired_model", "parent_wrong", "seal_wrong", "stop_hidden", "step_wrong", "flag_omitted", "flag_altered", "value_altered"], "precedence": ["retired_model", "parent_wrong", "seal_wrong", "stop_hidden", "step_wrong", "flag_omitted", "flag_altered", "value_altered"], "budget": 4, "forbidden": ["find_flip", "design_run", "run_dataset", "validate_series"]}, "seed": {"kind": "g2_round6_design6_0.15.3", "seed": 20261102606, "note": "Genuine rows are engine v0.15.3 answers; false rows are recorded changes of genuine ones, labelled by precedence, each label recovered from the engine alone. Design: round6/f6_lib.py."}, "reference": {"false_rows": {"R4": "step_wrong", "R5": "seal_wrong", "R8": "flag_altered", "R9": "retired_model"}, "mutations": {"R4": ["steps_landed 344 claimed as 1810, more steps than the request asks for"], "R5": ["proof taken from another run of the same model (ad1969f7ba7bdeb6...)"], "R6": ["genuine: sent with a readout of h_magnitude_nms (not part of the seal)"], "R7": ["genuine: sent with a readout of earth_mars_distance_m (not part of the seal)"], "R8": ["extent of FLAG_OFF_FLOWN_ENTRY on path_sine changed in the 6th significant figure", "genuine difference: sent with a readout of ground_distance_m (not part of the seal)", "flags listed in reversed order"], "R9": ["retired ID plasma_sheath_ramc2"], "R12": ["genuine: sent with a readout of radius_m (not part of the seal)"]}, "genuine": {"R1": {"value": 2.2890861976984564, "outcome": "completed", "stop": null, "steps_landed": 69, "flags": [], "proof": "949c987ad62f835ca215267699517ed2e659b5e776277779896aaf721a03f139d674ea7e0f671e6160f37eaca17eaade"}, "R2": {"value": 1.3960519703767567, "outcome": "ended", "stop": "PastFlightDeployment", "steps_landed": 2115, "flags": [], "proof": "a4065183ea2043a6b9568252634e364467b059fc61f9a23478a29d53c70035b9b199b77f07d277aa257df8e292b9ce3b"}, "R3": {"value": 7320760.59153902, "outcome": "converged", "stop": null, "steps_landed": null, "flags": [], "proof": "eec6980868952c49cd6a1017930f98d396e4452a470c6fa0eacd9b4e00d4aa1c3c32a4c83a59d23ebb96511b2071cec9"}, "R4": {"value": 6394735.022733123, "outcome": "refused", "stop": "RadiusBelowEarthRadius", "steps_landed": 344, "flags": [{"flag": "FLAG_BELOW_COMPARED_RADIUS", "quantity": "radius_m", "extent": 5602264.977266877, "steps": 232}, {"flag": "FLAG_EARTH_SHADOW", "quantity": "distance_from_shadow_axis_m", "extent": 1013479.6278764848, "steps": 36}], "proof": "7d233dcfc07a2e1911dfb85fa0fea029ca687f3514cbba06fdf88864e906828e6417cdfe59a34263e9a9936df3787eeb"}, "R5": {"value": 6.973018347360404, "outcome": "completed", "stop": null, "steps_landed": 105, "flags": [], "proof": "f1293a36f9bf7c32a300cc0f8ba778b46e42d6d14bfd59d6e8c298fa9c9b7d3768f322c6aaff6f08efd3787ce94be59c"}, "R6": {"value": 1.2538931414748378, "outcome": "completed", "stop": null, "steps_landed": 51, "flags": [], "proof": "03d88323f8f93f53797cbc48775f27fd6a07de18484442a71b7150623946a49b71ae478a13981aefc1278e97d0ba94e7"}, "R7": {"value": 360459888729.46576, "outcome": "completed", "stop": null, "steps_landed": 30, "flags": [], "proof": "e584421f53f10db28a78d74a117cfc06b70f10a6cd5a8edfccbd8f76cbd63845b21a93ee0d2b86eac20331f5a33cc32b"}, "R8": {"value": 617475.7093449463, "outcome": "ended", "stop": "PastFlightDeployment", "steps_landed": 2015, "flags": [{"flag": "FLAG_DROGUE_MACH_WINDOW", "quantity": "mach", "extent": 0.3987609440499196, "steps": 195}, {"flag": "FLAG_DROGUE_MACH_WINDOW", "quantity": "mach", "extent": 0.39949110594929116, "steps": 195}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "air_speed_m_s", "extent": 189.96215207054047, "steps": 524}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "air_speed_m_s", "extent": 1431.0624296764208, "steps": 1231}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "path_sine", "extent": 0.040780280423902485, "steps": 1050}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "path_sine", "extent": 0.049833594621743194, "steps": 880}], "proof": "3c2f0b68016777a8ea47683b523e67425743046af710d339be26b0801f7acb6a63bd125f2dc439ead5719719ecc90dbb"}, "R9": {"value": 5.665499503721301e+18, "outcome": "converged", "stop": null, "steps_landed": null, "flags": [], "proof": "0835e993c83234e8ed833a8d39db824f039eb71ea77c309c76720162a6e41a59ccd8190b85384a21a3bb84183f442fbf"}, "R10": {"value": 0.000761549984910976, "outcome": "completed", "stop": null, "steps_landed": 18, "flags": [], "proof": "f3de03ad5a49c1f27c156b8d58a2d143f777aa5fb5c459524b72678085d6f40a16eb5b8dade2b6ec34aa9865f4368bc7"}, "R11": {"value": 2.5762879795193383, "outcome": "completed", "stop": null, "steps_landed": 57, "flags": [], "proof": "647a4baa677e63010302d970dec4c6d51f25ade699b52280cee7ff1ff0403679a724f0e0fd0d7643bf5d0d037e42b424"}, "R12": {"value": 8.038589347556837, "outcome": "completed", "stop": null, "steps_landed": 1635, "flags": [], "proof": "4e66884da3bdfb79ac5594a27861f9a025d797903b4d2f127f503fd89a7bc9e96639f499b3eb8e87a6b36e0c3c12d38e"}}, "engine_source": "https://github.com/johnkruze/zero-trust-physics-engine", "engine_tag": "v0.15.3", "engine_commit": "664d68f426ccdfd0159e5f91857edba3872390d1", "gateway_version": "0.15.3", "engine_binary_sha256": "2569d8f69b023f7e7fe441c31d3f69ea94d9adfa8100d6e7e56855768c147076"}} diff --git a/sample/tasks/harbor/tasks/g2-forensics6-07/tests/grade.py b/sample/tasks/harbor/tasks/g2-forensics6-07/tests/grade.py new file mode 100644 index 0000000000000000000000000000000000000000..88564e4e42982627e805eb8e50bd600ae052dd80 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-forensics6-07/tests/grade.py @@ -0,0 +1,272 @@ +"""Harbor glue: find the agent's reply and its calls, hand them to the dataset's score.py, write the reward. + +Standard library only. Every path can be moved with an environment variable, so the +same file runs outside a container: + + ZTP_TESTS_DIR this folder: environment.jsonl (and score.py, ztp_mcp.py) (default: where this file is) + ZTP_SCORER_DIR where score.py and ztp_mcp.py sit (default: ZTP_TESTS_DIR) + ZTP_ANSWER_FILE the card the instruction asks the agent to save (default /app/answer.json) + ZTP_CALLS_FILE a call log written by the oracle's solve.sh (default /app/calls.jsonl) + ZTP_ORACLE_LOG Harbor's log of the oracle agent's run (default /logs/agent/oracle.txt) + ZTP_TRAJECTORY_FILE Harbor's record of the run, in ATIF (default /logs/agent/trajectory.json) + ZTP_VERIFIER_DIR where the reward is written (default /logs/verifier) + ZTP_ENGINE the verifier, MCP over stdio (default /usr/local/bin/mcp_stdio) + ZTP_SCORE_TIMEOUT_S how long the scorer may take, in seconds (default 600) + +The reply, first found: the answer file when it is there and not empty (one JSON object over +several lines is put on one line first); else the last agent message with text in the +trajectory; else none, and the scorer gives 0. + +The calls, for every environment (a call budget, and a forensics answer, are scored on them): the agent's calls of the +verifier's own tools in the trajectory's agent steps, in order, by function name and arguments (mcp__verifier__solve is +read as solve). The agent's other tools (a shell, a file editor, writing /app/answer.json) are left out of the record: +they are not verifier calls and are not counted against a budget. When there is no trajectory file at all and Harbor's +oracle has run (its log /logs/agent/oracle.txt is there), the log solution/solve.sh wrote is read instead: the oracle +runs no model, so Harbor records no tool call for it. Any other run with no trajectory is scored with no call record, +and a budget or forensics answer then scores 0. + +The verifier is held to its release by what it answers (version 0.15.3, kernel genesis_kernel_v0.13.1); the binary's +sha256 is recorded on the score row. pack_score.py, beside score.py, holds that rule; --strict-binary is not used here +because this image builds the verifier from source, a different file from the served build. + +The reward, reward.json in ZTP_VERIFIER_DIR: {"reward": 0 or 1, "correct": 0 or 1, "proofs_hold": 0 or 1}. +reward is 1 only when both scores are 1. score.json holds the scorer's line (the reason for a 0). +If the scorer itself fails, no reward is written and this exits non-zero. +""" +import json +import os +import re +import signal +import subprocess +import sys +import tempfile + +TESTS = os.environ.get("ZTP_TESTS_DIR") or os.path.dirname(os.path.abspath(__file__)) +SCORER = os.environ.get("ZTP_SCORER_DIR") or TESTS +ANSWER = os.environ.get("ZTP_ANSWER_FILE") or "/app/answer.json" +CALLS = os.environ.get("ZTP_CALLS_FILE") or "/app/calls.jsonl" +TRAJECTORY = os.environ.get("ZTP_TRAJECTORY_FILE") or "/logs/agent/trajectory.json" +ORACLE_LOG = os.environ.get("ZTP_ORACLE_LOG") or "/logs/agent/oracle.txt" +OUT = os.environ.get("ZTP_VERIFIER_DIR") or "/logs/verifier" +ENGINE = os.environ.get("ZTP_ENGINE") or "/usr/local/bin/mcp_stdio" +TIMEOUT_S = float(os.environ.get("ZTP_SCORE_TIMEOUT_S") or 600) +SCORES = ("correct", "proofs_hold") + + +class ScorerFailed(Exception): + """The check could not be made. No reward is written.""" + + +def on_one_line(text): + try: + whole = json.loads(text) + except ValueError: + return text + if not isinstance(whole, dict): + return text + return re.sub(r"[\r\n]+", " ", text.strip()) + + +def text_of(message): + if isinstance(message, str): + return message + if isinstance(message, list): + return "\n".join(part.get("text") or "" for part in message if isinstance(part, dict) and part.get("type") == "text") + return "" + + +def trajectory_steps(): + try: + with open(TRAJECTORY, encoding="utf-8", errors="replace") as f: + return json.load(f).get("steps") or [] + except (OSError, ValueError, AttributeError, TypeError): + return [] + + +def find_reply(): + try: + with open(ANSWER, encoding="utf-8-sig", errors="replace") as f: + text = f.read() + if text.strip(): + return on_one_line(text), "the answer file %s" % ANSWER + except OSError: + pass + for step in reversed(trajectory_steps()): + if isinstance(step, dict) and step.get("source") == "agent" and text_of(step.get("message")).strip(): + return text_of(step["message"]), "the last agent message in %s" % TRAJECTORY + return None, "nowhere: no answer file and no agent message in a trajectory file" + + +def verifier_tool(name): + """The verifier's own name for a tool call (mcp__verifier__solve -> solve), or None for any other tool.""" + sys.path.insert(0, SCORER) + from score import VERIFIER_TOOLS, tool_name + tool = tool_name(name) + return tool if tool in VERIFIER_TOOLS else None + + +def find_calls(): + """(list of {"tool", "arguments"} or None, where they were found).""" + if os.path.isfile(TRAJECTORY): + calls, other = [], 0 + for step in trajectory_steps(): + if not isinstance(step, dict) or step.get("source") != "agent": + continue + for call in step.get("tool_calls") or []: + if not isinstance(call, dict): + continue + tool = verifier_tool(call.get("function_name")) + if tool is None: + other += 1 + continue + arguments = call.get("arguments") + if isinstance(arguments, str): + try: + arguments = json.loads(arguments) + except ValueError: + arguments = {} + calls.append({"tool": tool, "arguments": arguments if isinstance(arguments, dict) else {}}) + return calls, "%d verifier calls in %s (%d calls of other tools left out)" % (len(calls), TRAJECTORY, other) + if os.path.isfile(ORACLE_LOG): + try: + with open(CALLS, encoding="utf-8", errors="replace") as f: + logged = [json.loads(line) for line in f if line.strip()] + return logged, "the oracle's call log %s (no trajectory; %s is there)" % (CALLS, ORACLE_LOG) + except (OSError, ValueError): + return None, "nowhere: the oracle ran and wrote no call log" + return None, "nowhere: no trajectory file, and the oracle did not run" + + +def the_environment(): + path = os.path.join(TESTS, "environment.jsonl") + try: + with open(path, encoding="utf-8") as f: + rows = [json.loads(line) for line in f if line.strip()] + except (OSError, ValueError) as problem: + raise ScorerFailed("%s cannot be read: %s" % (path, problem)) + if len(rows) != 1 or not isinstance(rows[0], dict) or not isinstance(rows[0].get("id"), str): + raise ScorerFailed("%s does not hold exactly one environment" % path) + return rows[0], path + + +def verifier_answers(): + if ENGINE.startswith("http://") or ENGINE.startswith("https://"): + return "an MCP address, not asked here" + if not os.path.isfile(ENGINE): + raise ScorerFailed("there is no verifier at %s" % ENGINE) + sys.path.insert(0, SCORER) + try: + from ztp_mcp import StdioVerifier + verifier = StdioVerifier([ENGINE], timeout_s=60, patience_s=0) + try: + verifier.connect() + server = verifier.server + finally: + verifier.close() + except Exception as problem: + raise ScorerFailed("the verifier at %s did not answer as an MCP server: %s" % (ENGINE, problem)) + if not isinstance(server, dict) or not server.get("name"): + raise ScorerFailed("the program at %s answered and did not say what it is; it is not the verifier" % ENGINE) + return "%s %s" % (server.get("name"), server.get("version")) + + +def run_scorer(command): + environment = dict(os.environ, PYTHONIOENCODING="utf-8") + process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=environment, + encoding="utf-8", errors="replace", start_new_session=True) + try: + stdout, stderr = process.communicate(timeout=TIMEOUT_S) + except subprocess.TimeoutExpired: + try: + os.killpg(process.pid, signal.SIGKILL) + except OSError: + process.kill() + stdout, stderr = process.communicate() + return None, stdout, stderr + return process.returncode, stdout, stderr + + +def grade(log): + environment, environment_path = the_environment() + name = environment["id"] + reply, found = find_reply() + log.append("environment: %s" % name) + log.append("reply from: %s" % found) + log.append("verifier: %s (%s)" % (ENGINE, verifier_answers())) + with tempfile.TemporaryDirectory() as work: + replies = os.path.join(work, "replies") + os.mkdir(replies) + if reply is not None: + with open(os.path.join(replies, name + ".txt"), "w", encoding="utf-8") as f: + f.write(reply) + calls, where = find_calls() + log.append("calls from: %s" % where) + if calls is not None: + with open(os.path.join(replies, name + ".calls.jsonl"), "w", encoding="utf-8") as f: + for call in calls: + f.write(json.dumps(call) + "\n") + scores_path = os.path.join(work, "scores.jsonl") + score_py = os.path.join(SCORER, "score.py") + entry = os.path.join(SCORER, "pack_score.py") + command = [sys.executable, "-B", entry if os.path.isfile(entry) else score_py, replies, "--engine", ENGINE, + "--environments", environment_path, "--only", name, "--out", scores_path] + with open(score_py, encoding="utf-8") as f: + if "--calls-from" in f.read(): + # the call record here is the one this file found: Harbor's trajectory, or the oracle's log + command += ["--calls-from", "reply"] + code, stdout, stderr = run_scorer(command) + log.append("score.py exit: %s" % ("none, ended after %g s" % TIMEOUT_S if code is None else code)) + log.append("score.py stdout:\n%s" % stdout) + log.append("score.py stderr:\n%s" % stderr) + if code is None: + raise ScorerFailed("score.py did not finish in %g s" % TIMEOUT_S) + if code != 0: + raise ScorerFailed("score.py exited %d: %s" % (code, (stderr.strip().splitlines() or ["no message"])[-1])) + try: + with open(scores_path, encoding="utf-8") as f: + rows = [json.loads(line) for line in f if line.strip()] + except (OSError, ValueError) as problem: + raise ScorerFailed("score.py wrote no scores that can be read: %s" % problem) + if len(rows) != 1 or not isinstance(rows[0], dict) or rows[0].get("id") != name: + raise ScorerFailed("score.py did not write one line for %s" % name) + row = rows[0] + if any(type(row.get(score)) is not int or row[score] not in (0, 1) for score in SCORES): + raise ScorerFailed("score.py did not give %s as 0 or 1" % " and ".join(SCORES)) + row["reply_from"] = found + reward = {"reward": int(all(row[score] == 1 for score in SCORES))} + reward.update((score, row[score]) for score in SCORES) + if isinstance(row.get("graded"), (int, float)): + reward["graded"] = row["graded"] + return reward, row + + +def main(): + os.makedirs(OUT, exist_ok=True) + for name in ("reward.json", "reward.txt", "score.json"): + try: + os.remove(os.path.join(OUT, name)) + except OSError: + pass + log, failure = [], None + try: + reward, row = grade(log) + except ScorerFailed as problem: + failure = "the scorer failed, no reward written: %s" % problem + log.append(failure) + with open(os.path.join(OUT, "score.log"), "w", encoding="utf-8") as f: + f.write("\n".join(log) + "\n") + if failure: + sys.exit(failure) + with open(os.path.join(OUT, "score.json"), "w", encoding="utf-8") as f: + json.dump(row, f) + f.write("\n") + with open(os.path.join(OUT, "reward.json"), "w", encoding="utf-8") as f: + json.dump(reward, f) + f.write("\n") + print(json.dumps(reward)) + if row.get("reason"): + print(row["reason"].encode("ascii", "backslashreplace").decode("ascii")) + + +if __name__ == "__main__": + main() diff --git a/sample/tasks/harbor/tasks/g2-forensics6-07/tests/pack_score.py b/sample/tasks/harbor/tasks/g2-forensics6-07/tests/pack_score.py new file mode 100644 index 0000000000000000000000000000000000000000..b41382aa52ca13dbeccd56097b08175a0fed19a2 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-forensics6-07/tests/pack_score.py @@ -0,0 +1,105 @@ +"""Cross-platform release-pinned scorer wrapper for Zero-Trust Physics packs (macOS arm64, Linux amd64, Linux arm64, HTTP). + + python3 pack_score.py REPLIES --engine ENGINE --environments F [score.py's options] [--strict-binary] + python3 pack_score.py --run run_cheat_suite.py [its options] [--strict-binary] + +Verifies that the target verifier answers MCP initialize as release 0.15.3 (matching reference.gateway_version and +engine_tag) on kernel genesis_kernel_v0.13.1, while recording engine_binary_sha256_seen and engine_binary_is_reference on +every score row. Pass --strict-binary to additionally require exact SHA-256 identity with reference.engine_binary_sha256. +All deterministic recomputation, seal, budget, and grading invariants of score.py apply unchanged. + +Standard library only. Licence: Apache-2.0. +""" +import inspect +import os +import re +import runpy +import sys + +HERE = os.path.dirname(os.path.abspath(__file__)) +if HERE not in sys.path: + sys.path.insert(0, HERE) + +KERNEL = "genesis_kernel_v0.13.1" +STRICT = False + + +def _kernel_of(replay): + """The kernel the verifier names: its serverInfo.description is the kernel's name (0.15.2), or one line that ends + with it ("... Cards: genesis_kernel_v0.13.1", 0.15.3).""" + server = getattr(getattr(replay, "verifier", None), "server", None) or {} + found = re.findall(r"genesis_kernel_v[0-9][0-9.]*[0-9]", server.get("description") or "") + return found[-1] if found else server.get("description") + + +def install(strict=False): + """Configure cross-platform release identity verification on score (idempotent). Returns the score module.""" + global STRICT + STRICT = bool(strict) + import score + if getattr(score, "_pack_engine_identity", False): + return score + original = score.engine_problem + original_score = score.score + + def engine_problem(env, replay): + ref = env.get("reference") or {} + want = ref.get("engine_binary_sha256") + seen = getattr(replay, "binary_sha256", None) + if STRICT or not (seen and want and seen != want): + return original(env, replay) + # a different file: held to the release by what it says it is, every other rule as score.py's + saved = replay.binary_sha256 + replay.binary_sha256 = None + try: + problem = original(env, replay) + finally: + replay.binary_sha256 = saved + if problem: + return problem + kernel = _kernel_of(replay) + if kernel != KERNEL: + return "the verifier reports kernel %s; release %s runs %s" % (kernel, replay.version, KERNEL) + return None + + def scored(env, reply, replay, *args, **kwargs): + row = original_score(env, reply, replay, *args, **kwargs) + if isinstance(row, dict): + want = (env.get("reference") or {}).get("engine_binary_sha256") + seen = getattr(replay, "binary_sha256", None) + row["engine_binary_sha256_seen"] = seen + row["engine_binary_is_reference"] = None if not seen else (seen == want) + return row + + # score.py may one day hold its own source-build rule; then it is left as it is + if "strict" in inspect.getsource(original).lower(): + return score + score.engine_problem = engine_problem + score.score = scored + score._pack_engine_identity = True + return score + + +def main(): + argv = sys.argv[1:] + strict = "--strict-binary" in argv + argv = [a for a in argv if a != "--strict-binary"] + if argv[:1] == ["--run"]: + if len(argv) < 2: + sys.exit("give the program: --run run_cheat_suite.py [options]") + program = argv[1] if os.path.isabs(argv[1]) or os.path.isfile(argv[1]) else os.path.join(HERE, argv[1]) + folder = os.path.dirname(os.path.abspath(program)) + if folder not in sys.path: + sys.path.insert(0, folder) + install(strict) + # a program that does `from score import score` takes the replaced function, as the module now holds it + sys.argv = [program] + argv[2:] + runpy.run_path(program, run_name="__main__") + return + score = install(strict) + sys.argv = [os.path.join(HERE, "score.py")] + argv + score.main() + + +if __name__ == "__main__": + main() diff --git a/sample/tasks/harbor/tasks/g2-forensics6-07/tests/score.py b/sample/tasks/harbor/tasks/g2-forensics6-07/tests/score.py new file mode 100644 index 0000000000000000000000000000000000000000..4403f043313037d26927b89db218b4718ffcf3d2 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-forensics6-07/tests/score.py @@ -0,0 +1,1199 @@ +"""Score replies to the multi-step environments with no judge: a program and the verifier. + + python3 score.py REPLIES --engine ENGINE [--environments F] [--only id,id] [--out F] + [--calls-from reply|harness] [--harness-dir DIR] + + REPLIES is a folder with one file per environment, .txt, the whole text of a reply. + --calls-from harness the call record is the harness's own: .harness.jsonl, written by + harness/mcp_log_proxy.py outside the solver's working directory (in + --harness-dir, default REPLIES). A .calls.jsonl beside the reply, + when there is one, is read only to catch an edit: it must equal the + harness log call for call. + --calls-from reply (the earlier set's way) the call record is .calls.jsonl beside the reply: + one JSON object a line, {"tool": "", "arguments": {...}}. + + ENGINE is the verifier: the path to mcp_stdio (MCP over stdio, no network), or an MCP address + beginning http. A task is scored only on the engine it was built on: the verifier's version must + be the task's reference.gateway_version (engine_tag), and a local binary's SHA-256 the task's + reference.engine_binary_sha256. + +The answer card is one JSON object on the reply's last line. Its shape is the family's: + + tradeoff, chain_design (kind design_to_limit, chained_design) + {"passing": DESIGN, "failing": DESIGN, "binding": ""} + DESIGN = {"run": {"request": R, "proof": ""}, + "solve": {"request": R, "proof": ""}} (solve only where the task has one) + Where a constraint is that the run completes and it binds, the failing DESIGN also carries + "stopped": "" and "step": . R = {"tool": ..., "arguments": {...}} + The design shapes, one scorer for every group (check.design says which): + run a run alone. + coupled check.design.chain names a solver and coupling: the run, then a solve handed that sealed run. + continued check.design.chain.kind "continuation", or chain.layout.kind "continue": the run, then a run of + the same card that continues it through from, starting from its sealed final state, + DESIGN = {"run": {...}, "next": {"request": R, "proof": ""}}. The next run's template + is chain.next_template, chain.template or chain.next; its start fields are chain.carried + ({field: where the first run's answer holds it}), chain.handed (with chain.handed_from) or + chain.carry and chain.clock, each equal to the first run's answer bit for bit. A constraint on + "next" reads the next run, and a stop constraint judges it. + solve check.design.tool or check.design.kind "solve": DESIGN = {"solve": {...}}, one solve and no + run. A binding refusal is named ("stopped") with no step. + staged check.design.stages: DESIGN = {"": {"request": R, "proof": ...}, ...}, one entry per + stage in order; a later stage carries an earlier stage's answer at a named input (handed) or + continues an earlier run (continues), bit for bit. + A constraint's read may carry "index": one entry of an output the verifier returns as a list. + budget (kind budgeted_search) + {"holds": {"request": R, "proof": ""}, + "stops": {"request": R, "proof": "", "stopped": ""}} + forensics + {"false_rows": {"": "", ...}} ({} when every row is genuine) + +Every proof is verified on the verifier (verify_tape for a run_seal, verify_solution for a +solution_seal, short form) and every number judged is read from the verifier's own answer to the +card's request, sent again here, never from the reply. + +Scores per environment +---------------------- +reward 0 or 1, exactly as the earlier scorer: 1 only when correct and proofs_hold are both 1. + proofs_hold: every proof on the card verifies. correct: the card is the right answer and + nothing below under "integrity" failed. +graded in [0, 1], beside reward. + + Integrity (graded 0 and reward 0, whatever the answer): the card cannot be read; a proof does not + verify (a copied, nudged, edited or stale proof); a request differs from the task's template other + than at the design variable; a chained solve not handed its own design's sealed run; no call log; + a call log beside the reply that differs from the harness log; a harness log whose chain breaks; + a forbidden tool called; more computing calls than the budget; a request on the card that is not + among the calls; a forensics answer with no computing call behind it; a task built on another + engine than the verifier. + + tradeoff, chain_design, budget. With integrity held, the sides are judged on the verifier: the + passing design meets every constraint and the failing one breaks the named binding constraint + (budget: holds completes, stops ends with the task's stop, named on the card), on the side the + task asks for, inside its range, with any stop and step the card must name. Wrong sides score 0. + With the sides right: + + e = the length of the smallest interval holding both designs' values and the reference + boundary (for a bracket that straddles the boundary, its width) + tol = the task's tolerance (tradeoff, chain_design) or relative width x |boundary| (budget) + r = e / tol + graded = 1 when reward is 1 (r <= 1 and the bracket straddles it) + = 0.5 ** log10(r) when r > 1: each tenfold of looseness halves the score + (r 1.35 -> 0.914, 2 -> 0.811, 10 -> 0.5, 100 -> 0.25) + = 0.5 when r <= 1 but the bracket misses the reference boundary + by more than the slack (another crossing than the one asked) + + The decay is smooth and falls monotonically with r, and a near miss scores near the top. + + forensics. With integrity held, graded is F1 over the (row, reason) pairs: a row counts as found + only with its right reason. precision = found / named, recall = found / false rows; an empty + answer to a table with no false row scores 1. A card that names every row of the table false is + a blanket answer and scores 0, as do unknown rows and reasons outside the task's list. + +Licence: Apache-2.0. +""" +import argparse +import copy +import hashlib +import json +import math +import os +import re +import sys + +HERE = os.path.dirname(os.path.abspath(__file__)) +sys.path.insert(0, HERE) +from ztp_mcp import McpError, StdioVerifier, Verifier # noqa: E402 + +FAMILIES = ("tradeoff", "chain_design", "budget", "forensics") +KINDS = {"tradeoff": "design_to_limit", "chain_design": "chained_design", "budget": "budgeted_search", "forensics": "forensics"} +NOT_STOPPED = ("completed", "converged") +PREFIX_ENDS = ("__", ".", ":", "/") +VERIFIER_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite", + "run_trajectory", "compute_step", "verify_step", "design_run", "solve", "run_dataset", + "validate_series", "verify_tape", "verify_solution", "verify_dataset", "verify_receipt", "find_flip") +# Calls that read the catalogue compute nothing and are free in a call budget. +FREE_TOOLS = ("list_cards", "list_solvers", "find_model", "describe_card", "describe_solver", "cite", "verify_receipt") +REASONS = ("value_altered", "seal_wrong", "flag_omitted", "retired_model", "stop_hidden") +GRADED_DECAY = 0.5 # graded = GRADED_DECAY ** log10(r) +OTHER_CROSSING = 0.5 # right sides, tight, around another crossing than the reference boundary + + +class Integrity(Exception): + """The answer cannot be trusted: graded 0 and reward 0.""" + + +class Wrong(Exception): + """The answer is trusted and wrong: graded 0 and reward 0.""" + + +def load_environments(path): + with open(path, encoding="utf-8") as f: + return [json.loads(line) for line in f if line.strip()] + + +def row_problems(env): + """What a task row lacks against the shared row contract (empty when none).""" + out = [] + for key in ("id", "family", "models", "real_thing", "task", "check", "seed", "reference"): + if key not in env: + out.append("no %s" % key) + family = env.get("family") + if family not in FAMILIES: + out.append("family %r" % family) + elif "kind" in env and env["kind"] != KINDS[family]: + out.append("kind %r for family %s (want %s)" % (env["kind"], family, KINDS[family])) + ref = env.get("reference") or {} + for key in ("engine_tag", "engine_commit", "engine_binary_sha256"): + if not ref.get(key): + out.append("reference.%s missing" % key) + return out + + +def file_sha256(path): + h = hashlib.sha256() + with open(path, "rb") as f: + for block in iter(lambda: f.read(1 << 20), b""): + h.update(block) + return h.hexdigest() + + +def open_verifier(engine): + if engine.startswith("http://") or engine.startswith("https://"): + verifier = Verifier(engine, pause_s=0.5) + verifier.binary_sha256 = None + else: + if not os.path.isfile(engine): + sys.exit("no file at %s: give the path to mcp_stdio, or an MCP address beginning http" % engine) + verifier = StdioVerifier([engine]) + verifier.binary_sha256 = file_sha256(engine) + try: + verifier.connect() + except McpError as problem: + sys.exit("the verifier failed, so nothing was scored: %s" % problem) + if not isinstance(verifier.server, dict) or not verifier.server.get("name"): + close_verifier(verifier) + sys.exit("the verifier failed, so nothing was scored: %s did not answer as an MCP server" % engine) + return verifier + + +def close_verifier(verifier): + if hasattr(verifier, "close"): + verifier.close() + + +# ------------------------------------------------------------------------------------------ +# reading the reply and the call logs +# ------------------------------------------------------------------------------------------ +def _no_constant(name): + raise ValueError("%s is not a number" % name) + + +def read_card(reply): + """(card, problem): the JSON object on the reply's last line. A closing code fence is passed over.""" + lines = [line.strip() for line in (reply or "").replace("\r", "\n").split("\n") if line.strip()] + while lines and lines[-1].startswith("```"): + lines.pop() + if not lines: + return None, "the reply is empty" + try: + card = json.loads(lines[-1], parse_constant=_no_constant) + except ValueError: + return None, "the last line is not one JSON object" + if not isinstance(card, dict): + return None, "the last line is not one JSON object" + return card, None + + +def tool_name(name): + """The verifier's own name for a tool an agent's program may have prefixed (mcp__zerotrust__solve).""" + if not isinstance(name, str): + return None + if name in VERIFIER_TOOLS: + return name + for tool in VERIFIER_TOOLS: + for joint in PREFIX_ENDS: + if name.endswith(joint + tool): + return tool + return name + + +def without_readout(arguments): + """A run's arguments as sealed: a readout is not part of a run's seal.""" + if not isinstance(arguments, dict): + return arguments + return {k: v for k, v in arguments.items() if k != "readout"} + + +def numbers_by_value(value): + """Every number as a float, so 18 and 18.0 (one request to the engine) compare equal; bools kept.""" + if isinstance(value, dict): + return {k: numbers_by_value(v) for k, v in value.items()} + if isinstance(value, list): + return [numbers_by_value(v) for v in value] + if isinstance(value, int) and not isinstance(value, bool): + return float(value) + return value + + +def canonical(arguments): + """A request's arguments as compared with the call log: no readout, keys sorted, numbers by value.""" + return json.dumps(numbers_by_value(without_readout(arguments)), sort_keys=True, separators=(",", ":")) + + +def _arguments(one): + arguments = one.get("arguments") + if isinstance(arguments, str): + try: + arguments = json.loads(arguments) + except ValueError: + arguments = {} + return arguments if isinstance(arguments, dict) else {} + + +def read_calls(path): + """Every call in a reply-side call log, [(tool, arguments)], or None when there is no log.""" + if not path or not os.path.isfile(path): + return None + calls = [] + with open(path, encoding="utf-8", errors="replace") as f: + for line in f: + line = line.strip() + if not line: + continue + try: + one = json.loads(line) + except ValueError: + continue + if isinstance(one, dict): + calls.append((tool_name(one.get("tool")), _arguments(one))) + return calls + + +def chain_of(previous, entry): + payload = json.dumps(entry, sort_keys=True, separators=(",", ":")) + return hashlib.sha384(((previous or "") + payload).encode("utf-8")).hexdigest() + + +def read_harness_log(path): + """(calls, problem) from a log written by harness/mcp_log_proxy.py. calls is None when there is no log; + problem names the first line whose chain does not follow (an edit, a line taken out or put in).""" + if not path or not os.path.isfile(path): + return None, None + calls, previous = [], None + with open(path, encoding="utf-8", errors="replace") as f: + for number_, line in enumerate(f, 1): + if not line.strip(): + continue + try: + entry = json.loads(line) + except ValueError: + return calls, "line %d of the harness log is not JSON" % number_ + if not isinstance(entry, dict) or "chain" not in entry: + return calls, "line %d of the harness log carries no chain" % number_ + chain = entry.pop("chain") + if chain != chain_of(previous, entry) or entry.get("seq") != len(calls) + 1: + return calls, "the harness log's chain breaks at line %d" % number_ + previous = chain + calls.append((tool_name(entry.get("tool")), _arguments(entry))) + return calls, None + + +def write_harness_log(path, calls): + """A chained log in the proxy's format, for tests and the cheat suite: calls [(tool, arguments)].""" + previous = None + with open(path, "w", encoding="utf-8") as f: + for seq, (tool, arguments) in enumerate(calls, 1): + entry = {"seq": seq, "jsonrpc_id": seq, "tool": tool, "arguments": arguments, "ts_request": None, + "ts_response": None, "duration_s": None, "response_sha384": None, "text_sha384": None, "is_error": False} + entry["chain"] = chain_of(previous, entry) + previous = entry["chain"] + f.write(json.dumps(entry, sort_keys=True) + "\n") + + +# ------------------------------------------------------------------------------------------ +# the verifier, asked again +# ------------------------------------------------------------------------------------------ +def stop_name_in(sentence): + names = re.findall(r"\(([A-Z][A-Za-z0-9]*[a-z][A-Za-z0-9]*)\)", sentence or "") + return names[-1] if names else None + + +class Replay: + """The verifier, with every answer remembered: the same request is sent once.""" + + def __init__(self, verifier): + self.verifier = verifier + self.seen = {} + server = getattr(verifier, "server", None) or {} + self.version = server.get("version") + self.binary_sha256 = getattr(verifier, "binary_sha256", None) + + def call(self, tool, arguments): + key = tool + "\x00" + json.dumps(arguments, sort_keys=True) + if key not in self.seen: + try: + self.seen[key] = self.verifier.call_json(tool, arguments) + except McpError as problem: + if not str(problem).startswith("protocol error"): + raise SystemExit("the verifier failed, so nothing was scored: %s" % problem) + self.seen[key] = ("the verifier did not take the request: %s" % problem, True) + return self.seen[key] + + def answer(self, tool, arguments, readout=None): + """One run or solve computed again: {"stopped", "outcome", "stop", "proof", "body"}.""" + arguments = copy.deepcopy(without_readout(arguments)) + if readout is not None and tool == "run_trajectory": + arguments["readout"] = readout + body, is_error = self.call(tool, arguments) + if is_error or not isinstance(body, dict): + sentence = body if isinstance(body, str) else json.dumps(body) + return {"stopped": True, "outcome": "stopped before computing", "stop": stop_name_in(sentence), + "proof": None, "body": None, "sentence": sentence} + outcome = body.get("outcome") + stopped = outcome not in NOT_STOPPED + return {"stopped": stopped, "outcome": outcome, "stop": body.get("reject") if stopped else None, + "proof": body.get("run_seal") or body.get("solution_seal"), "body": body, + "sentence": body.get("reject_detail")} + + def proof_holds(self, tool, arguments, proof): + """(holds, words): the card's seal verified by verify_tape or verify_solution, short form.""" + if not isinstance(proof, str) or not re.fullmatch(r"[0-9a-f]{96}", proof): + return False, "the proof is not a SHA-384 seal of 96 hex digits" + if tool == "run_trajectory": + body, is_error = self.call("verify_tape", {"request": without_readout(arguments), "run_seal": proof}) + elif tool == "solve": + body, is_error = self.call("verify_solution", {"request": arguments, "solution_seal": proof}) + else: + return False, "a proof is verified for run_trajectory or solve only, not %s" % tool + if is_error or not isinstance(body, dict): + return False, "the verifier would not verify it: %s" % (str(body)[:200]) + if body.get("holds") is True: + return True, None + return False, "the verifier says the seal does not hold (cause %s)" % body.get("cause") + + +def engine_problem(env, replay): + """None when the verifier is the engine the task was built on; else what differs.""" + ref = env.get("reference") or {} + tag = ref.get("gateway_version") or (ref.get("engine_tag") or "").lstrip("v") + if not tag: + return "the task names no engine it was built on" + if (ref.get("engine_tag") or "v" + tag).lstrip("v") != tag: + return "the task's engine_tag %s and gateway_version %s disagree" % (ref.get("engine_tag"), ref.get("gateway_version")) + if replay.version != tag: + return "the task was built on engine %s; the verifier is %s" % (tag, replay.version) + want = ref.get("engine_binary_sha256") + if replay.binary_sha256 and want and replay.binary_sha256 != want: + return "the verifier's binary is not the one the task was built on (sha256 %s..., want %s...)" % (replay.binary_sha256[:12], want[:12]) + return None + + +# ------------------------------------------------------------------------------------------ +# requests and their inputs +# ------------------------------------------------------------------------------------------ +_PART = re.compile(r"([A-Za-z_0-9]+)((?:\[\d+\])*)") + + +def get_path(obj, path): + here = obj + for part in path.split("."): + found = _PART.fullmatch(part) + if not found or not isinstance(here, dict) or found.group(1) not in here: + return None + here = here[found.group(1)] + for index in re.findall(r"\[(\d+)\]", found.group(2)): + if not isinstance(here, list) or int(index) >= len(here): + return None + here = here[int(index)] + return here + + +def set_path(obj, path, value): + parts = path.split(".") + here = obj + for i, part in enumerate(parts): + m = _PART.fullmatch(part) + name, idx = m.group(1), [int(k) for k in re.findall(r"\[(\d+)\]", m.group(2))] + last = i == len(parts) - 1 + if not idx: + if last: + here[name] = value + else: + here = here[name] + else: + here = here[name] + for j, k in enumerate(idx): + if last and j == len(idx) - 1: + here[k] = value + else: + here = here[k] + + +def number(value): + return isinstance(value, (int, float)) and not isinstance(value, bool) and math.isfinite(value) + + +def differs(template, given, free, where=""): + """The first place where a request differs from the task's, other than the free places. None when none.""" + if where in free: + return None + if isinstance(template, dict): + if not isinstance(given, dict): + return where or "the request" + for key in set(template) | set(given): + place = "%s.%s" % (where, key) if where else key + if place in free: + continue + if key not in given or key not in template: + return place + found = differs(template[key], given[key], free, place) + if found: + return found + return None + if isinstance(template, list): + if not isinstance(given, list) or len(given) != len(template): + return where + for index, (a, b) in enumerate(zip(template, given)): + found = differs(a, b, free, "%s[%d]" % (where, index)) + if found: + return found + return None + if number(template) and number(given): + return None if float(template) == float(given) else where + return None if template == given else where + + +def design_value(variable, run_arguments, solve_arguments, next_arguments=None): + """The design variable of one design, read from its requests (on: run, solve, or next, a continued run).""" + kind = variable["kind"] + if kind == "path": + on = variable.get("on", "run") + source = {"solve": solve_arguments, "next": next_arguments}.get(on, run_arguments) or {} + value = get_path(source, variable["path"]) + for place in variable.get("also") or []: + again = get_path(source, place) + if not (number(again) and number(value) and float(again) == float(value)): + return None + return float(value) if number(value) else None + if kind == "entry_angle_deg": + radial = get_path(run_arguments or {}, "initial.radial_speed_m_s") + transverse = get_path(run_arguments or {}, "initial.transverse_speed_m_s") + if not (number(radial) and number(transverse)) or transverse <= 0: + return None + speed = math.hypot(radial, transverse) + if abs(speed - variable["speed_m_s"]) > 1e-6 * variable["speed_m_s"]: + return None + return math.degrees(math.atan2(-radial, transverse)) + return None + + +def variable_places(variable): + if variable["kind"] == "entry_angle_deg": + return {"initial.radial_speed_m_s", "initial.transverse_speed_m_s"} + if variable["kind"] == "path" and variable.get("on", "run") == "run": + return {variable["path"]} | set(variable.get("also") or []) + return set() + + +def read_value(read, answer): + """One number from a replayed answer: final, result, or the extreme of a run's readout.""" + body = answer["body"] + if body is None: + return None + kind = read["kind"] + value = None + if kind == "final": + value = (body.get("final_state") or {}).get(read["quantity"]) + elif kind == "result": + value = (body.get("result") or {}).get(read["quantity"]) + elif kind == "flag_extent": + # an advisory flag the run raised, at its largest extent; 0 when the run does not raise it + value = max([x.get("extent") or 0.0 for x in body.get("exceedance_extremes") or [] + if isinstance(x, dict) and x.get("flag") == read["quantity"]] or [0.0]) + elif kind == "extreme": + for quantity in (body.get("readout") or {}).get("quantities") or []: + if quantity.get("quantity") == read["quantity"]: + value = quantity.get(read["which"]) + if "index" in read: + # one entry of an output the verifier returns as a list (a hose's modes, a solve asked at several points) + k = read["index"] + value = value[k] if isinstance(value, list) and isinstance(k, int) and -len(value) <= k < len(value) else None + return value if number(value) else None + + +def readout_for(constraints, on="run"): + """The readout a run is sent with: the extremes its constraints read (on: run, next, or a stage key).""" + quantities = sorted({c["read"]["quantity"] for c in constraints if c["on"] == on and c["read"]["kind"] == "extreme"}) + return {"quantities": quantities} if quantities else None + + +def design_shape(spec): + """Which of the design shapes a task's check.design is: run, coupled, continued, solve or staged.""" + if spec.get("stages"): + return "staged" + if spec.get("tool") == "solve" or spec.get("kind") == "solve": + return "solve" + chain = spec.get("chain") or {} + if chain.get("kind") == "continuation" or (chain.get("layout") or {}).get("kind") == "continue": + return "continued" + return "coupled" if chain else "run" + + +def continuation_of(spec): + """A continued design's chain in one form: (next template, {start field: where the first run's answer holds it}, + next outcomes, the next run's places that also hold a first-run design value).""" + chain = spec["chain"] + template = chain.get("next_template") or chain.get("template") or chain.get("next") + if "carried" in chain: # group 1 + carried = dict(chain["carried"]) + elif "handed" in chain: # group 4 + named = chain.get("handed_from") or {} + carried = {k: "final_state." + named.get(k, k) for k in chain["handed"]} + else: # group 5 + carried = {k: "final_state." + k for k in chain.get("carry") or []} + if chain.get("clock"): + carried[chain["clock"]["field"]] = "final_state." + chain["clock"]["from"] + outcomes = chain.get("next_outcomes") or spec["run_outcomes"] + return template, carried, outcomes, list(chain.get("next_also") or []) + + +def meets(constraint, value): + if value is None: + return False + return value <= constraint["limit"] if constraint["op"] == "<=" else value >= constraint["limit"] + + +def history_layout_problem(layout, parameters, frames_count): + """None when the arrays of a chained solve are laid out as the task states; else what is not.""" + if layout is None: + return None + if layout["kind"] == "stardust_slab": + names = ("history_time_s", "history_pressure_pa", "history_heat_transfer_coefficient_kg_per_m2_s", + "history_flow_enthalpy_j_per_kg", "history_radiative_heating_w_per_m2") + columns = [parameters.get(name) for name in names] + if not all(isinstance(c, list) and all(number(v) for v in c) for c in columns): + return "the history columns are not all lists of numbers" + time, pressure, coefficient, enthalpy, radiative = columns + rows = frames_count + 3 + if any(len(c) != rows for c in columns): + return "the history has not one row before the %d frames handed and two after them" % frames_count + if time[0] != 0.0 or coefficient[0] != 0.0: + return "row 0 is not at 0 s with no heating" + if pressure[0] != pressure[1] or enthalpy[0] != enthalpy[1]: + return "row 0 does not repeat the first frame's pressure and enthalpy" + if abs(time[-2] - (time[-3] + 1.0)) > 1e-9 or time[-1] != layout["cool_to_s"]: + return "the rows after the frames are not at 1 s after the last frame and at %g s" % layout["cool_to_s"] + if coefficient[-2] != 0.0 or coefficient[-1] != 0.0: + return "the stream is not off after the frames" + if pressure[-1] != pressure[-3] or pressure[-2] != pressure[-3] or enthalpy[-1] != enthalpy[-3] or enthalpy[-2] != enthalpy[-3]: + return "the rows after the frames do not hold the last frame's pressure and enthalpy" + if any(v != 0.0 for v in radiative): + return "a row of the history holds radiative heating" + return None + if layout["kind"] == "triga_element": + return None # every array is handed by the coupling and held to its bits by the verifier + return "an unknown layout" + + +# ------------------------------------------------------------------------------------------ +# the call record +# ------------------------------------------------------------------------------------------ +def card_requests(env, card): + """Every request on the card, [(tool, arguments)], read leniently (for the call log).""" + out = [] + + def take(part): + if isinstance(part, dict) and isinstance(part.get("request"), dict) and isinstance(part["request"].get("arguments"), dict): + out.append((tool_name(part["request"].get("tool")), part["request"]["arguments"])) + + if env["family"] in ("tradeoff", "chain_design"): + stages = [s["key"] for s in (env["check"].get("design") or {}).get("stages") or []] + for side in ("passing", "failing"): + design = card.get(side) if isinstance(card.get(side), dict) else {} + for key in stages or ("run", "solve", "next"): + take(design.get(key)) + elif env["family"] == "budget": + take(card.get("holds")) + take(card.get("stops")) + return out + + +def sequence(calls): + return [(tool_name(t), json.dumps(numbers_by_value(a), sort_keys=True)) for t, a in calls] + + +def call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row): + """None when the call record holds; else why not (an integrity failure).""" + check = env["check"] + if calls_from == "harness": + if calls is None: + return "no harness call log: every attempt is scored with the calls the harness recorded" + if log_problem: + return log_problem + if reply_calls is not None and sequence(reply_calls) != sequence(calls): + return "the call log beside the reply differs from the harness log" + elif calls is None: + return "no call log: every environment is scored with the agent's calls" + calls = [(tool_name(t), a) for t, a in calls] + banned = sorted({t for t, _ in calls if t in (check.get("forbidden") or [])}) + if banned: + return "the log holds calls of %s, which the task rules out" % ", ".join(banned) + computing = [(t, a) for t, a in calls if t not in FREE_TOOLS] + row["computing_calls"] = len(computing) + if check.get("budget") and len(computing) > check["budget"]: + return "%d computing calls; the budget is %d" % (len(computing), check["budget"]) + sent = {(t, canonical(a)) for t, a in computing} + for tool, arguments in card_requests(env, card): + if (tool, canonical(arguments)) not in sent: + return "a %s request on the card is not among the calls in the log" % tool + if env["family"] == "forensics" and not computing: + return "no computing call behind the answer: the table was not put to the verifier" + return None + + +# ------------------------------------------------------------------------------------------ +# the families +# ------------------------------------------------------------------------------------------ +def request_of(part, tool, what): + """The arguments of one request on the card (Integrity when it is not one).""" + if not isinstance(part, dict): + raise Integrity("%s is missing" % what) + request = part.get("request") + if not (isinstance(request, dict) and isinstance(request.get("arguments"), dict)): + raise Integrity("%s has no request {\"tool\": ..., \"arguments\": {...}}" % what) + if tool_name(request.get("tool")) != tool: + raise Integrity("%s is a request of %s, not %s" % (what, request.get("tool"), tool)) + return request["arguments"] + + +def score_design(env, design, which, replay, proofs): + """One design of a boundary family: facts {x, met, values, stopped, steps_landed}.""" + check = env["check"] + spec = check["design"] + shape = design_shape(spec) + if shape in ("solve", "staged", "continued") and not isinstance(design, dict): + raise Integrity("the %s design is missing" % which) + if shape == "solve": + return score_solve_design(env, design, which, replay, proofs) + if shape == "staged": + return score_staged_design(env, design, which, replay, proofs) + if shape == "continued": + return score_continued_design(env, design, which, replay, proofs) + chain = spec.get("chain") + run_args = request_of((design or {}).get("run") if isinstance(design, dict) else None, "run_trajectory", + "the %s design's run" % which) + free = set(spec.get("free") or []) | variable_places(spec["variable"]) + where = differs(spec["template"], without_readout(run_args), free) + if where: + raise Integrity("the %s design's run differs from the task's at %s" % (which, where)) + for place in spec.get("free") or []: + if place.endswith(".steps"): + steps = get_path(run_args, place) + if not (isinstance(steps, int) and not isinstance(steps, bool) and 1 <= steps <= spec.get("most_steps", 10 ** 7)): + raise Integrity("the %s design's run has no whole number of steps at %s" % (which, place)) + run_proof = design["run"].get("proof") + holds, words = replay.proof_holds("run_trajectory", run_args, run_proof) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's run_seal: %s" % (which, words)) + run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"])) + stop_names = [c["stop"] for c in check["constraints"] if c["on"] == "outcome"] + stopped_by_name = run["outcome"] == "refused" and run["stop"] in stop_names + if run["outcome"] not in spec["run_outcomes"] and not stopped_by_name: + raise Wrong("the %s design's run comes back %s%s, not %s" % ( + which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"]))) + solve_args, solve = None, None + if chain: + solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which) + if solve_args.get("solver") != chain["solver"]: + raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver"))) + handed = solve_args.get("from") + if not isinstance(handed, dict) or handed.get("coupling") != chain["coupling"]: + raise Integrity("the %s design's solve is not handed its run through the coupling %s" % (which, chain["coupling"])) + if canonical(handed.get("request")) != canonical(run_args) or handed.get("run_seal") != run_proof: + raise Integrity("the %s design's solve is not handed the design's own sealed run" % which) + parameters = solve_args.get("parameters") + if not isinstance(parameters, dict): + raise Integrity("the %s design's solve has no parameters" % which) + solve_free = set(chain.get("handed") or []) + if spec["variable"]["kind"] == "path" and spec["variable"].get("on") == "solve": + solve_free.add(spec["variable"]["path"].split(".", 1)[1]) + where = differs(chain["parameters"], parameters, solve_free) + if where: + raise Integrity("the %s design's solve differs from the task's at parameters.%s" % (which, where)) + frames = len((run["body"] or {}).get("frames") or []) + problem = history_layout_problem(chain.get("layout"), parameters, frames) + if problem: + raise Integrity("the %s design's solve: %s" % (which, problem)) + holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's solution_seal: %s" % (which, words)) + solve = replay.answer("solve", solve_args) + if solve["outcome"] != "converged": + raise Wrong("the %s design's solve comes back %s%s, not converged" % ( + which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else "")) + x = design_value(spec["variable"], run_args, solve_args) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, spec["variable"].get("words", ""))) + met, values = {}, {} + for constraint in check["constraints"]: + if constraint["on"] == "outcome": + values[constraint["id"]] = run["outcome"] if not run["stop"] else "%s (%s)" % (run["outcome"], run["stop"]) + met[constraint["id"]] = not (run["outcome"] == "refused" and run["stop"] == constraint["stop"]) + continue + value = read_value(constraint["read"], run if constraint["on"] == "run" else solve) + values[constraint["id"]] = value + met[constraint["id"]] = meets(constraint, value) + facts = {"x": x, "met": met, "values": values} + if run["outcome"] not in NOT_STOPPED and run["body"]: + facts["stopped"], facts["steps_landed"] = run["stop"], run["body"].get("steps_landed") + return facts + + +def halted(answer, stop, staged=False): + """True when an answer is stopped by the stop named: a refusal ("refused"); for a staged design, any outcome that + is not completed or converged (group 3's rule, kept as built).""" + if staged: + return answer["outcome"] not in NOT_STOPPED and answer["stop"] == stop + return answer["outcome"] == "refused" and answer["stop"] == stop + + +def constraint_facts(check, answers, judged, staged=False): + """met and values of every constraint: each read from the answer its "on" names (answers: {on: answer}); a stop + constraint ("on": "outcome") is judged on the answer judged, or on its stage's answer for a staged design.""" + met, values = {}, {} + for c in check["constraints"]: + if c["on"] == "outcome": + a = answers.get(c["stage"]) if c.get("stage") else judged + values[c["id"]] = None if a is None else (a["outcome"] if not a["stop"] else "%s (%s)" % (a["outcome"], a["stop"])) + met[c["id"]] = a is not None and not halted(a, c["stop"], staged) + continue + a = answers.get(c["on"]) + value = read_value(c["read"], a) if a is not None else None + values[c["id"]] = value + met[c["id"]] = meets(c, value) if c.get("limit") is not None else None + return met, values + + +def stopped_by(answer, constraints, stage=None): + """True when an answer is stopped by a stop one of the task's stop constraints names (for the stage given).""" + return any(halted(answer, c["stop"], stage is not None) for c in constraints + if c["on"] == "outcome" and (stage is None or c.get("stage") == stage)) + + +def score_solve_design(env, design, which, replay, proofs): + """One design that is one solve and no run (check.design.tool or kind "solve").""" + check = env["check"] + spec = check["design"] + var = spec["variable"] + solve_args = request_of(design.get("solve"), "solve", "the %s design's solve" % which) + if solve_args.get("solver") != spec["template"].get("solver"): + raise Integrity("the %s design's solve is of %s, not the task's solver" % (which, solve_args.get("solver"))) + free = set(spec.get("free") or []) | {var["path"]} | set(var.get("also") or []) + where = differs(spec["template"], solve_args, free) + if where: + raise Integrity("the %s design's solve differs from the task's at %s" % (which, where)) + holds, words = replay.proof_holds("solve", solve_args, design["solve"].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's solution_seal: %s" % (which, words)) + solve = replay.answer("solve", solve_args) + if solve["outcome"] not in spec["run_outcomes"] and not stopped_by(solve, check["constraints"]): + raise Wrong("the %s design's solve comes back %s%s, not %s" % ( + which, solve["outcome"], " (%s)" % solve["stop"] if solve["stop"] else "", " or ".join(spec["run_outcomes"]))) + x = design_value(dict(var, on="solve"), None, solve_args) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", ""))) + met, values = constraint_facts(check, {"solve": solve}, solve) + facts = {"x": x, "met": met, "values": values} + if solve["outcome"] not in NOT_STOPPED and solve["body"]: + facts["stopped"], facts["steps_landed"], facts["no_step"] = solve["stop"], None, True + return facts + + +def score_continued_design(env, design, which, replay, proofs): + """One design of a run and the run that continues it through from. The verifier holds the hand-off: it computes + the first run again, compares its seal and refuses a start that is not the first run's final state; the scorer + also holds each carried start field to the first run's answer, bit for bit.""" + check = env["check"] + spec = check["design"] + var = spec["variable"] + on_next = var["kind"] == "path" and var.get("on") == "next" + template, carried, next_outcomes, next_also = continuation_of(spec) + run_args = request_of(design.get("run"), "run_trajectory", "the %s design's run" % which) + free = set(spec.get("free") or []) | (set() if on_next else variable_places(var)) + where = differs(spec["template"], without_readout(run_args), free) + if where: + raise Integrity("the %s design's run differs from the task's at %s" % (which, where)) + run_proof = design["run"].get("proof") + holds, words = replay.proof_holds("run_trajectory", run_args, run_proof) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's run_seal: %s" % (which, words)) + run = replay.answer("run_trajectory", run_args, readout_for(check["constraints"], "run")) + if run["outcome"] not in spec["run_outcomes"]: + raise Wrong("the %s design's first run comes back %s%s, not %s" % ( + which, run["outcome"], " (%s)" % run["stop"] if run["stop"] else "", " or ".join(spec["run_outcomes"]))) + next_args = request_of(design.get("next"), "run_trajectory", "the %s design's next run" % which) + handed = next_args.get("from") + if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(run_args) + or handed.get("run_seal") != run_proof): + raise Integrity("the %s design's next run does not continue the design's own sealed run (from)" % which) + next_free = {"initial." + name for name in carried} | {"from"} | set(next_also) + if on_next: + next_free |= {var["path"]} | set(var.get("also") or []) + where = differs(template, without_readout(next_args), next_free) + if where: + raise Integrity("the %s design's next run differs from the task's at %s" % (which, where)) + start = next_args.get("initial") if isinstance(next_args.get("initial"), dict) else {} + for name, source in carried.items(): + held, given = get_path(run["body"] or {}, source), start.get(name) + if name not in start or not (given == held or (number(given) and number(held) and float(given) == float(held))): + raise Integrity("the %s design's next run does not start from its run's %s, bit for bit" % (which, source)) + holds, words = replay.proof_holds("run_trajectory", next_args, design["next"].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's next run_seal: %s" % (which, words)) + nxt = replay.answer("run_trajectory", next_args, readout_for(check["constraints"], "next")) + if nxt["outcome"] not in next_outcomes and not stopped_by(nxt, check["constraints"]): + raise Wrong("the %s design's next run comes back %s%s, not %s" % ( + which, nxt["outcome"], " (%s)" % nxt["stop"] if nxt["stop"] else "", " or ".join(next_outcomes))) + x = design_value(var, run_args, None, next_args) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", ""))) + for place in next_also: + again = get_path(next_args, place) + if not (number(again) and float(again) == float(x)): + raise Integrity("the %s design's next run does not hold the design value at %s" % (which, place)) + met, values = constraint_facts(check, {"run": run, "next": nxt}, nxt) + facts = {"x": x, "met": met, "values": values} + if nxt["outcome"] not in NOT_STOPPED and nxt["body"]: + facts["stopped"], facts["steps_landed"] = nxt["stop"], nxt["body"].get("steps_landed") + return facts + + +def build_stage_request(spec, stage, x, answers, requests): + """One stage's request of a staged design at x: the template, x at the variable's places, the values handed from + earlier stages' answers, and a continuation's start and from (used by run_reference.py).""" + q = copy.deepcopy(stage["template"]) + var = spec["variable"] + if var.get("stage") == stage["key"]: + for place in [var["path"]] + list(var.get("also") or []): + set_path(q, place, x) + for h in stage.get("handed") or []: + set_path(q, h["to"], read_value(h["read"], answers[h["from"]])) + if stage.get("continues"): + parent = stage["continues"] + final = answers[parent]["body"]["final_state"] + q["initial"] = {k: final[k] for k in stage["template"]["initial"]} + q["from"] = {"request": copy.deepcopy(requests[parent]), "run_seal": answers[parent]["proof"]} + return q + + +def score_staged_design(env, design, which, replay, proofs): + """One staged design (check.design.stages): each stage a run or a solve, in order.""" + check = env["check"] + spec = check["design"] + var = spec["variable"] + stages = spec["stages"] + answers, requests, facts = {}, {}, {} + for i, stage in enumerate(stages): + key, tool = stage["key"], stage["tool"] + sent = without_readout(request_of(design.get(key), tool, "the %s design's %s" % (which, key))) + free = set(stage.get("free") or []) | {h["to"] for h in stage.get("handed") or []} + if var.get("stage") == key: + free |= {var["path"]} | set(var.get("also") or []) + if stage.get("continues"): + free |= {"initial", "from"} + where = differs(stage["template"], sent, free) + if where: + raise Integrity("the %s design's %s differs from the task's at %s" % (which, key, where)) + for h in stage.get("handed") or []: + want = read_value(h["read"], answers[h["from"]]) + got = get_path(sent, h["to"]) + if want is None or not number(got) or float(got) != float(want): + raise Integrity("the %s design's %s does not carry %s's %s at %s, bit for bit" % ( + which, key, h["from"], h["read"]["quantity"], h["to"])) + if stage.get("continues"): + parent = stage["continues"] + handed = sent.get("from") + if (not isinstance(handed, dict) or canonical(handed.get("request")) != canonical(requests[parent]) + or handed.get("run_seal") != design[parent].get("proof")): + raise Integrity("the %s design's %s does not continue the design's own sealed %s run (from)" % (which, key, parent)) + final = (answers[parent]["body"] or {}).get("final_state") or {} + start = sent.get("initial") + keys = set(stage["template"]["initial"]) + if not isinstance(start, dict) or set(start) != keys or any( + not number(start[k]) or float(start[k]) != final.get(k) for k in keys): + raise Integrity("the %s design's %s does not start from the final state of its %s run, bit for bit" % (which, key, parent)) + holds, words = replay.proof_holds(tool, sent, design[key].get("proof")) + proofs.append(holds) + if not holds: + raise Integrity("the %s design's %s proof: %s" % (which, key, words)) + answer = replay.answer(tool, sent, readout_for(check["constraints"], key) if tool == "run_trajectory" else None) + named = stopped_by(answer, check["constraints"], stage=key) + if answer["outcome"] not in stage["outcomes"] and not named: + raise Wrong("the %s design's %s comes back %s%s, not %s" % ( + which, key, answer["outcome"], " (%s)" % answer["stop"] if answer["stop"] else "", " or ".join(stage["outcomes"]))) + answers[key], requests[key] = answer, sent + if named: + facts["stopped"], facts["stopped_stage"] = answer["stop"], key + facts["steps_landed"] = (answer["body"] or {}).get("steps_landed") if tool == "run_trajectory" else None + facts["no_step"] = tool != "run_trajectory" + if i != len(stages) - 1: + raise Wrong("the %s design's %s stops (%s) before its last stage" % (which, key, answer["stop"])) + x = design_value(dict(var, on="run"), requests.get(var["stage"]), None) + if x is None: + raise Integrity("the %s design's value of the design variable cannot be read (%s)" % (which, var.get("words", ""))) + met, values = constraint_facts(check, answers, None, staged=True) + facts.update({"x": x, "met": met, "values": values}) + return facts + + +def grade_bracket(a, b, star, tol, slack, row): + """(reward_ok, graded) for a bracket [a, b] with its sides right.""" + width = abs(b - a) + straddles = min(a, b) - slack <= star <= max(a, b) + slack + within = width <= tol * (1 + 1e-9) + e = max(a, b, star) - min(a, b, star) + r = e / tol if tol > 0 else float("inf") + row["width"], row["width_ratio"] = width, r + if within and straddles: + return True, 1.0 + if r <= 1: + return False, OTHER_CROSSING + return False, GRADED_DECAY ** math.log10(r) + + +def score_boundary(env, card, replay, row, proofs): + check, reference = env["check"], env["reference"] + passing = score_design(env, card.get("passing"), "passing", replay, proofs) + failing = score_design(env, card.get("failing"), "failing", replay, proofs) + row["passing"], row["failing"] = passing, failing + span = check["design"].get("range") + if span and not all(span[0] <= x <= span[1] for x in (passing["x"], failing["x"])): + raise Wrong("a design lies outside the range the task states, %g to %g" % tuple(span)) + broken = [c for c, ok in passing["met"].items() if not ok] + if broken: + raise Wrong("the passing design breaks %s" % ", ".join(broken)) + broken = [c for c, ok in failing["met"].items() if not ok] + if not broken: + raise Wrong("the failing design meets every constraint") + binding = card.get("binding") + if binding != reference["binding"]: + raise Wrong("binding names %r; the constraint that binds is another" % (binding,)) + if binding not in broken: + raise Wrong("the failing design does not break %s, the constraint named binding" % binding) + if binding in [c["id"] for c in check["constraints"] if c["on"] == "outcome"]: + said = card.get("failing") or {} + if said.get("stopped") != failing.get("stopped"): + raise Wrong("the failing design's run stops with %s; the card says %r" % (failing.get("stopped"), said.get("stopped"))) + if failing.get("no_step"): + pass # a solve that is refused has no step: its stop's name is stated + elif not (isinstance(said.get("step"), int) and not isinstance(said.get("step"), bool) and said["step"] == failing.get("steps_landed")): + raise Wrong("the failing design's run is sealed to step %s; the card says %r" % (failing.get("steps_landed"), said.get("step"))) + spec = check["design"] + xp, xf = passing["x"], failing["x"] + if spec["direction"] == "largest" and not xf > xp: + raise Wrong("the task asks for the largest value that holds: the failing design must lie above the passing one") + if spec["direction"] == "smallest" and not xf < xp: + raise Wrong("the task asks for the smallest value that holds: the failing design must lie below the passing one") + ok, graded = grade_bracket(xp, xf, reference["boundary"], spec["tolerance"], spec["tolerance"] * 0.5, row) + if not ok: + return graded, "the two designs are %.6g apart; the task asks for %.6g or less, and they must straddle the boundary" % ( + abs(xf - xp), spec["tolerance"]) + return 1.0, None + + +def score_budget(env, card, replay, row, proofs): + check, reference = env["check"], env["reference"] + template, path, tool = check["template"], check["variable"], check["tool"] + sides = {} + for side in ("holds", "stops"): + arguments = request_of(card.get(side), tool, side) + also = check.get("also") or [] + where = differs(template, without_readout(arguments), {path} | set(also)) + if where: + raise Integrity("the %s request differs from the task's at %s" % (side, where)) + x = get_path(arguments, path) + if not number(x): + raise Integrity("the %s request has no number at %s" % (side, path)) + for place in also: + again = get_path(arguments, place) + if not (number(again) and float(again) == float(x)): + raise Integrity("the %s request does not hold the same value at %s as at %s" % (side, place, path)) + holds, words = replay.proof_holds(tool, arguments, card[side].get("proof")) + proofs.append(holds) + sides[side] = (float(x), arguments, holds, words) + for side in ("holds", "stops"): + if not sides[side][2]: + raise Integrity("the %s seal: %s" % (side, sides[side][3])) + held = replay.answer(tool, sides["holds"][1]) + stopped = replay.answer(tool, sides["stops"][1]) + row["holds_outcome"], row["stops_outcome"] = held["outcome"], "%s (%s)" % (stopped["outcome"], stopped["stop"]) + if held["outcome"] not in NOT_STOPPED: + raise Wrong("the holds request comes back %s (%s)" % (held["outcome"], held["stop"])) + if stopped["stop"] != check["stop"]: + raise Wrong("the stops request comes back %s (%s), not the stop %s" % (stopped["outcome"], stopped["stop"], check["stop"])) + if card["stops"].get("stopped") != check["stop"]: + raise Wrong("the card names the stop %r; the verifier names %s" % (card["stops"].get("stopped"), check["stop"])) + xh, xs = sides["holds"][0], sides["stops"][0] + star = reference["boundary"] + row["holds_value"], row["stops_value"] = xh, xs + tol = check["relative_width"] * abs(star) + ok, graded = grade_bracket(xh, xs, star, tol, 1e-9 * abs(star), row) + if not ok: + return graded, "the bracket is %.6g wide; the task asks for %.3g of the value or less, and it must hold the stop" % ( + abs(xs - xh), check["relative_width"]) + return 1.0, None + + +def forensics_f1(env, named): + """(graded, problem): F1 over (row, reason) pairs; problem when the card is not a usable answer.""" + if not isinstance(named, dict): + return 0.0, "false_rows is not an object of row and reason" + rows = [c["row"] for c in env["check"]["rows"]] + truth = env["reference"]["false_rows"] + unknown = [r for r in named if r not in set(rows)] + if unknown: + return 0.0, "no rows %s in the table" % ", ".join(sorted(unknown)) + reasons = env["check"].get("reasons") or REASONS + bad = [r for r, why in named.items() if why not in reasons] + if bad: + return 0.0, "the reason for %s is not one of %s" % (", ".join(sorted(bad)), ", ".join(reasons)) + if rows and set(named) == set(rows): + return 0.0, "every row of the table is named false: a blanket answer" + found = sum(1 for r, why in named.items() if truth.get(r) == why) + if not truth and not named: + return 1.0, None + precision = found / len(named) if named else 0.0 + recall = found / len(truth) if truth else 0.0 + f1 = 2 * precision * recall / (precision + recall) if precision + recall else 0.0 + if f1 >= 1.0: + return 1.0, None + missed = sorted(set(truth) - set(named)) + wrongly = sorted(set(named) - set(truth)) + wrong_reason = sorted(r for r in set(truth) & set(named) if truth[r] != named[r]) + said = [] + if missed: + said.append("%d false row(s) not named" % len(missed)) + if wrongly: + said.append("%d genuine row(s) named false" % len(wrongly)) + if wrong_reason: + said.append("%d false row(s) with another reason" % len(wrong_reason)) + return f1, "; ".join(said) + + +def score(env, reply, replay, calls=None, reply_calls=None, calls_from="reply", log_problem=None): + """One environment scored. calls: the authoritative record [(tool, arguments)] (None: no record); + reply_calls: the reply-side log, compared with calls under calls_from="harness".""" + row = {"id": env["id"], "family": env["family"], "kind": KINDS.get(env["family"]), "calls_from": calls_from, + "correct": 0, "proofs_hold": 0, "reward": 0, "graded": 0.0, "verdict": None, "reason": None} + card, problem = read_card(reply) + if problem: + row.update(verdict="no_card", reason=problem) + return row + proofs = [] + try: + problem = engine_problem(env, replay) + if problem: + raise Integrity(problem) + problem = call_record_problem(env, card, calls, reply_calls, calls_from, log_problem, row) + if problem: + raise Integrity(problem) + family = env["family"] + if family in ("tradeoff", "chain_design"): + graded, reason = score_boundary(env, card, replay, row, proofs) + elif family == "budget": + graded, reason = score_budget(env, card, replay, row, proofs) + elif family == "forensics": + named = card.get("false_rows") + if isinstance(named, dict): + row["named"] = named + graded, reason = forensics_f1(env, named) + proofs = [True] + if reason and graded == 0.0 and not isinstance(named, dict): + raise Wrong(reason) + else: + raise Wrong("unknown family %s" % family) + except Integrity as problem: + row.update(verdict="integrity", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs))) + return row + except Wrong as problem: + row.update(verdict="wrong", reason=str(problem), proofs_hold=int(bool(proofs) and all(proofs))) + return row + proofs_hold = int(bool(proofs) and all(proofs)) + correct = int(graded >= 1.0 and reason is None) + row.update(correct=correct, proofs_hold=proofs_hold, reward=int(correct == 1 and proofs_hold == 1), + graded=round(graded, 6) if proofs_hold else 0.0, + verdict="pass" if correct and proofs_hold else ("near" if graded > 0 else "wrong"), reason=reason) + return row + + +def records_for(folder, env_id, calls_from, harness_dir=None): + """(calls, reply_calls, log_problem) for one environment's reply in folder.""" + reply_calls = read_calls(os.path.join(folder, env_id + ".calls.jsonl")) + if calls_from == "harness": + calls, log_problem = read_harness_log(os.path.join(harness_dir or folder, env_id + ".harness.jsonl")) + return calls, reply_calls, log_problem + return reply_calls, None, None + + +def main(): + parser = argparse.ArgumentParser(description=__doc__.split("\n")[0]) + parser.add_argument("replies") + parser.add_argument("--engine", required=True) + parser.add_argument("--only") + parser.add_argument("--environments", required=True) + parser.add_argument("--out") + parser.add_argument("--calls-from", choices=("reply", "harness"), default="harness") + parser.add_argument("--harness-dir") + parser.add_argument("--quiet", action="store_true") + args = parser.parse_args() + environments = load_environments(args.environments) + if args.only: + wanted = set(args.only.split(",")) + environments = [e for e in environments if e["id"] in wanted] + missing = wanted - {e["id"] for e in environments} + if missing: + sys.exit("no environments %s in %s" % (", ".join(sorted(missing)), args.environments)) + for env in environments: + for problem in row_problems(env): + print("warning: %s: %s" % (env.get("id"), problem), file=sys.stderr) + verifier = open_verifier(args.engine) + replay = Replay(verifier) + rows = [] + try: + for env in environments: + path = os.path.join(args.replies, env["id"] + ".txt") + reply = open(path, encoding="utf-8", errors="replace").read() if os.path.isfile(path) else "" + calls, reply_calls, log_problem = records_for(args.replies, env["id"], args.calls_from, args.harness_dir) + row = score(env, reply, replay, calls, reply_calls, args.calls_from, log_problem) + rows.append(row) + if not args.quiet: + print("%-58s reward %d graded %.4f %-9s %s" % (env["id"], row["reward"], row["graded"], row["verdict"], + row["reason"] or ""), flush=True) + replay.seen.clear() + finally: + close_verifier(verifier) + if args.out: + with open(args.out, "w", encoding="utf-8") as f: + for row in rows: + f.write(json.dumps(row) + "\n") + total = len(rows) + print("\n%d environments: reward %d, graded %.4f (mean %.4f), correct %d, proofs_hold %d" % ( + total, sum(r["reward"] for r in rows), sum(r["graded"] for r in rows), + sum(r["graded"] for r in rows) / total if total else 0.0, + sum(r["correct"] for r in rows), sum(r["proofs_hold"] for r in rows))) + by = {} + for r in rows: + by.setdefault(r["family"], []).append(r) + for family in FAMILIES: + if family in by: + print(" %-13s reward %d of %d, mean graded %.4f" % (family, sum(r["reward"] for r in by[family]), len(by[family]), + sum(r["graded"] for r in by[family]) / len(by[family]))) + + +if __name__ == "__main__": + main() diff --git a/sample/tasks/harbor/tasks/g2-forensics6-07/tests/test.sh b/sample/tasks/harbor/tasks/g2-forensics6-07/tests/test.sh new file mode 100644 index 0000000000000000000000000000000000000000..4e4008f0a93d9c230856a9c0e0ecf5cd5cef1066 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-forensics6-07/tests/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Harbor runs this after the agent has finished, in a fresh copy of the image +# (task.toml: [verifier] environment_mode = "separate"). By then Harbor has +# copied tests/ to /tests and the declared artifacts, where they exist, to +# their own paths: /app/answer.json and /logs/agent/trajectory.json. +# grade.py writes /logs/verifier/reward.json. If the scorer itself fails it +# writes no reward and this script exits non-zero. +HERE="$(cd "$(dirname "$0")" && pwd)" +exec python3 -B "$HERE/grade.py" diff --git a/sample/tasks/harbor/tasks/g2-forensics6-07/tests/ztp_mcp.py b/sample/tasks/harbor/tasks/g2-forensics6-07/tests/ztp_mcp.py new file mode 100644 index 0000000000000000000000000000000000000000..0cde73653317c847cd361ad0ca9d4f1f785bc3a7 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-forensics6-07/tests/ztp_mcp.py @@ -0,0 +1,188 @@ +"""A small Model Context Protocol client for the Zero-Trust Physics verifier. + +Standard library only. It speaks MCP two ways: + + stdio to a verifier built from the public source and started here as a program + (target/release/mcp_stdio): one JSON-RPC message a line, no network. + HTTP to an MCP address (JSON-RPC in a POST), such as + + https://mcp.zerotrustphysics.com/mcp Open to any agent. + +The open address gives each network address one place in the physics pool at a +time and answers "Too many concurrent physics tasks." or HTTP 429 when it is +busy; nothing waits on the server, so this client sends one request at a time +and, when it is told to come back, waits and sends the same request again. + +Licence: Apache-2.0. +""" +import json +import select +import shlex +import subprocess +import time +import urllib.error +import urllib.request + +OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp" +BUSY = "Too many concurrent physics tasks." + + +class McpError(RuntimeError): + pass + + +class Verifier: + """One MCP endpoint. call(tool, arguments) returns (text, is_error).""" + + def __init__(self, url=OPEN_ADDRESS, timeout_s=90, patience_s=600, pause_s=0.0, headers=None, quiet=True): + self.url = url + self.timeout_s = timeout_s + self.patience_s = patience_s # how long to keep asking politely before giving up on one request + self.pause_s = pause_s # a fixed pause after every request, for a shared address + self.headers = dict(headers or {}) + self.quiet = quiet + self.session = None + self.server = None + self.requests_sent = 0 + self.times_asked_to_wait = 0 + self._id = 0 + + # -- transport ------------------------------------------------------------------------- + def _post(self, message): + body = json.dumps(message).encode() + headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream", + "User-Agent": "zero-trust-physics-environments/1.0", **self.headers} + if self.session: + headers["Mcp-Session-Id"] = self.session + request = urllib.request.Request(self.url, data=body, headers=headers, method="POST") + self.requests_sent += 1 + with urllib.request.urlopen(request, timeout=self.timeout_s) as response: + session = response.headers.get("Mcp-Session-Id") + if session: + self.session = session + raw = response.read().decode("utf-8") + kind = response.headers.get("Content-Type", "") + if "text/event-stream" in kind: + for line in raw.splitlines(): + if line.startswith("data:"): + found = json.loads(line[5:].strip()) + if found.get("id") == message.get("id"): + return found + raise McpError("the event stream held no answer to the request") + return json.loads(raw) if raw.strip() else {} + + def _ask(self, method, params=None): + """Send one request; on 429, a busy pool, a 5xx or a dropped connection, wait and send it again.""" + self._id += 1 + message = {"jsonrpc": "2.0", "id": self._id, "method": method} + if params is not None: + message["params"] = params + started, wait = time.time(), 2.0 + while True: + reason = None + try: + answer = self._post(message) + if "error" in answer: + raise McpError("protocol error: %s" % json.dumps(answer["error"])[:300]) + result = answer.get("result", {}) + text = "".join(c.get("text", "") for c in result.get("content", []) or []) + if method == "tools/call" and BUSY in text and len(text) < 400: + reason = "the physics pool is busy" + else: + if self.pause_s: + time.sleep(self.pause_s) + return result + except urllib.error.HTTPError as problem: + if problem.code == 429 or problem.code >= 500: + after = problem.headers.get("Retry-After") + reason = "HTTP %d" % problem.code + if after and after.isdigit(): + wait = max(wait, float(after)) + else: + raise McpError("HTTP %d: %s" % (problem.code, problem.read().decode("utf-8", "replace")[:300])) + except (urllib.error.URLError, TimeoutError, ConnectionError, OSError) as problem: + reason = "no connection (%s)" % problem + self.times_asked_to_wait += 1 + if time.time() - started + wait > self.patience_s: + raise McpError("gave up after %d s: %s" % (self.patience_s, reason)) + if not self.quiet: + print(" %s; asking again in %.0f s" % (reason, wait), flush=True) + time.sleep(wait) + wait = min(wait * 1.6, 30.0) + + # -- protocol -------------------------------------------------------------------------- + def connect(self): + result = self._ask("initialize", {"protocolVersion": "2025-06-18", "capabilities": {}, + "clientInfo": {"name": "zero-trust-physics-environments", "version": "1.0"}}) + self.server = result.get("serverInfo") + try: + self._post({"jsonrpc": "2.0", "method": "notifications/initialized"}) + except Exception: # a notification has no answer; some servers close without one + pass + return result + + def tools(self): + """The tool declarations exactly as the endpoint gives them.""" + return self._ask("tools/list").get("tools", []) + + def call(self, tool, arguments=None): + """Call one tool. Returns (text, is_error): the text of the answer and the MCP isError flag.""" + result = self._ask("tools/call", {"name": tool, "arguments": arguments or {}}) + text = "".join(c.get("text", "") for c in result.get("content", []) or []) + return text, bool(result.get("isError")) + + def call_json(self, tool, arguments=None): + """Call one tool. Returns (body, is_error): the parsed JSON, or the text when it is not JSON.""" + text, is_error = self.call(tool, arguments) + try: + return json.loads(text), is_error + except ValueError: + return text, is_error + + +class StdioVerifier(Verifier): + """The same interface over MCP stdio: a program started here that speaks JSON-RPC, one message a line. + For anyone who holds an MCP server as a program; the open address needs none of this.""" + + def __init__(self, command, timeout_s=600, **kwargs): + super().__init__(url="stdio: " + (command if isinstance(command, str) else " ".join(command)), timeout_s=timeout_s, **kwargs) + self.proc = subprocess.Popen(shlex.split(command) if isinstance(command, str) else command, + stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) + + def _post(self, message): + self.requests_sent += 1 + try: + self.proc.stdin.write((json.dumps(message) + "\n").encode()) + self.proc.stdin.flush() + except OSError: # a program that has stopped reading will not start again + try: + self.proc.stdin.close() + except OSError: + pass + raise McpError("the program stopped reading") + if "id" not in message: + return {} + while True: + ready, _, _ = select.select([self.proc.stdout], [], [], self.timeout_s) + if not ready: + raise McpError("no answer in %d s" % self.timeout_s) + line = self.proc.stdout.readline() + if not line: + raise McpError("the program closed its output") + found = json.loads(line) + if found.get("id") == message["id"]: + return found + + def close(self): + self.proc.terminate() + try: + self.proc.wait(timeout=5) + except subprocess.TimeoutExpired: + self.proc.kill() + + +def connect(endpoint=OPEN_ADDRESS, **kwargs): + """A connected verifier: an http(s) address, or "stdio:" for a program.""" + verifier = StdioVerifier(endpoint[len("stdio:"):].strip(), **kwargs) if endpoint.startswith("stdio:") else Verifier(endpoint, **kwargs) + verifier.connect() + return verifier diff --git a/sample/tasks/harbor/tasks/g2-forensics6-07/tests/ztp_open_bridge.py b/sample/tasks/harbor/tasks/g2-forensics6-07/tests/ztp_open_bridge.py new file mode 100644 index 0000000000000000000000000000000000000000..9e4330e54ed33d8cf1f9a1078d9f36e5f96c2996 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-forensics6-07/tests/ztp_open_bridge.py @@ -0,0 +1,109 @@ +"""The open address as a stdio MCP server: every JSON-RPC line read on stdin is posted, unchanged, to the verifier's +MCP address, and its answer written back on stdout, one line each. Standard library only. + + python3 ztp_open_bridge.py [URL] URL defaults to https://mcp.zerotrustphysics.com/mcp + +It is for a client that starts its MCP server as a program (an MCP config's command and args, a Harbor task's stdio +server, the harness's logging proxy in front of it) when the verifier it is to use is the served one. The bridge adds +nothing and drops nothing: a request goes out byte for byte as JSON, its answer comes back as the address gave it; a +notification (no id) is posted and answered by nothing. The session the address opens (Mcp-Session-Id) is kept for +every later message. On HTTP 429, a 5xx, a busy physics pool or a dropped connection it waits and posts the same +message again, as ztp_mcp.Verifier does, so a client sees one answer per request. + +Optional: ZTP_API_KEY in the environment sends "Authorization: Bearer " on every post, for a keyed door. With no +key set the bridge sends what it always sent. No key is ever written into a pack, a task or an image. + +Licence: Apache-2.0. +""" +import json +import os +import sys +import time +import urllib.error +import urllib.request + +OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp" +BUSY = "Too many concurrent physics tasks." +PATIENCE_S = float(os.environ.get("ZTP_BRIDGE_PATIENCE_S", "900")) +API_KEY = os.environ.get("ZTP_API_KEY") or None + + +class Bridge: + def __init__(self, url): + self.url = url + self.session = None + self.extra_headers = {} + + def post(self, message): + body = json.dumps(message).encode() + headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream", + "User-Agent": "zero-trust-physics-bridge/1.0"} + if self.session: + headers["Mcp-Session-Id"] = self.session + if API_KEY: + headers["Authorization"] = "Bearer " + API_KEY + headers.update(self.extra_headers) + request = urllib.request.Request(self.url, data=body, headers=headers, method="POST") + with urllib.request.urlopen(request, timeout=600) as response: + if response.headers.get("Mcp-Session-Id"): + self.session = response.headers["Mcp-Session-Id"] + raw = response.read().decode("utf-8") + kind = response.headers.get("Content-Type", "") + if "id" not in message: + return None + if "text/event-stream" in kind: + for line in raw.splitlines(): + if line.startswith("data:"): + found = json.loads(line[5:].strip()) + if found.get("id") == message.get("id"): + return found + return {"jsonrpc": "2.0", "id": message.get("id"), "error": {"code": -32603, "message": "the address's event stream held no answer"}} + return json.loads(raw) if raw.strip() else None + + def forward(self, message): + started, wait = time.time(), 2.0 + while True: + try: + answer = self.post(message) + text = "" + if isinstance(answer, dict) and isinstance(answer.get("result"), dict): + text = "".join(c.get("text", "") for c in answer["result"].get("content", []) or [] if isinstance(c, dict)) + if not (BUSY in text and len(text) < 400): + return answer + except urllib.error.HTTPError as problem: + if not (problem.code == 429 or problem.code >= 500): + if "id" not in message: + return None + return {"jsonrpc": "2.0", "id": message.get("id"), + "error": {"code": -32603, "message": "HTTP %d from the verifier's address" % problem.code}} + after = problem.headers.get("Retry-After") + if after and after.isdigit(): + wait = max(wait, float(after)) + except (urllib.error.URLError, TimeoutError, ConnectionError, OSError): + pass + if time.time() - started + wait > PATIENCE_S: + if "id" not in message: + return None + return {"jsonrpc": "2.0", "id": message.get("id"), + "error": {"code": -32603, "message": "the verifier's address did not answer in %d s" % PATIENCE_S}} + time.sleep(wait) + wait = min(wait * 1.6, 30.0) + + +def main(): + bridge = Bridge(sys.argv[1] if len(sys.argv) > 1 else OPEN_ADDRESS) + for line in sys.stdin: + if not line.strip(): + continue + try: + message = json.loads(line) + except ValueError: + continue + answer = bridge.forward(message) + if answer is not None: + sys.stdout.write(json.dumps(answer, separators=(",", ":")) + "\n") + sys.stdout.flush() + + +if __name__ == "__main__": + main() diff --git a/sample/tasks/harbor/tasks/g2-forensics7-10/environment/Dockerfile b/sample/tasks/harbor/tasks/g2-forensics7-10/environment/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..c807fbade805136032ff63002e2cc8d31376f95f --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-forensics7-10/environment/Dockerfile @@ -0,0 +1,14 @@ +# Harbor environment image for Zero-Trust Physics release v0.15.3 (commit 664d68f4). +# Public 5-crate Rust engine reference source is at https://github.com/johnkruze/zero-trust-physics-engine (tag v0.15.2); +# read-only source audit of the pack verifier build is available under NDA (https://zerotrustphysics.com/offers/#licence). +# In this free evaluation sample, /usr/local/bin/mcp_stdio bridges JSON-RPC over stdio to the public MCP endpoint +# (ztp_open_bridge.py), and the scorer verifies release 0.15.3 version and kernel invariants on every reply. +# Paid Domain Packs ship compiled static Linux/macOS rollout binaries for --network none execution. +FROM python:3.12-slim-bookworm +ARG ZTP_ENGINE_TAG=v0.15.3 +ARG ZTP_ENGINE_COMMIT=664d68f426ccdfd0159e5f91857edba3872390d1 +ARG ZTP_VERIFIER_URL=https://mcp.zerotrustphysics.com/mcp +COPY ztp_open_bridge.py /usr/local/lib/ztp/ztp_open_bridge.py +RUN printf '#!/bin/sh\nexec python3 /usr/local/lib/ztp/ztp_open_bridge.py "%s"\n' "$ZTP_VERIFIER_URL" > /usr/local/bin/mcp_stdio \ + && chmod +x /usr/local/bin/mcp_stdio +WORKDIR /app diff --git a/sample/tasks/harbor/tasks/g2-forensics7-10/environment/ztp_open_bridge.py b/sample/tasks/harbor/tasks/g2-forensics7-10/environment/ztp_open_bridge.py new file mode 100644 index 0000000000000000000000000000000000000000..9e4330e54ed33d8cf1f9a1078d9f36e5f96c2996 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-forensics7-10/environment/ztp_open_bridge.py @@ -0,0 +1,109 @@ +"""The open address as a stdio MCP server: every JSON-RPC line read on stdin is posted, unchanged, to the verifier's +MCP address, and its answer written back on stdout, one line each. Standard library only. + + python3 ztp_open_bridge.py [URL] URL defaults to https://mcp.zerotrustphysics.com/mcp + +It is for a client that starts its MCP server as a program (an MCP config's command and args, a Harbor task's stdio +server, the harness's logging proxy in front of it) when the verifier it is to use is the served one. The bridge adds +nothing and drops nothing: a request goes out byte for byte as JSON, its answer comes back as the address gave it; a +notification (no id) is posted and answered by nothing. The session the address opens (Mcp-Session-Id) is kept for +every later message. On HTTP 429, a 5xx, a busy physics pool or a dropped connection it waits and posts the same +message again, as ztp_mcp.Verifier does, so a client sees one answer per request. + +Optional: ZTP_API_KEY in the environment sends "Authorization: Bearer " on every post, for a keyed door. With no +key set the bridge sends what it always sent. No key is ever written into a pack, a task or an image. + +Licence: Apache-2.0. +""" +import json +import os +import sys +import time +import urllib.error +import urllib.request + +OPEN_ADDRESS = "https://mcp.zerotrustphysics.com/mcp" +BUSY = "Too many concurrent physics tasks." +PATIENCE_S = float(os.environ.get("ZTP_BRIDGE_PATIENCE_S", "900")) +API_KEY = os.environ.get("ZTP_API_KEY") or None + + +class Bridge: + def __init__(self, url): + self.url = url + self.session = None + self.extra_headers = {} + + def post(self, message): + body = json.dumps(message).encode() + headers = {"Content-Type": "application/json", "Accept": "application/json, text/event-stream", + "User-Agent": "zero-trust-physics-bridge/1.0"} + if self.session: + headers["Mcp-Session-Id"] = self.session + if API_KEY: + headers["Authorization"] = "Bearer " + API_KEY + headers.update(self.extra_headers) + request = urllib.request.Request(self.url, data=body, headers=headers, method="POST") + with urllib.request.urlopen(request, timeout=600) as response: + if response.headers.get("Mcp-Session-Id"): + self.session = response.headers["Mcp-Session-Id"] + raw = response.read().decode("utf-8") + kind = response.headers.get("Content-Type", "") + if "id" not in message: + return None + if "text/event-stream" in kind: + for line in raw.splitlines(): + if line.startswith("data:"): + found = json.loads(line[5:].strip()) + if found.get("id") == message.get("id"): + return found + return {"jsonrpc": "2.0", "id": message.get("id"), "error": {"code": -32603, "message": "the address's event stream held no answer"}} + return json.loads(raw) if raw.strip() else None + + def forward(self, message): + started, wait = time.time(), 2.0 + while True: + try: + answer = self.post(message) + text = "" + if isinstance(answer, dict) and isinstance(answer.get("result"), dict): + text = "".join(c.get("text", "") for c in answer["result"].get("content", []) or [] if isinstance(c, dict)) + if not (BUSY in text and len(text) < 400): + return answer + except urllib.error.HTTPError as problem: + if not (problem.code == 429 or problem.code >= 500): + if "id" not in message: + return None + return {"jsonrpc": "2.0", "id": message.get("id"), + "error": {"code": -32603, "message": "HTTP %d from the verifier's address" % problem.code}} + after = problem.headers.get("Retry-After") + if after and after.isdigit(): + wait = max(wait, float(after)) + except (urllib.error.URLError, TimeoutError, ConnectionError, OSError): + pass + if time.time() - started + wait > PATIENCE_S: + if "id" not in message: + return None + return {"jsonrpc": "2.0", "id": message.get("id"), + "error": {"code": -32603, "message": "the verifier's address did not answer in %d s" % PATIENCE_S}} + time.sleep(wait) + wait = min(wait * 1.6, 30.0) + + +def main(): + bridge = Bridge(sys.argv[1] if len(sys.argv) > 1 else OPEN_ADDRESS) + for line in sys.stdin: + if not line.strip(): + continue + try: + message = json.loads(line) + except ValueError: + continue + answer = bridge.forward(message) + if answer is not None: + sys.stdout.write(json.dumps(answer, separators=(",", ":")) + "\n") + sys.stdout.flush() + + +if __name__ == "__main__": + main() diff --git a/sample/tasks/harbor/tasks/g2-forensics7-10/instruction.md b/sample/tasks/harbor/tasks/g2-forensics7-10/instruction.md new file mode 100644 index 0000000000000000000000000000000000000000..499289db0b87281914a9c29dfa5feaac605562e1 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-forensics7-10/instruction.md @@ -0,0 +1,35 @@ +A report hands you ten claims about answers of the verifier. Each row gives the model, the request as it was sent, what its answer is claimed to say and the proof claimed for it. claim.outcome and claim.stop are the run's outcome and the name of its stop or declared end (null when it completed); claim.steps_landed is the last step the run is sealed to; claim.quantity and claim.value are one number of the final state of a run (of the result, for a solve); claim.flags are the advisory flags the run carried, each with the quantity it is on, its extent at the largest (extent) and the number of steps it was raised on (steps). +Some rows are false. A false row may be wrong in more than one way; its reason is the first of these, in this order, that is true of it: +1. retired_model: the request names a model ID the verifier does not serve (one it no longer serves, or a name it never served). +2. parent_wrong: the request continues a run (from) that is not the parent it names: its start state, or the seal it gives for its parent, belongs to another run, and the verifier refuses the continuation. +3. seal_wrong: the proof is not the seal of this request. +4. stop_hidden: the run stops part way and the claim says it completed. +5. step_wrong: the claim names the run's stop, but not the last step the run is sealed to. +6. flag_omitted: the run carries an advisory flag (a name on a quantity) that the claim leaves out altogether. +7. flag_altered: the flags the claim lists are not the run's, entry for entry: an extent or a count of steps differs, or an entry is missing or added where its name on that quantity is listed too (the verifier may list one flag on one quantity more than once, each with its own extent). +8. value_altered: the claimed value is not the one the request gives, to the last digit. +A row that is none of these is genuine, whatever else differs in how it is written (the order of its flags, a readout sent with the request, the spelling of a number). Name every false row with its reason. +The rows, one a line: +{"row": "R1", "model": "aerospace/solar_system", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "solar_system", "initial": {"sun_position_m": [-863637229.4106485, -588455255.8381735, -225852694.17788354], "sun_velocity_m_s": [12.397135730588673, -8.676658356669796, -4.0448914054830265], "mercury_position_m": [30544984580.541214, 31538497612.618702, 13677667513.450943], "mercury_velocity_m_s": [-45893.79576346148, 28907.37310381068, 20202.882077964397], "venus_position_m": [-106439655769.27072, 15156574441.51891, 13539171068.575262], "venus_velocity_m_s": [-6662.526312895438, -31691.929801737846, -13835.48559151052], "earth_position_m": [102407858815.46872, -102611923461.79506, -44458723871.361084], "earth_velocity_m_s": [21351.990015305262, 18497.83118201897, 8019.230891774351], "moon_position_m": [102047097668.78308, -102736187163.71382, -44474590914.85404], "moon_velocity_m_s": [21609.833460848902, 17579.38315631339, 7638.85449892693], "mars_position_m": [-108034816249.35658, 196931821387.40118, 93267362532.8832], "mars_velocity_m_s": [-20818.954980749113, -8043.795945699443, -3126.300559642824], "jupiter_position_m": [419113155659.17053, 572916852927.5242, 235366142766.89377], "jupiter_velocity_m_s": [-10981.451664109512, 7203.166125214057, 3354.981129871713], "saturn_position_m": [810247233830.7081, 1028692408157.641, 390011764585.78156], "saturn_velocity_m_s": [-8280.517996609125, 5149.719611471784, 2483.289801876904], "uranus_position_m": [2242902225084.655, -1790169184837.4873, -815772837485.7194], "uranus_velocity_m_s": [4440.090766223361, 4422.709890451177, 1874.2294942165538], "neptune_position_m": [2597044231109.891, -3383482727434.8364, -1449535655907.9255], "neptune_velocity_m_s": [4405.7539005103245, 2969.8264977576428, 1105.8807943842667], "ceres_position_m": [-322236661229.9761, -227977183777.5967, -41837637472.4793], "ceres_velocity_m_s": [9380.707730841985, -13838.379917110064, -8421.170529908282], "pallas_position_m": [-351293366602.40656, -24289147273.497444, 28702819004.877907], "pallas_velocity_m_s": [-1948.7381903754856, -20307.781285208814, 4156.606512462996], "vesta_position_m": [166331403121.10275, -256906652758.2719, -124134856049.41298], "vesta_velocity_m_s": [18295.602252098583, 9577.160570429965, 1423.2851008847358], "energy_anchor": -1.321940998513625e+25, "booked_work": 0.0, "angular_momentum_anchor": [5.490282510087069e+31, -8.153754585822945e+32, 1.9244191261307657e+33], "booked_torque": [0.0, 0.0, 0.0]}, "dt_s": 1677.0, "segments": [{"steps": 9, "load": {}}, {"steps": 10, "load": {}}, {"steps": 11, "load": {}}, {"steps": 12, "load": {}}, {"steps": 13, "load": {}}, {"steps": 14, "load": {}}, {"steps": 15, "load": {}}], "record_every": 84, "readout": {"quantities": ["earth_mars_distance_m"]}}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 84, "quantity": "earth_mars_distance_m", "value": 390895599447.7874, "flags": []}, "proof": "0cc96b6596b63629b419c167374ae7ab4a2b01eea6b41026478ecd3e3e3519f0257c279d9ee2b73cf297642b476eecb4"} +{"row": "R2", "model": "aerospace/capsule_insight", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_insight", "initial": {"radius_m": 3519545.0, "radial_speed_m_s": -1340.4281, "transverse_speed_m_s": 5819.933}, "dt_s": 0.1, "segments": [{"steps": 2195, "load": {"lift_over_drag": 0.0}}], "record_every": 2195}}, "claim": {"outcome": "ended", "stop": "PastFlightDeployment", "steps_landed": 1975, "quantity": "mach", "value": 1.414380813182044, "flags": []}, "proof": "caf9fef4f3cfb1be4d6d1234fb1484c1525d788b0f09706c6f48f9d4be552533f0c55af43f8dda1ae3d7869b6a3f82c5"} +{"row": "R3", "model": "aerospace/crater_ryugu_sci", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "crater_ryugu_sci", "initial": {"radius_m": 3.395}, "dt_s": 0.163, "segments": [{"steps": 201, "load": {}}, {"steps": 222, "load": {}}, {"steps": 243, "load": {}}], "record_every": 666}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 666, "quantity": "radius_m", "value": 6.8729656389716265, "flags": []}, "proof": "6d6b45da8cf15848762712a1d05b1b8f3b1b9d6303f2c0162e30dfa6d44ec950766e5b6bf074c739440ff306f1889a0a"} +{"row": "R4", "model": "aerospace/capsule_stardust", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "capsule_stardust", "initial": {"radius_m": 6488061.0, "radial_speed_m_s": -2105.71, "transverse_speed_m_s": 12576.74}, "dt_s": 0.05, "segments": [{"steps": 3193, "load": {}}], "record_every": 3193, "readout": {"quantities": ["altitude_m"]}}}, "claim": {"outcome": "ended", "stop": "PastFlightDeployment", "steps_landed": 1929, "quantity": "altitude_m", "value": 31025.876497731544, "flags": [{"flag": "FLAG_DROGUE_MACH_WINDOW", "quantity": "mach", "extent": 0.39864147264033933, "steps": 190}, {"flag": "FLAG_DROGUE_MACH_WINDOW", "quantity": "mach", "extent": 0.39990473030213836, "steps": 190}, {"flag": "FLAG_MACH_TABLE_HELD", "quantity": "mach", "extent": 0.02429835996056795, "steps": 2}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "air_speed_m_s", "extent": 155.89247760455874, "steps": 484}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "air_speed_m_s", "extent": 1697.5036915755654, "steps": 1243}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "path_sine", "extent": 0.048142951009741516, "steps": 1005}, {"flag": "FLAG_OFF_FLOWN_ENTRY", "quantity": "path_sine", "extent": 0.06286079576874015, "steps": 851}]}, "proof": "fa2be55cda475420e0f90829833bea259ff32039b96724066963ad9de7ee75937d6f50458965183ad3962d5197a6062b"} +{"row": "R5", "model": "plasma_sheath_ram_c2", "request": {"tool": "solve", "arguments": {"solver": "plasma_sheath_ram_c2", "parameters": {"altitude_m": 55180.0, "velocity_m_s": 6896.0, "signal_frequency_hz": 4157000000.0}}}, "claim": {"outcome": "converged", "stop": null, "steps_landed": null, "quantity": "stagnation_temperature_k", "value": 6383.526355576421, "flags": []}, "proof": "70b0239e697034b92172ce494691215f79d0c4a56078257a3e624b2ee111ef7e94ef97df0177ac97270ec674bda20422"} +{"row": "R6", "model": "ablator_slab", "request": {"tool": "solve", "arguments": {"solver": "ablator_slab", "parameters": {"material": "PICA, open record, version 5", "thickness_m": 0.04845, "start_temperature_k": 308.75, "thermocouple_depths_m": [], "face": "held_temperature", "held_temperature_k": 1976.0, "hold_duration_s": 63.85, "continue_after_s": 43.15, "return_face_history": false, "return_thermocouple_histories": false, "return_final_profile": false}}}, "claim": {"outcome": "converged", "stop": null, "steps_landed": null, "quantity": "depth_within_2_percent_of_virgin_m", "value": 0.014116399858056352, "flags": []}, "proof": "96e1a407a5dcf744722373aa7715f472762d5816c796d3073ee9f8970fc1ce3ed5bb10c6cc151e88ee32c13bc1cb681b"} +{"row": "R7", "model": "aerospace/momentum_jwst_dihedral", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "momentum_jwst_dihedral", "initial": {"h_eci_nms": [-1.429, 1.053, -1.498]}, "dt_s": 1910.0, "segments": [{"steps": 49, "load": {"q1": 0.638559, "q2": -0.019, "q3": -0.652891, "q4": 0.406959, "sun_x": 0.616092, "sun_y": 0.703148, "sun_z": 0.354984, "sun_distance_au": 1.01415}}, {"steps": 45, "load": {"q1": 0.748856, "q2": -0.003607, "q3": -0.560934, "q4": 0.352923, "sun_x": 0.674752, "sun_y": 0.668222, "sun_z": 0.313352, "sun_distance_au": 1.01415}}], "record_every": 94, "readout": {"quantities": ["h_magnitude_nms"]}}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 94, "quantity": "h_magnitude_nms", "value": 5.002332004564212, "flags": []}, "proof": "a93f9cd7a27d8851a5b9c4996bfa3d1f7c1c31622907a4c743501d5727ba57a8d39f657eca88e8928d1a19ee417ca01d"} +{"row": "R8", "model": "aerospace/momentum_jwst_srp", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "momentum_jwst_srp", "initial": {"h_eci_nms": [0.918, -1.255, 0.815]}, "dt_s": 874.0, "segments": [{"steps": 44, "load": {"q1": 0.685819, "q2": 0.011638, "q3": -0.603055, "q4": 0.407236, "sun_x": 0.616092, "sun_y": 0.713107, "sun_z": 0.334528, "sun_distance_au": 1.01161}}, {"steps": 32, "load": {"q1": 0.659909, "q2": -0.005461, "q3": -0.631303, "q4": 0.407365, "sun_x": 0.634305, "sun_y": 0.70673, "sun_z": 0.313352, "sun_distance_au": 0.1851}}], "record_every": 76}}, "claim": {"outcome": "refused", "stop": "SunshieldAboveKaptonLimit", "steps_landed": 118, "quantity": "h_magnitude_nms", "value": 1.6088350681235042, "flags": []}, "proof": "2802624f097f31c406fcd6c90107e0c92b0856ada8ab7aefd2a74b0db13c863229e6ac88939c9df175a48db8856bbc9d"} +{"row": "R9", "model": "aerospace/satellite_lageos1_twin", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "satellite_lageos1_twin", "initial": {"epoch_utc_s": 844432990.0, "forecast_elapsed_s": 0.0, "position_m": [-5947439.326, 2555567.396, 10470793.788], "velocity_m_s": [4754.057, 2345.016, 2292.947]}, "dt_s": 10.0, "segments": [{"steps": 1614, "load": {}}], "record_every": 1614}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 1614, "quantity": "semi_major_axis_m", "value": 11400874.582902145, "flags": [{"flag": "FLAG_BELOW_COMPARED_RADIUS", "quantity": "radius_m", "extent": 1559062.143708026, "steps": 994}, {"flag": "FLAG_EARTH_SHADOW", "quantity": "distance_from_shadow_axis_m", "extent": 1409415.657917643, "steps": 183}]}, "proof": "760e36d0a9c7ce7d7bc1e45f15334a31f23e242ce276c2b84454dfdcf21ca745576a3557773a024e0d7bedcd90133779"} +{"row": "R10", "model": "aerospace/crater_ryugu_sci", "request": {"tool": "run_trajectory", "arguments": {"domain": "aerospace", "card": "crater_ryugu_sci", "initial": {"radius_m": 1.25}, "dt_s": 0.1285, "segments": [{"steps": 210, "load": {}}, {"steps": 231, "load": {}}, {"steps": 252, "load": {}}, {"steps": 273, "load": {}}, {"steps": 294, "load": {}}, {"steps": 315, "load": {}}], "record_every": 1575}}, "claim": {"outcome": "completed", "stop": null, "steps_landed": 1575, "quantity": "radius_m", "value": 7.823494707379572, "flags": []}, "proof": "e6950ae5d4f4d0953321d1013624d3ce599b23249db4d6075c705be83c6b66f37cbf9a67bb109ddbf36bd7003945bd86"} + +Budget: at most 4 calls that compute, counted over every call you make (every run_trajectory, solve, compute_step and verify_ call counts, refused or not); list_cards, list_solvers, find_model, describe_card, describe_solver, cite and verify_receipt are free. find_flip, design_run, run_dataset and validate_series may not be called at all. + +You have one tool server, the verifier. Answer from what its tools give you and from nothing else. Every number you are judged on is computed again from the requests on your card. + +End your reply with your answer card: one JSON object on its own last line, with no code fence and nothing after it. A request on the card is {"tool": "", "arguments": {}}, and a proof is the run_seal or solution_seal the verifier gave for that request. + +The card: +{"false_rows": {"": "", ...}} + +Name every false row, each with its one reason from retired_model, parent_wrong, seal_wrong, stop_hidden, step_wrong, flag_omitted, flag_altered, value_altered (the first of them, in that order, that is true of the row). Leave the genuine rows out. {"false_rows": {}} says every row is genuine. Your calls are counted: the budget is in the task, and the tools it rules out may not be called at all. + +Also write that answer card, by itself, to the file `/app/answer.json`. diff --git a/sample/tasks/harbor/tasks/g2-forensics7-10/solution/chainlib.py b/sample/tasks/harbor/tasks/g2-forensics7-10/solution/chainlib.py new file mode 100644 index 0000000000000000000000000000000000000000..3c8dc60513d8f8f0372b1ff80d49884754a1d0e5 --- /dev/null +++ b/sample/tasks/harbor/tasks/g2-forensics7-10/solution/chainlib.py @@ -0,0 +1,63 @@ +"""Build the solve request of a chained design from a run's answer: the history its coupling hands over. + +A coupling hands values from the run's recorded frames into the solve bit for bit: each frame's +32-bit slot widened exactly to 64 bits. The frame layout is in describe_card (frame_slots). This +module reads the slots from frame_hex with the standard library and lays the history out the way a +task states it. + + chained_solve(layout, parameters, run_request, run_answer) -> the solve's arguments, with from + +layout is the task's check.design.chain.layout: {"kind": "stardust_slab", "cool_to_s": 600.0} or +{"kind": "triga_element"}. + +Licence: Apache-2.0. +""" +import copy +import struct + + +def _slots(run_answer, f64_at, f32_at): + """Per recorded frame: the f64 at f64_at and each f32 at f32_at, widened.""" + out = [[] for _ in range(1 + len(f32_at))] + for frame in run_answer["frames"]: + raw = bytes.fromhex(frame["frame_hex"]) + out[0].append(struct.unpack("