@chrono-meta/fh-gate 3.39.1 → 3.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/.claude/regression/probes_live.yaml +9 -2
  2. package/.claude-plugin/marketplace.json +4 -4
  3. package/CLAUDE.md +2 -2
  4. package/README.ja.md +20 -18
  5. package/README.zh.md +20 -18
  6. package/knowledge/shared/harness-core/claude_md_full_reference.md +8 -1
  7. package/knowledge/shared/harness-core/dispatch_conditional_prohibition.md +9 -0
  8. package/knowledge/shared/harness-core/fh_module_contract.md +55 -1
  9. package/knowledge/shared/harness-core/lease_record_channel.md +26 -2
  10. package/knowledge/shared/harness-core/onboarding_acceleration_autopilot.md +7 -0
  11. package/knowledge/shared/learnings/subagent_invocations_log.yaml +36 -0
  12. package/knowledge/shared/rules/operations.md +1 -0
  13. package/package.json +14 -1
  14. package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
  15. package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
  16. package/plugins/fh-meta/CHANGELOG.md +52 -0
  17. package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
  18. package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
  19. package/scripts/adapters/gstack_content_safety.sh +2 -2
  20. package/scripts/adapters/mate_agent_boundary.sh +2 -2
  21. package/scripts/adapters/qasp_new_code_anchor.sh +2 -2
  22. package/scripts/adapters/qasp_web_rules.sh +2 -2
  23. package/scripts/agent_tools_pin.txt +16 -0
  24. package/scripts/catch_tally.py +216 -0
  25. package/scripts/claim_precision_report.py +138 -0
  26. package/scripts/fh_module_check.py +182 -1
  27. package/scripts/fh_session_load.sh +3 -1
  28. package/scripts/fixture_guard_lib.sh +38 -0
  29. package/scripts/generated_harness_check.py +4 -0
  30. package/scripts/lane_identity_tripwire.sh +35 -0
  31. package/scripts/package_coverage_check.sh +6 -2
  32. package/scripts/post_squash_verify.sh +53 -1
  33. package/scripts/pr_merge_verified.sh +57 -1
  34. package/scripts/probe_live_eval.sh +61 -0
  35. package/scripts/probe_live_eval_lib.py +47 -4
  36. package/scripts/selfcheck.sh +17 -0
  37. package/scripts/selfdev_merge_tier.sh +153 -0
  38. package/scripts/session_checklist.py +38 -1
  39. package/scripts/session_close_check.sh +79 -1
  40. package/scripts/shell_name_boundary_scan.sh +11 -3
  41. package/scripts/sim_isolated_run.sh +62 -1
  42. package/scripts/test_adapter_lanes.sh +3 -3
  43. package/scripts/test_agent_tools_pin_lanes.sh +73 -0
  44. package/scripts/test_catch_tally_lanes.sh +10 -0
  45. package/scripts/test_claim_precision_report_lanes.sh +77 -0
  46. package/scripts/test_doc_claims_1113_lanes.sh +36 -0
  47. package/scripts/test_fh_module_check_lanes.sh +106 -1
  48. package/scripts/test_fh_run_resolver_lanes.sh +1 -1
  49. package/scripts/test_fixture_git_env_lanes.sh +87 -0
  50. package/scripts/test_generated_harness_check_lanes.sh +8 -0
  51. package/scripts/test_lane_gap_hint_lanes.sh +2 -2
  52. package/scripts/test_locale_invariance_lanes.sh +3 -3
  53. package/scripts/test_name_boundary_locale_lanes.sh +66 -0
  54. package/scripts/test_package_coverage_lanes.sh +10 -0
  55. package/scripts/test_post_squash_verify_lanes.sh +23 -2
  56. package/scripts/test_pr_merge_verified_lanes.sh +62 -3
  57. package/scripts/test_probe_live_eval_lanes.sh +160 -5
  58. package/scripts/test_selfdev_merge_tier_lanes.sh +128 -0
  59. package/scripts/test_session_checklist_lanes.sh +57 -0
  60. package/scripts/test_session_close_chain_lanes.sh +93 -0
  61. package/scripts/test_session_close_lanes.sh +11 -0
  62. package/scripts/test_sim_isolated_run_lanes.sh +67 -0
  63. package/scripts/test_temper_check_lanes.sh +1 -1
  64. package/scripts/test_verdict_watermark_lanes.sh +1 -1
  65. package/templates/harness_birth_core.md +57 -0
@@ -71,11 +71,12 @@ done
71
71
  [ "$_tf" -eq 0 ] && ok "trivial ② (: · true · ' true ; ' · exit 0 · '' · /usr/bin/true) → rc=3 each"
72
72
 
73
73
  # failing ② on a byte-correct merge → rc=1
74
- run "$T/ok" "$TIP_OK" --rerun 'grep -q NOPE a'
74
+ run "$T/ok" "$TIP_OK" --rerun 'grep -q NOPE a && echo found'
75
75
  [ "$RC" -eq 1 ] && ok "failing ② on a byte-correct squash → rc=1" || { bad "failing ② rc=$RC"; printf '%s\n' "$OUT" | tail -4; }
76
76
 
77
77
  # silent ② (rc=0, no output) → rc=4, never a pass
78
- run "$T/ok" "$TIP_OK" --rerun 'grep -q a2 a'
78
+ # (wrapped in bash -c: a bare `grep -q` is now refused before running — X12; the guard must still catch what X12 cannot see)
79
+ run "$T/ok" "$TIP_OK" --rerun 'bash -c "grep -q a2 a"'
79
80
  [ "$RC" -eq 4 ] && ok "silent ② (rc=0, empty output) → rc=4" || { bad "silent ② rc=$RC"; printf '%s\n' "$OUT" | tail -4; }
80
81
 
81
82
  # COMBINED: main also changed a (different line region) after the branch was cut → not DIFFERS
