@chrono-meta/fh-gate 3.29.0 β†’ 3.31.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 (47) hide show
  1. package/.claude-plugin/marketplace.json +4 -4
  2. package/AGENTS.md +7 -2
  3. package/CLAUDE.md +1 -1
  4. package/README.ja.md +6 -5
  5. package/README.ko.md +6 -5
  6. package/README.md +15 -5
  7. package/README.zh.md +6 -5
  8. package/docs/REFERENCE.md +6 -5
  9. package/docs/USER_GUIDE.md +3 -0
  10. package/knowledge/shared/harness-core/claude_md_gate_details.md +1 -1
  11. package/knowledge/shared/harness-core/dispatch_conditional_prohibition.md +42 -0
  12. package/knowledge/shared/harness-core/sonnet_floor_doctrine.md +7 -0
  13. package/knowledge/shared/learnings/subagent_invocations_log.yaml +161 -0
  14. package/package.json +6 -1
  15. package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
  16. package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
  17. package/plugins/fh-meta/CHANGELOG.md +35 -0
  18. package/plugins/fh-meta/skills/install-wizard/SKILL.md +25 -0
  19. package/plugins/fh-meta/skills/install-wizard/SKILL_detail.md +24 -6
  20. package/plugins/fh-meta/skills/phantom-quench/SKILL.md +1 -1
  21. package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
  22. package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
  23. package/scripts/abstract_consult_check.py +573 -0
  24. package/scripts/fh_detach.py +444 -0
  25. package/scripts/mapped_tracks.sh +20 -13
  26. package/scripts/memory_gc_report.py +55 -5
  27. package/scripts/pr_merge_verified.sh +56 -8
  28. package/scripts/selfcheck.sh +85 -6
  29. package/scripts/session_checklist.py +3 -2
  30. package/scripts/session_close_check.sh +1 -1
  31. package/scripts/sim_isolated_run.sh +62 -0
  32. package/scripts/stale_ref_scan.py +47 -3
  33. package/scripts/test_abstract_consult_check_lanes.sh +201 -0
  34. package/scripts/test_fh_detach_lanes.sh +252 -0
  35. package/scripts/test_hook_source_gate_lanes.sh +16 -2
  36. package/scripts/test_mapped_tracks_lanes.sh +55 -1
  37. package/scripts/test_memory_gc_report_lanes.sh +91 -1
  38. package/scripts/test_mutation_probe_lanes.sh +86 -10
  39. package/scripts/test_ollama_panel_lanes.sh +107 -11
  40. package/scripts/test_pr_merge_verified_lanes.sh +48 -1
  41. package/scripts/test_prepush_real_fire_lanes.sh +215 -0
  42. package/scripts/test_selfcheck_state_lanes.sh +73 -1
  43. package/scripts/test_session_checklist_lanes.sh +34 -0
  44. package/scripts/test_sim_isolated_run_lanes.sh +88 -0
  45. package/scripts/test_stale_ref_scan_lanes.sh +11 -1
  46. package/templates/.git-hooks/pre-push +82 -1
  47. package/templates/CLAUDE.md +16 -0
@@ -34,7 +34,7 @@ w fb_promote.md "$hdr
34
34
  - 2026-10-01 | same day again
35
35
  - 2026-10-05 | other day
36
36
  ---
37
- body"
37
+ body β€” fixed in 4cab596 (an evidence anchor, so this one may be promoted)"
38
38
  w fb_two_two.md "$hdr
39
39
  type: feedback
40
40
  hits:
@@ -206,5 +206,95 @@ Q="$T/q"; mkdir -p "$Q"; for f in z a; do printf -- '---\nmetadata:\n type: use
206
206
  printf -- '- [z](z.md) [a](a.md)\n' > "$Q/MEMORY.md"
207
207
  eq "L27 same-line links keep link order" "$(python3 "$HERE/memory_gc_report.py" "$Q" --json | "$PY" -c "import json,sys;print(json.load(sys.stdin)['order'])")" "['z.md', 'a.md']"
208
208
 
