@chrono-meta/fh-gate 3.43.0 → 3.45.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 (105) hide show
  1. package/.claude/rules/fh_4axis_gate.md +50 -608
  2. package/.claude-plugin/marketplace.json +4 -4
  3. package/AGENTS.md +5 -1
  4. package/CATALOG.md +21 -0
  5. package/CHEATSHEET.md +7 -1
  6. package/docs/USER_GUIDE.md +95 -0
  7. package/docs/codex-compat.md +1 -1
  8. package/knowledge/shared/harness-core/fh_4axis_gate_detail.md +679 -0
  9. package/knowledge/shared/harness-core/fh_integration_contract.md +1 -1
  10. package/knowledge/shared/harness-core/fh_module_contract.md +106 -3
  11. package/knowledge/shared/harness-core/governance_engineering_definition.md +16 -0
  12. package/knowledge/shared/harness-core/heavy_skill_to_cartridge.md +185 -0
  13. package/knowledge/shared/learnings/subagent_invocations_log.yaml +221 -0
  14. package/knowledge/shared/plugin-catalog/recommended_plugins.md +53 -9
  15. package/package.json +24 -1
  16. package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
  17. package/plugins/fh-commons/skills/ko-tech-writer/SKILL.md +50 -14
  18. package/plugins/fh-commons/skills/ko-tech-writer/SKILL_detail.md +80 -0
  19. package/plugins/fh-commons/skills/ko-tech-writer/fixtures/sense_negative.md +30 -0
  20. package/plugins/fh-commons/skills/ko-tech-writer/fixtures/sense_positive.md +56 -0
  21. package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
  22. package/plugins/fh-meta/CHANGELOG.md +118 -0
  23. package/plugins/fh-meta/skills/auto-decorrelation/SKILL.md +58 -1
  24. package/plugins/fh-meta/skills/install-wizard/SKILL_detail.md +4 -0
  25. package/plugins/fh-meta/skills/sim-conductor/SKILL_detail.md +3 -3
  26. package/plugins/fh-meta/skills/steel-quench/SKILL_detail.md +9 -4
  27. package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
  28. package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
  29. package/scripts/agy_launch_guard.sh +165 -0
  30. package/scripts/agy_remote_run.sh +187 -0
  31. package/scripts/below_floor_scan.sh +30 -0
  32. package/scripts/codex_launch_guard.sh +123 -0
  33. package/scripts/correction_moments.py +23 -2
  34. package/scripts/fh-gate.sh +612 -14
  35. package/scripts/fh-goal.sh +56 -12
  36. package/scripts/fh-run.sh +1 -1
  37. package/scripts/fh_gate_exec.sh +272 -0
  38. package/scripts/fh_session_load.sh +17 -0
  39. package/scripts/finding_fleet.sh +36 -2
  40. package/scripts/finding_verifier.sh +7 -2
  41. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/README.md +16 -0
  42. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/scripts/check_refs.py +12 -0
  43. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/scripts/test_check_refs.py +24 -0
  44. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/skills/tidy-notes/SKILL.md +16 -0
  45. package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/skills/tidy-notes/fh-module.yaml +20 -0
  46. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/SKILL.md +25 -0
  47. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/hooks/hooks.json +7 -0
  48. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/check_links.py +25 -0
  49. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/publish.sh +9 -0
  50. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/publish_guard.py +6 -0
  51. package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/setup.sh +5 -0
  52. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/SKILL.md +25 -0
  53. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/hooks/hooks.json +10 -0
  54. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/check_refs.py +12 -0
  55. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/guard_push.py +9 -0
  56. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/install.sh +6 -0
  57. package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/ship.sh +9 -0
  58. package/scripts/heavy_skill_smell.py +311 -0
  59. package/scripts/job_heartbeat.py +186 -0
  60. package/scripts/ko_tech_writer_calibrate.py +88 -1
  61. package/scripts/live_eval_matrix.py +128 -0
  62. package/scripts/live_eval_trace.py +199 -5
  63. package/scripts/package_coverage_check.sh +18 -0
  64. package/scripts/prepush_guard_check.sh +41 -20
  65. package/scripts/probe_live_eval.sh +33 -1
  66. package/scripts/probe_live_eval_lib.py +14 -6
  67. package/scripts/selfcheck.sh +162 -2
  68. package/scripts/selfcheck_shard_weights.txt +2 -0
  69. package/scripts/session_checklist.py +109 -5
  70. package/scripts/sidecar_calibrate.sh +15 -5
  71. package/scripts/sidecar_wait.sh +21 -1
  72. package/scripts/sim_isolated_run.sh +20 -0
  73. package/scripts/test_agy_launch_guard_lanes.sh +347 -0
  74. package/scripts/test_agy_remote_run_lanes.sh +228 -0
  75. package/scripts/test_below_floor_scan_lanes.sh +85 -0
  76. package/scripts/test_codex_launch_guard_lanes.sh +183 -0
  77. package/scripts/test_correction_moments_lanes.sh +37 -0
  78. package/scripts/test_fh_gate_absorb_lanes.sh +255 -0
  79. package/scripts/test_fh_gate_defaults_lanes.sh +169 -0
  80. package/scripts/test_fh_gate_exec_lanes.sh +244 -0
  81. package/scripts/test_fh_gate_fusion_lanes.sh +202 -0
  82. package/scripts/test_fh_gate_regressions.sh +92 -1
  83. package/scripts/test_fh_goal_change_detection_lanes.sh +103 -3
  84. package/scripts/test_finding_pipeline_lanes.sh +41 -3
  85. package/scripts/test_guard_anchor_override_env_lanes.sh +84 -0
  86. package/scripts/test_heavy_skill_smell_lanes.sh +160 -0
  87. package/scripts/test_job_heartbeat_lanes.sh +96 -0
  88. package/scripts/test_live_eval_construct_lanes.sh +29 -6
  89. package/scripts/test_live_eval_matrix_lanes.sh +53 -0
  90. package/scripts/test_live_eval_trace_lanes.sh +165 -12
  91. package/scripts/test_name_boundary_locale_lanes.sh +36 -5
  92. package/scripts/test_preprep_speech_coach_lanes.sh +18 -2
  93. package/scripts/test_prepush_guard_failure_visibility_lanes.sh +152 -0
  94. package/scripts/test_prepush_marker_lookup_lanes.sh +143 -0
  95. package/scripts/test_probe_live_eval_lanes.sh +43 -0
  96. package/scripts/test_regression_guard_sibling_lanes.sh +52 -1
  97. package/scripts/test_session_checklist_lanes.sh +205 -0
  98. package/scripts/test_sidecar_calibrate_lanes.sh +5 -1
  99. package/scripts/test_sidecar_wait_stdin.sh +18 -0
  100. package/scripts/test_sim_isolated_run_lanes.sh +43 -0
  101. package/scripts/universal_guard_check.sh +8 -0
  102. package/templates/.claude/rules/mcp_tool_gating.md +27 -0
  103. package/templates/.git-hooks/pre-push +60 -3
  104. package/templates/regression_guard.sh +8 -4
  105. package/templates/settings.LaneGap.snippet.json +27 -0
