@chrono-meta/fh-gate 3.8.0 → 3.9.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.
@@ -45,7 +45,34 @@ CLI_EVENT_EXCLUDE = {"G-CODE-01", "G-CODE-02", "G-CODE-03"}
45
45
  # arm that can see the skill layer), and building one re-calibrates all 12 probes, so it is not a
46
46
  # calibration-week change. Named here so the gap stays greppable instead of dissolving into a
47
47
  # permanently-red lane nobody reads.
48
- ARM_CAPABILITY_EXCLUDE = {"G-TRIG-03"}
48
+ #
49
+ # G-LINT-01 joined this set 2026-09-14, same root cause, different symptom. It had emitted
50
+ # NOT-YET-AUTHORED every night for eight nights — "the rule selects it but nobody wrote a spec" —
51
+ # which reads like a to-do and is not one: its Input Pattern is `/harness-doctor` run in FH cwd, so
52
+ # scoring it requires an arm that can INVOKE a skill, and this arm cannot. Eight identical warnings
53
+ # is how a warning stops being read; the honest close is to name the real blocker, not to author a
54
+ # regex against a route the arm cannot take. Same UNMEASURED note applies: whether harness-doctor's
55
+ # L4 knowledge cross-ref lint fires is not answered by excluding it here.
56
+ ARM_CAPABILITY_EXCLUDE = {"G-TRIG-03", "G-LINT-01"}
57
+
58
+ # The THIRD judgment call, and deliberately a SEPARATE set from the one above — "the arm lacks the
59
+ # TOOL" and "the arm cannot reach the STATE that decides the right answer" are different facts, and
60
+ # collapsing them would render an unreachable fixture as a missing capability (the same
61
+ # separate-values-on-purpose discipline CLAUDE.md applies to the `crossfamily:` degrade triad).
62
+ #
63
+ # G-GREET-03 checks the FIXED 4-DOOR MENU, which renders only on the RETURNING branch. The branch
64
+ # test is mechanical and is `bash scripts/mapped_tracks.sh` — but an observe-mode arm runs with
65
+ # `--tools "Read,Grep,Glob"` and has no Bash, and `tracks/**` is gitignored so the disposable clone
66
+ # carries no session files or mapped-project dirs either. The arm therefore cannot reach the state
67
+ # that decides WHICH door set is correct, and a regex asserting ①②③④ would score a NEW-user 2-door
68
+ # menu — the correct answer for that clone — as a failure.
69
+ #
70
+ # 🟥 THIS IS AN OPEN GAP, NOT AN ANSWER. "Does the fixed 4-door menu render at the floor tier?" is
71
+ # UNMEASURED. Closing it needs an arm with a fixture (a real FILE under tracks/{name}/ — an empty
72
+ # dir is invisible to Glob, measured 2026-08-29 in sim_isolated_run.sh's own header) plus a branch
73
+ # the arm can observe without Bash. Named here so the gap stays greppable instead of dissolving
74
+ # into a decorative always-red probe.
75
+ ARM_STATE_EXCLUDE = {"G-GREET-03"}
49
76
 
50
77
 
51
78
  def parse_probes_md(path):
@@ -135,7 +162,14 @@ def classify(id_, input_pat, class_tok):
135
162
  if id_ in CLI_EVENT_EXCLUDE:
136
163
  return 'EXCLUDED', 'NOT-CHAT-UTTERANCE (shell command, not a chat turn)'
137
164
  if id_ in ARM_CAPABILITY_EXCLUDE:
138
- return 'EXCLUDED', 'NOT-LIVE-MEASURABLE (skill-description route; the arm has no Skill tool)'
165
+ return 'EXCLUDED', 'NOT-LIVE-MEASURABLE (needs the Skill layer; the arm has no Skill tool)'
166
+ # Checked BEFORE the utterance-shape rule on purpose: G-GREET-03's cell carries no quoted
167
+ # literal either, so NO-UTTERANCE would win the race and report a true-but-irrelevant reason
168
+ # ("nobody typed it") for a row whose real blocker is that the arm cannot reach the branch
169
+ # state. An honest reason column is the whole point of naming these sets.
170
+ if id_ in ARM_STATE_EXCLUDE:
171
+ return 'EXCLUDED', ('NOT-LIVE-MEASURABLE (branch-state route; the arm has no Bash to run '
172
+ 'the branch test and the clone carries no tracks/** fixture)')
139
173
  if not UTTERANCE_RE.search(input_pat):
140
174
  return 'EXCLUDED', 'NO-UTTERANCE (no quoted/backticked literal a user would type)'
141
175
  return 'SELECTABLE', None