209
+
210
+ # πŸŸ₯ residual edges NOT chased (round cap 2, static matcher does not converge): '#123456 ' CSS colours without ';' Β· repo#N inside
211
+ # URLs counted twice (presence only, harmless) Β· sha-looking words in prose with mixed letters/digits (e.g. 'b2c3d4e') count.
212
+ # ── evidence anchors (harness2: a lesson is stored/promoted only with a cited contrast) β€” own fixture dir ──
213
+ M2="$T/m2"; mkdir -p "$M2"
214
+ w2(){ printf '%s\n' "$2" > "$M2/$1"; }
215
+ w2 fb_anchored.md "$hdr
216
+ type: feedback
217
+ hits:
218
+ - 2026-10-01 | a
219
+ - 2026-10-02 | b
220
+ - 2026-10-03 | c
221
+ ---
222
+ fixed in 4cab596 β€” measured with scripts/test_x.sh"
223
+ w2 fb_held.md "$hdr
224
+ type: feedback
225
+ hits:
226
+ - 2026-10-01 | a
227
+ - 2026-10-02 | b
228
+ - 2026-10-03 | c
229
+ ---
230
+ happened on 2026-10-03, three times (a date is not an evidence anchor)"
231
+ pos(){ w2 "$1" "$hdr
232
+ type: project
233
+ ---
234
+ $2"; }
235
+ pos a_sha.md "fixed in 4cab596"
236
+ pos a_sha_ctx.md "landed as commit 1234567"
237
+ pos a_pr.md "see #1"
238
+ pos a_repo_pr.md "see chrono-meta/forge-harness#938"
239
+ pos a_path.md "the bug was in src/main.rs"
240
+ pos a_upper.md "documented in README.MD"
241
+ pos a_docker.md "the Dockerfile pins it"
242
+ pos a_arxiv.md "per arXiv:2610.29609"
243
+ pos a_url.md "see https://example.org/x"
244
+ w2 a_hitline.md "$hdr
245
+ type: feedback
246
+ hits:
247
+ - 2026-10-01 | fixed in 4cab596
248
+ ---
249
+ the rule, stated without citing anything"
250
+ pos n_noise.md "color #fff, version 3.29, the word deadbeef, abcdefg, C# and ' are not anchors"
251
+ pos n_css.md "color: #123456;"
252
+ pos n_uuid.md "request 3f2a9c1e-8b7d-4e21-9a3b-0c5d6e7f8a9b failed"
253
+ pos n_slug.md "see [intro](#2-intro)"
254
+ pos n_wiki.md "see [[feedback_x]] for the relation"
255
+ pos n_wiki_ext.md "see [[feedback_x.md]] for the relation"
256
+ pos n_frag.md "see [step](#2)"
257
+ pos n_uuid_ctx.md "commit 1234567-dead-beef-1234-123456789abc"
258
+ pos a_arxiv_old.md "per arXiv:hep-th/9901001"
259
+ pos n_date.md "happened on 2026-10-03, three times"
260
+ w2 n_fm.md "---
261
+ name: x
262
+ description: |
263
+ quoted
264
+ ---
265
+ see https://example.org/frontmatter
266
+ metadata:
267
+ type: project
268
+ ---
269
+ plain body"
270
+ w2 MEMORY.md "# Memory Index
271
+ - [A](fb_anchored.md)
272
+ - [H](fb_held.md)
273
+ - [U](user_plain.md)
274
+ - [a1](a_sha.md)
275
+ - [a2](a_sha_ctx.md)
276
+ - [a3](a_pr.md)
277
+ - [a4](a_repo_pr.md)
278
+ - [a5](a_path.md)
279
+ - [a6](a_upper.md)
280
+ - [a7](a_docker.md)
281
+ - [a8](a_arxiv.md)
282
+ - [a9](a_url.md)
283
+ - [a10](a_hitline.md)
284
+ - [n1](n_noise.md)
285
+ - [n2](n_css.md)
286
+ - [n3](n_uuid.md)
287
+ - [n4](n_slug.md)
288
+ - [n5](n_wiki.md)
289
+ - [n6](n_date.md)
290
+ - [n7](n_fm.md)
291
+ - [n8](n_wiki_ext.md)
292
+ - [n9](n_frag.md)
293
+ - [n10](n_uuid_ctx.md)
294
+ - [a11](a_arxiv_old.md)"
295
+ q2(){ "$PY" "$HERE/memory_gc_report.py" "$M2" --today 2026-10-15 --json | "$PY" -c "import json,sys; d=json.load(sys.stdin); print($1)"; }
296
+ eq "L30 promote needs an evidence anchor; a recurring entry citing only dates is held, not promoted" "$(q2 "(d['promote'], d['promote_held'])")" "([['fb_anchored.md', 3, 3]], [['fb_held.md', 3, 3]])"
297
+ eq "L31 each anchor class counts on its own (sha Β· named sha Β· #N Β· owner/repo#N Β· path Β· upper-case ext Β· Dockerfile Β· arXiv Β· URL Β· hit line); every non-anchor stays unanchored (#fff Β· CSS Β· UUID Β· #slug Β· [[wiki]] Β· date Β· frontmatter URL)" "$(q2 "sorted(d['unanchored'])")" "['fb_held.md', 'n_css.md', 'n_date.md', 'n_fm.md', 'n_frag.md', 'n_noise.md', 'n_slug.md', 'n_uuid.md', 'n_uuid_ctx.md', 'n_wiki.md', 'n_wiki_ext.md']"
298
+ eq "L32 user entries are never listed as unanchored (and the list is not empty, so this is not vacuous)" "$(q2 "('user_plain.md' in d['unanchored'], len(d['unanchored']) > 0)")" "(False, True)"
209
299
  echo "memory_gc_report lanes: $pass pass Β· $fail fail"
210
300
  [ $fail -eq 0 ]
@@ -152,12 +152,24 @@ grep -q 'TIMEOUT L2' <<<"$out" ; chk $? "R3 a hang is reported as TIMEOUT, its
152
152
 
153
153
  echo "── S: in-place safety β€” each lane is a blocking repro from the 2026-10-07 blind review"
154
154
  bkpath() { python3 -c 'import hashlib,os,sys;print("/tmp/mutation_probe-%d/path-%s.backup"%(os.getuid(),hashlib.sha256(os.path.realpath(sys.argv[1]).encode()).hexdigest()[:16]))' "$1"; }
155
+ ibkpath() { python3 -c 'import os,sys;st=os.stat(sys.argv[1]);print("/tmp/mutation_probe-%d/inode-%d-%d.backup"%(os.getuid(),st.st_dev,st.st_ino))' "$1"; }
155
156
  sha_of() { python3 -c 'import hashlib,sys;print(hashlib.sha256(open(sys.argv[1],"rb").read()).hexdigest())' "$1"; }
156
157
  procs_matching() { # count live processes whose WHOLE cmdline is $1 β€” /proc, not pgrep (pgrep absent β†’ vacuous);
157
158
  local n=0 c # exact match, so the counter never counts itself (a substring grep did)
158
159
  for c in /proc/[0-9]*/cmdline; do [ -e "$c" ] || continue; [ "$(tr '\0' ' ' < "$c" 2>/dev/null)" = "$1 " ] && n=$((n+1)); done
159
160
  echo "$n"
160
161
  }
162
+ # The counter is exact per cmdline but its SCOPE is the whole machine: /proc is not scoped to a
163
+ # checkout, so a fixture named `sleep 4747` is a name two runs can both claim. Measured 2026-10-26:
164
+ # this suite and three others went red only under concurrent load and passed 3/3 standalone in both
165
+ # trees β€” two copies in DIFFERENT trees each counted the other's live fixtures, so N6/S7-5 ("no
166
+ # orphan is left running") saw the sibling's healthy, about-to-be-killed sleep and called it an
167
+ # orphan. Nothing was broken in the subject; the lanes were reading each other.
168
+ # The fix is to make the fixture's name unique to THIS run. A fractional suffix keeps the cmdline
169
+ # exactly matchable (`sleep 4747.12345` is one argv word) while making the token un-shareable.
170
+ # $$ is unique among live processes and $RANDOM breaks the PID-reuse case; digits only, one dot.
171
+ _PSFX="$$${RANDOM}"
172
+ TOK_N6="4747.$_PSFX"; TOK_K0="4646.$_PSFX"; TOK_S75="4848.$_PSFX"
161
173
  if [ -d /proc/self ]; then HAVE_PROC=1; else HAVE_PROC=0; fi
162
174
 
163
175
  # B4 β€” the baseline lane writes its own subject: refuse, and leave the ORIGINAL bytes
@@ -226,12 +238,12 @@ out=$(python3 "$PROBE" lat.sh lane_weak.sh 2>&1); rc=$?
226
238
  [ "$rc" -eq 2 ] && grep -q 'not UTF-8' <<<"$out" ; chk $? "N5 non-UTF-8 subject β†’ 2 with the reason (v1: traceback rc 1)"
227
239
 
228
240
  # N6 β€” no orphan keeps running a mutant after a timeout
229
- printf '. ./n1.sh\nis_adult 19 && exit 0\n( touch n6.started; exec sleep 4747 ) &\nwait\n' > lane_n6.sh
241
+ printf '. ./n1.sh\nis_adult 19 && exit 0\n( touch n6.started; exec sleep %s ) &\nwait\n' "$TOK_N6" > lane_n6.sh
230
242
  rm -f n6.started
231
243
  out=$(python3 "$PROBE" n1.sh lane_n6.sh --timeout 2 2>&1)
232
244
  sleep 0.5
233
245
  if [ "$HAVE_PROC" -eq 1 ]; then
234
- [ -e n6.started ] && grep -q 'TIMEOUT' <<<"$out" && [ "$(procs_matching 'sleep 4747')" -eq 0 ] ; chk $? "N6 the timed-out lane's grandchildren are killed with its process group (counted via /proc β€” v6 used pgrep, vacuous when absent)"
246
+ [ -e n6.started ] && grep -q 'TIMEOUT' <<<"$out" && [ "$(procs_matching "sleep $TOK_N6")" -eq 0 ] ; chk $? "N6 the timed-out lane's grandchildren are killed with its process group (counted via /proc β€” v6 used pgrep, vacuous when absent)"
235
247
  else
236
248
  echo " ⚠️ N6 UNMEASURED β€” no /proc"; UNMEASURED=$((UNMEASURED+1))
237
249
  fi
@@ -482,8 +494,23 @@ out=$(python3 "$PROBE" z16.sh lane_z16.sh --timeout 30 2>&1); rc=$?
482
494
  # Z17 β€” a closed stdout does not lose the run
483
495
  cp age.sh z17.sh; h0=$(sha_of z17.sh)
484
496
  sed 's#age\.sh#z17.sh#' lane_strong.sh > lane_z17.sh # v6 ran lane_strong here, which never sources z17.sh β€” the v7 control caught it
485
- python3 "$PROBE" z17.sh lane_z17.sh --timeout 30 2>z17.err | head -c 1 >/dev/null; rc=${PIPESTATUS[0]}; [ "$rc" -eq 0 ] || { echo " (Z17 rc=$rc)"; sed 's/^/ /' z17.err; }
486
- [ "$rc" -eq 0 ] && [ "$(sha_of z17.sh)" = "$h0" ] ; chk $? "Z17 stdout closed mid-run β†’ still rc 0 and restored (v5: BrokenPipe traceback rc 1)"
497
+ # πŸŸ₯ μ „μ œ λ¨Όμ € β€” μƒνƒœ λ””λ ‰ν„°λ¦¬λŠ” μ»¨ν…Œμ΄λ„ˆ μ „μ—­(`/tmp/mutation_probe-$uid`)이고 inode ν‚€λŠ”
498
+ # 파일이 μ§€μ›Œμ§€λ©΄ μž¬μ‚¬μš©λœλ‹€. κ·Έλž˜μ„œ **λ‹€λ₯Έ νŠΈλ¦¬κ°€ μ§€λ‚œμ£Όμ— 남긴 λ°±μ—…**이 이번 ν”½μŠ€μ²˜μ˜
499
+ # inode 와 같은 이름일 수 있고, 그러면 ν”„λ‘œλΈŒλŠ” (옳게) rc=2 Β«CANNOT JUDGEΒ» 둜 κ±°μ ˆν•œλ‹€.
500
+ # μ΄ˆνŒμ€ κ·Έ rc=2 λ₯Ό `❌ Z17 stdout closed mid-run` 으둜 μ°μ—ˆλ‹€ β€” 즉 **μ•ˆ μž¬μ–΄μ§„ 것을
501
+ # γ€Œμ΄ λ™μž‘μ΄ κΉ¨μ‘Œλ‹€γ€λ‘œ κ±°μ§“ 진단**ν–ˆλ‹€. 2026-10-19 클린룸 감사 μ‹€μΈ‘: μ»¨ν…Œμ΄λ„ˆ μž¬μ‚¬μš© 4회차,
502
+ # 10-12 자 λ°±μ—… inode-65024-1941405 이 10-19 의 z17 ν”½μŠ€μ²˜μ™€ 같은 μ΄λ¦„μ΄μ—ˆλ‹€.
503
+ # β‡’ μ‹€ν–‰ **전에** 두 ν‚€(pathΒ·inode)λ₯Ό 보고, 이미 있으면 UNMEASURED 둜 μ„Όλ‹€(톡과 μ•„λ‹˜ β€”
504
+ # μŠ€μœ„νŠΈλŠ” κ·Έλž˜λ„ exit 1 이닀). λ©”μ‹œμ§€ λ¬Έμžμ—΄μ„ grep ν•˜μ§€ μ•Šκ³  기둝의 쑴재만 λ³Έλ‹€.
505
+ _z17stale=""
506
+ for _b in "$(bkpath z17.sh)" "$(ibkpath z17.sh)"; do [ -e "$_b" ] && _z17stale="$_b"; done
507
+ if [ -n "$_z17stale" ]; then
508
+ echo " ⚠️ Z17 UNMEASURED β€” μ „μ—­ μƒνƒœ 디렉터리에 λ‚¨μ˜ 백업이 λ¨Όμ € μžˆλ‹€: $_z17stale (inode μž¬μ‚¬μš©). λΉ„μš°κ³  λ‹€μ‹œ 돌렀라"
509
+ UNMEASURED=$((UNMEASURED+1))
510
+ else
511
+ python3 "$PROBE" z17.sh lane_z17.sh --timeout 30 2>z17.err | head -c 1 >/dev/null; rc=${PIPESTATUS[0]}; [ "$rc" -eq 0 ] || { echo " (Z17 rc=$rc)"; sed 's/^/ /' z17.err; }
512
+ [ "$rc" -eq 0 ] && [ "$(sha_of z17.sh)" = "$h0" ] ; chk $? "Z17 stdout closed mid-run β†’ still rc 0 and restored (v5: BrokenPipe traceback rc 1)"
513
+ fi
487
514
  # Z18 β€” --json through a hard link to the subject
488
515
  cp age.sh z18.sh; ln -f z18.sh z18.json; h0=$(sha_of z18.sh)
489
516
  out=$(python3 "$PROBE" z18.sh lane_weak.sh --timeout 30 --json z18.json 2>&1); rc=$?
@@ -538,8 +565,16 @@ out=$(python3 "$PROBE" z28.sh --list 2>&1)
538
565
  ! grep -qF '==' <<<"$out" && grep -qF '[=β†’!=]' <<<"$out" ; chk $? "Z28 #!/bin/sh: '!=' is not flipped to the non-POSIX '==' (= β†’ != still is)"
539
566
 
540
567
  if [ "$HAVE_PROC" -eq 1 ]; then # the process counter itself, on a known pair, before any lane trusts it
541
- sleep 4646 & kp=$!; sleep 0.1; k1=$(procs_matching 'sleep 4646'); kill "$kp"; wait "$kp" 2>/dev/null; k0=$(procs_matching 'sleep 4646')
568
+ sleep "$TOK_K0" & kp=$!; sleep 0.1; k1=$(procs_matching "sleep $TOK_K0"); kill "$kp"; wait "$kp" 2>/dev/null; k0=$(procs_matching "sleep $TOK_K0")
542
569
  [ "$k1" -eq 1 ] && [ "$k0" -eq 0 ] ; chk $? "K0 the /proc process counter sees a live sleep (1) and not a dead one (0) β€” and not itself"
570
+ # K1 (2026-10-26) β€” the token must be unique to this run, not merely exact. Known pair against a
571
+ # live FOREIGN process carrying the old shared name: the thing a concurrent sibling used to be.
572
+ sleep 4747 & kf=$!; sleep 0.1
573
+ [ "$(procs_matching 'sleep 4747')" -ge 1 ] ; chk $? "K1a known-POSITIVE: the OLD shared token does count a foreign process (the collision was real)"
574
+ [ "$(procs_matching "sleep $TOK_N6")" -eq 0 ] ; chk $? "K1b known-NEGATIVE: this run's unique token does not count it β€” N6/S7-5 cannot read a sibling's fixtures"
575
+ kill "$kf" 2>/dev/null; wait "$kf" 2>/dev/null
576
+ # And the three tokens must differ from each other, or one lane's fixture answers another's count.
577
+ [ "$TOK_N6" != "$TOK_K0" ] && [ "$TOK_K0" != "$TOK_S75" ] && [ "$TOK_N6" != "$TOK_S75" ] ; chk $? "K1c the three fixture tokens are distinct within a run"
543
578
  fi
544
579
  echo "── S7: v7 safety contract β€” each lane red on v6 (2026-10-08, from the v6 capture-recapture detectors)"
545
580
 
@@ -576,10 +611,10 @@ out=$(python3 "$PROBE" s74.sh lane_s74.sh --timeout 30 2>&1); rc=$?
576
611
  # S7-5 β€” a setsid escapee is killed (Linux subreaper); unmeasurable without /proc β†’ UNMEASURED, never PASS
577
612
  if [ "$HAVE_PROC" -eq 1 ] && command -v setsid >/dev/null 2>&1; then
578
613
  cp age.sh s75.sh; rm -f s75.started
579
- printf '. ./s75.sh\nsetsid sh -c "touch s75.started; exec sleep 4848" </dev/null >/dev/null 2>&1 &\nsleep 0.3\nis_adult 20 || exit 1\nis_adult 19 || exit 1\nexit 0\n' > lane_s75.sh
614
+ printf '. ./s75.sh\nsetsid sh -c "touch s75.started; exec sleep %s" </dev/null >/dev/null 2>&1 &\nsleep 0.3\nis_adult 20 || exit 1\nis_adult 19 || exit 1\nexit 0\n' "$TOK_S75" > lane_s75.sh
580
615
  out=$(python3 "$PROBE" s75.sh lane_s75.sh --timeout 30 2>&1)
581
616
  sleep 0.3
582
- [ -e s75.started ] && grep -qE 'mutants=1 ' <<<"$out" && [ "$(procs_matching 'sleep 4848')" -eq 0 ] ; chk $? "S7-5 a setsid descendant of the lane does not outlive the probe (v6: it kept running with the mutant)"
617
+ [ -e s75.started ] && grep -qE 'mutants=1 ' <<<"$out" && [ "$(procs_matching "sleep $TOK_S75")" -eq 0 ] ; chk $? "S7-5 a setsid descendant of the lane does not outlive the probe (v6: it kept running with the mutant)"
583
618
  else
584
619
  echo " ⚠️ S7-5 UNMEASURED β€” no /proc or no setsid"; UNMEASURED=$((UNMEASURED+1))
585
620
  fi
@@ -663,13 +698,32 @@ for k in $(seq 2 12000); do printf '[ "$a" -eq %d ] && echo x%d\n' "$k" "$k"; do
663
698
  printf 'grep -q "exit 113" r71.sh && exit 1\nexit 0\n' > lane_r71.sh
664
699
  cp r71.orig r71.sh
665
700
  _ms(){ python3 -c 'import time; print(int(time.time() * 1000))'; } # BSD date has no %N
666
- c71=$(_ms); h71=""
701
+ c71=$(_ms); h71=""; _c71out=""
667
702
  while IFS= read -r l; do
703
+ _c71out="$_c71out$l
704
+ "
668
705
  case "$l" in subject:*) [ -n "$h71" ] || h71=$(( $(_ms) - c71 )) ;; esac
