@chrono-meta/fh-gate 3.42.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.
Files changed (71) hide show
  1. package/.claude/regression/probes_live.yaml +16 -8
  2. package/.claude/rules/fh_4axis_gate.md +8 -0
  3. package/.claude-plugin/marketplace.json +4 -4
  4. package/AGENTS.md +9 -0
  5. package/README.ja.md +2 -0
  6. package/README.ko.md +2 -0
  7. package/README.md +2 -0
  8. package/README.zh.md +2 -0
  9. package/docs/HOW_FH_DIFFERS.en.md +37 -0
  10. package/docs/HOW_FH_DIFFERS.md +39 -0
  11. package/docs/USER_GUIDE.md +208 -2
  12. package/docs/model_tier_expectations.md +8 -4
  13. package/knowledge/shared/harness-core/claude_md_full_reference.md +10 -0
  14. package/knowledge/shared/harness-core/dispatch_conditional_prohibition.md +18 -0
  15. package/knowledge/shared/harness-core/fh_module_contract.md +19 -0
  16. package/knowledge/shared/harness-core/governance_engineering_definition.md +16 -0
  17. package/knowledge/shared/harness-core/measurement-integrity-checklist.md +24 -0
  18. package/knowledge/shared/learnings/subagent_invocations_log.yaml +42 -0
  19. package/knowledge/shared/plugin-catalog/recommended_plugins.md +53 -9
  20. package/package.json +13 -1
  21. package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
  22. package/plugins/fh-commons/skills/ko-tech-writer/SKILL.md +49 -14
  23. package/plugins/fh-commons/skills/ko-tech-writer/SKILL_detail.md +60 -0
  24. package/plugins/fh-commons/skills/ko-tech-writer/fixtures/sense_negative.md +30 -0
  25. package/plugins/fh-commons/skills/ko-tech-writer/fixtures/sense_positive.md +56 -0
  26. package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
  27. package/plugins/fh-meta/CHANGELOG.md +55 -2
  28. package/plugins/fh-meta/skills/auto-decorrelation/SKILL.md +45 -1
  29. package/plugins/fh-meta/skills/edit-manifest/SKILL.md +14 -1
  30. package/plugins/fh-meta/skills/harvest-loop/SKILL.md +1 -1
  31. package/plugins/fh-meta/skills/meta-prompt-builder/SKILL.md +19 -0
  32. package/plugins/fh-meta/skills/sim-conductor/SKILL_detail.md +3 -3
  33. package/plugins/fh-meta/skills/steel-quench/SKILL_detail.md +8 -4
  34. package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
  35. package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
  36. package/scripts/agy_launch_guard.sh +49 -0
  37. package/scripts/agy_remote_run.sh +187 -0
  38. package/scripts/capability_registry_check.sh +15 -2
  39. package/scripts/codex_launch_guard.sh +87 -0
  40. package/scripts/finding_fleet.sh +35 -2
  41. package/scripts/finding_verifier.sh +6 -2
  42. package/scripts/ko_tech_writer_calibrate.py +88 -1
  43. package/scripts/live_eval_trace.py +141 -0
  44. package/scripts/package_coverage_check.sh +7 -0
  45. package/scripts/pr_merge_verified.sh +7 -0
  46. package/scripts/prepush_guard_check.sh +33 -20
  47. package/scripts/probe_live_eval.sh +6 -3
  48. package/scripts/probe_live_eval_lib.py +92 -2
  49. package/scripts/remote_marker_gate.sh +56 -0
  50. package/scripts/selfcheck.sh +58 -2
  51. package/scripts/session_checklist.py +109 -5
  52. package/scripts/session_close_check.sh +16 -0
  53. package/scripts/sidecar_calibrate.sh +10 -2
  54. package/scripts/sidecar_wait.sh +21 -1
  55. package/scripts/sim_isolated_run.sh +17 -2
  56. package/scripts/test_agy_launch_guard_lanes.sh +227 -0
  57. package/scripts/test_agy_remote_run_lanes.sh +228 -0
  58. package/scripts/test_codex_launch_guard_lanes.sh +138 -0
  59. package/scripts/test_finding_pipeline_lanes.sh +6 -2
  60. package/scripts/test_fixture_guard_coverage_lanes.sh +71 -10
  61. package/scripts/test_live_eval_trace_lanes.sh +191 -0
  62. package/scripts/test_meta_prompt_restate_lanes.sh +36 -0
  63. package/scripts/test_mutation_probe_lanes.sh +26 -6
  64. package/scripts/test_pr_merge_verified_lanes.sh +23 -0
  65. package/scripts/test_preprep_speech_coach_lanes.sh +18 -2
  66. package/scripts/test_prepush_guard_failure_visibility_lanes.sh +152 -0
  67. package/scripts/test_remote_marker_gate_lanes.sh +96 -0
  68. package/scripts/test_session_checklist_lanes.sh +205 -0
  69. package/scripts/test_session_close_lanes.sh +7 -0
  70. package/scripts/test_sidecar_calibrate_lanes.sh +4 -0
  71. package/scripts/test_sidecar_wait_stdin.sh +18 -0
@@ -513,12 +513,15 @@ if [ ! -f scripts/prepush_guard_check.sh ]; then
513
513
  _absent_subject_verdict "prepush-guard known-pair" "scripts/prepush_guard_check.sh" || fail=1
514
514
  else
515
515
  # πŸŸ₯ νŒŒμ΄ν”„ μ•žμ—μ„œ rc λ₯Ό μž‘λŠ”λ‹€ β€” ν‘œμ‹œ ν•„ν„°μ˜ rc λ₯Ό 읽으면 μ‹€νŒ¨κ°€ 0 으둜 보인닀.
516
+ # πŸŸ₯ tail -12 둜 자λ₯΄μ§€ μ•ŠλŠ”λ‹€ β€” ν•˜μœ„ μ†ŒλΉ„μžκ°€ Β«BLOCKED β€” a known pair brokeΒ» 만 λ°›κ³  μ–΄λŠ μŒμΈμ§€
517
+ # λͺ» 읽은 싀사고(2026-11-16, 원인은 UNMEASURED). ❌ 쀄을 λ½‘λŠ” _show_failure 둜 보이고, 전체 경과도 μ°λŠ”λ‹€.
518
+ _pg_t0=$SECONDS
516
519
  _pg_out="$(bash scripts/prepush_guard_check.sh 2>&1)"; _pg_rc=$?
517
520
  if [ "$_pg_rc" -eq 0 ]; then
518
521
  echo "PASS prepush-guard known-pair"
519
522
  else
520
- echo "FAIL prepush-guard known-pair (rc=$_pg_rc)"
521
- [ -n "$_pg_out" ] && printf '%s\n' "$_pg_out" | tail -12 | sed 's/^/ /'
523
+ echo "FAIL prepush-guard known-pair (rc=$_pg_rc, $((SECONDS - _pg_t0))s)"
524
+ _show_failure "$_pg_out"
522
525
  fail=1
523
526
  fi
524
527
  fi
@@ -1183,10 +1186,16 @@ for _pair in \
1183
1186
  "scripts/probe_live_eval_lib.py|scripts/test_live_eval_transitions_lanes.sh" \
1184
1187
  "scripts/correction_moments.py|scripts/test_correction_moments_lanes.sh" \
1185
1188
  "scripts/probe_live_eval_lib.py|scripts/test_live_eval_construct_lanes.sh" \
1189
+ "scripts/live_eval_trace.py|scripts/test_live_eval_trace_lanes.sh" \
1190
+ "scripts/probe_live_eval_lib.py|scripts/test_live_eval_trace_lanes.sh" \
1191
+ "scripts/sim_isolated_run.sh|scripts/test_live_eval_trace_lanes.sh" \
1186
1192
  `# 무인 자체개발 루프(2026-11-04, 운영자 μƒμ‹œ μš”μ²­). μžλ™ λ¨Έμ§€ 등급은 λͺ¨λΈμ΄ μ•„λ‹ˆλΌ 경둜 ν—ˆμš© λͺ©λ‘μ΄ μ •ν•œλ‹€ β€” 빈 λͺ©λ‘μ€ AUTO κ°€ μ•„λ‹ˆλΌ HARNESS-ERROR(μ‹€μΈ‘: κ°€λ“œλ₯Ό μ§€μš°λ©΄ 빈 λͺ©λ‘μ΄ AUTO 둜 톡과).` \