@@ -179,5 +180,25 @@ _p2=$(bash "$SC" --precheck --rerun 'grep -q x y; echo z' >/dev/null 2>&1; echo
179
180
  _p3=$(bash "$SC" --precheck >/dev/null 2>&1; echo $?)
180
181
  [ "$_p1$_p2$_p3" = "302" ] && ok "X11 --precheck: trivial=3 · real=0 · missing=2" || bad "X11 --precheck got $_p1/$_p2/$_p3 (want 3/0/2)"
181
182
 
183
+ # X12 a ② that is statically silent on success is refused BEFORE merging (rc=3). Origin: the 7 merges in the
184
+ # receipts that ended verify-incomplete (2026-11-09) — content intact, ② a quiet check, the rc=4 silence
185
+ # guard fired only after the merge. Shapes below are those real --rerun strings, reduced. Pass side: a
186
+ # quiet check that also says what passed, and commands that print, must stay accepted.
187
+ _x12=0
188
+ for q in 'grep -q x y' 'bash a.sh --help >/dev/null 2>&1; grep -q "A pass" b.md' 'git show HEAD:f | grep -qx L' \
189
+ 'grep -qF "curl -sL \"u\"" s.md' 'python3 -c "import yaml;yaml.safe_load(open(\"l.yaml\"))"' \
190
+ 'git check-ignore -q f' 'test -f a && [ -s a ]' 'cmp -s a b'; do
191
+ _r=$(bash "$SC" --precheck --rerun "$q" >/dev/null 2>&1; echo $?)
192
+ [ "$_r" = 3 ] || { bad "X12 quiet ② '$q' → rc=$_r (want 3)"; _x12=1; }
193
+ done
194
+ for p in 'grep -q x y && echo ok' 'pytest -q t' 'bash scripts/x.sh' 'python3 -c "import yaml;print(1)"' \
195
+ 'git grep -e x' 'grep -c x y' 'make t >/dev/null 2>&1; echo done' 'cat a 2>/dev/null' 'bash -c true' \
196
+ 'cat a 3>/dev/null' 'cat a >/dev/null 1>&2' "printf '%s\\n' -q | grep -- -q" "python3 -c 'import os; os.write(1,b\"ok\")'" \
197
+ "grep -q '\"' a; echo \"ok\"" "grep -q x a & echo done" 'cat a >&2 | test -d /tmp'; do # last 7 = cross-family R1 over-refusals
198
+ _r=$(bash "$SC" --precheck --rerun "$p" >/dev/null 2>&1; echo $?)
199
+ [ "$_r" = 0 ] || { bad "X12 printing ② '$p' → rc=$_r (want 0)"; _x12=1; }
200
+ done
201
+ [ "$_x12" -eq 0 ] && ok "X12 quiet ② refused before merge (8 shapes → 3) · printing ② accepted (16 shapes → 0)"
202
+
182
203
  printf 'PASS %d · FAIL %d\n' "$PASS" "$FAIL"
183
204
  [ "$FAIL" -eq 0 ]
@@ -24,7 +24,19 @@ setup() {
24
24
  # SETUP_EXTRA=1: a tracked dir whose listing names `a`, and a runner whose text names `a` — the shapes a glob/dir word can drag in
25
25
  [ -n "${SETUP_EXTRA:-}" ] && { mkdir -p "$d/seed/d"; printf 'x\n' > "$d/seed/d/a"; printf 'grep -q a2 a\n' > "$d/seed/r.sh"; }
26
26
  git -C "$d/seed" add -A; git -C "$d/seed" commit -qm init --no-verify; git -C "$d/seed" push -q origin HEAD:main
27
- git -C "$d/seed" switch -qc feat; printf 'a2\n' > "$d/seed/a"; printf 'b2\n' > "$d/seed/b"
27
+ # SETUP_DOCS=1: the PR changes only docs/x.md (a change the merge tier allows); main carries it at x1
28
+ # SETUP_SKILL=1: the PR rewords one skill line (no verdict words) — the tier must READ its diff to say AUTO
29
+ if [ -n "${SETUP_SKILL:-}" ]; then
30
+ mkdir -p "$d/seed/plugins/p/skills/s"; printf 'Plain text one.\n' > "$d/seed/plugins/p/skills/s/SKILL.md"; git -C "$d/seed" add plugins
31
+ git -C "$d/seed" commit -qm skill --no-verify; git -C "$d/seed" push -q origin HEAD:main
32
+ git -C "$d/seed" switch -qc feat; printf 'Plain text two.\n' > "$d/seed/plugins/p/skills/s/SKILL.md"
33
+ elif [ -n "${SETUP_DOCS:-}" ]; then
34
+ mkdir -p "$d/seed/docs"; printf 'x1\n' > "$d/seed/docs/x.md"; git -C "$d/seed" add docs/x.md
35
+ git -C "$d/seed" commit -qm docs --no-verify; git -C "$d/seed" push -q origin HEAD:main
36
+ git -C "$d/seed" switch -qc feat; printf 'x2\n' > "$d/seed/docs/x.md"
37
+ else
38
+ git -C "$d/seed" switch -qc feat; printf 'a2\n' > "$d/seed/a"; printf 'b2\n' > "$d/seed/b"
39
+ fi
28
40
  git -C "$d/seed" commit -qam feat --no-verify; git -C "$d/seed" push -q origin feat
29
41
  git clone -q "$d/origin.git" "$d/work" 2>/dev/null; git -C "$d/work" fetch -q origin feat
30
42
  printf '%s' "$(git -C "$d/seed" rev-parse feat)" > "$d/head.oid"
@@ -38,6 +50,7 @@ D="$D"
38
50
  case "\$1 \$2" in
39
51
  "pr view")
40
52
  [ -f "\$D/view_fail" ] && exit 1
53
+ case "\$*" in *--json\ files*) cat "\$D/files.tsv"; exit 0 ;; esac
41
54
  [ -f "\$D/view_fail_after_merge" ] && [ -s "\$D/merge.log" ] && exit 1
42
55
  case "\$*" in
43
56
  *state,headRefOid*)
@@ -81,6 +94,7 @@ GOOD='grep -q a2 a && grep -q b2 b && echo instrument-ok'
81
94
  printf '── pr_merge_verified ──\n'
82
95
 
83
96
  setup ok; mkgh "$T/ok"; run "$T/ok" 7 --rerun "$GOOD"
97
+ OK_OUT="$OUT"
84
98
  { [ "$RC" -eq 0 ] && printf '%s' "$OUT" | grep -q 'merged and verified'; } \
85
99
  && ok "L1 merge + verify → rc=0" || { bad "L1 happy path rc=$RC"; printf '%s\n' "$OUT" | tail -6; }
86
100
 
@@ -156,13 +170,51 @@ setup st; mkgh "$T/st"; : > "$T/st/local_fail"; : > "$T/st/stuck"; run "$T/st" 7
156
170
 
157
171
  # ── merge receipt: actor + lease (frontier digest 2026-10-23, arXiv:2610.28683) ──
158
172
  # L17 an agent session merging under a named lease → one receipt line naming both, with the merge commit and outcome