@@ -185,13 +219,25 @@ def build_selection(probes_md_rows, live_rows):
185
219
  warnings.append("BAD-POLARITY: %s declares polarity=%r (must be present|absent)"
186
220
  % (row['id'], spec['polarity']))
187
221
  continue
188
- selected.append({
222
+ entry = {
189
223
  'id': row['id'],
190
224
  'input': spec['input'],
191
225
  'control_input': spec['control_input'],
192
226
  'polarity': spec['polarity'],
193
227
  'expect_re': spec['expect_re'],
194
- })
228
+ }
229
+ # Optional, and optional on purpose — a second known-negative costs a THIRD live call per
230
+ # rep, so it is spent only where one control has been shown to under-discriminate. Key name
231
+ # has no digit: parse_probes_live's key regex is `[a-z_]+`, so `control_input_2` would be
232
+ # silently dropped (the leniency class [[feedback_declaration_silently_dropped_by_parse]]).
233
+ if spec.get('control_input_b'):
234
+ entry['control_input_b'] = spec['control_input_b']
235
+ # ADVISORY channel — recorded, never scored. See score_run(): a probe can be widened to
236
+ # measure a BEHAVIOR while a narrower pattern keeps measuring the ROUTE, so that turning the
237
+ # row green does not also erase the residual the widening stopped seeing.
238
+ if spec.get('advisory_re'):
239
+ entry['advisory_re'] = spec['advisory_re']
240
+ selected.append(entry)
195
241
 
196
242
  # Dead-pointer guard: an id in probes_live.yaml that does not exist in probes.md AT ALL.
197
243
  for p in live_rows:
@@ -335,11 +381,42 @@ def score_run(live_rows, run_root, ids_in_order, threshold, model, reps=1):
335
381
  rows.append({'id': pid, 'verdict': 'UNKNOWN-ID', 'primary_hit': None, 'control_hit': None})
336
382
  continue
337
383
  base = os.path.join(run_root, pid)
384
+ has_ctrl_b = bool(spec.get('control_input_b'))
385
+ adv_re = spec.get('advisory_re')
386
+ adv_pat = re.compile(adv_re) if adv_re else None
387
+ adv_hits = 0
388
+ ctrl_b_absent = False # rep-1 only, diagnostic: which arm actually produced nothing
338
389
  per_rep = [] # [(verdict, phit, chit, primary_text, control_text)]
339
390
  for i in range(1, reps + 1):
340
391
  pt = _read_text(os.path.join(base, 'primary_r%d.txt' % i))
341
392
  ct = _read_text(os.path.join(base, 'control_r%d.txt' % i))
393
+ ct_first_arm_ran = bool(ct)
394
+ if has_ctrl_b:
395
+ # A declared second control that produced nothing did NOT run — and a probe whose
396
+ # calibration arm did not run has not been calibrated. Collapsing that into "the
397
+ # control stayed silent, so the pattern discriminates" is the not-found-is-not-zero
398
+ # defect pointed at the calibration channel instead of the measurement channel.
399
+ ctb = _read_text(os.path.join(base, 'control_b_r%d.txt' % i))
400
+ if not ctb:
401
+ ct = None
402
+ if i == 1 and ct_first_arm_ran:
403
+ # Keep WHICH arm died attributable. Without this the reason column blames
404
+ # `control:` — the arm that ran fine — for the absence of `control_b:`,
405
+ # which is a diagnostic pointing at the wrong file. Caught by lane CB2.
406
+ ctrl_b_absent = True
407
+ elif ct:
408
+ # Concatenated, so a hit in EITHER known-negative sets control_hit. For
409
+ # polarity=present that is the strict direction (more controls can only push a
410
+ # probe toward UNCALIBRATED, never toward PASS).
411
+ # 🟥 For polarity=absent it is the LENIENT direction — the control is a
412
+ # known-POSITIVE there, and concatenation makes "the pattern can fire at all"
413
+ # easier to satisfy. Do not declare control_input_b on an absent-polarity probe
414
+ # without re-deriving this; none currently does.
415
+ ct = ct + '\n----- control_b -----\n' + ctb
342
416
  v, ph, ch = score_probe(pt, ct, spec['polarity'], spec['expect_re'])
417
+ if adv_pat is not None and pt:
418
+ if adv_pat.search(pt):
419
+ adv_hits += 1
343
420
  per_rep.append((v, ph, ch, pt, ct))
344
421
 
345
422
  ran_reps = [r for r in per_rep if r[0] != FAILED_TO_RUN]