@@ -0,0 +1,143 @@
1
+ #!/usr/bin/env bash
2
+ # test_prepush_marker_lookup_lanes.sh — the pre-push Load-Bearing gate must find THIS branch's marker where the
3
+ # pre-commit hook writes it (the main checkout's tracks/_meta, i.e. EVIDENCE_ROOT), and nothing else.
4
+ #
5
+ # Why (2026-11-15, found pushing FH #1118 from a worktree): the gate read `$REPO_ROOT/tracks/_meta` — the worktree's
6
+ # own folder — and took the newest marker of ANY branch. Two wrong answers followed from one line:
7
+ # W1 a worktree push was BLOCKED although its branch's marker existed in the main checkout;
8
+ # M1 a main-checkout push PASSED on another branch's marker.
9
+ # Lanes (each in a throwaway clone of this checkout with a bare origin; nothing here touches the real repo):
10
+ # W1 worktree, marker for the pushed branch in the main checkout only → push passes
11
+ # M1 main checkout, only a FOREIGN branch's marker (newer) → push blocked
12
+ # M2 control: main checkout, the pushed branch's own marker → push passes
13
+ # M3 control: main checkout, no marker at all → push blocked
14
+ # M4 only a longer branch's marker (lane/m4_extra for lane/m4 — glob prefix) → push blocked
15
+ # M5 two local branches share one marker name (lane/m5 · lane_m5) → push blocked
16
+ # M6 same as M5 plus a tag of that name (the short refname would hide the collision) → push blocked
17
+ # M7 <sha>:refs/heads/lane/m7 while standing on a branch that has a marker → push blocked
18
+ # M8 <sha>:refs/heads/lane/m8, no local lane/m8, a local lane_m8 with a marker → push blocked
19
+ # W1/M2 «gate-pass» = rc 0 AND the gate printed its ✅ line (proves the hook ran, not just that the push worked)
20
+ # N1 control: a push that carries no load-bearing file, no marker → push passes (gate not involved)
21
+ # N2 an outside contributor's clone (no tracks/_meta), load-bearing file, no marker → push passes (FH-dev scope)
22
+ # Exit 0 all lanes pass · 1 a lane failed · 2 harness error.
23
+ set -uo pipefail
24
+ . "$(dirname "${BASH_SOURCE[0]}")/fixture_guard_lib.sh" # scrub inherited GIT_* env first (#1088)
25
+ SRC=$(cd "$(dirname "$0")/.." 2>/dev/null && pwd) || { echo "HARNESS-ERROR: cannot resolve the repo root"; exit 2; }
26
+ [ -f "$SRC/templates/.git-hooks/pre-push" ] || { echo "HARNESS-ERROR: no pre-push hook in $SRC"; exit 2; }
27
+ W=$(mktemp -d "${TMPDIR:-/tmp}/prepush-marker.XXXX") || { echo "HARNESS-ERROR: mktemp"; exit 2; }
28
+ trap 'rm -rf "$W"' EXIT
29
+ unset PUBLIC_SURFACE_OK DESTRUCTIVE_OP_OK MAIN_PUSH_OK PUSH_ZONE_OK TAG_VERSION_OK FH_SESSION_CLOSE 2>/dev/null || true
30
+ G() { git -c user.name=lane -c user.email=lane@localhost -c commit.gpgsign=false "$@"; }
31
+ TODAY=$(date +%Y-%m-%d)
32
+ pass=0; fail=0
33
+
34
+ # one fixture = a clone of this checkout (committed HEAD + this working tree's hook, so the hook under test is the
35
+ # one on disk), a bare origin, hooks wired by absolute path like the operator's setup.
36
+ fixture() { # $1 = dir
37
+ local d="$1"
38
+ G clone -q --no-hardlinks "$SRC" "$d/main" < /dev/null || return 1
39
+ cp "$SRC/templates/.git-hooks/pre-push" "$d/main/templates/.git-hooks/pre-push" || return 1
40
+ G init -q --bare "$d/origin.git" < /dev/null || return 1
41
+ G -C "$d/main" remote set-url origin "$d/origin.git" || return 1
42
+ G -C "$d/main" push -q --no-verify origin HEAD:refs/heads/main < /dev/null || return 1
43
+ G -C "$d/main" fetch -q origin < /dev/null || return 1
44
+ G -C "$d/main" config core.hooksPath "$d/main/templates/.git-hooks" || return 1 # checked (codex R2)
45
+ mkdir -p "$d/main/tracks/_meta" || return 1
46
+ }
47
+ lb_commit() { # $1 = repo dir · $2 = branch — a commit touching a load-bearing path
48
+ G -C "$1" switch -q -c "$2" origin/main < /dev/null || return 1
49
+ lb_change "$1" "$2"
50
+ }
51
+ lb_change() { # $1 = repo dir · $2 = label — the change itself, every step checked (codex R1: an unchecked failure
52
+ # left the branch at origin/main, so the push carried nothing load-bearing and «passed» without exercising the gate)
53
+ printf '\n# lane %s\n' "$2" >> "$1/scripts/predelete_check.sh" || return 1
54
+ G -C "$1" add scripts/predelete_check.sh || return 1
55
+ G -C "$1" commit -q --no-verify -m "lane $2" < /dev/null || return 1
56
+ [ -n "$(G -C "$1" log --format=%h origin/main..HEAD -- scripts/predelete_check.sh)" ] || return 1
57
+ }
58
+ plain_commit() { # $1 = repo dir · $2 = branch — a commit touching no load-bearing path
59
+ G -C "$1" switch -q -c "$2" origin/main < /dev/null || return 1
60
+ printf 'lane\n' > "$1/lane_note_${2//\//_}.txt"; G -C "$1" add "lane_note_${2//\//_}.txt"
61
+ G -C "$1" commit -q --no-verify -m "lane $2" < /dev/null
62
+ }
63
+ marker() { # $1 = evidence dir · $2 = branch
64
+ printf 'crossfamily: panel(codex) — residency=CLEAN(files=1) · evidence=SHARED(lane) · R1 no S/A\n' \
65
+ > "$1/tracks/_meta/.axes_23_passed_${2//\//_}_${TODAY}.marker"
66
+ }
67
+ push() { # $1 = repo dir · $2 = branch → prints rc
68
+ G -C "$1" push origin "$2" > "$W/last_push.log" 2>&1 < /dev/null; echo $?
69
+ }
70
+ lane() { # $1 id · $2 want (pass | gate-pass = pass AND the gate printed its ✅ line | block) · $3 rc
71
+ if { [ "$2" = pass ] && [ "$3" -eq 0 ]; } \
72
+ || { [ "$2" = gate-pass ] && [ "$3" -eq 0 ] && grep -q '✅ FH Load-Bearing Change Gate' "$W/last_push.log"; } \
73
+ || { [ "$2" = block ] && [ "$3" -ne 0 ] && grep -q 'no cross-family leg recorded' "$W/last_push.log"; }; then
74
+ pass=$((pass+1)); echo " ✅ $1 (want $2, rc=$3)"
75
+ else
76
+ fail=$((fail+1)); echo " ❌ $1 — want $2, got rc=$3"; awk '/⛔|❌|error/ && n < 4 { n++; print " " $0 }' "$W/last_push.log"
77
+ fi
78
+ }
79
+ echo "pre-push marker lookup lanes"
80
+
81
+ # W1 — worktree push, marker only in the main checkout
82
+ D="$W/w1"; mkdir -p "$D"; fixture "$D" || { echo "HARNESS-ERROR: fixture W1"; exit 2; }
83
+ G -C "$D/main" worktree add -q "$D/wt" -b lane/w1 origin/main < /dev/null || { echo "HARNESS-ERROR: worktree"; exit 2; }
84
+ mkdir -p "$D/wt/tracks/_meta" # the real worktrees have this folder too (it is gitignored, created by tools)
85
+ lb_change "$D/wt" w1 || { echo "HARNESS-ERROR: commit W1"; exit 2; }
86
+ marker "$D/main" lane/w1
87
+ lane W1 gate-pass "$(push "$D/wt" lane/w1)"
88
+
89
+ # M1 — main checkout, only a foreign (newer) marker
90
+ D="$W/m1"; mkdir -p "$D"; fixture "$D" || { echo "HARNESS-ERROR: fixture M1"; exit 2; }
91
+ lb_commit "$D/main" lane/m1 || { echo "HARNESS-ERROR: commit M1"; exit 2; }
92
+ marker "$D/main" lane/someone-else
93
+ lane M1 block "$(push "$D/main" lane/m1)"
94
+
95
+ # M2 — main checkout, own marker
96
+ marker "$D/main" lane/m1
97
+ lane M2 gate-pass "$(push "$D/main" lane/m1)"
98
+
99
+ # M4 — prefix collision: only a LONGER branch's marker (lane/m1 already pushed; lane_m4_extra is not lane/m4's)
100
+ G -C "$D/main" switch -q -c lane/m4 origin/main < /dev/null && lb_change "$D/main" m4 || { echo "HARNESS-ERROR: commit M4"; exit 2; }
101
+ marker "$D/main" lane/m4_extra
102
+ lane M4 block "$(push "$D/main" lane/m4)"
103
+
104
+ # M5 — slug collision: lane/m5 and lane_m5 both exist locally; the one marker cannot be attributed to either
105
+ G -C "$D/main" branch -q lane_m5 origin/main < /dev/null || { echo "HARNESS-ERROR: branch M5"; exit 2; }
106
+ G -C "$D/main" switch -q -c lane/m5 origin/main < /dev/null && lb_change "$D/main" m5 || { echo "HARNESS-ERROR: commit M5"; exit 2; }
107
+ marker "$D/main" lane/m5
108
+ lane M5 block "$(push "$D/main" lane/m5)"
109
+
110
+ # M6 — tag ambiguity: lane/m6 and lane_m6 both exist AND a tag lane_m6 (refname:short would print heads/lane_m6)
111
+ G -C "$D/main" branch -q lane_m6 origin/main < /dev/null && G -C "$D/main" tag lane_m6 origin/main < /dev/null || { echo "HARNESS-ERROR: refs M6"; exit 2; }
112
+ G -C "$D/main" switch -q -c lane/m6 origin/main < /dev/null && lb_change "$D/main" m6 || { echo "HARNESS-ERROR: commit M6"; exit 2; }
113
+ marker "$D/main" lane/m6
114
+ lane M6 block "$(push "$D/main" lane/m6)"
115
+
116
+ # M7 — commit-expression refspec: standing on lane/m1 (its marker exists), push an unreviewed load-bearing commit to a
117
+ # NEW branch name with <sha>:refs/heads/lane/m7 — it must need lane/m7's marker, not borrow lane/m1's
118
+ G -C "$D/main" switch -q -c lane/m7-src origin/main < /dev/null && lb_change "$D/main" m7 || { echo "HARNESS-ERROR: commit M7"; exit 2; }
119
+ M7SHA=$(G -C "$D/main" rev-parse HEAD); G -C "$D/main" switch -q lane/m1 < /dev/null || { echo "HARNESS-ERROR: switch M7"; exit 2; }
120
+ G -C "$D/main" push origin "$M7SHA:refs/heads/lane/m7" > "$W/last_push.log" 2>&1 < /dev/null; lane M7 block "$?"
121
+
122
+ # M8 — <sha>:refs/heads/lane/m8 where lane/m8 does not exist locally but lane_m8 does, with a marker → blocked
123
+ G -C "$D/main" branch -q lane_m8 origin/main < /dev/null || { echo "HARNESS-ERROR: branch M8"; exit 2; }
124
+ marker "$D/main" lane_m8
125
+ G -C "$D/main" push origin "$M7SHA:refs/heads/lane/m8" > "$W/last_push.log" 2>&1 < /dev/null; lane M8 block "$?"
126
+
127
+ # M3 — main checkout, no marker
128
+ D="$W/m3"; mkdir -p "$D"; fixture "$D" || { echo "HARNESS-ERROR: fixture M3"; exit 2; }
129
+ lb_commit "$D/main" lane/m3 || { echo "HARNESS-ERROR: commit M3"; exit 2; }
130
+ lane M3 block "$(push "$D/main" lane/m3)"
131
+
132
+ # N1 — no load-bearing file, no marker
133
+ plain_commit "$D/main" lane/n1 || { echo "HARNESS-ERROR: commit N1"; exit 2; }
134
+ lane N1 pass "$(push "$D/main" lane/n1)"
135
+
136
+ # N2 — an outside contributor's clone (no tracks/_meta anywhere), load-bearing file, no marker → not blocked by this gate
137
+ D="$W/n2"; mkdir -p "$D"; fixture "$D" || { echo "HARNESS-ERROR: fixture N2"; exit 2; }
138
+ rm -rf "$D/main/tracks/_meta"
139
+ lb_commit "$D/main" lane/n2 || { echo "HARNESS-ERROR: commit N2"; exit 2; }
140
+ lane N2 pass "$(push "$D/main" lane/n2)"
141
+
142
+ echo "pre-push marker lookup lanes: $pass passed, $fail failed"
143
+ [ "$fail" -eq 0 ]
@@ -878,6 +878,49 @@ fi
878
878
  _lane SF3 state-fp "verdict row identical across runs whose end states differ" "yes" \
