@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.
Files changed (43) hide show
  1. package/.claude-plugin/marketplace.json +4 -4
  2. package/AGENTS.md +5 -1
  3. package/docs/USER_GUIDE.md +95 -0
  4. package/knowledge/shared/harness-core/governance_engineering_definition.md +16 -0
  5. package/knowledge/shared/learnings/subagent_invocations_log.yaml +12 -0
  6. package/knowledge/shared/plugin-catalog/recommended_plugins.md +53 -9
  7. package/package.json +8 -1
  8. package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
  9. package/plugins/fh-commons/skills/ko-tech-writer/SKILL.md +47 -12
  10. package/plugins/fh-commons/skills/ko-tech-writer/SKILL_detail.md +60 -0
  11. package/plugins/fh-commons/skills/ko-tech-writer/fixtures/sense_negative.md +30 -0
  12. package/plugins/fh-commons/skills/ko-tech-writer/fixtures/sense_positive.md +56 -0
  13. package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
  14. package/plugins/fh-meta/CHANGELOG.md +23 -0
  15. package/plugins/fh-meta/skills/auto-decorrelation/SKILL.md +45 -1
  16. package/plugins/fh-meta/skills/sim-conductor/SKILL_detail.md +3 -3
  17. package/plugins/fh-meta/skills/steel-quench/SKILL_detail.md +8 -4
  18. package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
  19. package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
  20. package/scripts/agy_launch_guard.sh +49 -0
  21. package/scripts/agy_remote_run.sh +187 -0
  22. package/scripts/codex_launch_guard.sh +87 -0
  23. package/scripts/finding_fleet.sh +35 -2
  24. package/scripts/finding_verifier.sh +6 -2
  25. package/scripts/ko_tech_writer_calibrate.py +88 -1
  26. package/scripts/live_eval_trace.py +23 -4
  27. package/scripts/prepush_guard_check.sh +33 -20
  28. package/scripts/probe_live_eval.sh +1 -1
  29. package/scripts/probe_live_eval_lib.py +7 -5
  30. package/scripts/selfcheck.sh +51 -2
  31. package/scripts/session_checklist.py +109 -5
  32. package/scripts/sidecar_calibrate.sh +10 -2
  33. package/scripts/sidecar_wait.sh +21 -1
  34. package/scripts/test_agy_launch_guard_lanes.sh +227 -0
  35. package/scripts/test_agy_remote_run_lanes.sh +228 -0
  36. package/scripts/test_codex_launch_guard_lanes.sh +138 -0
  37. package/scripts/test_finding_pipeline_lanes.sh +6 -2
  38. package/scripts/test_live_eval_trace_lanes.sh +54 -8
  39. package/scripts/test_preprep_speech_coach_lanes.sh +18 -2
  40. package/scripts/test_prepush_guard_failure_visibility_lanes.sh +152 -0
  41. package/scripts/test_session_checklist_lanes.sh +205 -0
  42. package/scripts/test_sidecar_calibrate_lanes.sh +4 -0
  43. package/scripts/test_sidecar_wait_stdin.sh +18 -0
