@chrono-meta/fh-gate 3.43.0 → 3.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +4 -4
- package/AGENTS.md +5 -1
- package/docs/USER_GUIDE.md +95 -0
- package/knowledge/shared/harness-core/governance_engineering_definition.md +16 -0
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +12 -0
- package/knowledge/shared/plugin-catalog/recommended_plugins.md +53 -9
- package/package.json +8 -1
- package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-commons/skills/ko-tech-writer/SKILL.md +47 -12
- package/plugins/fh-commons/skills/ko-tech-writer/SKILL_detail.md +60 -0
- package/plugins/fh-commons/skills/ko-tech-writer/fixtures/sense_negative.md +30 -0
- package/plugins/fh-commons/skills/ko-tech-writer/fixtures/sense_positive.md +56 -0
- package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/CHANGELOG.md +23 -0
- package/plugins/fh-meta/skills/auto-decorrelation/SKILL.md +45 -1
- package/plugins/fh-meta/skills/sim-conductor/SKILL_detail.md +3 -3
- package/plugins/fh-meta/skills/steel-quench/SKILL_detail.md +8 -4
- package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
- package/scripts/agy_launch_guard.sh +49 -0
- package/scripts/agy_remote_run.sh +187 -0
- package/scripts/codex_launch_guard.sh +87 -0
- package/scripts/finding_fleet.sh +35 -2
- package/scripts/finding_verifier.sh +6 -2
- package/scripts/ko_tech_writer_calibrate.py +88 -1
- package/scripts/live_eval_trace.py +23 -4
- package/scripts/prepush_guard_check.sh +33 -20
- package/scripts/probe_live_eval.sh +1 -1
- package/scripts/probe_live_eval_lib.py +7 -5
- package/scripts/selfcheck.sh +51 -2
- package/scripts/session_checklist.py +109 -5
- package/scripts/sidecar_calibrate.sh +10 -2
- package/scripts/sidecar_wait.sh +21 -1
- package/scripts/test_agy_launch_guard_lanes.sh +227 -0
- package/scripts/test_agy_remote_run_lanes.sh +228 -0
- package/scripts/test_codex_launch_guard_lanes.sh +138 -0
- package/scripts/test_finding_pipeline_lanes.sh +6 -2
- package/scripts/test_live_eval_trace_lanes.sh +54 -8
- package/scripts/test_preprep_speech_coach_lanes.sh +18 -2
- package/scripts/test_prepush_guard_failure_visibility_lanes.sh +152 -0
- package/scripts/test_session_checklist_lanes.sh +205 -0
- package/scripts/test_sidecar_calibrate_lanes.sh +4 -0
- package/scripts/test_sidecar_wait_stdin.sh +18 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_agy_remote_run_lanes.sh — lanes for scripts/agy_remote_run.sh (agy only as a remote OS user).
|
|
3
|
+
#
|
|
4
|
+
# HOW. A fake `ssh`/`scp` pair stands in for the remote machine: a temp folder is the remote user's
|
|
5
|
+
# home, and the three PowerShell scripts the runner sends (canary.ps1 · run.ps1 · cleanup.ps1) are
|
|
6
|
+
# EMULATED by the fake ssh, not executed. A fake agy records that it started. No network, no real agy.
|
|
7
|
+
# WHAT IS CHECKED: the local half — refusal without a target or a fresh PASS receipt, refusal on a
|
|
8
|
+
# changed setting, no local fallback when the route is down, argument and file transport, exit codes,
|
|
9
|
+
# and that only the run's own work folder is removed.
|
|
10
|
+
# WHAT IS NOT CHECKED: the PowerShell scripts themselves (no PowerShell here) — they were run for real
|
|
11
|
+
# against a Windows remote on 2026-11-16 (canary PASS 6/6, one agy round trip); and whether the remote
|
|
12
|
+
# OS user is really isolated (that is what --canary measures, on the day it runs).
|
|
13
|
+
# Usage: bash scripts/test_agy_remote_run_lanes.sh Exit: 0 all pass · 1 any fail
|
|
14
|
+
set -uo pipefail
|
|
15
|
+
REPO="$(cd "$(dirname "$0")/.." && pwd)"
|
|
16
|
+
RUN="$REPO/scripts/agy_remote_run.sh"
|
|
17
|
+
GUARD="$REPO/scripts/agy_launch_guard.sh"
|
|
18
|
+
D="$(mktemp -d "${TMPDIR:-/tmp}/agyremote.XXXXXX")" || { echo "ENV-BLOCKED: mktemp failed — unmeasured, not a pass"; exit 1; }
|
|
19
|
+
trap 'rm -rf "$D"' EXIT
|
|
20
|
+
PASS=0; FAIL=0
|
|
21
|
+
ok() { PASS=$((PASS+1)); echo " ✅ $1"; }
|
|
22
|
+
bad() { FAIL=$((FAIL+1)); echo " ❌ $1"; }
|
|
23
|
+
RH="$D/rhome"; mkdir -p "$RH" "$D/bin"
|
|
24
|
+
|
|
25
|
+
# ── fake remote ────────────────────────────────────────────────────────────────────────────────────
|
|
26
|
+
cat > "$D/bin/ssh" <<EOF
|
|
27
|
+
#!/usr/bin/env bash
|
|
28
|
+
RH="$RH"; D="$D"
|
|
29
|
+
[ "\${FAKE_SSH_DOWN:-0}" = 1 ] && exit 255
|
|
30
|
+
while [ \$# -gt 0 ] && [ "\$1" = -o ]; do shift 2; done
|
|
31
|
+
shift # target
|
|
32
|
+
cmd="\$*"
|
|
33
|
+
case "\$cmd" in
|
|
34
|
+
"mkdir "*) mkdir "\$RH/\${cmd#mkdir }" ;;
|
|
35
|
+
powershell*-File*) f="\${cmd##*-File }"; wd="\${f%%\\\\*}"; sc="\${f##*\\\\}"; W="\$RH/\$wd"
|
|
36
|
+
mkdir -p "\$D/seen"; cp "\$W/\$sc" "\$D/seen/\$sc" 2>/dev/null
|
|
37
|
+
case "\$sc" in
|
|
38
|
+
canary.ps1) while IFS= read -r p; do ao=0; case "\$p" in '?'*) ao=1; p="\${p#?}" ;; esac
|
|
39
|
+
if grep -qxF -- "\$p" "\$D/readable" 2>/dev/null; then echo "DENY-FAIL \$p (readable)"
|
|
40
|
+
elif grep -qxF -- "\$p" "\$D/notfound" 2>/dev/null; then [ \$ao = 1 ] && echo "DENY-OK \$p (ItemNotFoundException)" || echo "DENY-FAIL \$p (not measured: ItemNotFoundException)"
|
|
41
|
+
else echo "DENY-OK \$p (UnauthorizedAccessException)"; fi
|
|
42
|
+
done < "\$W/deny.txt"
|
|
43
|
+
[ "\${FAKE_POS_FAIL:-0}" = 1 ] && echo POS-FAIL || echo POS-OK
|
|
44
|
+
exit "\${FAKE_SSH_CANARY_RC:-0}" ;;
|
|
45
|
+
run.ps1) ( cd "\$W" && args=(); while IFS= read -r a; do [ -n "\$a" ] && args+=("\$a"); done < args.txt
|
|
46
|
+
"\$D/fake_agy" -p "\$(cat prompt.txt)" \${args[@]+"\${args[@]}"} --settings "\$W/settings.json"; arc=\$?
|
|
47
|
+
echo "FH_AGY_RC=\$arc"; [ "\${FAKE_LATE_LINE:-0}" = 1 ] && echo "FH_AGY_RC=0"
|
|
48
|
+
exit "\${FAKE_SSH_RUN_RC:-\$arc}" ); exit \$? ;;
|
|
49
|
+
cleanup.ps1) n="\$wd"
|
|
50
|
+
if ! printf '%s' "\$n" | grep -Eq '^fh_agy_[0-9]{14}_[0-9a-f]{6}$'; then echo "CLEANUP-REFUSED \$n"; exit 3; fi
|
|
51
|
+
[ "\${FAKE_CLEANUP_FAIL:-0}" = 1 ] && { echo CLEANUP-FAILED; exit 5; }
|
|
52
|
+
rm -rf "\$W"; echo CLEANUP-OK ;;
|
|
53
|
+
esac ;;
|
|
54
|
+
*) echo "fake ssh: unexpected command: \$cmd" >&2; exit 99 ;;
|
|
55
|
+
esac
|
|
56
|
+
EOF
|
|
57
|
+
cat > "$D/bin/scp" <<EOF
|
|
58
|
+
#!/usr/bin/env bash
|
|
59
|
+
RH="$RH"
|
|
60
|
+
args=(); while [ \$# -gt 0 ]; do case "\$1" in -q) shift ;; -o) shift 2 ;; *) args+=("\$1"); shift ;; esac; done
|
|
61
|
+
dst="\${args[\${#args[@]}-1]}"; unset 'args[\${#args[@]}-1]'
|
|
62
|
+
case "\$dst" in
|
|
63
|
+
*:*) for s in "\${args[@]}"; do cp "\$s" "\$RH/\${dst#*:}" || exit 1; done ;;
|
|
64
|
+
*) for s in "\${args[@]}"; do cp "\$RH/\${s#*:}" "\$dst" || exit 1; done ;;
|
|
65
|
+
esac
|
|
66
|
+
EOF
|
|
67
|
+
cat > "$D/fake_agy" <<EOF
|
|
68
|
+
#!/usr/bin/env bash
|
|
69
|
+
printf '%s\n' "\$@" > "$D/agy_argv"
|
|
70
|
+
echo "fake-output" > out.txt
|
|
71
|
+
echo "FAKE-AGY-RAN"
|
|
72
|
+
[ -n "\${FAKE_AGY_SLEEP:-}" ] && sleep "\$FAKE_AGY_SLEEP"
|
|
73
|
+
[ -n "\${FAKE_AGY_FORGE:-}" ] && echo "FH_AGY_RC=0"
|
|
74
|
+
exit \${FAKE_AGY_RC:-0}
|
|
75
|
+
EOF
|
|
76
|
+
# a recording `agy` on PATH: if the runner ever fell back to a local agy, this would record it
|
|
77
|
+
printf '#!/usr/bin/env bash\n: > "%s/local_agy_ran"\n' "$D" > "$D/bin/agy"
|
|
78
|
+
chmod +x "$D/bin/ssh" "$D/bin/scp" "$D/fake_agy" "$D/bin/agy"
|
|
79
|
+
export PATH="$D/bin:$PATH" # fake ssh/scp by name, first on PATH — the runner has no override switch
|
|
80
|
+
export FH_AGY_REMOTE_RECEIPT_DIR="$D/receipts"
|
|
81
|
+
DENY='C:\Users\admin;C:\Users\Public;D:\'
|
|
82
|
+
# first / newest receipt without an early-exit reader on a pipe (pipefail class-lock)
|
|
83
|
+
first_receipt() { local f; for f in "$D"/receipts/receipt_*.txt; do [ -f "$f" ] && { printf '%s' "$f"; return 0; }; done; return 1; }
|
|
84
|
+
newest_receipt() { local f n=""; for f in "$D"/receipts/receipt_*.txt; do [ -f "$f" ] || continue; { [ -z "$n" ] || [ "$f" -nt "$n" ]; } && n="$f"; done; printf '%s' "$n"; }
|
|
85
|
+
leftover() { find "$RH" -mindepth 1 -maxdepth 1 -name 'fh_agy_*' | wc -l | tr -d ' '; }
|
|
86
|
+
run() { out=$("$@" 2>"$D/err" </dev/null); rc=$?; err=$(cat "$D/err"); }
|
|
87
|
+
|
|
88
|
+
echo "── refusals before any canary"
|
|
89
|
+
run env -u FH_AGY_REMOTE bash "$RUN" -p hi
|
|
90
|
+
[ "$rc" -eq 3 ] && printf '%s' "$err" | grep -q AGY-REMOTE-REFUSED && ok "R1 no FH_AGY_REMOTE: rc=3 refused" || bad "R1 no target: rc=$rc"
|
|
91
|
+
export FH_AGY_REMOTE=user@remote FH_AGY_REMOTE_DENY="$DENY"
|
|
92
|
+
run bash "$RUN" -p hi
|
|
93
|
+
[ "$rc" -eq 3 ] && printf '%s' "$err" | grep -q 'no canary receipt' && ok "R2 no receipt: rc=3 refused" || bad "R2 no receipt: rc=$rc err=${err:0:100}"
|
|
94
|
+
run env FH_AGY_REMOTE_DENY= bash "$RUN" --canary
|
|
95
|
+
[ "$rc" -eq 2 ] && ok "R3 canary with an empty deny list: rc=2" || bad "R3 empty deny canary: rc=$rc"
|
|
96
|
+
|
|
97
|
+
echo "── canary"
|
|
98
|
+
: > "$D/readable"
|
|
99
|
+
run bash "$RUN" --canary
|
|
100
|
+
R="$(first_receipt)"
|
|
101
|
+
if [ "$rc" -eq 0 ] && grep -qx 'verdict=PASS' "$R" && grep -qx 'denied=3/3' "$R" && [ "$(leftover)" = 0 ]; then ok "R4 canary all denied: PASS 3/3, receipt written, remote folder removed"
|
|
102
|
+
else bad "R4 canary PASS: rc=$rc receipt=$(head -4 "$R" 2>/dev/null | tr '\n' ' ') left=$(leftover)"; fi
|
|
103
|
+
printf 'C:\\Users\\Public\n' > "$D/readable"
|
|
104
|
+
run bash "$RUN" --canary
|
|
105
|
+
[ "$rc" -eq 1 ] && grep -qx 'verdict=FAIL' "$R" && ok "R5 canary with one readable path: FAIL rc=1" || bad "R5 canary readable: rc=$rc"
|
|
106
|
+
run bash "$RUN" -p hi
|
|
107
|
+
[ "$rc" -eq 3 ] && printf '%s' "$err" | grep -q 'did not pass' && ok "R6 run after a FAIL receipt: rc=3 refused" || bad "R6 run after FAIL: rc=$rc"
|
|
108
|
+
: > "$D/readable"
|
|
109
|
+
run env FAKE_POS_FAIL=1 bash "$RUN" --canary
|
|
110
|
+
[ "$rc" -eq 1 ] && grep -qx 'positive=FAIL' "$R" && ok "R7 canary whose positive control fails: FAIL" || bad "R7 positive fail: rc=$rc"
|
|
111
|
+
run bash "$RUN" --canary
|
|
112
|
+
[ "$rc" -eq 0 ] && ok "R8 canary PASS again (for the run lanes)" || bad "R8 canary PASS again: rc=$rc"
|
|
113
|
+
|
|
114
|
+
echo "── run"
|
|
115
|
+
printf 'frozen input\n' > "$D/in.txt"
|
|
116
|
+
rm -f "$D/agy_argv"
|
|
117
|
+
run bash "$RUN" --input "$D/in.txt" --fetch out.txt --fetch-dir "$D/back" -p "two words prompt" --model m1 --output-format text
|
|
118
|
+
argv="$(tr '\n' '|' < "$D/agy_argv" 2>/dev/null)"
|
|
119
|
+
if [ "$rc" -eq 0 ] && printf '%s' "$out" | grep -q FAKE-AGY-RAN && [ "$(cat "$D/back/out.txt" 2>/dev/null)" = fake-output ] \
|
|
120
|
+
&& printf '%s' "$argv" | grep -q '^-p|two words prompt|--model|m1|--output-format|text|--settings|' && [ "$(leftover)" = 0 ]; then
|
|
121
|
+
ok "R9 run: prompt and flags intact, --settings added, fetched file back, remote folder removed"
|
|
122
|
+
else bad "R9 run: rc=$rc argv=$argv left=$(leftover) err=${err:0:120}"; fi
|
|
123
|
+
run env FAKE_AGY_RC=7 bash "$RUN" -p hi
|
|
124
|
+
[ "$rc" -eq 1 ] && printf '%s' "$err" | grep -q 'AGY_RC=7' && ok "R10 remote agy rc 7: runner rc=1 with AGY_RC=7" || bad "R10 agy rc: rc=$rc err=${err:0:80}"
|
|
125
|
+
run env FAKE_CLEANUP_FAIL=1 bash "$RUN" -p hi
|
|
126
|
+
[ "$rc" -eq 5 ] && ok "R11 cleanup not confirmed: rc=5" || bad "R11 cleanup fail: rc=$rc"
|
|
127
|
+
rm -rf "$RH"/fh_agy_*
|
|
128
|
+
run env FAKE_SSH_DOWN=1 bash "$RUN" -p hi
|
|
129
|
+
[ "$rc" -eq 4 ] && printf '%s' "$err" | grep -q 'not falling back' && ok "R12 route down: rc=4, says it does not fall back" || bad "R12 route down: rc=$rc"
|
|
130
|
+
printf 'x' > "$D/bad name.txt"
|
|
131
|
+
run bash "$RUN" --input "$D/bad name.txt" -p hi
|
|
132
|
+
[ "$rc" -eq 2 ] && ok "R13 input name with a space: rc=2" || bad "R13 bad name: rc=$rc"
|
|
133
|
+
mkdir -p "$D/other"; cp "$D/in.txt" "$D/other/in.txt"
|
|
134
|
+
run bash "$RUN" --input "$D/in.txt" --input "$D/other/in.txt" -p hi
|
|
135
|
+
[ "$rc" -eq 2 ] && ok "R14 two inputs with one name: rc=2" || bad "R14 duplicate: rc=$rc"
|
|
136
|
+
run bash "$RUN" -p hi --settings x.json
|
|
137
|
+
[ "$rc" -eq 2 ] && ok "R15 caller --settings: rc=2 (the runner owns it)" || bad "R15 settings: rc=$rc"
|
|
138
|
+
|
|
139
|
+
echo "── receipt freshness and settings"
|
|
140
|
+
R="$(first_receipt)"
|
|
141
|
+
sed -i.bak 's/^epoch=.*/epoch=1000/' "$R"
|
|
142
|
+
run bash "$RUN" -p hi
|
|
143
|
+
[ "$rc" -eq 3 ] && printf '%s' "$err" | grep -q 'older than 7 days' && ok "R16 receipt older than 7 days: rc=3" || bad "R16 stale: rc=$rc"
|
|
144
|
+
run bash "$RUN" --canary
|
|
145
|
+
run env FH_AGY_REMOTE_DENY='C:\Users\admin' bash "$RUN" -p hi
|
|
146
|
+
[ "$rc" -eq 3 ] && printf '%s' "$err" | grep -q 'no canary receipt' && ok "R17 deny list changed since the canary: rc=3 (new settings, no receipt)" || bad "R17 changed: rc=$rc"
|
|
147
|
+
h_t=user@remote; h_d='C:\Users\admin'; h_a='%LOCALAPPDATA%\agy\bin\agy.exe'
|
|
148
|
+
cp "$R" "$D/receipts/receipt_$(printf 'v1|%d:%s|%d:%s|%d:%s' "${#h_t}" "$h_t" "${#h_d}" "$h_d" "${#h_a}" "$h_a" | shasum -a 256 | cut -c1-16).txt"
|
|
149
|
+
run env FH_AGY_REMOTE_DENY='C:\Users\admin' bash "$RUN" -p hi
|
|
150
|
+
[ "$rc" -eq 3 ] && printf '%s' "$err" | grep -q 'different settings' && ok "R18 receipt copied under another name: rc=3 (hash inside does not match)" || bad "R18 copied receipt: rc=$rc err=${err:0:80}"
|
|
151
|
+
|
|
152
|
+
echo "── through the guard"
|
|
153
|
+
run env FH_AGY_ISOLATION=remote-os-user bash "$GUARD" "$RUN" -p hi
|
|
154
|
+
[ "$rc" -eq 0 ] && printf '%s' "$out" | grep -q FAKE-AGY-RAN && ok "R19 guard + remote-os-user + this runner: runs" || bad "R19 guard route: rc=$rc err=${err:0:100}"
|
|
155
|
+
run env -u FH_AGY_ISOLATION bash "$GUARD" "$RUN" -p hi
|
|
156
|
+
[ "$rc" -eq 3 ] && ok "R20 guard without the marker: refused even for this runner" || bad "R20 guard no marker: rc=$rc"
|
|
157
|
+
|
|
158
|
+
echo "── review round 1 holes"
|
|
159
|
+
run bash "$RUN" --canary
|
|
160
|
+
printf '#!/usr/bin/env bash\n: > "%s/override_ran"\n' "$D" > "$D/override"; chmod +x "$D/override"
|
|
161
|
+
run env FH_AGY_REMOTE_SSH="$D/override" FH_AGY_REMOTE_SCP="$D/override" FH_AGY_REMOTE_LANE=1 bash "$RUN" -p hi
|
|
162
|
+
[ ! -e "$D/override_ran" ] && [ "$rc" -eq 0 ] && ok "R22 FH_AGY_REMOTE_SSH/SCP/LANE in the environment have no effect (no override exists)" || bad "R22 override honoured: rc=$rc"
|
|
163
|
+
printf 'x' > "$D/RUN.PS1"
|
|
164
|
+
run bash "$RUN" --input "$D/RUN.PS1" -p hi
|
|
165
|
+
[ "$rc" -eq 2 ] && printf '%s' "$err" | grep -q reserved && ok "R23 input named RUN.PS1 (case differs): rc=2 reserved" || bad "R23 RUN.PS1: rc=$rc"
|
|
166
|
+
run env FH_AGY_REMOTE_AGY="C:\\x$(printf '\342\200\231'); Remove-Item C:\\s #" bash "$RUN" -p hi
|
|
167
|
+
[ "$rc" -eq 2 ] && ok "R24 remote agy path with a smart quote: rc=2" || bad "R24 smart quote: rc=$rc"
|
|
168
|
+
run env FAKE_SSH_RUN_RC=255 bash "$RUN" -p hi
|
|
169
|
+
[ "$rc" -eq 4 ] && ok "R25 ssh exits 255 after agy ran: rc=4 (not success)" || bad "R25 ssh rc: rc=$rc"
|
|
170
|
+
rm -rf "$RH"/fh_agy_*
|
|
171
|
+
run env FAKE_CLEANUP_FAIL=1 bash "$RUN" --canary
|
|
172
|
+
R="$(printf '%s' "$out" | sed -n 's/.*receipt=//p')"
|
|
173
|
+
[ "$rc" -ne 0 ] && grep -qx 'verdict=FAIL' "$R" && ok "R26 canary whose cleanup fails: not PASS" || bad "R26 canary cleanup: rc=$rc verdict=$(sed -n 's/^verdict=//p' "$R")"
|
|
174
|
+
rm -rf "$RH"/fh_agy_*
|
|
175
|
+
: > "$D/afile" # a receipt dir UNDER a regular file cannot be created, even by root
|
|
176
|
+
run env FH_AGY_REMOTE_RECEIPT_DIR="$D/afile/sub" bash "$RUN" --canary
|
|
177
|
+
[ "$rc" -eq 4 ] && ok "R27 receipt cannot be written: rc=4" || bad "R27 unwritable receipt: rc=$rc"
|
|
178
|
+
run env FH_AGY_REMOTE_DENY="$(printf 'C:\\a\nC:\\b')" bash "$RUN" --canary
|
|
179
|
+
[ "$rc" -eq 2 ] && ok "R28 deny list with a line break: rc=2" || bad "R28 newline in deny: rc=$rc"
|
|
180
|
+
# R29 the uploaded scripts themselves carry the probes the emulator stands in for
|
|
181
|
+
if grep -q 'Get-ChildItem -LiteralPath \$p -Force -ErrorAction Stop' "$D/seen/canary.ps1" 2>/dev/null && grep -q "UnauthorizedAccess" "$D/seen/canary.ps1" \
|
|
182
|
+
&& grep -q "OpenRead(\$p)" "$D/seen/canary.ps1" && grep -q "POS-OK" "$D/seen/canary.ps1" \
|
|
183
|
+
&& grep -qF "'^fh_agy_[0-9]{14}_[0-9a-f]{6}\$'" "$D/seen/cleanup.ps1" && grep -qF '$parent -ne $env:USERPROFILE' "$D/seen/cleanup.ps1" \
|
|
184
|
+
&& grep -qF '"FH_AGY_RC=$rc"' "$D/seen/run.ps1" && grep -qF "prompt.txt' -Raw -Encoding UTF8" "$D/seen/run.ps1"; then
|
|
185
|
+
ok "R29 uploaded canary/cleanup/run scripts carry the read probe, the access-denied rule, the name+parent check and the final rc line"
|
|
186
|
+
else bad "R29 uploaded script content missing a probe or check"; fi
|
|
187
|
+
echo "── review round 2 holes"
|
|
188
|
+
printf 'C:\\Users\\Typo\n' > "$D/notfound"
|
|
189
|
+
run env FH_AGY_REMOTE_DENY='C:\Users\Typo;C:\Users\Public' bash "$RUN" --canary
|
|
190
|
+
[ "$rc" -eq 1 ] && printf '%s' "$out" | grep -q 'FAIL' && ok "R30 a deny path that does not exist (no ?): FAIL, not measured" || bad "R30 typo path: rc=$rc"
|
|
191
|
+
run env FH_AGY_REMOTE_DENY='?C:\Users\Typo;C:\Users\Public' bash "$RUN" --canary
|
|
192
|
+
[ "$rc" -eq 0 ] && ok "R31 the same path marked ? (absence accepted): PASS" || bad "R31 ? path: rc=$rc"
|
|
193
|
+
: > "$D/notfound"; rm -rf "$RH"/fh_agy_*
|
|
194
|
+
run env FAKE_SSH_CANARY_RC=255 bash "$RUN" --canary
|
|
195
|
+
[ "$rc" -eq 1 ] && ok "R32 canary whose ssh exits 255 after printing all probes: FAIL" || bad "R32 canary ssh rc: rc=$rc"
|
|
196
|
+
rm -rf "$RH"/fh_agy_*
|
|
197
|
+
run bash "$RUN" --canary
|
|
198
|
+
run env FAKE_AGY_FORGE=1 FAKE_AGY_RC=7 bash "$RUN" -p hi
|
|
199
|
+
[ "$rc" -eq 1 ] && printf '%s' "$err" | grep -q 'AGY_RC=7' && ok "R33 agy prints a forged FH_AGY_RC=0 then exits 7: runner rc=1 (only the last line counts)" || bad "R33 forged rc: rc=$rc"
|
|
200
|
+
printf 'a' > "$D/Evidence.txt"; printf 'b' > "$D/other/evidence.txt"
|
|
201
|
+
run bash "$RUN" --input "$D/Evidence.txt" --input "$D/other/evidence.txt" -p hi
|
|
202
|
+
[ "$rc" -eq 2 ] && ok "R34 inputs Evidence.txt and evidence.txt: rc=2 (Windows ignores case)" || bad "R34 case dup: rc=$rc"
|
|
203
|
+
echo "── narrowed round 3: verdict and destructive paths"
|
|
204
|
+
rm -rf "$RH"/fh_agy_*
|
|
205
|
+
run bash "$RUN" --canary
|
|
206
|
+
run bash "$RUN" --fetch ../outside.txt --fetch-dir "$D/back" -p hi
|
|
207
|
+
[ "$rc" -eq 2 ] && ok "R35 --fetch ../outside.txt: rc=2 (bare names only)" || bad "R35 fetch traversal: rc=$rc"
|
|
208
|
+
R="$(printf '%s' "$out" | sed -n 's/.*receipt=//p')"; [ -n "$R" ] || R="$(newest_receipt)"
|
|
209
|
+
run bash "$RUN" --canary; R="$(printf '%s' "$out" | sed -n 's/.*receipt=//p')"
|
|
210
|
+
sed -i.bak 's/^epoch=.*/epoch=9999999999/' "$R"
|
|
211
|
+
run bash "$RUN" -p hi
|
|
212
|
+
[ "$rc" -eq 3 ] && printf '%s' "$err" | grep -q 'future' && ok "R36 receipt dated in the future: rc=3" || bad "R36 future receipt: rc=$rc"
|
|
213
|
+
run bash "$RUN" --canary
|
|
214
|
+
run env FAKE_AGY_RC=7 FAKE_LATE_LINE=1 bash "$RUN" -p hi
|
|
215
|
+
[ "$rc" -ne 0 ] && ok "R37 agy exits 7, a late line prints FH_AGY_RC=0: not success (rc=$rc)" || bad "R37 late forged line: rc=0"
|
|
216
|
+
rm -rf "$RH"/fh_agy_*
|
|
217
|
+
FAKE_AGY_SLEEP=3 bash "$RUN" -p hi > "$D/int.out" 2> "$D/int.err" < /dev/null &
|
|
218
|
+
ipid=$!; k=0; until ls "$RH"/fh_agy_* >/dev/null 2>&1 || [ "$k" -ge 50 ]; do sleep 0.1; k=$((k+1)); done
|
|
219
|
+
sleep 0.5; kill -TERM "$ipid" 2>/dev/null; wait "$ipid" 2>/dev/null; irc=$?
|
|
220
|
+
if [ "$(leftover)" = 0 ] && [ "$irc" = 130 ]; then ok "R38 TERM during a run: the runner's own handler exits 130 and the remote work folder is removed"
|
|
221
|
+
else bad "R38 interrupt: left=$(leftover) irc=$irc waited=$k out=$(head -c 80 "$D/int.out" | tr "\n" " ") err=$(head -c 120 "$D/int.err")"; fi
|
|
222
|
+
if grep -qF "deny.txt') -Encoding UTF8" "$D/seen/canary.ps1" && grep -qF 'InnerException' "$D/seen/canary.ps1" \
|
|
223
|
+
&& grep -qF 'exit $rc' "$D/seen/run.ps1"; then ok "R39 uploaded scripts read the deny list as UTF-8, walk wrapped errors, and exit with agy's code"
|
|
224
|
+
else bad "R39 uploaded script content missing UTF-8 deny read / inner-error walk / exit code"; fi
|
|
225
|
+
[ ! -e "$D/local_agy_ran" ] && ok "R21 no lane started a local agy" || bad "R21 a local agy was started"
|
|
226
|
+
echo
|
|
227
|
+
echo "agy remote run lanes: $PASS passed, $FAIL failed"
|
|
228
|
+
[ "$FAIL" -eq 0 ]
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_codex_launch_guard_lanes.sh — lanes for scripts/codex_launch_guard.sh and the FH callers that start
|
|
3
|
+
# codex (finding_fleet.sh codex rows · finding_verifier.sh --family codex · sidecar_calibrate.sh probe).
|
|
4
|
+
#
|
|
5
|
+
# WHAT IS CHECKED: codex is not started when the prompt (stdin), an argument or the working folder refers
|
|
6
|
+
# to a configured company-repo root; it is started — with the prompt intact and its own exit code passed
|
|
7
|
+
# back — when nothing does; and an unconfigured list is said out loud, never shown as clean. A FAKE codex
|
|
8
|
+
# records whether it started; no real codex runs. The roots used here are temp folders this lane makes.
|
|
9
|
+
# WHAT IS NOT CHECKED: a company path the prompt carries in another shape (relative path, file content
|
|
10
|
+
# pasted without its path, encoding) — the guard matches root paths as strings, nothing more.
|
|
11
|
+
#
|
|
12
|
+
# Usage: bash scripts/test_codex_launch_guard_lanes.sh Exit: 0 all pass · 1 any fail
|
|
13
|
+
set -uo pipefail
|
|
14
|
+
REPO="$(cd "$(dirname "$0")/.." && pwd)"
|
|
15
|
+
GUARD="$REPO/scripts/codex_launch_guard.sh"
|
|
16
|
+
FLEET="$REPO/scripts/finding_fleet.sh"
|
|
17
|
+
VERIFIER="$REPO/scripts/finding_verifier.sh"
|
|
18
|
+
D="$(mktemp -d "${TMPDIR:-/tmp}/codexguard.XXXXXX")" || { echo "ENV-BLOCKED: mktemp failed — unmeasured, not a pass"; exit 1; }
|
|
19
|
+
trap 'rm -rf "$D"' EXIT
|
|
20
|
+
D="$(cd "$D" && pwd -P)"
|
|
21
|
+
unset FH_COMPANY_ROOTS FH_COMPANY_ROOTS_FILE
|
|
22
|
+
export FH_COMPANY_ROOTS_FILE="$D/no-such-roots-file" # keep the operator's own list out of these lanes
|
|
23
|
+
PASS=0; FAIL=0
|
|
24
|
+
ok() { PASS=$((PASS+1)); echo " ✅ $1"; }
|
|
25
|
+
bad() { FAIL=$((FAIL+1)); echo " ❌ $1"; }
|
|
26
|
+
|
|
27
|
+
cat > "$D/codex_fake" <<EOF
|
|
28
|
+
#!/usr/bin/env bash
|
|
29
|
+
cat > "$D/stdin_seen"
|
|
30
|
+
printf '%s\n' "\$@" > "$D/argv_seen"
|
|
31
|
+
: > "$D/ran"
|
|
32
|
+
echo '{"title":"fake","file":"t.py","line":1,"severity":"B","category":"x","detail":"d","defeater":"df","confidence":0.5}'
|
|
33
|
+
exit \${FAKE_CODEX_RC:-0}
|
|
34
|
+
EOF
|
|
35
|
+
chmod +x "$D/codex_fake"
|
|
36
|
+
mkdir -p "$D/company/repo-a/src" "$D/public"
|
|
37
|
+
ROOT="$D/company/repo-a"
|
|
38
|
+
run() { rm -f "$D/ran" "$D/stdin_seen"; out=$("$@" 2>"$D/err"); rc=$?; err=$(cat "$D/err"); }
|
|
39
|
+
|
|
40
|
+
echo "── guard alone"
|
|
41
|
+
run env -u FH_COMPANY_ROOTS bash "$GUARD" "$D/codex_fake" exec - <<< "review this public diff"
|
|
42
|
+
if [ "$rc" -eq 0 ] && [ -e "$D/ran" ] && printf '%s' "$err" | grep -q 'not checked'; then ok "C1 no list configured: codex runs, and the guard says «not checked» (not «clean»)"
|
|
43
|
+
else bad "C1 unconfigured: rc=$rc ran=$([ -e "$D/ran" ] && echo yes || echo no) err=${err:0:100}"; fi
|
|
44
|
+
|
|
45
|
+
export FH_COMPANY_ROOTS="$ROOT"
|
|
46
|
+
run bash "$GUARD" "$D/codex_fake" exec - <<< "please review $ROOT/src/app.py for bugs"
|
|
47
|
+
if [ "$rc" -eq 3 ] && [ ! -e "$D/ran" ] && printf '%s' "$err" | grep -q 'CODEX-REFUSED' && printf '%s' "$err" | grep -q 'prompt'; then ok "C2 company root in the prompt: refused rc=3, codex not started, says «prompt»"
|
|
48
|
+
else bad "C2 prompt: rc=$rc ran=$([ -e "$D/ran" ] && echo yes || echo no) err=${err:0:120}"; fi
|
|
49
|
+
|
|
50
|
+
printf 'diff --git a/x.sh b/x.sh\n+echo hi\n' > "$D/public.diff"
|
|
51
|
+
run env FAKE_CODEX_RC=5 bash "$GUARD" "$D/codex_fake" exec --sandbox read-only - < "$D/public.diff"
|
|
52
|
+
if [ "$rc" -eq 5 ] && [ -e "$D/ran" ] && cmp -s "$D/stdin_seen" "$D/public.diff" && [ "$(sed -n 2p "$D/argv_seen")" = "--sandbox" ]; then ok "C3 public diff: codex runs with the prompt byte-for-byte and its own rc (5) comes back"
|
|
53
|
+
else bad "C3 public: rc=$rc ran=$([ -e "$D/ran" ] && echo yes || echo no) same_stdin=$(cmp -s "$D/stdin_seen" "$D/public.diff" && echo yes || echo no)"; fi
|
|
54
|
+
|
|
55
|
+
run bash "$GUARD" "$D/codex_fake" exec -C "$ROOT" - <<< "hello"
|
|
56
|
+
[ "$rc" -eq 3 ] && [ ! -e "$D/ran" ] && printf '%s' "$err" | grep -q 'argument' && ok "C4 company root in an argument: refused" || bad "C4 argument: rc=$rc err=${err:0:100}"
|
|
57
|
+
|
|
58
|
+
run bash -c 'cd "$1" && bash "$2" "$3" exec - <<< "hello"' _ "$ROOT/src" "$GUARD" "$D/codex_fake"
|
|
59
|
+
[ "$rc" -eq 3 ] && [ ! -e "$D/ran" ] && printf '%s' "$err" | grep -q 'working folder' && ok "C5 working folder inside a company root: refused" || bad "C5 cwd: rc=$rc err=${err:0:100}"
|
|
60
|
+
|
|
61
|
+
# C6 the same root written another way: /private stripped (macOS /tmp = /private/tmp) and ~ for $HOME
|
|
62
|
+
case "$ROOT" in
|
|
63
|
+
/private/*) alt="${ROOT#/private}"
|
|
64
|
+
run bash "$GUARD" "$D/codex_fake" exec - <<< "look at $alt/src"
|
|
65
|
+
[ "$rc" -eq 3 ] && [ ! -e "$D/ran" ] && ok "C6a root written without /private: refused" || bad "C6a /private form: rc=$rc" ;;
|
|
66
|
+
*) echo " ➖ C6a /private form not applicable (temp root is not under /private)" ;;
|
|
67
|
+
esac
|
|
68
|
+
HROOT="$HOME/.fh-codex-guard-lane-$$"
|
|
69
|
+
run env FH_COMPANY_ROOTS="$HROOT" bash "$GUARD" "$D/codex_fake" exec - <<< "see ~/.fh-codex-guard-lane-$$/x"
|
|
70
|
+
[ "$rc" -eq 3 ] && [ ! -e "$D/ran" ] && ok "C6b root under HOME written with ~: refused" || bad "C6b ~ form: rc=$rc"
|
|
71
|
+
|
|
72
|
+
# C7 the list can come from a file (one path per line, # comments) instead of the environment
|
|
73
|
+
printf '# lane roots\n\n%s\n' "$ROOT" > "$D/roots"
|
|
74
|
+
run env -u FH_COMPANY_ROOTS FH_COMPANY_ROOTS_FILE="$D/roots" bash "$GUARD" "$D/codex_fake" exec - <<< "check $ROOT/src"
|
|
75
|
+
[ "$rc" -eq 3 ] && [ ! -e "$D/ran" ] && ok "C7 roots from a file: refused" || bad "C7 roots file: rc=$rc err=${err:0:100}"
|
|
76
|
+
# C7b a near-miss path (root name as a prefix of another folder) is NOT a match
|
|
77
|
+
run bash "$GUARD" "$D/codex_fake" exec - <<< "check $D/company/repo-ab/src"
|
|
78
|
+
[ "$rc" -eq 0 ] && [ -e "$D/ran" ] && ok "C7b ${ROOT##*/}b is not ${ROOT##*/}: runs (no prefix over-block)" || bad "C7b near-miss: rc=$rc"
|
|
79
|
+
|
|
80
|
+
# C7c a list file that exists but cannot be read is a refusal, not «unconfigured»
|
|
81
|
+
mkdir -p "$D/unreadable_roots" # a directory where a file is expected: open() fails with an error other than not-found
|
|
82
|
+
run env -u FH_COMPANY_ROOTS FH_COMPANY_ROOTS_FILE="$D/unreadable_roots" bash "$GUARD" "$D/codex_fake" exec - <<< "hello"
|
|
83
|
+
[ "$rc" -eq 3 ] && [ ! -e "$D/ran" ] && printf '%s' "$err" | grep -q 'cannot be read' && ok "C7c unreadable roots file: refused (not «not checked»)" || bad "C7c unreadable list: rc=$rc err=${err:0:100}"
|
|
84
|
+
|
|
85
|
+
echo "── callers"
|
|
86
|
+
printf 'def f():\n return "%s/src"\n' "$ROOT" > "$D/t_company.py"
|
|
87
|
+
printf 'def f():\n return 1\n' > "$D/t_public.py"
|
|
88
|
+
printf 'codex|logic|CODEX_BIN exec -\n' > "$D/codex.tbl"
|
|
89
|
+
rm -f "$D/ran"
|
|
90
|
+
FH_CODEX_BIN="$D/codex_fake" bash "$FLEET" "$D/t_company.py" --out "$D/f1" --fleet "$D/codex.tbl" < /dev/null > "$D/f1.out" 2>&1
|
|
91
|
+
if [ ! -e "$D/ran" ] && grep -qs 'CODEX-REFUSED' "$D/f1/err_codex_logic.txt"; then ok "C8 fleet codex row on a file that names a company root: refused"
|
|
92
|
+
else bad "C8 fleet company: started=$([ -e "$D/ran" ] && echo yes || echo no)"; fi
|
|
93
|
+
rm -f "$D/ran"
|
|
94
|
+
FH_CODEX_BIN="$D/codex_fake" bash "$FLEET" "$D/t_public.py" --out "$D/f2" --fleet "$D/codex.tbl" < /dev/null > "$D/f2.out" 2>&1
|
|
95
|
+
[ -e "$D/ran" ] && ok "C8b fleet codex row on a public file: runs (control alive)" || bad "C8b fleet public: not started"
|
|
96
|
+
printf 'codex|logic|codex exec -\n' > "$D/byname.tbl"
|
|
97
|
+
mkdir -p "$D/bin"; cp "$D/codex_fake" "$D/bin/codex"
|
|
98
|
+
rm -f "$D/ran"
|
|
99
|
+
PATH="$D/bin:$PATH" FH_CODEX_BIN="$D/codex_fake" bash "$FLEET" "$D/t_company.py" --out "$D/f3" --fleet "$D/byname.tbl" < /dev/null > "$D/f3.out" 2>&1
|
|
100
|
+
[ ! -e "$D/ran" ] && ok "C8c fleet row calling codex by name on a company file: refused" || bad "C8c by name: started"
|
|
101
|
+
# C8d round 2: round-1 findings from a public file, round 2 aimed at a company file — still refused
|
|
102
|
+
FH_CODEX_BIN="$D/codex_fake" bash "$FLEET" "$D/t_public.py" --out "$D/f4r1" --fleet "$D/codex.tbl" --r1-only < /dev/null > /dev/null 2>&1
|
|
103
|
+
rm -f "$D/ran"
|
|
104
|
+
FH_CODEX_BIN="$D/codex_fake" bash "$FLEET" "$D/t_company.py" --out "$D/f4r2" --reuse-r1 "$D/f4r1" --round2 < /dev/null > "$D/f4r2.out" 2>&1
|
|
105
|
+
if [ ! -e "$D/ran" ] && grep -qs 'CODEX-REFUSED' "$D/f4r2/err2_codex_logic.txt"; then ok "C8d fleet round 2 on a company file: refused"
|
|
106
|
+
else bad "C8d round 2: started=$([ -e "$D/ran" ] && echo yes || echo no) r2err=$(head -c 80 "$D/f4r2/err2_codex_logic.txt" 2>/dev/null)"; fi
|
|
107
|
+
# C8e a guard refusal seen through sidecar_wait is HARNESS-ERROR (nothing was reviewed), not COMPLETE
|
|
108
|
+
SW="$REPO/scripts/sidecar_wait.sh"
|
|
109
|
+
rm -f "$D/ran"
|
|
110
|
+
printf 'review %s/src\n' "$ROOT" | SIDECAR_POLL=1 bash "$SW" "$D/sw.out" 20 -- bash "$GUARD" "$D/codex_fake" exec - > "$D/sw.txt" 2>&1; swrc=$?
|
|
111
|
+
grep -q 'SIDECAR_VERDICT=HARNESS-ERROR.*reason=guard-refused' "$D/sw.txt" && [ "$swrc" -eq 3 ] && [ ! -e "$D/ran" ] \
|
|
112
|
+
&& ok "C8e guard refusal through sidecar_wait: HARNESS-ERROR reason=guard-refused (rc 3)" || bad "C8e sidecar_wait: rc=$swrc verdict=$(grep -m1 SIDECAR_VERDICT "$D/sw.txt")"
|
|
113
|
+
printf '%s\n' '{"id":"x1","title":"t","file":"t.py","line":1,"severity":"B","category":"x","detail":"d","defeater":"df","confidence":0.5}' > "$D/claims.jsonl"
|
|
114
|
+
rm -f "$D/ran"
|
|
115
|
+
FH_CODEX_BIN="$D/codex_fake" bash "$VERIFIER" --family codex --target "$D/t_company.py" < "$D/claims.jsonl" > "$D/v1.out" 2> "$D/v1.err"; vrc=$?
|
|
116
|
+
[ ! -e "$D/ran" ] && [ "$vrc" -ne 0 ] && ok "C9 verifier --family codex on a company file: not started (rc=$vrc)" || bad "C9 verifier company: rc=$vrc started=$([ -e "$D/ran" ] && echo yes || echo no)"
|
|
117
|
+
rm -f "$D/ran"
|
|
118
|
+
FH_CODEX_BIN="$D/codex_fake" bash "$VERIFIER" --family codex --target "$D/t_public.py" < "$D/claims.jsonl" > /dev/null 2>&1
|
|
119
|
+
[ -e "$D/ran" ] && ok "C9b verifier on a public file: runs (control alive)" || bad "C9b verifier public: not started"
|
|
120
|
+
|
|
121
|
+
echo "── static"
|
|
122
|
+
# C10 shipped scripts start codex only through the guard. Comment lines are skipped; lanes and the guard
|
|
123
|
+
# itself are excluded. Residual: a launch assembled from pieces is not seen by a line scan.
|
|
124
|
+
hits=$(cd "$REPO/scripts" && grep -nE '(^|[[:space:](="])("?\$\{?CODEX\}?"?|codex)[[:space:]]+exec([[:space:]]|$)' \
|
|
125
|
+
$(ls *.sh | grep -vE '^(test_|codex_launch_guard\.sh$|docker_phase1_verify\.sh$|fh-goal\.sh$|fh-gate\.sh$|fh-run\.sh$)') 2>/dev/null | grep -vE ':[0-9]+:[[:space:]]*#' | grep -v 'CODEX_GUARD' || true)
|
|
126
|
+
# Excluded by name, on purpose:
|
|
127
|
+
# · docker_phase1_verify.sh — runs codex INSIDE a container with a fixed «reply OK» prompt; no file of
|
|
128
|
+
# this machine can reach that call.
|
|
129
|
+
# · fh-goal.sh · fh-gate.sh · fh-run.sh — runtime adapters: codex there is the user's chosen agent doing
|
|
130
|
+
# the user's own work, not a verifier arm handed someone else's material. Guarding them would block a
|
|
131
|
+
# consumer whose organisation allows codex. This guard covers verifier arms only.
|
|
132
|
+
[ -z "$hits" ] && ok "C10 no shipped script starts codex around the guard" || { bad "C10 unguarded codex launch(es):"; printf ' %s\n' "$hits"; }
|
|
133
|
+
printf 'out=$(codex exec -)\n' > "$D/probe.sh"
|
|
134
|
+
grep -qE '(^|[[:space:](="])("?\$\{?CODEX\}?"?|codex)[[:space:]]+exec([[:space:]]|$)' "$D/probe.sh" && ok "C11 static pattern sees a known unguarded line (control alive)" || bad "C11 static pattern blind"
|
|
135
|
+
|
|
136
|
+
echo
|
|
137
|
+
echo "codex launch guard lanes: $PASS passed, $FAIL failed"
|
|
138
|
+
[ "$FAIL" -eq 0 ]
|
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
# verifier that cannot be reached, a family grading its own findings. Each lane below pins one of
|
|
8
8
|
# those, and the mutant lane checks that removing the guard actually turns a lane red.
|
|
9
9
|
set -uo pipefail
|
|
10
|
+
# Every agy in this file is a FAKE (a stub script), and agy_launch_guard.sh refuses any agy launch
|
|
11
|
+
# without an isolation marker. The guard's own refusal is tested in test_agy_launch_guard_lanes.sh;
|
|
12
|
+
# here the marker only lets the fakes through so these lanes keep measuring what they measure.
|
|
13
|
+
export FH_AGY_ISOLATION=container
|
|
10
14
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
11
15
|
FLEET="$HERE/finding_fleet.sh"; VERIFY="$HERE/finding_verify.py"
|
|
12
16
|
PASS=0; FAIL=0
|
|
@@ -244,7 +248,7 @@ bash "$PIPE" "$D/tgt.py" --out "$D/pipe22" --fleet "$D/fleet0.tbl" >"$D/p22" 2>&
|
|
|
244
248
|
# verifier 를 찾으므로, 뮤턴트만 임시 디렉터리에 두면 프로브는 «가드가 죽었나» 가 아니라
|
|
245
249
|
# «파일이 없나» 를 잰다 — 빨간색이 나오지만 이유가 다르다(실측 2026-09-09, 이 레인의 첫 판).
|
|
246
250
|
MUTD="$D/mut"; mkdir -p "$MUTD"
|
|
247
|
-
cp "$HERE/finding_fleet.sh" "$HERE/finding_verify.py" "$HERE/finding_verifier.sh" "$MUTD/"
|
|
251
|
+
cp "$HERE/finding_fleet.sh" "$HERE/finding_verify.py" "$HERE/finding_verifier.sh" "$HERE/agy_launch_guard.sh" "$MUTD/"
|
|
248
252
|
MUTP="$MUTD/finding_pipeline.sh"
|
|
249
253
|
MUT_ERR="$D/mut23.err"
|
|
250
254
|
/usr/bin/python3 - "$PIPE" "$MUTP" 2>"$MUT_ERR" <<'PY'
|
|
@@ -1113,7 +1117,7 @@ fi
|
|
|
1113
1117
|
# 🟥 사본의 HERE 는 사본이 있는 디렉터리다 — 형제 스크립트를 같이 옮기지 않으면 «missing …
|
|
1114
1118
|
# skipped, NOT passed» 로 exit 3 이 나서 rc 만 맞는 거짓 초록이 된다(초판이 그랬고, 아래
|
|
1115
1119
|
# coverage 단언이 그것을 잡았다 — rc 하나만 봤으면 통과했다).
|
|
1116
|
-
/bin/cp "$HERE/finding_fleet.sh" "$HERE/finding_verify.py" "$HERE/finding_verifier.sh" "$D/" 2>/dev/null
|
|
1120
|
+
/bin/cp "$HERE/finding_fleet.sh" "$HERE/finding_verify.py" "$HERE/finding_verifier.sh" "$HERE/agy_launch_guard.sh" "$D/" 2>/dev/null
|
|
1117
1121
|
/usr/bin/sed 's|done < "$ROSTER"|done < "$OUT/families.txt"|g' "$PIPE" > "$D/pipe_rev.sh"
|
|
1118
1122
|
NREV=$(/usr/bin/grep -c 'done < "\$OUT/families.txt"' "$D/pipe_rev.sh" 2>/dev/null); NREV=${NREV:-0}
|
|
1119
1123
|
if [ "$NREV" -ge 2 ]; then
|
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
# TR8 the runner refuses --trace with --turns (rc 2), never ignores it
|
|
14
14
|
# TR13 ablation_calibrate.sh (direct claude -p measurement path) pins MCP in every arm
|
|
15
15
|
# TR9 revert probe: a scorer without the «said, not done → FAIL» line turns TR2 red
|
|
16
|
+
# TR14 arms equal in tools/MCP but one loaded an extra plugin → INVALID-COMPARISON (2026-11-15 nightly shape)
|
|
17
|
+
# TR15 control: arms with the same plugin set stay comparable (PASS), also reordered or with a duplicate entry
|
|
18
|
+
# TR16 same plugin, different version → INVALID-COMPARISON (an auto-update moved a version mid-run)
|
|
19
|
+
# TR17 one arm's init carries a plugin list (or an empty one), the other's none → INVALID-COMPARISON (UNKNOWN ≠ «no plugins»)
|
|
20
|
+
# TR18 revert probe: an inventory without plugins turns TR14 back to comparable → TR14 would be red
|
|
16
21
|
set -u
|
|
17
22
|
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
18
23
|
LIB="${LIVE_EVAL_LIB_DIR:-$HERE}"
|
|
@@ -23,7 +28,8 @@ python3 "$HERE/live_eval_trace.py" extract /dev/null /dev/null /dev/null >/dev/n
|
|
|
23
28
|
&& ok "TR0 the shipped file runs by its own path (empty stream → rc 3)" || bad "TR0 direct run"
|
|
24
29
|
if [ -n "${LIVE_TRACE_REAL:-}" ]; then
|
|
25
30
|
r=$(python3 "$HERE/live_eval_trace.py" extract "$LIVE_TRACE_REAL" "$T/real.txt" "$T/real.tools" ; echo "rc=$?")
|
|
26
|
-
grep -q '^tools=.*Read' "$T/real.tools" && [ -s "$T/real.txt" ] &&
|
|
31
|
+
grep -q '^tools=.*Read' "$T/real.tools" && [ -s "$T/real.txt" ] && grep -q '| plugins=\[' "$T/real.tools" \
|
|
32
|
+
&& echo " ℹ️ TR0b real stream shape read, plugin list included ($r)" \
|
|
27
33
|
|| echo " ⚠️ TR0b real stream NOT read ($r) — fixtures may not match the real shape"
|
|
28
34
|
else
|
|
29
35
|
echo " ℹ️ TR0b real-shape re-check UNMEASURED this run (LIVE_TRACE_REAL unset) — not a pass"
|
|
@@ -33,10 +39,19 @@ fi
|
|
|
33
39
|
cat > "$T/mk.py" <<'PY'
|
|
34
40
|
import json, sys
|
|
35
41
|
f, tools, mcp, res = sys.argv[1:5]
|
|
42
|
+
import os
|
|
36
43
|
ev = [{"type": "system", "subtype": "hook_started", "hook_name": "SessionStart"}]
|
|
37
44
|
if tools != "NOINIT":
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
init = {"type": "system", "subtype": "init", "tools": [t for t in tools.split(",") if t],
|
|
46
|
+
"mcp_servers": [{"name": m.split(":")[0], "status": (m.split(":") + ["connected"])[1]} for m in mcp.split(",") if m]}
|
|
47
|
+
# MK_PLUGINS: unset/empty = no plugins key (older shape); "-" = empty list; else csv of
|
|
48
|
+
# source[=version] — the real init carries {name, path, source, version?} per plugin.
|
|
49
|
+
pl = os.environ.get("MK_PLUGINS", "")
|
|
50
|
+
if pl:
|
|
51
|
+
init["plugins"] = [] if pl == "-" else [
|
|
52
|
+
dict({"name": x.split("=")[0].split("@")[0], "path": "/fixture", "source": x.split("=")[0]},
|
|
53
|
+
**({"version": x.split("=")[1]} if "=" in x else {})) for x in pl.split(",")]
|
|
54
|
+
ev.append(init)
|
|
40
55
|
# call forms: Read=path · ERR:Read=path (tool_result is_error) · SUB:Read=path (inside a subagent)
|
|
41
56
|
for n, c in enumerate(sys.argv[5:]):
|
|
42
57
|
flag = ""
|
|
@@ -58,7 +73,7 @@ mk "$T/a.jsonl" "Read,Grep,Glob" "" "CATALOG says x" Read=CATALOG.md
|
|
|
58
73
|
python3 "$HERE/live_eval_trace.py" extract "$T/a.jsonl" "$T/a.txt" "$T/a.tools"; xrc=$?
|
|
59
74
|
printf '%s\n' '{"type":"system","subtype":"init","tools":["Read"]}' > "$T/nores.jsonl"
|
|
60
75
|
python3 "$HERE/live_eval_trace.py" extract "$T/nores.jsonl" "$T/n.txt" "$T/n.tools"; nrc=$?
|
|
61
|
-
[ $xrc -eq 0 ] && [ "$(cat "$T/a.txt")" = "CATALOG says x" ] && grep -qx 'tools=Glob,Grep,Read | mcp=' "$T/a.tools" \
|
|
76
|
+
[ $xrc -eq 0 ] && [ "$(cat "$T/a.txt")" = "CATALOG says x" ] && grep -qx 'tools=Glob,Grep,Read | mcp= | plugins=UNKNOWN' "$T/a.tools" \
|
|
62
77
|
&& [ $nrc -eq 3 ] && [ ! -s "$T/n.txt" ] \
|
|
63
78
|
&& ok "TR1 extract writes result + inventory; no result event → rc 3, empty text" \
|
|
64
79
|
|| bad "TR1 xrc=$xrc nrc=$nrc txt=$(cat "$T/a.txt") tools=$(cat "$T/a.tools")"
|
|
@@ -69,9 +84,11 @@ build(){ local root="$1" pid="$2" reps="$3" ps="$4" cs="$5" i arm spec
|
|
|
69
84
|
for i in $(seq 1 "$reps"); do
|
|
70
85
|
for arm in primary control; do
|
|
71
86
|
[ $arm = primary ] && spec="$ps" || spec="$cs"
|
|
72
|
-
IFS='|' read -r tl mc tx calls <<<"$spec"
|
|
87
|
+
IFS='|' read -r tl mc tx calls pl <<<"$spec"
|
|
88
|
+
# 5th field = plugins for rep 1 only when it starts with «r1:» (a set that changed in one rep)
|
|
89
|
+
case "$pl" in r1:*) if [ "$i" -eq 1 ]; then pl="${pl#r1:}"; else pl="${PL_BASE:-}"; fi ;; esac
|
|
73
90
|
printf '%s' "$tx" > "$root/$pid/${arm}_r$i.txt"
|
|
74
|
-
if [ "$tl" != "-" ]; then set -f; mk "$root/$pid/${arm}_r$i.stream.jsonl" "$tl" "$mc" "$tx" $calls; set +f; fi
|
|
91
|
+
if [ "$tl" != "-" ]; then set -f; MK_PLUGINS="$pl" mk "$root/$pid/${arm}_r$i.stream.jsonl" "$tl" "$mc" "$tx" $calls; set +f; fi
|
|
75
92
|
done
|
|
76
93
|
done; }
|
|
77
94
|
score(){ python3 - "$LIB" "$1" "$2" "$3" "${4:-}" <<'PY'
|
|
@@ -106,7 +123,7 @@ m=$(score "$T/old" P 'read=CATALOG\.md'); m0=$(score "$T/old" P '')
|
|
|
106
123
|
|
|
107
124
|
build "$T/inv" P 3 "Read,Grep,Glob|drive,wiki|CATALOG has it|Read=CATALOG.md" "$RT||오늘 맑아|"
|
|
108
125
|
v=$(score "$T/inv" P 'read=CATALOG\.md')
|
|
109
|
-
[[ "$v" == "INVALID-COMPARISON MENTION-ONLY INVALID-COMPARISON None "* || "$v" == "INVALID-COMPARISON BEHAVIOUR INVALID-COMPARISON None "* ]] && [[ "$v" == *"different tool/MCP lists"* ]] \
|
|
126
|
+
[[ "$v" == "INVALID-COMPARISON MENTION-ONLY INVALID-COMPARISON None "* || "$v" == "INVALID-COMPARISON BEHAVIOUR INVALID-COMPARISON None "* ]] && [[ "$v" == *"different tool/MCP/plugin lists"* ]] \
|
|
110
127
|
&& ok "TR6 arms with different tool/MCP lists → INVALID-COMPARISON, no pass_rate" || bad "TR6 [$v]"
|
|
111
128
|
|
|
112
129
|
b=$(score "$T/did" P 'reads=CATALOG')
|
|
@@ -141,5 +158,34 @@ hf=$(score "$T/half" P 'read=CATALOG\.md')
|
|
|
141
158
|
npin=$(grep -cE '^ (allowlist|denylist|baseline)\) +FLAGS=\(.*--strict-mcp-config' "$HERE/ablation_calibrate.sh")
|
|
142
159
|
[ "$npin" -eq 3 ] && ok "TR13 ablation_calibrate.sh pins MCP (--strict-mcp-config) in all 3 arms" || bad "TR13 pinned arms=$npin/3"
|
|
143
160
|
|
|
144
|
-
|
|
161
|
+
# ── plugins (2026-11-15): the nightly's G-GREET-01 / G-TRIG-05 had tools and MCP equal in every arm and
|
|
162
|
+
# one rep (primary_r1) with one extra builtin plugin; the scorer reported «1 distinct». Names below are
|
|
163
|
+
# synthetic — the shape (source@version, builtin with no version) is the real init's.
|
|
164
|
+
PB='fx-core@hub=3.42.0,fx-lsp@official=1.0.0,fx-telemetry@builtin'
|
|
165
|
+
PL_BASE="$PB" build "$T/plg" P 3 "$RT||CATALOG has it|Read=CATALOG.md|r1:$PB,fx-chart@builtin" "$RT||오늘 맑아||$PB"
|
|
166
|
+
pg=$(score "$T/plg" P 'read=CATALOG\.md')
|
|
167
|
+
[[ "$pg" == INVALID-COMPARISON* ]] && [[ "$pg" == *"saw 2 different"*"plugin lists"* ]] && [[ "$pg" != *UNKNOWN* ]] \
|
|
168
|
+
&& ok "TR14 one rep with an extra plugin (tools/MCP equal) → INVALID-COMPARISON" || bad "TR14 [$pg]"
|
|
169
|
+
build "$T/plq" P 3 "$RT||CATALOG has it|Read=CATALOG.md|$PB" "$RT||오늘 맑아||$PB"
|
|
170
|
+
pq=$(score "$T/plq" P 'read=CATALOG\.md')
|
|
171
|
+
PR='fx-telemetry@builtin,fx-lsp@official=1.0.0,fx-core@hub=3.42.0,fx-lsp@official=1.0.0' # same set: reordered + a duplicate
|
|
172
|
+
build "$T/plr" P 3 "$RT||CATALOG has it|Read=CATALOG.md|$PB" "$RT||오늘 맑아||$PR"
|
|
173
|
+
pr=$(score "$T/plr" P 'read=CATALOG\.md')
|
|
174
|
+
[[ "$pq" == "PASS BEHAVIOUR PASS 1.0 "* ]] && [[ "$pr" == "PASS BEHAVIOUR PASS 1.0 "* ]] && ok "TR15 control: same plugin set in every arm → comparable, PASS" || bad "TR15 same=[$pq] reordered+dup=[$pr]"
|
|
175
|
+
build "$T/plv" P 3 "$RT||CATALOG has it|Read=CATALOG.md|${PB/3.42.0/3.43.0}" "$RT||오늘 맑아||$PB"
|
|
176
|
+
pv=$(score "$T/plv" P 'read=CATALOG\.md')
|
|
177
|
+
[[ "$pv" == INVALID-COMPARISON* ]] && [[ "$pv" == *"saw 2 different"* ]] && [[ "$pv" != *UNKNOWN* ]] && ok "TR16 same plugin, different version → INVALID-COMPARISON" || bad "TR16 [$pv]"
|
|
178
|
+
build "$T/plu" P 3 "$RT||CATALOG has it|Read=CATALOG.md|$PB" "$RT||오늘 맑아|"
|
|
179
|
+
pu=$(score "$T/plu" P 'read=CATALOG\.md')
|
|
180
|
+
build "$T/ple" P 3 "$RT||CATALOG has it|Read=CATALOG.md|-" "$RT||오늘 맑아|"
|
|
181
|
+
pe=$(score "$T/ple" P 'read=CATALOG\.md')
|
|
182
|
+
[[ "$pu" == INVALID-COMPARISON* ]] && [[ "$pe" == INVALID-COMPARISON* ]] && ok "TR17 one arm with a plugin list, one without → INVALID-COMPARISON (UNKNOWN, not 0)" || bad "TR17 list=[$pu] empty-list=[$pe]"
|
|
183
|
+
mkdir -p "$T/mut2"; cp "$LIB/probe_live_eval_lib.py" "$T/mut2/"
|
|
184
|
+
sed "s/^\( *\)plug = 'UNKNOWN' if trace.get('plugins') is None else ','.join(trace\['plugins'\])$/\1plug = ''/" \
|
|
185
|
+
"$LIB/live_eval_trace.py" > "$T/mut2/live_eval_trace.py"
|
|
186
|
+
if grep -q "trace.get('plugins') is None" "$T/mut2/live_eval_trace.py"; then bad "TR18 mutation did not apply (instrument error, not a pass)"
|
|
187
|
+
else mp=$(LIB="$T/mut2" score "$T/plg" P 'read=CATALOG\.md')
|
|
188
|
+
[[ "$mp" == "PASS "* ]] && ok "TR18 revert probe: inventory without plugins → TR14's pair scores PASS (TR14 would be red)" || bad "TR18 mutant still [$mp]"; fi
|
|
189
|
+
|
|
190
|
+
[ $pass -eq 19 ] || bad "lane count $pass != 19 — a case did not run"
|
|
145
191
|
echo "live_eval_trace lanes: $pass passed, $fail failed"; [ $fail -eq 0 ]
|
|
@@ -39,12 +39,28 @@ echo "$OUT" | grep -qE 'R1-b .*MUT [0-9]+' \
|
|
|
39
39
|
|| ng "되돌림 프로브 출력 없음 — 지역 문턱의 하중을 아무도 안 쟀다"
|
|
40
40
|
|
|
41
41
|
echo "== CLI 계약 — self-test 밖에서 한 번 더 =="
|
|
42
|
+
# The isolation that matters is «no ffmpeg on PATH». `command -v python3` can be a shell shim (pyenv,
|
|
43
|
+
# asdf: `#!/usr/bin/env bash`) that dies with rc 127 once PATH is empty — before the code under test
|
|
44
|
+
# runs. So resolve the real interpreter first, with the normal PATH, and run THAT under the empty PATH.
|
|
45
|
+
real_py() { "$1" -c 'import sys; print(sys.executable)' 2>/dev/null; }
|
|
46
|
+
PY=$(real_py "$(command -v python3)")
|
|
47
|
+
[ -n "$PY" ] && [ -x "$PY" ] || { echo "ⓘ could not resolve the real python3 interpreter — setup broke (NOT a pass)"; exit 10; }
|
|
42
48
|
EMPTY=$(mktemp -d) || exit 10
|
|
43
|
-
OUT=$(cd plugins/fh-preprep/skills/preprep && PATH="$EMPTY" "$
|
|
44
|
-
rmdir "$EMPTY"
|
|
49
|
+
OUT=$(cd plugins/fh-preprep/skills/preprep && PATH="$EMPTY" "$PY" lane_speech_coach.py /nonexistent.wav 2>&1); RC=$?
|
|
45
50
|
[ "$RC" -eq 2 ] && echo "$OUT" | grep -q '통과 아님' \
|
|
46
51
|
&& ok "ffmpeg 없음 → rc 2 · «통과 아님」 (0 도 1 도 아니다)" \
|
|
47
52
|
|| ng "ffmpeg 없음이 rc=$RC 로 나간다: $(echo "$OUT" | tail -3)"
|
|
53
|
+
# control: a bash-shim python3 (the shape that broke this probe on pyenv) still reaches rc 2 through
|
|
54
|
+
# the same resolution — and the shim itself, run directly under the empty PATH, really does die
|
|
55
|
+
SHIM=$(mktemp -d) || exit 10
|
|
56
|
+
printf '#!/usr/bin/env bash\nexec "%s" "$@"\n' "$PY" > "$SHIM/python3"; chmod +x "$SHIM/python3"
|
|
57
|
+
SPY=$(PATH="$SHIM:$PATH" real_py "$SHIM/python3")
|
|
58
|
+
OUT=$(cd plugins/fh-preprep/skills/preprep && PATH="$EMPTY" "$SPY" lane_speech_coach.py /nonexistent.wav 2>&1); RC=$?
|
|
59
|
+
DIRECT=$(cd plugins/fh-preprep/skills/preprep && PATH="$EMPTY" "$SHIM/python3" lane_speech_coach.py /nonexistent.wav >/dev/null 2>&1; echo $?)
|
|
60
|
+
[ "$RC" -eq 2 ] && [ "$DIRECT" -ne 2 ] \
|
|
61
|
+
&& ok "셸 래퍼 python3 컨트롤: 해석기 해석 경유 rc 2 · 래퍼 직접 실행은 rc=$DIRECT (래퍼가 실제로 죽는 모양)" \
|
|
62
|
+
|| ng "셸 래퍼 컨트롤: 해석 경유 rc=$RC · 직접 rc=$DIRECT"
|
|
63
|
+
rm -rf "$SHIM"; rmdir "$EMPTY"
|
|
48
64
|
|
|
49
65
|
grep -q "lane_speech_coach" plugins/fh-preprep/skills/preprep/SKILL.md \
|
|
50
66
|
&& ok "명세: SKILL.md 가 이 레인을 적는다(고아 구현 아님)" \
|