879
879
  "$([ -n "$(grep -E '^\| G-GREET-01 ' "$T/sf_a.md")" ] && [ "$(grep -E '^\| G-GREET-01 ' "$T/sf_a.md")" = "$(grep -E '^\| G-GREET-01 ' "$T/sf_b.md")" ] && echo yes || echo no)"
880
880
 
881
+ # BP1-BP4 behaviour profile (2026-11-17): one record-only line per rep, appended after the verdict.
882
+ # BP1 the budget stub writes no stream → MISSING for both arms (not measured ≠ 0).
883
+ _lane BP1 behave-prof "stub without stream: report carries 'trace=MISSING' for both arms" "2" \
884
+ "$(grep -cE '^behaviour-profile: G-GREET-01 (primary|control) r1 trace=MISSING$' "$T/bud_report.md")"
885
+ # BP2 a stub that writes a stream: primary explores + runs a test, control only explores.
886
+ cat > "$BSTUB/fake_sim_trace.sh" <<'FAKETRACE'
887
+ #!/usr/bin/env bash
888
+ arm=""; out=""
889
+ while [ $# -gt 0 ]; do case "$1" in --arm) arm="$2"; shift 2 ;; --out) out="$2"; shift 2 ;; *) shift ;; esac; done
890
+ mkdir -p "$out"
891
+ printf 'stub body %s\n' "$arm" > "$out/${arm}_r1.txt"
892
+ printf 'rc\t0\ntimeout_s\t900\nmax_turns\tunset\ntoken_cap\tunset\nended_at_cap\tno\n' > "$out/${arm}_r1.meta.tsv"
893
+ if [ "$arm" = primary ]; then cmd='bash scripts/test_x_lanes.sh'; else cmd='ls tracks'; fi
894
+ { printf '{"type":"system","subtype":"init","tools":["Read","Bash"],"mcp_servers":[]}\n'
895
+ printf '{"type":"assistant","message":{"content":[{"type":"tool_use","id":"a","name":"Read","input":{"file_path":"CATALOG.md"}}]}}\n'
896
+ printf '{"type":"assistant","message":{"content":[{"type":"tool_use","id":"b","name":"Bash","input":{"command":"%s"}}]}}\n' "$cmd"
897
+ printf '{"type":"result","subtype":"success","result":"stub body"}\n'; } > "$out/${arm}_r1.stream.jsonl"
898
+ [ "$arm" = control ] && [ "${FH_TRACE_STUB_BAD:-no}" = yes ] && printf 'not json\x00' > "$out/${arm}_r1.stream.jsonl" && chmod 000 "$out/${arm}_r1.stream.jsonl"
899
+ echo "RESULT: CLEAN"; exit 0
900
+ FAKETRACE
901
+ chmod +x "$BSTUB/fake_sim_trace.sh"
902
+ ( cd "$REPO_ROOT" && FH_SIM_RUNNER_BIN="$BSTUB/fake_sim_trace.sh" \
903
+ bash "$RUNNER" --ids "G-GREET-01" --no-evidence --report-out "$T/bp.md" ) >"$T/bp.log" 2>&1
904
+ _lane BP2 behave-prof "stream present: per-arm counts (primary runs a test, control only explores)" "yes" \
905
+ "$(grep -qxF 'behaviour-profile: G-GREET-01 primary r1 explore=1 edit=0 test-run=1 other=0 total=2' "$T/bp.md" \
906
+ && grep -qxF 'behaviour-profile: G-GREET-01 control r1 explore=2 edit=0 test-run=0 other=0 total=2' "$T/bp.md" && echo yes || echo no)"
907
+ # BP3 FH_LIVE_TRACE=0 keeps no stream → one «not recorded» line, not a MISSING line per rep
908
+ ( cd "$REPO_ROOT" && FH_SIM_RUNNER_BIN="$BSTUB/fake_sim_trace.sh" FH_LIVE_TRACE=0 \
909
+ bash "$RUNNER" --ids "G-GREET-01" --no-evidence --report-out "$T/bp0.md" ) >"$T/bp0.log" 2>&1
910
+ _lane BP3 behave-prof "FH_LIVE_TRACE=0 → one 'not recorded' line, no per-rep lines" "1 0" \
911
+ "$(grep -c '^behaviour-profile: not recorded — FH_LIVE_TRACE=0' "$T/bp0.md") $(grep -c '^behaviour-profile: G-GREET-01' "$T/bp0.md")"
912
+ # BP4 an unreadable stream says UNREADABLE (skipped as root: root reads mode 000)
913
+ if [ "$(id -u)" != 0 ]; then
914
+ ( cd "$REPO_ROOT" && FH_SIM_RUNNER_BIN="$BSTUB/fake_sim_trace.sh" FH_TRACE_STUB_BAD=yes \
915
+ bash "$RUNNER" --ids "G-GREET-01" --no-evidence --report-out "$T/bpu.md" ) >"$T/bpu.log" 2>&1
916
+ _lane BP4 behave-prof "unreadable stream → trace=UNREADABLE, not counts of 0" "1" \
917
+ "$(grep -cxF 'behaviour-profile: G-GREET-01 control r1 trace=UNREADABLE' "$T/bpu.md")"
918
+ chmod -R u+rwx "$T" 2>/dev/null
919
+ fi
920
+ # BP5 the profile never moves a verdict: the G-GREET-01 row is identical with and without streams.
921
+ _lane BP5 behave-prof "verdict row identical with stream (BP2) and without (FH_LIVE_TRACE=0)" "yes" \
922
+ "$([ -n "$(grep -E '^\| G-GREET-01 ' "$T/bp.md")" ] && [ "$(grep -E '^\| G-GREET-01 ' "$T/bp.md")" = "$(grep -E '^\| G-GREET-01 ' "$T/bp0.md")" ] && echo yes || echo no)"
923
+
881
924
  # TG3 default output unchanged: no --target -> no split section anywhere.
