@chrono-meta/fh-gate 3.42.0 → 3.43.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.
- package/.claude/regression/probes_live.yaml +16 -8
- package/.claude/rules/fh_4axis_gate.md +8 -0
- package/.claude-plugin/marketplace.json +4 -4
- package/AGENTS.md +5 -0
- package/README.ja.md +2 -0
- package/README.ko.md +2 -0
- package/README.md +2 -0
- package/README.zh.md +2 -0
- package/docs/HOW_FH_DIFFERS.en.md +37 -0
- package/docs/HOW_FH_DIFFERS.md +39 -0
- package/docs/USER_GUIDE.md +113 -2
- package/docs/model_tier_expectations.md +8 -4
- package/knowledge/shared/harness-core/claude_md_full_reference.md +10 -0
- package/knowledge/shared/harness-core/dispatch_conditional_prohibition.md +18 -0
- package/knowledge/shared/harness-core/fh_module_contract.md +19 -0
- package/knowledge/shared/harness-core/measurement-integrity-checklist.md +24 -0
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +30 -0
- package/package.json +6 -1
- package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-commons/skills/ko-tech-writer/SKILL.md +2 -2
- package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/CHANGELOG.md +32 -2
- package/plugins/fh-meta/skills/edit-manifest/SKILL.md +14 -1
- package/plugins/fh-meta/skills/harvest-loop/SKILL.md +1 -1
- package/plugins/fh-meta/skills/meta-prompt-builder/SKILL.md +19 -0
- package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
- package/scripts/capability_registry_check.sh +15 -2
- package/scripts/live_eval_trace.py +122 -0
- package/scripts/package_coverage_check.sh +7 -0
- package/scripts/pr_merge_verified.sh +7 -0
- package/scripts/probe_live_eval.sh +6 -3
- package/scripts/probe_live_eval_lib.py +89 -1
- package/scripts/remote_marker_gate.sh +56 -0
- package/scripts/selfcheck.sh +7 -0
- package/scripts/session_close_check.sh +16 -0
- package/scripts/sim_isolated_run.sh +17 -2
- package/scripts/test_fixture_guard_coverage_lanes.sh +71 -10
- package/scripts/test_live_eval_trace_lanes.sh +145 -0
- package/scripts/test_meta_prompt_restate_lanes.sh +36 -0
- package/scripts/test_mutation_probe_lanes.sh +26 -6
- package/scripts/test_pr_merge_verified_lanes.sh +23 -0
- package/scripts/test_remote_marker_gate_lanes.sh +96 -0
- package/scripts/test_session_close_lanes.sh +7 -0
|
@@ -312,6 +312,13 @@ FAILED_TO_RUN = 'FAILED-TO-RUN'
|
|
|
312
312
|
UNCALIBRATED = 'UNCALIBRATED'
|
|
313
313
|
PASS = 'PASS'
|
|
314
314
|
FAIL = 'FAIL'
|
|
315
|
+
INVALID_COMPARISON = 'INVALID-COMPARISON' # arms ran with different tool/MCP surfaces (FH-3, 2026-11-14)
|
|
316
|
+
|
|
317
|
+
try: # §TRACE — sibling module; absent = every probe is scored on text only and labelled MENTION-ONLY
|
|
318
|
+
import live_eval_trace as _trace
|
|
319
|
+
except ImportError: # pragma: no cover
|
|
320
|
+
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
321
|
+
import live_eval_trace as _trace
|
|
315
322
|
|
|
316
323
|
|
|
317
324
|
def _read_text(path):
|
|
@@ -515,6 +522,14 @@ def score_run(live_rows, run_root, ids_in_order, threshold, model, reps=1):
|
|
|
515
522
|
adv_re = spec.get('advisory_re')
|
|
516
523
|
adv_pat = re.compile(adv_re) if adv_re else None
|
|
517
524
|
adv_hits = 0
|
|
525
|
+
behave, behave_err = spec.get('behave'), None
|
|
526
|
+
if behave:
|
|
527
|
+
try:
|
|
528
|
+
_trace.parse_behave(behave)
|
|
529
|
+
except (ValueError, re.error) as e:
|
|
530
|
+
behave_err, behave = str(e), None
|
|
531
|
+
inventories, inv_unknown, traces, no_trace, b_reps = set(), 0, {}, 0, []
|
|
532
|
+
damaged, any_trace = 0, False
|
|
518
533
|
ctrl_b_absent = False # rep-1 only, diagnostic: which arm actually produced nothing
|
|
519
534
|
per_rep = [] # [(verdict, phit, chit, primary_text, control_text)]
|
|
520
535
|
for i in range(1, reps + 1):
|
|
@@ -544,6 +559,31 @@ def score_run(live_rows, run_root, ids_in_order, threshold, model, reps=1):
|
|
|
544
559
|
# without re-deriving this; none currently does.
|
|
545
560
|
ct = ct + '\n----- control_b -----\n' + ctb
|
|
546
561
|
v, ph, ch = score_probe(pt, ct, spec['polarity'], spec['expect_re'])
|
|
562
|
+
# §TRACE — what each arm's session had (init tools/MCP) and, for a `behave:` probe, did.
|
|
563
|
+
for arm in ['primary', 'control'] + (['control_b'] if has_ctrl_b else []):
|
|
564
|
+
tr = _trace.parse_stream(os.path.join(base, '%s_r%d.stream.jsonl' % (arm, i)))
|
|
565
|
+
if tr is not None and tr['damaged']:
|
|
566
|
+
damaged += 1
|
|
567
|
+
tr = None
|
|
568
|
+
any_trace = any_trace or tr is not None
|
|
569
|
+
inv = _trace.inventory(tr)
|
|
570
|
+
if inv is not None:
|
|
571
|
+
inventories.add(inv)
|
|
572
|
+
elif tr is not None:
|
|
573
|
+
inv_unknown += 1
|
|
574
|
+
traces[(arm, i)] = tr
|
|
575
|
+
if behave and v in (PASS, FAIL):
|
|
576
|
+
arms_i = ['primary', 'control'] + (['control_b'] if has_ctrl_b else [])
|
|
577
|
+
if any(traces[(a, i)] is None for a in arms_i):
|
|
578
|
+
no_trace += 1
|
|
579
|
+
else:
|
|
580
|
+
bp = _trace.behave_hit(traces[('primary', i)], behave)
|
|
581
|
+
bc = any(_trace.behave_hit(traces[(a, i)], behave) for a in arms_i[1:])
|
|
582
|
+
b_reps.append((bp, bc))
|
|
583
|
+
if bc:
|
|
584
|
+
v = UNCALIBRATED # the control arm did the action too: it cannot discriminate
|
|
585
|
+
elif v == PASS and not bp:
|
|
586
|
+
v = FAIL # said it, did not do it
|
|
547
587
|
if adv_pat is not None and pt:
|
|
548
588
|
if adv_pat.search(pt):
|
|
549
589
|
adv_hits += 1
|
|
@@ -555,6 +595,10 @@ def score_run(live_rows, run_root, ids_in_order, threshold, model, reps=1):
|
|
|
555
595
|
|
|
556
596
|
if not ran_reps:
|
|
557
597
|
verdict = FAILED_TO_RUN
|
|
598
|
+
elif len(inventories) > 1 or (inventories and inv_unknown):
|
|
599
|
+
verdict = INVALID_COMPARISON # different surfaces, or one arm's surface unknown
|
|
600
|
+
elif behave_err or (behave and any_trace and (no_trace or damaged)):
|
|
601
|
+
verdict = UNCALIBRATED # bad spec, or traces expected but some arm's is missing/damaged
|
|
558
602
|
elif uncal:
|
|
559
603
|
verdict = UNCALIBRATED
|
|
560
604
|
else:
|
|
@@ -573,6 +617,24 @@ def score_run(live_rows, run_root, ids_in_order, threshold, model, reps=1):
|
|
|
573
617
|
'reps_requested': reps,
|
|
574
618
|
'silent': silent,
|
|
575
619
|
'rep_verdicts': [r[0] for r in per_rep]}
|
|
620
|
+
# scored_by: BEHAVIOUR only when every rep that ran carried both traces and a behave spec.
|
|
621
|
+
# A probe with no `behave:` or a rep with no trace is MENTION-ONLY — its PASS reads a text.
|
|
622
|
+
row['scored_by'] = ('BEHAVIOUR' if behave and ran_reps and len(b_reps) == len(ran_reps)
|
|
623
|
+
else 'MENTION-ONLY')
|
|
624
|
+
row['behave'] = ('%d/%d did · control %d/%d' % (sum(1 for b in b_reps if b[0]), len(b_reps),
|
|
625
|
+
sum(1 for b in b_reps if b[1]), len(b_reps))) if b_reps else ('no trace' if behave else '-')
|
|
626
|
+
row['inventory'] = (('%d distinct' % len(inventories)) if inventories else 'UNMEASURED (no trace)') + \
|
|
627
|
+
((' · %d trace(s) without init' % inv_unknown) if inv_unknown else '')
|
|
628
|
+
row['_inventories'] = sorted(inventories)
|
|
629
|
+
if behave_err:
|
|
630
|
+
row['reason'] = 'BAD-BEHAVE: ' + behave_err
|
|
631
|
+
elif inventories and inv_unknown and len(inventories) == 1:
|
|
632
|
+
row['reason'] = 'INVALID-COMPARISON: %d trace(s) carry no init tool list — surfaces not comparable' % inv_unknown
|
|
633
|
+
elif behave and any_trace and (no_trace or damaged):
|
|
634
|
+
row['reason'] = 'TRACE-INCOMPLETE: %d rep(s) missing an arm trace · %d damaged stream(s)' % (no_trace, damaged)
|
|
635
|
+
elif len(inventories) > 1:
|
|
636
|
+
row['reason'] = 'INVALID-COMPARISON: arms saw %d different tool/MCP lists — %s' % (
|
|
637
|
+
len(inventories), ' ≠ '.join(sorted(inventories)))
|
|
576
638
|
if len(ran_reps) > 1 and 0 < len(pass_reps) < len(ran_reps):
|
|
577
639
|
row['reason'] = 'FLAKY across reps (%s)' % ','.join(r[0] for r in per_rep)
|
|
578
640
|
if adv_pat is not None:
|
|
@@ -643,11 +705,19 @@ def score_run(live_rows, run_root, ids_in_order, threshold, model, reps=1):
|
|
|
643
705
|
r['reason'] = (r['reason'] + '; ' + note) if r.get('reason') else note
|
|
644
706
|
|
|
645
707
|
failed_to_run = [r for r in rows if r['verdict'] == FAILED_TO_RUN]
|
|
708
|
+
invalid = [r for r in rows if r['verdict'] == INVALID_COMPARISON]
|
|
709
|
+
run_inv = set(x for r in rows for x in r.get('_inventories', []))
|
|
710
|
+
behaviour_backed = [r for r in rows if r['verdict'] == PASS and r.get('scored_by') == 'BEHAVIOUR']
|
|
711
|
+
mention_only_pass = [r for r in rows if r['verdict'] == PASS and r.get('scored_by') != 'BEHAVIOUR']
|
|
646
712
|
uncalibrated = [r for r in rows if r['verdict'] == UNCALIBRATED]
|
|
647
713
|
ran = [r for r in rows if r['verdict'] in (PASS, FAIL)]
|
|
648
714
|
passed = [r for r in rows if r['verdict'] == PASS]
|
|
649
715
|
|
|
650
|
-
if
|
|
716
|
+
if invalid or len(run_inv) > 1:
|
|
717
|
+
overall = INVALID_COMPARISON # no number: the arms were not the same instrument
|
|
718
|
+
rc = 2
|
|
719
|
+
pass_rate = None
|
|
720
|
+
elif uncalibrated:
|
|
651
721
|
overall = 'UNCALIBRATED'
|
|
652
722
|
rc = 2
|
|
653
723
|
pass_rate = None
|
|
@@ -681,6 +751,10 @@ def score_run(live_rows, run_root, ids_in_order, threshold, model, reps=1):
|
|
|
681
751
|
'silent_fraction': silent_fraction,
|
|
682
752
|
'blackout': blackout,
|
|
683
753
|
'blackout_suspect': blackout_suspect,
|
|
754
|
+
'invalid_comparison': len(invalid),
|
|
755
|
+
'run_inventories': len(run_inv),
|
|
756
|
+
'behaviour_backed': len(behaviour_backed),
|
|
757
|
+
'mention_only_pass': len(mention_only_pass),
|
|
684
758
|
}
|
|
685
759
|
|
|
686
760
|
|
|
@@ -904,6 +978,11 @@ def render_report_md(select_result, score_result, run_date, instrument=None):
|
|
|
904
978
|
% (score_result['overall'], score_result['ran'], score_result['failed_to_run'],
|
|
905
979
|
score_result['uncalibrated'], score_result['passed'], pr_s))
|
|
906
980
|
lines.append("")
|
|
981
|
+
lines.append("- scored by behaviour: **%d** of %d PASS · MENTION-ONLY: **%d** (a MENTION-ONLY PASS read the "
|
|
982
|
+
"reply text; it is not evidence the rule acted) · tool/MCP surfaces in this run: %s"
|
|
983
|
+
% (score_result.get('behaviour_backed', 0), score_result['passed'],
|
|
984
|
+
score_result.get('mention_only_pass', 0),
|
|
985
|
+
score_result.get('run_inventories') or 'UNMEASURED (no trace)'))
|
|
907
986
|
sf = score_result.get('silent_fraction')
|
|
908
987
|
if sf is not None:
|
|
909
988
|
lines.append("- instrument-silent probes: %d/%d (%.2f) — a probe is *silent* when its "
|
|
@@ -923,6 +1002,15 @@ def render_report_md(select_result, score_result, run_date, instrument=None):
|
|
|
923
1002
|
"instrument failure produce this shape, and this file cannot tell them "
|
|
924
1003
|
"apart; the preserved response bodies can.")
|
|
925
1004
|
lines.append("")
|
|
1005
|
+
if score_result is not None:
|
|
1006
|
+
lines.extend(["## Scored by — behaviour or mention", "",
|
|
1007
|
+
"`BEHAVIOUR` = the probe's `behave:` action was read from the event stream in every rep "
|
|
1008
|
+
"(primary did it, control did not). `MENTION-ONLY` = the verdict rests on reply text.", "",
|
|
1009
|
+
"| Probe | scored_by | behave (primary did · control did) | tool/MCP lists |", "|---|---|---|---|"])
|
|
1010
|
+
for r in score_result['rows']:
|
|
1011
|
+
lines.append("| %s | %s | %s | %s |" % (r['id'], r.get('scored_by', 'MENTION-ONLY'),
|
|
1012
|
+
_md_escape(r.get('behave', '-')), _md_escape(r.get('inventory', '-'))))
|
|
1013
|
+
lines.append("")
|
|
926
1014
|
lines.extend(render_construct_md(select_result['selected']))
|
|
927
1015
|
if score_result is not None and score_result.get('target'):
|
|
928
1016
|
lines.extend(render_target_md(score_result['target']))
|
|
@@ -47,6 +47,9 @@
|
|
|
47
47
|
# 하나로 묶어 뒀더니 실물 PR 재현이 **전부 SKIP** 으로 떨어졌다(조용한 통과).
|
|
48
48
|
# RMG_BASE_REF 비교 기준 (기본: origin/main)
|
|
49
49
|
# RMG_BODY_FILE PR 본문이 담긴 파일 (선택 — 없으면 커밋 메시지만 본다)
|
|
50
|
+
# RMG_PR_LOOKUP 1 이면 BODY_FILE 이 없을 때 그 커밋의 PR 본문을 `gh api` 로 읽는다(push 실행용)
|
|
51
|
+
# 조회 실패 = rc=10 · 이 채널의 PR 없음 = 커밋 메시지만
|
|
52
|
+
# RMG_REPO owner/name (RMG_PR_LOOKUP=1 일 때 필수) · RMG_GH gh 실행 파일 (기본: gh — 레인이 가짜를 꽂는다)
|
|
50
53
|
# RMG_CHANNEL_RE 플로어 없는 채널 패턴 (기본: '^claude/')
|
|
51
54
|
# RMG_GUARD_FILE GUARD_PATHSPEC 정본 (기본: templates/regression_guard.sh)
|
|
52
55
|
set -u
|
|
@@ -134,6 +137,59 @@ fi
|
|
|
134
137
|
say "📄 FH 자산 $NCH 개를 건드렸다:"
|
|
135
138
|
printf '%s\n' "$CHANGED" | sed 's/^/ /'
|
|
136
139
|
|
|
140
|
+
# ── 3-a. push 실행: 그 커밋의 PR 본문을 API 로 읽는다 (2026-11-15, AQ-20261114-10) ──
|
|
141
|
+
# `pull_request` 실행은 본문을 이벤트에서 받지만 `push` 실행에는 본문이 없다. 그래서 같은
|
|
142
|
+
# HEAD 에 push 실행만 빨갛고 pull_request 실행은 초록인 두 판정이 났다(#1095 · #1103).
|
|
143
|
+
# 🟥 조회 실패는 «PR 없음» 이 아니다 → rc=10(빨강). PR 이 정말 없으면 커밋 메시지만 본다 —
|
|
144
|
+
# 그때 마커가 없으면 아래 4 가 rc=1 로 막는다. 정본 기록면은 여전히 커밋 메시지다(:172 처방).
|
|
145
|
+
if [ -z "$BODY_FILE" ] && [ "${RMG_PR_LOOKUP:-0}" = "1" ]; then
|
|
146
|
+
GH_BIN="${RMG_GH:-gh}"
|
|
147
|
+
if [ -z "${RMG_REPO:-}" ] || [ -z "$_h" ]; then
|
|
148
|
+
say "❌ HARNESS-ERROR — PR 조회에 필요한 값이 없다(RMG_REPO='${RMG_REPO:-}' · sha='$_h')."
|
|
149
|
+
exit 10
|
|
150
|
+
fi
|
|
151
|
+
LOOKUP_DIR=$(mktemp -d 2>/dev/null) || { say "❌ HARNESS-ERROR — 임시 폴더를 못 만든다"; exit 10; }
|
|
152
|
+
if ! "$GH_BIN" api "repos/$RMG_REPO/commits/$_h/pulls" > "$LOOKUP_DIR/pulls.json" 2> "$LOOKUP_DIR/err.txt"; then
|
|
153
|
+
say "❌ HARNESS-ERROR — 커밋 $_h 의 PR 조회가 실패했다:"
|
|
154
|
+
sed 's/^/ /' "$LOOKUP_DIR/err.txt" | head -5
|
|
155
|
+
say " 🟥 조회 실패를 «PR 없음» 으로 읽지 않는다. 다시 돌리거나 커밋 메시지에 마커를 실어라."
|
|
156
|
+
rm -rf "$LOOKUP_DIR"; exit 10
|
|
157
|
+
fi
|
|
158
|
+
# 이 채널(head ref)의 PR 만 받는다 — 같은 커밋을 품은 남의 PR 본문으로 통과하지 않게.
|
|
159
|
+
# head 레포까지 맞춘다 — 같은 브랜치 이름의 포크 PR 본문으로 통과하지 않게(codex R1).
|
|
160
|
+
if ! python3 - "$LOOKUP_DIR/pulls.json" "$CHANNEL_NAME" "$LOOKUP_DIR/body.txt" "$RMG_REPO" > "$LOOKUP_DIR/n.txt" 2>> "$LOOKUP_DIR/err.txt" <<'PY'
|
|
161
|
+
import json, sys
|
|
162
|
+
src, ref, out, repo = sys.argv[1:5]
|
|
163
|
+
data = json.load(open(src, encoding="utf-8"))
|
|
164
|
+
if not isinstance(data, list):
|
|
165
|
+
raise SystemExit("not a list")
|
|
166
|
+
bodies = []
|
|
167
|
+
for p in data:
|
|
168
|
+
# a malformed entry is an unreadable answer, not «no PR» (codex R1)
|
|
169
|
+
h = p.get("head") if isinstance(p, dict) else None
|
|
170
|
+
r = h.get("repo") if isinstance(h, dict) else None
|
|
171
|
+
if not (isinstance(h, dict) and isinstance(h.get("ref"), str)
|
|
172
|
+
and isinstance(r, dict) and isinstance(r.get("full_name"), str)):
|
|
173
|
+
raise SystemExit("malformed PR entry (head.ref / head.repo.full_name)")
|
|
174
|
+
if h["ref"] == ref and r["full_name"] == repo:
|
|
175
|
+
bodies.append(p.get("body") or "")
|
|
176
|
+
open(out, "w", encoding="utf-8").write("\n".join(bodies))
|
|
177
|
+
print(len(bodies))
|
|
178
|
+
PY
|
|
179
|
+
then
|
|
180
|
+
say "❌ HARNESS-ERROR — PR 조회 응답을 못 읽는다:"
|
|
181
|
+
sed 's/^/ /' "$LOOKUP_DIR/err.txt" | head -5
|
|
182
|
+
rm -rf "$LOOKUP_DIR"; exit 10
|
|
183
|
+
fi
|
|
184
|
+
NPR=$(cat "$LOOKUP_DIR/n.txt")
|
|
185
|
+
if [ "${NPR:-0}" -gt 0 ] 2>/dev/null; then
|
|
186
|
+
BODY_FILE="$LOOKUP_DIR/body.txt"
|
|
187
|
+
say "🔎 push 실행: 커밋 $_h 의 PR($CHANNEL_NAME) ${NPR} 개 본문을 API 로 읽었다."
|
|
188
|
+
else
|
|
189
|
+
say "🔎 push 실행: 커밋 $_h 를 품은 '$CHANNEL_NAME' PR 이 없다 — 커밋 메시지만 본다."
|
|
190
|
+
fi
|
|
191
|
+
fi
|
|
192
|
+
|
|
137
193
|
# ── 3. 기록면 = 커밋 메시지 (+ 선택적 PR 본문) ────────────────────────────────
|
|
138
194
|
RECORD=$(git log --format='%B' "$BASE_REF".."$HEAD_REF" 2>/dev/null)
|
|
139
195
|
if [ -n "$BODY_FILE" ] && [ -r "$BODY_FILE" ]; then
|
package/scripts/selfcheck.sh
CHANGED
|
@@ -1183,10 +1183,16 @@ for _pair in \
|
|
|
1183
1183
|
"scripts/probe_live_eval_lib.py|scripts/test_live_eval_transitions_lanes.sh" \
|
|
1184
1184
|
"scripts/correction_moments.py|scripts/test_correction_moments_lanes.sh" \
|
|
1185
1185
|
"scripts/probe_live_eval_lib.py|scripts/test_live_eval_construct_lanes.sh" \
|
|
1186
|
+
"scripts/live_eval_trace.py|scripts/test_live_eval_trace_lanes.sh" \
|
|
1187
|
+
"scripts/probe_live_eval_lib.py|scripts/test_live_eval_trace_lanes.sh" \
|
|
1188
|
+
"scripts/sim_isolated_run.sh|scripts/test_live_eval_trace_lanes.sh" \
|
|
1186
1189
|
`# 무인 자체개발 루프(2026-11-04, 운영자 상시 요청). 자동 머지 등급은 모델이 아니라 경로 허용 목록이 정한다 — 빈 목록은 AUTO 가 아니라 HARNESS-ERROR(실측: 가드를 지우면 빈 목록이 AUTO 로 통과).` \
|
|
1187
1190
|
"scripts/selfdev_merge_tier.sh|scripts/test_selfdev_merge_tier_lanes.sh" \
|
|
1188
1191
|
"scripts/selfdev_queue.py|scripts/test_selfdev_queue_lanes.sh" \
|
|
1189
1192
|
"scripts/ablation_nominate.py|scripts/test_ablation_nominate_lanes.sh" \
|
|
1193
|
+
"scripts/ablation_verdict.py|scripts/test_ablation_verdict_lanes.sh" \
|
|
1194
|
+
`# 빌더 카드 파일 역할 4값(2026-11-15, FH-6). 디스패치 뒤 바뀐 파일 ∩ protected = ∅ — protected 를 안 적은 카드는 통과가 아니라 HARNESS-ERROR.` \
|
|
1195
|
+
"scripts/builder_card_files_check.py|scripts/test_builder_card_files_lanes.sh" \
|
|
1190
1196
|
`# 리스 기록 채널(2026-11-07). 세션은 초안, 기록은 운영자 — 에이전트 셸 거부 · 코드 불일치 무기록 · 원자적 교체.` \
|
|
1191
1197
|
"scripts/lease_line_apply.sh|scripts/test_lease_line_apply_lanes.sh" \
|
|
1192
1198
|
`# 공유 세션 장부(2026-11-11 시범). 실무 세션이 쓰고 루트가 읽는다 — 안 적은 세션은 NOT-WRITTEN, 깨진 줄은 MALFORMED.` \
|
|
@@ -1293,6 +1299,7 @@ for _pair in \
|
|
|
1293
1299
|
"scripts/stale_clone_guard.sh|scripts/test_stale_clone_guard_lanes.sh" \
|
|
1294
1300
|
"scripts/proposal_hook.sh|scripts/test_proposal_hook_lanes.sh" \
|
|
1295
1301
|
"plugins/fh-commons/skills/ko-tech-writer/SKILL.md|scripts/test_ko_tech_writer_lanes.sh" \
|
|
1302
|
+
"plugins/fh-meta/skills/meta-prompt-builder/SKILL.md|scripts/test_meta_prompt_restate_lanes.sh" \
|
|
1296
1303
|
"scripts/absorption_queue.py|scripts/test_absorption_queue_lanes.sh" \
|
|
1297
1304
|
"scripts/catch_tally.py|scripts/test_catch_tally_lanes.sh" \
|
|
1298
1305
|
"scripts/shell_name_boundary_scan.sh|scripts/test_name_boundary_locale_lanes.sh" \
|
|
@@ -528,6 +528,22 @@ if [ -f "$FC" ]; then
|
|
|
528
528
|
fi
|
|
529
529
|
fi
|
|
530
530
|
|
|
531
|
+
# ⑤-done-anchor (RECORD-ONLY — never sets FAIL, 2026-11-14). A «완료/done» line is a claim about the
|
|
532
|
+
# world handed to the next session. arXiv:2611.14654 measured what a tidied record costs the reader:
|
|
533
|
+
# an agent's own «completed» action next to an error still in the world lowered recovery 50% → 44%,
|
|
534
|
+
# while a truthful note beside the preserved error raised it 51% → 66% (vs a matched neutral note).
|
|
535
|
+
# This line checks only a property of the record — does each done-line carry a world anchor (commit
|
|
536
|
+
# sha · #PR · run id · file path · URL) — never whether the work is actually done.
|
|
537
|
+
if [ -f "$FC" ]; then
|
|
538
|
+
_DONE_RE='완료|[Dd]one|DONE|[Cc]losed'
|
|
539
|
+
_ANCHOR_RE='[0-9a-f]{7,40}|#[0-9]+|[0-9]{8,}|[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+|[A-Za-z0-9_-]+\.(md|sh|py|js|json|yml)|https?://'
|
|
540
|
+
_bare=$(grep -E "$_DONE_RE" "$FC" | grep -vE '^[[:space:]]*#' | grep -vcE "$_ANCHOR_RE")
|
|
541
|
+
if [ "${_bare:-0}" -gt 0 ]; then
|
|
542
|
+
echo "ⓘ ⑤-done-anchor ${_bare} «완료» line(s) in fh_completed_${TODAY}.md name no commit · PR · file (record only) — pair each with its world state, and say what is still unresolved:"
|
|
543
|
+
grep -E "$_DONE_RE" "$FC" | grep -vE '^[[:space:]]*#' | grep -vE "$_ANCHOR_RE" | head -3 | cut -c1-140 | sed 's/^/ /'
|
|
544
|
+
fi
|
|
545
|
+
fi
|
|
546
|
+
|
|
531
547
|
# ④-b npm freshness — files[] assets changed since last version tag → republish owed.
|
|
532
548
|
# Patterns are NARROWED to the actually-shipped subpaths (package.json files[]): knowledge/ ships only
|
|
533
549
|
# shared/{harness-core,dialogue,rules}; docs/ ships only {codex-compat,CONTRIBUTING,pillars}. A broad
|
|
@@ -314,7 +314,7 @@ _PYEOF
|
|
|
314
314
|
|
|
315
315
|
BASE_REF=""; BASE_SHA=""
|
|
316
316
|
ARM=""; REPS=1; PROMPT=""; MODE="observe"; MODEL="sonnet"; TIMEOUT=900; OUTDIR=""; NOHARNESS=0; SETUP=""; EXTRA=""
|
|
317
|
-
TURNS=""; NORESUME=0
|
|
317
|
+
TURNS=""; NORESUME=0; TRACE=0
|
|
318
318
|
SETSRC=""; SETFILE=""; PERMMODE=""; ADDWRAP=0 # §CONSUMER SURFACE — never inherited from the env (codex R1)
|
|
319
319
|
_needval() { [ "$#" -ge 2 ] || { echo "FAIL: $1 needs a value" >&2; exit 2; }; }
|
|
320
320
|
while [ $# -gt 0 ]; do
|
|
@@ -334,6 +334,7 @@ while [ $# -gt 0 ]; do
|
|
|
334
334
|
--mcp-config) MCPCFG="${2:-}"; shift 2 ;; # the ONLY MCP servers an arm may see (see MCP ISOLATION). Default: none.
|
|
335
335
|
--turns) TURNS="${2:-}"; shift 2 ;; # MULTI-TURN: one turn per line. See §MULTI-TURN.
|
|
336
336
|
--no-resume) NORESUME=1; shift ;; # CONTROL arm for --turns:each turn is a fresh session. See §MULTI-TURN.
|
|
337
|
+
--trace) TRACE=1; shift ;; # §TRACE: keep the event stream (tool calls + init tool list). Single-shot only.
|
|
337
338
|
--setting-sources) _needval "$@"; SETSRC="$2"; [ -n "$SETSRC" ] || { echo "FAIL: --setting-sources is empty" >&2; exit 2; }; shift 2 ;; # §CONSUMER SURFACE — e.g. project,local
|
|
338
339
|
--settings) _needval "$@"; SETFILE="$2"; [ -n "$SETFILE" ] || { echo "FAIL: --settings is empty" >&2; exit 2; }; shift 2 ;; # §CONSUMER SURFACE — permission file
|
|
339
340
|
--permission-mode) _needval "$@"; PERMMODE="$2"
|
|
@@ -343,6 +344,7 @@ while [ $# -gt 0 ]; do
|
|
|
343
344
|
*) echo "unknown flag: $1" >&2; exit 2 ;;
|
|
344
345
|
esac
|
|
345
346
|
done
|
|
347
|
+
if [ "$TRACE" -eq 1 ] && [ -n "$TURNS" ]; then echo "FAIL: --trace is single-shot only (refused with --turns, never silently ignored)" >&2; exit 2; fi
|
|
346
348
|
# ── §CONSUMER SURFACE (2026-11-10, AQ-20261110-6) ───────────────────────────────────────────
|
|
347
349
|
# WHY: the blind harness-birth test (branch claude/blind-birth-test-092883, its fixtures folder
|
|
348
350
|
# blind_birth_2026-11-10 — not on main when this landed) needed an arm that
|
|
@@ -685,7 +687,7 @@ for r in $(seq 1 "$REPS"); do
|
|
|
685
687
|
# A reused --out must not carry the previous run's budget record into a rep that fails before
|
|
686
688
|
# writing its own (clone failure `continue`s first) — a stale `ended_at_cap=no` would be read as
|
|
687
689
|
# this run's. Same for the per-turn table the budget line reads.
|
|
688
|
-
rm -f "$OUTDIR/${ARM}_r${r}.meta.tsv" "$OUTDIR/${ARM}_r${r}.turns.tsv"
|
|
690
|
+
rm -f "$OUTDIR/${ARM}_r${r}.meta.tsv" "$OUTDIR/${ARM}_r${r}.turns.tsv" "$OUTDIR/${ARM}_r${r}.stream.jsonl" "$OUTDIR/${ARM}_r${r}.tools.txt"
|
|
689
691
|
# Each clone gets its OWN parent directory. Siblings under one parent are visible to `../`,
|
|
690
692
|
# and that is not hypothetical: an arm measured 2026-08-29 scanned its parent for mappable
|
|
691
693
|
# projects and reported finding "iso_A, door_CTRL" — the other arms' work dirs. Content stayed
|
|
@@ -869,6 +871,19 @@ for r in $(seq 1 "$REPS"); do
|
|
|
869
871
|
# adds a path, it does not modify the one every existing probe already runs on.
|
|
870
872
|
fh_run_turns "$r"
|
|
871
873
|
rc=$?
|
|
874
|
+
elif [ "$TRACE" -eq 1 ]; then
|
|
875
|
+
# §TRACE (2026-11-14, FH-3) — same argv plus a stream format, so the scorer can read what the
|
|
876
|
+
# session DID (tool calls) and which tool surface it had (init event). The .txt keeps the shape
|
|
877
|
+
# every scorer already reads. A stream with no result event is rc 3, never an empty answer.
|
|
878
|
+
( cd "$WORK" && fh_timeout "$TIMEOUT" claude -p "$PROMPT" \
|
|
879
|
+
--model "$MODEL" "${TOOLS[@]}" ${MCPARGS[@]+"${MCPARGS[@]}"} \
|
|
880
|
+
${SURFREP[@]+"${SURFREP[@]}"} --output-format stream-json --verbose \
|
|
881
|
+
< /dev/null 2>"$OUTDIR/${ARM}_r${r}.stderr.txt" ) > "$OUTDIR/${ARM}_r${r}.stream.jsonl"
|
|
882
|
+
rc=$?
|
|
883
|
+
python3 "$(dirname "$0")/live_eval_trace.py" extract "$OUTDIR/${ARM}_r${r}.stream.jsonl" \
|
|
884
|
+
"$OUTDIR/${ARM}_r${r}.txt" "$OUTDIR/${ARM}_r${r}.tools.txt"
|
|
885
|
+
_xrc=$?
|
|
886
|
+
[ "$rc" -eq 0 ] && [ "$_xrc" -ne 0 ] && rc=3
|
|
872
887
|
else
|
|
873
888
|
( cd "$WORK" && fh_timeout "$TIMEOUT" claude -p "$PROMPT" \
|
|
874
889
|
--model "$MODEL" "${TOOLS[@]}" ${MCPARGS[@]+"${MCPARGS[@]}"} \
|
|
@@ -11,20 +11,46 @@
|
|
|
11
11
|
# before the first git invocation. Readers are included on purpose: under an exported GIT_DIR a
|
|
12
12
|
# read-only lane inspects the wrong repo and reports on it — a wrong answer, not just a leak.
|
|
13
13
|
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
14
|
+
# SEEN since 2026-11-14: git captured into a variable (`G=$(command -v git)`, `G=/usr/bin/git`) and a
|
|
15
|
+
# guard line inside a heredoc body (not counted). NOT SEEN (named residuals): git reached through
|
|
16
|
+
# indirection the assignment regex does not name (`eval`, arrays, a function wrapping git), and a guard
|
|
17
|
+
# in an unexecuted branch (`if false; then . …; fi`) — the scan reads lines, not control flow.
|
|
18
|
+
# Known over-block (fail-closed, red not green): a quoted `"<<EOF"` in text opens heredoc state, so a
|
|
19
|
+
# real guard right after it is not counted until a line equal to EOF appears. The heredoc tracker is a
|
|
20
|
+
# line scanner, not a shell parser: two codex rounds each found new delimiter shapes (R1 numeric ·
|
|
21
|
+
# multiple; R2 tab strip · `EOF-X`), all fixed with fixtures C15–C17; further shapes are this residual.
|
|
16
22
|
#
|
|
17
23
|
# SUBJECT: the scan below, run over the live scripts/ directory (L-live) and over planted fixtures
|
|
18
24
|
# (calibration). Revert probe: delete the guard line from any one lane → L-live goes red naming it.
|
|
19
25
|
. "$(dirname "${BASH_SOURCE[0]}")/fixture_guard_lib.sh" # scrub inherited GIT_* env first (#1088)
|
|
20
26
|
set -u
|
|
27
|
+
SELF="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}")"
|
|
21
28
|
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
|
22
|
-
pass=0; fail=0
|
|
29
|
+
pass=0; fail=0; skipped=0
|
|
30
|
+
sk() { skipped=$((skipped+1)); echo " SKIP $1"; }
|
|
23
31
|
chk() { if [ "$1" -eq 0 ]; then pass=$((pass+1)); echo " PASS $2"; else fail=$((fail+1)); echo " FAIL $2"; fi; }
|
|
24
32
|
|
|
25
33
|
GIT_RE='(^|[^A-Za-z0-9_.-])(/[A-Za-z0-9_./-]*/)?"?git"?[[:space:]]+(-[A-Za-z-]|[a-z])'
|
|
26
34
|
SRC_RE='^[[:space:]]*(\.|source)[[:space:]]+("[^"#]*("[^"#]*"[^"#]*)*fixture_guard_lib\.sh"|[^[:space:]"#]*fixture_guard_lib\.sh)[[:space:]]*(#.*)?$'
|
|
27
35
|
|
|
36
|
+
# git captured into a variable (`G=git`, `G=/usr/bin/git`, `G=$(command -v git)`, `$(which git)`): the
|
|
37
|
+
# assignment line counts as the first git reference, so a lane that only ever runs "$G" is in scope.
|
|
38
|
+
VAR_RE='^[[:space:]]*(export[[:space:]]+|local[[:space:]]+)?[A-Za-z_][A-Za-z0-9_]*=("|'"'"')?((/[A-Za-z0-9_./-]*/)?git|\$\((command -v|which)[[:space:]]+git\))("|'"'"')?([[:space:];]|$)'
|
|
39
|
+
# guard_line <file> → line number of the first guard source line that is NOT inside a heredoc body
|
|
40
|
+
# (a `. …fixture_guard_lib.sh` written into a here-document is data for another file, not a guard here).
|
|
41
|
+
guard_line() {
|
|
42
|
+
SRC_RE="$SRC_RE" awk 'BEGIN { re = ENVIRON["SRC_RE"]; np = 0; qi = 0 }
|
|
43
|
+
qi < np { t = $0; if (dash[qi]) sub(/^\t+/, "", t); if (t == q[qi]) qi++; next }
|
|
44
|
+
/^[[:space:]]*#/ { next }
|
|
45
|
+
$0 ~ re { print NR; exit }
|
|
46
|
+
{ l = $0; gsub(/<<</, "", l)
|
|
47
|
+
while (match(l, /<<-?[[:space:]]*[^[:space:]<>|&;()]+/)) {
|
|
48
|
+
tag = substr(l, RSTART, RLENGTH); dash[np] = (tag ~ /^<<-/)
|
|
49
|
+
sub(/^<<-?[[:space:]]*/, "", tag); gsub(/["\047\\]/, "", tag)
|
|
50
|
+
q[np++] = tag; l = substr(l, RSTART + RLENGTH) } }
|
|
51
|
+
' "$1"
|
|
52
|
+
}
|
|
53
|
+
|
|
28
54
|
# scan <dir> → prints one line per offending file; exit 0 when none, 1 when any, 2 when nothing scanned
|
|
29
55
|
scan() {
|
|
30
56
|
_n=0; _bad=0; _seen=""
|
|
@@ -33,10 +59,10 @@ scan() {
|
|
|
33
59
|
case "$f" in "$1"/test_*_lanes.sh) case " $_seen " in *" $f "*) continue ;; esac ;; esac
|
|
34
60
|
_seen="${_seen:-} $f"
|
|
35
61
|
case "$f" in */fixture_guard_lib.sh) continue ;; esac
|
|
36
|
-
g="$(grep -nE "$GIT_RE" "$f" | grep -vE '^[0-9]+:[[:space:]]*#' | head -1 | cut -d: -f1)"
|
|
62
|
+
g="$(grep -nE "$GIT_RE|$VAR_RE" "$f" | grep -vE '^[0-9]+:[[:space:]]*#' | head -1 | cut -d: -f1)"
|
|
37
63
|
[ -n "$g" ] || continue
|
|
38
64
|
_n=$((_n+1))
|
|
39
|
-
s="$(
|
|
65
|
+
s="$(guard_line "$f")"
|
|
40
66
|
if [ -z "$s" ]; then echo "UNGUARDED $f (first git call line $g, no fixture_guard_lib.sh source)"; _bad=$((_bad+1))
|
|
41
67
|
elif [ "$s" -gt "$g" ]; then echo "LATE-GUARD $f (guard line $s after first git call line $g)"; _bad=$((_bad+1)); fi
|
|
42
68
|
done
|
|
@@ -70,11 +96,46 @@ out="$(scan "$T/c8")"; rc=$?; [ "$rc" -eq 1 ] && [ "$(printf '%s\n' "$out" | gre
|
|
|
70
96
|
mkdir "$T/c9"; for form in 'git -p status' 'git -C"$d" status' '/usr/bin/git status' '"git" status'; do printf '#!/bin/bash\n%s\n' "$form" > "$T/c9/test_$(printf '%s' "$form" | tr -c 'a-z' _)_lanes.sh"; done
|
|
71
97
|
out="$(scan "$T/c9")"; rc=$?; [ "$rc" -eq 1 ] && [ "$(printf '%s\n' "$out" | grep -c UNGUARDED)" -eq 4 ]; chk $? "C9 git -p · git -C\"…\" · /usr/bin/git · \"git\" are all seen (rc=$rc, codex R2)"
|
|
72
98
|
|
|
99
|
+
# C10: the same file run from a non-git copy (an installed package's shape) must SKIP L-live by name,
|
|
100
|
+
# exit 0, and NOT print a PASS for it. The checkout run below is the opposite arm (L-live measured).
|
|
101
|
+
if [ -z "${FGCOV_INNER:-}" ]; then
|
|
102
|
+
mkdir -p "$T/pkg/scripts"; cp "$SELF" scripts/fixture_guard_lib.sh "$T/pkg/scripts/"
|
|
103
|
+
out="$(cd "$T/pkg" && FGCOV_INNER=1 bash scripts/test_fixture_guard_coverage_lanes.sh 2>&1)"; rc=$?
|
|
104
|
+
[ "$rc" -eq 0 ] && printf '%s\n' "$out" | grep -q '^ SKIP L-live — NOT-APPLICABLE' \
|
|
105
|
+
&& ! printf '%s\n' "$out" | grep -q 'PASS L-live' && printf '%s\n' "$out" | grep -q '1 skipped (not a pass)'
|
|
106
|
+
chk $? "C10 non-git tree (installed package) → L-live SKIPPED by name, not red, not counted as pass (rc=$rc)"
|
|
107
|
+
fi
|
|
108
|
+
|
|
109
|
+
mkdir "$T/c11"; printf '#!/bin/bash\nG=$(command -v git)\n"$G" -C "$d" commit -q\n' > "$T/c11/test_var_lanes.sh"; printf '#!/bin/bash\nREALGIT=/usr/bin/git\n"$REALGIT" status\n' > "$T/c11/test_var2_lanes.sh"
|
|
110
|
+
out="$(scan "$T/c11")"; rc=$?; [ "$rc" -eq 1 ] && [ "$(printf '%s\n' "$out" | grep -c UNGUARDED)" -eq 2 ]; chk $? "C11 git only through a variable (\$(command -v git) · /usr/bin/git) is seen (rc=$rc)"
|
|
111
|
+
mkdir "$T/c12"; printf '#!/bin/bash\n%s\nG=$(command -v git)\n"$G" status\n' "$GUARD" > "$T/c12/test_vok_lanes.sh"
|
|
112
|
+
out="$(scan "$T/c12")"; rc=$?; [ "$rc" -eq 0 ]; chk $? "C12 control: guarded variable lane stays green (rc=$rc)"
|
|
113
|
+
mkdir "$T/c13"; printf '#!/bin/bash\ncat > "$d/x.sh" <<EOF\n%s\nEOF\ngit -C "$d" status\n' "$GUARD" > "$T/c13/test_hd_lanes.sh"
|
|
114
|
+
out="$(scan "$T/c13")"; rc=$?; [ "$rc" -eq 1 ] && printf '%s' "$out" | grep -q 'UNGUARDED.*test_hd_lanes'; chk $? "C13 guard line inside a heredoc body does not count (rc=$rc)"
|
|
115
|
+
mkdir "$T/c14"; printf '#!/bin/bash\ncat > "$d/x.sh" <<'"'"'EOF'"'"'\necho hi\nEOF\n%s\ngit -C "$d" status\n' "$GUARD" > "$T/c14/test_hdok_lanes.sh"
|
|
116
|
+
out="$(scan "$T/c14")"; rc=$?; [ "$rc" -eq 0 ]; chk $? "C14 control: heredoc closes, real guard after it counts (rc=$rc)"
|
|
117
|
+
|
|
118
|
+
mkdir "$T/c15"; printf '#!/bin/bash\ncat <<123\n%s\n123\ngit status\n' "$GUARD" > "$T/c15/test_num_lanes.sh"; printf '#!/bin/bash\ncat <<ONE <<TWO\nfirst\nONE\n%s\nTWO\ngit status\n' "$GUARD" > "$T/c15/test_two_lanes.sh"
|
|
119
|
+
out="$(scan "$T/c15")"; rc=$?; [ "$rc" -eq 1 ] && [ "$(printf '%s\n' "$out" | grep -c UNGUARDED)" -eq 2 ]; chk $? "C15 numeric heredoc delimiter and two heredocs on one line are both tracked (rc=$rc, codex R1)"
|
|
120
|
+
|
|
121
|
+
mkdir "$T/c16"; printf '#!/bin/bash\ncat <<EOF\n\tEOF\n%s\nEOF\ngit status\n' "$GUARD" > "$T/c16/test_tab_lanes.sh"; printf '#!/bin/bash\ncat <<EOF-X\nEOF\n%s\nEOF-X\ngit status\n' "$GUARD" > "$T/c16/test_dash_lanes.sh"
|
|
122
|
+
out="$(scan "$T/c16")"; rc=$?; [ "$rc" -eq 1 ] && [ "$(printf '%s\n' "$out" | grep -c UNGUARDED)" -eq 2 ]; chk $? "C16 tab-prefixed terminator closes only <<- heredocs · delimiter EOF-X is not closed by EOF (rc=$rc, codex R2)"
|
|
123
|
+
mkdir "$T/c17"; printf '#!/bin/bash\ncat <<-EOF\n\tbody\n\tEOF\n%s\ngit status\n' "$GUARD" > "$T/c17/test_dok_lanes.sh"
|
|
124
|
+
out="$(scan "$T/c17")"; rc=$?; [ "$rc" -eq 0 ]; chk $? "C17 control: <<- heredoc closed by a tab-indented terminator, guard after it counts (rc=$rc)"
|
|
125
|
+
|
|
73
126
|
# ── live ──
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
127
|
+
# The floor 80 is a CHECKOUT number: an installed npm package ships fewer lanes (70 in 3.41.0), so run
|
|
128
|
+
# there the scan is not wrong, it is measuring a different tree. Same test selfcheck uses for package
|
|
129
|
+
# mode (`[ ! -e .git ]`). Non-git → the live lane is SKIPPED by name and the summary says so; it is
|
|
130
|
+
# never counted as a pass. Calibration C1–C9 above still runs — the scanner itself works anywhere.
|
|
131
|
+
if [ ! -e .git ]; then
|
|
132
|
+
sk "L-live — NOT-APPLICABLE: not a git checkout (installed package mode); the floor 80 counts the checkout's lanes. Run in a clone to measure. Not a pass."
|
|
133
|
+
else
|
|
134
|
+
out="$(scan scripts)"; rc=$?
|
|
135
|
+
printf '%s\n' "$out" | grep -vE '^SCANNED' | sed 's/^/ /'
|
|
136
|
+
n="$(printf '%s\n' "$out" | sed -n 's/^SCANNED //p')"
|
|
137
|
+
[ "$rc" -eq 0 ] && [ "${n:-0}" -ge 80 ]; chk $? "L-live every git-calling lane sources the guard first (scanned ${n:-0}, floor 80 — measured 86 on 2026-11-13; a sharp drop means the scan regex broke)"
|
|
138
|
+
fi
|
|
78
139
|
|
|
79
|
-
echo "fixture-guard coverage lanes: $pass passed, $fail failed"
|
|
140
|
+
echo "fixture-guard coverage lanes: $pass passed, $fail failed$( [ "$skipped" -gt 0 ] && printf ', %s skipped (not a pass)' "$skipped")"
|
|
80
141
|
[ "$fail" -eq 0 ]
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Lanes for live_eval_trace.py + the behave:/inventory layer in probe_live_eval_lib.score_run (FH-3).
|
|
3
|
+
# Fixtures carry the event keys a real `claude -p --output-format stream-json --verbose` run emits
|
|
4
|
+
# (system/init tools+mcp_servers · assistant message.content[].tool_use · result) — checked against a
|
|
5
|
+
# recorded stream on the author machine; set LIVE_TRACE_REAL=<file.jsonl> to re-check that shape (TR0).
|
|
6
|
+
# TR1 extract: result text + init inventory; a stream with no result event → rc 3 and empty text
|
|
7
|
+
# TR2 the calibration PAIR: «did it» (Read CATALOG.md) PASS/BEHAVIOUR · «said it» (names CATALOG, no call) FAIL
|
|
8
|
+
# TR3 first_read is order: CATALOG.md read second → FAIL
|
|
9
|
+
# TR4 control arm does the action too → UNCALIBRATED (cannot discriminate)
|
|
10
|
+
# TR5 no trace on disk → text verdict kept, scored_by=MENTION-ONLY, counted in mention_only_pass
|
|
11
|
+
# TR6 arms with different tool/MCP lists (82 vs 24) → INVALID-COMPARISON, overall has no pass_rate
|
|
12
|
+
# TR7 a malformed behave: spec → UNCALIBRATED with BAD-BEHAVE, never a silent text-only pass
|
|
13
|
+
# TR8 the runner refuses --trace with --turns (rc 2), never ignores it
|
|
14
|
+
# TR13 ablation_calibrate.sh (direct claude -p measurement path) pins MCP in every arm
|
|
15
|
+
# TR9 revert probe: a scorer without the «said, not done → FAIL» line turns TR2 red
|
|
16
|
+
set -u
|
|
17
|
+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
18
|
+
LIB="${LIVE_EVAL_LIB_DIR:-$HERE}"
|
|
19
|
+
pass=0; fail=0; ok(){ pass=$((pass+1)); echo " ✅ $1"; }; bad(){ fail=$((fail+1)); echo " ❌ $1"; }
|
|
20
|
+
T="$(mktemp -d)"; trap 'rm -rf "$T"' EXIT
|
|
21
|
+
|
|
22
|
+
python3 "$HERE/live_eval_trace.py" extract /dev/null /dev/null /dev/null >/dev/null 2>&1; [ $? -eq 3 ] \
|
|
23
|
+
&& ok "TR0 the shipped file runs by its own path (empty stream → rc 3)" || bad "TR0 direct run"
|
|
24
|
+
if [ -n "${LIVE_TRACE_REAL:-}" ]; then
|
|
25
|
+
r=$(python3 "$HERE/live_eval_trace.py" extract "$LIVE_TRACE_REAL" "$T/real.txt" "$T/real.tools" ; echo "rc=$?")
|
|
26
|
+
grep -q '^tools=.*Read' "$T/real.tools" && [ -s "$T/real.txt" ] && echo " ℹ️ TR0b real stream shape read ($r)" \
|
|
27
|
+
|| echo " ⚠️ TR0b real stream NOT read ($r) — fixtures may not match the real shape"
|
|
28
|
+
else
|
|
29
|
+
echo " ℹ️ TR0b real-shape re-check UNMEASURED this run (LIVE_TRACE_REAL unset) — not a pass"
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
# fixture writer: ev <file> <tools csv> <mcp csv> <result text> [ToolName=path ...]
|
|
33
|
+
cat > "$T/mk.py" <<'PY'
|
|
34
|
+
import json, sys
|
|
35
|
+
f, tools, mcp, res = sys.argv[1:5]
|
|
36
|
+
ev = [{"type": "system", "subtype": "hook_started", "hook_name": "SessionStart"}]
|
|
37
|
+
if tools != "NOINIT":
|
|
38
|
+
ev.append({"type": "system", "subtype": "init", "tools": [t for t in tools.split(",") if t],
|
|
39
|
+
"mcp_servers": [{"name": m.split(":")[0], "status": (m.split(":") + ["connected"])[1]} for m in mcp.split(",") if m]})
|
|
40
|
+
# call forms: Read=path · ERR:Read=path (tool_result is_error) · SUB:Read=path (inside a subagent)
|
|
41
|
+
for n, c in enumerate(sys.argv[5:]):
|
|
42
|
+
flag = ""
|
|
43
|
+
if ":" in c.split("=", 1)[0]:
|
|
44
|
+
flag, c = c.split(":", 1)
|
|
45
|
+
name, p = c.split("=", 1)
|
|
46
|
+
key = "pattern" if name == "Glob" else "file_path" if name == "Read" else "path"
|
|
47
|
+
a = {"type": "assistant", "message": {"content": [{"type": "tool_use", "id": "t%d" % n, "name": name, "input": {key: p}}]}}
|
|
48
|
+
if flag == "SUB":
|
|
49
|
+
a["parent_tool_use_id"] = "task0"
|
|
50
|
+
ev.append(a)
|
|
51
|
+
ev.append({"type": "user", "message": {"content": [{"type": "tool_result", "tool_use_id": "t%d" % n, "is_error": flag == "ERR"}]}})
|
|
52
|
+
ev.append({"type": "result", "subtype": "success", "result": res})
|
|
53
|
+
open(f, "w").write("".join(json.dumps(e, ensure_ascii=False) + "\n" for e in ev))
|
|
54
|
+
PY
|
|
55
|
+
mk(){ python3 "$T/mk.py" "$@"; }
|
|
56
|
+
|
|
57
|
+
mk "$T/a.jsonl" "Read,Grep,Glob" "" "CATALOG says x" Read=CATALOG.md
|
|
58
|
+
python3 "$HERE/live_eval_trace.py" extract "$T/a.jsonl" "$T/a.txt" "$T/a.tools"; xrc=$?
|
|
59
|
+
printf '%s\n' '{"type":"system","subtype":"init","tools":["Read"]}' > "$T/nores.jsonl"
|
|
60
|
+
python3 "$HERE/live_eval_trace.py" extract "$T/nores.jsonl" "$T/n.txt" "$T/n.tools"; nrc=$?
|
|
61
|
+
[ $xrc -eq 0 ] && [ "$(cat "$T/a.txt")" = "CATALOG says x" ] && grep -qx 'tools=Glob,Grep,Read | mcp=' "$T/a.tools" \
|
|
62
|
+
&& [ $nrc -eq 3 ] && [ ! -s "$T/n.txt" ] \
|
|
63
|
+
&& ok "TR1 extract writes result + inventory; no result event → rc 3, empty text" \
|
|
64
|
+
|| bad "TR1 xrc=$xrc nrc=$nrc txt=$(cat "$T/a.txt") tools=$(cat "$T/a.tools")"
|
|
65
|
+
|
|
66
|
+
# run_root builder: build <root> <probe> <reps> <primary-spec|-> <control-spec|-> ; spec = "tools|mcp|text|calls..."
|
|
67
|
+
build(){ local root="$1" pid="$2" reps="$3" ps="$4" cs="$5" i arm spec
|
|
68
|
+
mkdir -p "$root/$pid"
|
|
69
|
+
for i in $(seq 1 "$reps"); do
|
|
70
|
+
for arm in primary control; do
|
|
71
|
+
[ $arm = primary ] && spec="$ps" || spec="$cs"
|
|
72
|
+
IFS='|' read -r tl mc tx calls <<<"$spec"
|
|
73
|
+
printf '%s' "$tx" > "$root/$pid/${arm}_r$i.txt"
|
|
74
|
+
if [ "$tl" != "-" ]; then set -f; mk "$root/$pid/${arm}_r$i.stream.jsonl" "$tl" "$mc" "$tx" $calls; set +f; fi
|
|
75
|
+
done
|
|
76
|
+
done; }
|
|
77
|
+
score(){ python3 - "$LIB" "$1" "$2" "$3" "${4:-}" <<'PY'
|
|
78
|
+
import sys, json; sys.path.insert(0, sys.argv[1]); import probe_live_eval_lib as L
|
|
79
|
+
root, pid, behave, pol = sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5] or 'present'
|
|
80
|
+
spec = {'id': pid, 'polarity': pol, 'expect_re': 'CATALOG'}
|
|
81
|
+
if behave: spec['behave'] = behave
|
|
82
|
+
r = L.score_run([spec], root, [pid], 0.8, 'sonnet', reps=3)
|
|
83
|
+
row = r['rows'][0]
|
|
84
|
+
print(row['verdict'], row['scored_by'], r['overall'], r['pass_rate'], r['mention_only_pass'], r['behaviour_backed'], '|', row['reason'])
|
|
85
|
+
PY
|
|
86
|
+
}
|
|
87
|
+
RT='Read,Grep,Glob'
|
|
88
|
+
build "$T/did" P 3 "$RT||CATALOG has it|Read=CATALOG.md Read=x.md" "$RT||오늘 맑아|"
|
|
89
|
+
build "$T/said" P 3 "$RT||I will read CATALOG.md first|" "$RT||오늘 맑아|"
|
|
90
|
+
d=$(score "$T/did" P 'first_read=CATALOG\.md'); s=$(score "$T/said" P 'first_read=CATALOG\.md')
|
|
91
|
+
[[ "$d" == "PASS BEHAVIOUR PASS 1.0 0 1 "* ]] && [[ "$s" == "FAIL BEHAVIOUR "* ]] \
|
|
92
|
+
&& ok "TR2 pair: did → PASS/BEHAVIOUR · said-only → FAIL (same text pattern hits both)" || bad "TR2 did=[$d] said=[$s]"
|
|
93
|
+
|
|
94
|
+
build "$T/order" P 3 "$RT||CATALOG has it|Grep=knowledge Read=CATALOG.md" "$RT||오늘 맑아|"
|
|
95
|
+
o=$(score "$T/order" P 'first_read=CATALOG\.md'); o2=$(score "$T/order" P 'read=CATALOG\.md')
|
|
96
|
+
[[ "$o" == FAIL* ]] && [[ "$o2" == PASS* ]] && ok "TR3 first_read reads order (second → FAIL; read= → PASS)" || bad "TR3 first=[$o] any=[$o2]"
|
|
97
|
+
|
|
98
|
+
build "$T/ctl" P 3 "$RT||CATALOG has it|Read=CATALOG.md" "$RT||오늘 맑아|Read=CATALOG.md"
|
|
99
|
+
c=$(score "$T/ctl" P 'read=CATALOG\.md')
|
|
100
|
+
[[ "$c" == "UNCALIBRATED "* ]] && ok "TR4 control does the action → UNCALIBRATED" || bad "TR4 [$c]"
|
|
101
|
+
|
|
102
|
+
build "$T/old" P 3 "-||CATALOG has it|" "-||오늘 맑아|"
|
|
103
|
+
m=$(score "$T/old" P 'read=CATALOG\.md'); m0=$(score "$T/old" P '')
|
|
104
|
+
[[ "$m" == "PASS MENTION-ONLY PASS 1.0 1 0 "* ]] && [[ "$m0" == "PASS MENTION-ONLY "* ]] \
|
|
105
|
+
&& ok "TR5 no trace → text verdict kept, labelled MENTION-ONLY, counted as mention-only" || bad "TR5 [$m] [$m0]"
|
|
106
|
+
|
|
107
|
+
build "$T/inv" P 3 "Read,Grep,Glob|drive,wiki|CATALOG has it|Read=CATALOG.md" "$RT||오늘 맑아|"
|
|
108
|
+
v=$(score "$T/inv" P 'read=CATALOG\.md')
|
|
109
|
+
[[ "$v" == "INVALID-COMPARISON MENTION-ONLY INVALID-COMPARISON None "* || "$v" == "INVALID-COMPARISON BEHAVIOUR INVALID-COMPARISON None "* ]] && [[ "$v" == *"different tool/MCP lists"* ]] \
|
|
110
|
+
&& ok "TR6 arms with different tool/MCP lists → INVALID-COMPARISON, no pass_rate" || bad "TR6 [$v]"
|
|
111
|
+
|
|
112
|
+
b=$(score "$T/did" P 'reads=CATALOG')
|
|
113
|
+
[[ "$b" == "UNCALIBRATED "* ]] && [[ "$b" == *BAD-BEHAVE* ]] && ok "TR7 malformed behave: → UNCALIBRATED/BAD-BEHAVE" || bad "TR7 [$b]"
|
|
114
|
+
|
|
115
|
+
tout=$(bash "$HERE/sim_isolated_run.sh" --arm primary --prompt x --trace --turns 'a' 2>&1); trc=$?
|
|
116
|
+
[ $trc -eq 2 ] && [[ "$tout" == *"--trace is single-shot only"* ]] && ok "TR8 runner refuses --trace with --turns (rc 2)" || bad "TR8 rc=$trc $tout"
|
|
117
|
+
|
|
118
|
+
mkdir -p "$T/mut"; cp "$LIB/live_eval_trace.py" "$T/mut/"
|
|
119
|
+
sed 's/^\( *\)v = FAIL # said it, did not do it$/\1pass/' "$LIB/probe_live_eval_lib.py" > "$T/mut/probe_live_eval_lib.py"
|
|
120
|
+
if grep -q 'said it, did not do it' "$T/mut/probe_live_eval_lib.py"; then bad "TR9 mutation did not apply (instrument error, not a pass)"
|
|
121
|
+
else ms=$(LIB="$T/mut" score "$T/said" P 'first_read=CATALOG\.md')
|
|
122
|
+
[[ "$ms" == PASS* ]] && ok "TR9 revert probe: without the line, said-only scores PASS → TR2 would be red" || bad "TR9 mutant still [$ms]"; fi
|
|
123
|
+
|
|
124
|
+
build "$T/deny" P 3 "$RT||CATALOG has it|ERR:Read=CATALOG.md" "$RT||오늘 맑아|"
|
|
125
|
+
build "$T/sub" P 3 "$RT||CATALOG has it|SUB:Read=CATALOG.md Read=x.md" "$RT||오늘 맑아|"
|
|
126
|
+
build "$T/grp" P 3 "$RT||CATALOG has it|Grep=. Glob=CATALOG.md" "$RT||오늘 맑아|"
|
|
127
|
+
dn=$(score "$T/deny" P 'read=CATALOG\.md'); sb=$(score "$T/sub" P 'read=CATALOG\.md'); gp=$(score "$T/grp" P 'read=CATALOG\.md')
|
|
128
|
+
[[ "$dn" == FAIL* ]] && [[ "$sb" == FAIL* ]] && [[ "$gp" == FAIL* ]] \
|
|
129
|
+
&& ok "TR10 a failed Read, a subagent's Read, and a Glob/Grep-pattern hit are not «read» (codex R1)" || bad "TR10 deny=[$dn] sub=[$sb] glob=[$gp]"
|
|
130
|
+
build "$T/noinit" P 3 "NOINIT||CATALOG has it|Read=CATALOG.md" "$RT||오늘 맑아|"
|
|
131
|
+
build "$T/mstat" P 3 "$RT|drive:connected|CATALOG has it|Read=CATALOG.md" "$RT|drive:failed|오늘 맑아|"
|
|
132
|
+
ni=$(score "$T/noinit" P 'read=CATALOG\.md'); ms2=$(score "$T/mstat" P 'read=CATALOG\.md')
|
|
133
|
+
[[ "$ni" == INVALID-COMPARISON* ]] && [[ "$ms2" == INVALID-COMPARISON* ]] \
|
|
134
|
+
&& ok "TR11 one arm without init, or MCP connected vs failed → INVALID-COMPARISON (codex R1)" || bad "TR11 noinit=[$ni] status=[$ms2]"
|
|
135
|
+
build "$T/half" P 3 "$RT||CATALOG has it|Read=CATALOG.md" "-||오늘 맑아|"
|
|
136
|
+
hf=$(score "$T/half" P 'read=CATALOG\.md')
|
|
137
|
+
[[ "$hf" == UNCALIBRATED* ]] && [[ "$hf" == *TRACE-INCOMPLETE* ]] && ok "TR12 a control arm with no trace while primary has one → UNCALIBRATED, not text-only PASS" || bad "TR12 [$hf]"
|
|
138
|
+
|
|
139
|
+
# TR13 the direct `claude -p` measurement path (not via sim_isolated_run) pins MCP in all three arms.
|
|
140
|
+
# Static check of the argv only — a pin is not proof; the recorded tool list (TR6/TR11) is the defence.
|
|
141
|
+
npin=$(grep -cE '^ (allowlist|denylist|baseline)\) +FLAGS=\(.*--strict-mcp-config' "$HERE/ablation_calibrate.sh")
|
|
142
|
+
[ "$npin" -eq 3 ] && ok "TR13 ablation_calibrate.sh pins MCP (--strict-mcp-config) in all 3 arms" || bad "TR13 pinned arms=$npin/3"
|
|
143
|
+
|
|
144
|
+
[ $pass -eq 14 ] || bad "lane count $pass != 14 — a case did not run"
|
|
145
|
+
echo "live_eval_trace lanes: $pass passed, $fail failed"; [ $fail -eq 0 ]
|