@@ -356,13 +433,23 @@ def score_run(live_rows, run_root, ids_in_order, threshold, model, reps=1):
356
433
  # primary_hit/control_hit stay single-valued for backward compatibility with the existing
357
434
  # report columns and lanes: they report rep 1, and `reps` carries the spread.
358
435
  phit, chit = per_rep[0][1], per_rep[0][2]
436
+ # INSTRUMENT-SILENT: the pattern matched in NEITHER arm, in NO rep that ran. Per probe this
437
+ # is ordinary (a rule that did not fire looks exactly like this). Across a WHOLE run it is
438
+ # the signature of a blind instrument — see the run-level branch below.
439
+ silent = bool(ran_reps) and not any(r[1] or r[2] for r in ran_reps)
359
440
  row = {'id': pid, 'verdict': verdict, 'primary_hit': phit, 'control_hit': chit,
360
441
  'polarity': spec['polarity'], 'reason': '',
361
442
  'reps': '%d/%d' % (len(pass_reps), len(ran_reps)) if ran_reps else '0/0',
362
443
  'reps_requested': reps,
444
+ 'silent': silent,
363
445
  'rep_verdicts': [r[0] for r in per_rep]}
364
446
  if len(ran_reps) > 1 and 0 < len(pass_reps) < len(ran_reps):
365
447
  row['reason'] = 'FLAKY across reps (%s)' % ','.join(r[0] for r in per_rep)
448
+ if adv_pat is not None:
449
+ row['advisory'] = '%d/%d' % (adv_hits, len(ran_reps) if ran_reps else 0)
450
+ row['advisory_re'] = adv_re
451
+ note = 'advisory[%s] %s' % (adv_re, row['advisory'])
452
+ row['reason'] = (row['reason'] + '; ' + note) if row['reason'] else note
366
453
  if verdict == FAILED_TO_RUN:
367
454
  # Diagnostic only — score_probe already decided the verdict above from exactly the
368
455
  # same texts; this never changes it, only explains it. Reported from rep 1.
@@ -370,11 +457,57 @@ def score_run(live_rows, run_root, ids_in_order, threshold, model, reps=1):
370
457
  primary_text, control_text = per_rep[0][3], per_rep[0][4]
371
458
  if primary_text is None or primary_text == '':
372
459
  reasons.append('primary: %s' % _failure_reason(base, 'primary'))
373
- if control_text is None or control_text == '':
460
+ if ctrl_b_absent:
461
+ reasons.append('control_b: %s' % _failure_reason(base, 'control_b'))
462
+ elif control_text is None or control_text == '':
374
463
  reasons.append('control: %s' % _failure_reason(base, 'control'))
375
464
  row['reason'] = '; '.join(reasons)
376
465
  rows.append(row)
377
466
 
467
+ # ── RUN-BLACKOUT / BLACKOUT-SUSPECT (2026-09-14) ──────────────────────────────────────────
468
+ # WHY. On 2026-09-13 every one of 11 probes scored 0/3 — including G-GREET-01, which is 3/3 on
469
+ # every other night in the record, and G-GREET-04, whose polarity=absent control is a
470
+ # known-POSITIVE and also never fired. The report rendered that as ten FAIL rows: "the harness
471
+ # did not fire", when what actually happened is "nothing was measured". That is the
472
+ # not-found-is-not-zero defect (CLAUDE.md §Instrument-Calibration), and the existing
473
+ # UNCALIBRATED value already means exactly the right thing — it was simply never reachable from
474
+ # this shape, because the per-probe rule only fires when a pattern hits a known-negative.
475
+ # This is a CONDITION EXTENSION onto the existing value, not a new verdict.
476
+ #
477
+ # WHERE THE BOUNDARY IS, AND WHY THERE.
478
+ # silent_fraction = (scored probes whose pattern matched in NEITHER arm in ANY rep) / (scored)
479
+ # Measured over the 10 nights on record: 09-05..09-11 and 09-14 sit at 0.00–0.18.
480
+ # 09-12 = 0.73. 09-13 = 1.00.
481
+ # * silent_fraction == 1.00 AND >= 3 scored probes -> RUN-BLACKOUT (verdict UNCALIBRATED)
482
+ # At 1.00 there is literally no evidence any channel worked: N independent patterns, each
483
+ # authored against a different rule, matched nothing anywhere across 2N..6N responses.
484
+ # * 0.50 <= silent_fraction < 1.00 -> BLACKOUT-SUSPECT, ADVISORY ONLY.
485
+ # The verdict is left exactly as computed. This is the deliberate narrow edge: 09-12 lands
486
+ # here (0.73) and stays FAIL, because its greeting anchors were ALIVE — G-GREET-01 3/3 and
487
+ # G-GREET-04 3/3 — so at least two channels demonstrably worked and a genuine broad
488
+ # regression is a live hypothesis that must not be laundered into "nothing was measured".
489
+ # 🟥 This is the failure mode the extension itself must not cause: widen the hard condition
490
+ # below 1.00 and a REAL full regression starts rendering as UNCALIBRATED. The 0.50 line is
491
+ # a majority, chosen for that meaning and not fitted to 0.73; any cut in (0.18, 0.73] would
492
+ # separate the observed classes, which is exactly why it may NOT carry the hard branch.
493
+ # * >= 3 scored probes is required so the guard cannot fire on a one-probe spot-check, where
494
+ # "the single probe did not fire" is the ordinary, informative answer.
495
+ #
496
+ # HONEST SCOPE: n = 10 nights, one instrument, one repo. The 0.50 line is provisional and the
497
+ # distribution that would refine it is exactly what the newly-preserved run artifacts build.
498
+ scored = [r for r in rows if r['verdict'] in (PASS, FAIL, UNCALIBRATED)]
499
+ silent_rows = [r for r in scored if r.get('silent')]
500
+ silent_fraction = (len(silent_rows) / float(len(scored))) if scored else None
501
+ blackout = bool(scored) and len(scored) >= 3 and len(silent_rows) == len(scored)
502
+ blackout_suspect = (not blackout) and silent_fraction is not None and silent_fraction >= 0.5
503
+
504
+ if blackout:
505
+ for r in scored:
506
+ r['verdict'] = UNCALIBRATED
507
+ note = ('RUN-BLACKOUT: no pattern matched in either arm in any rep, across every '
508
+ 'probe in this run — the instrument, not the rule, is what failed')
509
+ r['reason'] = (r['reason'] + '; ' + note) if r.get('reason') else note
510
+
378
511
  failed_to_run = [r for r in rows if r['verdict'] == FAILED_TO_RUN]