669
706
  done < <(python3 "$PROBE" r71.sh lane_r71.sh --max 1 --timeout 30 2>&1)
670
707
  cmp -s r71.sh r71.orig || cp r71.orig r71.sh
671
- # no header = the calibration run never reached the lock: the delay is unknown, so the lane fails below
672
- # (d71 stays 0 β†’ the restore lands before the read β†’ no refusal) rather than guessing a number.
708
+ # no header = the calibration run never reached the lock: the delay is unknown.
709
+ # πŸŸ₯ 2026-10-26: that used to be ONE outcome β€” the lane ran anyway with d71=0 and went red. Measured
710
+ # here, the common cause is not a defect in the probe at all: the probe's state directory
711
+ # /tmp/mutation_probe-$uid is MACHINE-GLOBAL and its inode key is (st_dev, st_ino), so a fixture this
712
+ # suite creates fresh can land on an inode whose backup an EARLIER run left behind (the suite's own
713
+ # kill/timeout lanes leave backups by design β€” 26 of them after one round of runs in this container).
714
+ # The probe then answers `CANNOT JUDGE: a previous run left a backup …` BEFORE printing the header,
715
+ # the calibration is unknown, and this lane called that a FAILURE. It is not: it is UNMEASURED, which
716
+ # is neither a pass nor a fail, and the suite already has that counter. Any OTHER reason for a
717
+ # missing header still falls through to the old behaviour β€” the point is a typed verdict, not a
718
+ # looser one. The aliasing itself lives in scripts/mutation_probe.py (the subject, and the recovery
719
+ # path for a subject's original bytes) and is a NAMED RESIDUAL here, not something a lane may patch.
720
+ if [ -z "$h71" ] && grep -q 'a previous run left a backup' <<<"$_c71out"; then
721
+ echo " ⚠️ R7-1 UNMEASURED β€” the probe refused the calibration run: a previous run's backup is still in"
722
+ echo " the machine-global state dir and its inode key aliases this fixture. Not a pass, not a failure."
723
+ printf ' %s\n' "$(grep -m1 'a previous run left a backup' <<<"$_c71out")"
724
+ echo " Inspect those backups, restore anything real by hand, remove them, then re-run."
725
+ UNMEASURED=$((UNMEASURED+1))
726
+ else
673
727
  [ -n "$h71" ] || echo " ⚠️ R7-1 calibration: no Β«subject:Β» header β€” time-to-lock unknown on this machine"
