@chrono-meta/fh-gate 3.44.0 → 3.46.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 +13 -3
- 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_detail_protocols.md +1 -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 +19 -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-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 +122 -0
- package/plugins/fh-meta/skills/auto-decorrelation/SKILL.md +13 -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/harvest-loop/SKILL.md +2 -2
- package/plugins/fh-meta/skills/install-wizard/SKILL_detail.md +4 -0
- package/plugins/fh-meta/skills/memory-hygiene/SKILL.md +6 -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 +197 -4
- package/scripts/package_coverage_check.sh +18 -0
- package/scripts/pr_merge_verified.sh +14 -4
- 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 +113 -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_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 +255 -0
- package/scripts/test_fh_gate_defaults_lanes.sh +188 -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 +132 -5
- package/scripts/test_name_boundary_locale_lanes.sh +36 -5
- package/scripts/test_pr_merge_verified_lanes.sh +15 -2
- package/scripts/test_prepush_marker_lookup_lanes.sh +143 -0
- package/scripts/test_probe_live_eval_lanes.sh +44 -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/scripts/worktree_reclaim.sh +1 -1
- package/templates/.claude/rules/mcp_tool_gating.md +27 -0
- package/templates/.git-hooks/pre-push +60 -3
- package/templates/PRE-PUBLISH-CHECKLIST.md +22 -0
- package/templates/regression_guard.sh +8 -4
- package/templates/settings.LaneGap.snippet.json +27 -0
package/scripts/selfcheck.sh
CHANGED
|
@@ -397,6 +397,17 @@ else
|
|
|
397
397
|
fail=1
|
|
398
398
|
fi
|
|
399
399
|
|
|
400
|
+
# fh-gate review stage + execution layer (2026-11-19): the built-in /code-review is the default reviewer on
|
|
401
|
+
# the claude backend, its findings carried as labelled; E0 scanners and E1 target lanes run in a copy. Both
|
|
402
|
+
# suites are token-free (stub backends, scratch repos) and ship with the package, as the gate does.
|
|
403
|
+
for _fhg_lane in scripts/test_fh_gate_defaults_lanes.sh scripts/test_fh_gate_exec_lanes.sh scripts/test_fh_gate_fusion_lanes.sh scripts/test_fh_gate_absorb_lanes.sh; do
|
|
404
|
+
if [ -f "$_fhg_lane" ]; then
|
|
405
|
+
bash "$_fhg_lane" || fail=1
|
|
406
|
+
else
|
|
407
|
+
echo "FAIL fh-gate: $_fhg_lane missing"; fail=1
|
|
408
|
+
fi
|
|
409
|
+
done
|
|
410
|
+
|
|
400
411
|
# pre-push stdin integrity — anchors the 2026-07-20 fail-open hole (a stdin-inheriting subprocess
|
|
401
412
|
# above the ref loop drains git's ref list → Destructive-Op gate silently allows a delete/force push).
|
|
402
413
|
# Wired here, not left standalone: an unwired checker is the exact defect this session found in
|
|
@@ -1185,7 +1196,10 @@ for _pair in \
|
|
|
1185
1196
|
"scripts/destructive_pre_gate.sh|scripts/test_destructive_pre_gate_lanes.sh" \
|
|
1186
1197
|
"scripts/probe_live_eval_lib.py|scripts/test_live_eval_transitions_lanes.sh" \
|
|
1187
1198
|
"scripts/correction_moments.py|scripts/test_correction_moments_lanes.sh" \
|
|
1199
|
+
"scripts/below_floor_scan.sh|scripts/test_below_floor_scan_lanes.sh" \
|
|
1200
|
+
"scripts/job_heartbeat.py|scripts/test_job_heartbeat_lanes.sh" \
|
|
1188
1201
|
"scripts/probe_live_eval_lib.py|scripts/test_live_eval_construct_lanes.sh" \
|
|
1202
|
+
"scripts/live_eval_matrix.py|scripts/test_live_eval_matrix_lanes.sh" \
|
|
1189
1203
|
"scripts/live_eval_trace.py|scripts/test_live_eval_trace_lanes.sh" \
|
|
1190
1204
|
"scripts/probe_live_eval_lib.py|scripts/test_live_eval_trace_lanes.sh" \
|
|
1191
1205
|
"scripts/sim_isolated_run.sh|scripts/test_live_eval_trace_lanes.sh" \
|
|
@@ -1224,6 +1238,14 @@ for _pair in \
|
|
|
1224
1238
|
"plugins/fh-meta/skills/frontier-digest/SKILL.md|scripts/test_frontier_digest_recall.sh" \
|
|
1225
1239
|
"scripts/test_frontier_digest_recall.sh|scripts/test_frontier_digest_recall_negctl.sh" \
|
|
1226
1240
|
"scripts/fh_module_check.py|scripts/test_fh_module_check_lanes.sh" \
|
|
1241
|
+
"scripts/heavy_skill_smell.py|scripts/test_heavy_skill_smell_lanes.sh" \
|
|
1242
|
+
"scripts/cartridge_loader.py|scripts/test_cartridge_loader_lanes.sh" \
|
|
1243
|
+
"scripts/scoreboard_render.py|scripts/test_scoreboard_render_lanes.sh" \
|
|
1244
|
+
"scripts/fh_gate_exec.sh|scripts/test_fh_gate_exec_lanes.sh" \
|
|
1245
|
+
"scripts/fh-gate.sh|scripts/test_fh_gate_fusion_lanes.sh" \
|
|
1246
|
+
"scripts/fh-gate.sh|scripts/test_fh_gate_absorb_lanes.sh" \
|
|
1247
|
+
"scripts/fh-gate.sh|scripts/test_fh_gate_defaults_lanes.sh" \
|
|
1248
|
+
"scripts/fh_techwriter_sync_check.sh|scripts/test_fh_techwriter_sync_lanes.sh" \
|
|
1227
1249
|
"scripts/knowledge_seam_check.sh|scripts/test_knowledge_seam_lanes.sh" \
|
|
1228
1250
|
"templates/.git-hooks/pre-commit|scripts/test_marker_crossfamily_lanes.sh" \
|
|
1229
1251
|
"templates/.git-hooks/pre-commit|scripts/test_marker_floor_lanes.sh" \
|
|
@@ -1303,6 +1325,8 @@ for _pair in \
|
|
|
1303
1325
|
"scripts/proposal_hook.sh|scripts/test_proposal_hook_lanes.sh" \
|
|
1304
1326
|
"plugins/fh-commons/skills/ko-tech-writer/SKILL.md|scripts/test_ko_tech_writer_lanes.sh" \
|
|
1305
1327
|
"plugins/fh-meta/skills/meta-prompt-builder/SKILL.md|scripts/test_meta_prompt_restate_lanes.sh" \
|
|
1328
|
+
"plugins/fh-meta/skills/deep-clarify/SKILL.md|scripts/test_deep_clarify_spec_path_lanes.sh" \
|
|
1329
|
+
"plugins/fh-meta/skills/deep-clarify/SKILL.md|scripts/test_deep_clarify_interview_lanes.sh" \
|
|
1306
1330
|
"scripts/absorption_queue.py|scripts/test_absorption_queue_lanes.sh" \
|
|
1307
1331
|
"scripts/catch_tally.py|scripts/test_catch_tally_lanes.sh" \
|
|
1308
1332
|
"scripts/shell_name_boundary_scan.sh|scripts/test_name_boundary_locale_lanes.sh" \
|
|
@@ -2223,6 +2247,28 @@ else
|
|
|
2223
2247
|
fail=1
|
|
2224
2248
|
fi
|
|
2225
2249
|
|
|
2250
|
+
# prepush_marker_lookup — the pre-push Load-Bearing gate reads this branch's marker where pre-commit
|
|
2251
|
+
# writes it (the evidence root), not a path only the main checkout has.
|
|
2252
|
+
if [ -f scripts/test_prepush_marker_lookup_lanes.sh ]; then
|
|
2253
|
+
if ! bash scripts/test_prepush_marker_lookup_lanes.sh; then
|
|
2254
|
+
fail=1
|
|
2255
|
+
fi
|
|
2256
|
+
else
|
|
2257
|
+
echo "FAIL test_prepush_marker_lookup_lanes.sh: absent — the pre-push marker lookup has no lane"
|
|
2258
|
+
fail=1
|
|
2259
|
+
fi
|
|
2260
|
+
|
|
2261
|
+
# guard_anchor_override_env — the two guard anchors (universal_guard_check.sh · prepush_guard_check.sh)
|
|
2262
|
+
# must measure the hook's default whatever override the caller exported (PUBLIC_SURFACE_OK=1 …).
|
|
2263
|
+
if [ -f scripts/test_guard_anchor_override_env_lanes.sh ]; then
|
|
2264
|
+
if ! bash scripts/test_guard_anchor_override_env_lanes.sh; then
|
|
2265
|
+
fail=1
|
|
2266
|
+
fi
|
|
2267
|
+
else
|
|
2268
|
+
echo "FAIL test_guard_anchor_override_env_lanes.sh: absent — the anchors' override scrub has no lane"
|
|
2269
|
+
fail=1
|
|
2270
|
+
fi
|
|
2271
|
+
|
|
2226
2272
|
# And the ablation calibrator, for the third instance of the same reason. Its whole job is telling
|
|
2227
2273
|
# apart states that look identical from outside — "the arm could not answer" vs "the runner is dead"
|
|
2228
2274
|
# vs "the runner read the answer off disk" — and round 2 of its own adversarial review found that
|
|
@@ -2698,6 +2744,62 @@ else
|
|
|
2698
2744
|
fail=1
|
|
2699
2745
|
fi
|
|
2700
2746
|
|
|
2747
|
+
# fh_module_check.py — the REAL-CORPUS arm. Wired 2026-11-16 (clean-room audit round 9) because the
|
|
2748
|
+
# 19 RD fixture lanes in test_fh_module_check_lanes.sh measure the CHECKER and nothing measured its
|
|
2749
|
+
# SUBJECTS. Three `fh-module.yaml` manifests ship (plugins/fh-commons/skills/{ko-tech-writer,
|
|
2750
|
+
# persona-cast,convergence-loop}) and no standing channel ever ran the install-time check over them:
|
|
2751
|
+
# measured with grep over scripts/, templates/.git-hooks/ and .github/ — 0 callers, the only hits
|
|
2752
|
+
# being this file's pair declaration, the spec, CATALOG.md and the lane suite's own fixtures.
|
|
2753
|
+
# plugins/fh-meta/CHANGELOG.md asserts "The three modules in this package pass". That was true when
|
|
2754
|
+
# measured by hand (all three rc 0, re-measured 2026-11-16) and had NO channel behind it, so a drift
|
|
2755
|
+
# in a manifest, or in a shipped .py inside one of those skills, would have been found by the
|
|
2756
|
+
# consumer installing the module rather than here. The install-time verdict is exactly what a
|
|
2757
|
+
# context-less clone user meets first, which is why it belongs in this file and not in a lane.
|
|
2758
|
+
# Package mode is decided by BOTH sides being absent — the `probe_scope_check.sh` idiom two blocks
|
|
2759
|
+
# up, whose own comment earns the rule that over-blocking the normal case is a defect too.
|
|
2760
|
+
# The subject's exit contract, from its own header: 0 OK · 1 BLOCK · 2 UNMEASURED ·
|
|
2761
|
+
# 3 OK-but-UNCALIBRATED, which it calls "never a clean pass" — so 2 and 3 are NOT passes here. They
|
|
2762
|
+
# print at the LINE HEAD as `INCOMPLETE fh-module …` rather than only as a ⬜ decoration, because a
|
|
2763
|
+
# non-pass written in a local decoration is one the next round's log diff cannot count (round 8).
|
|
2764
|
+
# Why not `_show_failure`: that helper extracts ❌-marked lines from a SUITE's output, and this
|
|
2765
|
+
# subject speaks a different vocabulary — `BLOCK:`/`UNMEASURED:`/`RESULT:` lines. Handing it this
|
|
2766
|
+
# output would print the trailing NOTE instead of the reason, so the reason is lifted directly.
|
|
2767
|
+
_fmc_why() { printf '%s\n' "$1" | grep -E '^(BLOCK|UNMEASURED|UNCAL|RESULT):' | head -6 | sed 's/^/ /'; }
|
|
2768
|
+
_fmc_manifests=$(find . -name fh-module.yaml -not -path './node_modules/*' -not -path './.git/*' 2>/dev/null | sort)
|
|
2769
|
+
# `wc -l` over a sed-stripped list rather than `grep -c . || true`: grep exits 1 on a zero count, so
|
|
2770
|
+
# the obvious form needs a `|| true`, and a short-circuit to a permissive value is the exact shape
|
|
2771
|
+
# degrade_direction_scan.sh exists to flag. `wc` always exits 0, so the count needs no rescue.
|
|
2772
|
+
_fmc_n=$(printf '%s\n' "$_fmc_manifests" | sed '/^[[:space:]]*$/d' | wc -l | tr -d ' ')
|
|
2773
|
+
if [ ! -f scripts/fh_module_check.py ] && [ "$_fmc_n" -eq 0 ]; then
|
|
2774
|
+
echo "SKIP fh_module_check.py corpus (package mode: neither the checker nor any fh-module.yaml is here)"
|
|
2775
|
+
elif [ ! -f scripts/fh_module_check.py ]; then
|
|
2776
|
+
echo "FAIL fh_module_check.py corpus: $_fmc_n manifest(s) present but the checker is missing — the install-time verdict is UNMEASURED, not clean"
|
|
2777
|
+
fail=1
|
|
2778
|
+
elif [ "$_fmc_n" -eq 0 ]; then
|
|
2779
|
+
echo "FAIL fh_module_check.py corpus: the checker is here but no fh-module.yaml was found — the corpus vanished; UNMEASURED, not clean"
|
|
2780
|
+
fail=1
|
|
2781
|
+
else
|
|
2782
|
+
_fmc_bad=0
|
|
2783
|
+
while IFS= read -r _m; do
|
|
2784
|
+
[ -n "$_m" ] || continue
|
|
2785
|
+
_out=$(python3 scripts/fh_module_check.py check "$_m" 2>&1); _rc=$?
|
|
2786
|
+
case "$_rc" in
|
|
2787
|
+
0) echo "PASS fh-module ${_m#./} (install-time check: OK)" ;;
|
|
2788
|
+
1) echo "FAIL fh-module ${_m#./}: BLOCK (rc 1) — this module would be refused at install time"
|
|
2789
|
+
_fmc_why "$_out"; _fmc_bad=1 ;;
|
|
2790
|
+
2) echo "INCOMPLETE fh-module ${_m#./}: ⬜ UNMEASURED (rc 2 — unreadable, tooling down, or empty core list). NOT a pass"
|
|
2791
|
+
_fmc_why "$_out"; _fmc_bad=1 ;;
|
|
2792
|
+
3) echo "INCOMPLETE fh-module ${_m#./}: ⬜ OK-but-UNCALIBRATED (rc 3) — the subject's own contract calls this never a clean pass"
|
|
2793
|
+
_fmc_bad=1 ;;
|
|
2794
|
+
*) echo "INCOMPLETE fh-module ${_m#./}: ⬜ the checker exited $_rc, outside its documented 0/1/2/3 contract — UNMEASURED"
|
|
2795
|
+
_fmc_why "$_out"; _fmc_bad=1 ;;
|
|
2796
|
+
esac
|
|
2797
|
+
done <<_FMC_EOF
|
|
2798
|
+
$_fmc_manifests
|
|
2799
|
+
_FMC_EOF
|
|
2800
|
+
[ "$_fmc_bad" -eq 0 ] || fail=1
|
|
2801
|
+
fi
|
|
2802
|
+
|
|
2701
2803
|
# utterance landing check — the close chain's CONTENT anchor, and it has to be RUN, not parsed.
|
|
2702
2804
|
# Measured 2026-08-08 on the branch that introduced it: the only thing in this file that touched
|
|
2703
2805
|
# `scripts/utterance_landing_check.sh` was the `bash -n` syntax sweep at the top. Syntax passing is
|
|
@@ -3126,6 +3228,17 @@ fi
|
|
|
3126
3228
|
# Lane-identity tripwire — record-only: a WARN line, never a FAIL (a hit is a past event in the
|
|
3127
3229
|
# repo, not this run's verdict). Runs AFTER the lanes, which is when a leaked commit would have just landed.
|
|
3128
3230
|
if [ -f scripts/lane_identity_tripwire.sh ]; then bash scripts/lane_identity_tripwire.sh . | grep -v '^LANE-TRIPWIRE ok' ; fi
|
|
3231
|
+
# fh-techwriter copy sync (2026-11-19) — record-only: an INFO line, never a FAIL. The copy lives in another
|
|
3232
|
+
# repository and is regenerated and pushed there by a human, so its state is not this tree's verdict. Shard 1
|
|
3233
|
+
# only, source tree only. Exit 2 (no copy here, export failed) prints «not measured», never «in sync».
|
|
3234
|
+
if [ -f scripts/fh_techwriter_sync_check.sh ] && [ "$_CONSUMER" -ne 1 ] && { [ -z "${_SHARD_N:-}" ] || [ "${_SHARD_I:-1}" = 1 ]; }; then
|
|
3235
|
+
_tw=$(bash scripts/fh_techwriter_sync_check.sh </dev/null 2>&1); _twrc=$?
|
|
3236
|
+
case "$_twrc" in
|
|
3237
|
+
0) echo "INFO fh-techwriter copy: in sync — $(printf '%s\n' "$_tw" | grep '^fh-techwriter sync:' | cut -c21-)";;
|
|
3238
|
+
1) printf '%s\n' "$_tw" | sed 's/^/INFO fh-techwriter copy: /';;
|
|
3239
|
+
*) echo "INFO fh-techwriter copy: not measured — $(printf '%s\n' "$_tw" | tail -1)";;
|
|
3240
|
+
esac
|
|
3241
|
+
fi
|
|
3129
3242
|
if [ "$_CONSUMER" -eq 1 ]; then
|
|
3130
3243
|
_n=$(printf '%s\n' $CONSUMER_SKIPPED | grep -c .)
|
|
3131
3244
|
echo "CONSUMER PROFILE — $_n checkout-only suite(s) NOT measured here (not a pass):$CONSUMER_SKIPPED"
|
|
@@ -57,6 +57,8 @@
|
|
|
57
57
|
4 test_degrade_scan_shell_probes.sh
|
|
58
58
|
4 test_destructive_pre_gate_lanes.sh
|
|
59
59
|
4 test_fh_module_check_lanes.sh
|
|
60
|
+
3 test_heavy_skill_smell_lanes.sh
|
|
61
|
+
4 test_cartridge_loader_lanes.sh
|
|
60
62
|
4 test_heavy_classifier_lanes.sh
|
|
61
63
|
4 test_marker_first_use_lanes.sh
|
|
62
64
|
4 test_memory_link_check.sh
|
|
@@ -59,11 +59,13 @@ command -v gtimeout >/dev/null 2>&1 && TIMEOUT_BIN="gtimeout"
|
|
|
59
59
|
# No coreutils timeout on stock macOS. perl's alarm is the portable watchdog; if perl is missing too,
|
|
60
60
|
# run WITHOUT a deadline rather than skipping the probe — a missing watchdog must never become a
|
|
61
61
|
# silently skipped measurement reported as absence (the same rule fh_session_load.sh applies).
|
|
62
|
+
# Every probe passes its prompt as an argument, so the runtime gets a closed stdin: inheriting the caller's
|
|
63
|
+
# stdin let codex_launch_guard.sh wait on an agent shell's never-ending one (2026-11-20, 2 h 30 min).
|
|
62
64
|
_run() {
|
|
63
65
|
local secs="$1"; shift
|
|
64
|
-
if [ -n "$TIMEOUT_BIN" ]; then "$TIMEOUT_BIN" "$secs" "$@"
|
|
65
|
-
elif command -v perl >/dev/null 2>&1; then perl -e 'alarm shift @ARGV; exec @ARGV' "$secs" "$@"
|
|
66
|
-
else "$@"; fi
|
|
66
|
+
if [ -n "$TIMEOUT_BIN" ]; then "$TIMEOUT_BIN" "$secs" "$@" < /dev/null
|
|
67
|
+
elif command -v perl >/dev/null 2>&1; then perl -e 'alarm shift @ARGV; exec @ARGV' "$secs" "$@" < /dev/null
|
|
68
|
+
else "$@" < /dev/null; fi
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
# _answer — reduce a runtime's stdout to THE MODEL'S ANSWER.
|
|
@@ -104,7 +106,7 @@ CODEX_GUARD="$(cd "$(dirname "$0")" && pwd)/codex_launch_guard.sh"
|
|
|
104
106
|
build_cmd() {
|
|
105
107
|
case "$1" in
|
|
106
108
|
codex) CMD=(bash "$CODEX_GUARD" codex exec -m "$2" -c model_reasoning_effort=high --skip-git-repo-check "$3") ;; # company-root paths refused
|
|
107
|
-
agy) CMD=(bash "$AGY_GUARD" agy -p "$3" --model "$2" --print-timeout 170s) ;; # refuses unless FH_AGY_ISOLATION=container|os-user
|
|
109
|
+
agy) CMD=(bash "$AGY_GUARD" agy -p "$3" --model "$2" --print-timeout 170s) ;; # refuses unless FH_AGY_ISOLATION=container|os-user|no-tools-agent
|
|
108
110
|
*) CMD=("$1" "$3") ;;
|
|
109
111
|
esac
|
|
110
112
|
}
|
|
@@ -130,7 +132,7 @@ probe_runtime() {
|
|
|
130
132
|
# The isolation guard refused before agy started: nothing was measured. Say so instead of reading
|
|
131
133
|
# the refusal text as the model's answer (it rendered REACHABLE · control: rejects-bogus before).
|
|
132
134
|
if [ "$id_rc" -eq 3 ] && printf '%s\n' "$id_raw" | grep -q '^AGY-REFUSED'; then
|
|
133
|
-
printf '%-6s REFUSED — agy_launch_guard: FH_AGY_ISOLATION is not container|os-user, agy not started, nothing measured\n' "$rt"
|
|
135
|
+
printf '%-6s REFUSED — agy_launch_guard: FH_AGY_ISOLATION is not container|os-user|no-tools-agent (or that route refused), agy not started, nothing measured\n' "$rt"
|
|
134
136
|
return 0
|
|
135
137
|
fi
|
|
136
138
|
|
|
@@ -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 ]
|