159
- setup rl; mkgh "$T/rl"; OUT=$(cd "$T/rl/work" && CLAUDECODE=1 PATH="$T/rl/bin:$PATH" PMV_RETRY_SLEEP=0 PMV_RECEIPTS="$T/rl/receipts.jsonl" bash "$SC" 7 --rerun "$GOOD" --lease "night-2026-10-22" 2>&1); RC=$?
160
- { [ "$RC" -eq 0 ] && [ "$(rcpt "$T/rl" actor)" = "agent-session:claude-code" ] && [ "$(rcpt "$T/rl" lease)" = "night-2026-10-22" ] \
173
+ setup rl; mkgh "$T/rl"; OUT=$(cd "$T/rl/work" && CLAUDECODE=1 PATH="$T/rl/bin:$PATH" PMV_RETRY_SLEEP=0 PMV_RECEIPTS="$T/rl/receipts.jsonl" bash "$SC" 7 --rerun "$GOOD" --lease "operator «night-2026-10-22»" 2>&1); RC=$?
174
+ RL_OUT="$OUT"
175
+ { [ "$RC" -eq 0 ] && [ "$(rcpt "$T/rl" actor)" = "agent-session:claude-code" ] && [ "$(rcpt "$T/rl" lease)" = "operator «night-2026-10-22»" ] \
161
176
  && [ "$(rcpt "$T/rl" outcome)" = "verified" ] && [ "$(rcpt "$T/rl" merge)" = "$(cat "$T/rl/merge.oid")" ] && [ "$(wc -l < "$T/rl/receipts.jsonl")" -eq 1 ]; } \
162
177
  && ok "L17 agent merge under a lease → receipt: actor agent-session · lease · verified · merge oid" || { bad "L17 rc=$RC receipt=$(cat "$T/rl/receipts.jsonl" 2>/dev/null)"; printf '%s\n' "$OUT" | tail -3; }
163
178
  # L18 control: no lease, no agent marker → actor human-or-unknown, lease NONE (recorded, not refused)
164
179
  { [ "$(rcpt "$T/ok" actor)" = "human-or-unknown" ] && [ "$(rcpt "$T/ok" lease)" = "NONE" ]; } \
165
180
  && ok "L18 no lease, no agent marker → human-or-unknown · NONE (merge still allowed)" || bad "L18 receipt=$(cat "$T/ok/receipts.jsonl" 2>/dev/null)"
181
+ # L18b/L18c (AQ-20261109-5) lease=NONE is said before the merge; a named lease is not warned about
182
+ { [ "$(rcpt "$T/ok" lease)" = "NONE" ] && printf '%s' "$OK_OUT" | grep -qF 'no --lease: the receipt will record lease=NONE'; } \
183
+ && ok "L18b no lease → warning line before the merge (the merge still runs)" || bad "L18b warning missing: $(printf '%s' "$OK_OUT" | head -5)"
184
+ printf '%s' "$RL_OUT" | grep -qF 'no --lease' && bad "L18c named lease still warned" || ok "L18c --lease given → no NONE warning"
185
+ # ── a lease is checked by the merge tier unless it is the operator's answer for this PR (AQ-20261109-4: #1063 was
186
+ # TIER=HOLD and merged «under the lease»). The tier reads the recorded head through local git, not the live PR.
187
+ GOODX='grep -q x2 docs/x.md && echo instrument-ok'
188
+ # S1 a standing lease + a docs-only PR (tier AUTO) → merged, and it says it asked
189
+ SETUP_DOCS=1 setup sa; mkgh "$T/sa"; run "$T/sa" 7 --rerun "$GOODX" --lease 'selfdev standing 2026-11-04'
190
+ { [ "$RC" -eq 0 ] && merged "$T/sa" && printf '%s' "$OUT" | grep -qF 'says TIER=AUTO'; } && ok "S1 standing lease + tier AUTO → merged" || { bad "S1 rc=$RC"; printf '%s\n' "$OUT" | tail -4; }
191
+ # S2 a standing lease + a PR the tier holds (root files a, b) → rc 7 before the merge
192
+ setup sh; mkgh "$T/sh"; run "$T/sh" 7 --rerun "$GOOD" --lease 'selfdev standing 2026-11-04'
193
+ { [ "$RC" -eq 7 ] && ! merged "$T/sh" && printf '%s' "$OUT" | grep -qF 'TIER=HOLD'; } && ok "S2 standing lease + tier HOLD → rc 7, nothing merged" || { bad "S2 rc=$RC merged=$(merged "$T/sh" && echo yes || echo no)"; printf '%s\n' "$OUT" | tail -4; }
194
+ # S3 spellings a substring list missed (codex R1): upper case · self-dev · session lease → all checked, all refused
195
+ for _l in 'STANDING' 'self-dev lease' 'session lease 2026-11-09'; do
196
+ setup sv; mkgh "$T/sv"; run "$T/sv" 7 --rerun "$GOOD" --lease "$_l"
197
+ { [ "$RC" -eq 7 ] && ! merged "$T/sv"; } && ok "S3 lease «${_l}» → tier checked, rc 7" || bad "S3 lease «${_l}» rc=$RC"
198
+ rm -rf "$T/sv"
199
+ done
200
+ # S4 control: the operator's answer for this PR is not checked — even when it mentions selfdev (codex R1 #4)
201
+ setup so; mkgh "$T/so"; run "$T/so" 7 --rerun "$GOOD" --lease 'Operator: «merge this selfdev fix» 2026-11-09'
202
+ { [ "$RC" -eq 0 ] && merged "$T/so" && ! printf '%s' "$OUT" | grep -qF 'TIER='; } && ok "S4 operator lease → tier not consulted, merged" || { bad "S4 rc=$RC"; printf '%s\n' "$OUT" | tail -4; }
203
+ # S6 codex R2: «--lease none» typed by hand is a label, not the default → checked, refused on a HOLD change
204
+ setup sn; mkgh "$T/sn"; run "$T/sn" 7 --rerun "$GOOD" --lease 'none'
205
+ { [ "$RC" -eq 7 ] && ! merged "$T/sn"; } && ok "S6 «--lease none» → tier checked, rc 7" || bad "S6 rc=$RC"
206
+ # S7 codex R2: the caller's git config cannot change what the tier sees (noprefix · color · relative · ignoreSubmodules)
207
+ for _d in s7a s7h; do
208
+ if [ "$_d" = s7a ]; then SETUP_SKILL=1 setup "$_d"; else setup "$_d"; fi; mkgh "$T/$_d"
209
+ for _c in 'diff.noprefix true' 'color.diff always' 'color.ui always' 'diff.relative true' 'diff.ignoreSubmodules all'; do git -C "$T/$_d/work" config $_c; done
210
+ done
211
+ run "$T/s7a" 7 --rerun 'grep -q "text two" plugins/p/skills/s/SKILL.md && echo instrument-ok' --lease 'selfdev standing 2026-11-04'
212
+ { [ "$RC" -eq 0 ] && merged "$T/s7a"; } && ok "S7a hostile git config + plain skill edit (diff is read) → tier still AUTO, merged" || { bad "S7a rc=$RC"; printf '%s\n' "$OUT" | tail -4; }
213
+ run "$T/s7h" 7 --rerun "$GOOD" --lease 'selfdev standing 2026-11-04'
214
+ { [ "$RC" -eq 7 ] && ! merged "$T/s7h"; } && ok "S7h hostile git config + held PR → still rc 7" || bad "S7h rc=$RC"
215
+ # S5 the tier judges the RECORDED head: a live PR whose file list says docs-only cannot launder a head that changes a, b
216
+ setup sl; mkgh "$T/sl"; printf 'MODIFIED\tdocs/x.md\t1\t1\n' > "$T/sl/files.tsv"; run "$T/sl" 7 --rerun "$GOOD" --lease 'selfdev standing 2026-11-04'
217
+ { [ "$RC" -eq 7 ] && ! merged "$T/sl"; } && ok "S5 tier reads the recorded head, not the live file list → rc 7" || bad "S5 rc=$RC"
166
218
  # L19 negative control — a refusal BEFORE the merge, or a merge GitHub did not take, leaves no receipt. It cannot detect the feature
167
219
  # being removed on its own (codex R1); L17 · L18 · L21 are its positive pair.
168
220
  { [ ! -s "$T/nore/receipts.jsonl" ] && [ ! -s "$T/triv/receipts.jsonl" ] && [ ! -s "$T/mf/receipts.jsonl" ]; } \
@@ -235,5 +287,12 @@ setup eh; mkgh "$T/eh"; run "$T/eh" 7 --rerun "$GOOD" --expect-head 000000000000
235
287
  setup eh2; mkgh "$T/eh2"; run "$T/eh2" 7 --rerun "$GOOD" --expect-head "$(cat "$T/eh2/head.oid")"
236
288
  { [ "$RC" -eq 0 ] && merged "$T/eh2"; } && ok "L32b --expect-head matching → merged and verified" || { bad "L32b rc=$RC"; printf '%s\n' "$OUT" | tail -3; }
237
289
 
290
+ # L33 header honesty (2026-11-13, Area B S1): the RECEIPT note must not say the lease is «not enforced» —
291
+ # --lease has gated the merge through the tier (rc 7) since 3.40.0, and the EXIT block says so.
292
+ if [ ! -f "$SC" ]; then bad "L33 subject missing: $SC"
293
+ elif grep -q 'recorded, not enforced' "$SC"; then bad "L33 header still says the lease is «recorded, not enforced»"
294
+ elif ! grep -q '^#.*lease (.*TIER=AUTO, see EXIT 7)' "$SC"; then bad "L33 RECEIPT lease note no longer points at the TIER=AUTO / EXIT 7 enforcement"
295
+ else ok "L33 header does not contradict EXIT 7 (lease is enforced)"; fi
296
+
238
297
  printf 'PASS %d · FAIL %d\n' "$PASS" "$FAIL"
239
298
  [ "$FAIL" -eq 0 ]
@@ -740,21 +740,30 @@ open(os.path.join(base, 'control_r1.txt'), 'w').write('weather')
740
740
  for arm in ('primary', 'control'):
741
741
  if sys.argv[2] == 'MISSING':
742
742
  continue
743
- if sys.argv[2] == 'PARTIAL' and arm == 'primary':
743
+ if sys.argv[2] in ('PARTIAL', 'WALLNOMETA') and arm == 'primary':
744
744
  continue # transcript present, meta absent: ran but unmeasured
745
745
  end = sys.argv[2] if arm == 'primary' else 'no'
746
+ wall = ''
747
+ if sys.argv[2] == 'WALL':
748
+ end, wall = 'no', 'wall_s\t%d\n' % (3 if arm == 'primary' else 7)
749
+ if sys.argv[2] == 'WALLNOMETA':
750
+ end, wall = 'no', 'wall_s\t4\n'
751
+ if sys.argv[2] == 'WALLBAD':
752
+ end, wall = 'no', ('wall_s\t\u00b2\n' if arm == 'primary' else 'wall_s\t6\n')
753
+ if sys.argv[2] == 'WALLHALF':
754
+ end, wall = 'no', ('wall_s\t5\n' if arm == 'primary' else 'wall_s\t\n')
746
755
  open(os.path.join(base, arm + '_r1.meta.tsv'), 'w').write(
747
- 'rc\t0\ntimeout_s\t900\nmax_turns\tunset\ntoken_cap\tunset\nended_at_cap\t%s\n' % end)
756
+ 'rc\t0\ntimeout_s\t900\nmax_turns\tunset\ntoken_cap\tunset\nended_at_cap\t%s\n%s' % (end, wall))
748
757
  r = score_run([{'id': 'G-X', 'polarity': 'present', 'expect_re': 'ZZZ'}], root, ['G-X'], 0.8, 'sonnet')['rows'][0]