379
512
  uncalibrated = [r for r in rows if r['verdict'] == UNCALIBRATED]
380
513
  ran = [r for r in rows if r['verdict'] in (PASS, FAIL)]
@@ -409,6 +542,11 @@ def score_run(live_rows, run_root, ids_in_order, threshold, model, reps=1):
409
542
  'overall': overall,
410
543
  'rc': rc,
411
544
  'model': model,
545
+ 'silent': len(silent_rows),
546
+ 'scored': len(scored),
547
+ 'silent_fraction': silent_fraction,
548
+ 'blackout': blackout,
549
+ 'blackout_suspect': blackout_suspect,
412
550
  }
413
551
 
414
552
 
@@ -443,6 +581,25 @@ def render_report_md(select_result, score_result, run_date):
443
581
  % (score_result['overall'], score_result['ran'], score_result['failed_to_run'],
444
582
  score_result['uncalibrated'], score_result['passed'], pr_s))
445
583
  lines.append("")
584
+ sf = score_result.get('silent_fraction')
585
+ if sf is not None:
586
+ lines.append("- instrument-silent probes: %d/%d (%.2f) — a probe is *silent* when its "
587
+ "pattern matched in NEITHER arm in ANY rep."
588
+ % (score_result.get('silent', 0), score_result.get('scored', 0), sf))
589
+ if score_result.get('blackout'):
590
+ lines.append("")
591
+ lines.append("🟥 **RUN-BLACKOUT** — every scored probe was instrument-silent. This run "
592
+ "measured NOTHING; it is not evidence that any rule stopped firing. Read "
593
+ "the preserved response bodies under `tracks/_meta/live_eval_runs/` before "
594
+ "attributing this to the harness.")
595
+ elif score_result.get('blackout_suspect'):
596
+ lines.append("")
597
+ lines.append("⚠️ **BLACKOUT-SUSPECT (advisory — the verdict above is unchanged)** — a "
598
+ "majority of probes were instrument-silent while at least one channel "
599
+ "demonstrably worked. Both a broad real regression and a partial "
600
+ "instrument failure produce this shape, and this file cannot tell them "
601
+ "apart; the preserved response bodies can.")
602
+ lines.append("")
446
603
  lines.append("## Excluded (from probes.md, 33-row snapshot)")
447
604
  lines.append("")
448
605
  lines.append("| Probe | Reason |")
@@ -500,6 +657,11 @@ def _cmd_select(args):
500
657
  f.write(p['input'])
501
658
  with open(os.path.join(args.spec_dir, p['id'] + '.control.txt'), 'w', encoding='utf-8') as f:
502
659
  f.write(p['control_input'])