1187
1193
  "scripts/selfdev_merge_tier.sh|scripts/test_selfdev_merge_tier_lanes.sh" \
1188
1194
  "scripts/selfdev_queue.py|scripts/test_selfdev_queue_lanes.sh" \
1189
1195
  "scripts/ablation_nominate.py|scripts/test_ablation_nominate_lanes.sh" \
1196
+ "scripts/ablation_verdict.py|scripts/test_ablation_verdict_lanes.sh" \
1197
+ `# λΉŒλ” μΉ΄λ“œ 파일 μ—­ν•  4κ°’(2026-11-15, FH-6). λ””μŠ€νŒ¨μΉ˜ λ’€ 바뀐 파일 ∩ protected = βˆ… β€” protected λ₯Ό μ•ˆ 적은 μΉ΄λ“œλŠ” 톡과가 μ•„λ‹ˆλΌ HARNESS-ERROR.` \
1198
+ "scripts/builder_card_files_check.py|scripts/test_builder_card_files_lanes.sh" \
1190
1199
  `# 리슀 기둝 채널(2026-11-07). μ„Έμ…˜μ€ μ΄ˆμ•ˆ, 기둝은 운영자 β€” μ—μ΄μ „νŠΈ μ…Έ κ±°λΆ€ Β· μ½”λ“œ 뢈일치 무기둝 Β· μ›μžμ  ꡐ체.` \
1191
1200
  "scripts/lease_line_apply.sh|scripts/test_lease_line_apply_lanes.sh" \
1192
1201
  `# 곡유 μ„Έμ…˜ μž₯λΆ€(2026-11-11 μ‹œλ²”). 싀무 μ„Έμ…˜μ΄ μ“°κ³  λ£¨νŠΈκ°€ μ½λŠ”λ‹€ β€” μ•ˆ 적은 μ„Έμ…˜μ€ NOT-WRITTEN, κΉ¨μ§„ 쀄은 MALFORMED.` \
@@ -1293,6 +1302,7 @@ for _pair in \
1293
1302
  "scripts/stale_clone_guard.sh|scripts/test_stale_clone_guard_lanes.sh" \
1294
1303
  "scripts/proposal_hook.sh|scripts/test_proposal_hook_lanes.sh" \
1295
1304
  "plugins/fh-commons/skills/ko-tech-writer/SKILL.md|scripts/test_ko_tech_writer_lanes.sh" \
1305
+ "plugins/fh-meta/skills/meta-prompt-builder/SKILL.md|scripts/test_meta_prompt_restate_lanes.sh" \
1296
1306
  "scripts/absorption_queue.py|scripts/test_absorption_queue_lanes.sh" \
1297
1307
  "scripts/catch_tally.py|scripts/test_catch_tally_lanes.sh" \
1298
1308
  "scripts/shell_name_boundary_scan.sh|scripts/test_name_boundary_locale_lanes.sh" \
@@ -1861,6 +1871,52 @@ else
1861
1871
  echo "FAIL test_sidecar_calibrate_lanes.sh: sidecar_calibrate.sh present but its anchor is missing"
1862
1872
  fail=1
1863
1873
  fi
1874
+ # agy launch guard (2026-11-16). The guard is the only thing between an FH script and a cloud agent
1875
+ # CLI that reads this machine and sends what it read to the model; its lanes use fake agy stubs only.
1876
+ if [ ! -f scripts/agy_launch_guard.sh ]; then
1877
+ _absent_subject_verdict "test_agy_launch_guard_lanes.sh" "scripts/agy_launch_guard.sh" || fail=1
1878
+ elif [ -f scripts/test_agy_launch_guard_lanes.sh ]; then
1879
+ if ! bash scripts/test_agy_launch_guard_lanes.sh < /dev/null; then
1880
+ fail=1
1881
+ fi
1882
+ else
1883
+ echo "FAIL test_agy_launch_guard_lanes.sh: agy_launch_guard.sh present but its anchor is missing"
1884
+ fail=1
1885
+ fi
1886
+ # agy remote runner (2026-11-16) β€” the only route the guard's remote-os-user marker opens; its lanes use a fake ssh/scp.
1887
+ if [ ! -f scripts/agy_remote_run.sh ]; then
1888
+ _absent_subject_verdict "test_agy_remote_run_lanes.sh" "scripts/agy_remote_run.sh" || fail=1
1889
+ elif [ -f scripts/test_agy_remote_run_lanes.sh ]; then
1890
+ if ! env -u FH_AGY_REMOTE -u FH_AGY_REMOTE_DENY -u FH_AGY_REMOTE_RECEIPT_DIR bash scripts/test_agy_remote_run_lanes.sh < /dev/null; then
1891
+ fail=1
1892
+ fi
1893
+ else
1894
+ echo "FAIL test_agy_remote_run_lanes.sh: agy_remote_run.sh present but its anchor is missing"
1895
+ fail=1
1896
+ fi
1897
+ # codex launch guard (2026-11-16) β€” refuses a codex verifier arm whose prompt/args/cwd name a company root.
1898
+ if [ ! -f scripts/codex_launch_guard.sh ]; then
1899
+ _absent_subject_verdict "test_codex_launch_guard_lanes.sh" "scripts/codex_launch_guard.sh" || fail=1
1900
+ elif [ -f scripts/test_codex_launch_guard_lanes.sh ]; then
1901
+ if ! bash scripts/test_codex_launch_guard_lanes.sh < /dev/null; then
1902
+ fail=1
1903
+ fi
1904
+ else
1905
+ echo "FAIL test_codex_launch_guard_lanes.sh: codex_launch_guard.sh present but its anchor is missing"
1906
+ fail=1
1907
+ fi
1908
+ # prepush-guard failure visibility (2026-11-16) β€” a broken known pair must be named, with rc and
1909
+ # elapsed, in the last lines of the check and in selfcheck's own rendering of it.
1910
+ if [ ! -f scripts/prepush_guard_check.sh ]; then
1911
+ _absent_subject_verdict "test_prepush_guard_failure_visibility_lanes.sh" "scripts/prepush_guard_check.sh" || fail=1
1912
+ elif [ -f scripts/test_prepush_guard_failure_visibility_lanes.sh ]; then
1913
+ if ! bash scripts/test_prepush_guard_failure_visibility_lanes.sh < /dev/null; then
1914
+ fail=1
1915
+ fi
1916
+ else
1917
+ echo "FAIL test_prepush_guard_failure_visibility_lanes.sh: prepush_guard_check.sh present but its anchor is missing"
1918
+ fail=1
1919
+ fi
1864
1920
  # Squash-merge verification + its merge-path wiring (2026-09-24). Same subject/anchor pairing as above:
1865
1921
  # both scripts return verdict exit codes, and pr_merge_verified's whole job is to REFUSE before merging β€”
1866
1922
  # a refusal nobody re-runs is one the next edit quietly removes. Lanes are hermetic (temp repos, fake gh).
@@ -660,21 +660,119 @@ def _cells(line):
660
660
 
661
661
 
662
662
  CARRY_HEADING = "## 이전 κ²°κ³Όμ„œμ—μ„œ 이어받지 λͺ»ν•œ νŒμ •"