749
758
  print('%s|%s|%s' % (r['verdict'], r['ended_at_cap'], r['budget']))
750
759
  PY
751
760
  }
752
761
  r="$(_budget yes)"
753
762
  _lane BU1 budget "KNOWN-POSITIVE — a FAIL whose primary episode ended at the cap says so" \
754
- "FAIL|yes|timeout=900s max_turns=unset tokens=unset ended_at_cap=yes (1/2 episodes)" "$r"
763
+ "FAIL|yes|timeout=900s max_turns=unset tokens=unset ended_at_cap=yes (1/2 episodes) wall_s=UNMEASURED tokens_used=UNMEASURED" "$r"
755
764
  r="$(_budget no)"
756
765
  _lane BU2 budget "KNOWN-NEGATIVE — a FAIL that ended on its own says ended_at_cap=no" \
757
- "FAIL|no|timeout=900s max_turns=unset tokens=unset ended_at_cap=no" "$r"
766
+ "FAIL|no|timeout=900s max_turns=unset tokens=unset ended_at_cap=no wall_s=UNMEASURED tokens_used=UNMEASURED" "$r"
758
767
  r="$(_budget MISSING)"
759
768
  _lane BU3 budget "no meta recorded -> UNKNOWN (not measured is not no)" \
760
769
  "FAIL|UNKNOWN|no episode meta (cap not recorded)" "$r"
@@ -762,7 +771,21 @@ _lane BU3 budget "no meta recorded -> UNKNOWN (not measured is not no)" \
762
771
  # episode's `no` stand for the row — before the fix this printed `...|no|...`.
763
772
  r="$(_budget PARTIAL)"
764
773
  _lane BU5 budget "partial meta (transcript without meta) -> UNKNOWN, not the other episode's no" \
765
- "FAIL|UNKNOWN|timeout=900s max_turns=unset tokens=unset ended_at_cap=UNKNOWN" "$r"
774
+ "FAIL|UNKNOWN|timeout=900s max_turns=unset tokens=unset ended_at_cap=UNKNOWN wall_s=UNMEASURED tokens_used=UNMEASURED" "$r"
775
+
776
+ # BU6/BU7 cost axis (2026-11-12): wall seconds sit next to the verdict, never in it; tokens stay UNMEASURED.
777
+ r="$(_budget WALL)"
778
+ _lane BU6 budget "KNOWN-POSITIVE — wall_s recorded in both episodes -> range, verdict unchanged" \
779
+ "FAIL|no|timeout=900s max_turns=unset tokens=unset ended_at_cap=no wall_s=3..7 tokens_used=UNMEASURED" "$r"
780
+ r="$(_budget WALLHALF)"
781
+ _lane BU7 budget "one episode's wall_s empty -> counted as unmeasured, not as 0" \
782
+ "FAIL|no|timeout=900s max_turns=unset tokens=unset ended_at_cap=no wall_s=5..5 (1/2 episodes unmeasured) tokens_used=UNMEASURED" "$r"
783
+ r="$(_budget WALLNOMETA)"
784
+ _lane BU8 budget "transcript without meta next to a measured episode -> range flagged partial (codex R1 A)" \
785
+ "FAIL|UNKNOWN|timeout=900s max_turns=unset tokens=unset ended_at_cap=UNKNOWN wall_s=4..4 (1/2 episodes unmeasured) tokens_used=UNMEASURED" "$r"
786
+ r="$(_budget WALLBAD)"
787
+ _lane BU9 budget "non-ASCII digit wall_s does not crash scoring; counted unmeasured (codex R1 A)" \
788
+ "FAIL|no|timeout=900s max_turns=unset tokens=unset ended_at_cap=no wall_s=6..6 (1/2 episodes unmeasured) tokens_used=UNMEASURED" "$r"
766
789
 
767
790
  # BU4/TG*: end to end through the runner with a stub sim that writes the meta the real runner writes.
768
791
  if [ "$NOPROBES" -eq 1 ]; then _skipblock "budget/target runner lanes BU4 TG3-TG5 (need probes.md)"; else
@@ -783,6 +806,77 @@ chmod +x "$BSTUB/fake_sim_budget.sh"
783
806
  _lane BU4 budget "runner -> report row carries 'ended_at_cap=yes' when the stub hit its cap" \
784
807
  "yes" "$(grep -E '^\| G-GREET-01 ' "$T/bud_report.md" | grep -q 'ended_at_cap=yes' && echo yes || echo no)"
785
808
 