674
728
  d71=$(awk -v ms="${h71:-0}" 'BEGIN { printf "%.3f", ms / 2000 }')
675
729
  sed '2s/-ne 1/-eq 1/' r71.orig > r71.sh # the other probe's mutant is live
@@ -677,6 +731,28 @@ python3 "$PROBE" r71.sh lane_r71.sh --max 1 --timeout 30 > r71.out 2>&1 & pb=$!
677
731
  sleep "$d71"; cat r71.orig > r71.sh # … and now it restores (same inode)
678
732
  wait "$pb"; rc=$?
679
733
  grep -q 'changed between reading it and locking it' r71.out && [ "$rc" -eq 2 ] && cmp -s r71.sh r71.orig && [ ! -e "$(bkpath r71.sh)" ] ; chk $? "R7-1 a subject that changed between read and lock β†’ 2, the original stays (fbfe773: the stale mutant was backed up as Β«originalΒ» and written back)"
734
+ fi
735
+
736
+ # R7-1b (2026-10-26) β€” the known pair for the UNMEASURED arm above. The claim it rests on is that a
737
+ # leftover backup under either key makes the probe refuse BEFORE it prints its header; if that is not
738
+ # true, the arm above is an excuse rather than a verdict. Measured both ways on a throwaway subject,
739
+ # and the planted file is removed in the same lane (it is a 52-byte fixture, not anyone's recovery data).
740
+ cp age.sh r71b.sh
741
+ _r71b_bk="$(ibkpath r71b.sh)"
742
+ mkdir -p "$(dirname "$_r71b_bk")" 2>/dev/null
743
+ if [ -e "$_r71b_bk" ]; then
744
+ echo " ⚠️ R7-1b UNMEASURED β€” a backup is already at $_r71b_bk; this lane will not touch someone else's"
745
+ UNMEASURED=$((UNMEASURED+1))
746
+ else
747
+ cp age.sh "$_r71b_bk"
748
+ out=$(python3 "$PROBE" r71b.sh lane_weak.sh --max 1 --timeout 30 2>&1); rc=$?
749
+ [ "$rc" -eq 2 ] && grep -q 'a previous run left a backup' <<<"$out" && ! grep -q '^subject:' <<<"$out"
750
+ chk $? "R7-1b known-POSITIVE: a leftover backup at the INODE key makes the probe refuse before its header (so a missing header is UNMEASURED, not a lane failure)"
751
+ rm -f "$_r71b_bk"
752
+ out=$(python3 "$PROBE" r71b.sh lane_weak.sh --max 1 --timeout 30 2>&1); rc=$?
753
+ grep -q '^subject:' <<<"$out"
754
+ chk $? "R7-1b known-NEGATIVE: with the leftover gone, the same subject reaches the header (the refusal was the backup, not the subject)"
755
+ fi
680
756
  cp r71.orig r71.sh