663
+ KEEP_HEADING = "## 이전 κ²°κ³Όμ„œμ˜ ν‘œ λ°– λ‚΄μš© (extract κ°€ λ‹€μ‹œ λ§Œλ“€μ§€ μ•ŠλŠ” 쀄 β€” μ›λž˜ μˆœμ„œ)"
664
+ # Lines do_extract writes itself, matched by their WHOLE shape (a stale copy, whose counts changed between runs, is not
665
+ # the operator's content). Whole-line, not prefix: a note the person starts with Β«πŸŸ₯ ν›… 기둝 …» or appends to a status
666
+ # line is theirs and must survive (independent review 2026-11-15 reproduced prefix matching dropping both).
667
+ _GENERATED_LINE_RES = tuple(re.compile(p) for p in (
668
+ r"^# μ„Έμ…˜ μš”μ²­ 체크리슀트 \(μŠ€μΌˆλ ˆν†€\) β€” [^\n]+$",
669
+ r"^채널 2/2 μ—΄μŒ β€” raw \d+건 Β· μ••μΆ• μš”μ•½ \d+건\(쀑볡 제거 ν›„ \d+건 μΆ”κ°€\)$",
670
+ "^" + chr(0x1F4CE) + r" 원μž₯ = .* \(\d+ lines\)$",
671
+ r"^πŸŸ₯ JSONL νŒŒμ‹± μ‹€νŒ¨ \d+쀄 β€” κ·Έ μ€„μ˜ λ°œν™”λŠ” 이 ν‘œμ— μ—†λ‹€ \(rc=2\)$",
672
+ r"^πŸͺ ν›… 기둝 채널 읽음 β€” \d+건 Β· 전사와 일치 \d+건 Β· ν›… μ „μš© \d+건 \(ν–‰ 번호 H = ν›… μ „μš©, S = μš”μ•½, 숫자 = 전사\)$",
673
+ r"^🟨 ν›… 기둝 채널 μ•ˆ 읽음 β€” 파일 μ—†μŒ: .* \(0건이 μ•„λ‹ˆλΌ λ―Έμ—΄λžŒ; 훅이 μ•ˆ κ±Έλ Έκ±°λ‚˜ λ‹€λ₯Έ ν—ˆλΈŒμΌ 수 μžˆλ‹€\)$",
674
+ r"^πŸŸ₯ ν›… 기둝 채널 였λ₯˜ β€” .*: .* \(rc=2; 전사 행은 κ·ΈλŒ€λ‘œ μ•„λž˜μ— μžˆλ‹€\)$",
675
+ r"^πŸŸ₯ ν›… 기둝 \d+쀄 해석 μ‹€νŒ¨ β€” κ·Έ μ€„μ˜ λ°œν™”λŠ” 이 ν‘œμ— 없을 수 μžˆλ‹€ \(rc=2\)$",
676
+ r"^↩️ 이전 κ²°κ³Όμ„œμ—μ„œ νŒμ • \d+쀄 μ΄μ–΄λ°›μŒ Β· λͺ» 맞좘 νŒμ • \d+쀄은 맨 μ•„λž˜ «이전 κ²°κ³Όμ„œμ—μ„œ 이어받지 λͺ»ν•œ νŒμ •Β»μ— 보쑴"
677
+ r"( Β· ν‘œ λ°– 쀄 \d+쀄은 맨 μ•„λž˜ «이전 κ²°κ³Όμ„œμ˜ ν‘œ λ°– λ‚΄μš©Β»μ— 보쑴)?$",
678
+ ))
679
+ _GENERATED_ROW_ID_RE = re.compile(r"^(\d+|H\d+|S\d+)$") # the Β«#Β» ids do_extract writes: 7 Β· H2 Β· S1
680
+ _GENERATED_HEADER = "| # | μ‹œκ° | λ°œν™”(μš”μ§€) | μƒνƒœ | 증거 | μ‚¬μœ  / 남은 것 | μ œμ•ˆ(이번 μ„Έμ…˜ vs 이월) |"
681
+ _GENERATED_SEPARATOR = "|---|---|---|---|---|---|---|"
682
+
683
+
684
+ def _carry_skip(c):
685
+ """rows carry_forward never reads as a checklist row: a header (Β«#Β» Β· empty first cell) or a separator in any
686
+ markdown spelling. ONE definition for both passes β€” when carry_forward skipped a row and _unconsumed assumed
687
+ carry_forward had it, the row vanished (review R3: Β«| --- | … |Β», Β«| :--- | … |Β», a person's Β«| # | … |Β» header)."""
688
+ if c[0] in ("#", "") or all(re.fullmatch(r":?-+:?", x) for x in c):
689
+ return True
690
+ return c[0] != "-" and set(c[0]) <= set("-") # Β«-Β» alone is an orphan row, not a separator
691
+
692
+
693
+ def _is_generated(line):
694
+ return line in (CARRY_HEADING, KEEP_HEADING) or any(r.match(line) for r in _GENERATED_LINE_RES)
695
+
696
+
697
+ def _fenced(old):
698
+ """indices of lines inside a CLOSED fenced code block, markers included β€” a person's code is kept verbatim, never
699
+ read as table rows or separators (review 2026-11-15). Same opener rule as load_tables (FENCE_RE: same character,
700
+ closer at least as long). An unclosed fence is ignored here, and so is an opener whose closer lies beyond extract's
701
+ own table header: either way the live table was swallowed and every judgment below it detached (review R2)."""
702
+ idx, opened = set(), None # opened = (index, char, length)
703
+ for i, l in enumerate(old):
704
+ if l == _GENERATED_HEADER and opened is not None:
705
+ opened = None # a fence never spans extract's own table: an opener above it is unclosed (review R2 repro)
706
+ continue
707
+ m = FENCE_RE.match(l)
708
+ if not m:
709
+ continue
710
+ tick = m.group(1)
711
+ if opened is None:
712
+ opened = (i, tick[0], len(tick))
713
+ elif tick[0] == opened[1] and len(tick) >= opened[2] and l.strip() == tick:
714
+ idx.update(range(opened[0], i + 1)); opened = None
715
+ return idx
716
+
717
+
718
+ def _unconsumed(old, lines_out):
719
+ """lines of the previous sheet that the table parser does not consume and extract does not regenerate β€”
720
+ a result-sheet section written below the table, a preface above it, prose between (2026-11-14 harvest H3: 13 such
721
+ lines vanished on one re-extract), closed fenced code verbatim, a person's own 7-column separator, and a hand-added
722
+ row with empty judgment cells whose Β«#Β» is not an id extract writes. Kept in their original order; outside fences blank runs collapse and edges are
723
+ trimmed, so a re-run over its own output yields the same block (idempotent)."""
724
+ regenerated = set(lines_out)
725
+ fenced = _fenced(old)
726
+ kept = []
727
+ for i, l in enumerate(old):
728
+ if i in fenced:
729
+ kept.append(l); continue
730
+ if not l.strip():
731
+ if kept and kept[-1] != "":
732
+ kept.append("")
733
+ continue
734
+ if l == _GENERATED_SEPARATOR:
735
+ # regenerated only where extract writes it β€” right under its own header; a person's 7-column table keeps it
736
+ if i > 0 and old[i - 1] == _GENERATED_HEADER:
737
+ continue
738
+ kept.append(l); continue
739
+ if l in regenerated or _is_generated(l):
740
+ continue
741
+ c = _cells(l)
742
+ if c is not None:
743
+ # a row carry_forward reads (not _carry_skip, has a judgment) is carried or orphaned there; an empty row
744
+ # with an id extract writes (7 Β· H2 Β· S1) is a skeleton row from some run β€” never the person's content,
745
+ # even when this run no longer writes it (review R2). Everything else β€” a person's own header, separator
746
+ # or empty labelled row β€” is kept here (the generated header was already dropped as `regenerated`).
747
+ if not _carry_skip(c) and any(c[3:]):
748
+ continue # carry_forward carries or orphans it
749
+ if not _carry_skip(c) and _GENERATED_ROW_ID_RE.match(c[0]):
750
+ continue # an empty skeleton row from some run
751
+ kept.append(l)
752
+ while kept and kept[-1] == "":
753
+ kept.pop()
754
+ return kept
663
755
 
664
756
 
665
757
  def carry_forward(lines_out, out_path):
666
758
  try:
667
759
  with open(out_path, "r", encoding="utf-8", errors="replace") as f:
668
- old = f.read().split("\n")
760
+ text = f.read()
669
761
  except OSError:
670
762
  return lines_out
763
+ old = (text[1:] if text.startswith("\ufeff") else text).split("\n") # a BOM (Notepad) broke every ^-anchored match
671
764
  prev, orphans_prev = {}, []
672
765
  in_orphans = False
673
- for l in old:
766
+ fenced = _fenced(old)
767
+ for i, l in enumerate(old):
768
+ if i in fenced:
769
+ continue # a person's code block: kept verbatim by _unconsumed
674
770
  if l.startswith(CARRY_HEADING):
675
771
  in_orphans = True; continue
676
772
  c = _cells(l)
677
- if not c or c[0] in ("#", "---") or set(c[0]) <= set("-"):
773
+ # Β«-Β» alone is how an orphan row is written (below) β€” not a separator. Reading it as one dropped every orphan
774
+ # judgment on the SECOND re-extract (found 2026-11-15 by the idempotency lane L55; origin/main reproduces it).
775
+ if not c or _carry_skip(c):
678
776
  continue
679
777
  if not any(c[3:]):
680
778
  continue # an empty row has nothing to carry