809
+ # SF1-SF3 state fingerprint (2026-11-11): one line per rep, appended after the verdict, never scored.
810
+ # SF1 the budget stub writes no treediff → the line says MISSING (not measured ≠ 0).
811
+ _lane SF1 state-fp "stub without treediff: report carries 'treediff=MISSING' for both arms" "2" \
812
+ "$(grep -cE '^state-fingerprint: G-GREET-01 (primary|control) r1 treediff=MISSING$' "$T/bud_report.md")"
813
+ # SF2 a stub that writes a treediff + the changed file → changed=1 with a hash; a second run with
814
+ # different file bytes but the SAME porcelain line gets a different hash (state, not output).
815
+ cat > "$BSTUB/fake_sim_state.sh" <<'FAKESTATE'
816
+ #!/usr/bin/env bash
817
+ arm=""; out=""
818
+ while [ $# -gt 0 ]; do case "$1" in --arm) arm="$2"; shift 2 ;; --out) out="$2"; shift 2 ;; *) shift ;; esac; done
819
+ mkdir -p "$out/w_${arm}_r1/repo"
820
+ printf 'stub body %s\n' "$arm" > "$out/${arm}_r1.txt"
821
+ printf 'rc\t0\ntimeout_s\t900\nmax_turns\tunset\ntoken_cap\tunset\nended_at_cap\tno\n' > "$out/${arm}_r1.meta.tsv"
822
+ case "${FH_STATE_STUB_KIND:-file}" in
823
+ file) printf '?? note.txt\n' > "$out/${arm}_r1.treediff.txt"
824
+ printf '%s\n' "${FH_STATE_STUB_BYTES:-a}" > "$out/w_${arm}_r1/repo/note.txt" ;;
825
+ dir) printf '?? newdir/\n' > "$out/${arm}_r1.treediff.txt"; mkdir -p "$out/w_${arm}_r1/repo/newdir"
826
+ printf '%s\n' "${FH_STATE_STUB_BYTES:-a}" > "$out/w_${arm}_r1/repo/newdir/f.txt" ;;
827
+ quoted) printf '?? "a b.txt"\n' > "$out/${arm}_r1.treediff.txt"
828
+ printf '%s\n' "${FH_STATE_STUB_BYTES:-a}" > "$out/w_${arm}_r1/repo/a b.txt" ;;
829
+ unread) printf '?? note.txt\n' > "$out/${arm}_r1.treediff.txt"; chmod 000 "$out/${arm}_r1.treediff.txt" ;;
830
+ rename) printf 'R old.txt -> new.txt\n' > "$out/${arm}_r1.treediff.txt"
831
+ printf '%s\n' "${FH_STATE_STUB_BYTES:-a}" > "$out/w_${arm}_r1/repo/new.txt" ;;
832
+ lockedfile) printf ' M secret.txt\n' > "$out/${arm}_r1.treediff.txt"
833
+ printf 'x\n' > "$out/w_${arm}_r1/repo/secret.txt"; chmod 000 "$out/w_${arm}_r1/repo/secret.txt" ;;
834
+ esac
835
+ echo "RESULT: CLEAN"; exit 0
836
+ FAKESTATE
837
+ chmod +x "$BSTUB/fake_sim_state.sh"
838
+ for v in a b; do
839
+ ( cd "$REPO_ROOT" && FH_SIM_RUNNER_BIN="$BSTUB/fake_sim_state.sh" FH_STATE_STUB_BYTES="$v" \
840
+ bash "$RUNNER" --ids "G-GREET-01" --no-evidence --report-out "$T/sf_$v.md" ) >"$T/sf_$v.log" 2>&1
841
+ done
842
+ sf_a="$(grep -E '^state-fingerprint: G-GREET-01 primary r1 changed=1 unhashed=0 sha256=[0-9a-f]{16}$' "$T/sf_a.md")"
843
+ sf_b="$(grep -E '^state-fingerprint: G-GREET-01 primary r1 changed=1 unhashed=0 sha256=[0-9a-f]{16}$' "$T/sf_b.md")"
844
+ _lane SF2 state-fp "treediff present: changed=1 + hash; same porcelain, different bytes → different hash" "yes" \
845
+ "$([ -n "$sf_a" ] && [ -n "$sf_b" ] && [ "$sf_a" != "$sf_b" ] && echo yes || echo no)"
846
+ # Codex R1 (2026-11-11): SF4 a changed DIRECTORY is hashed over its files (different bytes → different hash)
847
+ for v in a b; do
848
+ ( cd "$REPO_ROOT" && FH_SIM_RUNNER_BIN="$BSTUB/fake_sim_state.sh" FH_STATE_STUB_KIND=dir FH_STATE_STUB_BYTES="$v" \
849
+ bash "$RUNNER" --ids "G-GREET-01" --no-evidence --report-out "$T/sfd_$v.md" ) >"$T/sfd_$v.log" 2>&1
850
+ done
851
+ _lane SF4 state-fp "untracked directory: content change moves the hash" "yes" \
852
+ "$(a=$(grep '^state-fingerprint: G-GREET-01 primary r1 changed=1 ' "$T/sfd_a.md"); b=$(grep '^state-fingerprint: G-GREET-01 primary r1 changed=1 ' "$T/sfd_b.md"); [ -n "$a" ] && [ "$a" != "$b" ] && echo yes || echo no)"
853
+ # SF5 a git-quoted path is named as unhashed, never silently folded into «same hash»
854
+ ( cd "$REPO_ROOT" && FH_SIM_RUNNER_BIN="$BSTUB/fake_sim_state.sh" FH_STATE_STUB_KIND=quoted \
855
+ bash "$RUNNER" --ids "G-GREET-01" --no-evidence --report-out "$T/sfq.md" ) >"$T/sfq.log" 2>&1
856
+ _lane SF5 state-fp "quoted porcelain path → unhashed=1 on the line" "1" \
857
+ "$(grep -cE '^state-fingerprint: G-GREET-01 primary r1 changed=1 unhashed=1 ' "$T/sfq.md")"
858
+ # SF6 an unreadable treediff says UNREADABLE, not changed=0 (skipped as root: root reads mode 000)
859
+ if [ "$(id -u)" = 0 ]; then _skipblock "SF6 (root reads mode-000 files)"; else
860
+ ( cd "$REPO_ROOT" && FH_SIM_RUNNER_BIN="$BSTUB/fake_sim_state.sh" FH_STATE_STUB_KIND=unread \
861
+ bash "$RUNNER" --ids "G-GREET-01" --no-evidence --report-out "$T/sfu.md" ) >"$T/sfu.log" 2>&1
862
+ _lane SF6 state-fp "unreadable treediff → treediff=UNREADABLE" "1" \
863
+ "$(grep -cE '^state-fingerprint: G-GREET-01 primary r1 treediff=UNREADABLE$' "$T/sfu.md")"
864
+ chmod -R u+rwx "$T" 2>/dev/null
865
+ fi
866
+ # Codex R2: SF7 rename record and SF8 unreadable listed file → counted as unhashed
867
+ ( cd "$REPO_ROOT" && FH_SIM_RUNNER_BIN="$BSTUB/fake_sim_state.sh" FH_STATE_STUB_KIND=rename \
868
+ bash "$RUNNER" --ids "G-GREET-01" --no-evidence --report-out "$T/sfr.md" ) >"$T/sfr.log" 2>&1
869
+ _lane SF7 state-fp "rename record → unhashed=1" "1" "$(grep -cE '^state-fingerprint: G-GREET-01 primary r1 changed=1 unhashed=1 ' "$T/sfr.md")"
870
+ if [ "$(id -u)" != 0 ]; then
871
+ ( cd "$REPO_ROOT" && FH_SIM_RUNNER_BIN="$BSTUB/fake_sim_state.sh" FH_STATE_STUB_KIND=lockedfile \
872
+ bash "$RUNNER" --ids "G-GREET-01" --no-evidence --report-out "$T/sfl.md" ) >"$T/sfl.log" 2>&1
873
+ _lane SF8 state-fp "unreadable listed file → unhashed=1" "1" "$(grep -cE '^state-fingerprint: G-GREET-01 primary r1 changed=1 unhashed=1 ' "$T/sfl.md")"
874
+ chmod -R u+rwx "$T" 2>/dev/null
875
+ fi
876
+ # SF3 the fingerprint never moves a verdict: the G-GREET-01 report row is byte-identical across a/b.
877
+ _lane SF3 state-fp "verdict row identical across runs whose end states differ" "yes" \
878
+ "$([ -n "$(grep -E '^\| G-GREET-01 ' "$T/sf_a.md")" ] && [ "$(grep -E '^\| G-GREET-01 ' "$T/sf_a.md")" = "$(grep -E '^\| G-GREET-01 ' "$T/sf_b.md")" ] && echo yes || echo no)"
879
+
786
880
  # TG3 default output unchanged: no --target -> no split section anywhere.
787
881
  _lane TG3 target "default (no --target): report has no 'Target split' section" \
788
882
  "no" "$(grep -q 'Target split' "$T/bud_report.md" && echo yes || echo no)"
@@ -906,6 +1000,67 @@ PY
906
1000
  )"
907
1001
  _lane IF4 instrument "KNOWN-NEGATIVE — stub sim runner is fingerprinted as sim_runner(override)" "override" "$r"
908
1002
 