660
+ # Written ONLY when declared — probe_live_eval.sh keys the third live call off this
661
+ # file's existence, so an absent file must mean "no second control", never "empty one".
662
+ if p.get('control_input_b'):
663
+ with open(os.path.join(args.spec_dir, p['id'] + '.control_b.txt'), 'w', encoding='utf-8') as f:
664
+ f.write(p['control_input_b'])
503
665
  with open(os.path.join(args.spec_dir, 'selected_ids.txt'), 'w', encoding='utf-8') as f:
504
666
  for p in filtered:
505
667
  f.write(p['id'] + '\n')
@@ -532,6 +694,17 @@ def _cmd_score(args):
532
694
  print("total=%d ran=%d failed_to_run=%d uncalibrated=%d passed=%d pass_rate=%s threshold=%.2f"
533
695
  % (score_result['total'], score_result['ran'], score_result['failed_to_run'],
534
696
  score_result['uncalibrated'], score_result['passed'], pr_s, score_result['threshold']))
697
+ sf = score_result.get('silent_fraction')
698
+ if sf is not None:
699
+ print("instrument-silent: %d/%d (%.2f)"
700
+ % (score_result.get('silent', 0), score_result.get('scored', 0), sf))
701
+ if score_result.get('blackout'):
702
+ print("🟥 RUN-BLACKOUT — every scored probe was silent in BOTH arms. Nothing was measured;")
703
+ print(" this is not evidence any rule stopped firing. Read the preserved response bodies.")
704
+ elif score_result.get('blackout_suspect'):
705
+ print("⚠️ BLACKOUT-SUSPECT (advisory, verdict unchanged) — majority of probes silent while")
706
+ print(" at least one channel worked. Real broad regression and partial instrument failure")
707
+ print(" look identical here; the preserved response bodies tell them apart.")
535
708
  print("OVERALL: %s (rc=%d)" % (score_result['overall'], score_result['rc']))
536
709
 
537
710
  if args.report_out:
@@ -1418,6 +1418,28 @@ else
1418
1418
  fail=1
1419
1419
  fi
1420
1420
 
1421
+ # temper_check lanes — 🟥 `templates/temper_check.sh` 는 게이트체인 7경로 중 **유일하게 실행 레인이
1422
+ # 0** 이었다(2026-09-14 frontier-digest 후보 #1 → 독립 재현으로 참 판정). 참조 6곳이 전부 비실행
1423
+ # 이었고, 그중 하나가 **바로 이 파일의 `bash -n` 목록**이다 — 즉 selfcheck 자신이 «구문 검사» 를
1424
+ # «검증» 으로 세고 있었다. steel-quench SKILL.md 의 T-1 행은 그 사이 그것을 `measured` 로 선언한다.
1425
+ # `bash -n` 은 계기가 아니다([[feedback_gate_verification_must_execute]]) — 아래가 그 자리를 실행으로
1426
+ # 바꾼다. 레인은 격리 픽스처(실물 내용 · 실제 두 커밋 쌍)를 쓰고 네트워크·API 를 안 탄다.
1427
+ #
1428
+ # ⚠️ Subject-absent 는 여기서도 FAIL 이다(SKIP 아님) — `templates/temper_check.sh` 는 package.json
1429
+ # files[] 에 있으므로 부재는 «정당한 미출하» 가 아니라 삭제다. 위 branch_claim 블록과 같은 근거.
1430
+ # rc=2 는 계기 오류(HARNESS-ERROR)라 rc=1 과 같이 fail 로 접는다 — «못 쟀다» 는 «통과» 가 아니다.
1431
+ if [ ! -f templates/temper_check.sh ]; then
1432
+ echo "FAIL templates/temper_check.sh is in package.json files[] but absent — a deleted subject, not a skip"
1433
+ fail=1
1434
+ elif [ -f scripts/test_temper_check_lanes.sh ]; then
1435
+ if ! bash scripts/test_temper_check_lanes.sh; then
1436
+ fail=1
1437
+ fi
1438
+ else
1439
+ echo "FAIL test_temper_check_lanes.sh: temper_check.sh present but its anchor is missing"
1440
+ fail=1
1441
+ fi
1442
+
1421
1443
  # listing_watch — 같은 형태. 🟥 이 블록을 «레인을 짓는 같은 커밋에서» 붙인다: 바로 위 주석이
1422
1444
  # 기록한 「레인은 지었는데 selfcheck 배선을 안 했다」 재발이 **최소 다섯 번**이고, 그 다섯 다 CI 나
1423
1445
  # lane-runner 가 뒤늦게 잡았다. 순서를 바꾸는 것이 유일한 처방이라 여기서 그렇게 한다.