882
925
  _lane TG3 target "default (no --target): report has no 'Target split' section" \
883
926
  "no" "$(grep -q 'Target split' "$T/bud_report.md" && echo yes || echo no)"
@@ -8,7 +8,8 @@
8
8
  # SKILL pair — so these lanes cover both pairs and both directions:
9
9
  # moved into the sibling -> no M-tier (exit != 2)
10
10
  # dropped from both -> M-tier block (exit 2) <- the lookup must not become a free pass
11
- # plus a REVERT PROBE: the CLAUDE.md case is deleted from a copy of the guard and lane S1 must turn red.
11
+ # plus REVERT PROBES: each pair arm is deleted from a copy of the guard and its lane must turn red.
12
+ # 2026-11-19: third pair, .claude/rules/fh_4axis_gate.md <-> fh_4axis_gate_detail.md (S11-S13, R4-R5).
12
13
  #
13
14
  # Usage: bash scripts/test_regression_guard_sibling_lanes.sh Exit: 0 = all behave; 1 = regression.
14
15
 
@@ -188,6 +189,56 @@ else
188
189
  else echo " ✅ R3 revert probe: without the reverse arm the reference side no longer sees a move"; fi
189
190
  fi
190
191
 
192
+ # S11 (2026-11-19): the 4-axis rule became a thin resident layer; its body moved verbatim to
193
+ # knowledge/shared/harness-core/fh_4axis_gate_detail.md. Same pair shape, so the same lookup.
194
+ RULE=.claude/rules/fh_4axis_gate.md; RDET=knowledge/shared/harness-core/fh_4axis_gate_detail.md
195
+ mkrule() { local d=$1; mkrepo "$d"; mkdir -p "$d/.claude/rules"; printf '# gate\n%s' "$BODY" > "$d/$RULE"; git -C "$d" add -A && git -C "$d" commit -q -m rule; }
196
+ d=$T/s11; mkrule "$d"
197
+ printf '# gate\nthin layer only.\n' > "$d/$RULE"; printf '# gate detail\n%s' "$BODY" > "$d/$RDET"
198
+ git -C "$d" add -A
199
+ run_lane "S11 4-axis rule -> detail move" "$d" "$GUARD" pass
200
+
201
+ # S12: rule slimmed, detail file absent -> real loss still blocks
202
+ d=$T/s12; mkrule "$d"
203
+ printf '# gate\nthin layer only.\n' > "$d/$RULE"; git -C "$d" add -A
204
+ run_lane "S12 4-axis rule loss, detail absent" "$d" "$GUARD" block
205
+
206
+ # R4: revert probe — delete the rule arm from a copy of the guard; S11 must now block
207
+ G5=$T/guard_norule.sh
208
+ grep -v '^ .claude/rules/fh_4axis_gate.md) ' "$GUARD" > "$G5"
209
+ if cmp -s "$GUARD" "$G5"; then echo " ❌ R4 revert probe: the mutation did not apply (pattern drift) — HARNESS-ERROR"; FAIL=1
210
+ else
211
+ d=$T/r4; mkrule "$d"
212
+ printf '# gate\nthin layer only.\n' > "$d/$RULE"; printf '# gate detail\n%s' "$BODY" > "$d/$RDET"
213
+ git -C "$d" add -A
214
+ run_lane "R4 revert probe: without the rule pair, S11 blocks" "$d" "$G5" block
215
+ fi
216
+
217
+ # S13: reverse — detail content moved back into the rule -> move recognised on the detail side
218
+ d=$T/s13; mkrule "$d"
219
+ printf '# gate\nthin layer only.\n' > "$d/$RULE"; printf '# gate detail\n%s' "$BODY" > "$d/$RDET"
220
+ git -C "$d" add -A; git -C "$d" commit -q -m split
221
+ printf '# gate\n%s' "$BODY" > "$d/$RULE"; printf '# gate detail\nmoved back.\n' > "$d/$RDET"; git -C "$d" add -A
222
+ out=$(cd "$d" && bash "$GUARD" --staged 2>&1)
223
+ sec=$(grep -A60 "fh_4axis_gate_detail.md ===" <<<"$out"); if [[ "$sec" == *"moved to"* ]] && [[ "$sec" != *"M-TIER"* ]]; then
224
+ echo " ✅ S13 detail -> rule reverse move recognised"
225
+ else echo " ❌ S13 reverse move not recognised on the detail side"; FAIL=1; fi
226
+
227
+ # R5: revert probe — drop the detail-side arm; S13 must fail
228
+ G6=$T/guard_nodetailarm.sh
229
+ grep -v 'fh_4axis_gate_detail.md) sib=".claude/rules/fh_4axis_gate.md"' "$GUARD" > "$G6"
230
+ if cmp -s "$GUARD" "$G6"; then echo " ❌ R5 revert probe: the mutation did not apply (pattern drift) — HARNESS-ERROR"; FAIL=1
231
+ else
232
+ d=$T/r5; mkrule "$d"
233
+ printf '# gate\nthin layer only.\n' > "$d/$RULE"; printf '# gate detail\n%s' "$BODY" > "$d/$RDET"
234
+ git -C "$d" add -A; git -C "$d" commit -q -m split
235
+ printf '# gate\n%s' "$BODY" > "$d/$RULE"; printf '# gate detail\nmoved back.\n' > "$d/$RDET"; git -C "$d" add -A
236
+ rc=0; out=$(cd "$d" && bash "$G6" --staged 2>&1) || rc=$?
237
+ if [ "$rc" -gt 2 ] || ! grep -q "fh_4axis_gate_detail.md ===" <<<"$out"; then echo " ❌ R5 revert probe: mutated guard did not run or never examined the detail file (rc=$rc) — HARNESS-ERROR"; FAIL=1
238
+ elif sec=$(grep -A60 "fh_4axis_gate_detail.md ===" <<<"$out"); [[ "$sec" == *"moved to"* ]]; then echo " ❌ R5 revert probe: reverse move still recognised without the detail-side arm"; FAIL=1
239
+ else echo " ✅ R5 revert probe: without the detail-side arm the detail file no longer sees a move"; fi
240
+ fi
241
+
191
242
  echo