1003
+ # ── run-rc: a rep the runner says did not finish (meta rc != 0) is FAILED-TO-RUN (2026-11-11) ──────
1004
+ # Real defect: a usage-limit reply is NON-EMPTY text, so the empty-text check let it through and it
1005
+ # was scored FAIL. Measured: 2026-11-10 model-arms run, Opus G-MAP-01 r1-r3 = 6 limit replies scored
1006
+ # FAIL 0/3; nightly 2026-10-27 had 75 such files. In every one of those 156 files the runner's
1007
+ # meta.tsv said rc=1, and in all 2,142 normal replies it said rc=0 — so the discriminator is the
1008
+ # runner's own exit code, never the reply text. Fixture texts below are byte-copied from those runs.
1009
+ # 🟥 RC4/RC5 are the opposite-direction controls: an rc=0 reply that merely CONTAINS limit wording is
1010
+ # still scored normally (a real FAIL stays FAIL), and a run with no meta.tsv is not re-guessed.
1011
+ _rc_run() { # $1=reps, then per rep "<kind>:<primary rc>:<control rc>"; kind P pass | F fail | L limit | M mixed | Q pass+limit words; rc '-' = no meta
1012
+ local reps="$1"; shift
1013
+ python3 - "$REPO_ROOT" "$reps" "$@" <<'PY'
1014
+ import sys, os, tempfile
1015
+ sys.path.insert(0, os.path.join(sys.argv[1], 'scripts'))
1016
+ from probe_live_eval_lib import score_run
1017
+ LIMIT = "You've hit your 5-hour limit · resets 11:30pm (Asia/Seoul)\n"
1018
+ LIMIT_S = "You've hit your session limit · resets 3:20am (Asia/Seoul)\n"
1019
+ reps = int(sys.argv[2]); specs = sys.argv[3:]
1020
+ root = tempfile.mkdtemp(); base = os.path.join(root, 'G-X'); os.makedirs(base)
1021
+ for i, spec in enumerate(specs, start=1):
1022
+ kind, prc, crc = spec.split(':')
1023
+ prim = {'P': '\U0001f43f️ hi', 'F': 'nothing here', 'L': LIMIT, 'S': LIMIT_S,
1024
+ 'M': 'Not mapped. ' + LIMIT, 'Q': '\U0001f43f️ hi. ' + LIMIT}[kind]
1025
+ ctrl = {'L': LIMIT, 'S': LIMIT_S}.get(kind, 'weather')
1026
+ for arm, text, rc in (('primary', prim, prc), ('control', ctrl, crc)):
1027
+ open(os.path.join(base, '%s_r%d.txt' % (arm, i)), 'w', encoding='utf-8').write(text)
1028
+ if rc != '-':
1029
+ open(os.path.join(base, '%s_r%d.meta.tsv' % (arm, i)), 'w').write('sim_model\tx\nrc\t%s\n' % rc)
1030
+ row = score_run([{'id': 'G-X', 'polarity': 'present', 'expect_re': '\U0001f43f️'}],
1031
+ root, ['G-X'], 0.8, 'sonnet', reps=reps)['rows'][0]
1032
+ print('%s %s|%s' % (row['verdict'], row.get('reps'), row.get('reason', '')))
1033
+ PY
1034
+ }
1035
+ r="$(_rc_run 3 L:1:1 L:1:1 L:1:1)"
1036
+ _lane RC1 run-rc "3 limit replies (rc=1, real text) -> FAILED-TO-RUN, not FAIL 0/3" "FAILED-TO-RUN 0/0" "${r%%|*}"
1037
+ case "${r#*|}" in *"rc=1"*"limit"*) rr=named ;; *) rr="unnamed:${r#*|}" ;; esac
1038
+ _lane RC1b run-rc "reason names the runner rc and the reply's first line" "named" "$rr"
1039
+ r="$(python3 - "$REPO_ROOT" <<'PY'
1040
+ import sys, os, tempfile
1041
+ sys.path.insert(0, os.path.join(sys.argv[1], 'scripts'))
1042
+ from probe_live_eval_lib import _failure_reason
1043
+ b = tempfile.mkdtemp()
1044
+ open(os.path.join(b, 'primary_r1.txt'), 'w').write('')
1045
+ open(os.path.join(b, 'primary_r1.meta.tsv'), 'w').write('rc\t127\n')
1046
+ open(os.path.join(b, 'primary_r1.stderr.txt'), 'w').write('claude: command not found\n')
1047
+ print(_failure_reason(b, 'primary'))
1048
+ PY
1049
+ )"
1050
+ _lane RC1c run-rc "rc!=0 with EMPTY reply keeps the stderr diagnostic (codex R1)" "claude: command not found" "$r"
1051
+ r="$(_rc_run 3 P:0:0 P:0:0 L:1:1)"
1052
+ _lane RC2 run-rc "a limit rep leaves the denominator: 2 pass + 1 limit -> PASS 2/2" "PASS 2/2" "${r%%|*}"
1053
+ r="$(_rc_run 3 P:0:1 P:0:0 P:0:0)"
1054
+ _lane RC3 run-rc "control arm alone rc!=0 -> that rep did not run (PASS 2/2)" "PASS 2/2" "${r%%|*}"
1055
+ r="$(_rc_run 3 M:0:0 M:0:0 M:0:0)"
1056
+ _lane RC4 run-rc "KNOWN-NEGATIVE — rc=0 reply with limit wording and no rule hit stays FAIL" "FAIL 0/3" "${r%%|*}"
1057
+ r="$(_rc_run 3 Q:0:0 Q:0:0 Q:0:0)"
1058
+ _lane RC4b run-rc "KNOWN-NEGATIVE — rc=0 reply with limit wording and a rule hit stays PASS" "PASS 3/3" "${r%%|*}"
1059
+ r="$(_rc_run 3 L:-:- L:-:- L:-:-)"
1060
+ _lane RC5 run-rc "no meta.tsv (older run) -> text is not re-guessed; scored as before (FAIL)" "FAIL 0/3" "${r%%|*}"
1061
+ r="$(_rc_run 3 S:1:1 S:1:1 S:1:1)"
1062
+ _lane RC6 run-rc "nightly 'session limit' variant (rc=1) -> FAILED-TO-RUN" "FAILED-TO-RUN 0/0" "${r%%|*}"
1063
+
909
1064
  echo ""
910
1065
  echo "── summary ──────────────────────────────────────────────────────"
911
1066
  echo "lanes: $N failed: $([ "$FAIL" -eq 0 ] && echo 0 || echo '>=1')"
