@chrono-meta/fh-gate 3.45.0 → 3.47.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/rules/fh_4axis_gate.md +1 -1
- package/.claude-plugin/marketplace.json +4 -4
- package/CHEATSHEET.md +8 -4
- package/README.ja.md +4 -0
- package/README.ko.md +22 -0
- package/README.md +24 -0
- package/README.zh.md +4 -0
- package/docs/codex-compat.md +4 -4
- package/knowledge/shared/harness-core/agents_md_runtime_details.md +2 -2
- package/knowledge/shared/harness-core/builtin_capability_map.md +5 -2
- package/knowledge/shared/harness-core/claude_md_full_reference.md +5 -1
- package/knowledge/shared/harness-core/fh_4axis_gate_detail.md +15 -0
- package/knowledge/shared/harness-core/fh_detail_protocols.md +1 -0
- package/knowledge/shared/harness-core/fh_integration_contract.md +2 -2
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +14 -0
- package/package.json +3 -1
- package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-commons/skills/mcp-circuit-breaker/SKILL.md +12 -6
- package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/CHANGELOG.md +89 -0
- package/plugins/fh-meta/skills/context-doctor/SKILL.md +1 -0
- package/plugins/fh-meta/skills/deep-clarify/SKILL.md +76 -22
- package/plugins/fh-meta/skills/frontier-digest/SKILL_detail.md +13 -7
- package/plugins/fh-meta/skills/harvest-loop/SKILL.md +2 -2
- package/plugins/fh-meta/skills/memory-hygiene/SKILL.md +6 -0
- package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
- package/scripts/fh-gate.sh +149 -19
- package/scripts/live_eval_trace.py +22 -4
- package/scripts/pr_merge_verified.sh +14 -4
- package/scripts/selfcheck.sh +2 -0
- package/scripts/test_action_yml_lanes.sh +50 -0
- package/scripts/test_deep_clarify_interview_lanes.sh +108 -0
- package/scripts/test_deep_clarify_spec_path_lanes.sh +91 -0
- package/scripts/test_fh_gate_absorb_lanes.sh +1 -0
- package/scripts/test_fh_gate_defaults_lanes.sh +229 -3
- package/scripts/test_fh_gate_fusion_lanes.sh +1 -0
- package/scripts/test_fh_gate_regressions.sh +1 -0
- package/scripts/test_live_eval_trace_lanes.sh +27 -7
- package/scripts/test_pr_merge_verified_lanes.sh +15 -2
- package/scripts/test_probe_live_eval_lanes.sh +4 -3
- package/scripts/worktree_reclaim.sh +1 -1
- package/templates/PRE-PUBLISH-CHECKLIST.md +22 -0
- package/templates/predelete_check.sh +2 -0
- package/templates/predelete_check.test.sh +10 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_deep_clarify_spec_path_lanes.sh — where deep-clarify's own Step 3 commands put the spec.
|
|
3
|
+
#
|
|
4
|
+
# WHY. deep-clarify wrote `.claude/specs/{slug}.md`. Claude Code treats `.claude/` as sensitive: a headless
|
|
5
|
+
# run gets the write refused, and an interactive non-developer gets a «modify sensitive file» prompt
|
|
6
|
+
# (FoD O2, 2026-11-21). The spec belongs in a plain work-folder path.
|
|
7
|
+
#
|
|
8
|
+
# WHAT IS CHECKED, by running the commands the skill tells the session to run (not by reading prose):
|
|
9
|
+
# P1 Step 3's mkdir block, a write to the «Write →» path and Step 3's `test -f` line, run in an empty
|
|
10
|
+
# folder, save the spec, print «SPEC SAVED», and create nothing under `.claude/`
|
|
11
|
+
# P2 the four places that name the path agree: the ABORT-if-exists check, the Write target, the
|
|
12
|
+
# `test -f` line, and the Done-When row
|
|
13
|
+
# P3 the gitignore advice for company projects is still there
|
|
14
|
+
# P4 control: the same checks on a planted copy that saves under `.claude/specs/` go red
|
|
15
|
+
# NOT CHECKED: whether a real session follows Step 3 (that is a behaviour sim, not this lane).
|
|
16
|
+
#
|
|
17
|
+
# Usage: bash scripts/test_deep_clarify_spec_path_lanes.sh Exit: 0 all pass · 1 any fail
|
|
18
|
+
set -uo pipefail
|
|
19
|
+
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
20
|
+
SKILL="$HERE/../plugins/fh-meta/skills/deep-clarify/SKILL.md"
|
|
21
|
+
TMPROOT=$(mktemp -d "${TMPDIR:-/tmp}/deep_clarify_spec_XXXXXX")
|
|
22
|
+
trap 'rm -rf "$TMPROOT"' EXIT
|
|
23
|
+
pass=0; fail=0
|
|
24
|
+
ok() { printf 'PASS %s\n' "$1"; pass=$((pass + 1)); }
|
|
25
|
+
bad() { printf 'FAIL %s — %s\n' "$1" "$2"; fail=$((fail + 1)); }
|
|
26
|
+
|
|
27
|
+
# extract <skill file> <out dir> — writes mkdir.sh, write_path, test.sh, abort_path, done_path, has_ignore
|
|
28
|
+
extract() {
|
|
29
|
+
python3 - "$1" "$2" <<'PY'
|
|
30
|
+
import re, sys, os
|
|
31
|
+
src, out = sys.argv[1], sys.argv[2]
|
|
32
|
+
t = open(src, encoding="utf-8").read()
|
|
33
|
+
a = t.find("## Step 3."); b = t.find("### Spec Document Format", a)
|
|
34
|
+
step = t[a:b] if a >= 0 and b > a else ""
|
|
35
|
+
blocks = re.findall(r"```bash\n(.*?)```", step, re.S)
|
|
36
|
+
mk = next((x for x in blocks if "mkdir" in x), "")
|
|
37
|
+
ts = next((x for x in blocks if "test -f" in x), "")
|
|
38
|
+
w = re.search(r"`Write`\s*→\s*`([^`]+)`", step)
|
|
39
|
+
ab = re.search(r"If `([^`]+)` \*\*already exists", step)
|
|
40
|
+
dw = t[t.find("## Done When"):]
|
|
41
|
+
dn = re.search(r"`test -f ([^`]+)` exits 0", dw)
|
|
42
|
+
ign = "gitignore" in step
|
|
43
|
+
def put(name, val): open(os.path.join(out, name), "w", encoding="utf-8").write(val)
|
|
44
|
+
put("mkdir.sh", mk); put("test.sh", ts)
|
|
45
|
+
put("write_path", w.group(1) if w else ""); put("abort_path", ab.group(1) if ab else "")
|
|
46
|
+
put("done_path", dn.group(1) if dn else ""); put("has_ignore", "1" if ign else "0")
|
|
47
|
+
PY
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
# check <label> <skill file> — prints the problems, nothing when the skill saves outside .claude/
|
|
51
|
+
check() {
|
|
52
|
+
local d="$TMPROOT/$1" wp tp out
|
|
53
|
+
mkdir -p "$d/x" "$d/work"; extract "$2" "$d/x" || { echo "extract failed"; return; }
|
|
54
|
+
wp=$(sed 's/{slug}/demo-spec-20261121/' "$d/x/write_path")
|
|
55
|
+
[ -s "$d/x/mkdir.sh" ] || echo "no mkdir block in Step 3"
|
|
56
|
+
[ -s "$d/x/test.sh" ] || echo "no test -f block in Step 3"
|
|
57
|
+
[ -n "$wp" ] || echo "no «Write → path» in Step 3"
|
|
58
|
+
[ -n "$wp" ] || return
|
|
59
|
+
( cd "$d/work" && bash "$d/x/mkdir.sh" ) > /dev/null 2>&1 || echo "mkdir block failed"
|
|
60
|
+
( cd "$d/work" && printf '# Spec: demo\n' > "$wp" ) 2>/dev/null || echo "write to $wp failed (directory missing?)"
|
|
61
|
+
sed 's/{slug}/demo-spec-20261121/g' "$d/x/test.sh" > "$d/x/test_run.sh"
|
|
62
|
+
out=$(cd "$d/work" && bash "$d/x/test_run.sh" 2>&1) || echo "test -f block failed: $out"
|
|
63
|
+
[[ "$out" == *"SPEC SAVED"* ]] || echo "no «SPEC SAVED» line"
|
|
64
|
+
case "$wp" in .claude/*|*/.claude/*) echo "spec path is under .claude/ ($wp)" ;; esac
|
|
65
|
+
[ -e "$d/work/.claude" ] && echo "the commands created .claude/ in the work folder"
|
|
66
|
+
for f in abort_path done_path; do
|
|
67
|
+
[ "$(cat "$d/x/$f")" = "$(cat "$d/x/write_path")" ] || echo "$f «$(cat "$d/x/$f")» ≠ write path «$(cat "$d/x/write_path")»"
|
|
68
|
+
done
|
|
69
|
+
tp=$(sed -n '/test -f /{s/.*test -f \([^ &]*\).*/\1/p;q;}' "$d/x/test.sh")
|
|
70
|
+
[ "$tp" = "$(cat "$d/x/write_path")" ] || echo "test -f path «${tp}» ≠ write path"
|
|
71
|
+
[ "$(cat "$d/x/has_ignore")" = 1 ] || echo "the gitignore advice is gone from Step 3"
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
[ -r "$SKILL" ] || { echo "HARNESS: $SKILL not readable — not measured"; exit 1; }
|
|
75
|
+
|
|
76
|
+
probs=$(check shipped "$SKILL")
|
|
77
|
+
if [ -z "$probs" ]; then ok "P1–P3 the skill's own Step 3 commands save the spec outside .claude/, four path mentions agree, gitignore advice kept"
|
|
78
|
+
else bad "P1–P3 shipped SKILL.md" "$(printf '%s' "$probs" | tr '\n' '|')"; fi
|
|
79
|
+
|
|
80
|
+
# P4 — control: a planted copy that saves under .claude/specs/ must be caught (the instrument is alive)
|
|
81
|
+
sed -E 's#(`|mkdir -p |test -f |SPEC SAVED: )specs/#\1.claude/specs/#g' "$SKILL" > "$TMPROOT/planted.md"
|
|
82
|
+
if grep -q '\.claude/specs/{slug}' "$TMPROOT/planted.md"; then
|
|
83
|
+
probs=$(check planted "$TMPROOT/planted.md")
|
|
84
|
+
[[ "$probs" == *"under .claude/"* ]] && ok "P4 control: a copy saving under .claude/specs/ is caught" \
|
|
85
|
+
|| bad "P4 control blind" "planted .claude/ path not reported: $(printf '%s' "$probs" | tr '\n' '|')"
|
|
86
|
+
else
|
|
87
|
+
bad "P4 control not planted" "no .claude/specs/{slug} in the planted copy — the substitution did not apply"
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
echo "deep-clarify spec path lanes: $pass passed, $fail failed"
|
|
91
|
+
[ "$fail" -eq 0 ]
|
|
@@ -32,6 +32,7 @@ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
32
32
|
GATE="$HERE/fh-gate.sh"
|
|
33
33
|
TMPROOT=$(mktemp -d "${TMPDIR:-/tmp}/fh_gate_absorb_XXXXXX")
|
|
34
34
|
trap 'rm -rf "$TMPROOT"' EXIT
|
|
35
|
+
export CODEX_HOME="$TMPROOT/codexhome-none" # fh-gate reads the codex user config (provider guard): not the runner's
|
|
35
36
|
export FH_RECORD_BASE="$TMPROOT/records"; mkdir -p "$FH_RECORD_BASE"
|
|
36
37
|
export FH_GATE_EXEC=off
|
|
37
38
|
# The elephant is opt-in since 3.45.0 (default off — pinned by test_fh_gate_defaults_lanes.sh); these lanes test it
|
|
@@ -16,6 +16,12 @@
|
|
|
16
16
|
# D9 --help names fh-legacy as the default reviewer
|
|
17
17
|
# D10 FH_REVIEWER=fh and the elephant pass get exactly Read/Glob/Grep — no shell, no MCP, no skill (D10b: control)
|
|
18
18
|
# D11 FH_REVIEWER=code-review keeps git but runs without the five GITHUB_* command-file variables
|
|
19
|
+
# D12 run from a copy with no action.yml (package shape): D7 is SKIPPED by name — not a pass, not a fail
|
|
20
|
+
# D14 FH_REVIEWER=code-review loads user settings only, and its prompt comes after `--` (the real CLI reads it then)
|
|
21
|
+
# D15 every codex review call (default, goldfish, elephant) has --ignore-user-config before its prompt marker
|
|
22
|
+
# D17 codex with no FH_MODEL passes no -m (codex picks a model its login accepts); FH_MODEL=x passes -m x
|
|
23
|
+
# D16 a codex user config that names where requests go (model_provider other than openai, model_providers,
|
|
24
|
+
# openai_base_url, chatgpt_base_url) or cannot be read → exit 10, no codex call; a plain or absent config proceeds
|
|
19
25
|
# D7 action.yml does not put FH_TIMEOUT in the step env; it exports it only when the `timeout` input (default '') is non-empty
|
|
20
26
|
# (known pair: the shipped file passes; a planted «FH_TIMEOUT: ${{ inputs.timeout }}» env line is caught)
|
|
21
27
|
# Token-free: claude and codex are stubs that answer by request kind and log what they were asked.
|
|
@@ -27,7 +33,7 @@ TMPROOT=$(mktemp -d "${TMPDIR:-/tmp}/fh_gate_defaults_XXXXXX")
|
|
|
27
33
|
trap 'rm -rf "$TMPROOT"' EXIT
|
|
28
34
|
export FH_RECORD_BASE="$TMPROOT/records"; mkdir -p "$FH_RECORD_BASE"
|
|
29
35
|
unset FH_REVIEWER FH_GATE_ELEPHANT FH_GATE_EXEC FH_TIMEOUT FH_GATE_LEVEL
|
|
30
|
-
pass=0; fail=0
|
|
36
|
+
pass=0; fail=0; skipped=0
|
|
31
37
|
ok() { printf 'PASS %s\n' "$1"; pass=$((pass + 1)); }
|
|
32
38
|
bad() { printf 'FAIL %s — %s\n' "$1" "$2"; fail=$((fail + 1)); }
|
|
33
39
|
g() { git -c user.name=t -c user.email=t@t -c commit.gpgsign=false -c core.hooksPath=/dev/null "$@"; }
|
|
@@ -40,16 +46,22 @@ case "$args" in *"/code-review "*) kind=cr ;; esac
|
|
|
40
46
|
case "$in" in *"FH ELEPHANT PASS"*) kind=ele ;; *"FH REVIEW PASS"*) kind=abs ;; esac
|
|
41
47
|
: > "${LOGDIR:-/tmp}/claude_${kind}.called"
|
|
42
48
|
printf '%s\n' "$@" > "${LOGDIR:-/tmp}/claude_${kind}.args"; env > "${LOGDIR:-/tmp}/claude_${kind}.env"
|
|
49
|
+
pwd -P > "${LOGDIR:-/tmp}/claude_${kind}.cwd"
|
|
43
50
|
empty='{"status":"SUCCESS","findings":[]}'
|
|
44
51
|
case "$kind" in legacy) p="$FAKE_PAYLOAD" ;; *) p="$empty" ;; esac
|
|
45
52
|
printf '{"is_error":false,"subtype":"success","structured_output":%s}\n' "$p"
|
|
46
53
|
FAKE
|
|
47
54
|
cat > "$FAKEBIN/codex" <<'FAKE'
|
|
48
55
|
#!/usr/bin/env bash
|
|
56
|
+
all=$(printf '%s\n' "$@")
|
|
49
57
|
out=""; while [ $# -gt 0 ]; do case "$1" in -o) out="$2"; shift 2 ;; *) shift ;; esac; done
|
|
50
58
|
in=$(cat); kind=legacy
|
|
51
59
|
case "$in" in *"FH ELEPHANT PASS"*) kind=ele ;; *"FH REVIEW PASS"*) kind=abs ;; esac
|
|
52
60
|
: > "${LOGDIR:-/tmp}/codex_${kind}.called"
|
|
61
|
+
bn="${FAKE_CODEX_BANNER:-}"; [ "$kind" = ele ] && [ -n "${FAKE_CODEX_BANNER_ELE:-}" ] && bn="$FAKE_CODEX_BANNER_ELE"
|
|
62
|
+
if [ -n "$bn" ]; then printf 'OpenAI Codex (stub)\n--------\nmodel: %s\n--------\nuser\nmodel: echoed-from-prompt\n' "$bn" >&2; fi
|
|
63
|
+
if [ -n "${FAKE_CODEX_ECHO_ONLY:-}" ]; then printf 'OpenAI Codex (stub)\n--------\nuser\nmodel: echoed-from-prompt\n' >&2; fi
|
|
64
|
+
printf '%s\n' "$all" > "${LOGDIR:-/tmp}/codex_${kind}.args"; pwd -P > "${LOGDIR:-/tmp}/codex_${kind}.cwd"
|
|
53
65
|
empty='{"status":"SUCCESS","findings":[]}'
|
|
54
66
|
case "$kind" in legacy) p="$FAKE_PAYLOAD" ;; *) p="$empty" ;; esac
|
|
55
67
|
[ -n "$out" ] && printf '%s' "$p" > "$out"
|
|
@@ -57,6 +69,9 @@ exit 0
|
|
|
57
69
|
FAKE
|
|
58
70
|
chmod +x "$FAKEBIN/claude" "$FAKEBIN/codex"
|
|
59
71
|
export PATH="$FAKEBIN:$PATH"
|
|
72
|
+
# The codex calls read the runner's codex user config (the provider guard does); pin it to an empty home so the lane
|
|
73
|
+
# does not depend on whose machine runs it. D16 points CODEX_HOME at its own fixtures.
|
|
74
|
+
export CODEX_HOME="$TMPROOT/codexhome-none"
|
|
60
75
|
export FAKE_PAYLOAD='{"status":"SUCCESS","verdict":"PASS","findings_count":0,"findings_a":0,"findings_b":0,"findings":[]}'
|
|
61
76
|
|
|
62
77
|
REPO="$TMPROOT/repo"; mkdir -p "$REPO/scripts"
|
|
@@ -122,6 +137,7 @@ else bad "D9 --help default reviewer" "$(grep -m2 -F 'FH_REVIEWER' "$TMPROOT/hel
|
|
|
122
137
|
# and git's read commands write files through --output=. The whole policy is asserted, not one token of it.
|
|
123
138
|
# Known pair: on the 3.45.0 merge (7c5a6b7) both calls allow Bash(git diff:*) and carry none of the three flags.
|
|
124
139
|
argv_after() { awk -v f="$2" 'p{print; exit} $0==f{p=1}' "$1"; }
|
|
140
|
+
has_pair() { awk -v f="$2" -v v="$3" 'p&&$0==v{ok=1} {p=($0==f)} END{exit !ok}' "$1"; } # «f v» adjacent in argv
|
|
125
141
|
has_flag() { grep -qxF -- "$2" "$1"; }
|
|
126
142
|
policy_ok() { # policy_ok <args file> — prints what is wrong, nothing when the policy holds
|
|
127
143
|
local a="$1" t al d need
|
|
@@ -133,6 +149,8 @@ policy_ok() { # policy_ok <args file> — prints what is wrong, nothing when t
|
|
|
133
149
|
has_flag "$a" --strict-mcp-config || echo "no --strict-mcp-config"
|
|
134
150
|
has_flag "$a" --disable-slash-commands || echo "no --disable-slash-commands"
|
|
135
151
|
! has_flag "$a" --mcp-config || echo "an --mcp-config was passed"
|
|
152
|
+
# the reviewed checkout is untrusted: its project/local settings and hooks must not load (2026-11-22)
|
|
153
|
+
[ "$(argv_after "$a" --setting-sources)" = "user" ] || echo "setting-sources=[$(argv_after "$a" --setting-sources)]"
|
|
136
154
|
}
|
|
137
155
|
gate d10 FH_REVIEWER=fh FH_GATE_ELEPHANT=on
|
|
138
156
|
p_abs=$(policy_ok "$TMPROOT/d10/claude_abs.args" | tr '\n' ' '); p_ele=$(policy_ok "$TMPROOT/d10/claude_ele.args" | tr '\n' ' ')
|
|
@@ -143,6 +161,39 @@ printf '%s\n' --tools Read,Glob,Grep --strict-mcp-config --disable-slash-command
|
|
|
143
161
|
--disallowedTools Bash,PowerShell,Write,Edit,NotebookEdit,WebFetch,WebSearch > "$TMPROOT/planted.args"
|
|
144
162
|
[ -n "$(policy_ok "$TMPROOT/planted.args")" ] && ok "D10b the policy check catches a planted extra allowed tool (control alive)" || bad "D10b policy check blind" "planted Write in the allow list passed"
|
|
145
163
|
|
|
164
|
+
# D13 — the DEFAULT review call (fh-legacy, run_backend) gets the same read-only policy as the goldfish and
|
|
165
|
+
# elephant passes, and runs at the repository root like them. Before 2026-11-22 run_backend passed none of
|
|
166
|
+
# --tools / --strict-mcp-config / --disable-slash-commands / -s read-only (found by a codex review of a README
|
|
167
|
+
# claim). Run from a subfolder so «runs at the repo root» is distinguishable from «runs where it was called».
|
|
168
|
+
mkdir -p "$TMPROOT/d13c" "$TMPROOT/d13x"
|
|
169
|
+
( cd "$REPO/scripts" && env LOGDIR="$TMPROOT/d13c" bash "$GATE" ) > "$TMPROOT/d13c.out" 2>&1 < /dev/null; rc_c=$?
|
|
170
|
+
( cd "$REPO/scripts" && env LOGDIR="$TMPROOT/d13x" FH_BACKEND=codex bash "$GATE" ) > "$TMPROOT/d13x.out" 2>&1 < /dev/null; rc_x=$?
|
|
171
|
+
root_p=$(cd "$REPO" && pwd -P)
|
|
172
|
+
p_leg=$(policy_ok "$TMPROOT/d13c/claude_legacy.args" | tr '\n' ' ')
|
|
173
|
+
[ "$(cat "$TMPROOT/d13c/claude_legacy.cwd" 2>/dev/null)" = "$root_p" ] || p_leg="${p_leg}cwd=[$(cat "$TMPROOT/d13c/claude_legacy.cwd" 2>/dev/null)] "
|
|
174
|
+
if [ "$rc_c" -eq 0 ] && [ -z "$p_leg" ]; then ok "D13a default claude review: exactly Read/Glob/Grep, no MCP, no skill, at the repo root"
|
|
175
|
+
else bad "D13a default claude review policy" "rc=$rc_c ${p_leg:-ok}"; fi
|
|
176
|
+
x_bad=""
|
|
177
|
+
grep -qxF -- "-s" "$TMPROOT/d13x/codex_legacy.args" 2>/dev/null && [ "$(argv_after "$TMPROOT/d13x/codex_legacy.args" -s)" = "read-only" ] || x_bad="no -s read-only "
|
|
178
|
+
[ "$(cat "$TMPROOT/d13x/codex_legacy.cwd" 2>/dev/null)" = "$root_p" ] || x_bad="${x_bad}cwd=[$(cat "$TMPROOT/d13x/codex_legacy.cwd" 2>/dev/null)]"
|
|
179
|
+
has_pair "$TMPROOT/d13x/codex_legacy.args" -c "project_doc_max_bytes=0" 2>/dev/null || x_bad="${x_bad}reads the checkout AGENTS.md (no -c project_doc_max_bytes=0) "
|
|
180
|
+
if [ "$rc_x" -eq 0 ] && [ -z "$x_bad" ]; then ok "D13b default codex review: -s read-only, no checkout AGENTS.md, at the repo root"
|
|
181
|
+
else bad "D13b default codex review policy" "rc=$rc_x ${x_bad:-ok}"; fi
|
|
182
|
+
|
|
183
|
+
# D13c — the opt-in codex goldfish and elephant passes do not read the reviewed checkout's AGENTS.md either.
|
|
184
|
+
# Measured 2026-11-22 (real codex 0.164.0, local fake API, planted fixture): without the flag the request
|
|
185
|
+
# carries the checkout's AGENTS.md; with `-c project_doc_max_bytes=0` it does not.
|
|
186
|
+
gate d13y FH_BACKEND=codex FH_REVIEWER=fh FH_GATE_ELEPHANT=on
|
|
187
|
+
y_bad=""
|
|
188
|
+
for k in abs ele; do
|
|
189
|
+
f="$TMPROOT/d13y/codex_${k}.args"
|
|
190
|
+
[ -s "$f" ] || { y_bad="${y_bad}${k}: no call recorded "; continue; }
|
|
191
|
+
has_pair "$f" -c "project_doc_max_bytes=0" || y_bad="${y_bad}${k}: no -c project_doc_max_bytes=0 "
|
|
192
|
+
[ "$(argv_after "$f" -s)" = "read-only" ] || y_bad="${y_bad}${k}: no -s read-only "
|
|
193
|
+
done
|
|
194
|
+
if [ "$RC" -eq 0 ] && [ -z "$y_bad" ]; then ok "D13c codex goldfish and elephant passes: -s read-only, no checkout AGENTS.md"
|
|
195
|
+
else bad "D13c codex opt-in passes" "rc=$RC ${y_bad:-ok}"; fi
|
|
196
|
+
|
|
146
197
|
# D11 — /code-review keeps git (it needs it), so its call runs without the runner's five command-file variables.
|
|
147
198
|
# (This only removes the direct reference — the path stays labelled not read-only.)
|
|
148
199
|
gate d11 FH_REVIEWER=code-review GITHUB_ENV="$TMPROOT/gh1" GITHUB_PATH="$TMPROOT/gh2" GITHUB_OUTPUT="$TMPROOT/gh3" GITHUB_STATE="$TMPROOT/gh4" GITHUB_STEP_SUMMARY="$TMPROOT/gh5"
|
|
@@ -151,6 +202,163 @@ if [ "$RC" -eq 0 ] && [ -s "$TMPROOT/d11/claude_cr.env" ] && ! grep -qE '^GITHUB
|
|
|
151
202
|
ok "D11 /code-review call: git kept, none of the five GITHUB_* command-file variables in its environment"
|
|
152
203
|
else bad "D11 code-review env" "rc=$RC $(grep -E '^GITHUB_(ENV|PATH|OUTPUT|STATE|STEP_SUMMARY)=' "$TMPROOT/d11/claude_cr.env" 2>/dev/null | cut -d= -f1 | tr '\n' ' ')"; fi
|
|
153
204
|
|
|
205
|
+
# D14 — the opt-in /code-review call. Measured 2026-11-22 with real claude 2.1.330 on a planted checkout:
|
|
206
|
+
# ① without --setting-sources user, the checkout's project and local hooks ran, its .mcp.json server started and
|
|
207
|
+
# its CLAUDE.md, CLAUDE.local.md and .claude/rules text reached the call (3/3); with the flag, none of them (3/3).
|
|
208
|
+
# ② the CLI reads a word after --disallowedTools as that option's value («"/code-review low" was read as a value
|
|
209
|
+
# of --disallowedTools, not as a prompt»), so the call failed before any review (exit 10). With `--` in front
|
|
210
|
+
# the prompt is read as a prompt. This stub does not parse argv like the real CLI, so ② is asserted on the
|
|
211
|
+
# argv shape: the line before the /code-review prompt must be `--`.
|
|
212
|
+
cr_ok() { # cr_ok <args file> — prints what is wrong. Options count only before the first `--` (after it, everything
|
|
213
|
+
# is positional); exactly one `--`, followed by the /code-review prompt and nothing else.
|
|
214
|
+
[ -s "$1" ] || { echo "no call recorded"; return; }
|
|
215
|
+
awk '
|
|
216
|
+
!seen && $0=="--" { seen=NR; next }
|
|
217
|
+
!seen && prev=="--setting-sources" && $0=="user" { src=1 }
|
|
218
|
+
seen && NR==seen+1 { if ($0 ~ /^\/code-review /) pr=1 }
|
|
219
|
+
seen && NR>seen+1 { extra=1 }
|
|
220
|
+
seen && $0=="--" { dup=1 }
|
|
221
|
+
{ prev=$0 }
|
|
222
|
+
END {
|
|
223
|
+
if (!seen) print "no --"
|
|
224
|
+
if (!src) print "no --setting-sources user before --"
|
|
225
|
+
if (!pr) print "prompt not right after --"
|
|
226
|
+
if (extra || dup) print "more after the prompt"
|
|
227
|
+
}' "$1"
|
|
228
|
+
}
|
|
229
|
+
gate d14 FH_REVIEWER=code-review
|
|
230
|
+
z_bad=$(cr_ok "$TMPROOT/d14/claude_cr.args" | tr '\n' ' ')
|
|
231
|
+
if [ "$RC" -eq 0 ] && [ -z "$z_bad" ]; then ok "D14 /code-review call: user settings only, prompt after --"
|
|
232
|
+
else bad "D14 code-review call" "rc=$RC ${z_bad:-ok}"; fi
|
|
233
|
+
# D14b — the checker sees a planted evasion (cross-family R2): --setting-sources user moved after the first `--`
|
|
234
|
+
# (positional there) with a second `--` before the prompt. Control: the shipped shape passes the same checker.
|
|
235
|
+
printf '%s\n' --print --allowedTools Read --disallowedTools Write -- --setting-sources user -- "/code-review low" > "$TMPROOT/cr_planted.args"
|
|
236
|
+
printf '%s\n' --print --setting-sources user --allowedTools Read --disallowedTools Write -- "/code-review low" > "$TMPROOT/cr_good.args"
|
|
237
|
+
if [ -n "$(cr_ok "$TMPROOT/cr_planted.args")" ] && [ -z "$(cr_ok "$TMPROOT/cr_good.args")" ]; then
|
|
238
|
+
ok "D14b the /code-review check catches a flag moved after -- (and passes the good shape)"
|
|
239
|
+
else bad "D14b code-review checker" "planted=[$(cr_ok "$TMPROOT/cr_planted.args" | tr '\n' ' ')] good=[$(cr_ok "$TMPROOT/cr_good.args" | tr '\n' ' ')]"; fi
|
|
240
|
+
|
|
241
|
+
# D15 — every codex review call drops the user config layer. Measured 2026-11-22 (real codex 0.164.0, isolated
|
|
242
|
+
# CODEX_HOME, local fake API): when the user config marks the checkout trusted, the checkout's .codex/config.toml
|
|
243
|
+
# MCP server starts and writes outside -s read-only (3/3; untrusted 0/3); `-c mcp_servers={}`, `-c projects={}`
|
|
244
|
+
# and a per-path trust override did not stop it; --ignore-user-config did (0/3). Reuses the D13b/D13c calls.
|
|
245
|
+
# The flag must come before the `-` prompt marker and with no `--` before it (after `--` it is a positional).
|
|
246
|
+
cx_ok() { # cx_ok <args file> — prints what is wrong
|
|
247
|
+
[ -s "$1" ] || { echo "no call recorded"; return; }
|
|
248
|
+
awk '$0=="--"{dd=1} $0=="--ignore-user-config" && !dd && !dash {f=1} $0=="-"{dash=1}
|
|
249
|
+
END{ if(!f) print "no --ignore-user-config before the prompt marker" }' "$1"
|
|
250
|
+
}
|
|
251
|
+
w_bad=""
|
|
252
|
+
for k in d13x/codex_legacy d13y/codex_abs d13y/codex_ele; do
|
|
253
|
+
r=$(cx_ok "$TMPROOT/$k.args" | tr '\n' ' '); [ -z "$r" ] || w_bad="${w_bad}${k##*/}: $r"
|
|
254
|
+
done
|
|
255
|
+
printf '%s\n' exec -m x -s read-only -c project_doc_max_bytes=0 -- --ignore-user-config > "$TMPROOT/cx_planted.args"
|
|
256
|
+
printf '%s\n' exec -m x -s read-only --ignore-user-config -c project_doc_max_bytes=0 - > "$TMPROOT/cx_good.args"
|
|
257
|
+
[ -n "$(cx_ok "$TMPROOT/cx_planted.args")" ] && [ -z "$(cx_ok "$TMPROOT/cx_good.args")" ] || w_bad="${w_bad}checker control dead "
|
|
258
|
+
if [ -z "$w_bad" ]; then ok "D15 codex review calls (default, goldfish, elephant): --ignore-user-config (checker control alive)"
|
|
259
|
+
else bad "D15 codex user config" "$w_bad"; fi
|
|
260
|
+
|
|
261
|
+
# D16 — with the user config dropped (D15), a config that names where requests go would silently send the review to
|
|
262
|
+
# codex's default provider instead. fh-gate reads that config first and fails closed (exit 10, no codex call)
|
|
263
|
+
# when it sets model_provider (other than "openai"), model_providers, openai_base_url or chatgpt_base_url
|
|
264
|
+
# (codex 0.164.0 config reference), or when it cannot be read. A plain or absent config proceeds.
|
|
265
|
+
d16() { # d16 <name> <config text|-absent|-unreadable> → sets RC, CALLED
|
|
266
|
+
local n="$1" t="$2" h="$TMPROOT/d16_$1"; mkdir -p "$h"
|
|
267
|
+
case "$t" in -absent) ;; -unreadable) printf 'model = "x"\n' > "$h/config.toml"; chmod 000 "$h/config.toml" ;; *) printf '%s\n' "$t" > "$h/config.toml" ;; esac
|
|
268
|
+
gate "d16$n" FH_BACKEND=codex CODEX_HOME="$h"
|
|
269
|
+
CALLED=no; called "d16$n" codex_legacy && CALLED=yes
|
|
270
|
+
chmod 600 "$h/config.toml" 2>/dev/null || true
|
|
271
|
+
}
|
|
272
|
+
v_bad=""
|
|
273
|
+
for c in 'mp|model_provider = "corp-proxy"' 'mpq|"model_provider"="corp"' 'tbl|[model_providers.corp]' 'dot|model_providers.corp.base_url = "https://x"' \
|
|
274
|
+
'obu|openai_base_url = "https://proxy.example/v1"' 'cbu|chatgpt_base_url = "https://x"' \
|
|
275
|
+
'prof|[profiles.work]
|
|
276
|
+
model_provider = "corp"' 'inl|profiles = { work = { model_provider = "corp" } }'; do
|
|
277
|
+
n="${c%%|*}"; d16 "$n" "${c#*|}"
|
|
278
|
+
{ [ "$RC" -eq 10 ] && [ "$CALLED" = no ] && grep -qE 'model_provider|model_providers|openai_base_url|chatgpt_base_url' "$TMPROOT/d16$n.err"; } \
|
|
279
|
+
|| v_bad="${v_bad}${n}: rc=$RC called=$CALLED "
|
|
280
|
+
done
|
|
281
|
+
if [ "$(id -u)" = 0 ]; then
|
|
282
|
+
printf ' SKIP D16 unreadable config — NOT-APPLICABLE as root (chmod 000 is still readable; not measured, not a pass)\n'; skipped=$((skipped + 1))
|
|
283
|
+
else
|
|
284
|
+
# exit 10 alone would not tell the named refusal from fh-gate's generic ERR trap (a failed `cat` trips that too),
|
|
285
|
+
# so the message that names the reason is asserted as well
|
|
286
|
+
d16 unr -unreadable
|
|
287
|
+
{ [ "$RC" -eq 10 ] && [ "$CALLED" = no ] && grep -qF 'cannot read the codex user config' "$TMPROOT/d16unr.err"; } \
|
|
288
|
+
|| v_bad="${v_bad}unreadable: rc=$RC called=$CALLED named=$(grep -cF 'cannot read the codex user config' "$TMPROOT/d16unr.err") "
|
|
289
|
+
# cross-family R1 B: absence counts only when confirmed — a CODEX_HOME that cannot be searched is not «no config»
|
|
290
|
+
h="$TMPROOT/d16_lockedhome"; mkdir -p "$h"; printf 'model_provider = "corp"\n' > "$h/config.toml"; chmod 000 "$h"
|
|
291
|
+
gate d16lock FH_BACKEND=codex CODEX_HOME="$h"; chmod 700 "$h"
|
|
292
|
+
{ [ "$RC" -eq 10 ] && ! called d16lock codex_legacy && grep -qF 'cannot read the codex user config' "$TMPROOT/d16lock.err"; } \
|
|
293
|
+
|| v_bad="${v_bad}locked-home: rc=$RC "
|
|
294
|
+
fi
|
|
295
|
+
# a dangling config.toml link is not «no config» either
|
|
296
|
+
h="$TMPROOT/d16_dangling"; mkdir -p "$h"; ln -s "$TMPROOT/nowhere.toml" "$h/config.toml"
|
|
297
|
+
gate d16dang FH_BACKEND=codex CODEX_HOME="$h"
|
|
298
|
+
{ [ "$RC" -eq 10 ] && ! called d16dang codex_legacy && grep -qF 'cannot read the codex user config' "$TMPROOT/d16dang.err"; } \
|
|
299
|
+
|| v_bad="${v_bad}dangling-link: rc=$RC "
|
|
300
|
+
# cross-family R1 A: a quoted key may spell a routing key with an escape (all three are valid TOML for the real key)
|
|
301
|
+
for c in 'esc1|"openai\u005fbase_url" = "https://corp.example/v1"' 'esc2|"model\u005fprovider" = "azure"' \
|
|
302
|
+
'esc3|"model\U0000005Fproviders".corp.base_url = "https://x"' 'esc4|"chatgpt\x5fbase_url" = "https://x"'; do
|
|
303
|
+
n="${c%%|*}"; d16 "$n" "${c#*|}"
|
|
304
|
+
{ [ "$RC" -eq 10 ] && [ "$CALLED" = no ] && grep -qF 'escape' "$TMPROOT/d16$n.err"; } || v_bad="${v_bad}${n}: rc=$RC called=$CALLED "
|
|
305
|
+
done
|
|
306
|
+
for c in 'plain|model = "gpt-x"' 'oai|model_provider = "openai"' 'cmt|# model_provider = "corp"' \
|
|
307
|
+
"oaisq|'model_provider' = 'openai'" 'oaitq|model_provider = """openai"""'; do
|
|
308
|
+
n="${c%%|*}"; d16 "$n" "${c#*|}"
|
|
309
|
+
{ [ "$RC" -eq 0 ] && [ "$CALLED" = yes ]; } || v_bad="${v_bad}${n}(should proceed): rc=$RC called=$CALLED "
|
|
310
|
+
done
|
|
311
|
+
d16 abs -absent; { [ "$RC" -eq 0 ] && [ "$CALLED" = yes ]; } || v_bad="${v_bad}absent(should proceed): rc=$RC called=$CALLED "
|
|
312
|
+
if [ -z "$v_bad" ]; then ok "D16 codex provider guard: 8 route-changing configs, 4 escaped keys, unreadable/locked/dangling → exit 10, no call; plain/openai(3 spellings)/comment/absent proceed"
|
|
313
|
+
else bad "D16 codex provider guard" "$v_bad"; fi
|
|
314
|
+
|
|
315
|
+
# D17 — the codex default model. Measured 2026-11-22 on codex 0.164.0 with a ChatGPT-account login: `-m gpt-5.5`
|
|
316
|
+
# (the old default) → 400 «The 'gpt-5.5' model is not supported when using Codex with a ChatGPT account»; no -m
|
|
317
|
+
# → codex picked gpt-6.1-terra from its own catalog and answered. So with FH_MODEL unset fh-gate passes no -m;
|
|
318
|
+
# an explicit FH_MODEL is still passed as -m. The governance record names the model codex resolved, read from the
|
|
319
|
+
# banner line above `user` only (cross-family R1: «not pinned» alone hides which model gave the verdict).
|
|
320
|
+
d17gate() { local n="$1"; shift; mkdir -p "$TMPROOT/rec_$n"; gate "$n" FH_RECORD_BASE="$TMPROOT/rec_$n" "$@"; eval "RC_$n=$RC"; }
|
|
321
|
+
d17rec() { awk '/^ model: /{print; exit}' "$TMPROOT/rec_$1"/governance_log_*.yaml 2>/dev/null || true; }
|
|
322
|
+
d17gate d17 FH_BACKEND=codex FH_MODEL=
|
|
323
|
+
d17gate d17b FH_BACKEND=codex FH_MODEL= FAKE_CODEX_BANNER=gpt-banner-x
|
|
324
|
+
d17gate d17e FH_BACKEND=codex FH_MODEL= "FAKE_CODEX_BANNER=evil; touch /tmp/x"
|
|
325
|
+
d17gate d17n FH_BACKEND=codex FH_MODEL= FAKE_CODEX_ECHO_ONLY=1 # a «model:» only below `user` (prompt echo) must not count
|
|
326
|
+
d17gate d17x FH_BACKEND=codex FH_MODEL=gpt-pinned-x
|
|
327
|
+
d17gate d17y FH_BACKEND=codex FH_REVIEWER=fh FH_GATE_ELEPHANT=on FH_MODEL=
|
|
328
|
+
d17gate d17z FH_BACKEND=codex FH_REVIEWER=fh FH_GATE_ELEPHANT=on FH_MODEL=gpt-pinned-y
|
|
329
|
+
d17gate d17p FH_BACKEND=codex FH_REVIEWER=fh FH_GATE_ELEPHANT=on FH_MODEL= FAKE_CODEX_BANNER=gpt-rev-a FAKE_CODEX_BANNER_ELE=gpt-ele-b
|
|
330
|
+
u_bad=""
|
|
331
|
+
for n in d17 d17b d17e d17n d17x d17y d17z d17p; do eval "r=\$RC_$n"; [ "$r" -eq 0 ] || u_bad="${u_bad}$n rc=$r "; done
|
|
332
|
+
[ -s "$TMPROOT/d17/codex_legacy.args" ] || u_bad="${u_bad}no codex call "
|
|
333
|
+
has_flag "$TMPROOT/d17/codex_legacy.args" -m 2>/dev/null && u_bad="${u_bad}unset FH_MODEL still passes -m "
|
|
334
|
+
for k in abs ele; do
|
|
335
|
+
[ -s "$TMPROOT/d17y/codex_${k}.args" ] || u_bad="${u_bad}${k}: no call "
|
|
336
|
+
has_flag "$TMPROOT/d17y/codex_${k}.args" -m 2>/dev/null && u_bad="${u_bad}${k}: unset FH_MODEL still passes -m "
|
|
337
|
+
has_pair "$TMPROOT/d17z/codex_${k}.args" -m gpt-pinned-y 2>/dev/null || u_bad="${u_bad}${k}: explicit FH_MODEL not passed as -m "
|
|
338
|
+
done
|
|
339
|
+
has_pair "$TMPROOT/d17x/codex_legacy.args" -m gpt-pinned-x 2>/dev/null || u_bad="${u_bad}legacy: explicit FH_MODEL not passed as -m "
|
|
340
|
+
[ "$(d17rec d17)" = " model: codex default (not pinned, resolved review unknown)" ] || u_bad="${u_bad}record(no banner)=[$(d17rec d17)] "
|
|
341
|
+
[ "$(d17rec d17b)" = " model: codex default (not pinned, resolved review gpt-banner-x)" ] || u_bad="${u_bad}record(banner)=[$(d17rec d17b)] "
|
|
342
|
+
[ "$(d17rec d17e)" = " model: codex default (not pinned, resolved review unknown)" ] || u_bad="${u_bad}record(bad banner)=[$(d17rec d17e)] "
|
|
343
|
+
[ "$(d17rec d17n)" = " model: codex default (not pinned, resolved review unknown)" ] || u_bad="${u_bad}record(echo only)=[$(d17rec d17n)] "
|
|
344
|
+
[ "$(d17rec d17p)" = " model: codex default (not pinned, resolved review gpt-rev-a, elephant gpt-ele-b)" ] || u_bad="${u_bad}record(per pass)=[$(d17rec d17p)] "
|
|
345
|
+
# the record stays valid YAML (cross-family R2: «resolved: x» inside a plain scalar broke it): no «: » in any value,
|
|
346
|
+
# and where PyYAML is present the files parse and give the model back as a string
|
|
347
|
+
for n in d17 d17p d17x; do
|
|
348
|
+
v=$(d17rec "$n"); v="${v# model: }"; [[ "$v" != *": "* ]] || u_bad="${u_bad}$n model value has «: » "
|
|
349
|
+
if python3 -c 'import yaml' 2>/dev/null; then
|
|
350
|
+
python3 - "$TMPROOT/rec_$n" <<'PYY' || u_bad="${u_bad}$n record does not parse as YAML "
|
|
351
|
+
import glob, sys, yaml
|
|
352
|
+
for f in glob.glob(sys.argv[1] + "/governance_log_*.yaml"):
|
|
353
|
+
d = yaml.safe_load(open(f))
|
|
354
|
+
assert isinstance(d, list) and all(isinstance(x.get("model"), str) for x in d), f
|
|
355
|
+
PYY
|
|
356
|
+
fi
|
|
357
|
+
done
|
|
358
|
+
[ "$(d17rec d17x)" = " model: gpt-pinned-x" ] || u_bad="${u_bad}record(pinned)=[$(d17rec d17x)] "
|
|
359
|
+
if [ -z "$u_bad" ]; then ok "D17 codex: no FH_MODEL → no -m on all three calls, record names the resolved model per pass (unknown if not shown or not an id) and parses as YAML; FH_MODEL=x → -m x everywhere"
|
|
360
|
+
else bad "D17 codex default model" "${u_bad}"; fi
|
|
361
|
+
|
|
154
362
|
# D7 — action.yml's step env must not carry FH_TIMEOUT; the run block exports it only from a non-empty input.
|
|
155
363
|
envblock() { awk '/^ *env: *$/{e=1; next} e && /^ *run: *\|/{exit} e{print}' "$1"; }
|
|
156
364
|
if [ -r "$ACTION" ]; then
|
|
@@ -163,7 +371,25 @@ if [ -r "$ACTION" ]; then
|
|
|
163
371
|
&& grep -qE "^ *default: ''" <<<"$(awk '/^ timeout:/{f=1} f&&/default:/{print; exit}' "$ACTION")"; then
|
|
164
372
|
ok "D7 action.yml: FH_TIMEOUT only from a non-empty timeout input (a planted env line is caught)"
|
|
165
373
|
else bad "D7 action timeout pass-through" "env lines with FH_TIMEOUT: shipped=$n_ship planted=$n_plant"; fi
|
|
166
|
-
else
|
|
374
|
+
else
|
|
375
|
+
# No action.yml here: the npm package does not ship it, and a field harness that syncs FH's lanes has none.
|
|
376
|
+
# Not a pass and not a fail — named. In an FH checkout its absence is caught by test_action_yml_lanes.sh (exit 10).
|
|
377
|
+
printf ' SKIP D7 action timeout pass-through — NOT-APPLICABLE: no action.yml at %s (not measured, not a pass)\n' "$ACTION"
|
|
378
|
+
skipped=$((skipped + 1))
|
|
379
|
+
fi
|
|
380
|
+
|
|
381
|
+
# D12 — the same lane file run from a copy with no action.yml (an installed package's shape) must SKIP D7 by name,
|
|
382
|
+
# exit 0 and print no PASS for it (3.45.0 shipped this lane failing there: pmh-dev intake 2026-11-21).
|
|
383
|
+
if [ -z "${FHGD_INNER:-}" ]; then
|
|
384
|
+
mkdir -p "$TMPROOT/pkg"; cp -R "$HERE" "$TMPROOT/pkg/scripts"
|
|
385
|
+
if [ -e "$TMPROOT/pkg/action.yml" ]; then bad "D12 package-shape copy" "action.yml present in the copy — the fixture is not package-shaped"
|
|
386
|
+
else
|
|
387
|
+
( cd "$TMPROOT/pkg" && FHGD_INNER=1 bash scripts/test_fh_gate_defaults_lanes.sh ) > "$TMPROOT/d12.out" 2>&1 < /dev/null; d12rc=$?
|
|
388
|
+
if [ "$d12rc" -eq 0 ] && grep -q '^ SKIP D7 .*NOT-APPLICABLE' "$TMPROOT/d12.out" && ! grep -q '^PASS D7' "$TMPROOT/d12.out" \
|
|
389
|
+
&& grep -q '1 skipped (not a pass)' "$TMPROOT/d12.out"; then ok "D12 without action.yml: D7 is skipped by name, exit 0, not counted as passed"
|
|
390
|
+
else bad "D12 package-shape run" "rc=$d12rc $(grep -E 'D7|lanes:' "$TMPROOT/d12.out" | tr '\n' '|')"; fi
|
|
391
|
+
fi
|
|
392
|
+
fi
|
|
167
393
|
|
|
168
|
-
echo "fh-gate defaults lanes: $pass passed, $fail failed"
|
|
394
|
+
echo "fh-gate defaults lanes: $pass passed, $fail failed$( [ "$skipped" -gt 0 ] && printf ', %s skipped (not a pass)' "$skipped")"
|
|
169
395
|
[ "$fail" -eq 0 ]
|
|
@@ -29,6 +29,7 @@ HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
29
29
|
GATE="$HERE/fh-gate.sh"
|
|
30
30
|
TMPROOT=$(mktemp -d "${TMPDIR:-/tmp}/fh_gate_fusion_XXXXXX")
|
|
31
31
|
trap 'rm -rf "$TMPROOT"' EXIT
|
|
32
|
+
export CODEX_HOME="$TMPROOT/codexhome-none" # fh-gate reads the codex user config (provider guard): not the runner's
|
|
32
33
|
export FH_RECORD_BASE="$TMPROOT/records"; mkdir -p "$FH_RECORD_BASE"
|
|
33
34
|
# These lanes exercise the opt-in review and execution layer (3.45.0: defaults are fh-legacy · exec off · elephant
|
|
34
35
|
# off — pinned by test_fh_gate_defaults_lanes.sh). Each lane that needs otherwise sets its own value.
|
|
@@ -21,6 +21,7 @@ GATE="scripts/fh-gate.sh"
|
|
|
21
21
|
pass=0; fail=0
|
|
22
22
|
TMPROOT=$(mktemp -d "${TMPDIR:-/tmp}/fh_gate_test_XXXXXX")
|
|
23
23
|
trap 'rm -rf "$TMPROOT"' EXIT
|
|
24
|
+
export CODEX_HOME="$TMPROOT/codexhome-none" # fh-gate reads the codex user config (provider guard): not the runner's
|
|
24
25
|
|
|
25
26
|
# 🟥 The gate APPENDS every invocation to $FH_RECORD_BASE/governance_log_<date>.yaml, defaulting to
|
|
26
27
|
# the hub's own tracks/_meta. Measured 2026-11-16 (clean-room audit round 9): one run of this suite
|
|
@@ -212,7 +212,8 @@ else mp=$(LIB="$T/mut2" score "$T/plg" P 'read=CATALOG\.md')
|
|
|
212
212
|
[[ "$mp" == "PASS "* ]] && ok "TR18 revert probe: inventory without plugins → TR14's pair scores PASS (TR14 would be red)" || bad "TR18 mutant still [$mp]"; fi
|
|
213
213
|
|
|
214
214
|
# ── behaviour profile (2026-11-17, record only): top-level calls in explore · edit · test-run · other.
|
|
215
|
-
# mk2 <file> <json list of [name, input, flag]> [noresult] — flag "SUB" = inside a subagent
|
|
215
|
+
# mk2 <file> <json list of [name, input, flag]> [noresult] — flag "SUB" = inside a subagent · "ERR" = its tool_result
|
|
216
|
+
# is_error · "NORES" = no tool_result at all
|
|
216
217
|
cat > "$T/mk2.py" <<'PY'
|
|
217
218
|
import json, sys
|
|
218
219
|
f, calls = sys.argv[1], json.loads(sys.argv[2])
|
|
@@ -222,7 +223,12 @@ for n, (name, inp, flag) in enumerate(calls):
|
|
|
222
223
|
if flag == "SUB":
|
|
223
224
|
a["parent_tool_use_id"] = "task0"
|
|
224
225
|
ev.append(a)
|
|
225
|
-
|
|
226
|
+
if flag == "NORES":
|
|
227
|
+
continue
|
|
228
|
+
r = {"type": "tool_result", "tool_use_id": "b%d" % n}
|
|
229
|
+
if flag == "ERR":
|
|
230
|
+
r["is_error"] = True
|
|
231
|
+
ev.append({"type": "user", "message": {"content": [r]}})
|
|
226
232
|
if len(sys.argv) < 4:
|
|
227
233
|
ev.append({"type": "result", "subtype": "success", "result": "done"})
|
|
228
234
|
open(f, "w").write("".join(json.dumps(e) + "\n" for e in ev))
|
|
@@ -235,12 +241,12 @@ B='[["Read",{"file_path":"a.md"},""],["Edit",{"file_path":"a.md"},""],["Write",{
|
|
|
235
241
|
["Edit",{"file_path":"c.md"},"SUB"],["Bash",{"command":"pytest"},"SUB"]]'
|
|
236
242
|
python3 "$T/mk2.py" "$T/bp.jsonl" "$B"
|
|
237
243
|
bp=$(python3 "$HERE/live_eval_trace.py" profile "$T/bp.jsonl"; echo "rc=$?")
|
|
238
|
-
[ "$bp" = "explore=4 edit=4 test-run=2 other=2 total=12
|
|
244
|
+
[ "$bp" = "explore=4 edit=4 test-run=2 other=2 total=12 first_error=none
|
|
239
245
|
rc=0" ] && ok "TR19 profile bins: one known call per rule; redirects to /dev/null and 2>&1 stay explore; subagent calls not counted" \
|
|
240
246
|
|| bad "TR19 [$bp]"
|
|
241
247
|
python3 "$T/mk2.py" "$T/bpn.jsonl" '[["Read",{"file_path":"a.md"},""]]' noresult
|
|
242
248
|
bn=$(python3 "$HERE/live_eval_trace.py" profile "$T/bpn.jsonl"); bu=$(python3 "$HERE/live_eval_trace.py" profile "$T/absent.jsonl"; echo "rc=$?")
|
|
243
|
-
[ "$bn" = "explore=1 edit=0 test-run=0 other=0 total=1 result=MISSING (counts are a lower bound)" ] \
|
|
249
|
+
[ "$bn" = "explore=1 edit=0 test-run=0 other=0 total=1 first_error=none result=MISSING (counts are a lower bound)" ] \
|
|
244
250
|
&& [ "$bu" = "trace=UNREADABLE
|
|
245
251
|
rc=3" ] && ok "TR20 no result event → counts marked a lower bound; unreadable stream → trace=UNREADABLE rc 3, never 0" \
|
|
246
252
|
|| bad "TR20 noresult=[$bn] absent=[$bu]"
|
|
@@ -250,7 +256,7 @@ mkdir -p "$T/mut3"; sed 's|(?!/dev/null\\b)||' "$LIB/live_eval_trace.py" > "$T/m
|
|
|
250
256
|
if ! grep -q '(?!/dev/null' "$LIB/live_eval_trace.py"; then bad "TR21 the original has no /dev/null exclusion to revert"
|
|
251
257
|
elif grep -q '(?!/dev/null' "$T/mut3/live_eval_trace.py"; then bad "TR21 mutation did not apply (instrument error, not a pass)"
|
|
252
258
|
else mb=$(python3 "$T/mut3/live_eval_trace.py" profile "$T/bp.jsonl"); mrc=$?
|
|
253
|
-
[ $mrc -eq 0 ] && [ "$mb" = "explore=3 edit=5 test-run=2 other=2 total=12" ] \
|
|
259
|
+
[ $mrc -eq 0 ] && [ "$mb" = "explore=3 edit=5 test-run=2 other=2 total=12 first_error=none" ] \
|
|
254
260
|
&& ok "TR21 revert probe: without the /dev/null exclusion, 2>/dev/null reads as an edit → TR19 would be red" \
|
|
255
261
|
|| bad "TR21 mutant rc=$mrc [$mb]"; fi
|
|
256
262
|
# TR22 (codex R1): naming a test file as data is not a test run; sed -Ei / --in-place are edits;
|
|
@@ -261,10 +267,24 @@ B2='[["Bash",{"command":"cat tests/test_example.py"},""],["Bash",{"command":"gre
|
|
|
261
267
|
["Bash",{"command":"./scripts/test_z.sh"},""],["Bash",{"command":"npm run test"},""]]'
|
|
262
268
|
python3 "$T/mk2.py" "$T/bp2.jsonl" "$B2"
|
|
263
269
|
b2=$(python3 "$HERE/live_eval_trace.py" profile "$T/bp2.jsonl")
|
|
264
|
-
[ "$b2" = "explore=3 edit=2 test-run=4 other=0 total=9" ] \
|
|
270
|
+
[ "$b2" = "explore=3 edit=2 test-run=4 other=0 total=9 first_error=none" ] \
|
|
265
271
|
&& ok "TR22 reading a test file stays explore; sed -Ei/--in-place are edits; timeout/env wrappers keep the runner visible" \
|
|
266
272
|
|| bad "TR22 [$b2]"
|
|
267
273
|
|
|
274
|
+
# TR25 (2026-11-21, absorption AQ-20261101-2): «first error depth» — the 1-based position of the first top-level
|
|
275
|
+
# call whose result is an error. A final PASS hides a run that hit errors early and recovered by luck; the depth is
|
|
276
|
+
# record only, never scored. No error → none. A call with no result → unknown (not measured is not «no error»).
|
|
277
|
+
python3 "$T/mk2.py" "$T/fe.jsonl" '[["Read",{"file_path":"a.md"},""],["Bash",{"command":"pytest"},"ERR"],["Edit",{"file_path":"a.md"},"ERR"]]'
|
|
278
|
+
python3 "$T/mk2.py" "$T/fe0.jsonl" '[["Read",{"file_path":"a.md"},""],["Bash",{"command":"pytest"},""]]'
|
|
279
|
+
python3 "$T/mk2.py" "$T/feu.jsonl" '[["Read",{"file_path":"a.md"},""],["Bash",{"command":"pytest"},"NORES"]]'
|
|
280
|
+
python3 "$T/mk2.py" "$T/fes.jsonl" '[["Read",{"file_path":"a.md"},""],["Bash",{"command":"pytest"},"SUB"]]'
|
|
281
|
+
fe=$(python3 "$HERE/live_eval_trace.py" profile "$T/fe.jsonl"); fe0=$(python3 "$HERE/live_eval_trace.py" profile "$T/fe0.jsonl")
|
|
282
|
+
feu=$(python3 "$HERE/live_eval_trace.py" profile "$T/feu.jsonl"); fes=$(python3 "$HERE/live_eval_trace.py" profile "$T/fes.jsonl")
|
|
283
|
+
[[ "$fe" == *" first_error=2"* ]] && [[ "$fe0" == *" first_error=none"* ]] && [[ "$feu" == *" first_error=unknown"* ]] \
|
|
284
|
+
&& [[ "$fes" == *" first_error=none"* ]] \
|
|
285
|
+
&& ok "TR25 first error depth: error at call 2 → 2 · no error → none · a call with no result → unknown · subagent calls not counted" \
|
|
286
|
+
|| bad "TR25 err=[$fe] none=[$fe0] nores=[$feu] sub=[$fes]"
|
|
287
|
+
|
|
268
288
|
# the count has to add the named skips, or a lane that correctly declined would read as a lane that
|
|
269
289
|
# silently did not run — which is the thing this counter exists to catch.
|
|
270
290
|
# ── TR23 (2026-11-20 weekly audit): the INVALID reason names what differs. The nightly printed two
|
|
@@ -289,7 +309,7 @@ if grep -q 'SURFACE_DIFF_RETURN' "$T/mut3/live_eval_trace.py"; then bad "TR24 mu
|
|
|
289
309
|
else m3=$(LIB="$T/mut3" score "$T/plg" P 'read=CATALOG\.md')
|
|
290
310
|
[[ "$m3" != *"plugins=fx-chart@builtin — "* ]] && [[ "$m3" == INVALID-COMPARISON* ]] && ok "TR24 revert probe: surface_diff → '' drops the named plugin (TR23 would be red), verdict unchanged" || bad "TR24 mutant still [$m3]"; fi
|
|
291
311
|
|
|
292
|
-
[ $((pass + fail + skipped)) -eq
|
|
312
|
+
[ $((pass + fail + skipped)) -eq 26 ] || bad "lane count $pass passed + $fail failed + $skipped skipped != 26 — a case did not run"
|
|
293
313
|
if [ "$skipped" -gt 0 ]; then
|
|
294
314
|
echo "live_eval_trace lanes: $pass passed, $fail failed, $skipped skipped (named, not a pass)"
|
|
295
315
|
else
|
|
@@ -46,7 +46,7 @@ setup() {
|
|
|
46
46
|
git clone -q "$d/origin.git" "$d/work" 2>/dev/null; git -C "$d/work" fetch -q origin feat
|
|
47
47
|
printf '%s' "$(git -C "$d/seed" rev-parse feat)" > "$d/head.oid"
|
|
48
48
|
}
|
|
49
|
-
# fake gh. Behaviour knobs via files in $D: view_fail · merge_fail · drop_b
|
|
49
|
+
# fake gh. Behaviour knobs via files in $D: view_fail · merge_fail · drop_b · trunc (headRefOid cut to 37 chars)
|
|
50
50
|
mkgh() {
|
|
51
51
|
local D="$1"; mkdir -p "$D/bin"
|
|
52
52
|
cat > "$D/bin/gh" <<EOF
|
|
@@ -67,7 +67,7 @@ case "\$1 \$2" in
|
|
|
67
67
|
elif [ -f "\$D/closed" ]; then echo "CLOSED \$(cat "\$D/head.oid")"
|
|
68
68
|
else echo "OPEN \$(cat "\$D/head.oid")"; fi ;;
|
|
69
69
|
*title*) echo "Fake PR title" ;;
|
|
70
|
-
*headRefOid*) cat "\$D/head.oid"; echo ;;
|
|
70
|
+
*headRefOid*) if [ -f "\$D/trunc" ]; then cut -c1-37 "\$D/head.oid"; else cat "\$D/head.oid"; echo; fi ;;
|
|
71
71
|
*state*) if [ -f "\$D/merge.oid" ] && [ ! -f "\$D/queued" ]; then echo MERGED; else echo OPEN; fi ;;
|
|
72
72
|
*mergeCommit*) if [ -f "\$D/queued" ]; then echo null; else cat "\$D/merge.oid" 2>/dev/null; echo; fi ;; esac ;;
|
|
73
73
|
"pr merge")
|
|
@@ -318,5 +318,18 @@ elif grep -q 'recorded, not enforced' "$SC"; then bad "L33 header still says the
|
|
|
318
318
|
elif ! grep -q '^#.*lease (.*TIER=AUTO, see EXIT 7)' "$SC"; then bad "L33 RECEIPT lease note no longer points at the TIER=AUTO / EXIT 7 enforcement"
|
|
319
319
|
else ok "L33 header does not contradict EXIT 7 (lease is enforced)"; fi
|
|
320
320
|
|
|
321
|
+
# ── a commit id cut short (an output-compression proxy shortened a hash in a field run: 37 of 40 chars) ──
|
|
322
|
+
# L34 the PR head read from gh is not a full 40/64-hex id → refused BEFORE the merge, by name. A 37-char prefix still
|
|
323
|
+
# resolves locally (git accepts abbreviations), so without the check the merge call went out with it.
|
|
324
|
+
setup tr; mkgh "$T/tr"; : > "$T/tr/trunc"; run "$T/tr" 7 --rerun "$GOOD"
|
|
325
|
+
{ [ "$RC" -eq 4 ] && ! merged "$T/tr" && printf '%s' "$OUT" | grep -q 'not a full 40- or 64-hex commit id'; } \
|
|
326
|
+
&& ok "L34 PR head cut to 37 chars → rc=4 BEFORE merge, named" \
|
|
327
|
+
|| { bad "L34 truncated head rc=$RC merged=$(merged "$T/tr" && echo yes || echo no)"; printf '%s\n' "$OUT" | tail -3; }
|
|
328
|
+
# L35 the caller's --expect-head cut short → usage refusal (rc=2) before anything is read or merged
|
|
329
|
+
setup te; mkgh "$T/te"; run "$T/te" 7 --rerun "$GOOD" --expect-head "$(cut -c1-37 "$T/te/head.oid")"
|
|
330
|
+
{ [ "$RC" -eq 2 ] && ! merged "$T/te" && printf '%s' "$OUT" | grep -q -- '--expect-head is not a full 40- or 64-hex commit id'; } \
|
|
331
|
+
&& ok "L35 --expect-head cut to 37 chars → rc=2, no merge, named" \
|
|
332
|
+
|| { bad "L35 truncated --expect-head rc=$RC merged=$(merged "$T/te" && echo yes || echo no)"; printf '%s\n' "$OUT" | tail -3; }
|
|
333
|
+
|
|
321
334
|
printf 'PASS %d · FAIL %d\n' "$PASS" "$FAIL"
|
|
322
335
|
[ "$FAIL" -eq 0 ]
|
|
@@ -882,7 +882,8 @@ _lane SF3 state-fp "verdict row identical across runs whose end states differ" "
|
|
|
882
882
|
# BP1 the budget stub writes no stream → MISSING for both arms (not measured ≠ 0).
|
|
883
883
|
_lane BP1 behave-prof "stub without stream: report carries 'trace=MISSING' for both arms" "2" \
|
|
884
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.
|
|
885
|
+
# BP2 a stub that writes a stream: primary explores + runs a test, control only explores. The stub writes no
|
|
886
|
+
# tool_result, so first_error is «unknown» (not measured), never «none».
|
|
886
887
|
cat > "$BSTUB/fake_sim_trace.sh" <<'FAKETRACE'
|
|
887
888
|
#!/usr/bin/env bash
|
|
888
889
|
arm=""; out=""
|
|
@@ -902,8 +903,8 @@ chmod +x "$BSTUB/fake_sim_trace.sh"
|
|
|
902
903
|
( cd "$REPO_ROOT" && FH_SIM_RUNNER_BIN="$BSTUB/fake_sim_trace.sh" \
|
|
903
904
|
bash "$RUNNER" --ids "G-GREET-01" --no-evidence --report-out "$T/bp.md" ) >"$T/bp.log" 2>&1
|
|
904
905
|
_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)"
|
|
906
|
+
"$(grep -qxF 'behaviour-profile: G-GREET-01 primary r1 explore=1 edit=0 test-run=1 other=0 total=2 first_error=unknown' "$T/bp.md" \
|
|
907
|
+
&& grep -qxF 'behaviour-profile: G-GREET-01 control r1 explore=2 edit=0 test-run=0 other=0 total=2 first_error=unknown' "$T/bp.md" && echo yes || echo no)"
|
|
907
908
|
# BP3 FH_LIVE_TRACE=0 keeps no stream → one «not recorded» line, not a MISSING line per rep
|
|
908
909
|
( cd "$REPO_ROOT" && FH_SIM_RUNNER_BIN="$BSTUB/fake_sim_trace.sh" FH_LIVE_TRACE=0 \
|
|
909
910
|
bash "$RUNNER" --ids "G-GREET-01" --no-evidence --report-out "$T/bp0.md" ) >"$T/bp0.log" 2>&1
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
# hole big enough to lose the exact thing this script exists to protect: measured on this repo's
|
|
31
31
|
# own `.gitignore`, a worktree holding ONLY `knowledge/**/*_paper_draft.md` (unpublished drafts)
|
|
32
32
|
# and `outputs/` (field-harness run artifacts) was told **«✅ safe to: git worktree remove»**.
|
|
33
|
-
# `CLAUDE.local.md`, `.claude/specs
|
|
33
|
+
# `CLAUDE.local.md`, deep-clarify specs (`specs/`, earlier `.claude/specs/`), `.claude/rules/.public-surface-patterns` are the same class
|
|
34
34
|
# — ignored AND irreplaceable, several of them with no undo at all.
|
|
35
35
|
# 🟥 That was the SECOND time in one session that a fix here re-created the disease it was fixing.
|
|
36
36
|
# So the non-blocking set is now a NAMED WHITELIST, not a category:
|
|
@@ -53,6 +53,28 @@ grep -rIE '<private-harness-name>|<internal-codename>|<corp-domain>' LICENSE REA
|
|
|
53
53
|
git ls-files | grep -iE '<internal-acronym>'
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
+
### Step 0b — Publishing a filtered copy only: did the strip flow back?
|
|
57
|
+
|
|
58
|
+
If you publish a filtered copy — protected paths stripped on a throwaway branch, pushed to a second remote — check
|
|
59
|
+
that your own integration branch did not absorb that stripped tree. In a field run it flowed back into local `main`
|
|
60
|
+
through merges: hundreds of protected files deleted and a few CI and ownership files altered. **The commit counts
|
|
61
|
+
looked normal** — `git log` and ahead/behind showed nothing. Only a tree diff against the upstream showed it:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
git fetch origin && git diff --name-status origin/main main # D = deleted · M = modified · A = added, per file
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
- `origin` here is the **unfiltered** upstream. If `origin` in your clone is the filtered remote, use the name of the
|
|
68
|
+
unfiltered one instead — against the filtered remote the stripped tree looks clean.
|
|
69
|
+
- «Protected paths» are the ones your filter strips: read them from the filter's own exclusion list (the script or
|
|
70
|
+
config that builds the filtered branch).
|
|
71
|
+
|
|
72
|
+
Any `D` on a protected path → stop before publishing. Put those files back from the upstream, for example
|
|
73
|
+
`git restore --source=origin/main -- <path>` and commit; anything wider (resetting the branch, rewriting history)
|
|
74
|
+
goes through the Destructive-Op gate first. This stays a manual check on purpose: if the same backflow shows up in a
|
|
75
|
+
second repository, mechanize it as a shared script that prints «deleted N · modified M · added A (protected-path
|
|
76
|
+
deletions P)» and warns when P > 0, without blocking.
|
|
77
|
+
|
|
56
78
|
## Step 1 — Run both gates (must both be non-LEAK)
|
|
57
79
|
|
|
58
80
|
| Gate | Catches | Pass condition |
|