681
757
 
682
758
  # R7-2 β€” the lane hard-links an unrelated file to the subject's path: that file is never written
@@ -19,7 +19,27 @@ set -u
19
19
  ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
20
20
  CAL="$ROOT/scripts/sidecar_calibrate.sh"
21
21
  pass=0; fail=0
22
- PORT="${FH_LANE_PORT:-18011}"
22
+ # PORT β€” asked of the OS, not hardcoded (2026-10-26). It was `${FH_LANE_PORT:-18011}`, and 18011
23
+ # is machine-global: a TCP port is not scoped to a checkout. Two copies of this suite running in
24
+ # DIFFERENT trees on one machine both try to bind it; the loser's stub dies with "Address already in
25
+ # use", every lane in the losing run then talks to the WINNER's stub, and the verdicts come back as
26
+ # an unreproducible mix that reads exactly like a flake β€” measured 2026-10-26, when this suite and
27
+ # three others only ever went red under concurrent load and passed 3/3 standalone in both trees.
28
+ # The lesson generalizes past this file: a fixture keyed on a machine-global name (a port, a
29
+ # /proc-wide process pattern, a fixed /tmp path) is not hermetic however hermetic its logic is.
30
+ # FH_LANE_PORT still wins when set β€” an operator pinning a port has a reason, and overriding them
31
+ # would trade one surprise for another.
32
+ _free_port() { # a port the OS says is free right now: bind :0, read it back, release it
33
+ python3 -c 'import socket
34
+ s=socket.socket(); s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
35
+ s.bind(("127.0.0.1", 0)); print(s.getsockname()[1]); s.close()'
36
+ }
37
+ # A released ephemeral port can be taken in the window before the stub binds it β€” rare, and the
38
+ # honest answer to rare is a retry that NAMES itself, not a lane failure that looks like a defect
39
+ # in the subject. start_stub re-picks on each attempt when the port was not pinned.
40
+ PORT="${FH_LANE_PORT:-}"
41
+ [ -n "$PORT" ] || PORT="$(_free_port)"
42
+ PORT_PINNED=0; [ -n "${FH_LANE_PORT:-}" ] && PORT_PINNED=1
23
43
  SRV_PID=""