@@ -0,0 +1,128 @@
1
+ #!/usr/bin/env bash
2
+ # test_selfdev_merge_tier_lanes.sh — known-pair lanes for scripts/selfdev_merge_tier.sh.
3
+ # Each lane writes a changed-file list and asserts the TIER line AND the rc (the two must agree).
4
+ # T1/T2 are the pair the classifier exists for: an allowed doc → AUTO, a hook → HOLD.
5
+ # 🟥 Rows are fed with < <(...), never `printf | lane`: a pipe runs lane() in a subshell and the
6
+ # pass/fail counters vanish — measured on the first run: 13 ✅ printed, «1 passed» counted, so a
7
+ # failing lane would have exited 0. The total check at the end re-checks the counter itself.
8
+ # T3 is the empty-set trap (all() over nothing is true) — it must be HARNESS-ERROR, never AUTO.
9
+ set -u
10
+ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
11
+ TIER="$HERE/selfdev_merge_tier.sh"
12
+ [ -f "$TIER" ] || { echo "HARNESS-ERROR: $TIER missing"; exit 2; }
13
+ W="$(mktemp -d)"; trap 'rm -rf "$W"' EXIT
14
+ pass=0; fail=0
15
+ lane() { # id expected_tier expected_rc (rows on stdin, «st<TAB>path<TAB>add<TAB>del»)
16
+ local id="$1" want="$2" wrc="$3" f="$W/$1.tsv" out rc got
17
+ cat > "$f"
18
+ if [ -n "${DIFF:-}" ]; then out="$(PATH="${PATHPRE:+$PATHPRE:}$PATH" SELFDEV_MAX_LINES="${MAXL:-300}" bash "$TIER" --files "$f" --diff "$DIFF" 2>&1)"; rc=$?
19
+ else out="$(SELFDEV_MAX_LINES="${MAXL:-300}" bash "$TIER" --files "$f" 2>&1)"; rc=$?; fi
20
+ got="$(printf '%s\n' "$out" | tail -1)"
21
+ if [ "$got" = "TIER=$want" ] && [ "$rc" -eq "$wrc" ]; then pass=$((pass+1)); echo " ✅ $id $got rc=$rc"
22
+ else fail=$((fail+1)); echo " ❌ $id want TIER=$want rc=$wrc · got «${got}» rc=$rc"; printf '%s\n' "$out" | sed 's/^/ /'; fi
23
+ }
24
+ T=$'\t'
25
+ lane T1-doc AUTO 0 < <(printf 'M%sdocs/USER_GUIDE.md%s4%s1\n' "$T" "$T" "$T")
26
+ lane T2-hook HOLD 3 < <(printf 'M%stemplates/.git-hooks/pre-commit%s2%s0\n' "$T" "$T" "$T")
27
+ lane T3-empty HARNESS-ERROR 2 < <(printf '')
28
+ lane T4-added-lane AUTO 0 < <(printf 'A%sscripts/test_new_lanes.sh%s40%s0\n' "$T" "$T" "$T")
29
+ lane T5-edited-lane HOLD 3 < <(printf 'M%sscripts/test_existing_lanes.sh%s3%s9\n' "$T" "$T" "$T")
30
+ lane T6-rules HOLD 3 < <(printf 'M%sknowledge/shared/rules/sync_push_protocols.md%s1%s1\n' "$T" "$T" "$T")
31
+ lane T7-gate-doc HOLD 3 < <(printf 'M%sknowledge/shared/harness-core/field_verdict_crossfamily_gate.md%s1%s0\n' "$T" "$T" "$T")
32
+ lane T8-knowledge AUTO 0 < <(printf 'M%sknowledge/shared/harness-core/builtin_capability_map.md%s2%s0\n' "$T" "$T" "$T")
33
+ lane T9-mixed HOLD 3 < <(printf 'M%sdocs/USER_GUIDE.md%s1%s0\nM%sCLAUDE.md%s1%s0\n' "$T" "$T" "$T" "$T" "$T" "$T")
34
+ MAXL=10 lane T10-oversize HOLD 3 < <(printf 'M%sdocs/a.md%s8%s5\n' "$T" "$T" "$T")
35
+ # T11 needs the skill's lines since AQ-20261109-6: a plain wording edit stays AUTO (the known negative)
36
+ SK=plugins/fh-meta/skills/frontier-digest/SKILL_detail.md
37
+ cat > "$W/plain.diff" <<'EOF_D'
38
+ diff --git a/plugins/fh-meta/skills/frontier-digest/SKILL_detail.md b/plugins/fh-meta/skills/frontier-digest/SKILL_detail.md
39
+ --- a/plugins/fh-meta/skills/frontier-digest/SKILL_detail.md
40
+ +++ b/plugins/fh-meta/skills/frontier-digest/SKILL_detail.md
41
+ @@ -10,1 +10,1 @@
42
+ -Each candidate ends with a prior-art line.
43
+ +Each candidate ends with one prior-art line naming the closest earlier work.
44
+ EOF_D
45
+ DIFF="$W/plain.diff" lane T11-skill-doc AUTO 0 < <(printf 'M%s%s%s1%s1\n' "$T" "$SK" "$T" "$T")
46
+ lane T12-bad-count HOLD 3 < <(printf 'M%sdocs/a.md%sx%s1\n' "$T" "$T" "$T")
47
+ lane T13-self HOLD 3 < <(printf 'M%sscripts/selfdev_merge_tier.sh%s1%s1\n' "$T" "$T" "$T")
48
+ # codex R1 (2026-11-04) holes — each lane is the input that used to reach AUTO
49
+ lane T14-rename HOLD 3 < <(printf 'R%sdocs/example.md%s1%s0\n' "$T" "$T" "$T")
50
+ MAXL=1000 lane T15-raise-ceiling HOLD 3 < <(printf 'M%sdocs/a.md%s301%s0\n' "$T" "$T" "$T")
51
+ MAXL=abc lane T16-nonnumeric-ceiling HARNESS-ERROR 2 < <(printf 'M%sdocs/a.md%s1%s0\n' "$T" "$T" "$T")
52
+ lane T17-overflow-count HOLD 3 < <(printf 'M%sdocs/a.md%s9223372036854775807%s1\n' "$T" "$T" "$T")
53
+ lane T18-leading-zero AUTO 0 < <(printf 'M%sdocs/a.md%s08%s09\n' "$T" "$T" "$T")
54
+ # AQ-20261109-6 (2026-11-09) — a skill's rubric is its instrument. #1063 widened a scorer and was merged as
55
+ # reversible; the same loosening written into a SKILL.md used to be AUTO here. Lines are a real rubric
56
+ # (prompt-regression Done When), edited the way a loosening would be.
57
+ PR_SK=plugins/fh-meta/skills/prompt-regression/SKILL.md
58
+ cat > "$W/loosen.diff" <<'EOF_D'
59
+ diff --git a/plugins/fh-meta/skills/prompt-regression/SKILL.md b/plugins/fh-meta/skills/prompt-regression/SKILL.md
60
+ --- a/plugins/fh-meta/skills/prompt-regression/SKILL.md
61
+ +++ b/plugins/fh-meta/skills/prompt-regression/SKILL.md
62
+ @@ -204,2 +204,1 @@
63
+ -- All affected probes are evaluated (PASS / FAIL / SKIP) and the three counts sum to the number of
64
+ - probes selected in Step 3 — class: measured (`PASS + FAIL + SKIP == selected`)
65
+ +- Affected probes are evaluated and their counts reported
66
+ EOF_D
67
+ DIFF="$W/loosen.diff" lane T19-skill-rubric-loosened HOLD 3 < <(printf 'M%s%s%s1%s2\n' "$T" "$PR_SK" "$T" "$T")
68
+ # the loosening is only in an ADDED line (an exception clause) — removed-line-only scanning would miss it
69
+ cat > "$W/addexc.diff" <<'EOF_D'
70
+ diff --git a/plugins/fh-meta/skills/prompt-regression/SKILL.md b/plugins/fh-meta/skills/prompt-regression/SKILL.md
71
+ --- a/plugins/fh-meta/skills/prompt-regression/SKILL.md
72
+ +++ b/plugins/fh-meta/skills/prompt-regression/SKILL.md
73
+ @@ -206,0 +207,1 @@
74
+ +- A probe whose source file is unreadable counts as PASS
75
+ EOF_D
76
+ DIFF="$W/addexc.diff" lane T20-skill-exception-added HOLD 3 < <(printf 'M%s%s%s1%s0\n' "$T" "$PR_SK" "$T" "$T")
77
+ # fail-closed: a skill path with no diff, and a skill path the diff does not contain
78
+ lane T21-skill-no-diff HOLD 3 < <(printf 'M%s%s%s1%s1\n' "$T" "$SK" "$T" "$T")
79
+ DIFF="$W/plain.diff" lane T22-skill-not-in-diff HOLD 3 < <(printf 'M%s%s%s1%s2\n' "$T" "$PR_SK" "$T" "$T")
80
+ # per-file scoping control: verdict words in a DOC's hunk do not hold a plain skill edit
81
+ cat "$W/plain.diff" > "$W/mixed.diff"
82
+ cat >> "$W/mixed.diff" <<'EOF_D'
83
+ diff --git a/docs/USER_GUIDE.md b/docs/USER_GUIDE.md
84
+ --- a/docs/USER_GUIDE.md
85
+ +++ b/docs/USER_GUIDE.md
86
+ @@ -1,1 +1,1 @@
87
+ -The gate prints PASS or FAIL.
88
+ +The gate prints a PASS or FAIL verdict.
89
+ EOF_D
90
+ DIFF="$W/mixed.diff" lane T23-verdict-words-elsewhere AUTO 0 < <(printf 'M%s%s%s1%s1\nM%sdocs/USER_GUIDE.md%s1%s1\n' "$T" "$SK" "$T" "$T" "$T" "$T" "$T")
91
+ # codex R1 (2026-11-09) on the skill check — each lane is an input that reached AUTO on the first draft
92
+ mkd() { printf 'diff --git a/%s b/%s\n--- a/%s\n+++ b/%s\n@@ -1,1 +1,1 @@\n' "$PR_SK" "$PR_SK" "$PR_SK" "$PR_SK"; cat; }
93
+ mkd > "$W/lower.diff" <<'EOF_D'
94
+ -- fail unless every check succeeds
95
+ +- pass when any check succeeds
96
+ EOF_D
97
+ DIFF="$W/lower.diff" lane T24-skill-lowercase-rubric HOLD 3 < <(printf 'M%s%s%s1%s1\n' "$T" "$PR_SK" "$T" "$T")
98
+ # content lines that look like file headers inside a hunk («-- x» removed → «--- x») are content, not headers
99
+ mkd > "$W/hdrlike.diff" <<'EOF_D'
100
+ --- FAIL unless all checks succeed
101
+ +++ PASS even when the source is unreadable
102
+ +Plain prose about the skill.
103
+ EOF_D
104
+ DIFF="$W/hdrlike.diff" lane T25-skill-header-like-content HOLD 3 < <(printf 'M%s%s%s2%s1\n' "$T" "$PR_SK" "$T" "$T")
105
+ # …and the known negative of the same fix: header-like PLAIN content is counted and read, so it stays AUTO
106
+ # (with headers skipped anywhere, these two lines vanish and the count check holds it — T25 alone could not show that)
107
+ mkd > "$W/hdrplain.diff" <<'EOF_D'
108
+ --- a dash list item
109
+ +++ a plus list item
110
+ EOF_D
111
+ DIFF="$W/hdrplain.diff" lane T28-skill-header-like-plain AUTO 0 < <(printf 'M%s%s%s1%s1\n' "$T" "$PR_SK" "$T" "$T")
112
+ # a diff that shows fewer changed lines than the file list counts is not the change
113
+ DIFF="$W/plain.diff" lane T26-skill-truncated-diff HOLD 3 < <(printf 'M%s%s%s1%s2\n' "$T" "$SK" "$T" "$T")
114
+ # grep failing (rc 2) is HOLD, not «no vocabulary»
115
+ # the fake fails only the vocabulary grep (-E…q); `grep -c` passes through, so the count check is not what holds it
116
+ REALGREP="$(command -v grep)"
117
+ mkdir -p "$W/badgrep"; printf '#!/bin/sh\ncase "$1" in -c) exec %s "$@" ;; esac\nexit 2\n' "$REALGREP" > "$W/badgrep/grep"; chmod +x "$W/badgrep/grep"
118
+ PATHPRE="$W/badgrep" DIFF="$W/plain.diff" lane T27-skill-grep-fails HOLD 3 < <(printf 'M%s%s%s1%s1\n' "$T" "$SK" "$T" "$T")
119
+ # codex R2: a failing helper in the vocabulary pipe must not read as «no vocabulary» (a loosened rubric, cut that exits 2)
120
+ mkd > "$W/r2.diff" <<'EOF_D'
121
+ -PASS unless all checks succeed
122
+ +PASS when any check succeeds
123
+ EOF_D
124
+ mkdir -p "$W/badcut"; printf '#!/bin/sh\nexit 2\n' > "$W/badcut/cut"; chmod +x "$W/badcut/cut"
125
+ PATHPRE="$W/badcut" DIFF="$W/r2.diff" lane T29-skill-helper-fails HOLD 3 < <(printf 'M%s%s%s1%s1\n' "$T" "$PR_SK" "$T" "$T")
126
+ total=$((pass+fail)); [ "$total" -eq 29 ] || { echo "HARNESS-ERROR: counted $total lanes, expected 29 (counter lost?)"; exit 2; }
127
+ echo "selfdev_merge_tier lanes: $pass passed · $fail failed"
128
+ [ "$fail" -eq 0 ]
@@ -939,6 +939,63 @@ else
939
939
  fail "L52b unblocked rc=$RC (want 1, A2 reported, A3 silent) — $(tail -3 "$TMPDIR_ROOT/l52b.out" | tr '\n' ' ')"