@@ -691,11 +789,17 @@ def carry_forward(lines_out, out_path):
691
789
  out.append(l)
692
790
  orphans = ["| %s | %s | %s | %s | %s | %s | %s |" % ((("-",) + k + tuple(v))) for k, vs in prev.items() for v in vs]
693
791
  orphans += orphans_prev
694
- if used or orphans:
695
- out.insert(4, "↩️ 이전 κ²°κ³Όμ„œμ—μ„œ νŒμ • %d쀄 μ΄μ–΄λ°›μŒ Β· λͺ» 맞좘 νŒμ • %d쀄은 맨 μ•„λž˜ «이전 κ²°κ³Όμ„œμ—μ„œ 이어받지 λͺ»ν•œ νŒμ •Β»μ— 보쑴" % (used, len(orphans)))
792
+ kept = _unconsumed(old, lines_out)
793
+ if used or orphans or kept:
794
+ msg = "↩️ 이전 κ²°κ³Όμ„œμ—μ„œ νŒμ • %d쀄 μ΄μ–΄λ°›μŒ Β· λͺ» 맞좘 νŒμ • %d쀄은 맨 μ•„λž˜ «이전 κ²°κ³Όμ„œμ—μ„œ 이어받지 λͺ»ν•œ νŒμ •Β»μ— 보쑴" % (used, len(orphans))
795
+ if kept:
796
+ msg += " Β· ν‘œ λ°– 쀄 %d쀄은 맨 μ•„λž˜ «이전 κ²°κ³Όμ„œμ˜ ν‘œ λ°– λ‚΄μš©Β»μ— 보쑴" % sum(1 for l in kept if l)
797
+ out.insert(4, msg)
696
798
  if orphans:
697
799
  out += ["", CARRY_HEADING, "", "| # | μ‹œκ° | λ°œν™”(μš”μ§€) | μƒνƒœ | 증거 | μ‚¬μœ  / 남은 것 | μ œμ•ˆ(이번 μ„Έμ…˜ vs 이월) |",
698
800
  "|---|---|---|---|---|---|---|"] + orphans
801
+ if kept:
802
+ out += ["", KEEP_HEADING, ""] + kept
699
803
  return out
700
804
 
701
805
 
@@ -528,6 +528,22 @@ if [ -f "$FC" ]; then
528
528
  fi
529
529
  fi
530
530
 
531
+ # β‘€-done-anchor (RECORD-ONLY β€” never sets FAIL, 2026-11-14). A Β«μ™„λ£Œ/doneΒ» line is a claim about the
532
+ # world handed to the next session. arXiv:2611.14654 measured what a tidied record costs the reader:
533
+ # an agent's own Β«completedΒ» action next to an error still in the world lowered recovery 50% β†’ 44%,
534
+ # while a truthful note beside the preserved error raised it 51% β†’ 66% (vs a matched neutral note).
535
+ # This line checks only a property of the record β€” does each done-line carry a world anchor (commit
536
+ # sha Β· #PR Β· run id Β· file path Β· URL) β€” never whether the work is actually done.
537
+ if [ -f "$FC" ]; then
538
+ _DONE_RE='μ™„λ£Œ|[Dd]one|DONE|[Cc]losed'
539
+ _ANCHOR_RE='[0-9a-f]{7,40}|#[0-9]+|[0-9]{8,}|[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+|[A-Za-z0-9_-]+\.(md|sh|py|js|json|yml)|https?://'
540
+ _bare=$(grep -E "$_DONE_RE" "$FC" | grep -vE '^[[:space:]]*#' | grep -vcE "$_ANCHOR_RE")
541
+ if [ "${_bare:-0}" -gt 0 ]; then
542
+ echo "β“˜ β‘€-done-anchor ${_bare} Β«μ™„λ£ŒΒ» line(s) in fh_completed_${TODAY}.md name no commit Β· PR Β· file (record only) β€” pair each with its world state, and say what is still unresolved:"
543
+ grep -E "$_DONE_RE" "$FC" | grep -vE '^[[:space:]]*#' | grep -vE "$_ANCHOR_RE" | head -3 | cut -c1-140 | sed 's/^/ /'
544
+ fi
545
+ fi
546
+
531
547
  # β‘£-b npm freshness β€” files[] assets changed since last version tag β†’ republish owed.
532
548
  # Patterns are NARROWED to the actually-shipped subpaths (package.json files[]): knowledge/ ships only
533
549
  # shared/{harness-core,dialogue,rules}; docs/ ships only {codex-compat,CONTRIBUTING,pillars}. A broad
@@ -94,6 +94,8 @@ VERDICT_PROMPT="Reply with exactly one word, PASS or FAIL, and nothing else. The
94
94
  BOGUS_MODEL="zzz-nonexistent-model-9.9"
95
95
 
96
96
  PANEL=""
97
+ AGY_GUARD="$(cd "$(dirname "$0")" && pwd)/agy_launch_guard.sh"
98
+ CODEX_GUARD="$(cd "$(dirname "$0")" && pwd)/codex_launch_guard.sh"
97
99
 
98
100
  # build_cmd <runtime> <model> <prompt> β€” fills CMD as an argv array.
99
101
  # NOT a shell function passed to the watchdog: `timeout`/`gtimeout` exec a BINARY and cannot see
@@ -101,8 +103,8 @@ PANEL=""
101
103
  # runtime failing to run (caught by lane 3/4b/5b, not by reading).
102
104
  build_cmd() {
103
105
  case "$1" in
104
- codex) CMD=(codex exec -m "$2" -c model_reasoning_effort=high --skip-git-repo-check "$3") ;;
105
- agy) CMD=(agy -p "$3" --model "$2" --print-timeout 170s) ;;
106
+ 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
106
108
  *) CMD=("$1" "$3") ;;
107
109
  esac
108
110
  }