24
44
 
25
45
  # `wait` after the kill, so bash reaps the child quietly instead of printing "Terminated: 15" into
@@ -97,15 +117,24 @@ HTTPServer(("127.0.0.1", PORT), H).serve_forever()
97
117
  PY
98
118
  # shellcheck disable=SC2016
99
119
  start_stub() {
100
- stop_stub
101
- python3 "$STUB" "$PORT" "$1" >/dev/null 2>&1 &
102
- SRV_PID=$!
103
- for _ in $(seq 1 40); do
104
- # Ready = ANY HTTP answer, not a 2xx: the notollama mode answers /api/version with a 404 on
105
- # purpose, and `-f` would read that as "stub never came up".
106
- _c="$(curl -s -o /dev/null --max-time 1 -w '%{http_code}' "http://127.0.0.1:$PORT/api/version" 2>/dev/null)"
107
- [ "${_c:-000}" != "000" ] && return 0
108
- sleep 0.25
120
+ local _try
121
+ for _try in 1 2 3; do
122
+ stop_stub
123
+ [ "$_try" -eq 1 ] || [ "$PORT_PINNED" -eq 1 ] || PORT="$(_free_port)"
124
+ python3 "$STUB" "$PORT" "$1" >/dev/null 2>&1 &
125
+ SRV_PID=$!
126
+ for _ in $(seq 1 40); do
127
+ # Ready = ANY HTTP answer, not a 2xx: the notollama mode answers /api/version with a 404 on
128
+ # purpose, and `-f` would read that as "stub never came up".
129
+ _c="$(curl -s -o /dev/null --max-time 1 -w '%{http_code}' "http://127.0.0.1:$PORT/api/version" 2>/dev/null)"
130
+ [ "${_c:-000}" != "000" ] && return 0
131
+ # The stub process being GONE is a different fact from "not ready yet", and waiting out the
132
+ # remaining 10 s on a dead process is how a bind collision used to present as a timeout.
133
+ kill -0 "$SRV_PID" 2>/dev/null || break
134
+ sleep 0.25
135
+ done
136
+ [ "$PORT_PINNED" -eq 1 ] && break
137
+ echo " ⚠️ stub did not come up on port $PORT (attempt $_try/3) β€” re-picking a free port" >&2
109
138
  done
110
139
  return 1
111
140
  }
@@ -163,13 +192,80 @@ MODELS=" stub-model:1b , " \
163
192
  expect "S14 padding around commas is trimmed" ok YES "PIN-OK(envelope)" "INPUT-ERROR"
164
193
 
165
194
  # S6 β€” absence must be MEASURED, never assumed. No server at the host at all.