192
243
  if [ "$FAIL" -eq 0 ]; then echo "ALL regression_guard sibling lanes behave."; exit 0; fi
193
244
  echo "regression_guard sibling lanes: FAIL"; exit 1
@@ -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"
@@ -97,7 +101,7 @@ STUB
97
101
  # not: "absent" is simulated by NOT creating a stub, so the real codex/agy further down $PATH were
98
102
  # found instead and the lanes fired REAL, billed API calls (measured: a lane run hung past 120s
99
103
  # against live runtimes). A test that can reach production is not a test.
100
- run_cal() { PATH="$TMP/bin:/usr/bin:/bin:/usr/sbin:/sbin" bash "$CAL" --stub-model "stub-pro-3.1" "$@" 2>&1; }
104
+ run_cal() { PATH="$TMP/bin:/usr/bin:/bin:/usr/sbin:/sbin" bash "$CAL" --stub-model "stub-pro-3.1" "$@" 2>&1 < /dev/null; }
101
105
 
102
106
  echo "── sidecar-calibrate lanes ──"
103
107
 
@@ -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
@@ -730,5 +730,48 @@ run_sut --arm a --reps 1 --prompt p --setting-sources 'project local' --out "$WO
730
730
  run_sut --arm a --reps 1 --prompt p --setting-sources ',,,' --out "$WORKROOT/o31k2"; _rk2=$RC
