# dsv41_final — SFT-ready dsv41 TerminalHorizon whole trajectories (2026-11-09) Last stage of the chain described in `coding_analysis/takeaway/terminal_horizon.md`: `dsv41_merged` (system-error-clean) → Opus-4.8 process judge (`dsv41_merged_judged-keep`, 2,541) → **this**: `coding_arena/code/sft/finalize_dataset.py` removes the two residual bad-action forms and the short-``-heavy trajectories that the judge lets through as "isolated, recoverable". ## What was cleaned **Trajectory-level DROP (47)** | rule | threshold | dropped | why | |---|---|---|---| | short-think heavy | > 20% of assistant turns have `` < 20 chars ("Poll." / "Continue." / "Next.") | 35 | th3k has 0.2% such turns vs our 5.9%; trajectories dominated by them teach "don't reason" | | form A heavy | > 25% of steps are foreground-blocking waits whose observation is byte-identical to the previous one | 1 | pure spin-wait on a 20-min `gmx mdrun` run in the foreground | | form C heavy | > 10% of steps are `commands: []` without `task_complete` (no duration, harness returns a stale screen) | 14 | protocol misuse; th3k has 3 such turns in total | (3 trajectories hit two rules; dropped 27 score-0 / 20 score-1.) **Turn-level collapse (118 trajectories, 306 (action, observation) pairs removed, 0.14% of turns)** - form A runs: a sequence of (wait, identical observation) pairs keeps only its first pair; the following pair (whose observation finally changed) is kept, so the chain reads `wait → still running → wait → finished → act` instead of 17× `wait → "2>&1"`. 164 runs, 275 pairs. - form C runs (≥ 3 consecutive `commands: []`): keep first and last pair. 13 runs, 31 pairs. - Alternation user/assistant is preserved; the task prompt and compaction handoffs are never touched. Verified on the two worst cases before the full run (see takeaway §3.7); re-scan after the build: form-A identical-observation turns 0.54% → 0.36%, poll-heavy trajectories 35 → 22, `commands: []` 501 → 258 turns, short-think 5.88% → 5.43% (the remaining ones are isolated, in-context appropriate short reasoning). ## Statistics | | value | |---|---| | trajectories | **2,494** (1,231 solved, 49.4%) | | envs | 1,340 (1,154 with both samples) | | source | th14 2,320 / redo14 131 / thredopol 43 | | chars p50 / p90 / max | 468k / 1,098k / 1,879k (1.42 GB total) | | est. tokens (2.1 chars/tok) p50 / p90 / max | 223k / 523k / 895k; total ~675M | | messages p50 / p90 / max | 134 / 362 / 1,010 | | assistant turns | 223,704 | | assistant-side mojibake / unparseable JSON / tool-markup leak | 0 / 0 / 0 | ## Files | file | content | |---|---| | `dsv41_final.jsonl` / `.manifest.jsonl` | the dataset (line-aligned; manifest adds `record_id`, `collapsed_pairs`) | | `dsv41_final-solved.jsonl` / `.manifest.jsonl` | score == 1 subset | | `drops.tsv` | 47 dropped trajectories with rule + value | | `collapse.tsv` | per-trajectory collapse accounting | | `build_stats.json` | counts + thresholds | | `scan_bad_actions.txt` | post-build bad-action scan | Next step: `coding_sft/prep/prep_and_sched.py --src dsv41_final.jsonl ...` (segment at compaction boundaries, `--bad-pair mask`, strip trailing `` in the plan field).