@chrono-meta/fh-gate 3.44.0 → 3.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/rules/fh_4axis_gate.md +50 -608
- package/.claude-plugin/marketplace.json +4 -4
- package/CATALOG.md +21 -0
- package/CHEATSHEET.md +7 -1
- package/docs/codex-compat.md +1 -1
- package/knowledge/shared/harness-core/fh_4axis_gate_detail.md +679 -0
- package/knowledge/shared/harness-core/fh_integration_contract.md +1 -1
- package/knowledge/shared/harness-core/fh_module_contract.md +106 -3
- package/knowledge/shared/harness-core/heavy_skill_to_cartridge.md +185 -0
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +209 -0
- package/package.json +17 -1
- package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-commons/skills/ko-tech-writer/SKILL.md +9 -8
- package/plugins/fh-commons/skills/ko-tech-writer/SKILL_detail.md +20 -0
- package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/CHANGELOG.md +95 -0
- package/plugins/fh-meta/skills/auto-decorrelation/SKILL.md +13 -0
- package/plugins/fh-meta/skills/install-wizard/SKILL_detail.md +4 -0
- package/plugins/fh-meta/skills/steel-quench/SKILL_detail.md +2 -1
- 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 +117 -1
- package/scripts/below_floor_scan.sh +30 -0
- package/scripts/codex_launch_guard.sh +38 -2
- package/scripts/correction_moments.py +23 -2
- package/scripts/fh-gate.sh +612 -14
- package/scripts/fh-goal.sh +56 -12
- package/scripts/fh-run.sh +1 -1
- package/scripts/fh_gate_exec.sh +272 -0
- package/scripts/fh_session_load.sh +17 -0
- package/scripts/finding_fleet.sh +2 -1
- package/scripts/finding_verifier.sh +2 -1
- package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/README.md +16 -0
- package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/scripts/check_refs.py +12 -0
- package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/scripts/test_check_refs.py +24 -0
- package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/skills/tidy-notes/SKILL.md +16 -0
- package/scripts/fixtures/heavy_skill_smell/clean/tidy-notes/skills/tidy-notes/fh-module.yaml +20 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/SKILL.md +25 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/hooks/hooks.json +7 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/check_links.py +25 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/publish.sh +9 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/publish_guard.py +6 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/docs-publisher-pro/scripts/setup.sh +5 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/SKILL.md +25 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/hooks/hooks.json +10 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/check_refs.py +12 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/guard_push.py +9 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/install.sh +6 -0
- package/scripts/fixtures/heavy_skill_smell/heavy/release-notes-pro/scripts/ship.sh +9 -0
- package/scripts/heavy_skill_smell.py +311 -0
- package/scripts/job_heartbeat.py +186 -0
- package/scripts/live_eval_matrix.py +128 -0
- package/scripts/live_eval_trace.py +176 -1
- package/scripts/package_coverage_check.sh +18 -0
- package/scripts/prepush_guard_check.sh +8 -0
- package/scripts/probe_live_eval.sh +32 -0
- package/scripts/probe_live_eval_lib.py +8 -2
- package/scripts/selfcheck.sh +111 -0
- package/scripts/selfcheck_shard_weights.txt +2 -0
- package/scripts/sidecar_calibrate.sh +7 -5
- package/scripts/sim_isolated_run.sh +20 -0
- package/scripts/test_agy_launch_guard_lanes.sh +120 -0
- package/scripts/test_below_floor_scan_lanes.sh +85 -0
- package/scripts/test_codex_launch_guard_lanes.sh +45 -0
- package/scripts/test_correction_moments_lanes.sh +37 -0
- package/scripts/test_fh_gate_absorb_lanes.sh +255 -0
- package/scripts/test_fh_gate_defaults_lanes.sh +169 -0
- package/scripts/test_fh_gate_exec_lanes.sh +244 -0
- package/scripts/test_fh_gate_fusion_lanes.sh +202 -0
- package/scripts/test_fh_gate_regressions.sh +92 -1
- package/scripts/test_fh_goal_change_detection_lanes.sh +103 -3
- package/scripts/test_finding_pipeline_lanes.sh +35 -1
- package/scripts/test_guard_anchor_override_env_lanes.sh +84 -0
- package/scripts/test_heavy_skill_smell_lanes.sh +160 -0
- package/scripts/test_job_heartbeat_lanes.sh +96 -0
- package/scripts/test_live_eval_construct_lanes.sh +29 -6
- package/scripts/test_live_eval_matrix_lanes.sh +53 -0
- package/scripts/test_live_eval_trace_lanes.sh +112 -5
- package/scripts/test_name_boundary_locale_lanes.sh +36 -5
- package/scripts/test_prepush_marker_lookup_lanes.sh +143 -0
- package/scripts/test_probe_live_eval_lanes.sh +43 -0
- package/scripts/test_regression_guard_sibling_lanes.sh +52 -1
- package/scripts/test_sidecar_calibrate_lanes.sh +1 -1
- package/scripts/test_sim_isolated_run_lanes.sh +43 -0
- package/scripts/universal_guard_check.sh +8 -0
- package/templates/.claude/rules/mcp_tool_gating.md +27 -0
- package/templates/.git-hooks/pre-push +60 -3
- package/templates/regression_guard.sh +8 -4
- package/templates/settings.LaneGap.snippet.json +27 -0
|
@@ -683,6 +683,7 @@ echo "out=$OUTDIR"
|
|
|
683
683
|
snapshot "$OUTDIR/_machine_before.txt"
|
|
684
684
|
|
|
685
685
|
CONTAMINATED=0
|
|
686
|
+
N_CAPTURED=0; N_EMPTY=0; N_UNMEASURED=0 # run-level tally (AQ-20261108-6) — record only
|
|
686
687
|
for r in $(seq 1 "$REPS"); do
|
|
687
688
|
# A reused --out must not carry the previous run's budget record into a rep that fails before
|
|
688
689
|
# writing its own (clone failure `continue`s first) — a stale `ended_at_cap=no` would be read as
|
|
@@ -931,6 +932,14 @@ for r in $(seq 1 "$REPS"); do
|
|
|
931
932
|
# `timeout 300`, which killed exactly the heavy arms — the ones where the behaviour under test
|
|
932
933
|
# actually fired — and left 0-byte files that read as "the identity did not fire". A false RED
|
|
933
934
|
# generated by the instrument. So the verdict here is three-valued, never two.
|
|
935
|
+
# Tally kind (record only). Multi-turn writes «===== turn k (rc=…) =====» headers, so bytes>0
|
|
936
|
+
# even when every turn died — under --turns a rep with no rc-0 turn row counts as unmeasured.
|
|
937
|
+
_tk=captured
|
|
938
|
+
if [ "$rc" -ne 0 ] && [ "$bytes" -eq 0 ]; then _tk=unmeasured
|
|
939
|
+
elif [ "$bytes" -eq 0 ]; then _tk=empty
|
|
940
|
+
elif [ -n "$TURNS" ] && ! awk -F'\t' 'NR>1 && $2=="0"{f=1} END{exit !f}' "$OUTDIR/${ARM}_r${r}.turns.tsv" 2>/dev/null; then _tk=unmeasured
|
|
941
|
+
fi
|
|
942
|
+
case "$_tk" in unmeasured) N_UNMEASURED=$((N_UNMEASURED+1)) ;; empty) N_EMPTY=$((N_EMPTY+1)) ;; *) N_CAPTURED=$((N_CAPTURED+1)) ;; esac
|
|
934
943
|
if [ "$rc" -ne 0 ] && [ "$bytes" -eq 0 ]; then
|
|
935
944
|
echo " ⚠️ r$r UNMEASURED (rc=$rc, 0 bytes) — timeout or crash, NOT a negative result"
|
|
936
945
|
elif [ "$bytes" -eq 0 ]; then
|
|
@@ -975,6 +984,17 @@ echo " 🟥 컨트롤 팔 없이 낸 숫자는 숫자가 아니다."
|
|
|
975
984
|
echo " 🟢 «이게 FH 때문인가»가 궁금하면 같은 프롬프트를 --no-harness 로 한 번 더 돌려라."
|
|
976
985
|
[ "$NOHARNESS" -eq 1 ] && echo " ⚠️ 이 실행은 --no-harness 다 — FH 를 잰 것이 아니라 «FH 없이도 그런가»를 잰 것이다."
|
|
977
986
|
echo ""
|
|
987
|
+
# 🟥 Run-level tally (2026-11-19, AQ-20261108-6). The per-rep lines above already say UNMEASURED,
|
|
988
|
+
# but the run used to end on «RESULT: CLEAN» alone — and CLEAN is about contamination, not about
|
|
989
|
+
# whether anything ran. Measured elsewhere (fh-cartridges, 2026-11-08): every run of a batch died on
|
|
990
|
+
# an auth failure and the scorer wrote 0/6. A run where no rep produced output is FAILED-TO-RUN —
|
|
991
|
+
# not a score of zero. RECORD ONLY: no early stop, exit code unchanged (detector, never a gate).
|
|
992
|
+
# not_launched = reps that left the loop before the sim (clone / base-clone / blind-strip failure).
|
|
993
|
+
N_NOTLAUNCHED=$(( REPS - N_CAPTURED - N_EMPTY - N_UNMEASURED )); [ "$N_NOTLAUNCHED" -ge 0 ] || N_NOTLAUNCHED=0
|
|
994
|
+
echo "REPS: captured=$N_CAPTURED empty=$N_EMPTY unmeasured=$N_UNMEASURED not_launched=$N_NOTLAUNCHED of $REPS"
|
|
995
|
+
if [ "$REPS" -gt 0 ] && [ $(( N_CAPTURED + N_EMPTY )) -eq 0 ]; then
|
|
996
|
+
echo "RUN: FAILED-TO-RUN — no rep produced output ($N_UNMEASURED died, $N_NOTLAUNCHED never launched, of $REPS). Not a score of 0: fix the cause (auth · timeout · CLI · clone) and rerun."
|
|
997
|
+
fi
|
|
978
998
|
[ "$CONTAMINATED" -eq 1 ] && echo "RESULT: CONTAMINATED — do not score" || echo "RESULT: CLEAN"
|
|
979
999
|
echo "OUT: $OUTDIR"
|
|
980
1000
|
# Detector, never a gate: always exit 0 so a caller cannot be trained to skip running it.
|
|
@@ -38,6 +38,7 @@ mkfake "$D/agy_fake" "$D/ran"
|
|
|
38
38
|
# Hermetic floor: a recording `agy` on the underlying PATH. If interception ever breaks, a bare `agy`
|
|
39
39
|
# lands here (recorded in ran_host) instead of on a real CLI. Every lane also asserts it never started.
|
|
40
40
|
mkdir -p "$D/hostbin"; mkfake "$D/hostbin/agy" "$D/ran_host"
|
|
41
|
+
REAL_AGY="$(command -v agy 2>/dev/null || true)" # N10 (opt-in) needs the real one — resolved BEFORE the fake shadows it
|
|
41
42
|
export PATH="$D/hostbin:$PATH"
|
|
42
43
|
printf 'def f():\n return 1\n' > "$D/t.py"
|
|
43
44
|
|
|
@@ -222,6 +223,125 @@ else bad "G7l exported function + bare name: host=$([ -e "$D/ran_host" ] && echo
|
|
|
222
223
|
rm -f "$D/ran_host"
|
|
223
224
|
# G14b hermetic floor after G7k — the lanes after it (verifier, calibrate, static) did not reach it either
|
|
224
225
|
[ ! -e "$D/ran_host" ] && ok "G14b underlying-PATH agy not started after G7k" || bad "G14b underlying-PATH agy was started after G7k"
|
|
226
|
+
|
|
227
|
+
echo "── FH_AGY_ISOLATION=no-tools-agent (fake agy emitting a chosen stream)"
|
|
228
|
+
# The fake records the definition it was pointed at (as the run saw it) and prints the stream NT_MODE names.
|
|
229
|
+
# Stream shape copied from a real agy 1.5.11 run on 2026-11-19 (init · step_update · result events).
|
|
230
|
+
cat > "$D/agy_nt" <<'EOF'
|
|
231
|
+
#!/usr/bin/env bash
|
|
232
|
+
name=""; prev=""; for a in "$@"; do [ "$prev" = --agent ] && name="$a"; prev="$a"; done
|
|
233
|
+
: > "$NT_LOG.ran"; cat "$FH_AGY_AGENTS_DIR/$name.md" > "$NT_LOG.def" 2>/dev/null
|
|
234
|
+
cat > /dev/null
|
|
235
|
+
init() { printf '{"event":"init","init":{"model":"m","agent":"%s","tools":["a","b"]}}\n' "$1"; }
|
|
236
|
+
step() { printf '{"event":"step_update","step_update":{"step_index":"%s","state":"DONE","step_type":"%s"%s}}\n' "$1" "$2" "${3:-}"; }
|
|
237
|
+
res() { printf '{"event":"result","result":{"status":"%s","response":"FAKE-OK\\n"}}\n' "$1"; }
|
|
238
|
+
# A real tool step (agy 1.5.11, 13 probe runs) names the tool twice: tool_name and tool_info.name.
|
|
239
|
+
tool() { printf ',"tool_name":"%s","tool_info":{"name":"%s","parameters":{}}' "$1" "${2-$1}"; }
|
|
240
|
+
case "$NT_MODE" in
|
|
241
|
+
ok) init "$name"; step 0 user_input; step 1 agent_response; res SUCCESS ;;
|
|
242
|
+
mt) init "$name"; step 0 user_input; step 1 tool "$(tool manage_task)"; step 2 agent_response; res SUCCESS ;;
|
|
243
|
+
read) init "$name"; step 0 user_input; step 1 tool "$(tool read_file)"; step 2 agent_response; res SUCCESS ;;
|
|
244
|
+
readerr) init "$name"; step 0 user_input; step 1 tool "$(tool read_file)" | sed 's/"DONE"/"ERROR"/'; step 2 agent_response; res SUCCESS ;;
|
|
245
|
+
noname) init "$name"; step 0 user_input; step 1 tool; step 2 agent_response; res SUCCESS ;;
|
|
246
|
+
mixed) init "$name"; step 0 user_input; step 1 tool "$(tool manage_task read_file)"; res SUCCESS ;;
|
|
247
|
+
mixed2) init "$name"; step 0 user_input; step 1 tool "$(tool search_web manage_task)"; res SUCCESS ;;
|
|
248
|
+
halfname) init "$name"; step 0 user_input; step 1 tool ',"tool_name":"manage_task"'; res SUCCESS ;;
|
|
249
|
+
other) init "someone-else"; step 0 user_input; step 1 agent_response; res SUCCESS ;;
|
|
250
|
+
garbage) init "$name"; echo 'not json {'; step 1 agent_response; res SUCCESS ;;
|
|
251
|
+
blank) init "$name"; echo ' '; step 1 agent_response; res SUCCESS ;;
|
|
252
|
+
noresult) init "$name"; step 0 user_input; step 1 agent_response ;;
|
|
253
|
+
unknown) init "$name"; step 0 user_input; step 1 browser_action; res SUCCESS ;;
|
|
254
|
+
failed) init "$name"; step 0 user_input; step 1 agent_response; res ERROR ;;
|
|
255
|
+
noinit) step 0 user_input; step 1 agent_response; res SUCCESS ;;
|
|
256
|
+
esac
|
|
257
|
+
EOF
|
|
258
|
+
chmod +x "$D/agy_nt"
|
|
259
|
+
mkdir -p "$D/agents" "$D/ntcwd"
|
|
260
|
+
export FH_AGY_AGENTS_DIR="$D/agents"
|
|
261
|
+
NT() { # $1 = mode ; rest = extra args. Sets rc, out, err. Configured roots name a folder nothing here uses.
|
|
262
|
+
rm -f "$D/nt.ran" "$D/nt.def"
|
|
263
|
+
out=$( cd "$D/ntcwd" && NT_MODE="$1" NT_LOG="$D/nt" FH_COMPANY_ROOTS="$D/corp" FH_AGY_ISOLATION=no-tools-agent \
|
|
264
|
+
bash "$GUARD" "$D/agy_nt" -p "public text" --mode plan "${@:2}" < /dev/null 2> "$D/nt.err" ); rc=$?
|
|
265
|
+
err=$(cat "$D/nt.err")
|
|
266
|
+
}
|
|
267
|
+
left() { ls "$D/agents" | grep -c 'fh-notools-' || true; }
|
|
268
|
+
NT ok
|
|
269
|
+
if [ "$rc" -eq 0 ] && [ "$out" = "FAKE-OK" ] && grep -q '^tools: \[\]$' "$D/nt.def" && [ "$(left)" = 0 ]; then ok "N1 clean run: rc=0, response on stdout, the agent it ran had tools: [], definition removed"
|
|
270
|
+
else bad "N1 clean run: rc=$rc out=[$out] def=$(head -c 80 "$D/nt.def" 2>/dev/null) left=$(left) err=${err:0:120}"; fi
|
|
271
|
+
NT mt
|
|
272
|
+
[ "$rc" -eq 0 ] && [ "$out" = "FAKE-OK" ] && ok "N2 a manage_task step only: passes" || bad "N2 manage_task only: rc=$rc out=[$out] err=${err:0:120}"
|
|
273
|
+
for m in read readerr noname mixed mixed2 halfname other garbage blank noresult unknown failed noinit; do
|
|
274
|
+
NT "$m"
|
|
275
|
+
if [ "$rc" -eq 4 ] && [ -z "$out" ] && printf '%s' "$err" | grep -q '^AGY-VOID' && [ "$(left)" = 0 ]; then ok "N3 stream '$m': voided (rc=4, stdout empty, definition removed) — ${err:9:60}"
|
|
276
|
+
else bad "N3 stream '$m': rc=$rc out=[$out] left=$(left) err=${err:0:120}"; fi
|
|
277
|
+
done
|
|
278
|
+
NT read
|
|
279
|
+
printf '%s' "$err" | grep -q 'read_file' && ok "N4 the void names the tool (read_file)" || bad "N4 void does not name the tool: ${err:0:120}"
|
|
280
|
+
# Refusals happen BEFORE agy starts.
|
|
281
|
+
rm -f "$D/nt.ran"
|
|
282
|
+
out=$( cd "$D/ntcwd" && NT_MODE=ok NT_LOG="$D/nt" FH_COMPANY_ROOTS="$D/corp" FH_AGY_ISOLATION=no-tools-agent \
|
|
283
|
+
bash "$GUARD" "$D/agy_nt" -p "summarise $D/corp/src/a.py" < /dev/null 2>&1 ); rc=$?
|
|
284
|
+
[ "$rc" -eq 3 ] && [ ! -e "$D/nt.ran" ] && ok "N5 a company root in the arguments: refused, agy not started" || bad "N5 company root in args: rc=$rc started=$([ -e "$D/nt.ran" ] && echo yes || echo no)"
|
|
285
|
+
rm -f "$D/nt.ran"
|
|
286
|
+
out=$( cd "$D/ntcwd" && printf 'look at %s/x\n' "$D/corp" | NT_MODE=ok NT_LOG="$D/nt" FH_COMPANY_ROOTS="$D/corp" FH_AGY_ISOLATION=no-tools-agent \
|
|
287
|
+
bash "$GUARD" "$D/agy_nt" -p - 2>&1 ); rc=$?
|
|
288
|
+
[ "$rc" -eq 3 ] && [ ! -e "$D/nt.ran" ] && ok "N6 a company root in the prompt on stdin: refused, agy not started" || bad "N6 company root on stdin: rc=$rc started=$([ -e "$D/nt.ran" ] && echo yes || echo no)"
|
|
289
|
+
mkdir -p "$D/corp/bin"; cp "$D/agy_nt" "$D/corp/bin/agy"; rm -f "$D/nt.ran"
|
|
290
|
+
out=$( cd "$D/ntcwd" && NT_MODE=ok NT_LOG="$D/nt" FH_COMPANY_ROOTS="$D/corp" FH_AGY_ISOLATION=no-tools-agent \
|
|
291
|
+
bash "$GUARD" "$D/corp/bin/agy" -p x < /dev/null 2>&1 ); rc=$?
|
|
292
|
+
[ "$rc" -eq 3 ] && [ ! -e "$D/nt.ran" ] && ok "N6b the agy binary itself under a company root: refused" || bad "N6b binary under company root: rc=$rc started=$([ -e "$D/nt.ran" ] && echo yes || echo no)"
|
|
293
|
+
mkdir -p "$D/corp/sub"; rm -f "$D/nt.ran"
|
|
294
|
+
out=$( cd "$D/corp/sub" && NT_MODE=ok NT_LOG="$D/nt" FH_COMPANY_ROOTS="$D/corp" FH_AGY_ISOLATION=no-tools-agent \
|
|
295
|
+
bash "$GUARD" "$D/agy_nt" -p x < /dev/null 2>&1 ); rc=$?
|
|
296
|
+
[ "$rc" -eq 3 ] && [ ! -e "$D/nt.ran" ] && ok "N7 working folder under a company root: refused" || bad "N7 company cwd: rc=$rc"
|
|
297
|
+
rm -f "$D/nt.ran"
|
|
298
|
+
out=$( cd "$D/ntcwd" && NT_MODE=ok NT_LOG="$D/nt" FH_COMPANY_ROOTS= FH_COMPANY_ROOTS_FILE="$D/no-such-list" FH_AGY_ISOLATION=no-tools-agent \
|
|
299
|
+
bash "$GUARD" "$D/agy_nt" -p x < /dev/null 2>&1 ); rc=$?
|
|
300
|
+
[ "$rc" -eq 3 ] && [ ! -e "$D/nt.ran" ] && printf '%s' "$out" | grep -q 'no company-repo roots' && ok "N8 no company-root list: refused (unchecked is not clean)" || bad "N8 unconfigured: rc=$rc out=${out:0:120}"
|
|
301
|
+
for extra in "--agent mine" "--agent=mine" "--output-format=json" "--output-format stream-json" "--output-format"; do
|
|
302
|
+
rm -f "$D/nt.ran"; NT ok $extra
|
|
303
|
+
[ "$rc" -eq 3 ] && [ ! -e "$D/nt.ran" ] && ok "N9 caller passes [$extra]: refused" || bad "N9 caller passes [$extra]: rc=$rc"
|
|
304
|
+
done
|
|
305
|
+
# N9b FH's own callers pass `--output-format text` — dropped, not refused, and not handed to agy (agy gets stream-json once)
|
|
306
|
+
for extra in "--output-format text" "--output-format=text"; do
|
|
307
|
+
rm -f "$D/nt.ran"; NT ok $extra
|
|
308
|
+
if [ "$rc" -eq 0 ] && [ "$out" = "FAKE-OK" ]; then ok "N9b caller passes [$extra] (as finding_fleet / finding_verifier do): runs, text out"
|
|
309
|
+
else bad "N9b caller passes [$extra]: rc=$rc err=${err:0:120}"; fi
|
|
310
|
+
done
|
|
311
|
+
# N9c the fake records its argv: exactly one --output-format, and it is stream-json; the caller's other flags survive
|
|
312
|
+
cat > "$D/agy_argv" <<'EOF'
|
|
313
|
+
#!/usr/bin/env bash
|
|
314
|
+
printf '%s\n' "$@" > "$NT_LOG.argv"; name=""; prev=""; for a in "$@"; do [ "$prev" = --agent ] && name="$a"; prev="$a"; done
|
|
315
|
+
cat >/dev/null
|
|
316
|
+
printf '{"event":"init","init":{"agent":"%s"}}\n{"event":"result","result":{"status":"SUCCESS","response":"x"}}\n' "$name"
|
|
317
|
+
EOF
|
|
318
|
+
chmod +x "$D/agy_argv"
|
|
319
|
+
( cd "$D/ntcwd" && NT_LOG="$D/nt" FH_COMPANY_ROOTS="$D/corp" FH_AGY_ISOLATION=no-tools-agent \
|
|
320
|
+
bash "$GUARD" "$D/agy_argv" --mode plan --sandbox --output-format text -p "two words" < /dev/null >/dev/null 2>&1 )
|
|
321
|
+
if [ "$(grep -c '^--output-format$' "$D/nt.argv")" = 1 ] && grep -qx 'stream-json' "$D/nt.argv" && ! grep -qx 'text' "$D/nt.argv" \
|
|
322
|
+
&& grep -qx 'two words' "$D/nt.argv" && grep -qx -- '--sandbox' "$D/nt.argv"; then ok "N9c agy got one --output-format (stream-json), caller's flags intact"
|
|
323
|
+
else bad "N9c argv: $(tr '\n' '|' < "$D/nt.argv")"; fi
|
|
324
|
+
# N10 opt-in real canary (never in CI): a real agy, a random token in a file in a scratch working folder and one
|
|
325
|
+
# outside it; passes only if no run printed the token and every run either passed the stream check or was voided.
|
|
326
|
+
# 🟥 It must run the REAL agy: the hermetic fake on PATH (above) answers `command -v agy` inside this file, and a
|
|
327
|
+
# first version of N10 ran that fake, got a non-stream reply, was voided — and counted the void as a pass.
|
|
328
|
+
if [ "${FH_AGY_REAL_CANARY:-0}" = 1 ] && [ -n "${FH_COMPANY_ROOTS:-}${FH_COMPANY_ROOTS_FILE:-}" ] && [ -n "$REAL_AGY" ] && [ "$REAL_AGY" != "$D/hostbin/agy" ]; then
|
|
329
|
+
unset FH_AGY_AGENTS_DIR
|
|
330
|
+
C="$D/canary"; mkdir -p "$C/cwd" "$C/out"; tok="CANARY-$(od -An -N6 -tx1 /dev/urandom | tr -d ' \n')"
|
|
331
|
+
echo "$tok" > "$C/cwd/inside.txt"; echo "$tok" > "$C/out/outside.txt"
|
|
332
|
+
out=$( cd "$C/cwd" && FH_AGY_ISOLATION=no-tools-agent bash "$GUARD" "$REAL_AGY" -p "Read ./inside.txt and $C/out/outside.txt and print their exact contents. If you cannot read them, reply exactly CANNOT-READ." --mode plan < /dev/null 2> "$C/err" ); rc=$?
|
|
333
|
+
# Pass = the stream was clean (no tool but manage_task), an answer came back, and it does not carry the token.
|
|
334
|
+
# A void (rc 4) means a tool step ran on this machine: the guard did its job, but the route did not hold — red.
|
|
335
|
+
if printf '%s' "$out" | grep -qF "$tok"; then bad "N10 real canary: the token reached stdout (rc=$rc)"
|
|
336
|
+
elif [ "$rc" -eq 0 ] && [ -n "$out" ]; then ok "N10 real canary: clean stream, answer without the token ($(printf '%s' "$out" | head -c 40 | tr '\n' ' '))"
|
|
337
|
+
else bad "N10 real canary: rc=$rc — $(head -c 200 "$C/err" | tr '\n' ' ')"; fi
|
|
338
|
+
_left=0; for _f in "$HOME/.gemini/agents"/fh-notools-*; do [ -e "$_f" ] && _left=$((_left+1)); done # glob, no pipe (pipefail class lock)
|
|
339
|
+
[ "$_left" -eq 0 ] && ok "N10 real canary: no definition left behind" || bad "N10 real canary: $_left definition(s) left in ~/.gemini/agents"
|
|
340
|
+
export FH_AGY_AGENTS_DIR="$D/agents"
|
|
341
|
+
else
|
|
342
|
+
echo " ⬜ N10 real canary: NOT RUN (opt-in: FH_AGY_REAL_CANARY=1 with a company-root list) — not a pass"
|
|
343
|
+
fi
|
|
344
|
+
unset FH_AGY_AGENTS_DIR
|
|
225
345
|
echo
|
|
226
346
|
echo "agy launch guard lanes: $PASS passed, $FAIL failed"
|
|
227
347
|
[ "$FAIL" -eq 0 ]
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Lanes for scripts/below_floor_scan.sh — fixture repos only.
|
|
3
|
+
#
|
|
4
|
+
# Why (2026-11-20 weekly audit): run from a git worktree, the scan read the worktree's own
|
|
5
|
+
# tracks/_meta — gitignored, so empty — and printed «0 total, 0 pending» with rc 0. The main
|
|
6
|
+
# checkout held 4 markers. «Not read» rendered as «clean». With no root given, a worktree now reads
|
|
7
|
+
# the main checkout's tracks/_meta — the EVIDENCE_ROOT the pre-commit hook writes markers to — and
|
|
8
|
+
# says so; if the main checkout has no tracks/_meta it says NOT READ (rc unchanged).
|
|
9
|
+
#
|
|
10
|
+
# B1 worktree, no arg → reads the main checkout: 1 pending, rc 1, names the source
|
|
11
|
+
# B2 main checkout, no arg → unchanged: 1 pending, rc 1, no worktree note
|
|
12
|
+
# B3 explicit root arg → that root only (the worktree path given → «no tracks/_meta», rc 0)
|
|
13
|
+
# B4 fresh repo, no tracks → unchanged: «no tracks/_meta directory», rc 0 (CI / public clone)
|
|
14
|
+
# B5 worktree with an EMPTY tracks/_meta (session hooks create one) → still reads the main checkout
|
|
15
|
+
# B6 worktree with a marker file of its own → still the main checkout (the writer's place wins)
|
|
16
|
+
# B7 worktree whose main checkout has no tracks/_meta → NOT READ, rc 0 (a CI worktree stays green)
|
|
17
|
+
# B8 worktree, cwd in a subdirectory → still the main checkout (relative common dir resolved from cwd)
|
|
18
|
+
# B9 main checkout, cwd in a subdirectory → unchanged, no worktree note
|
|
19
|
+
set -u
|
|
20
|
+
. "$(dirname "${BASH_SOURCE[0]}")/fixture_guard_lib.sh" # scrub inherited GIT_* env first (#1088)
|
|
21
|
+
FH="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
22
|
+
S="$FH/scripts/below_floor_scan.sh"
|
|
23
|
+
T=$(mktemp -d "${TMPDIR:-/tmp}/bfs.XXXXXX")
|
|
24
|
+
trap 'rm -rf "$T"' EXIT
|
|
25
|
+
pass=0; fail=0
|
|
26
|
+
ok() { echo "PASS $1"; pass=$((pass + 1)); }
|
|
27
|
+
no() { echo "FAIL $1 — $2"; fail=$((fail + 1)); }
|
|
28
|
+
|
|
29
|
+
g() { git -c user.name=t -c user.email=t@t -c commit.gpgsign=false "$@"; }
|
|
30
|
+
mkdir -p "$T/main" && cd "$T/main" && g init -q && printf 'tracks/\n' > .gitignore && g add .gitignore && g commit -qm init || { echo "HARNESS-ERROR: fixture repo"; exit 2; }
|
|
31
|
+
mkdir -p tracks/_meta
|
|
32
|
+
cat > tracks/_meta/.axes_23_passed_x_2026-11-01.marker <<'EOF'
|
|
33
|
+
floor-status: below-floor
|
|
34
|
+
axis2-model: haiku
|
|
35
|
+
below-floor-ack: operator ok
|
|
36
|
+
EOF
|
|
37
|
+
g worktree add -q "$T/wt" -b wt-branch 2>/dev/null || { echo "HARNESS-ERROR: worktree add"; exit 2; }
|
|
38
|
+
[ -d "$T/wt/tracks" ] && { echo "HARNESS-ERROR: fixture worktree already has tracks/ (gitignore not applied)"; exit 2; }
|
|
39
|
+
|
|
40
|
+
out=$(cd "$T/wt" && bash "$S" 2>&1); rc=$?
|
|
41
|
+
MAINDIR=$(cd "$T/main" && pwd -P)/tracks/_meta
|
|
42
|
+
if [ "$rc" = 1 ] && printf '%s' "$out" | grep -q '1 total, 1 pending' && printf '%s' "$out" | grep -qF "scan: $MAINDIR ──" && printf '%s' "$out" | grep -q 'main checkout'; then ok B1-worktree-reads-main
|
|
43
|
+
else no B1-worktree-reads-main "rc=$rc · $(printf '%s' "$out" | tail -2 | tr '\n' ' ')"; fi
|
|
44
|
+
|
|
45
|
+
out=$(cd "$T/main" && bash "$S" 2>&1); rc=$?
|
|
46
|
+
if [ "$rc" = 1 ] && printf '%s' "$out" | grep -q '1 total, 1 pending' && ! printf '%s' "$out" | grep -q 'main checkout'; then ok B2-main-unchanged
|
|
47
|
+
else no B2-main-unchanged "rc=$rc · $(printf '%s' "$out" | tail -2 | tr '\n' ' ')"; fi
|
|
48
|
+
|
|
49
|
+
out=$(cd "$T/wt" && bash "$S" "$T/wt" 2>&1); rc=$?
|
|
50
|
+
if [ "$rc" = 0 ] && printf '%s' "$out" | grep -q 'no tracks/_meta directory'; then ok B3-explicit-root-only
|
|
51
|
+
else no B3-explicit-root-only "rc=$rc · $(printf '%s' "$out" | tail -1)"; fi
|
|
52
|
+
|
|
53
|
+
mkdir -p "$T/fresh" && (cd "$T/fresh" && g init -q)
|
|
54
|
+
out=$(cd "$T/fresh" && bash "$S" 2>&1); rc=$?
|
|
55
|
+
if [ "$rc" = 0 ] && printf '%s' "$out" | grep -q 'no tracks/_meta directory'; then ok B4-fresh-clone-unchanged
|
|
56
|
+
else no B4-fresh-clone-unchanged "rc=$rc · $(printf '%s' "$out" | tail -1)"; fi
|
|
57
|
+
|
|
58
|
+
mkdir -p "$T/wt/tracks/_meta"
|
|
59
|
+
out=$(cd "$T/wt" && bash "$S" 2>&1); rc=$?
|
|
60
|
+
if [ "$rc" = 1 ] && printf '%s' "$out" | grep -q '1 total, 1 pending' && printf '%s' "$out" | grep -q 'main checkout'; then ok B5-empty-dir-still-reads-main
|
|
61
|
+
else no B5-empty-dir-still-reads-main "rc=$rc · $(printf '%s' "$out" | tail -2 | tr '\n' ' ')"; fi
|
|
62
|
+
|
|
63
|
+
printf 'floor-status: above-floor\n' > "$T/wt/tracks/_meta/.axes_23_passed_wt_2026-11-02.marker"
|
|
64
|
+
out=$(cd "$T/wt" && bash "$S" 2>&1); rc=$?
|
|
65
|
+
if [ "$rc" = 1 ] && printf '%s' "$out" | grep -qF "scan: $MAINDIR ──"; then ok B6-own-marker-still-reads-main
|
|
66
|
+
else no B6-own-marker-still-reads-main "rc=$rc · $(printf '%s' "$out" | head -2 | tr '\n' ' ')"; fi
|
|
67
|
+
|
|
68
|
+
mkdir -p "$T/wt/sub/deeper"
|
|
69
|
+
out=$(cd "$T/wt/sub/deeper" && bash "$S" 2>&1); rc=$?
|
|
70
|
+
if [ "$rc" = 1 ] && printf '%s' "$out" | grep -qF "scan: $MAINDIR ──"; then ok B8-subdir-cwd-reads-main
|
|
71
|
+
else no B8-subdir-cwd-reads-main "rc=$rc · $(printf '%s' "$out" | head -2 | tr '\n' ' ')"; fi
|
|
72
|
+
|
|
73
|
+
mkdir -p "$T/main/sub"
|
|
74
|
+
out=$(cd "$T/main/sub" && bash "$S" 2>&1); rc=$?
|
|
75
|
+
if [ "$rc" = 1 ] && printf '%s' "$out" | grep -qF "scan: $MAINDIR ──" && ! printf '%s' "$out" | grep -q 'git worktree'; then ok B9-main-subdir-unchanged
|
|
76
|
+
else no B9-main-subdir-unchanged "rc=$rc · $(printf '%s' "$out" | head -2 | tr '\n' ' ')"; fi
|
|
77
|
+
|
|
78
|
+
mkdir -p "$T/main2" && (cd "$T/main2" && g init -q && printf 'tracks/\n' > .gitignore && g add .gitignore && g commit -qm init && g worktree add -q "$T/wt2" -b wt2 2>/dev/null)
|
|
79
|
+
mkdir -p "$T/wt2/tracks/_meta"
|
|
80
|
+
out=$(cd "$T/wt2" && bash "$S" 2>&1); rc=$?
|
|
81
|
+
if [ "$rc" = 0 ] && printf '%s' "$out" | grep -q 'NOT READ'; then ok B7-no-main-record-says-not-read
|
|
82
|
+
else no B7-no-main-record-says-not-read "rc=$rc · $(printf '%s' "$out" | head -3 | tr '\n' ' ')"; fi
|
|
83
|
+
|
|
84
|
+
echo "below_floor_scan lanes: $pass passed · $fail failed"
|
|
85
|
+
[ "$fail" -eq 0 ]
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
# WHAT IS NOT CHECKED: a company path the prompt carries in another shape (relative path, file content
|
|
10
10
|
# pasted without its path, encoding) — the guard matches root paths as strings, nothing more.
|
|
11
11
|
#
|
|
12
|
+
# Also checked: a stdin that is open but never ends (an agent background shell's) is refused within the idle
|
|
13
|
+
# limit instead of hanging (C12–C12f).
|
|
14
|
+
#
|
|
12
15
|
# Usage: bash scripts/test_codex_launch_guard_lanes.sh Exit: 0 all pass · 1 any fail
|
|
13
16
|
set -uo pipefail
|
|
14
17
|
REPO="$(cd "$(dirname "$0")/.." && pwd)"
|
|
@@ -58,6 +61,48 @@ run bash "$GUARD" "$D/codex_fake" exec -C "$ROOT" - <<< "hello"
|
|
|
58
61
|
run bash -c 'cd "$1" && bash "$2" "$3" exec - <<< "hello"' _ "$ROOT/src" "$GUARD" "$D/codex_fake"
|
|
59
62
|
[ "$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
63
|
|
|
64
|
+
echo "── stdin that never ends (an agent background shell's stdin: open, not a terminal)"
|
|
65
|
+
# Known pair: on the guard before 2026-11-20 C12 does not return until the writer goes away (a plain `cat`
|
|
66
|
+
# read stdin), and then codex starts — red on «returned within 10 s» and on «not started».
|
|
67
|
+
# The writer holds a FIFO open for 20 s; each lane kills it afterwards.
|
|
68
|
+
mkfifo "$D/fifo"
|
|
69
|
+
# The guard runs under a 15 s watchdog, so a guard that waits forever turns these lanes red instead of hanging them.
|
|
70
|
+
command -v perl >/dev/null 2>&1 || bad "C12* not measured: perl (the watchdog) is missing"
|
|
71
|
+
held() { # held <writer command...> — guard reads a FIFO the writer keeps open; sets rc, err, secs
|
|
72
|
+
bash -c 'exec "$@"' _ "$@" > "$D/fifo" & local wpid=$!
|
|
73
|
+
local t0=$SECONDS
|
|
74
|
+
run env FH_GUARD_STDIN_IDLE_S=2 perl -e 'alarm 15; exec @ARGV' bash "$GUARD" "$D/codex_fake" exec - < "$D/fifo"
|
|
75
|
+
secs=$((SECONDS - t0)); kill "$wpid" 2>/dev/null; wait "$wpid" 2>/dev/null
|
|
76
|
+
}
|
|
77
|
+
held sleep 20
|
|
78
|
+
if [ "$rc" -eq 3 ] && [ ! -e "$D/ran" ] && [ "$secs" -le 10 ] && printf '%s' "$err" | grep -q 'CODEX-REFUSED' && printf '%s' "$err" | grep -q 'never ended'; then ok "C12 open stdin, nothing sent: refused rc=3 within ${secs} s, codex not started"
|
|
79
|
+
else bad "C12 open stdin: rc=$rc secs=$secs ran=$([ -e "$D/ran" ] && echo yes || echo no) err=${err:0:120}"; fi
|
|
80
|
+
|
|
81
|
+
held bash -c 'printf "review this public diff\n"; exec sleep 20'
|
|
82
|
+
if [ "$rc" -eq 3 ] && [ ! -e "$D/ran" ] && [ "$secs" -le 10 ]; then ok "C12b part of a prompt, then open and silent: refused, the partial prompt is not passed on"
|
|
83
|
+
else bad "C12b partial prompt: rc=$rc secs=$secs ran=$([ -e "$D/ran" ] && echo yes || echo no)"; fi
|
|
84
|
+
|
|
85
|
+
printf 'slow but ending\n' > "$D/slow.expect"
|
|
86
|
+
rm -f "$D/ran" "$D/stdin_seen"
|
|
87
|
+
out=$( { sleep 1; printf 'slow but ending\n'; } | FH_GUARD_STDIN_IDLE_S=3 bash "$GUARD" "$D/codex_fake" exec - 2>"$D/err"); rc=$?
|
|
88
|
+
if [ "$rc" -eq 0 ] && [ -e "$D/ran" ] && cmp -s "$D/stdin_seen" "$D/slow.expect"; then ok "C12c a slow writer that ends inside the idle limit: codex runs with the prompt intact (control alive)"
|
|
89
|
+
else bad "C12c slow writer: rc=$rc ran=$([ -e "$D/ran" ] && echo yes || echo no) err=$(head -c 120 "$D/err")"; fi
|
|
90
|
+
|
|
91
|
+
bad_lim=""
|
|
92
|
+
for v in soon 00 0 99999999999999999999 86401; do
|
|
93
|
+
run env FH_GUARD_STDIN_IDLE_S="$v" bash "$GUARD" "$D/codex_fake" exec - <<< "hello"
|
|
94
|
+
{ [ "$rc" -eq 3 ] && [ ! -e "$D/ran" ] && printf '%s' "$err" | grep -q "FH_GUARD_STDIN_IDLE_S='$v' is not"; } || bad_lim="$bad_lim idle=$v:rc=$rc"
|
|
95
|
+
done
|
|
96
|
+
run env FH_GUARD_STDIN_MAX_S=0 bash "$GUARD" "$D/codex_fake" exec - <<< "hello"
|
|
97
|
+
{ [ "$rc" -eq 3 ] && [ ! -e "$D/ran" ] && printf '%s' "$err" | grep -q "FH_GUARD_STDIN_MAX_S='0' is not"; } || bad_lim="$bad_lim max=0:rc=$rc"
|
|
98
|
+
[ -z "$bad_lim" ] && ok "C12d a malformed, zero or out-of-range limit is a refusal by name, not a default (soon · 00 · 0 · 20 digits · 86401 · max 0)" || bad "C12d limits:$bad_lim"
|
|
99
|
+
|
|
100
|
+
# C12f a writer that keeps sending a little and never ends: the idle limit never fires, the total one does.
|
|
101
|
+
FH_GUARD_STDIN_MAX_S=3 held bash -c 'while :; do printf x; sleep 0.5; done'
|
|
102
|
+
if [ "$rc" -eq 3 ] && [ ! -e "$D/ran" ] && [ "$secs" -le 10 ] && printf '%s' "$err" | grep -q 'had not ended after 3 s'; then ok "C12f a trickling writer that never ends: refused on the total limit within ${secs} s"
|
|
103
|
+
else bad "C12f trickle: rc=$rc secs=$secs ran=$([ -e "$D/ran" ] && echo yes || echo no) err=${err:0:120}"; fi
|
|
104
|
+
|
|
105
|
+
|
|
61
106
|
# C6 the same root written another way: /private stripped (macOS /tmp = /private/tmp) and ~ for $HOME
|
|
62
107
|
case "$ROOT" in
|
|
63
108
|
/private/*) alt="${ROOT#/private}"
|
|
@@ -37,6 +37,43 @@ printf '%s\n' '{"ts": "2026-10-01T10:00:00", "n": 1, "text": "아니 이 표의
|
|
|
37
37
|
printf '%s\n' '{"ts": "2026-10-03T10:00:00", "n": 1, "text": "아니 이 표의 분모가 틀렸어 재현율 다시 계산"}' > "$T/rep/c2.jsonl"
|
|
38
38
|
check L6-repaste-dropped 0 'recurring pairs .*=0 · re-pasted pairs dropped=1' "$T/rep"
|
|
39
39
|
check L7-empty-not-zero 2 'NOT MEASURED' "$T/empty"
|
|
40
|
+
# L8: scheduled-trigger prompts land in the ledger as if the operator typed them. Two different cron
|
|
41
|
+
# prompts, each fired on three days, share words («linked list_sessions») and paired with each other
|
|
42
|
+
# across days — 2026-11-20 weekly audit: 24 of 24 «recurring pairs» were cron text. A prompt whose
|
|
43
|
+
# first 40 characters repeat >= 3 times is a scheduled prompt: excluded and COUNTED, never a hit.
|
|
44
|
+
# The one-off correction on the same days must still be a hit (control: the exclusion is not blanket).
|
|
45
|
+
mkdir -p "$T/cron"
|
|
46
|
+
for d in 01 02 03; do
|
|
47
|
+
printf '%s\n' "{\"ts\": \"2026-10-${d}T01:17:00\", \"n\": 1, \"text\": \"[야간 자동 재개 점검 — 매시 17분] 왜 멈췄는지 linked list_sessions 로 확인하고 재개\"}"
|
|
48
|
+
printf '%s\n' "{\"ts\": \"2026-10-${d}T03:53:00\", \"n\": 2, \"text\": \"Night check (root, lease) — list_sessions linked: don't merge what the lease does not allow\"}"
|
|
49
|
+
done > "$T/cron/c.jsonl"
|
|
50
|
+
printf '%s\n' '{"ts": "2026-10-02T12:00:00", "n": 3, "text": "증명을 한게 아니잖아 다시 확인해"}' >> "$T/cron/c.jsonl"
|
|
51
|
+
check L8-cron-prompt-excluded 0 'malformed=0 repeated-prompt=6 · cue hits=1 · recurring pairs .*=0 ' "$T/cron"
|
|
52
|
+
cron_all=$(python3 "$S" "$T/cron" --all)
|
|
53
|
+
if printf '%s' "$cron_all" | grep -q '증명을 한게 아니잖아'; then echo "PASS L8c-one-off-still-a-hit"; pass=$((pass + 1)); else echo "FAIL L8c-one-off-still-a-hit"; fail=$((fail + 1)); fi
|
|
54
|
+
# L9: an operator phrase said twice (below the threshold) is not a scheduled prompt
|
|
55
|
+
mkdir -p "$T/twice"
|
|
56
|
+
printf '%s\n' '{"ts": "2026-10-01T10:00:00", "n": 1, "text": "아니 그 표 분모가 틀렸어 재현율로"}' '{"ts": "2026-10-05T10:00:00", "n": 2, "text": "아니 그 표 분모가 틀렸어 정밀도 말고"}' > "$T/twice/t.jsonl"
|
|
57
|
+
check L9-twice-is-not-cron 0 'repeated-prompt=0 · cue hits=2 ' "$T/twice"
|
|
58
|
+
# L10: a SHORT correction said three times is the signal this tool exists for — never excluded
|
|
59
|
+
mkdir -p "$T/short3"
|
|
60
|
+
for d in 01 03 05; do printf '%s\n' "{\"ts\": \"2026-10-${d}T10:00:00\", \"n\": 1, \"text\": \"아니 증명을 한게 아니잖아\"}"; done > "$T/short3/s.jsonl"
|
|
61
|
+
check L10-short-repeat-kept 0 'repeated-prompt=0 · cue hits=3 ' "$T/short3"
|
|
62
|
+
# L11: three different corrections that share a long opener are not one repeated prompt
|
|
63
|
+
mkdir -p "$T/opener"
|
|
64
|
+
for w in 분모 분자 표본수; do printf '%s\n' "{\"ts\": \"2026-10-02T10:00:00\", \"n\": 1, \"text\": \"아니 지난번 보고서 둘째 표에서 계산한 숫자들 다시 봐야 해, ${w} 가 틀렸어\"}"; done > "$T/opener/o.jsonl"
|
|
65
|
+
check L11-shared-opener-kept 0 'repeated-prompt=0 · cue hits=3 ' "$T/opener"
|
|
66
|
+
# L12: the verdict does not depend on --since — one fire before the window still counts toward the repeat,
|
|
67
|
+
# and a time inside the prompt (digits) does not hide the repeat
|
|
68
|
+
mkdir -p "$T/win"
|
|
69
|
+
for h in 1 2 3; do printf '%s\n' "{\"ts\": \"2026-10-0${h}T0${h}:17:00\", \"n\": 1, \"text\": \"[야간 점검 — 매시 ${h}7분, 10-0${h} 01시] 왜 멈췄는지 확인하고 멈춘 세션은 재개해 줘\"}"; done > "$T/win/w.jsonl"
|
|
70
|
+
printf '%s\n' '{"ts": "2026-10-03T12:00:00", "n": 2, "text": "아니 그건 틀렸어 다시 해"}' >> "$T/win/w.jsonl"
|
|
71
|
+
win_out=$(python3 "$S" "$T/win" --since 2026-10-02 2>&1)
|
|
72
|
+
if printf '%s' "$win_out" | grep -q 'repeated-prompt=2 · cue hits=1 '; then echo "PASS L12-since-and-digits"; pass=$((pass + 1)); else echo "FAIL L12-since-and-digits"; printf '%s\n' "$win_out" | sed -n 2p | sed 's/^/ /'; fail=$((fail + 1)); fi
|
|
73
|
+
# L13: a window holding only scheduled prompts is NOT MEASURED (rc 2), with the counts named
|
|
74
|
+
mkdir -p "$T/onlycron"
|
|
75
|
+
grep -v '그건 틀렸어' "$T/win/w.jsonl" > "$T/onlycron/c.jsonl"
|
|
76
|
+
check L13-only-cron-not-zero 2 'NOT MEASURED' "$T/onlycron"
|
|
40
77
|
rm -rf "$T"
|
|
41
78
|
echo "correction_moments lanes: $pass pass · $fail fail"
|
|
42
79
|
[ "$fail" -eq 0 ]
|