166
- out=$( FH_OLLAMA_HOST="http://127.0.0.1:$((PORT+7))" bash "$CAL" --only ollama --quiet 2>&1 )
195
+ # The dead host used to be `$((PORT+7))`, which is arithmetic on an assumption: PORT+7 is free
196
+ # because nobody is expected to be there. On a busy machine somebody is, and then this lane asserts
197
+ # ABSENT against a host that answers and goes red for a reason that has nothing to do with the
198
+ # subject. Ask the OS for a port and then CHECK it is silent β€” the lane's own premise, measured.
199
+ _dead_port=""
200
+ for _ in 1 2 3; do
201
+ _p="$(_free_port)"
202
+ [ "$(curl -s -o /dev/null --max-time 1 -w '%{http_code}' "http://127.0.0.1:$_p/api/version" 2>/dev/null)" = "000" ] \
203
+ && { _dead_port="$_p"; break; }
204
+ done
205
+ if [ -z "$_dead_port" ]; then
206
+ # UNMEASURED, not a pass and not a failure of the subject: three ports in a row answered, so this
207
+ # lane never got the silent host its premise needs. Counted as a failure because an unmeasured
208
+ # known pair proves nothing β€” the same rule the suites around this one already follow.
209
+ printf ' ❌ %-44s UNMEASURED: could not obtain a silent port (3 tries)\n' "S6 no server at host"
210
+ fail=$((fail+1))
211
+ else
212
+ out=$( FH_OLLAMA_HOST="http://127.0.0.1:$_dead_port" bash "$CAL" --only ollama --quiet 2>&1 )
167
213
  if printf '%s' "$out" | grep -q 'ABSENT β€” no server at the configured host'; then
168
214
  printf ' βœ… %-44s reported ABSENT\n' "S6 no server at host"; pass=$((pass+1))
169
215
  else
170
216
  printf ' ❌ %-44s (expected a measured ABSENT line)\n' "S6 no server at host"
171
217
  printf ' out: %s\n' "$(printf '%s' "$out" | head -3)"; fail=$((fail+1))
172
218
  fi
219
+ fi
220
+
221
+ # ── S20 (2026-10-26) β€” the known pair for the port repair itself ───────────────────────────────
222
+ # The defect this suite shipped with was not in its logic: PORT was the fixed 18011, so two copies
223
+ # running in different trees on one machine fought over one socket. That is only a repair if the
224
+ # collision is REAL and the repair survives it, so this lane holds a port open and asks both
225
+ # questions against the live code rather than against my description of it.
226
+ echo "── S20 port is not machine-global ──"
227
+ _hold_out="$(mktemp)"; _held=""
228
+ python3 -c 'import socket,sys,time
229
+ s=socket.socket(); s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
230
+ s.bind(("127.0.0.1", 0)); s.listen(1)
231
+ print(s.getsockname()[1], flush=True)
232
+ time.sleep(45)' > "$_hold_out" 2>/dev/null &
233
+ _hold_pid=$!
234
+ for _ in $(seq 1 40); do _held="$(head -1 "$_hold_out" 2>/dev/null)"; [ -n "$_held" ] && break; sleep 0.25; done
235
+ _saved_port="$PORT"; _saved_pinned="$PORT_PINNED"
236
+ if [ -z "$_held" ]; then
237
+ # UNMEASURED: no holder, so neither arm below means anything. Counted, for the same reason S6's
238
+ # unmeasured arm is counted β€” a known pair that did not run is not a known pair that passed.
239
+ printf ' ❌ %-44s UNMEASURED: could not hold a port open\n' "S20 occupied-port known pair"
240
+ fail=$((fail+1))
241
+ else
242
+ # known-POSITIVE: the collision is real. Pin the stub to the held port and the stub cannot come
243
+ # up. If this arm ever passes, binding a busy port stopped failing and the lane below proves
244
+ # nothing β€” so the positive control is what keeps the negative one honest.
245
+ PORT="$_held"; PORT_PINNED=1
246
+ if start_stub ok 2>/dev/null; then
247
+ printf ' ❌ %-44s a stub came up on an OCCUPIED port β€” the control is broken\n' "S20a known-positive"
248
+ fail=$((fail+1))
249
+ else
250
+ printf ' βœ… %-44s a pinned, occupied port really does stop the stub\n' "S20a known-positive"
251
+ pass=$((pass+1))
252
+ fi
253
+ stop_stub
254
+ # known-NEGATIVE: with the port NOT pinned, the same occupied port is simply not chosen β€” which
255
+ # is the whole repair. The old `${FH_LANE_PORT:-18011}` form had no way to express this.
256
+ PORT_PINNED=0; PORT="$_held"
257
+ if start_stub ok && [ "$PORT" != "$_held" ]; then
258
+ printf ' βœ… %-44s unpinned: picked %s instead of the occupied port\n' "S20b known-negative" "$PORT"
259
+ pass=$((pass+1))
260
+ else
261
+ printf ' ❌ %-44s unpinned run did not route around the occupied port (port=%s)\n' "S20b known-negative" "$PORT"
262
+ fail=$((fail+1))
263
+ fi
264
+ stop_stub
265
+ fi
266
+ kill "$_hold_pid" 2>/dev/null; wait "$_hold_pid" 2>/dev/null
267
+ rm -f "$_hold_out"
268
+ PORT="$_saved_port"; PORT_PINNED="$_saved_pinned"
173
269
 
174
270
  echo
175
271
  if [ "$fail" -eq 0 ]; then
@@ -21,6 +21,8 @@ setup() {
21
21
  git init -q --bare -b main "$d/origin.git"
22
22
  git clone -q "$d/origin.git" "$d/seed" 2>/dev/null
23
23
  printf 'a1\n' > "$d/seed/a"; printf 'b1\n' > "$d/seed/b"
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
+ [ -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"; }
24
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
25
27
  git -C "$d/seed" switch -qc feat; printf 'a2\n' > "$d/seed/a"; printf 'b2\n' > "$d/seed/b"
26
28
  git -C "$d/seed" commit -qam feat --no-verify; git -C "$d/seed" push -q origin feat
@@ -67,7 +69,11 @@ esac
67
69
  EOF
68
70
  chmod +x "$D/bin/gh"
69
71
  }
70
- run() { local D="$1"; shift; OUT=$(cd "$D/work" && PATH="$D/bin:$PATH" PMV_RETRY_SLEEP=0 bash "$SC" "$@" 2>&1); RC=$?; }
72
+ # πŸŸ₯ env -u CLAUDECODE: the lane itself often runs inside Claude Code; without it every Β«no agent markerΒ» control inherits the
73
+ # marker and reads agent-session (measured on the first run of L18).
74
+ run() { local D="$1"; shift; OUT=$(cd "$D/work" && env -u CLAUDECODE PATH="$D/bin:$PATH" PMV_RETRY_SLEEP=0 PMV_RECEIPTS="$D/receipts.jsonl" bash "$SC" "$@" 2>&1); RC=$?; }
75
+ # receipt field reader: rcpt <dir> <field> β†’ value of the LAST receipt line (empty if none)
76
+ rcpt() { [ -s "$1/receipts.jsonl" ] && tail -1 "$1/receipts.jsonl" | python3 -c "import json,sys;v=json.load(sys.stdin).get(sys.argv[1]);print('' if v is None else v)" "$2"; }
71
77
  merged() { [ -s "$1/merge.log" ]; }
72
78
  GOOD='grep -q a2 a && grep -q b2 b && echo instrument-ok'
73
79
 
@@ -147,5 +153,46 @@ setup st; mkgh "$T/st"; : > "$T/st/local_fail"; : > "$T/st/stuck"; run "$T/st" 7
147
153
  { [ "$RC" -eq 5 ] && printf '%s' "$OUT" | grep -q 'NOT observed' && printf '%s' "$OUT" | grep -q 'read 3 time' && ! printf '%s' "$OUT" | grep -q 'nothing merged'; } \
148
154
  && ok "L16 stale OPEN through all re-reads β†’ rc=5 Β«NOT observedΒ», no false Β«nothing mergedΒ»" || { bad "L16 rc=$RC"; printf '%s\n' "$OUT" | tail -2; }
149
155
 
156
+ # ── merge receipt: actor + lease (frontier digest 2026-10-23, arXiv:2610.28683) ──
157
+ # L17 an agent session merging under a named lease β†’ one receipt line naming both, with the merge commit and outcome
158
+ 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=$?
159
+ { [ "$RC" -eq 0 ] && [ "$(rcpt "$T/rl" actor)" = "agent-session:claude-code" ] && [ "$(rcpt "$T/rl" lease)" = "night-2026-10-22" ] \
160
+ && [ "$(rcpt "$T/rl" outcome)" = "verified" ] && [ "$(rcpt "$T/rl" merge)" = "$(cat "$T/rl/merge.oid")" ] && [ "$(wc -l < "$T/rl/receipts.jsonl")" -eq 1 ]; } \
161
+ && 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; }
162
+ # L18 control: no lease, no agent marker β†’ actor human-or-unknown, lease NONE (recorded, not refused)
163
+ { [ "$(rcpt "$T/ok" actor)" = "human-or-unknown" ] && [ "$(rcpt "$T/ok" lease)" = "NONE" ]; } \
164
+ && 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)"
165
+ # L19 negative control β€” a refusal BEFORE the merge, or a merge GitHub did not take, leaves no receipt. It cannot detect the feature
166
+ # being removed on its own (codex R1); L17 Β· L18 Β· L21 are its positive pair.
167
+ { [ ! -s "$T/nore/receipts.jsonl" ] && [ ! -s "$T/triv/receipts.jsonl" ] && [ ! -s "$T/mf/receipts.jsonl" ]; } \
168
+ && ok "L19 refused / not-merged runs leave no receipt" || bad "L19 a receipt was written for a run that did not merge"
169
+ # L20 an empty --lease is a usage error before the merge
170
+ setup le; mkgh "$T/le"; run "$T/le" 7 --rerun "$GOOD" --lease ""
171
+ # the message names --lease: an unknown-option rc=2 alone would also pass (codex R1)
172
+ { [ "$RC" -eq 2 ] && ! merged "$T/le" && printf '%s' "$OUT" | grep -qF -- '--lease needs a non-empty label'; } && ok "L20 empty --lease β†’ rc=2 Β«needs a non-empty labelΒ», no merge" || bad "L20 empty lease rc=$RC out=$OUT"
173
+ # L22 a queued merge (GitHub accepted the request, not completed) is receipted as such β€” the request was made
174
+ [ "$(rcpt "$T/q" outcome)" = "accepted-not-completed" ] && ok "L22 queued merge β†’ receipt outcome accepted-not-completed" || bad "L22 receipt=$(cat "$T/q/receipts.jsonl" 2>/dev/null)"
175
+ # L21 a merged-but-failed verification still gets its receipt, with that outcome
176
+ [ "$(rcpt "$T/drop" outcome)" = "verify-failed" ] && ok "L21 verify FAILED after merge β†’ receipt outcome verify-failed" || bad "L21 receipt=$(cat "$T/drop/receipts.jsonl" 2>/dev/null)"
177
+
178
+ # ── --rerun coverage advisory (warning only) ──
179
+ # L23 a real but unrelated --rerun (touches none of the PR's changed files) β†’ warning, yet the merge and verify still go through
180
+ setup cv; mkgh "$T/cv"; run "$T/cv" 7 --rerun 'git --version && echo unrelated-ok'
181
+ { [ "$RC" -eq 0 ] && merged "$T/cv" && printf '%s' "$OUT" | grep -q 'mentions none of this PR'"'"'s 2 changed file'; } \
182
+ && ok "L23 --rerun naming no changed file β†’ advisory warning, merge + verify unchanged (rc=0)" || { bad "L23 rc=$RC"; printf '%s\n' "$OUT" | tail -4; }
183
+ # L24 control: a --rerun that names the changed files stays silent (L1's GOOD names a and b)
184
+ setup cv2; mkgh "$T/cv2"; run "$T/cv2" 7 --rerun "$GOOD"
185
+ { [ "$RC" -eq 0 ] && ! printf '%s' "$OUT" | grep -q 'mentions none of this PR'; } \
186
+ && ok "L24 --rerun naming the changed files β†’ no advisory" || bad "L24 rc=$RC (advisory fired on a covering --rerun?)"
187
+
188
+ # L25 a glob in --rerun is NOT expanded against the checkout β€” `echo *` would pull in r.sh (whose text names `a`) and silence the advisory (cross-family R1)
189
+ SETUP_EXTRA=1 setup cvg; mkgh "$T/cvg"; run "$T/cvg" 7 --rerun 'git --version && echo *'
190
+ { [ "$RC" -eq 0 ] && printf '%s' "$OUT" | grep -q 'mentions none of this PR'; } \
191
+ && ok "L25 --rerun with a bare glob β†’ advisory still fires (no pathname expansion)" || bad "L25 rc=$RC (glob expanded into a runner that names a changed file?)"
192
+ # L25b a word naming a tracked DIRECTORY adds nothing β€” its tree listing (here `a`) is not a script's text (cross-family R1)
193
+ SETUP_EXTRA=1 setup cvd; mkgh "$T/cvd"; run "$T/cvd" 7 --rerun 'git --version && ls d'
194
+ { [ "$RC" -eq 0 ] && printf '%s' "$OUT" | grep -q 'mentions none of this PR'; } \
195
+ && ok "L25b --rerun naming a tracked dir β†’ advisory still fires (blobs only)" || bad "L25b rc=$RC (dir listing counted as coverage?)"
196
+
150
197
  printf 'PASS %d Β· FAIL %d\n' "$PASS" "$FAIL"
151
198
  [ "$FAIL" -eq 0 ]