@@ -125,6 +127,12 @@ probe_runtime() {
125
127
  # (`${PIPESTATUS[0]}` λŠ” bash μ „μš©μ΄κ³ , 정본은 Β«νŒŒμ΄ν”„λ₯Ό μ“°μ§€ μ•ŠλŠ” 것» 이닀.)
126
128
  id_raw="$(_run 200 "${CMD[@]}" 2>&1)"; id_rc=$?
127
129
  id_out="$(printf '%s\n' "$id_raw" | _answer)"
130
+ # The isolation guard refused before agy started: nothing was measured. Say so instead of reading
131
+ # the refusal text as the model's answer (it rendered REACHABLE Β· control: rejects-bogus before).
132
+ 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"
134
+ return 0
135
+ fi
128
136
 
129
137
  # Discriminating check β€” the answer must be the MODEL's self-report naming the model that was
130
138
  # pinned. What counts as "naming it" is the VERSION token, not every token of the pin slug:
@@ -27,12 +27,18 @@
27
27
  # SIDECAR_VERDICT=TIMEOUT waited=<n>s bytes=<n> still alive when the budget ran out; NOT a result
28
28
  # SIDECAR_VERDICT=EMPTY exit=<n> exited cleanly having written nothing β€” the only
29
29
  # state in which "the sidecar said nothing" is true
30
+ # SIDECAR_VERDICT=HARNESS-ERROR exit=<n> reason=model-not-available|guard-refused the CLI refused the
31
+ # model, or a launch guard refused to start it
32
+ # (exit 3) β€” nothing was reviewed; never read as 0 findings
30
33
  #
31
34
  # Usage:
32
35
  # bash scripts/sidecar_wait.sh <outfile> <timeout_seconds> -- <command> [args...]
33
- # printf '%s' "$prompt" | bash scripts/sidecar_wait.sh out.txt 600 -- codex exec -m gpt-5.5 -
36
+ # printf '%s' "$prompt" | bash scripts/sidecar_wait.sh out.txt 600 -- bash scripts/codex_launch_guard.sh codex exec -
37
+ # (no -m: the CLI default answers; a pinned model can be retired β€” gpt-5.5 / gpt-5 return HTTP 400
38
+ # on 2026-11-16 β€” and then this wrapper reports HARNESS-ERROR, not a result)
34
39
  #
35
40
  # Exit: 0 = COMPLETE (with or without output) Β· 1 = TIMEOUT (verdict withheld, not a failure claim)
41
+ # Β· 3 = HARNESS-ERROR (the CLI refused the model; nothing was reviewed)
36
42
  set -uo pipefail
37
43
 
38
44
  OUT="${1:?usage: sidecar_wait.sh <outfile> <timeout_s> -- <cmd...>}"
@@ -118,6 +124,20 @@ done
118
124
 
119
125
  wait "$PID"; rc=$?
120
126
  size=$(wc -c < "$OUT" 2>/dev/null | tr -d ' ')
127
+ # A model the CLI refuses (measured 2026-11-16: codex `-m gpt-5.5` β†’ HTTP 400 Β«not supported when using
128
+ # Codex with a ChatGPT accountΒ», rc 1) is a broken instrument, not a review that found nothing. COMPLETE
129
+ # with that body reads as Β«the reviewer answeredΒ», so it gets its own verdict and a non-zero exit.
130
+ if [ "$rc" -ne 0 ] && grep -qE 'model_not_found|model is not supported|requires a newer version of Codex' "$OUT" 2>/dev/null; then
131
+ echo "SIDECAR_VERDICT=HARNESS-ERROR exit=$rc reason=model-not-available bytes=${size:-0}"
132
+ echo " the sidecar refused the requested model β€” nothing was reviewed. Drop the -m pin (CLI default) or pin a model that answers." >&2
133
+ exit 3
134
+ fi
135
+ # A launch guard that refused (codex_launch_guard.sh / agy_launch_guard.sh) started nothing: same verdict.
136
+ if [ "$rc" -ne 0 ] && grep -qE 'CODEX-REFUSED|AGY-REFUSED' "$OUT" 2>/dev/null; then
137
+ echo "SIDECAR_VERDICT=HARNESS-ERROR exit=$rc reason=guard-refused bytes=${size:-0}"
138
+ echo " a launch guard refused β€” the sidecar was never started, so nothing was reviewed." >&2
139
+ exit 3
140
+ fi
121
141
  if [ "${size:-0}" -eq 0 ]; then
122
142
  echo "SIDECAR_VERDICT=EMPTY exit=$rc"
123
143
  else
@@ -314,7 +314,7 @@ _PYEOF
314
314
 
315
315
  BASE_REF=""; BASE_SHA=""
316
316
  ARM=""; REPS=1; PROMPT=""; MODE="observe"; MODEL="sonnet"; TIMEOUT=900; OUTDIR=""; NOHARNESS=0; SETUP=""; EXTRA=""
317
- TURNS=""; NORESUME=0
317
+ TURNS=""; NORESUME=0; TRACE=0
318
318
  SETSRC=""; SETFILE=""; PERMMODE=""; ADDWRAP=0 # Β§CONSUMER SURFACE β€” never inherited from the env (codex R1)
319
319
  _needval() { [ "$#" -ge 2 ] || { echo "FAIL: $1 needs a value" >&2; exit 2; }; }
320
320
  while [ $# -gt 0 ]; do
@@ -334,6 +334,7 @@ while [ $# -gt 0 ]; do
334
334
  --mcp-config) MCPCFG="${2:-}"; shift 2 ;; # the ONLY MCP servers an arm may see (see MCP ISOLATION). Default: none.
335
335
  --turns) TURNS="${2:-}"; shift 2 ;; # MULTI-TURN: one turn per line. See Β§MULTI-TURN.
336
336
  --no-resume) NORESUME=1; shift ;; # CONTROL arm for --turns:each turn is a fresh session. See Β§MULTI-TURN.
337
+ --trace) TRACE=1; shift ;; # Β§TRACE: keep the event stream (tool calls + init tool list). Single-shot only.
337
338
  --setting-sources) _needval "$@"; SETSRC="$2"; [ -n "$SETSRC" ] || { echo "FAIL: --setting-sources is empty" >&2; exit 2; }; shift 2 ;; # Β§CONSUMER SURFACE β€” e.g. project,local
338
339
  --settings) _needval "$@"; SETFILE="$2"; [ -n "$SETFILE" ] || { echo "FAIL: --settings is empty" >&2; exit 2; }; shift 2 ;; # Β§CONSUMER SURFACE β€” permission file
339
340
  --permission-mode) _needval "$@"; PERMMODE="$2"
@@ -343,6 +344,7 @@ while [ $# -gt 0 ]; do
343
344
  *) echo "unknown flag: $1" >&2; exit 2 ;;
344
345
  esac
345
346
  done
347
+ if [ "$TRACE" -eq 1 ] && [ -n "$TURNS" ]; then echo "FAIL: --trace is single-shot only (refused with --turns, never silently ignored)" >&2; exit 2; fi
346
348
  # ── Β§CONSUMER SURFACE (2026-11-10, AQ-20261110-6) ───────────────────────────────────────────
347
349
  # WHY: the blind harness-birth test (branch claude/blind-birth-test-092883, its fixtures folder
348
350
  # blind_birth_2026-11-10 β€” not on main when this landed) needed an arm that
@@ -685,7 +687,7 @@ for r in $(seq 1 "$REPS"); do
685
687
  # A reused --out must not carry the previous run's budget record into a rep that fails before
686
688
  # writing its own (clone failure `continue`s first) β€” a stale `ended_at_cap=no` would be read as
687
689
  # this run's. Same for the per-turn table the budget line reads.
688
- rm -f "$OUTDIR/${ARM}_r${r}.meta.tsv" "$OUTDIR/${ARM}_r${r}.turns.tsv"
690
+ rm -f "$OUTDIR/${ARM}_r${r}.meta.tsv" "$OUTDIR/${ARM}_r${r}.turns.tsv" "$OUTDIR/${ARM}_r${r}.stream.jsonl" "$OUTDIR/${ARM}_r${r}.tools.txt"
689
691
  # Each clone gets its OWN parent directory. Siblings under one parent are visible to `../`,
690
692
  # and that is not hypothetical: an arm measured 2026-08-29 scanned its parent for mappable
691
693
  # projects and reported finding "iso_A, door_CTRL" β€” the other arms' work dirs. Content stayed
@@ -869,6 +871,19 @@ for r in $(seq 1 "$REPS"); do
869
871
  # adds a path, it does not modify the one every existing probe already runs on.
870
872
  fh_run_turns "$r"
871
873
  rc=$?
874
+ elif [ "$TRACE" -eq 1 ]; then
875
+ # Β§TRACE (2026-11-14, FH-3) β€” same argv plus a stream format, so the scorer can read what the
876
+ # session DID (tool calls) and which tool surface it had (init event). The .txt keeps the shape
877
+ # every scorer already reads. A stream with no result event is rc 3, never an empty answer.
878
+ ( cd "$WORK" && fh_timeout "$TIMEOUT" claude -p "$PROMPT" \
879
+ --model "$MODEL" "${TOOLS[@]}" ${MCPARGS[@]+"${MCPARGS[@]}"} \
880
+ ${SURFREP[@]+"${SURFREP[@]}"} --output-format stream-json --verbose \
881
+ < /dev/null 2>"$OUTDIR/${ARM}_r${r}.stderr.txt" ) > "$OUTDIR/${ARM}_r${r}.stream.jsonl"
882
+ rc=$?
883
+ python3 "$(dirname "$0")/live_eval_trace.py" extract "$OUTDIR/${ARM}_r${r}.stream.jsonl" \
884
+ "$OUTDIR/${ARM}_r${r}.txt" "$OUTDIR/${ARM}_r${r}.tools.txt"
885
+ _xrc=$?
886
+ [ "$rc" -eq 0 ] && [ "$_xrc" -ne 0 ] && rc=3
872
887
  else
