@chrono-meta/fh-gate 3.43.0 → 3.44.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-plugin/marketplace.json +4 -4
- package/AGENTS.md +5 -1
- package/docs/USER_GUIDE.md +95 -0
- package/knowledge/shared/harness-core/governance_engineering_definition.md +16 -0
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +12 -0
- package/knowledge/shared/plugin-catalog/recommended_plugins.md +53 -9
- package/package.json +8 -1
- package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-commons/skills/ko-tech-writer/SKILL.md +47 -12
- package/plugins/fh-commons/skills/ko-tech-writer/SKILL_detail.md +60 -0
- package/plugins/fh-commons/skills/ko-tech-writer/fixtures/sense_negative.md +30 -0
- package/plugins/fh-commons/skills/ko-tech-writer/fixtures/sense_positive.md +56 -0
- package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/CHANGELOG.md +23 -0
- package/plugins/fh-meta/skills/auto-decorrelation/SKILL.md +45 -1
- package/plugins/fh-meta/skills/sim-conductor/SKILL_detail.md +3 -3
- package/plugins/fh-meta/skills/steel-quench/SKILL_detail.md +8 -4
- package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
- package/scripts/agy_launch_guard.sh +49 -0
- package/scripts/agy_remote_run.sh +187 -0
- package/scripts/codex_launch_guard.sh +87 -0
- package/scripts/finding_fleet.sh +35 -2
- package/scripts/finding_verifier.sh +6 -2
- package/scripts/ko_tech_writer_calibrate.py +88 -1
- package/scripts/live_eval_trace.py +23 -4
- package/scripts/prepush_guard_check.sh +33 -20
- package/scripts/probe_live_eval.sh +1 -1
- package/scripts/probe_live_eval_lib.py +7 -5
- package/scripts/selfcheck.sh +51 -2
- package/scripts/session_checklist.py +109 -5
- package/scripts/sidecar_calibrate.sh +10 -2
- package/scripts/sidecar_wait.sh +21 -1
- package/scripts/test_agy_launch_guard_lanes.sh +227 -0
- package/scripts/test_agy_remote_run_lanes.sh +228 -0
- package/scripts/test_codex_launch_guard_lanes.sh +138 -0
- package/scripts/test_finding_pipeline_lanes.sh +6 -2
- package/scripts/test_live_eval_trace_lanes.sh +54 -8
- package/scripts/test_preprep_speech_coach_lanes.sh +18 -2
- package/scripts/test_prepush_guard_failure_visibility_lanes.sh +152 -0
- package/scripts/test_session_checklist_lanes.sh +205 -0
- package/scripts/test_sidecar_calibrate_lanes.sh +4 -0
- package/scripts/test_sidecar_wait_stdin.sh +18 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# codex_launch_guard.sh — FH starts codex through here. Lighter than agy_launch_guard.sh: codex is allowed
|
|
3
|
+
# on this machine, but never on company-repo material.
|
|
4
|
+
#
|
|
5
|
+
# WHY. codex `--sandbox read-only` limits writes, not reads: measured 2026-11-16 with canary files, it read
|
|
6
|
+
# paths in its cwd, in another temp folder and in the home directory. Whatever it reads goes to the cloud
|
|
7
|
+
# model. So a codex arm may only be handed public material, and this guard refuses the obvious leak: a
|
|
8
|
+
# prompt, an argument or a working folder that names a configured company-repo root.
|
|
9
|
+
#
|
|
10
|
+
# LIST. Company-repo roots, one absolute path per line, from FH_COMPANY_ROOTS (newline- or ':'-separated)
|
|
11
|
+
# or else the file FH_COMPANY_ROOTS_FILE (default: <repo>/.claude/rules/.company-roots, gitignored; '#'
|
|
12
|
+
# comments and blank lines ignored). No root path appears in any public file.
|
|
13
|
+
#
|
|
14
|
+
# MATCH. A root matches when it appears as a path in the prompt (stdin) or an argument — the root string
|
|
15
|
+
# followed by '/', end of text, or a character that cannot continue a path name — in any of three spellings:
|
|
16
|
+
# as given, its real path, with a leading /private removed (macOS /tmp = /private/tmp), and with $HOME
|
|
17
|
+
# written as '~'. Case-sensitive. The working folder matches when its real path is the root or below it.
|
|
18
|
+
# NOT matched: a relative path, file content pasted without its path, or an encoded path — the guard is a
|
|
19
|
+
# string check, not isolation. Not reached: a caller that starts codex by absolute path around this guard
|
|
20
|
+
# (finding_fleet routes CODEX_BIN and bare `codex` through a PATH shim; an absolute path skips it).
|
|
21
|
+
#
|
|
22
|
+
# UNCONFIGURED. No list, or an empty one: codex runs and the guard prints «CODEX-GUARD: no company roots
|
|
23
|
+
# configured — not checked» on stderr. That is said out loud, never shown as clean.
|
|
24
|
+
#
|
|
25
|
+
# Usage: bash scripts/codex_launch_guard.sh <codex-binary> [codex arguments...] (prompt on stdin)
|
|
26
|
+
# Exit: 3 = refused (codex not started; stderr starts «HARNESS-ERROR: CODEX-REFUSED») · 2 = usage
|
|
27
|
+
# · otherwise codex's own exit code (a codex exit of 3 is told apart by the missing CODEX-REFUSED line)
|
|
28
|
+
set -uo pipefail
|
|
29
|
+
[ $# -ge 1 ] || { echo "usage: codex_launch_guard.sh <codex-binary> [codex arguments...]" >&2; exit 2; }
|
|
30
|
+
_here="$(cd "$(dirname "$0")" && pwd -P)"
|
|
31
|
+
_rootsfile="${FH_COMPANY_ROOTS_FILE:-$_here/../.claude/rules/.company-roots}"
|
|
32
|
+
_tmp="$(mktemp "${TMPDIR:-/tmp}/fh_codex_prompt.XXXXXX")" || { echo "HARNESS-ERROR: codex_launch_guard cannot create a temp file — codex not started" >&2; exit 3; }
|
|
33
|
+
trap 'rm -f "$_tmp"' EXIT
|
|
34
|
+
if [ -t 0 ]; then : > "$_tmp"; else cat > "$_tmp"; fi
|
|
35
|
+
_verdict="$(FH_GUARD_PROMPT="$_tmp" FH_GUARD_ROOTS_FILE="$_rootsfile" python3 - "${@:2}" <<'PY'
|
|
36
|
+
import os, re, sys
|
|
37
|
+
def roots():
|
|
38
|
+
env = os.environ.get("FH_COMPANY_ROOTS")
|
|
39
|
+
if env is not None and env.strip():
|
|
40
|
+
raw = re.split(r"[\n:]", env)
|
|
41
|
+
else:
|
|
42
|
+
try: raw = open(os.environ["FH_GUARD_ROOTS_FILE"], encoding="utf-8").read().splitlines()
|
|
43
|
+
except FileNotFoundError: raw = [] # no list at all: unconfigured, said out loud
|
|
44
|
+
except OSError as e: # a list that exists but cannot be read: refuse
|
|
45
|
+
print("ERROR the company-roots file exists but cannot be read (%s)" % type(e).__name__); sys.exit(0)
|
|
46
|
+
out = []
|
|
47
|
+
for r in raw:
|
|
48
|
+
r = r.strip()
|
|
49
|
+
if r and not r.startswith("#"): out.append(r.rstrip("/"))
|
|
50
|
+
return out
|
|
51
|
+
R = roots()
|
|
52
|
+
if not R:
|
|
53
|
+
print("UNCONFIGURED"); sys.exit(0)
|
|
54
|
+
home = os.path.expanduser("~").rstrip("/")
|
|
55
|
+
def spellings(r):
|
|
56
|
+
s = {r}
|
|
57
|
+
try: s.add(os.path.realpath(r).rstrip("/"))
|
|
58
|
+
except OSError: pass
|
|
59
|
+
for x in list(s):
|
|
60
|
+
if x.startswith("/private/"): s.add(x[len("/private"):])
|
|
61
|
+
if home and (x == home or x.startswith(home + "/")): s.add("~" + x[len(home):])
|
|
62
|
+
return [x for x in s if x]
|
|
63
|
+
pats = []
|
|
64
|
+
for r in R:
|
|
65
|
+
for sp in spellings(r):
|
|
66
|
+
pats.append(re.compile(re.escape(sp) + r"(?=/|$|[^A-Za-z0-9._\-~])"))
|
|
67
|
+
def hit(text): return any(p.search(text) for p in pats)
|
|
68
|
+
where = []
|
|
69
|
+
try: prompt = open(os.environ["FH_GUARD_PROMPT"], encoding="utf-8", errors="replace").read()
|
|
70
|
+
except OSError: print("ERROR cannot read the prompt"); sys.exit(0)
|
|
71
|
+
if hit(prompt): where.append("prompt")
|
|
72
|
+
if any(hit(a) for a in sys.argv[1:]): where.append("argument")
|
|
73
|
+
cwd = os.path.realpath(os.getcwd())
|
|
74
|
+
for r in R:
|
|
75
|
+
rr = os.path.realpath(r)
|
|
76
|
+
if cwd == rr or cwd.startswith(rr.rstrip("/") + "/"): where.append("working folder"); break
|
|
77
|
+
print("REFUSE " + ",".join(where) if where else "OK")
|
|
78
|
+
PY
|
|
79
|
+
)" || _verdict="ERROR the matcher failed"
|
|
80
|
+
case "$_verdict" in
|
|
81
|
+
OK) ;;
|
|
82
|
+
UNCONFIGURED) echo "CODEX-GUARD: no company roots configured — not checked (set FH_COMPANY_ROOTS or $_rootsfile)" >&2 ;;
|
|
83
|
+
REFUSE*) echo "HARNESS-ERROR: CODEX-REFUSED — a company-repo root appears in the ${_verdict#REFUSE }; codex was not started. Send codex public material only." >&2; exit 3 ;;
|
|
84
|
+
*) echo "HARNESS-ERROR: CODEX-REFUSED — codex_launch_guard could not check (${_verdict}); codex was not started." >&2; exit 3 ;;
|
|
85
|
+
esac
|
|
86
|
+
exec 3<"$_tmp"; rm -f "$_tmp"; trap - EXIT
|
|
87
|
+
exec "$@" <&3 3<&-
|
package/scripts/finding_fleet.sh
CHANGED
|
@@ -31,7 +31,40 @@ HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
|
31
31
|
# this file ships in the npm package and a literal home directory is both a leak and wrong on the
|
|
32
32
|
# consumer's machine. Override with FH_CODEX_BIN / FH_AGY_BIN.
|
|
33
33
|
CODEX="${FH_CODEX_BIN:-$(command -v codex 2>/dev/null || echo "$HOME/.npm-global/bin/codex")}"
|
|
34
|
+
# A function named agy (exported into this shell) would outrank PATH and fool `command -v`: drop it first.
|
|
35
|
+
unset -f agy codex 2>/dev/null || true
|
|
34
36
|
AGY="${FH_AGY_BIN:-$(command -v agy 2>/dev/null || echo "$HOME/.local/bin/agy")}"
|
|
37
|
+
# Every agy launch goes through the isolation guard (refuses unless FH_AGY_ISOLATION=container|os-user).
|
|
38
|
+
# How: a shim named `agy` in a private temp dir is put FIRST on PATH, and the fleet token AGY_BIN
|
|
39
|
+
# becomes that shim's path. So a default row, a custom row that writes AGY_BIN (quoted or not, under
|
|
40
|
+
# `timeout`/`env`), and a custom row that calls `agy` by name all reach the guard; and no path chosen by
|
|
41
|
+
# the caller is pasted into the eval'd string (a directory name with `&` or PROMPT_FILE in it cannot
|
|
42
|
+
# break it). Named residual: a row that calls agy by ABSOLUTE path, or resets PATH, skips the shim.
|
|
43
|
+
AGY_GUARD="$HERE/agy_launch_guard.sh"
|
|
44
|
+
# A bare name (FH_AGY_BIN=agy) would resolve back to the shim once PATH is changed: pin it to a path now.
|
|
45
|
+
case "$AGY" in */*) ;; *) AGY="$(command -v -- "$AGY" 2>/dev/null || echo "/nonexistent/$AGY")" ;; esac
|
|
46
|
+
case "$AGY" in */fh_agy_shim.*/agy) AGY="${FH_AGY_REAL:-$AGY}" ;; esac # nested run: keep the real binary
|
|
47
|
+
# codex gets the same shim treatment, through the lighter codex_launch_guard.sh (refuses company-root paths)
|
|
48
|
+
case "$CODEX" in */*) ;; *) CODEX="$(command -v -- "$CODEX" 2>/dev/null || echo "/nonexistent/$CODEX")" ;; esac
|
|
49
|
+
case "$CODEX" in */fh_agy_shim.*/codex) CODEX="${FH_CODEX_REAL:-$CODEX}" ;; esac
|
|
50
|
+
CODEX_GUARD="$HERE/codex_launch_guard.sh"
|
|
51
|
+
AGY_SHIM_DIR="$(mktemp -d /tmp/fh_agy_shim.XXXXXX 2>/dev/null)" && [ -d "$AGY_SHIM_DIR" ] || {
|
|
52
|
+
echo "finding_fleet: cannot create the agy shim directory — refusing to run (agy would be unguarded)" >&2; exit 1; }
|
|
53
|
+
trap 'rm -rf "$AGY_SHIM_DIR"' EXIT
|
|
54
|
+
printf '#!/usr/bin/env bash\nexec bash "$FH_AGY_GUARD_PATH" "$FH_AGY_REAL" "$@"\n' > "$AGY_SHIM_DIR/agy"
|
|
55
|
+
chmod +x "$AGY_SHIM_DIR/agy"
|
|
56
|
+
printf '#!/usr/bin/env bash\nexec bash "$FH_CODEX_GUARD_PATH" "$FH_CODEX_REAL" "$@"\n' > "$AGY_SHIM_DIR/codex"
|
|
57
|
+
chmod +x "$AGY_SHIM_DIR/codex"
|
|
58
|
+
export FH_CODEX_GUARD_PATH="$CODEX_GUARD" FH_CODEX_REAL="$CODEX"
|
|
59
|
+
export FH_AGY_GUARD_PATH="$AGY_GUARD" FH_AGY_REAL="$AGY"
|
|
60
|
+
# The shim must actually run here (a noexec /tmp would make a bare `agy` fall through to the real one):
|
|
61
|
+
# run it once with the marker cleared — it must come back from the guard as a refusal, nothing else.
|
|
62
|
+
_shim_probe="$(FH_AGY_ISOLATION= "$AGY_SHIM_DIR/agy" --version 2>&1 </dev/null)"; _shim_rc=$?
|
|
63
|
+
case "$_shim_probe" in AGY-REFUSED*) _shim_said=1 ;; *) _shim_said=0 ;; esac # no early-exit reader on a pipe
|
|
64
|
+
if [ "$_shim_rc" -ne 3 ] || [ "$_shim_said" -ne 1 ]; then
|
|
65
|
+
echo "finding_fleet: the agy shim did not run (rc=$_shim_rc) — refusing to run (agy would be unguarded)" >&2; exit 1
|
|
66
|
+
fi
|
|
67
|
+
export PATH="$AGY_SHIM_DIR:$PATH"
|
|
35
68
|
|
|
36
69
|
default_fleet() {
|
|
37
70
|
cat <<'EOF'
|
|
@@ -92,7 +125,7 @@ DROPPED: lines. Your assigned area is unchanged: '
|
|
|
92
125
|
run_member_r2() { # $1=family $2=role $3=command $4=target $5=outdir
|
|
93
126
|
local fam="$1" role="$2" cmd="$3" tgt="$4" out="$5"
|
|
94
127
|
local q_codex q_agy q_pf
|
|
95
|
-
q_codex="$(printf '%q' "$
|
|
128
|
+
q_codex="$(printf '%q' "$AGY_SHIM_DIR/codex")"; q_agy="$(printf '%q' "$AGY_SHIM_DIR/agy")"
|
|
96
129
|
cmd="${cmd//CODEX_BIN/$q_codex}"; cmd="${cmd//AGY_BIN/$q_agy}"
|
|
97
130
|
local raw="$out/raw2_${fam}_${role}.txt" pf="$out/prompt2_${fam}_${role}.txt"
|
|
98
131
|
for _p in "$raw" "$pf" "$out/err2_${fam}_${role}.txt" "$out/part2_${fam}_${role}.jsonl" "$out/peer_${fam}_${role}.txt"; do
|
|
@@ -292,7 +325,7 @@ run_member() { # $1=family $2=role $3=command $4=target $5=outdir
|
|
|
292
325
|
# 여기는 bash `eval` 이므로 `printf %q` 가 옳은 도구다(shell=True 로 /bin/sh 에 넘기는
|
|
293
326
|
# finding_pipeline.sh 와는 사정이 다르다 — 거기서는 %q 가 dash 에서 깨져서 argv 로 갔다).
|
|
294
327
|
local q_codex q_agy q_pf
|
|
295
|
-
q_codex="$(printf '%q' "$
|
|
328
|
+
q_codex="$(printf '%q' "$AGY_SHIM_DIR/codex")"; q_agy="$(printf '%q' "$AGY_SHIM_DIR/agy")"
|
|
296
329
|
cmd="${cmd//CODEX_BIN/$q_codex}"; cmd="${cmd//AGY_BIN/$q_agy}"
|
|
297
330
|
local raw="$out/raw_${fam}_${role}.txt" pf="$out/prompt_${fam}_${role}.txt"
|
|
298
331
|
# 🟥 심링크를 통해 쓰면 남의 파일을 덮는다. 그리고 타깃이 심링크면 그 «내용»이 외부로 나간다.
|
|
@@ -20,6 +20,10 @@ set -uo pipefail
|
|
|
20
20
|
|
|
21
21
|
CODEX="${FH_CODEX_BIN:-$(command -v codex 2>/dev/null || echo "$HOME/.npm-global/bin/codex")}"
|
|
22
22
|
AGY="${FH_AGY_BIN:-$(command -v agy 2>/dev/null || echo "$HOME/.local/bin/agy")}"
|
|
23
|
+
# Every agy launch goes through the isolation guard (refuses unless FH_AGY_ISOLATION=container|os-user).
|
|
24
|
+
AGY_GUARD="$(cd "$(dirname "$0")" && pwd)/agy_launch_guard.sh"
|
|
25
|
+
# codex goes through the lighter guard: refused when the prompt, an argument or the cwd names a company root
|
|
26
|
+
CODEX_GUARD="$(cd "$(dirname "$0")" && pwd)/codex_launch_guard.sh"
|
|
23
27
|
|
|
24
28
|
FAMILY=""; TARGET=""; MODE="verify"; KEEP=""
|
|
25
29
|
# 호출자(파이프라인)가 env 로 보존 경로를 줄 수 있다 — 검증 패스의 CLI stderr(토큰 회계)가 여기서 산다.
|
|
@@ -122,9 +126,9 @@ if ! grep -q "===== FILE: $(basename "$TARGET") =====" "$WORK/prompt.txt"; then
|
|
|
122
126
|
fi
|
|
123
127
|
|
|
124
128
|
case "$FAMILY" in
|
|
125
|
-
codex) "$CODEX" exec --sandbox read-only --skip-git-repo-check -m gpt-6-astra \
|
|
129
|
+
codex) bash "$CODEX_GUARD" "$CODEX" exec --sandbox read-only --skip-git-repo-check -m gpt-6-astra \
|
|
126
130
|
-c model_reasoning_effort="high" < "$WORK/prompt.txt" > "$WORK/raw.txt" 2>"$WORK/err.txt" ;;
|
|
127
|
-
gemini) "$AGY" --mode plan --sandbox --model gemini-3.8-flash-high --output-format text --print-timeout 20m \
|
|
131
|
+
gemini) bash "$AGY_GUARD" "$AGY" --mode plan --sandbox --model gemini-3.8-flash-high --output-format text --print-timeout 20m \
|
|
128
132
|
-p "$(cat "$WORK/prompt.txt")" < /dev/null > "$WORK/raw.txt" 2>"$WORK/err.txt" ;;
|
|
129
133
|
*) echo "finding_verifier: unknown family '$FAMILY' (codex|gemini)" >&2; exit 2 ;;
|
|
130
134
|
esac
|
|
@@ -253,6 +253,36 @@ def heading_dense(path, common=None, st=None):
|
|
|
253
253
|
return out
|
|
254
254
|
|
|
255
255
|
|
|
256
|
+
# ── S35 낱말 뜻 흔들림 — (a) 기계 단계: 가벼운 동사·명사의 «모든 등장»을 활용형까지 문맥과 함께 늘어놓는다.
|
|
257
|
+
# 🟥 이 함수는 뜻을 가르지 않는다. 뜻 묶기(b)는 판단이다 — 사람 또는 모델이 낱말마다 등장을 뜻별로 묶고 소수 뜻을 표시한다.
|
|
258
|
+
# 레인(C22)이 재는 것은 «늘어놓기의 재현율»뿐이다: 활용형 픽스처의 모든 줄을 잡는가 · 겹치는 다른 낱말(쓰레기 · 세계 · 재료 …)을 안 잡는가.
|
|
259
|
+
# 출발점(2026-11-16): 정규식 하나가 「쓰던 · 쓰면 · 쓰고 · 쓰되」를 놓쳤다 — 활용형 열거가 이 레인의 핵심이다.
|
|
260
|
+
# 낱말을 늘리려면 픽스처 두 파일에 활용형 줄과 겹치는 낱말 줄을 먼저 넣고, 레인이 초록일 때만 여기에 더한다.
|
|
261
|
+
# 앞 경계 (?<![가-힣]) 때문에 합성어(글쓰기 · 덮어쓰기 · 공작기계)는 안 잡는다 — 알려진 잔여.
|
|
262
|
+
SENSE_WORDS = [
|
|
263
|
+
# 쓰다 = 어간 일치 + 이름 붙인 제외(쓰레기 · 쓰나미 · 쓰러지다 · 쓰라리다 · 쓰다듬다 · 씁쓸). 활용형을 열거하지 않는다 —
|
|
264
|
+
# 열거형은 라운드마다 새 활용형을 놓쳤다(쓰던 → 쓰인 → 쓰였다). 대신 과다 나열(쓸모 · 쓴맛 …)을 받아들이고 (b)가 가른다.
|
|
265
|
+
("쓰다", r"(?<![가-힣])(?:쓰(?!레|나미|러|라리|라린|다듬)|써(?![클머핀드])|썼|씁(?!쓸)|쓴|쓸(?!쓸)|씀)"),
|
|
266
|
+
# 세다 · 재다 = 「세 · 재」로 시작하는 다른 낱말이 너무 많아(세계 · 세션 · 재료 · 재현 …) 어미 첫 음절 목록 + 이름 붙인 제외로 둔다.
|
|
267
|
+
# 이 둘은 열거형이다 — 목록 밖 활용형은 조용히 빠진다(--senses 출력이 그렇게 적는다).
|
|
268
|
+
("세다", r"(?<![가-힣])(?:세(?:다(?!리)|는|어|었|고|면(?!대)|며|서|던|지|도(?!정)|려|되|겠|니|야|거|봤|보|셨|죠|네|든|기로|길)|센(?:다|(?![가-힣]))|셀(?:까|지|(?![가-힣]))|셉|셌)"),
|
|
269
|
+
("재다", r"(?<![가-힣])(?:재(?:다|는|어|었|고(?!품)|면(?!접)|며|서|던|지(?!정|원|급)|도(?!전|입)|려|되|겠|니|야|거(?!래)|봤|보(?!험)|셨|죠|든|기로|길)|잰(?:다|(?![가-힣]))|잴|잽(?!싸)|쟀)"),
|
|
270
|
+
("기계", r"(?<![가-힣])기계"),
|
|
271
|
+
]
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
def sense_hits(path, st=None):
|
|
275
|
+
"""[(낱말, 줄번호, 문맥)] — 펜스 · 그림 블록은 뺀다. 문맥 = 맞은 자리 앞뒤 20자."""
|
|
276
|
+
out = []
|
|
277
|
+
for i, line in scan_lines(path, True, st or Blocks()):
|
|
278
|
+
line = re.sub(r"<!--.*?-->", "", line) # 주석 안 낱말은 독자 본문이 아니다(픽스처의 기대 표지도 주석이다)
|
|
279
|
+
for lemma, pat in SENSE_WORDS:
|
|
280
|
+
for m in re.finditer(pat, line):
|
|
281
|
+
a, b = max(0, m.start() - 20), min(len(line), m.end() + 20)
|
|
282
|
+
out.append((lemma, i, line[a:b].strip()))
|
|
283
|
+
return out
|
|
284
|
+
|
|
285
|
+
|
|
256
286
|
# 함수형 레인 레지스트리: 플래그 -> f(path, common) -> [(키, 줄번호, 종류)]
|
|
257
287
|
FUNC_LANES = {"s7": lambda path, common=None: s7_candidates(path, common),
|
|
258
288
|
"hdens": lambda path, common=None: heading_dense(path)}
|
|
@@ -524,13 +554,42 @@ def scan_main(args):
|
|
|
524
554
|
return 0
|
|
525
555
|
|
|
526
556
|
|
|
557
|
+
def senses_main(args):
|
|
558
|
+
"""--senses FILE — S35 (a) 단계: 낱말별 모든 등장을 줄번호 · 문맥과 함께. 뜻 묶기(b)는 이 출력을 읽는 사람/모델의 몫이다."""
|
|
559
|
+
if len(args) != 1 or args[0].startswith("--"):
|
|
560
|
+
sys.stderr.write("usage: ko_tech_writer_calibrate.py --senses FILE\n")
|
|
561
|
+
return 10
|
|
562
|
+
st = Blocks()
|
|
563
|
+
try:
|
|
564
|
+
hits = sense_hits(args[0], st)
|
|
565
|
+
except (OSError, UnicodeDecodeError) as e:
|
|
566
|
+
sys.stderr.write("harness error: cannot scan %s: %s\n" % (args[0], e))
|
|
567
|
+
return 10
|
|
568
|
+
print("scanned: %s %d lines (fence/fig skipped: %d)" % (args[0], st.total, st.skipped))
|
|
569
|
+
print("words: %s -- listing only; group each word's lines by sense and flag the minority sense (judgment)" % ", ".join(w for w, _ in SENSE_WORDS))
|
|
570
|
+
print("coverage: 쓰다 · 기계 = stem match (over-lists; step b sorts it out) · 세다 · 재다 = enumerated endings -- a form outside the list is silently absent, so 0 here is not 'none'")
|
|
571
|
+
for lemma, _ in SENSE_WORDS:
|
|
572
|
+
rows = [(i, c) for w, i, c in hits if w == lemma]
|
|
573
|
+
print("== %s (%d)" % (lemma, len(rows)))
|
|
574
|
+
for i, c in rows:
|
|
575
|
+
print("%d\t%s" % (i, c))
|
|
576
|
+
bad = unclosed(st)
|
|
577
|
+
if bad:
|
|
578
|
+
for b in bad:
|
|
579
|
+
sys.stderr.write("WARNING unclosed block at EOF: %s -- listing after it is NOT valid\n" % b)
|
|
580
|
+
return 3
|
|
581
|
+
return 0
|
|
582
|
+
|
|
583
|
+
|
|
527
584
|
def main():
|
|
528
585
|
if len(sys.argv) > 1:
|
|
529
586
|
if sys.argv[1] == "--scan":
|
|
530
587
|
return scan_main(sys.argv[2:])
|
|
531
588
|
if sys.argv[1] == "--check-rewrite":
|
|
532
589
|
return check_main(sys.argv[2:])
|
|
533
|
-
sys.
|
|
590
|
+
if sys.argv[1] == "--senses":
|
|
591
|
+
return senses_main(sys.argv[2:])
|
|
592
|
+
sys.stderr.write("usage: ko_tech_writer_calibrate.py [--scan FILE [--s7-common LIST] | --check-rewrite ... | --senses FILE]\n")
|
|
534
593
|
return 10
|
|
535
594
|
for p in (POS, NEG):
|
|
536
595
|
if not os.path.isfile(p):
|
|
@@ -650,6 +709,33 @@ def main():
|
|
|
650
709
|
print("FAIL RW2 %s" % name)
|
|
651
710
|
nfail += 1
|
|
652
711
|
|
|
712
|
+
# C22 S35 낱말 뜻 늘어놓기 — 활용형 픽스처의 «모든» 줄을 기대 낱말로 잡는가(재현율) · 겹치는 다른 낱말을 0건 잡는가.
|
|
713
|
+
# 🟥 판별하는 것은 늘어놓기(a)뿐이다. 뜻 묶기(b)는 판단이라 이 레인이 재지 않는다 — 초록이어도 «뜻 흔들림 검출»을 주장하지 마라.
|
|
714
|
+
sp, sn = os.path.join(FIX, "sense_positive.md"), os.path.join(FIX, "sense_negative.md")
|
|
715
|
+
if not (os.path.isfile(sp) and os.path.isfile(sn)):
|
|
716
|
+
print("FAIL C22 word-sense listing -- fixture missing (%s / %s)" % (sp, sn))
|
|
717
|
+
nfail += 1
|
|
718
|
+
else:
|
|
719
|
+
exp = {}
|
|
720
|
+
for i, l in enumerate(read_lines(sp), 1):
|
|
721
|
+
m = re.search(r"<!-- (\S+) -->\s*$", l)
|
|
722
|
+
if m:
|
|
723
|
+
exp[i] = m.group(1)
|
|
724
|
+
got = {}
|
|
725
|
+
for lemma, i, _ in sense_hits(sp):
|
|
726
|
+
got.setdefault(i, set()).add(lemma)
|
|
727
|
+
miss = sorted(i for i, e in exp.items() if e not in got.get(i, set()))
|
|
728
|
+
extra = sorted(i for i in got if got[i] != {exp.get(i)})
|
|
729
|
+
neg = sense_hits(sn)
|
|
730
|
+
if exp and not miss and not extra and not neg:
|
|
731
|
+
print("OK C22 낱말 뜻 늘어놓기(S35 a단계) -- recall %d/%d lines of a constructed inflection fixture (%s) / negative 0 (listing discriminates there; "
|
|
732
|
+
"sense grouping is judgment, NOT measured here)" % (len(exp), len(exp), ", ".join(w for w, _ in SENSE_WORDS)))
|
|
733
|
+
npass += 1
|
|
734
|
+
else:
|
|
735
|
+
print("FAIL C22 낱말 뜻 늘어놓기 -- expected %d, missed lines %s, wrong-lemma lines %s, negative hits %d"
|
|
736
|
+
% (len(exp), miss, extra, len(neg)))
|
|
737
|
+
nfail += 1
|
|
738
|
+
|
|
653
739
|
# META 컨트롤 1 — 없는 토큰이 양쪽 다 0인가 (계기가 «늘 잡는다» 를 내지 않는다)
|
|
654
740
|
if count(POS, NEVER) == 0 and count(NEG, NEVER) == 0:
|
|
655
741
|
print("OK META control -- an absent token matches nothing in either fixture")
|
|
@@ -675,6 +761,7 @@ def main():
|
|
|
675
761
|
print(" NOT proven: 'zero residue' in any real document. That is measured per document.")
|
|
676
762
|
print(" C7-C12 positives are the harvest's own 'before' sentences (re-built short); C13-C14 positives are constructed (no harvest pair), so")
|
|
677
763
|
print(" false-positive rate on out-of-distribution text is UNMEASURED. C9 over-blocks by design.")
|
|
764
|
+
print(" C22 measures listing recall on a constructed inflection fixture only; grouping occurrences by sense (S35 step b) is judgment and has no lane.")
|
|
678
765
|
print(" Citing this suite as evidence of 'zero residue' reproduces the very downgrade")
|
|
679
766
|
print(" recorded in harness_terminal_correlation_and_recommendations.md.")
|
|
680
767
|
return 0
|
|
@@ -9,7 +9,7 @@ sim_isolated_run.sh), and a probe may declare `behave:` — an observable tool c
|
|
|
9
9
|
|
|
10
10
|
Two uses:
|
|
11
11
|
extract <stream.jsonl> <out.txt> <tools.txt> (runner) write the final result text and the init
|
|
12
|
-
tool/MCP inventory. Exit 3 on a stream that has no parseable result event — never an empty
|
|
12
|
+
tool/MCP/plugin inventory. Exit 3 on a stream that has no parseable result event — never an empty
|
|
13
13
|
«the session said nothing» (same rule as sim_isolated_run.sh's turns path).
|
|
14
14
|
library: parse_stream(path) · behave_hit(trace, spec) · inventory(trace)
|
|
15
15
|
|
|
@@ -35,7 +35,8 @@ def parse_stream(path):
|
|
|
35
35
|
lines = open(path, encoding='utf-8').read().splitlines()
|
|
36
36
|
except (OSError, UnicodeDecodeError):
|
|
37
37
|
return None
|
|
38
|
-
out = {'result': None, 'tools': None, 'mcp': None, 'calls': [], 'damaged': 0, 'ok_ids': set()}
|
|
38
|
+
out = {'result': None, 'tools': None, 'mcp': None, 'plugins': None, 'calls': [], 'damaged': 0, 'ok_ids': set()}
|
|
39
|
+
inits = [] # plugin set of every init event, in order
|
|
39
40
|
for ln in lines:
|
|
40
41
|
ln = ln.strip()
|
|
41
42
|
if not ln:
|
|
@@ -54,6 +55,17 @@ def parse_stream(path):
|
|
|
54
55
|
if isinstance(ev.get('mcp_servers'), list):
|
|
55
56
|
out['mcp'] = sorted(('%s:%s' % (s.get('name'), s.get('status'))) if isinstance(s, dict) else str(s)
|
|
56
57
|
for s in ev['mcp_servers'])
|
|
58
|
+
# Plugins (2026-11-15): arms load the operator's user/builtin/synced plugins from the real
|
|
59
|
+
# HOME, and the set can change between reps (a builtin rolled out mid-run; an auto-update
|
|
60
|
+
# moved a version). name, source and version — never the path (it carries the home directory).
|
|
61
|
+
# Key absent → None (UNKNOWN, never «no plugins»).
|
|
62
|
+
# Each entry is a JSON array [name, source, version] so no separator inside a name can make
|
|
63
|
+
# two different sets render alike; a non-object entry is {"raw": ...}, which never equals
|
|
64
|
+
# an array. A set: duplicates and order do not matter. Every init is kept (see below).
|
|
65
|
+
inits.append(None if not isinstance(ev.get('plugins'), list) else sorted(set(
|
|
66
|
+
json.dumps([p.get('name'), p.get('source'), p.get('version')], ensure_ascii=False)
|
|
67
|
+
if isinstance(p, dict) else json.dumps({'raw': p}, ensure_ascii=False)
|
|
68
|
+
for p in ev['plugins'])))
|
|
57
69
|
elif t == 'assistant':
|
|
58
70
|
if ev.get('parent_tool_use_id'):
|
|
59
71
|
continue
|
|
@@ -69,14 +81,21 @@ def parse_stream(path):
|
|
|
69
81
|
out['damaged'] += 1 # an error result is not a finished session
|
|
70
82
|
r = ev.get('result')
|
|
71
83
|
out['result'] = r if isinstance(r, str) else ('' if r is None else json.dumps(r, ensure_ascii=False))
|
|
84
|
+
# One init (the normal single-shot stream): its set. Several inits that agree: that set. Several
|
|
85
|
+
# that disagree: the whole sequence, so a later init can never erase an earlier mismatch (codex R1).
|
|
86
|
+
if inits:
|
|
87
|
+
out['plugins'] = inits[0] if all(x == inits[0] for x in inits) else \
|
|
88
|
+
[json.dumps({'inits': inits}, ensure_ascii=False)]
|
|
72
89
|
return out
|
|
73
90
|
|
|
74
91
|
|
|
75
92
|
def inventory(trace):
|
|
76
|
-
"""One comparable string for the arm's tool surface, or None when the init event was
|
|
93
|
+
"""One comparable string for the arm's tool/MCP/plugin surface, or None when the init event was
|
|
94
|
+
absent. An init without a plugin list reads plugins=UNKNOWN, so it never equals an arm that has one."""
|
|
77
95
|
if trace is None or trace['tools'] is None:
|
|
78
96
|
return None
|
|
79
|
-
|
|
97
|
+
plug = 'UNKNOWN' if trace.get('plugins') is None else ','.join(trace['plugins'])
|
|
98
|
+
return 'tools=' + ','.join(trace['tools']) + ' | mcp=' + ','.join(trace['mcp'] or []) + ' | plugins=' + plug
|
|
80
99
|
|
|
81
100
|
|
|
82
101
|
def _read_hit(call, trace, pat):
|
|
@@ -41,6 +41,18 @@ esac
|
|
|
41
41
|
HOOK="$WORK/hook"
|
|
42
42
|
|
|
43
43
|
FAILED=0
|
|
44
|
+
# Each pair's name, exit code and elapsed time when it breaks. The BLOCKED line at the end names them,
|
|
45
|
+
# because a caller that shows only the last lines of this output (selfcheck did: tail -12) otherwise
|
|
46
|
+
# reads «a known pair broke» with the pair itself cut off above. A downstream consumer hit exactly that
|
|
47
|
+
# under heavy load and could not say which pair broke, or whether it timed out. Elapsed is per pair
|
|
48
|
+
# (whole seconds, $SECONDS): a pair that ran long points at a timeout, a short one at a wrong verdict.
|
|
49
|
+
FAILED_LIST=()
|
|
50
|
+
_t0=$SECONDS
|
|
51
|
+
_el() { printf '%ss' "$((SECONDS - _t0))"; }
|
|
52
|
+
_pair_fail() { # called inside check/sb_check: reads their locals name and rc
|
|
53
|
+
FAILED=1
|
|
54
|
+
FAILED_LIST+=("$(printf '%s' "$name" | tr -s ' ') (rc=${rc:-?}, $(_el))")
|
|
55
|
+
}
|
|
44
56
|
# Fixtures assembled at runtime so this file's own bytes carry no matching credential shape
|
|
45
57
|
# (same rule as universal_guard_check.sh — a fixture file excluded from scanning would be a hole).
|
|
46
58
|
AWSK="AKIA""1234567890ABCDEF"
|
|
@@ -67,14 +79,14 @@ newrepo() { # echoes a fresh repo path with the pattern layers in place and one
|
|
|
67
79
|
# check <name> <repo> <expect: block|pass> <refline...>
|
|
68
80
|
check() {
|
|
69
81
|
local name="$1" repo="$2" expect="$3"; shift 3
|
|
70
|
-
local out rc got
|
|
82
|
+
local out rc got; _t0=$SECONDS
|
|
71
83
|
out=$(printf '%s\n' "$@" | ( cd "$repo" && bash templates/.git-hooks/pre-push origin git@example:x/y.git 2>&1 )); rc=$?
|
|
72
84
|
# A runtime fault is its own failure mode, checked BEFORE the verdict: an aborted hook that exits 0
|
|
73
85
|
# would otherwise be scored as a clean pass — the exact defect this anchor was written for.
|
|
74
86
|
if printf '%s' "$out" | grep -qiE 'bad substitution|unbound variable|syntax error|command not found'; then
|
|
75
|
-
echo " ❌ $name — RUNTIME FAULT in the hook (a hook that aborts is not a hook that passed)"
|
|
87
|
+
echo " ❌ $name [$(_el)] — RUNTIME FAULT in the hook (a hook that aborts is not a hook that passed)"
|
|
76
88
|
printf '%s\n' "$out" | grep -iE 'bad substitution|unbound|syntax error|command not found' | sed 's/^/ /' | head -3
|
|
77
|
-
|
|
89
|
+
_pair_fail; return
|
|
78
90
|
fi
|
|
79
91
|
# A hook killed by a signal, or one that dies printing nothing, produces no fault TEXT — the grep
|
|
80
92
|
# above cannot see it, and rc alone would score it as a pass (R7 audit, 2026-07-26). So a `pass`
|
|
@@ -88,23 +100,23 @@ check() {
|
|
|
88
100
|
if printf '%s' "$out" | grep -qE '(leak —|leak in pushed|incomplete confidentiality instrument|unusable pattern)'; then
|
|
89
101
|
got=block
|
|
90
102
|
else
|
|
91
|
-
echo " ❌ $name — blocked, but for a HARNESS reason, not a confidentiality finding"
|
|
103
|
+
echo " ❌ $name [$(_el)] — blocked, but for a HARNESS reason, not a confidentiality finding"
|
|
92
104
|
printf '%s\n' "$out" | sed 's/^/ | /' | head -6
|
|
93
|
-
|
|
105
|
+
_pair_fail; return
|
|
94
106
|
fi
|
|
95
107
|
elif printf '%s' "$out" | grep -qF 'FH Pre-Publish'; then
|
|
96
108
|
got=pass
|
|
97
109
|
else
|
|
98
|
-
echo " ❌ $name — hook exited 0 without reaching the publish check (silent abort is not a pass)"
|
|
110
|
+
echo " ❌ $name [$(_el)] — hook exited 0 without reaching the publish check (silent abort is not a pass)"
|
|
99
111
|
printf '%s\n' "$out" | sed 's/^/ | /' | head -5
|
|
100
|
-
|
|
112
|
+
_pair_fail; return
|
|
101
113
|
fi
|
|
102
114
|
if [ "$got" = "$expect" ]; then
|
|
103
|
-
echo " ✅ $name (expected $expect)"
|
|
115
|
+
echo " ✅ $name [$(_el)] (expected $expect)"
|
|
104
116
|
else
|
|
105
|
-
echo " ❌ $name — expected $expect, got $got"
|
|
117
|
+
echo " ❌ $name [$(_el)] — expected $expect, got $got"
|
|
106
118
|
printf '%s\n' "$out" | sed 's/^/ | /' | head -8
|
|
107
|
-
|
|
119
|
+
_pair_fail
|
|
108
120
|
fi
|
|
109
121
|
}
|
|
110
122
|
|
|
@@ -256,10 +268,10 @@ sb_check() { # sb_check <name> <repo> <expect: warn|skip|none> <refline> [must-
|
|
|
256
268
|
# [must-name]: a branch the warning MUST name. "a warning appeared" is too weak an assertion —
|
|
257
269
|
# under a mutation that broke the self-exclusion, the advisory still warned, but about the
|
|
258
270
|
# pushed branch ITSELF. The leg went green while the defect was live (measured 2026-07-27).
|
|
259
|
-
local name="$1" repo="$2" expect="$3" refline="$4" mustname="${5:-}" out rc got
|
|
271
|
+
local name="$1" repo="$2" expect="$3" refline="$4" mustname="${5:-}" out rc got; _t0=$SECONDS
|
|
260
272
|
out=$(printf '%s\n' "$refline" | ( cd "$repo" && bash templates/.git-hooks/pre-push origin git@example:x/y.git 2>&1 )); rc=$?
|
|
261
273
|
if printf '%s' "$out" | grep -qiE 'bad substitution|unbound variable|syntax error|command not found'; then
|
|
262
|
-
echo " ❌ $name — RUNTIME FAULT in the hook";
|
|
274
|
+
echo " ❌ $name [$(_el)] — RUNTIME FAULT in the hook"; _pair_fail; return
|
|
263
275
|
fi
|
|
264
276
|
if printf '%s' "$out" | grep -qF "$SB_MARK"; then
|
|
265
277
|
# Key on a machine token, not prose. Measured 2026-07-27: this classifier first grepped the
|
|
@@ -270,23 +282,23 @@ sb_check() { # sb_check <name> <repo> <expect: warn|skip|none> <refline> [must-
|
|
|
270
282
|
got=none
|
|
271
283
|
fi
|
|
272
284
|
if [ "$got" != "$expect" ]; then
|
|
273
|
-
echo " ❌ $name — expected $expect, got $got"
|
|
285
|
+
echo " ❌ $name [$(_el)] — expected $expect, got $got"
|
|
274
286
|
printf '%s\n' "$out" | sed 's/^/ | /' | head -8
|
|
275
|
-
|
|
287
|
+
_pair_fail; return
|
|
276
288
|
fi
|
|
277
289
|
# The advisory must not move the verdict. These legs are otherwise-clean pushes, so a non-zero
|
|
278
290
|
# exit means the advisory (or something it perturbed) started blocking.
|
|
279
291
|
if [ "$rc" -ne 0 ]; then
|
|
280
|
-
echo " ❌ $name — advisory changed the verdict (exit $rc); it must be advisory only"
|
|
292
|
+
echo " ❌ $name [$(_el)] — advisory changed the verdict (exit $rc); it must be advisory only"
|
|
281
293
|
printf '%s\n' "$out" | sed 's/^/ | /' | head -6
|
|
282
|
-
|
|
294
|
+
_pair_fail; return
|
|
283
295
|
fi
|
|
284
296
|
if [ -n "$mustname" ] && ! printf '%s' "$out" | grep -qF "$mustname"; then
|
|
285
|
-
echo " ❌ $name — warned, but never named '$mustname' (warning for the wrong reason)"
|
|
297
|
+
echo " ❌ $name [$(_el)] — warned, but never named '$mustname' (warning for the wrong reason)"
|
|
286
298
|
printf '%s\n' "$out" | grep -F "$SB_MARK" -A5 | sed 's/^/ | /' | head -8
|
|
287
|
-
|
|
299
|
+
_pair_fail; return
|
|
288
300
|
fi
|
|
289
|
-
echo " ✅ $name ($expect, verdict unchanged${mustname:+, named $mustname})"
|
|
301
|
+
echo " ✅ $name [$(_el)] ($expect, verdict unchanged${mustname:+, named $mustname})"
|
|
290
302
|
}
|
|
291
303
|
# ⚠️ 계기 주의 (실측): 처음엔 remote_sha 를 all-zero(=신규 브랜치)로 줬는데, 그러면 push 범위에
|
|
292
304
|
# 샌드박스의 base 커밋(= templates/.git-hooks/pre-push 사본을 담고 있다)이 들어가 이 훅의 **기존**
|
|
@@ -382,7 +394,8 @@ if [ "$FAILED" -eq 0 ]; then
|
|
|
382
394
|
echo "[prepush-guard] ✅ all known pairs hold"
|
|
383
395
|
exit 0
|
|
384
396
|
fi
|
|
385
|
-
|
|
397
|
+
_broken=""; for _b in ${FAILED_LIST[@]+"${FAILED_LIST[@]}"}; do _broken="${_broken:+$_broken; }$_b"; done
|
|
398
|
+
echo "[prepush-guard] ❌ BLOCKED — ${#FAILED_LIST[@]} known pair(s) broke after ${SECONDS}s: ${_broken:-<unnamed>}"
|
|
386
399
|
echo " BLOCK→PASS = the publish boundary stopped covering something it claims to cover."
|
|
387
400
|
echo " PASS→BLOCK = over-blocking, which trains PUBLIC_SURFACE_OK into reflex and disarms the gate."
|
|
388
401
|
echo " RUNTIME FAULT = the hook aborted; that is never a pass, however it exited."
|
|
@@ -138,7 +138,7 @@ MODEL="sonnet"
|
|
|
138
138
|
# ⚠️ 비용: reps=3 이면 프로브당 `claude -p` 호출이 2 → 6 이다(12 프로브 = 24 → 72).
|
|
139
139
|
REPS=1
|
|
140
140
|
# §TRACE (2026-11-14, FH-3): arms keep their event stream so the scorer can read tool calls and the
|
|
141
|
-
# init tool/MCP
|
|
141
|
+
# init tool/MCP/plugin lists (behave: probes · INVALID-COMPARISON). FH_LIVE_TRACE=0 restores text-only runs.
|
|
142
142
|
if [ "${FH_LIVE_TRACE:-1}" = 0 ]; then FH_LIVE_TRACE_ARG=""; else FH_LIVE_TRACE_ARG="--trace"; fi
|
|
143
143
|
DRYRUN=0
|
|
144
144
|
SUBSET=""
|
|
@@ -312,7 +312,7 @@ 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
|
|
315
|
+
INVALID_COMPARISON = 'INVALID-COMPARISON' # arms ran with different tool/MCP/plugin surfaces (FH-3 2026-11-14; plugins 2026-11-15)
|
|
316
316
|
|
|
317
317
|
try: # §TRACE — sibling module; absent = every probe is scored on text only and labelled MENTION-ONLY
|
|
318
318
|
import live_eval_trace as _trace
|
|
@@ -633,10 +633,12 @@ def score_run(live_rows, run_root, ids_in_order, threshold, model, reps=1):
|
|
|
633
633
|
elif behave and any_trace and (no_trace or damaged):
|
|
634
634
|
row['reason'] = 'TRACE-INCOMPLETE: %d rep(s) missing an arm trace · %d damaged stream(s)' % (no_trace, damaged)
|
|
635
635
|
elif len(inventories) > 1:
|
|
636
|
-
row['reason'] = 'INVALID-COMPARISON: arms saw %d different tool/MCP lists — %s' % (
|
|
636
|
+
row['reason'] = 'INVALID-COMPARISON: arms saw %d different tool/MCP/plugin lists — %s' % (
|
|
637
637
|
len(inventories), ' ≠ '.join(sorted(inventories)))
|
|
638
638
|
if len(ran_reps) > 1 and 0 < len(pass_reps) < len(ran_reps):
|
|
639
|
-
|
|
639
|
+
flaky = 'FLAKY across reps (%s)' % ','.join(r[0] for r in per_rep)
|
|
640
|
+
# an INVALID-COMPARISON reason must survive: the surface mismatch is why there is no number
|
|
641
|
+
row['reason'] = (row['reason'] + '; ' + flaky) if verdict == INVALID_COMPARISON and row['reason'] else flaky
|
|
640
642
|
if adv_pat is not None:
|
|
641
643
|
row['advisory'] = '%d/%d' % (adv_hits, len(ran_reps) if ran_reps else 0)
|
|
642
644
|
row['advisory_re'] = adv_re
|
|
@@ -979,7 +981,7 @@ def render_report_md(select_result, score_result, run_date, instrument=None):
|
|
|
979
981
|
score_result['uncalibrated'], score_result['passed'], pr_s))
|
|
980
982
|
lines.append("")
|
|
981
983
|
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"
|
|
984
|
+
"reply text; it is not evidence the rule acted) · tool/MCP/plugin surfaces in this run: %s"
|
|
983
985
|
% (score_result.get('behaviour_backed', 0), score_result['passed'],
|
|
984
986
|
score_result.get('mention_only_pass', 0),
|
|
985
987
|
score_result.get('run_inventories') or 'UNMEASURED (no trace)'))
|
|
@@ -1006,7 +1008,7 @@ def render_report_md(select_result, score_result, run_date, instrument=None):
|
|
|
1006
1008
|
lines.extend(["## Scored by — behaviour or mention", "",
|
|
1007
1009
|
"`BEHAVIOUR` = the probe's `behave:` action was read from the event stream in every rep "
|
|
1008
1010
|
"(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 |", "|---|---|---|---|"])
|
|
1011
|
+
"| Probe | scored_by | behave (primary did · control did) | tool/MCP/plugin lists |", "|---|---|---|---|"])
|
|
1010
1012
|
for r in score_result['rows']:
|
|
1011
1013
|
lines.append("| %s | %s | %s | %s |" % (r['id'], r.get('scored_by', 'MENTION-ONLY'),
|
|
1012
1014
|
_md_escape(r.get('behave', '-')), _md_escape(r.get('inventory', '-'))))
|
package/scripts/selfcheck.sh
CHANGED
|
@@ -513,12 +513,15 @@ if [ ! -f scripts/prepush_guard_check.sh ]; then
|
|
|
513
513
|
_absent_subject_verdict "prepush-guard known-pair" "scripts/prepush_guard_check.sh" || fail=1
|
|
514
514
|
else
|
|
515
515
|
# 🟥 파이프 앞에서 rc 를 잡는다 — 표시 필터의 rc 를 읽으면 실패가 0 으로 보인다.
|
|
516
|
+
# 🟥 tail -12 로 자르지 않는다 — 하위 소비자가 «BLOCKED — a known pair broke» 만 받고 어느 쌍인지
|
|
517
|
+
# 못 읽은 실사고(2026-11-16, 원인은 UNMEASURED). ❌ 줄을 뽑는 _show_failure 로 보이고, 전체 경과도 찍는다.
|
|
518
|
+
_pg_t0=$SECONDS
|
|
516
519
|
_pg_out="$(bash scripts/prepush_guard_check.sh 2>&1)"; _pg_rc=$?
|
|
517
520
|
if [ "$_pg_rc" -eq 0 ]; then
|
|
518
521
|
echo "PASS prepush-guard known-pair"
|
|
519
522
|
else
|
|
520
|
-
echo "FAIL prepush-guard known-pair (rc=$_pg_rc)"
|
|
521
|
-
|
|
523
|
+
echo "FAIL prepush-guard known-pair (rc=$_pg_rc, $((SECONDS - _pg_t0))s)"
|
|
524
|
+
_show_failure "$_pg_out"
|
|
522
525
|
fail=1
|
|
523
526
|
fi
|
|
524
527
|
fi
|
|
@@ -1868,6 +1871,52 @@ else
|
|
|
1868
1871
|
echo "FAIL test_sidecar_calibrate_lanes.sh: sidecar_calibrate.sh present but its anchor is missing"
|
|
1869
1872
|
fail=1
|
|
1870
1873
|
fi
|
|
1874
|
+
# agy launch guard (2026-11-16). The guard is the only thing between an FH script and a cloud agent
|
|
1875
|
+
# CLI that reads this machine and sends what it read to the model; its lanes use fake agy stubs only.
|
|
1876
|
+
if [ ! -f scripts/agy_launch_guard.sh ]; then
|
|
1877
|
+
_absent_subject_verdict "test_agy_launch_guard_lanes.sh" "scripts/agy_launch_guard.sh" || fail=1
|
|
1878
|
+
elif [ -f scripts/test_agy_launch_guard_lanes.sh ]; then
|
|
1879
|
+
if ! bash scripts/test_agy_launch_guard_lanes.sh < /dev/null; then
|
|
1880
|
+
fail=1
|
|
1881
|
+
fi
|
|
1882
|
+
else
|
|
1883
|
+
echo "FAIL test_agy_launch_guard_lanes.sh: agy_launch_guard.sh present but its anchor is missing"
|
|
1884
|
+
fail=1
|
|
1885
|
+
fi
|
|
1886
|
+
# agy remote runner (2026-11-16) — the only route the guard's remote-os-user marker opens; its lanes use a fake ssh/scp.
|
|
1887
|
+
if [ ! -f scripts/agy_remote_run.sh ]; then
|
|
1888
|
+
_absent_subject_verdict "test_agy_remote_run_lanes.sh" "scripts/agy_remote_run.sh" || fail=1
|
|
1889
|
+
elif [ -f scripts/test_agy_remote_run_lanes.sh ]; then
|
|
1890
|
+
if ! env -u FH_AGY_REMOTE -u FH_AGY_REMOTE_DENY -u FH_AGY_REMOTE_RECEIPT_DIR bash scripts/test_agy_remote_run_lanes.sh < /dev/null; then
|
|
1891
|
+
fail=1
|
|
1892
|
+
fi
|
|
1893
|
+
else
|
|
1894
|
+
echo "FAIL test_agy_remote_run_lanes.sh: agy_remote_run.sh present but its anchor is missing"
|
|
1895
|
+
fail=1
|
|
1896
|
+
fi
|
|
1897
|
+
# codex launch guard (2026-11-16) — refuses a codex verifier arm whose prompt/args/cwd name a company root.
|
|
1898
|
+
if [ ! -f scripts/codex_launch_guard.sh ]; then
|
|
1899
|
+
_absent_subject_verdict "test_codex_launch_guard_lanes.sh" "scripts/codex_launch_guard.sh" || fail=1
|
|
1900
|
+
elif [ -f scripts/test_codex_launch_guard_lanes.sh ]; then
|
|
1901
|
+
if ! bash scripts/test_codex_launch_guard_lanes.sh < /dev/null; then
|
|
1902
|
+
fail=1
|
|
1903
|
+
fi
|
|
1904
|
+
else
|
|
1905
|
+
echo "FAIL test_codex_launch_guard_lanes.sh: codex_launch_guard.sh present but its anchor is missing"
|
|
1906
|
+
fail=1
|
|
1907
|
+
fi
|
|
1908
|
+
# prepush-guard failure visibility (2026-11-16) — a broken known pair must be named, with rc and
|
|
1909
|
+
# elapsed, in the last lines of the check and in selfcheck's own rendering of it.
|
|
1910
|
+
if [ ! -f scripts/prepush_guard_check.sh ]; then
|
|
1911
|
+
_absent_subject_verdict "test_prepush_guard_failure_visibility_lanes.sh" "scripts/prepush_guard_check.sh" || fail=1
|
|
1912
|
+
elif [ -f scripts/test_prepush_guard_failure_visibility_lanes.sh ]; then
|
|
1913
|
+
if ! bash scripts/test_prepush_guard_failure_visibility_lanes.sh < /dev/null; then
|
|
1914
|
+
fail=1
|
|
1915
|
+
fi
|
|
1916
|
+
else
|
|
1917
|
+
echo "FAIL test_prepush_guard_failure_visibility_lanes.sh: prepush_guard_check.sh present but its anchor is missing"
|
|
1918
|
+
fail=1
|
|
1919
|
+
fi
|
|
1871
1920
|
# Squash-merge verification + its merge-path wiring (2026-09-24). Same subject/anchor pairing as above:
|
|
1872
1921
|
# both scripts return verdict exit codes, and pr_merge_verified's whole job is to REFUSE before merging —
|
|
1873
1922
|
# a refusal nobody re-runs is one the next edit quietly removes. Lanes are hermetic (temp repos, fake gh).
|