@@ -0,0 +1,152 @@
1
+ #!/usr/bin/env bash
2
+ # test_prepush_guard_failure_visibility_lanes.sh — when a known pair in prepush_guard_check.sh breaks,
3
+ # the reader of a TRUNCATED log must still see which pair broke, its exit code and how long it ran.
4
+ #
5
+ # WHY. A downstream consumer reported `[prepush-guard] ❌ BLOCKED — a known pair broke.` from a 2h+
6
+ # selfcheck under heavy load, and nobody could say which pair: selfcheck printed only the last 12
7
+ # lines of the check, the BLOCKED line named nothing, and the failing pair's own ❌ line sat above
8
+ # the cut. The cause of that failure is still UNMEASURED; these lanes only guard the instrument, so
9
+ # that a recurrence can be read as a timeout (long elapsed) or a wrong verdict (short elapsed).
10
+ #
11
+ # HOW. A throwaway repo gets the real hook, scan library, pattern defaults and the check under test.
12
+ # One arm is left clean; the other has one planted defect: the stacked-branch advisory's marker is
13
+ # renamed in the hook, so every pair that expects a warning now gets none (a broken pair, on purpose).
14
+ # V1 clean arm passes and prints no BLOCKED line (control: the plant is what breaks it)
15
+ # V2 the plant really landed (application check: marker gone from the planted hook only)
16
+ # V3 planted arm exits 1
17
+ # V4 the last 12 lines name every broken pair, with rc= and an elapsed time
18
+ # V5 every pair line (✅ and ❌) carries an elapsed stamp [Ns]
19
+ # V6 selfcheck's own renderer (_show_failure, extracted from selfcheck.sh and run) shows the names
20
+ # V7 selfcheck's prepush-guard block renders through _show_failure, not a bare tail
21
+ # Control arm for the whole file: PG_SCRIPT=<older prepush_guard_check.sh> makes V4/V5 red.
22
+ #
23
+ # Usage: bash scripts/test_prepush_guard_failure_visibility_lanes.sh (exit 0 all pass, 1 otherwise)
24
+ set -uo pipefail
25
+ ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
26
+ PG_SCRIPT="${PG_SCRIPT:-$ROOT/scripts/prepush_guard_check.sh}"
27
+ SELFCHECK="${SELFCHECK:-$ROOT/scripts/selfcheck.sh}"
28
+ PASS=0; FAIL=0
29
+ ok() { echo " ✅ $1"; PASS=$((PASS+1)); }
30
+ no() { echo " ❌ $1"; FAIL=$((FAIL+1)); }
31
+
32
+ for f in "$PG_SCRIPT" "$SELFCHECK" "$ROOT/templates/.git-hooks/pre-push" "$ROOT/scripts/psa_scan_lib.sh" \
33
+ "$ROOT/.claude/rules/.public-surface-patterns.defaults"; do
34
+ [ -f "$f" ] || { echo "HARNESS-ERROR: missing $f"; exit 2; }
35
+ done
36
+
37
+ # shellcheck source=fixture_guard_lib.sh
38
+ . "$ROOT/scripts/fixture_guard_lib.sh"
39
+ WORK="$(fh_fixture_root "$(mktemp -d "${TMPDIR:-/tmp}/pg_vis.XXXXXX")")" || exit 2
40
+ : "${WORK:?fixture root unset — refusing to run git in cwd}"
41
+ trap 'rm -rf "$WORK"' EXIT
42
+
43
+ mkfix() { # mkfix <dir> — a repo the check can treat as REPO_ROOT
44
+ local d="$1"
45
+ mkdir -p "$d/scripts" "$d/templates/.git-hooks" "$d/.claude/rules"
46
+ cp "$PG_SCRIPT" "$d/scripts/prepush_guard_check.sh"
47
+ cp "$ROOT/scripts/psa_scan_lib.sh" "$d/scripts/psa_scan_lib.sh"
48
+ cp "$ROOT/templates/.git-hooks/pre-push" "$d/templates/.git-hooks/pre-push"
49
+ cp "$ROOT/.claude/rules/.public-surface-patterns.defaults" "$d/.claude/rules/.public-surface-patterns.defaults"
50
+ ( cd "$d" && git init -q -b main && git config user.email t@example.com && git config user.name t \
51
+ && git add scripts templates .claude && git commit -qm fix >/dev/null ) || return 1
52
+ }
53
+
54
+ CLEAN="$WORK/clean"; PLANT="$WORK/plant"
55
+ mkfix "$CLEAN" || { echo "HARNESS-ERROR: clean fixture"; exit 2; }
56
+ mkfix "$PLANT" || { echo "HARNESS-ERROR: planted fixture"; exit 2; }
57
+ # The plant: rename the warning marker on the line that announces a stacked branch (not the SKIPPED one).
58
+ MARK='[fh-advisory:stacked-branch] %s carries'
59
+ python3 - "$PLANT/templates/.git-hooks/pre-push" "$MARK" <<'PY'
60
+ import sys
61
+ p, m = sys.argv[1], sys.argv[2]
62
+ s = open(p, encoding="utf-8").read()
63
+ open(p, "w", encoding="utf-8").write(s.replace(m, "[fh-advisory:planted-off] %s carries"))
64
+ PY
65
+ ( cd "$PLANT" && git add templates/.git-hooks/pre-push && git commit -qm plant >/dev/null )
66
+
67
+ # V2 application check
68
+ c_clean=$(grep -cF "$MARK" "$CLEAN/templates/.git-hooks/pre-push")
69
+ c_plant=$(grep -cF "$MARK" "$PLANT/templates/.git-hooks/pre-push")
70
+ if [ "$c_clean" -ge 1 ] && [ "$c_plant" -eq 0 ]; then ok "V2 plant applied (marker clean=$c_clean planted=$c_plant)"
71
+ else no "V2 plant not applied (marker clean=$c_clean planted=$c_plant) — later lanes would read nothing"; fi
72
+
73
+ out_clean="$(cd "$CLEAN" && bash scripts/prepush_guard_check.sh 2>&1)"; rc_clean=$?
74
+ out_plant="$(cd "$PLANT" && bash scripts/prepush_guard_check.sh 2>&1)"; rc_plant=$?
75
+
76
+ # V1
77
+ case "$out_clean" in
78
+ *"BLOCKED"*) no "V1 clean arm printed BLOCKED (rc=$rc_clean)" ;;
79
+ *) if [ "$rc_clean" -eq 0 ]; then ok "V1 clean arm passes (rc=0, no BLOCKED)"
80
+ else no "V1 clean arm rc=$rc_clean"; printf '%s\n' "$out_clean" | tail -8 | sed 's/^/ | /'; fi ;;
81
+ esac
82
+
83
+ # V3
84
+ if [ "$rc_plant" -eq 1 ]; then ok "V3 planted arm exits 1"; else no "V3 planted arm rc=$rc_plant (expected 1)"; fi
85
+
86
+ # Names of the broken pairs, as the per-pair ❌ lines print them (spaces squeezed; the elapsed stamp
87
+ # and everything after the em dash dropped).
88
+ names="$(printf '%s\n' "$out_plant" | python3 -c '
89
+ import re, sys
90
+ for line in sys.stdin:
91
+ m = re.match(r"^\s+❌ (.*?) (?:\[\d+s\] )?— ", line)
92
+ if m: print(re.sub(r" +", " ", m.group(1)).strip())
93
+ ')"
94
+ n_names=$(printf '%s\n' "$names" | grep -c . || true)
95
+ tail12="$(printf '%s\n' "$out_plant" | tail -12)"
96
+
97
+ # V4 — each broken pair must appear in the BLOCKED line of the last 12 lines WITH its own
98
+ # «(rc=N, Ns)»: a summary naming every pair but carrying the numbers for only one would be decorative.
99
+ if [ "$n_names" -eq 0 ]; then
100
+ no "V4 planted arm printed no per-pair ❌ line — nothing to look for"
101
+ else
102
+ v4miss="$(TAIL="$tail12" NAMES="$names" python3 -c '
103
+ import os, re
104
+ blk = [l for l in os.environ["TAIL"].splitlines() if "BLOCKED" in l]
105
+ line = re.sub(r" +", " ", blk[-1]) if blk else ""
106
+ for nm in os.environ["NAMES"].splitlines():
107
+ if nm and not re.search(re.escape(nm) + r" \(rc=\d+, \d+s\)", line):
108
+ print(" | " + nm)
109
+ ' | tr -d '\n')"
110
+ if [ -z "$v4miss" ]; then ok "V4 last 12 lines name all $n_names broken pair(s), each with (rc=, Ns)"
111
+ else no "V4 BLOCKED line in the last 12 lines lacks name+(rc=, Ns) for:$v4miss"; fi
112
+ fi
113
+
114
+ # V5
115
+ pair_lines=$(printf '%s\n' "$out_plant" | grep -E '^\s+(✅|❌) ' | grep -vE 'BLOCKED' || true)
116
+ n_pair=$(printf '%s\n' "$pair_lines" | grep -c . || true)
117
+ n_stamped=$(printf '%s\n' "$pair_lines" | grep -cE '\[[0-9]+s\]' || true)
118
+ if [ "$n_pair" -ge 10 ] && [ "$n_pair" -eq "$n_stamped" ]; then ok "V5 all $n_pair pair lines carry [Ns]"
119
+ else no "V5 pair lines stamped $n_stamped of $n_pair (want all, at least 10)"; fi
120
+
121
+ # V6 selfcheck's renderer, extracted and run on the planted output
122
+ fn="$(awk '/^_show_failure\(\) \{/{f=1} f{print} f&&/^\}/{exit}' "$SELFCHECK")"
123
+ if [ -z "$fn" ]; then
124
+ no "V6 _show_failure not found in selfcheck.sh"
125
+ else
126
+ shown="$(eval "$fn"; _show_failure "$out_plant" 2>&1)"
127
+ sq="$(printf '%s\n' "$shown" | sed 's/ */ /g')"
128
+ miss6=""
129
+ while IFS= read -r nm; do
130
+ [ -n "$nm" ] || continue
131
+ case "$sq" in *"$nm"*) ;; *) miss6="$miss6 | $nm" ;; esac
132
+ done <<EOF
133
+ $names
134
+ EOF
135
+ if [ "$n_names" -gt 0 ] && [ -z "$miss6" ]; then ok "V6 selfcheck renderer shows all broken pair names"
136
+ else no "V6 selfcheck renderer misses:${miss6:- (no names to check)}"; fi
137
+ fi
138
+
139
+ # V7 the prepush-guard block in selfcheck renders through _show_failure (comment lines ignored, so a
140
+ # commented-out call does not count; any tail -N in live lines is refused, not only tail -12)
141
+ blk="$(awk '/_pg_out="\$\(bash scripts\/prepush_guard_check.sh/{f=1} f{print} f&&/^fi$/{exit}' "$SELFCHECK" \
142
+ | grep -vE '^[[:space:]]*#' || true)"
143
+ if [ -z "$blk" ]; then no "V7 prepush-guard block not found in selfcheck.sh"
144
+ elif ! printf '%s\n' "$blk" | grep -m1 -E '^[[:space:]]*_show_failure "\$_pg_out"' >/dev/null; then
145
+ no "V7 selfcheck prepush block does not call _show_failure"
146
+ elif printf '%s\n' "$blk" | grep -m1 -E 'tail -[0-9]' >/dev/null; then
147
+ no "V7 selfcheck prepush block still truncates with tail -N"
148
+ else ok "V7 selfcheck prepush block renders through _show_failure"; fi
149
+
150
+ echo
151
+ echo "prepush-guard failure visibility: PASS=$PASS FAIL=$FAIL"
152
+ [ "$FAIL" -eq 0 ]
@@ -996,6 +996,211 @@ else
996
996
  fail "L54 rc=$RC rows=$L54_ROWS (want 1, no H) (see $TMPDIR_ROOT/l54.out)"