731
731
  { [ "$_rk1" = 2 ] && [ "$_rk2" = 2 ]; } && ok "L31k 'project local' and ',,,' → rc 2" || no "L31k malformed source list accepted (rc=$_rk1/$_rk2)"
732
732
 
733
+ # ── L32 run-level tally (2026-11-19, AQ-20261108-6) — a run where NO rep produced output is
734
+ # FAILED-TO-RUN, never a quiet «RESULT: CLEAN» that a scorer folds to 0/N. Known-positive: every
735
+ # rep dies (rc 7, 0 bytes). Known-negative: every rep answers. Exit code stays 0 in both (L9).
736
+ OUTDIR="$WORKROOT/o32a"
737
+ OUT=$( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=die \
738
+ bash "$SUT" --arm a --reps 2 --prompt p --out "$OUTDIR" 2>&1 ); RC=$?
739
+ { [ "$RC" = 0 ] && printf '%s' "$OUT" | grep -q "^RUN: FAILED-TO-RUN" \
740
+ && printf '%s' "$OUT" | grep -q "^REPS: captured=0 empty=0 unmeasured=2 not_launched=0 of 2$"; } \
741
+ && ok "L32a every rep dead → RUN: FAILED-TO-RUN + tally unmeasured=2 of 2 (exit 0 kept)" \
742
+ || no "L32a all-dead run not named FAILED-TO-RUN (rc=$RC): $(printf '%s' "$OUT" | grep -E '^(REPS|RUN):' | tr '\n' ' ')"
743
+ OUTDIR="$WORKROOT/o32b"
744
+ OUT=$( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say \
745
+ bash "$SUT" --arm a --reps 2 --prompt p --out "$OUTDIR" 2>&1 )
746
+ { ! printf '%s' "$OUT" | grep -q "FAILED-TO-RUN" \
747
+ && printf '%s' "$OUT" | grep -q "^REPS: captured=2 empty=0 unmeasured=0 not_launched=0 of 2$"; } \
748
+ && ok "L32b CONTROL — healthy run carries no FAILED-TO-RUN, tally captured=2 of 2" \
749
+ || no "L32b CONTROL — FAILED-TO-RUN fired on a healthy run, or the tally is wrong"
750
+ OUTDIR="$WORKROOT/o32c"
751
+ OUT=$( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=silent \
752
+ bash "$SUT" --arm a --reps 2 --prompt p --out "$OUTDIR" 2>&1 )
753
+ { ! printf '%s' "$OUT" | grep -q "FAILED-TO-RUN" \
754
+ && printf '%s' "$OUT" | grep -q "^REPS: captured=0 empty=2 unmeasured=0 not_launched=0 of 2$"; } \
755
+ && ok "L32c all-EMPTY (rc 0) is not FAILED-TO-RUN — it ran and said nothing; tally empty=2" \
756
+ || no "L32c EMPTY reps folded into FAILED-TO-RUN, or tally wrong"
757
+
758
+ # L32d/e — the two routes the challenger review (2026-11-19) found around L32a: a multi-turn rep
759
+ # whose every turn died (turn headers make bytes>0) and reps that never launched (clone failure).
760
+ printf 't1\nt2\n' > "$WORKROOT/t32.txt"
761
+ OUTDIR="$WORKROOT/o32d"
762
+ OUT=$( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=die \
763
+ bash "$SUT" --arm a --reps 2 --turns "$WORKROOT/t32.txt" --out "$OUTDIR" 2>&1 )
764
+ { printf '%s' "$OUT" | grep -q "^RUN: FAILED-TO-RUN" \
765
+ && printf '%s' "$OUT" | grep -q "^REPS: captured=0 empty=0 unmeasured=2 not_launched=0 of 2$"; } \
766
+ && ok "L32d --turns with every turn dead → unmeasured=2 + FAILED-TO-RUN (turn headers are not output)" \
767
+ || no "L32d multi-turn all-dead run counted as captured: $(printf '%s' "$OUT" | grep -E '^(REPS|RUN):' | tr '\n' ' ')"
768
+ OUTDIR="$WORKROOT/o32e"
769
+ OUT=$( cd "$SRC" && PATH="$STUBBIN:$PATH" HOME="$FAKEHOME" FH_STUB_MODE=say \
770
+ bash "$SUT" --arm a --reps 2 --prompt p --base-ref no-such-ref-32e --base-sha deadbeef --out "$OUTDIR" 2>&1 )
771
+ { printf '%s' "$OUT" | grep -q "^RUN: FAILED-TO-RUN" \
772
+ && printf '%s' "$OUT" | grep -q "^REPS: captured=0 empty=0 unmeasured=0 not_launched=2 of 2$"; } \
773
+ && ok "L32e every clone failed → not_launched=2 + FAILED-TO-RUN (not a quiet CLEAN)" \
774
+ || no "L32e never-launched reps not counted: $(printf '%s' "$OUT" | grep -E '^(REPS|RUN):' | tr '\n' ' ')"
775
+
733
776
  echo "sim_isolated_run lanes: $pass passed, $fail failed"
