@chrono-meta/fh-gate 3.27.0 → 3.29.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/CHEATSHEET.md +2 -2
- package/CLAUDE.md +6 -3
- package/README.ja.md +2 -4
- package/README.ko.md +2 -4
- package/README.md +19 -19
- package/README.zh.md +2 -4
- package/docs/REFERENCE.md +4 -1
- package/knowledge/shared/harness-core/claude_md_full_reference.md +2 -0
- package/knowledge/shared/harness-core/claude_md_gate_details.md +7 -0
- package/knowledge/shared/harness-core/dispatch_conditional_prohibition.md +12 -0
- package/knowledge/shared/harness-core/fh_module_contract.md +97 -0
- package/knowledge/shared/harness-core/fh_three_layer_canon.md +12 -0
- package/knowledge/shared/harness-core/measurement-integrity-checklist.md +16 -0
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +137 -0
- package/package.json +12 -1
- package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-commons/skills/ko-tech-writer/SKILL.md +84 -4
- package/plugins/fh-commons/skills/ko-tech-writer/fh-module.yaml +19 -0
- package/plugins/fh-commons/skills/ko-tech-writer/fixtures/known_negative.md +73 -1
- package/plugins/fh-commons/skills/ko-tech-writer/fixtures/known_positive.md +39 -1
- package/plugins/fh-commons/skills/ko-tech-writer/fixtures/known_unclosed.md +6 -0
- package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/CHANGELOG.md +32 -0
- package/plugins/fh-meta/skills/auto-decorrelation/SKILL.md +17 -0
- package/plugins/fh-meta/skills/frontier-digest/SKILL.md +14 -10
- package/plugins/fh-meta/skills/frontier-digest/SKILL_detail.md +17 -1
- package/plugins/fh-meta/skills/sim-conductor/SKILL.md +2 -2
- package/plugins/fh-meta/skills/sim-conductor/SKILL_detail.md +3 -3
- package/plugins/fh-meta/skills/steel-quench/SKILL.md +25 -1
- package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
- package/scripts/degrade_direction_scan.sh +43 -0
- package/scripts/dispatch_receipt.py +185 -0
- package/scripts/doc_claim_triad_scan.py +43 -4
- package/scripts/fh-gate.sh +71 -11
- package/scripts/fh_module_check.py +686 -0
- package/scripts/finding_fleet.sh +15 -3
- package/scripts/fixtures/frontier_digest_recall.tsv +5 -0
- package/scripts/ko_tech_writer_calibrate.py +288 -15
- package/scripts/package_coverage_check.sh +5 -0
- package/scripts/probe_live_eval.sh +19 -1
- package/scripts/probe_live_eval_lib.py +174 -5
- package/scripts/resident_cost.py +1 -1
- package/scripts/selfcheck.sh +48 -21
- package/scripts/session_checklist.py +214 -5
- package/scripts/session_close_check.sh +44 -0
- package/scripts/sim_isolated_run.sh +31 -0
- package/scripts/test_claude_md_size_lanes.sh +22 -7
- package/scripts/test_degrade_scan_shell_probes.sh +81 -0
- package/scripts/test_dispatch_receipt_lanes.sh +95 -0
- package/scripts/test_doc_claim_triad_lanes.sh +30 -0
- package/scripts/test_fh_audit_check_lanes.sh +10 -5
- package/scripts/test_fh_gate_regressions.sh +71 -1
- package/scripts/test_fh_module_check_lanes.sh +581 -0
- package/scripts/test_finding_pipeline_lanes.sh +83 -0
- package/scripts/test_frontier_digest_recall.sh +26 -0
- package/scripts/test_frontier_digest_recall_negctl.sh +15 -0
- package/scripts/test_ko_tech_writer_lanes.sh +1 -1
- package/scripts/test_locale_invariance_lanes.sh +19 -0
- package/scripts/test_mutation_probe_lanes.sh +22 -6
- package/scripts/test_probe_live_eval_lanes.sh +116 -0
- package/scripts/test_resident_cost_lanes.sh +1 -1
- package/scripts/test_selfcheck_state_lanes.sh +32 -0
- package/scripts/test_session_checklist_lanes.sh +167 -0
- package/scripts/test_sim_isolated_run_lanes.sh +51 -0
- package/scripts/test_utterance_checklist_hook_lanes.sh +175 -0
- package/scripts/utterance_checklist_hook.py +193 -0
- package/scripts/utterance_checklist_hook.sh +31 -0
- package/templates/PRE-PUBLISH-CHECKLIST.md +10 -0
- package/templates/degrade_direction_scan.sh +43 -0
package/scripts/fh-gate.sh
CHANGED
|
@@ -30,6 +30,37 @@
|
|
|
30
30
|
# FH_RECORD_BASE=<p> directory for governance_log YAML (default: FH_ROOT/tracks/_meta)
|
|
31
31
|
|
|
32
32
|
set -euo pipefail
|
|
33
|
+
# Unexpected failure → HARNESS_ERROR (10), never PENDING (1). Under `set -e` a command that fails where
|
|
34
|
+
# nobody expected it ends the script with that command's status — usually 1, which the contract reads as
|
|
35
|
+
# PENDING ("proceed with awareness"). MEASURED 2026-10-20: `TMPDIR=/nonexistent` made `mktemp` fail and
|
|
36
|
+
# the gate exited 1 (also through bin/fh-gate.js). Every intended outcome leaves through an explicit
|
|
37
|
+
# `exit N`, which does not fire ERR. A failing `X=$(cmd)` at top level still fires it.
|
|
38
|
+
# 🟥 NOT `set -E`: errtrace carries the trap INTO command substitutions, where it ignores the caller's
|
|
39
|
+
# `|| rc=$?`. Measured on the first draft: the cross-mode leg capture `_legout=$(…) || _legrc=$?` got
|
|
40
|
+
# 10 instead of the leg's 2, and one lane folded a BLOCKED leg into a PASS union. The regression suite
|
|
41
|
+
# (`cross: one leg BLOCKED → union BLOCKED`) is the anchor for this line.
|
|
42
|
+
# 10 is written as a literal because EXIT_HARNESS_ERROR is defined further down.
|
|
43
|
+
trap 'echo "ERROR: fh-gate: unexpected failure at line $LINENO (status $?) — failing closed as HARNESS_ERROR." >&2 || :; exit 10' ERR
|
|
44
|
+
# The ERR trap does not see every unexpected end: an unbound variable under `set -u` exits 1 without
|
|
45
|
+
# firing ERR, and so does a failure inside a function called from the EXIT trap (cross-family review,
|
|
46
|
+
# 2026-10-20 — `cleanup(){ false; }; trap cleanup EXIT; exit 2` returned 1). So the exit itself is the
|
|
47
|
+
# second check: a status of 0-3 is a verdict, and a verdict may only leave through a line that set
|
|
48
|
+
# _FH_VERDICT_EXIT=1 first (--version, --help, the cross union, the final verdict). Anything else that
|
|
49
|
+
# ends with 0-3 is reported as HARNESS_ERROR. Cleanup runs here too, and its own failure cannot change
|
|
50
|
+
# the status. Every message on these paths is `|| :` — with stderr closed a failing echo would otherwise
|
|
51
|
+
# end the handler before its `exit 10` (cross-family review round 2: `--invalid 2>&-` returned 1).
|
|
52
|
+
_FH_VERDICT_EXIT=0
|
|
53
|
+
_FH_CLEANUP=0
|
|
54
|
+
_fh_on_exit() {
|
|
55
|
+
local rc=$?
|
|
56
|
+
if [ "$_FH_CLEANUP" = 1 ]; then cleanup 2>/dev/null || true; fi
|
|
57
|
+
if [ "$rc" -le 3 ] && [ "$_FH_VERDICT_EXIT" != 1 ]; then
|
|
58
|
+
echo "ERROR: fh-gate: ended with status $rc without reaching a verdict — failing closed as HARNESS_ERROR." >&2 || :
|
|
59
|
+
exit 10
|
|
60
|
+
fi
|
|
61
|
+
exit "$rc"
|
|
62
|
+
}
|
|
63
|
+
trap _fh_on_exit EXIT
|
|
33
64
|
|
|
34
65
|
FH_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
35
66
|
# Single source of truth: read version from the package.json shipped alongside this script.
|
|
@@ -76,7 +107,7 @@ EXIT_DRY_RUN=12
|
|
|
76
107
|
case "${1:-}" in
|
|
77
108
|
--version|-V)
|
|
78
109
|
printf '%s\n' "fh-gate $VERSION"
|
|
79
|
-
exit 0
|
|
110
|
+
_FH_VERDICT_EXIT=1; exit 0
|
|
80
111
|
;;
|
|
81
112
|
--help|-h)
|
|
82
113
|
printf '%s\n' "fh-gate $VERSION — FH governance gate"
|
|
@@ -110,7 +141,7 @@ case "${1:-}" in
|
|
|
110
141
|
printf '%s\n' " FH_VERBOSE=1 print full backend stderr"
|
|
111
142
|
printf '%s\n' ""
|
|
112
143
|
printf '%s\n' " https://github.com/chrono-meta/forge-harness"
|
|
113
|
-
exit 0
|
|
144
|
+
_FH_VERDICT_EXIT=1; exit 0
|
|
114
145
|
;;
|
|
115
146
|
-*)
|
|
116
147
|
printf '%s\n' "ERROR: unrecognized option '${1}'." >&2
|
|
@@ -153,7 +184,8 @@ esac
|
|
|
153
184
|
# `cross` is a REQUEST, not a guarantee — a machine may have only one family installed. When a leg is
|
|
154
185
|
# unavailable or errors, this degrades to the surviving leg and SAYS SO, loudly, in both the human and
|
|
155
186
|
# the machine-readable output. A single-leg result that reads as if it were cross-checked is the same
|
|
156
|
-
# class of defect as a check that did not run reading as PASS.
|
|
187
|
+
# class of defect as a check that did not run reading as PASS. Since 2026-10-22 the EXIT CODE says so too:
|
|
188
|
+
# a single-leg PASS/PENDING leaves as ESCALATE (3) unless FH_GATE_CROSS_ALLOW_SINGLE=1 (see below).
|
|
157
189
|
#
|
|
158
190
|
# COST: cross is ~2x. It is deliberately NOT a default — [[feedback_decorrelation_not_fanout_cost_boundary]]
|
|
159
191
|
# says match the parallelisation axis to the failure mode rather than multiply. Callers should request
|
|
@@ -171,6 +203,15 @@ if [[ "$FH_BACKEND" == "cross" ]]; then
|
|
|
171
203
|
# without letting it abort. Verified against a BLOCKED leg, not assumed.
|
|
172
204
|
_legrc=0
|
|
173
205
|
_legout=$(FH_BACKEND="$_leg" "$0" "$@" 2>/dev/null) || _legrc=$?
|
|
206
|
+
# 11 (argument error) and 12 (dry-run) are not a leg failing — every leg gets the same arguments, so
|
|
207
|
+
# every leg would say the same. Pass them through instead of folding them into "harness error 10"
|
|
208
|
+
# (found 2026-10-20 by a local-model self-audit candidate, reproduced: cross + bad level → 10, not 11;
|
|
209
|
+
# cross + FH_DRY_RUN=1 → 10 and the prompt was lost). A dry-run leg's stdout IS the prompt — print it.
|
|
210
|
+
if [ "$_legrc" -eq "$EXIT_ARG_ERROR" ] || [ "$_legrc" -eq "$EXIT_DRY_RUN" ]; then
|
|
211
|
+
[ "$_legrc" -eq "$EXIT_DRY_RUN" ] && printf '%s\n' "$_legout"
|
|
212
|
+
echo "→ fh-gate: cross mode — leg $_leg exited $_legrc (same arguments for every leg); passing it through" >&2 || :
|
|
213
|
+
exit "$_legrc"
|
|
214
|
+
fi
|
|
174
215
|
if [ "$_legrc" -ge 10 ]; then
|
|
175
216
|
_CROSS_ERR="${_CROSS_ERR}${_CROSS_ERR:+, }$_leg (harness error $_legrc)"; continue
|
|
176
217
|
fi
|
|
@@ -189,22 +230,40 @@ $(printf '%s' "$_legout" | sed -n '/^---$/,$p')"
|
|
|
189
230
|
exit $EXIT_HARNESS_ERROR
|
|
190
231
|
fi
|
|
191
232
|
|
|
233
|
+
# 🟥 A single-leg PASS/PENDING used to leave with 0/1 — the codes a two-family run gives — so a caller reading
|
|
234
|
+
# only the exit code could not tell «cross-checked» from «one family alone» (2026-10-22, LLM call-site inventory).
|
|
235
|
+
# Cross was requested and could not be provided: that goes to a person (ESCALATE), unless the caller says
|
|
236
|
+
# exactly FH_GATE_CROSS_ALLOW_SINGLE=1, which is echoed into the output. BLOCKED/ESCALATE already stop.
|
|
237
|
+
_CROSS_FINAL="$_CROSS_WORST"; _CROSS_OVERRIDE=""
|
|
238
|
+
if [ "$_CROSS_RAN" -lt 2 ] && [ "$(_sev_rank "$_CROSS_WORST")" -lt "$(_sev_rank ESCALATE)" ]; then
|
|
239
|
+
if [ "${FH_GATE_CROSS_ALLOW_SINGLE:-}" = "1" ]; then
|
|
240
|
+
_CROSS_OVERRIDE=1
|
|
241
|
+
else
|
|
242
|
+
_CROSS_FINAL="ESCALATE"
|
|
243
|
+
fi
|
|
244
|
+
fi
|
|
192
245
|
printf 'FH_STATUS: SUCCESS\n'
|
|
193
|
-
printf 'FH_GATE_VERDICT: %s\n' "$
|
|
246
|
+
printf 'FH_GATE_VERDICT: %s\n' "$_CROSS_FINAL"
|
|
194
247
|
printf 'FH_GATE_MODE: cross\n'
|
|
195
248
|
printf 'FH_GATE_LEGS: %s\n' "$_CROSS_LEGS"
|
|
196
249
|
if [ "$_CROSS_RAN" -lt 2 ]; then
|
|
197
250
|
# Degraded, and it must be impossible to mistake this for a two-family result.
|
|
198
251
|
printf 'FH_GATE_DECORRELATED: no\n'
|
|
199
252
|
printf 'FH_GATE_DEGRADED: %s\n' "$_CROSS_ERR"
|
|
253
|
+
if [ "$_CROSS_FINAL" != "$_CROSS_WORST" ]; then
|
|
254
|
+
printf 'FH_GATE_ESCALATE_REASON: cross-degraded (single leg %s said %s; set FH_GATE_CROSS_ALLOW_SINGLE=1 to accept one family)\n' "$_CROSS_LEGS" "$_CROSS_WORST"
|
|
255
|
+
elif [ -n "$_CROSS_OVERRIDE" ]; then
|
|
256
|
+
printf 'FH_GATE_CROSS_OVERRIDE: FH_GATE_CROSS_ALLOW_SINGLE=1 (single leg %s accepted as %s)\n' "$_CROSS_LEGS" "$_CROSS_WORST"
|
|
257
|
+
fi
|
|
200
258
|
echo "WARN: FH_BACKEND=cross ran a SINGLE leg ($_CROSS_LEGS) — $_CROSS_ERR." >&2
|
|
201
259
|
echo " This verdict is NOT decorrelated. Treat it as $_CROSS_LEGS alone." >&2
|
|
202
260
|
else
|
|
203
261
|
printf 'FH_GATE_DECORRELATED: yes\n'
|
|
204
262
|
fi
|
|
205
263
|
printf '%s\n' "$_CROSS_OUT"
|
|
206
|
-
echo "→ fh-gate: cross mode — legs [$_CROSS_LEGS], union verdict $_CROSS_WORST" >&2
|
|
207
|
-
|
|
264
|
+
echo "→ fh-gate: cross mode — legs [$_CROSS_LEGS], union verdict $_CROSS_WORST, final $_CROSS_FINAL" >&2 || :
|
|
265
|
+
_FH_VERDICT_EXIT=1
|
|
266
|
+
case "$_CROSS_FINAL" in
|
|
208
267
|
PASS) exit $EXIT_PASS ;;
|
|
209
268
|
PENDING) exit $EXIT_PENDING ;;
|
|
210
269
|
BLOCKED) exit $EXIT_BLOCKED ;;
|
|
@@ -436,7 +495,7 @@ else
|
|
|
436
495
|
fi
|
|
437
496
|
|
|
438
497
|
cleanup() { rm -f "$PROMPT_FILE" "$OUTPUT_FILE" "$ERR_FILE" "$PARSE_FILE" "$SCHEMA_FILE" "$CODEX_LAST"; }
|
|
439
|
-
|
|
498
|
+
_FH_CLEANUP=1 # _fh_on_exit (top of file) calls cleanup from here on
|
|
440
499
|
|
|
441
500
|
# --- Build prompt ---
|
|
442
501
|
cat > "$PROMPT_FILE" <<PROMPT
|
|
@@ -764,11 +823,12 @@ FINDINGS_N_LOG=$(grep -m 1 "^FH_FINDINGS_COUNT:" "$PARSE_FILE" 2>/dev/null | awk
|
|
|
764
823
|
} >> "$RECORD_PATH" || echo "WARN: governance log write failed: $RECORD_PATH" >&2
|
|
765
824
|
|
|
766
825
|
# Exit code
|
|
826
|
+
_FH_VERDICT_EXIT=1
|
|
767
827
|
case "$VERDICT" in
|
|
768
|
-
PASS) echo "→ verdict: PASS" >&2
|
|
769
|
-
PENDING) echo "→ verdict: PENDING" >&2
|
|
770
|
-
BLOCKED) echo "→ verdict: BLOCKED" >&2
|
|
771
|
-
ESCALATE) echo "→ verdict: ESCALATE" >&2
|
|
828
|
+
PASS) echo "→ verdict: PASS" >&2 || :; exit $EXIT_PASS ;;
|
|
829
|
+
PENDING) echo "→ verdict: PENDING" >&2 || :; exit $EXIT_PENDING ;;
|
|
830
|
+
BLOCKED) echo "→ verdict: BLOCKED" >&2 || :; exit $EXIT_BLOCKED ;;
|
|
831
|
+
ESCALATE) echo "→ verdict: ESCALATE" >&2 || :; exit $EXIT_ESCALATE ;;
|
|
772
832
|
*)
|
|
773
833
|
echo "ERROR: unrecognized verdict '${VERDICT:-EMPTY}' — harness error, failing safe (commit not allowed)" >&2
|
|
774
834
|
exit $EXIT_HARNESS_ERROR
|