997
997
  fi
998
998
 
999
+ # L55 — re-extract keeps every line the table parser does not consume (2026-11-14 harvest H3: a result-sheet section
1000
+ # written below the table — 13 lines — vanished on `extract --out`). Known pair + decoys:
1001
+ # preface above the table · a result section below it · a decoy that LOOKS 7-column but is not a row (no «| » lead) ·
1002
+ # an 8-cell line · a real 7-cell row with a judgment (must stay an orphan row, NOT be copied into the kept block too).
1003
+ # Then a second re-extract over that output must be byte-identical (idempotent).
1004
+ build_jsonl "$TMPDIR_ROOT/l55.jsonl" "[{'type':'user','timestamp':'2026-10-18T01:00:00.000Z','message':{'role':'user','content':'Please move the session bar a little higher than it is now.'}}]"
1005
+ L55="$TMPDIR_ROOT/l55.md"
1006
+ run "$TMPDIR_ROOT/l55a.out" extract --transcript "$TMPDIR_ROOT/l55.jsonl" --out "$L55"
1007
+ L55A_RC=$RC
1008
+ python3 - "$L55" <<'PYEOF'
1009
+ import sys
1010
+ p = sys.argv[1]; L = open(p, encoding="utf-8").read().rstrip("\n").split("\n")
1011
+ i = next(k for k, l in enumerate(L) if l.startswith("| # |"))
1012
+ L[i:i] = ["PREFACE-LINE operator note above the table", ""]
1013
+ L += ["", "## 8차 결과 시트", "", "RESULT-LINE-1 merged #1095 after CI green", "",
1014
+ "|decoy|b|c|d|e|f|g|", "| e1 | e2 | e3 | e4 | e5 | e6 | e7 | e8 |",
1015
+ "RESULT-LINE-2 still open: P22-B", "| 9 | 10-17 08:00 | gone utterance | ✅DONE | x | - | - |"]
1016
+ open(p, "w", encoding="utf-8").write("\n".join(L) + "\n")
1017
+ PYEOF
1018
+ run "$TMPDIR_ROOT/l55b.out" extract --transcript "$TMPDIR_ROOT/l55.jsonl" --out "$L55"
1019
+ L55B_RC=$RC; cp "$L55" "$TMPDIR_ROOT/l55_after1.md"
1020
+ run "$TMPDIR_ROOT/l55c.out" extract --transcript "$TMPDIR_ROOT/l55.jsonl" --out "$L55"
1021
+ L55C_RC=$RC
1022
+ L55_KEPT=$(awk '/^## 이전 결과서의 표 밖 내용/{f=1;next} f' "$L55")
1023
+ L55_ORDER=$(printf '%s\n' "$L55_KEPT" | grep -nE '^(PREFACE-LINE|## 8차|RESULT-LINE-1|\|decoy|\| e1 |RESULT-LINE-2)' | cut -d: -f2- | awk '{print $1}' | tr '\n' ',')
1024
+ if [ "$L55A_RC" -eq 0 ] && [ "$L55B_RC" -eq 0 ] && [ "$L55C_RC" -eq 0 ] \
1025
+ && [ "$L55_ORDER" = "PREFACE-LINE,##,RESULT-LINE-1,|decoy|b|c|d|e|f|g|,|,RESULT-LINE-2," ] \
1026
+ && [ "$(grep -c 'gone utterance' "$L55")" -eq 1 ] \
1027
+ && awk '/^## 이전 결과서에서 이어받지 못한 판정/{f=1} f && /gone utterance/{ok=1} /^## 이전 결과서의 표 밖 내용/{f=0} END{exit !ok}' "$L55" \
1028
+ && [ "$(grep -c 'PREFACE-LINE' "$L55")" -eq 1 ] && [ "$(grep -c '^|decoy|' "$L55")" -eq 1 ] \
1029
+ && ! printf '%s\n' "$L55_KEPT" | grep -qE '^(📎|↩️|채널 2/2|\|---)' \
1030
+ && grep -q '표 밖 줄 6줄은 맨 아래' "$L55" \
1031
+ && cmp -s "$L55" "$TMPDIR_ROOT/l55_after1.md"; then
1032
+ pass "L55 re-extract keeps non-table lines (preface · result section · 7-col-looking decoy · 8-cell line) in order, once; a real row stays an orphan row; a second re-extract is byte-identical"
1033
+ else
1034
+ fail "L55 rc=$L55A_RC/$L55B_RC/$L55C_RC order=$L55_ORDER (see $L55 · $TMPDIR_ROOT/l55_after1.md)"
1035
+ fi
1036
+
1037
+ # L56 — what an independent review reproduced against L55's first version (2026-11-15), each a known-positive:
1038
+ # a note starting with a generated prefix · a note appended to a generated status line · a hand-added row with empty
1039
+ # judgment cells · a fenced block holding a 7-cell line, a separator and two blank lines · a person's own 3-column table.
1040
+ # Known-negative (the control that keeps the regexes honest): the transcript grows between runs, so «채널 2/2 …» and
1041
+ # «📎 원장 … (N lines)» change counts — their stale copies must NOT pile up in the kept block. Then a further run is identical.
1042
+ build_jsonl "$TMPDIR_ROOT/l56.jsonl" "[{'type':'user','timestamp':'2026-10-18T01:00:00.000Z','message':{'role':'user','content':'Please move the session bar a little higher than it is now.'}}]"
1043
+ L56="$TMPDIR_ROOT/l56.md"
1044
+ run "$TMPDIR_ROOT/l56a.out" extract --transcript "$TMPDIR_ROOT/l56.jsonl" --out "$L56"
1045
+ L56A_RC=$RC
1046
+ python3 - "$L56" <<'PYEOF'
1047
+ import sys
1048
+ p = sys.argv[1]; L = open(p, encoding="utf-8").read().rstrip("\n").split("\n")
1049
+ i = next(k for k, l in enumerate(L) if l.startswith("채널 2/2"))
1050
+ L.insert(i + 1, L[i] + " · NOTE-APPENDED by the operator") # keep the pure status line too: its stale copy is the control
1051
+ L += ["", "🟥 훅 기록 NOTE-PREFIX the operator's red note",
1052
+ "| hand | 10-17 07:00 | NOTE-HANDROW a request added by hand | | | | |",
1053
+ "", "```", "| a | b | c | d | e | f | g |", "", "", "code after two blanks", "|---|---|", "```",
1054
+ "", "| k | v | w |", "|---|---|---|", "| 1 | 2 | 3 |"]
1055
+ open(p, "w", encoding="utf-8").write("\n".join(L) + "\n")
1056
+ PYEOF
1057
+ cp "$L56" "$TMPDIR_ROOT/l56_edited.md"
1058
+ build_jsonl "$TMPDIR_ROOT/l56.jsonl" "[{'type':'user','timestamp':'2026-10-18T01:00:00.000Z','message':{'role':'user','content':'Please move the session bar a little higher than it is now.'}},{'type':'user','timestamp':'2026-10-18T01:09:00.000Z','message':{'role':'user','content':'Also make the badge smaller please.'}}]"
1059
+ run "$TMPDIR_ROOT/l56b.out" extract --transcript "$TMPDIR_ROOT/l56.jsonl" --out "$L56"
1060
+ L56B_RC=$RC; cp "$L56" "$TMPDIR_ROOT/l56_after1.md"
1061
+ run "$TMPDIR_ROOT/l56c.out" extract --transcript "$TMPDIR_ROOT/l56.jsonl" --out "$L56"
1062
+ L56C_RC=$RC
1063
+ L56_KEPT=$(awk '/^## 이전 결과서의 표 밖 내용/{f=1;next} f' "$L56")
1064
+ L56_FENCE=$(printf '%s\n' "$L56_KEPT" | awk '/^```/{n++; print; next} n==1{print}' | tr '\n' '~')
1065
+ if [ "$L56A_RC" -eq 0 ] && [ "$L56B_RC" -eq 0 ] && [ "$L56C_RC" -eq 0 ] \
1066
+ && printf '%s\n' "$L56_KEPT" | grep -q 'NOTE-APPENDED by the operator' \
1067
+ && printf '%s\n' "$L56_KEPT" | grep -qF "🟥 훅 기록 NOTE-PREFIX the operator's red note" \
1068
+ && printf '%s\n' "$L56_KEPT" | grep -qF '| hand | 10-17 07:00 | NOTE-HANDROW a request added by hand | | | | |' \
1069
+ && [ "$L56_FENCE" = '```~| a | b | c | d | e | f | g |~~~code after two blanks~|---|---|~```~' ] \
1070
+ && printf '%s\n' "$L56_KEPT" | grep -qxF '|---|---|---|' \
1071
+ && ! grep -q '^| - | b | c |' "$L56" \
1072
+ && [ "$(printf '%s\n' "$L56_KEPT" | grep -c '^채널 2/2 열음 — raw [0-9]*건 · 압축 요약 [0-9]*건([^)]*)$')" -eq 0 ] \
1073
+ && [ "$(printf '%s\n' "$L56_KEPT" | grep -c '원장 = .* lines)$')" -eq 0 ] \
1074
+ && grep -q '^채널 2/2 열음 — raw 2건' "$L56" \
1075
+ && cmp -s "$L56" "$TMPDIR_ROOT/l56_after1.md"; then
1076
+ pass "L56 kept: prefix-looking note · note on a status line · hand row with empty judgments · fenced code verbatim · own 3-col table; stale status lines do not pile up when counts change; next run identical"
1077
+ else
1078
+ fail "L56 rc=$L56A_RC/$L56B_RC/$L56C_RC fence=$L56_FENCE (see $L56 · $TMPDIR_ROOT/l56_edited.md)"
1079
+ fi
1080
+
1081
+ # L57 — the second independent review (2026-11-15) against L56's version, each reproduced there:
1082
+ # (a) a hook-only H row from a run WITH the hook file must not be kept when the next run has no hook file
1083
+ # (b) skeleton rows of a longer transcript must not be kept when the sheet is re-extracted from a shorter one
1084
+ # (c) an UNCLOSED fence above the table must not swallow it: row 1's judgment is still carried into the live table
1085
+ # (d) a 4-backtick fence holding «```» and a filled 7-cell row is kept verbatim, not split or orphaned
1086
+ # (e) a person's own 7-column table keeps its separator line
1087
+ python3 - "$TMPDIR_ROOT" <<'PYEOF'
1088
+ import json, sys, datetime
1089
+ d = sys.argv[1]
1090
+ def loc(z):
1091
+ t = datetime.datetime.strptime(z, "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=datetime.timezone.utc).astimezone()
1092
+ return t.strftime("%Y-%m-%dT%H:%M:%S")
1093
+ def tr(path, texts):
1094
+ with open(path, "w", encoding="utf-8") as f:
1095
+ for k, t in enumerate(texts):
1096
+ f.write(json.dumps({"type": "user", "timestamp": "2026-10-18T01:0%d:00Z" % k, "message": {"role": "user", "content": t}}) + "\n")
1097
+ tr(d + "/l57_long.jsonl", ["first request about the session bar", "second request about the badge", "third request about the footer"])
1098
+ tr(d + "/l57_short.jsonl", ["first request about the session bar"])
1099
+ with open(d + "/l57_hook.jsonl", "w", encoding="utf-8") as f:
1100
+ f.write(json.dumps({"ts": loc("2026-10-18T01:00:00Z"), "n": 1, "text": "first request about the session bar"}) + "\n")
1101
+ f.write(json.dumps({"ts": loc("2026-10-18T05:00:00Z"), "n": 2, "text": "HOOKONLY request typed while a tool ran"}) + "\n")
1102
+ PYEOF
1103
+ L57="$TMPDIR_ROOT/l57.md"
1104
+ run "$TMPDIR_ROOT/l57a.out" extract --transcript "$TMPDIR_ROOT/l57_long.jsonl" --utterances "$TMPDIR_ROOT/l57_hook.jsonl" --out "$L57"
1105
+ L57_RCS="$RC"
1106
+ L57_HROW=$(grep -c '^| H1 | .*HOOKONLY' "$L57") # control: the H row really existed in run 1
1107
+ python3 - "$L57" <<'PYEOF'
1108
+ import sys
1109
+ p = sys.argv[1]; L = open(p, encoding="utf-8").read().rstrip("\n").split("\n")
1110
+ L.insert(1, "```python"); L.insert(2, "x = 1 # FENCE-UNCLOSED the operator never closed this")
1111
+ for k, l in enumerate(L):
1112
+ if l.startswith("| 1 |"):
1113
+ L[k] = l.replace("| | | | |", "| ✅DONE | L57-EVID | - | - |")
1114
+ L += ["", "````", "```", "| 9 | 10-18 01:09 | FENCE4 in fence | x | y | z | w |", "```", "````",
1115
+ "", "OWN-TABLE:", "| a | b | c | d | e | f | g |", "|---|---|---|---|---|---|---|", "| 1x | p | q | | | | |"]
1116
+ open(p, "w", encoding="utf-8").write("\n".join(L) + "\n")
1117
+ PYEOF
1118
+ run "$TMPDIR_ROOT/l57b.out" extract --transcript "$TMPDIR_ROOT/l57_short.jsonl" --out "$L57"
1119
+ L57_RCS="$L57_RCS/$RC"; cp "$L57" "$TMPDIR_ROOT/l57_after1.md"
1120
+ run "$TMPDIR_ROOT/l57c.out" extract --transcript "$TMPDIR_ROOT/l57_short.jsonl" --out "$L57"
1121
+ L57_RCS="$L57_RCS/$RC"
1122
+ L57_KEPT=$(awk '/^## 이전 결과서의 표 밖 내용/{f=1;next} f' "$L57")
1123
+ L57_LIVE=$(awk '/^## /{exit} {print}' "$L57")
1124
+ L57_F4=$(printf '%s\n' "$L57_KEPT" | awk '/^````$/{n++; print; next} n==1{print}' | tr '\n' '~')
1125
+ if [ "$L57_RCS" = "0/0/0" ] && [ "$L57_HROW" -eq 1 ] \
1126
+ && ! grep -q 'HOOKONLY' "$L57" \
1127
+ && ! grep -qE '^\| [0-9]+ \| [^|]* \| (second|third) request' "$L57" \
1128
+ && printf '%s\n' "$L57_LIVE" | grep -qE '^\| 1 \| .*first request.* \| ✅DONE \| L57-EVID \| - \| - \|$' \
1129
+ && printf '%s\n' "$L57_KEPT" | grep -qF 'FENCE-UNCLOSED' \
1130
+ && [ "$L57_F4" = '````~```~| 9 | 10-18 01:09 | FENCE4 in fence | x | y | z | w |~```~````~' ] \
1131
+ && ! grep -q '^| - | 10-18 01:09 | FENCE4' "$L57" \
1132
+ && printf '%s\n' "$L57_KEPT" | awk '/^OWN-TABLE:/{f=1} f' | grep -qxF '|---|---|---|---|---|---|---|' \
1133
+ && printf '%s\n' "$L57_KEPT" | grep -qF '| 1x | p | q | | | | |' \
1134
+ && cmp -s "$L57" "$TMPDIR_ROOT/l57_after1.md"; then
1135
+ pass "L57 no stale H/skeleton rows kept · unclosed fence leaves the table live (judgment carried) · 4-tick fence verbatim · own 7-col separator kept · next run identical"
1136
+ else
1137
+ fail "L57 rc=$L57_RCS hrow=$L57_HROW f4=$L57_F4 (see $L57 · $TMPDIR_ROOT/l57_after1.md)"
1138
+ fi
1139
+
1140
+ # L58 — the third (last) review round (2026-11-15): rows BOTH passes skipped vanished, and a BOM hid the title.
1141
+ # kept verbatim: a spaced «| --- | … |» separator · an aligned «| :--- | … |» separator · a person's «| # | 항목 | … |» header
1142
+ # (all three were skipped by carry_forward AND assumed «carried» by the keep pass) · and a BOM-prefixed sheet must not
1143
+ # leave a stale title in the kept block.
1144
+ build_jsonl "$TMPDIR_ROOT/l58.jsonl" "[{'type':'user','timestamp':'2026-10-18T01:00:00.000Z','message':{'role':'user','content':'Please move the session bar a little higher than it is now.'}}]"
1145
+ L58="$TMPDIR_ROOT/l58.md"
1146
+ run "$TMPDIR_ROOT/l58a.out" extract --transcript "$TMPDIR_ROOT/l58.jsonl" --out "$L58"
1147
+ L58_RCS="$RC"
1148
+ python3 - "$L58" <<'PYEOF'
1149
+ import sys
1150
+ p = sys.argv[1]; L = open(p, encoding="utf-8").read().rstrip("\n").split("\n")
1151
+ L += ["", "MY-TABLE:", "| # | 항목 | 담당 | 상태 | 증거 | 비고 | 기한 |", "| --- | --- | --- | --- | --- | --- | --- |",
1152
+ "| m1 | x | y | | | | |", "| :--- | :--- | :--- | :--- | :--- | :--- | :--- |"]
1153
+ open(p, "w", encoding="utf-8").write("\ufeff" + "\n".join(L) + "\n")
1154
+ PYEOF
1155
+ run "$TMPDIR_ROOT/l58b.out" extract --transcript "$TMPDIR_ROOT/l58.jsonl" --out "$L58"
1156
+ L58_RCS="$L58_RCS/$RC"; cp "$L58" "$TMPDIR_ROOT/l58_after1.md"
1157
+ run "$TMPDIR_ROOT/l58c.out" extract --transcript "$TMPDIR_ROOT/l58.jsonl" --out "$L58"
1158
+ L58_RCS="$L58_RCS/$RC"
1159
+ L58_KEPT=$(awk '/^## 이전 결과서의 표 밖 내용/{f=1;next} f' "$L58")
1160
+ L58_MINE=$(printf '%s\n' "$L58_KEPT" | awk '/^MY-TABLE:/{f=1;next} f' | tr '\n' '~')
1161
+ if [ "$L58_RCS" = "0/0/0" ] \
1162
+ && [ "$L58_MINE" = '| # | 항목 | 담당 | 상태 | 증거 | 비고 | 기한 |~| --- | --- | --- | --- | --- | --- | --- |~| m1 | x | y | | | | |~| :--- | :--- | :--- | :--- | :--- | :--- | :--- |~' ] \
1163
+ && ! grep -q '^| - | :---' "$L58" \
1164
+ && ! printf '%s\n' "$L58_KEPT" | grep -q '세션 요청 체크리스트 (스켈레톤)' \
1165
+ && cmp -s "$L58" "$TMPDIR_ROOT/l58_after1.md"; then
1166
+ pass "L58 a person's «| # |» header, spaced and aligned separators kept verbatim in order · BOM sheet leaves no stale title · next run identical"
1167
+ else
1168
+ fail "L58 rc=$L58_RCS mine=$L58_MINE (see $L58)"
1169
+ fi
1170
+
1171
+ # KR1 — KNOWN RESIDUAL (round 4, 2026-11-15), not a pass claim. A person's 7-column table whose header is NOT the
1172
+ # checklist header («| Name | Owner | … |»): its header and filled rows are carried as orphan judgments with the first
1173
+ # cell replaced by «-» (Name · alpha lost), and an empty «| 2 | … |» row is dropped. Measured on the same fixture
1174
+ # against origin/main 3572903: main loses exactly the same cells AND drops the label line and the separator, so this
1175
+ # is not a regression of this change (operator «ㅇㅇ 그러자 추천대로» 2026-11-15: decide by regression, then merge).
1176
+ # What this lane asserts: the part this change does keep (label line + separator survive in order). What it only
1177
+ # reports: the residual loss — printed as KNOWN-RESIDUAL, counted in neither PASS nor FAIL. If the residual stops
1178
+ # reproducing, the lane says so: turn it into a pass lane then.
1179
+ build_jsonl "$TMPDIR_ROOT/kr1.jsonl" "[{'type':'user','timestamp':'2026-10-18T01:00:00.000Z','message':{'role':'user','content':'first request about the bar'}}]"
1180
+ KR1="$TMPDIR_ROOT/kr1.md"
1181
+ run "$TMPDIR_ROOT/kr1a.out" extract --transcript "$TMPDIR_ROOT/kr1.jsonl" --out "$KR1"
1182
+ KR1_RCS="$RC"
1183
+ python3 - "$KR1" <<'PYEOF'
1184
+ import sys
1185
+ p = sys.argv[1]; L = open(p, encoding="utf-8").read().rstrip("\n").split("\n")
1186
+ L += ["", "MY-HUMAN-TABLE:", "| Name | Owner | Due | A | B | C | D |", "|---|---|---|---|---|---|---|",
1187
+ "| alpha | me | 11-20 | x | y | z | w |", "| 2 | | | | | | |"]
1188
+ open(p, "w", encoding="utf-8").write("\n".join(L) + "\n")
1189
+ PYEOF
1190
+ run "$TMPDIR_ROOT/kr1b.out" extract --transcript "$TMPDIR_ROOT/kr1.jsonl" --out "$KR1"
1191
+ KR1_RCS="$KR1_RCS/$RC"
1192
+ KR1_KEPT=$(awk '/^## 이전 결과서의 표 밖 내용/{f=1;next} f' "$KR1" | awk '/^MY-HUMAN-TABLE:/{f=1} f' | tr '\n' '~')
1193
+ if [ "$KR1_RCS" = "0/0" ] && [ "${KR1_KEPT#MY-HUMAN-TABLE:~|---|---|---|---|---|---|---|~}" != "$KR1_KEPT" ]; then
1194
+ pass "KR1 (kept part) a person's table: label line and separator survive in order"
1195
+ else
1196
+ fail "KR1 (kept part) rc=$KR1_RCS kept=$KR1_KEPT (see $KR1)"
1197
+ fi
1198
+ if grep -qF '| alpha |' "$KR1" || grep -qF '| Name |' "$KR1"; then
1199
+ echo "ℹ️ KR1 residual no longer reproduces (Name/alpha cells survive) — promote KR1 to a pass lane"
1200
+ else
1201
+ echo "⚠️ KNOWN-RESIDUAL KR1: a different-header 7-column table's rows become orphan judgments with «-» in the first cell (Name · alpha lost) and its empty «2» row is dropped — same as origin/main 3572903; not counted as a pass"
1202
+ fi
1203
+
999
1204
  echo "── $PASS_COUNT passed, $FAIL_COUNT failed ──"
1000
1205
 
1001
1206
  if [ "$FAIL_COUNT" -gt 0 ]; then
@@ -13,6 +13,10 @@
13
13
  # Exit: 0 = all lanes pass; 1 = at least one failed.
14
14
 
15
15
  set -uo pipefail
16
+ # Every agy in this file is a FAKE (a stub script), and agy_launch_guard.sh refuses any agy launch
17
+ # without an isolation marker. The guard's own refusal is tested in test_agy_launch_guard_lanes.sh;
18
+ # here the marker only lets the fakes through so these lanes keep measuring what they measure.
19
+ export FH_AGY_ISOLATION=container
16
20
 
17
21
  REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
18
22
  CAL="$REPO/scripts/sidecar_calibrate.sh"
@@ -24,6 +24,7 @@
24
24
  # P3 the caller's own stdin is NOT consumed by the wrapper (spool regression)
25
25
  # P4 verdict codes: TIMEOUT=1 · EMPTY=0 · COMPLETE=0, and EMPTY/COMPLETE are distinguished
26
26
  # P5 an unwritable outfile is exit 2, not "EMPTY" (a false clean on the typed channel)
27
+ # P10 a model the CLI refuses is HARNESS-ERROR (rc 3), not COMPLETE · P10b control
27
28
  #
28
29
  # Verdicts are read by running the wrapper DIRECTLY — piping it into `tail` and reading `$?`
29
30
  # answers with tail's status and turns a real exit 1 green.
@@ -176,6 +177,23 @@ else
176
177
  bad "P8 stderr or child exit code lost (out='$(head -c 40 "$TD/p8.out" 2>/dev/null)' verdict='$(head -1 "$TD/p8.txt")')"
177
178
  fi
178
179
 
180
+ # P10 — a model the CLI refuses (measured 2026-11-16: codex «-m gpt-5.5» → HTTP 400 "not supported when
181
+ # using Codex with a ChatGPT account", rc 1) is a HARNESS-ERROR, never COMPLETE: a COMPLETE verdict with
182
+ # an error body reads as «the reviewer answered and found nothing». Control P10b: an ordinary non-zero exit
183
+ # with other text stays COMPLETE (the new verdict must not swallow every failure).
184
+ SIDECAR_POLL=1 bash "$SW" "$TD/p10.out" 20 -- sh -c 'echo "ERROR: {\"type\":\"error\",\"status\":400,\"error\":{\"type\":\"invalid_request_error\",\"message\":\"The '"'"'gpt-5.5'"'"' model is not supported when using Codex with a ChatGPT account.\"}}" >&2; exit 1' >"$TD/p10.txt" 2>&1 </dev/null; p10rc=$?
185
+ if grep -q 'SIDECAR_VERDICT=HARNESS-ERROR' "$TD/p10.txt" && ! grep -q 'SIDECAR_VERDICT=COMPLETE' "$TD/p10.txt" && [ "$p10rc" -eq 3 ]; then
186
+ ok "P10 a refused model is SIDECAR_VERDICT=HARNESS-ERROR (rc 3), not COMPLETE"
187
+ else
188
+ bad "P10 refused model: rc=$p10rc verdict='$(grep -m1 SIDECAR_VERDICT "$TD/p10.txt")'"
189
+ fi
190
+ SIDECAR_POLL=1 bash "$SW" "$TD/p10b.out" 20 -- sh -c 'echo "some review text"; exit 1' >"$TD/p10b.txt" 2>&1 </dev/null; p10brc=$?
191
+ if grep -q 'SIDECAR_VERDICT=COMPLETE exit=1' "$TD/p10b.txt" && [ "$p10brc" -eq 0 ]; then
192
+ ok "P10b control: an ordinary non-zero exit stays COMPLETE exit=1"
193
+ else
194
+ bad "P10b control: rc=$p10brc verdict='$(grep -m1 SIDECAR_VERDICT "$TD/p10b.txt")'"
195
+ fi
196
+
179
197
  echo "----"
180
198
  echo "sidecar_wait stdin anchor: $pass passed, $fail failed"
181
199
  [ "$fail" -eq 0 ] || exit 1