873
888
  ( cd "$WORK" && fh_timeout "$TIMEOUT" claude -p "$PROMPT" \
874
889
  --model "$MODEL" "${TOOLS[@]}" ${MCPARGS[@]+"${MCPARGS[@]}"} \
@@ -0,0 +1,227 @@
1
+ #!/usr/bin/env bash
2
+ # test_agy_launch_guard_lanes.sh β€” lanes for scripts/agy_launch_guard.sh and the three FH callers that
3
+ # launch agy (finding_fleet.sh default fleet Β· finding_verifier.sh --family gemini Β· sidecar_calibrate.sh).
4
+ #
5
+ # WHAT IS CHECKED: that no FH caller starts agy unless FH_AGY_ISOLATION is exactly `container` or
6
+ # `os-user`, that a refused launch is visible (AGY-REFUSED on stderr, non-zero), and that with the marker
7
+ # the call goes through with its arguments intact. Every lane uses a FAKE agy that only records that it
8
+ # was started β€” no real agy runs here.
9
+ # WHAT IS NOT CHECKED: whether the isolation the marker names is real. The marker is self-declared;
10
+ # no lane here can see a container or an OS user. Doc snippets (steel-quench / sim-conductor) that show
11
+ # `agy -p` are prose, not scripts, and are outside the static scan in G9.
12
+ #
13
+ # Usage: bash scripts/test_agy_launch_guard_lanes.sh Exit: 0 all pass Β· 1 any fail
14
+ set -uo pipefail
15
+ REPO="$(cd "$(dirname "$0")/.." && pwd)"
16
+ GUARD="$REPO/scripts/agy_launch_guard.sh"
17
+ FLEET="$REPO/scripts/finding_fleet.sh"
18
+ VERIFIER="$REPO/scripts/finding_verifier.sh"
19
+ CAL="$REPO/scripts/sidecar_calibrate.sh"
20
+ D="$(mktemp -d "${TMPDIR:-/tmp}/agyguard.XXXXXX")" || { echo "ENV-BLOCKED: mktemp failed β€” unmeasured, not a pass"; exit 1; }
21
+ trap 'rm -rf "$D"' EXIT
22
+ unset FH_AGY_ISOLATION
23
+ PASS=0; FAIL=0
24
+ ok() { PASS=$((PASS+1)); echo " βœ… $1"; }
25
+ bad() { FAIL=$((FAIL+1)); echo " ❌ $1"; }
26
+
27
+ # Fake agy: records that it started (and its argv, one per line), prints one JSONL finding / one word.
28
+ mkfake() { # $1 = path $2 = sentinel
29
+ cat > "$1" <<EOF
30
+ #!/usr/bin/env bash
31
+ printf '%s\n' "\$@" > "$2"
32
+ cat >/dev/null 2>&1 || true
33
+ echo '{"title":"fake finding","file":"t.py","line":1,"severity":"B","category":"x","detail":"d","defeater":"df","confidence":0.5}'
34
+ EOF
35
+ chmod +x "$1"
36
+ }
37
+ mkfake "$D/agy_fake" "$D/ran"
38
+ # Hermetic floor: a recording `agy` on the underlying PATH. If interception ever breaks, a bare `agy`
39
+ # lands here (recorded in ran_host) instead of on a real CLI. Every lane also asserts it never started.
40
+ mkdir -p "$D/hostbin"; mkfake "$D/hostbin/agy" "$D/ran_host"
41
+ export PATH="$D/hostbin:$PATH"
42
+ printf 'def f():\n return 1\n' > "$D/t.py"
43
+
44
+ echo "── guard alone"
45
+ # G1 no marker β†’ refused, fake never started
46
+ rm -f "$D/ran"
47
+ out=$(bash "$GUARD" "$D/agy_fake" -p "hello" < /dev/null 2>&1); rc=$?
48
+ if [ "$rc" -eq 3 ] && [ ! -e "$D/ran" ] && printf '%s' "$out" | grep -q 'AGY-REFUSED'; then ok "G1 no marker: rc=3, AGY-REFUSED, agy not started"
49
+ else bad "G1 no marker: rc=$rc ran=$([ -e "$D/ran" ] && echo yes || echo no) out=${out:0:120}"; fi
50
+
51
+ # G2 marker=container β†’ started, argv intact (an argument with spaces survives as one)
52
+ rm -f "$D/ran"
53
+ FH_AGY_ISOLATION=container bash "$GUARD" "$D/agy_fake" -p "two words" --mode plan < /dev/null >/dev/null 2>&1; rc=$?
54
+ if [ "$rc" -eq 0 ] && [ -e "$D/ran" ] && [ "$(sed -n 2p "$D/ran")" = "two words" ] && [ "$(wc -l < "$D/ran" | tr -d ' ')" = 4 ]; then
55
+ ok "G2 container: started, argv intact"
56
+ else bad "G2 container: rc=$rc argv=$(tr '\n' '|' < "$D/ran" 2>/dev/null)"; fi
57
+
58
+ # G3 marker=os-user β†’ started
59
+ rm -f "$D/ran"
60
+ FH_AGY_ISOLATION=os-user bash "$GUARD" "$D/agy_fake" -p x < /dev/null >/dev/null 2>&1; rc=$?
61
+ [ "$rc" -eq 0 ] && [ -e "$D/ran" ] && ok "G3 os-user: started" || bad "G3 os-user: rc=$rc"
62
+
63
+ # G4 near-miss values β†’ refused (a truthy word is not an isolation statement)
64
+ for v in 1 yes true Container "container " none ""; do
65
+ rm -f "$D/ran"
66
+ FH_AGY_ISOLATION="$v" bash "$GUARD" "$D/agy_fake" -p x < /dev/null >/dev/null 2>&1; rc=$?
67
+ if [ "$rc" -eq 3 ] && [ ! -e "$D/ran" ]; then ok "G4 value '$v': refused"; else bad "G4 value '$v': rc=$rc started=$([ -e "$D/ran" ] && echo yes || echo no)"; fi
68
+ done
69
+
70
+ # G5 no binary given β†’ usage, nothing started
71
+ bash "$GUARD" < /dev/null >/dev/null 2>&1; rc=$?
72
+ [ "$rc" -eq 2 ] && ok "G5 no args: rc=2" || bad "G5 no args: rc=$rc"
73
+
74
+ # G15 remote-os-user with any other target β†’ refused, target not started
75
+ rm -f "$D/ran"
76
+ FH_AGY_ISOLATION=remote-os-user bash "$GUARD" "$D/agy_fake" -p x < /dev/null >/dev/null 2>&1; rc=$?
77
+ if [ "$rc" -eq 3 ] && [ ! -e "$D/ran" ]; then ok "G15 remote-os-user + other target: refused"; else bad "G15 remote-os-user + other target: rc=$rc started=$([ -e "$D/ran" ] && echo yes || echo no)"; fi
78
+ # G16 remote-os-user with a file NAMED agy_remote_run.sh elsewhere β†’ refused (the path, not the name, is the route)
79
+ mkdir -p "$D/elsewhere"; mkfake "$D/elsewhere/agy_remote_run.sh" "$D/ran"
80
+ rm -f "$D/ran"
81
+ FH_AGY_ISOLATION=remote-os-user bash "$GUARD" "$D/elsewhere/agy_remote_run.sh" -p x < /dev/null >/dev/null 2>&1; rc=$?
82
+ if [ "$rc" -eq 3 ] && [ ! -e "$D/ran" ]; then ok "G16 remote-os-user + same-named file elsewhere: refused"; else bad "G16 same-named file elsewhere: rc=$rc started=$([ -e "$D/ran" ] && echo yes || echo no)"; fi
83
+
84
+ echo "── finding_fleet.sh default fleet (gemini row)"
85
+ cat > "$D/codex_fake" <<'EOF'
86
+ #!/usr/bin/env bash
87
+ cat >/dev/null 2>&1 || true
88
+ echo '{"title":"codex finding","file":"t.py","line":1,"severity":"B","category":"x","detail":"d","defeater":"df","confidence":0.5}'
89
+ EOF
90
+ chmod +x "$D/codex_fake"
91
+ # G6 no marker β†’ gemini member not started and recorded as failed with the refusal; codex still runs
92
+ rm -f "$D/ran"
93
+ FH_CODEX_BIN="$D/codex_fake" FH_AGY_BIN="$D/agy_fake" bash "$FLEET" "$D/t.py" --out "$D/f6" < /dev/null > "$D/f6.out" 2>&1; rc=$?
94
+ if [ ! -e "$D/ran" ] && grep -qs 'AGY-REFUSED' "$D/f6/err_gemini_security.txt" && [ "$rc" -eq 0 ]; then
95
+ ok "G6 fleet no marker: gemini refused (err file), codex member kept rc=0"
96
+ else bad "G6 fleet no marker: rc=$rc agy_started=$([ -e "$D/ran" ] && echo yes || echo no) err=$(head -c 120 "$D/f6/err_gemini_security.txt" 2>/dev/null)"; fi
97
+ # G7 control β€” with the marker the same fleet DOES start the fake (the lane can see a start)
98
+ rm -f "$D/ran"
99
+ FH_AGY_ISOLATION=container FH_CODEX_BIN="$D/codex_fake" FH_AGY_BIN="$D/agy_fake" bash "$FLEET" "$D/t.py" --out "$D/f7" < /dev/null > "$D/f7.out" 2>&1; rc=$?
100
+ [ -e "$D/ran" ] && [ "$rc" -eq 0 ] && ok "G7 fleet with marker: gemini member started (control alive)" || bad "G7 fleet with marker: rc=$rc started=$([ -e "$D/ran" ] && echo yes || echo no)"
101
+
102
+ # G7b round 2 without the marker (reusing G7's round-1 findings) β†’ not started, refusal in the r2 err file
103
+ rm -f "$D/ran"
104
+ FH_CODEX_BIN="$D/codex_fake" FH_AGY_BIN="$D/agy_fake" bash "$FLEET" "$D/t.py" --out "$D/f7b" --reuse-r1 "$D/f7" --round2 < /dev/null > "$D/f7b.out" 2>&1
105
+ if [ ! -e "$D/ran" ] && grep -qs 'AGY-REFUSED' "$D/f7b/err2_gemini_security.txt"; then ok "G7b fleet round 2 no marker: gemini refused"
106
+ else bad "G7b fleet round 2 no marker: started=$([ -e "$D/ran" ] && echo yes || echo no) err=$(head -c 120 "$D/f7b/err2_gemini_security.txt" 2>/dev/null)"; fi
107
+ # G7c control β€” round 2 with the marker starts it
108
+ rm -f "$D/ran"
109
+ FH_AGY_ISOLATION=container FH_CODEX_BIN="$D/codex_fake" FH_AGY_BIN="$D/agy_fake" bash "$FLEET" "$D/t.py" --out "$D/f7c" --reuse-r1 "$D/f7" --round2 < /dev/null > "$D/f7c.out" 2>&1
110
+ [ -e "$D/ran" ] && ok "G7c fleet round 2 with marker: started (control alive)" || bad "G7c fleet round 2 with marker: not started"
111
+ # G7d custom table rows that reach agy by NAME, in shapes a word match misses (redirection glued to the
112
+ # name, behind `env`, AGY_BIN behind `env`) β†’ refused without the marker; G7e same rows with it β†’ started.
113
+ # The real binary is FH_AGY_BIN (the fake); the shim on PATH is what a bare `agy` resolves to.
114
+ n=0
115
+ for row in 'agy -p "$(cat PROMPT_FILE)"' 'agy</dev/null -p hello' 'env agy -p hello' 'env AGY_BIN -p hello'; do
116
+ n=$((n+1)); printf 'gemini|security|%s\n' "$row" > "$D/direct$n.tbl"
117
+ rm -f "$D/ran"
118
+ FH_AGY_BIN="$D/agy_fake" bash "$FLEET" "$D/t.py" --out "$D/f7d$n" --fleet "$D/direct$n.tbl" < /dev/null > "$D/f7d$n.out" 2>&1
119
+ if [ ! -e "$D/ran" ] && grep -qs 'AGY-REFUSED' "$D/f7d$n/err_gemini_security.txt"; then ok "G7d row [$row]: refused without marker"
120
+ else bad "G7d row [$row]: started=$([ -e "$D/ran" ] && echo yes || echo no)"; fi
121
+ rm -f "$D/ran"
122
+ FH_AGY_ISOLATION=os-user FH_AGY_BIN="$D/agy_fake" bash "$FLEET" "$D/t.py" --out "$D/f7e$n" --fleet "$D/direct$n.tbl" < /dev/null > "$D/f7e$n.out" 2>&1
123
+ [ -e "$D/ran" ] && ok "G7e row [$row]: started with marker (control alive)" || bad "G7e row [$row]: not started with marker ($(head -c 100 "$D/f7e$n/err_gemini_security.txt" 2>/dev/null))"
124
+ done
125
+ # G7d-r2 a by-name row in ROUND 2 without the marker β†’ refused (refusal text in the r2 err file);
126
+ # G7e-r2 same with the marker β†’ started. Round-1 findings come from G7's run.
127
+ printf 'gemini|security|%s\n' 'agy -p "$(cat PROMPT_FILE)"' > "$D/direct_r2.tbl"
128
+ # --reuse-r1 takes the fleet from the round-1 dir, so round 1 runs with THIS table (marker on, r1 only)
129
+ FH_AGY_ISOLATION=container FH_AGY_BIN="$D/agy_fake" bash "$FLEET" "$D/t.py" --out "$D/f7r1d" --fleet "$D/direct_r2.tbl" --r1-only < /dev/null > /dev/null 2>&1
130
+ rm -f "$D/ran"
131
+ FH_AGY_BIN="$D/agy_fake" bash "$FLEET" "$D/t.py" --out "$D/f7dr2" --reuse-r1 "$D/f7r1d" --round2 < /dev/null > "$D/f7dr2.out" 2>&1
132
+ if [ ! -e "$D/ran" ] && grep -qs 'AGY-REFUSED' "$D/f7dr2/err2_gemini_security.txt"; then ok "G7d-r2 by-name row in round 2: refused without marker"
133
+ else bad "G7d-r2 by-name row in round 2: started=$([ -e "$D/ran" ] && echo yes || echo no) err=$(head -c 100 "$D/f7dr2/err2_gemini_security.txt" 2>/dev/null)"; fi
134
+ rm -f "$D/ran"
135
+ FH_AGY_ISOLATION=container FH_AGY_BIN="$D/agy_fake" bash "$FLEET" "$D/t.py" --out "$D/f7er2" --reuse-r1 "$D/f7r1d" --round2 < /dev/null > "$D/f7er2.out" 2>&1
136
+ [ -e "$D/ran" ] && ok "G7e-r2 by-name row in round 2 with marker: started (control alive)" || bad "G7e-r2 by-name row in round 2 with marker: not started"
137
+ # G7j an exported shell function named agy does not outrank the shim
138
+ agy() { : > "$D/ran_func"; }; export -f agy
139
+ rm -f "$D/ran" "$D/ran_func"
140
+ FH_AGY_BIN="$D/agy_fake" bash "$FLEET" "$D/t.py" --out "$D/f7j" --fleet "$D/direct1.tbl" < /dev/null > "$D/f7j.out" 2>&1
141
+ unset -f agy
142
+ if [ ! -e "$D/ran_func" ] && [ ! -e "$D/ran" ] && grep -qs 'AGY-REFUSED' "$D/f7j/err_gemini_security.txt"; then ok "G7j exported agy function: shim still wins, refused"
143
+ else bad "G7j exported agy function: func_ran=$([ -e "$D/ran_func" ] && echo yes || echo no)"; fi
144
+ # G14a hermetic floor so far β€” no unmarked lane above reached the underlying-PATH agy (G7k below starts it on purpose)
145
+ [ ! -e "$D/ran_host" ] && ok "G14a underlying-PATH agy not started by G1–G7j" || bad "G14a underlying-PATH agy was started before G7k β€” interception broke"
146
+ # G7k FH_AGY_BIN given as a bare name resolves once (no shim loop) β€” with the marker the PATH agy starts
147
+ rm -f "$D/ran_host"
148
+ FH_AGY_ISOLATION=container FH_CODEX_BIN="$D/codex_fake" FH_AGY_BIN=agy bash "$FLEET" "$D/t.py" --out "$D/f7k" < /dev/null > "$D/f7k.out" 2>&1 &
149
+ kpid=$!; k=0; while kill -0 "$kpid" 2>/dev/null && [ "$k" -lt 30 ]; do sleep 1; k=$((k+1)); done
150
+ if kill -0 "$kpid" 2>/dev/null; then kill "$kpid" 2>/dev/null; bad "G7k bare FH_AGY_BIN: still running after 30s (shim loop)"
151
+ elif [ -e "$D/ran_host" ]; then ok "G7k bare FH_AGY_BIN=agy: resolved to the PATH binary once"
152
+ else bad "G7k bare FH_AGY_BIN=agy: PATH agy never started"; fi
153
+ rm -f "$D/ran_host"
154
+ # G7h over-block control β€” a codex row whose TEXT mentions agy is not refused
155
+ printf 'codex|logic|%s\n' 'CODEX_BIN exec "review agy behavior"' > "$D/text.tbl"
156
+ FH_CODEX_BIN="$D/codex_fake" bash "$FLEET" "$D/t.py" --out "$D/f7i" --fleet "$D/text.tbl" < /dev/null > "$D/f7i.out" 2>&1; rc=$?
157
+ if [ "$rc" -eq 0 ] && ! grep -qs 'AGY-REFUSED' "$D/f7i/err_codex_logic.txt"; then ok "G7h codex row mentioning agy in text: runs (no over-block)"
158
+ else bad "G7h codex row mentioning agy in text: rc=$rc"; fi
159
+ # G7f a row that quotes the token ("AGY_BIN") still names one command (with the marker it starts)
160
+ printf 'gemini|security|%s\n' '"AGY_BIN" -p "$(cat PROMPT_FILE)"' > "$D/quoted.tbl"
161
+ rm -f "$D/ran"
162
+ FH_AGY_ISOLATION=container FH_AGY_BIN="$D/agy_fake" bash "$FLEET" "$D/t.py" --out "$D/f7f" --fleet "$D/quoted.tbl" < /dev/null > "$D/f7f.out" 2>&1
163
+ [ -e "$D/ran" ] && ok "G7f quoted \"AGY_BIN\" row: started with the marker" || bad "G7f quoted \"AGY_BIN\" row: not started ($(head -c 120 "$D/f7f/err_gemini_security.txt" 2>/dev/null))"
164
+ # G7g scripts installed under a directory whose name holds `&` and the text PROMPT_FILE: no marker β†’ refused,
165
+ # marker β†’ started (a pasted path could otherwise background the launch or be rewritten)
166
+ W="$D/a&agy&PROMPT_FILE"; mkdir -p "$W"; cp "$FLEET" "$GUARD" "$W/"
167
+ rm -f "$D/ran"
168
+ FH_CODEX_BIN="$D/codex_fake" FH_AGY_BIN="$D/agy_fake" bash "$W/finding_fleet.sh" "$D/t.py" --out "$D/f7g" < /dev/null > "$D/f7g.out" 2>&1
169
+ g1=$([ -e "$D/ran" ] && echo started || echo not-started)
170
+ rm -f "$D/ran"
171
+ FH_AGY_ISOLATION=container FH_CODEX_BIN="$D/codex_fake" FH_AGY_BIN="$D/agy_fake" bash "$W/finding_fleet.sh" "$D/t.py" --out "$D/f7h" < /dev/null > "$D/f7h.out" 2>&1
172
+ g2=$([ -e "$D/ran" ] && echo started || echo not-started)
173
+ [ "$g1" = not-started ] && [ "$g2" = started ] && ok "G7g odd install path: refused without marker, started with it" || bad "G7g odd install path: without=$g1 with=$g2"
174
+
175
+ echo "── finding_verifier.sh --family gemini"
176
+ 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"
177
+ # G8 no marker β†’ not started, non-zero
178
+ rm -f "$D/ran"
179
+ FH_AGY_BIN="$D/agy_fake" bash "$VERIFIER" --family gemini --target "$D/t.py" < "$D/claims.jsonl" > "$D/v8.out" 2> "$D/v8.err"; rc=$?
180
+ if [ ! -e "$D/ran" ] && [ "$rc" -ne 0 ]; then ok "G8 verifier no marker: agy not started, rc=$rc"
181
+ else bad "G8 verifier no marker: rc=$rc started=$([ -e "$D/ran" ] && echo yes || echo no)"; fi
182
+ # G9 control β€” with the marker the verifier starts it
183
+ rm -f "$D/ran"
184
+ FH_AGY_ISOLATION=container FH_AGY_BIN="$D/agy_fake" bash "$VERIFIER" --family gemini --target "$D/t.py" < "$D/claims.jsonl" >/dev/null 2>&1
185
+ [ -e "$D/ran" ] && ok "G9 verifier with marker: started (control alive)" || bad "G9 verifier with marker: not started"
186
+
187
+ echo "── sidecar_calibrate.sh --only agy"
188
+ mkdir -p "$D/bin"; mkfake "$D/bin/agy" "$D/ran"
189
+ # G10 no marker β†’ the PATH agy is not started; the row is not PINNED/PASS
190
+ rm -f "$D/ran"
191
+ c_out=$(PATH="$D/bin:$PATH" bash "$CAL" --only agy 2>&1 < /dev/null)
192
+ if [ ! -e "$D/ran" ] && printf '%s' "$c_out" | grep -qE '^agy +REFUSED' && ! printf '%s' "$c_out" | grep -qE '^agy +.*REACHABLE'; then ok "G10 calibrate no marker: agy not started, row says REFUSED (not REACHABLE)"
193
+ else bad "G10 calibrate no marker: started=$([ -e "$D/ran" ] && echo yes || echo no) out=$(printf '%s' "$c_out" | grep -m1 '^agy' | cut -c1-120)"; fi
194
+ # G11 control β€” with the marker the probe starts the PATH agy
195
+ rm -f "$D/ran"
196
+ FH_AGY_ISOLATION=container PATH="$D/bin:$PATH" bash "$CAL" --only agy >/dev/null 2>&1 < /dev/null
197
+ [ -e "$D/ran" ] && ok "G11 calibrate with marker: started (control alive)" || bad "G11 calibrate with marker: not started"
198
+
199
+ echo "── static: no shipped script launches agy around the guard"
200
+ # G12 every line in scripts/*.sh (not lanes, not the guard) that starts agy with a prompt/mode flag must
201
+ # go through the guard. Comment lines are skipped. Known residual: a launch built from pieces
202
+ # (variables, eval of a table row other than AGY_BIN) is not seen by a line scan.
203
+ hits=$(cd "$REPO/scripts" && grep -nE '(^|[[:space:]("=])("?\$\{?AGY\}?"?|agy)[[:space:]]+(-p|--print|--prompt|--mode|-i)([[:space:]]|$)' \
204
+ $(ls *.sh | grep -vE '^(test_|agy_launch_guard\.sh$)') 2>/dev/null \
205
+ | grep -vE ':[0-9]+:[[:space:]]*#' | grep -v 'AGY_GUARD' || true)
206
+ if [ -z "$hits" ]; then ok "G12 static scan: no unguarded agy launch in shipped scripts"
207
+ else bad "G12 static scan: unguarded launch(es):"; printf ' %s\n' "$hits"; fi
208
+ # G13 control for G12 β€” the same pattern DOES see an unguarded line
209
+ printf 'out=$(agy -p "$1")\n' > "$D/probe.sh"
210
+ grep -qE '(^|[[:space:]("=])("?\$\{?AGY\}?"?|agy)[[:space:]]+(-p|--print|--prompt|--mode|-i)([[:space:]]|$)' "$D/probe.sh" \
211
+ && ok "G13 static pattern sees a known unguarded line (control alive)" || bad "G13 static pattern blind to a known unguarded line"
212
+
213
+ # G7l exported agy function AND bare FH_AGY_BIN AND marker β€” still resolves to the PATH binary (no loop)
214
+ agy() { : > "$D/ran_func"; }; export -f agy
215
+ rm -f "$D/ran_host" "$D/ran_func"
216
+ FH_AGY_ISOLATION=container FH_CODEX_BIN="$D/codex_fake" FH_AGY_BIN=agy bash "$FLEET" "$D/t.py" --out "$D/f7l" < /dev/null > "$D/f7l.out" 2>&1 &
217
+ kpid=$!; k=0; while kill -0 "$kpid" 2>/dev/null && [ "$k" -lt 30 ]; do sleep 1; k=$((k+1)); done
218
+ unset -f agy
219
+ if kill -0 "$kpid" 2>/dev/null; then kill "$kpid" 2>/dev/null; bad "G7l exported function + bare name: still running after 30s (loop)"
220
+ elif [ -e "$D/ran_host" ] && [ ! -e "$D/ran_func" ]; then ok "G7l exported function + bare name: PATH agy started once, function ignored"
221
+ else bad "G7l exported function + bare name: host=$([ -e "$D/ran_host" ] && echo yes || echo no) func=$([ -e "$D/ran_func" ] && echo yes || echo no)"; fi
222
+ rm -f "$D/ran_host"
223
+ # G14b hermetic floor after G7k β€” the lanes after it (verifier, calibrate, static) did not reach it either
224
+ [ ! -e "$D/ran_host" ] && ok "G14b underlying-PATH agy not started after G7k" || bad "G14b underlying-PATH agy was started after G7k"
225
+ echo
226
+ echo "agy launch guard lanes: $PASS passed, $FAIL failed"
227
+ [ "$FAIL" -eq 0 ]