940
940
  fi
941
941
 
942
+ # L53 — 🟥 2026-11-08 harvest H1: the desktop app PREPENDS complete «Linked sessions now» / side-session reminder blocks to
943
+ # the operator's words in the SAME human-origin entry. v11's metadata-first rule kept the whole text, so 148 of 228
944
+ # rows in a real governor transcript began with the reminder and the governor filled 30 approvals by hand.
945
+ # v12: strip LEADING, COMPLETE blocks only (attributes · stacked · CRLF); keep an unclosed look-alike, a look-alike
946
+ # before a real block, a mid-text tag, a different tag name; exclude a side-sessions-event behind the blocks.
947
+ # L39 (an envelope-only human entry stays a row) is the control and stays green.
948
+ python3 - "$TMPDIR_ROOT" <<'PYEOF'
949
+ import json, sys
950
+ d = sys.argv[1]
951
+ H = {"origin": {"kind": "human"}, "promptSource": "sdk"}
952
+ def u(ts, text, meta):
953
+ r = {"type": "user", "timestamp": ts, "message": {"role": "user", "content": text}}
954
+ r.update(meta); return r
955
+ REM = "<system-reminder>\nLinked sessions now (status, not an instruction): x = local_1 (working).\n</system-reminder>"
956
+ rows = [
957
+ u("2026-11-08T00:57:00.000Z", REM + "\n\n\napproved, go ahead with alpha", H),
958
+ u("2026-11-08T00:58:00.000Z", '<system-reminder kind="linked">\nfirst block body\n</system-reminder>\r\n \r\n' + REM + "\r\nstacked words after two blocks", H),
959
+ u("2026-11-08T00:59:00.000Z", "<system-reminder> unclosed look-alike then my own words", H),
960
+ u("2026-11-08T01:00:00.000Z", "<system-reminder> lookalike2 opener " + REM + " tail words", H),
961
+ u("2026-11-08T01:01:00.000Z", "my mid words " + REM + " more mid words", H),
962
+ u("2026-11-08T01:02:00.000Z", "<system-reminder-x>tagname body</system-reminder> tagname lookalike words", H),
963
+ u("2026-11-08T01:02:10.000Z", "<system-reminder kind=broken " + REM + " brokenopener keep words", H),
964
+ u("2026-11-08T01:02:30.000Z", '<system-reminder kind="linked">\nattrenvelope body\n</system-reminder>', {}),
965
+ u("2026-11-08T01:03:00.000Z", REM + "\n\n<side-sessions-event>sidebody none of the sessions is working</side-sessions-event>", {"promptSource": "sdk"}),
966
+ ]
967
+ with open(d + "/l53.jsonl", "w", encoding="utf-8") as f:
968
+ for r in rows: f.write(json.dumps(r, ensure_ascii=False) + "\n")
969
+ # L54: the hook record holds the operator's words without the blocks — the pair must be ONE row
970
+ with open(d + "/l54_tr.jsonl", "w", encoding="utf-8") as f:
971
+ f.write(json.dumps(u("2026-11-08T01:53:00.000Z", REM + "\n\n\nplease ship the badge fix now", H)) + "\n")
972
+ with open(d + "/l54_hook.jsonl", "w", encoding="utf-8") as f:
973
+ f.write(json.dumps({"ts": "2026-11-08T01:53:00Z", "n": 1, "text": "please ship the badge fix now"}) + "\n")
974
+ PYEOF
975
+ run "$TMPDIR_ROOT/l53.out" extract --transcript "$TMPDIR_ROOT/l53.jsonl"
976
+ L53_REM=$(grep -cE '^\| [0-9]+ \| [^|]* \| <system-reminder>' "$TMPDIR_ROOT/l53.out")
977
+ if [ "$RC" -eq 0 ] && grep -q "raw 7건" "$TMPDIR_ROOT/l53.out" \
978
+ && grep -qE '^\| [0-9]+ \| [^|]* \| approved, go ahead with alpha \|' "$TMPDIR_ROOT/l53.out" \
979
+ && grep -qE '^\| [0-9]+ \| [^|]* \| stacked words after two blocks \|' "$TMPDIR_ROOT/l53.out" \
980
+ && ! grep -q "first block body" "$TMPDIR_ROOT/l53.out" \
981
+ && grep -q "unclosed look-alike then my own words" "$TMPDIR_ROOT/l53.out" \
982
+ && grep -q "lookalike2 opener" "$TMPDIR_ROOT/l53.out" \
983
+ && grep -q "my mid words .*Linked sessions now" "$TMPDIR_ROOT/l53.out" \
984
+ && grep -q "<system-reminder-x>tagname body" "$TMPDIR_ROOT/l53.out" \
985
+ && ! grep -q "sidebody" "$TMPDIR_ROOT/l53.out" && ! grep -q "attrenvelope body" "$TMPDIR_ROOT/l53.out" && grep -q "<system-reminder kind=broken <system-reminder> Linked" "$TMPDIR_ROOT/l53.out" && [ "$L53_REM" -eq 2 ]; then
986
+ pass "L53 extract: leading complete reminder blocks are stripped (single · stacked with attrs/CRLF); unclosed look-alike, look-alike before a block, mid-text tag and other tag name are kept; side-sessions-event behind the blocks is excluded"
987
+ else
988
+ fail "L53 rc=$RC reminder-rows=$L53_REM (want 2: the two exact-opener look-alike rows) (see $TMPDIR_ROOT/l53.out)"
989
+ fi
990
+ run "$TMPDIR_ROOT/l54.out" extract --transcript "$TMPDIR_ROOT/l54_tr.jsonl" --utterances "$TMPDIR_ROOT/l54_hook.jsonl"
991
+ L54_ROWS=$(grep -cE '^\| [0-9HS]+ \|' "$TMPDIR_ROOT/l54.out")
992
+ if [ "$RC" -eq 0 ] && [ "$L54_ROWS" -eq 1 ] && ! grep -qE '^\| H' "$TMPDIR_ROOT/l54.out" \
993
+ && grep -qE '^\| 1 \| [^|]* \| please ship the badge fix now \|' "$TMPDIR_ROOT/l54.out"; then
994
+ pass "L54 hook merge: a reminder-prefixed transcript row pairs with the hook's plain text — one row, no H duplicate"
995
+ else
996
+ fail "L54 rc=$RC rows=$L54_ROWS (want 1, no H) (see $TMPDIR_ROOT/l54.out)"
997
+ fi
998
+
942
999
  echo "── $PASS_COUNT passed, $FAIL_COUNT failed ──"
943
1000
 
944
1001
  if [ "$FAIL_COUNT" -gt 0 ]; then