734
777
  [ "$fail" -eq 0 ] || exit 1
@@ -24,6 +24,14 @@
24
24
  set -uo pipefail
25
25
 
26
26
  unset GIT_INDEX_FILE GIT_DIR GIT_WORK_TREE GIT_COMMON_DIR 2>/dev/null || true
27
+ # The anchor measures the hook as it behaves by DEFAULT. A caller that exported an override (a commit made with
28
+ # PUBLIC_SURFACE_OK=1 that stages the hook) used to pass it into the sandboxed hook, which then let its own
29
+ # planted leaks through and broke the known pairs (rc=1 for a reason unrelated to the change — pmh-dev #91 ②,
30
+ # 2026-11-15). Lane: scripts/test_guard_anchor_override_env_lanes.sh.
31
+ unset PUBLIC_SURFACE_OK DESTRUCTIVE_OP_OK FH_NOVELTY_OK MAIN_PUSH_OK PUSH_ZONE_OK TAG_VERSION_OK TRACKS_GITLINK_OK TRACKS_PUBLIC_OK 2>/dev/null || true
32
+ # Every PSA_* input too (codex R2: PSA_ALLOWLIST suppressed a planted positive) — by prefix, so a new PSA_ input
33
+ # cannot slip past a hand-written list. The scan library sets the ones it needs itself.
34
+ for _v in $(compgen -v | grep '^PSA_'); do unset "$_v"; done; unset _v
27
35
 
28
36
  REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
29
37
  HOOK="$REPO_ROOT/templates/.git-hooks/pre-commit"