@chrono-meta/fh-gate 3.21.0 → 3.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +4 -4
- package/CLAUDE.md +62 -281
- package/knowledge/shared/harness-core/checkout_layer_drift.md +11 -0
- package/knowledge/shared/harness-core/claude_md_gate_details.md +343 -0
- package/knowledge/shared/harness-core/dispatch_conditional_prohibition.md +89 -0
- package/knowledge/shared/harness-core/fh_detail_protocols.md +88 -0
- package/knowledge/shared/harness-core/fh_three_layer_canon.md +49 -0
- package/knowledge/shared/harness-core/field_verdict_crossfamily_gate.md +29 -0
- package/knowledge/shared/learnings/subagent_invocations_log.yaml +20 -0
- package/package.json +4 -1
- package/plugins/fh-commons/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-meta/CHANGELOG.md +17 -0
- package/plugins/fh-preprep/.claude-plugin/plugin.json +1 -1
- package/plugins/fh-qp/.claude-plugin/plugin.json +1 -1
- package/scripts/fh_session_load.sh +46 -0
- package/scripts/selfcheck.sh +41 -0
- package/scripts/sidecar_calibrate.sh +168 -13
- package/scripts/test_claude_md_size_lanes.sh +74 -0
- package/scripts/test_fh_audit_check_lanes.sh +140 -0
- package/scripts/test_ollama_panel_lanes.sh +69 -10
- package/scripts/test_session_load_mirror_fp_lanes.sh +122 -0
|
@@ -953,3 +953,32 @@ review, not fed in externally, and a second live demonstration the same day when
|
|
|
953
953
|
standpoint review of this very section caught real residency and citation defects in the first
|
|
954
954
|
draft (fixed in the same commit that added this line).
|
|
955
955
|
|
|
956
|
+
---
|
|
957
|
+
|
|
958
|
+
## §CM-Unmapped-Pilot-Evidence — Unmapped-file trigger — pilot evidence and the cue condition (moved from CLAUDE.md)
|
|
959
|
+
|
|
960
|
+
> Relocated **verbatim** from `CLAUDE.md` (§Field-Harness Load-Bearing Change Gate) on 2026-09-26 — resident-size diet. The resident text kept the rule and a pointer here; this section keeps the why / evidence layer. Nothing was reworded.
|
|
961
|
+
|
|
962
|
+
🟥 **Pilot evidence, below bar, and CUE-DEPENDENT** (floor tier, blind, one
|
|
963
|
+
variable — this paragraph injected): **before 0/1** — *"FH 자산도 매핑된 필드 하네스도 아니라서 …
|
|
964
|
+
적용 대상이 아닙니다"*, reviewed bare; **after 2/3** ran the gate. Both arms' prompt ended with *"네가
|
|
965
|
+
설치된 리뷰 절차가 있으면 그것을 따라라"*. 🟥 **Without that cue the gate fired 0/51** (same day, 17
|
|
966
|
+
unmapped gate-shaped files × 3, same doctrine in the clone, task sentence only). So this paragraph is
|
|
967
|
+
muscle, not skeleton: a session must be *reminded* to run its own procedure, and no hook supplies the
|
|
968
|
+
reminder yet (`fh_signal_2026-09-08_gate-needs-cue.md`). Do not cite 2/3 without the cue condition.
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
---
|
|
972
|
+
|
|
973
|
+
## §CM-Crossfamily-Typing-History — Why `crossfamily:` became typed — the 2026-08-08 marker count (moved from CLAUDE.md)
|
|
974
|
+
|
|
975
|
+
> Relocated **verbatim** from `CLAUDE.md` (§Field-Harness Gate) on 2026-09-26 — resident-size diet. The resident text kept the rule and a pointer here; this section keeps the why / evidence layer. Nothing was reworded.
|
|
976
|
+
|
|
977
|
+
Before 2026-08-08
|
|
978
|
+
this axis was convention-only — measured on this repo, 140 markers carried the tier verdict 129
|
|
979
|
+
times and any decorrelation verdict **4** times.
|
|
980
|
+
|
|
981
|
+
(🟥 the "two blind Sonnet sims graded a cold-read
|
|
982
|
+
`tier2`" citation that stood here is **RETRACTED** — dead instrument, `tool_uses: 0`; the live re-run
|
|
983
|
+
inverted it at reps=1, below bar. The **rule** stands on its own wording, not on that sim)
|
|
984
|
+
|
|
@@ -4416,3 +4416,23 @@
|
|
|
4416
4416
|
팔의 «실제 홈 영향 없음» 보고는 두 번 틀렸다(스크립트 시드 · 원인 모름) — 거버너가 mtime·heal 로그로 직접 대조해야 했다.
|
|
4417
4417
|
같은 체크아웃 팔은 직렬로, 읽기 전용 조사·임시 폴더 실험만 병렬로 — 충돌 0. «앱 설치» 와 «게이트 사본 갱신» 은 다른
|
|
4418
4418
|
사건이었다(설치본이 16:11 옛 판) — 설치 검증은 번들 cmp 가 아니라 **실행 중 훅의 판정** 을 찔러 봐야 했다.
|
|
4419
|
+
|
|
4420
|
+
- date: 2026-09-26
|
|
4421
|
+
session: 16a11bc6 (FH 로컬 거버너 · Opus 5.5 · 이월 과제 전량 → FH 답습 → 로컬 LLM)
|
|
4422
|
+
agent: general-purpose ×13 · Explore ×2
|
|
4423
|
+
task: >-
|
|
4424
|
+
FoD PR 팔 — #127 계획 승인 부스트 · #128 dock 간헐 · #129~#131 이월 시리즈(G31 핀 트리 · 게이트 구멍 · 계획 전문/질문 알림)
|
|
4425
|
+
· #132 칸 이름+설계 이관 · 칸 3 설계 초안 · 2.1.283 가시성 재측정 · FH 답습 조사(Explore) · FH #811 답습 5건 구현
|
|
4426
|
+
· FH #813 sidecar 판정 수리 · 로컬 LLM 어려운 픽스처 실측(234 호출)
|
|
4427
|
+
count: 15
|
|
4428
|
+
outcome: partial
|
|
4429
|
+
evidence: >-
|
|
4430
|
+
PR 10건 머지(FoD #127~#133 · FH #811 · #813) + v3.21.0 발행 · 실측 결과 파일 3. 🟥 partial 인 이유: 재측정 팔이 빈 작업경로(`cd ""`)로
|
|
4431
|
+
이 레포 CLAUDE.md·.claude/settings.json 을 덮어씀(전날 거버너 백업으로 회수, 운영자 /permissions 2줄 유실) · 설계 팔이 원 목록을
|
|
4432
|
+
못 찾아 재구성(거버너 보유분으로 대조) · 이월 팔이 낡은 로컬 main 에서 분기(거버너가 #128 머지 뒤 pull 누락) · 긴 실측 두 팔이
|
|
4433
|
+
중간 알림만 반복하며 오래 대기.
|
|
4434
|
+
learning: >-
|
|
4435
|
+
🟥 같은 계열 팔이 짠 판정 코드에서 codex 가 실제 fail-open 을 네 번 새로 찾았다(#811 중복 설치 CURRENT · #813 비Ollama 200 · 부분 본문).
|
|
4436
|
+
판정 코드는 교차 계열 한 번이 사실상 필수. 격리 규칙을 첫 줄에 넣어도 스크립트 결함(zsh 가 낱말을 안 쪼갬 → 빈 경로)은 못 막는다 —
|
|
4437
|
+
거버너가 팔 결과마다 레포 상태 + gitignored 설정 mtime 을 대조하는 절차가 유일하게 잡았다(→ FH #811 ④-f 로 기계화).
|
|
4438
|
+
머지 직후 로컬 main pull 은 설치 여부와 무관하게 항상.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chrono-meta/fh-gate",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.22.0",
|
|
4
4
|
"description": "FH runtime adapters — run FH governance, skills, and agents via Claude or Codex with machine-parseable gates.",
|
|
5
5
|
"homepage": "https://github.com/chrono-meta/forge-harness#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -175,6 +175,8 @@
|
|
|
175
175
|
"scripts/gate_anchor_check.sh",
|
|
176
176
|
"scripts/gate_pathspec_check.sh",
|
|
177
177
|
"scripts/prless_delta_scan.sh",
|
|
178
|
+
"scripts/test_claude_md_size_lanes.sh",
|
|
179
|
+
"scripts/test_fh_audit_check_lanes.sh",
|
|
178
180
|
"scripts/test_prless_delta_scan_lanes.sh",
|
|
179
181
|
"scripts/gate_bootstrap_ephemeral.sh",
|
|
180
182
|
"scripts/gate_shape_scan.sh",
|
|
@@ -332,6 +334,7 @@
|
|
|
332
334
|
"scripts/test_session_checklist_lanes.sh",
|
|
333
335
|
"scripts/test_session_close_chain_lanes.sh",
|
|
334
336
|
"scripts/test_session_close_lanes.sh",
|
|
337
|
+
"scripts/test_session_load_mirror_fp_lanes.sh",
|
|
335
338
|
"scripts/test_sidecar_calibrate_lanes.sh",
|
|
336
339
|
"scripts/test_sidecar_wait_stdin.sh",
|
|
337
340
|
"scripts/test_sim_isolated_run_lanes.sh",
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# forge-harness (fh-meta) Changelog
|
|
2
2
|
|
|
3
|
+
### [3.22.0] — 2026-09-27 — clone 사용자의 세션 시작 경고·터미널 거짓 알림을 걷고, 사이드카 판정 어휘를 가른다
|
|
4
|
+
|
|
5
|
+
**minor — 새 레인 셋 + 출하 스크립트 동작 변경.** 소비자의 게이트 수용은 안 깬다(막는 쪽으로 바뀐 것 없음).
|
|
6
|
+
|
|
7
|
+
- **CLAUDE.md 150k 경고 수리** — `git clone` 사용자가 v3.16.0 무렵부터 세션마다 보던
|
|
8
|
+
«CLAUDE.md is over the 150.0k-char limit» 를 없앴다(154,149 → 136,889자). 이유층 57블록을 상세 파일 6개로
|
|
9
|
+
**원문 그대로** 옮기고 포인터를 남겼다 — 규칙·트리거·문 리터럴·비가역 게이트 문장은 상주 그대로.
|
|
10
|
+
옛 문장 1,562 중 누락 0 · 보호 리터럴 133 · 격리 클론 플로어 티어 실사용 평가 12/12.
|
|
11
|
+
크기 가드 레인 `scripts/test_claude_md_size_lanes.sh`(145,000자, 문자 단위).
|
|
12
|
+
- **터미널 감사 배너(`templates/fh_audit_check.zsh`) 거짓 경보 수리** — 끌 수 없던 «No harvest history found» ·
|
|
13
|
+
상태 표시 센티널(`_wizard_done` 등)을 90일 감사로 읽던 줄 · 새 설치의 zsh NOMATCH 로 배너 통째 소멸 ·
|
|
14
|
+
호출 셸 KSH_ARRAYS 누출. 진짜 밀린 주간감사·frontier·Area B·커스텀 센티널은 그대로 뜬다. 레인 27/0.
|
|
15
|
+
- **세션 시작 «카드보다 새 파일» 미러 오탐 수리**(`scripts/fh_session_load.sh`) — 싱크가 mtime 만 새로 찍은
|
|
16
|
+
미러 사본(허브 원본과 바이트 동일 · 카드 이전 커밋 · 깨끗한 트리)은 목록에서 빼고 이름만 한 줄로. 레인 14/0.
|
|
17
|
+
- **`scripts/sidecar_calibrate.sh` 판정 어휘** — «모델 없음» 을 «도달 불가» 로 말하지 않고, 가짜 호스트·끊긴 전송이
|
|
18
|
+
패널에 못 든다.
|
|
19
|
+
|
|
3
20
|
### [3.21.0] — 2026-09-26 — 마감 게이트가 옛 훅과 세션 중 설정 덮어쓰기를 이름으로 말한다
|
|
4
21
|
|
|
5
22
|
**minor — 새 출하 스크립트 둘 + 마감 체인 동작 변경.** 소비자의 게이트 수용은 안 깬다
|
|
@@ -468,7 +468,42 @@ CARD_EPOCH=0
|
|
|
468
468
|
# ★ "$TM" (not the literal "tracks-meta") — paper-signals/handoff/digests are FH-exclusive areas
|
|
469
469
|
# sync-to-be.sh never namespaces (it does not write them for any hub), only tracks-meta needs the
|
|
470
470
|
# suffix here (pmh-dev#68 PR #368 review).
|
|
471
|
+
#
|
|
472
|
+
# 🟥 Mirror-copy false positive (fixed 2026-09-26): `sync-to-be.sh` REWRITES every tracks/_meta
|
|
473
|
+
# mirror it touches, so a mirror's mtime is «when the sync last ran», not «when its content was
|
|
474
|
+
# new». Measured: two result files the card had already absorbed were listed as NEWER because a
|
|
475
|
+
# 22:28 sync restamped them — git had last committed them the day BEFORE the card, and the hub
|
|
476
|
+
# copies carried the same 22:28 stamp, so no mtime anywhere could tell. A `$TM` mirror is DEMOTED
|
|
477
|
+
# (to a one-line note that names it — never silently dropped) only when ALL of these hold:
|
|
478
|
+
# ① line 1 is EXACTLY the sync banner (not a substring — a file merely mentioning it stays listed)
|
|
479
|
+
# ② the rest is byte-identical to the hub's canonical `tracks/_meta/<same path>` (cmp rc 0 only;
|
|
480
|
+
# differ = 1 and error = 2 both stay listed)
|
|
481
|
+
# ③ the companion git records that content as committed AT OR BEFORE the card, and the file is
|
|
482
|
+
# clean in the companion tree. Identity alone is not enough (cross-family [high], codex
|
|
483
|
+
# 2026-09-26): a result written to the hub TODAY and synced is identical too, yet the card has
|
|
484
|
+
# never seen it — its first commit lands after the card, so ③ keeps it listed.
|
|
485
|
+
# git unavailable / no commit found / dirty → NOT demoted, and the git-unavailable case says so.
|
|
486
|
+
# Named residual: content another machine committed before this card was written, pulled later and
|
|
487
|
+
# copied into the hub by sync-from-be, satisfies ①②③ while still unseen here. Narrow (needs the
|
|
488
|
+
# reverse sync to have run) and the note still names the file.
|
|
489
|
+
_MIRROR_BANNER="<!-- MIRROR COPY — synced from the ${HUB_NAME:-forge-harness} hub. Do NOT edit here; the next sync overwrites it. Edit the canonical file under the hub instead. -->"
|
|
490
|
+
MIRROR_GIT_UNAVAIL=""
|
|
491
|
+
command -v git >/dev/null 2>&1 || MIRROR_GIT_UNAVAIL=1
|
|
492
|
+
_is_absorbed_mirror() { # $1 = companion file, $2 = hub canonical path → 0 only when ①②③ all hold
|
|
493
|
+
case "$1" in *.md) ;; *) return 1 ;; esac
|
|
494
|
+
[ -f "$2" ] || return 1
|
|
495
|
+
[ "$(head -1 "$1" 2>/dev/null)" = "$_MIRROR_BANNER" ] || return 1
|
|
496
|
+
tail -n +2 "$1" 2>/dev/null | cmp -s - "$2" || return 1
|
|
497
|
+
[ -z "$MIRROR_GIT_UNAVAIL" ] || return 1
|
|
498
|
+
local rel="${1#$BE/}" ct st
|
|
499
|
+
ct="$(git -C "$BE" log -1 --format=%ct -- "$rel" 2>/dev/null)" || return 1
|
|
500
|
+
case "$ct" in ''|*[!0-9]*) return 1 ;; esac
|
|
501
|
+
[ "$ct" -le "${CARD_EPOCH:-0}" ] || return 1
|
|
502
|
+
st="$(git -C "$BE" status --porcelain -- "$rel" 2>/dev/null)" || return 1
|
|
503
|
+
[ -z "$st" ]
|
|
504
|
+
}
|
|
471
505
|
NEWER=""
|
|
506
|
+
MIRROR_REFRESH=""; MIRROR_REFRESH_N=0
|
|
472
507
|
for sub in paper-signals handoff "$TM" digests; do
|
|
473
508
|
d="$BE/$sub"
|
|
474
509
|
[ -d "$d" ] || continue
|
|
@@ -476,6 +511,10 @@ for sub in paper-signals handoff "$TM" digests; do
|
|
|
476
511
|
[ -n "$f" ] || continue
|
|
477
512
|
fe="$(_mtime "$f")"
|
|
478
513
|
if [ "${fe:-0}" -gt "${CARD_EPOCH:-0}" ]; then
|
|
514
|
+
if [ "$sub" = "$TM" ] && _is_absorbed_mirror "$f" "$FH/tracks/_meta/${f#$d/}"; then
|
|
515
|
+
MIRROR_REFRESH="${MIRROR_REFRESH} ${f#$d/}"; MIRROR_REFRESH_N=$((MIRROR_REFRESH_N + 1))
|
|
516
|
+
continue
|
|
517
|
+
fi
|
|
479
518
|
NEWER="${NEWER} - ${f#$BE/}\n"
|
|
480
519
|
fi
|
|
481
520
|
done <<EOF
|
|
@@ -566,6 +605,13 @@ fi
|
|
|
566
605
|
echo " (no companion files newer than the session card)"
|
|
567
606
|
fi
|
|
568
607
|
fi
|
|
608
|
+
if [ "$MIRROR_REFRESH_N" -gt 0 ]; then
|
|
609
|
+
echo " ⓘ ${MIRROR_REFRESH_N} mirror cop(y/ies) newer than the card by mtime only — byte-identical to the hub's"
|
|
610
|
+
echo " tracks/_meta copy and committed before the card (sync restamped them):${MIRROR_REFRESH}"
|
|
611
|
+
fi
|
|
612
|
+
if [ -n "$MIRROR_GIT_UNAVAIL" ]; then
|
|
613
|
+
echo " ⚠️ git unavailable — mirror-copy demotion is OFF; sync-restamped mirrors are listed above by mtime."
|
|
614
|
+
fi
|
|
569
615
|
if [ -n "$STATUS_MAP" ]; then
|
|
570
616
|
echo "── handoff/signal STATUS map (mtime-independent — closed items) ──"
|
|
571
617
|
printf "%b" "$STATUS_MAP"
|
package/scripts/selfcheck.sh
CHANGED
|
@@ -451,6 +451,47 @@ else
|
|
|
451
451
|
fail=1
|
|
452
452
|
fi
|
|
453
453
|
|
|
454
|
+
# session-load mirror FP — fh_session_load.sh listed sync-restamped mirror copies (byte-identical to
|
|
455
|
+
# the hub canonical) as «NEWER THAN SESSION CARD». Lane = FP stays quiet + every not-provably-same
|
|
456
|
+
# case (genuine · differs · no hub copy · lookalike banner · outside $TM) still listed.
|
|
457
|
+
if [ ! -f scripts/fh_session_load.sh ]; then
|
|
458
|
+
_absent_subject_verdict "session-load mirror FP lanes" "scripts/fh_session_load.sh" || fail=1
|
|
459
|
+
elif [ -f scripts/test_session_load_mirror_fp_lanes.sh ]; then
|
|
460
|
+
if ! bash scripts/test_session_load_mirror_fp_lanes.sh; then
|
|
461
|
+
fail=1
|
|
462
|
+
fi
|
|
463
|
+
else
|
|
464
|
+
echo "FAIL session-load mirror FP lanes: fh_session_load.sh present but its anchor is missing"
|
|
465
|
+
fail=1
|
|
466
|
+
fi
|
|
467
|
+
|
|
468
|
+
# CLAUDE.md size guard — Claude Code warns «CLAUDE.md is over the 150.0k-char limit» on every session
|
|
469
|
+
# start of a clone (measured 2026-09-26: 154,149 chars since ~v3.16.0). Guard at 145k (headroom ~1k/week).
|
|
470
|
+
if [ ! -f CLAUDE.md ]; then
|
|
471
|
+
_absent_subject_verdict "claude-md size lanes" "CLAUDE.md" || fail=1
|
|
472
|
+
elif [ -f scripts/test_claude_md_size_lanes.sh ]; then
|
|
473
|
+
if ! bash scripts/test_claude_md_size_lanes.sh; then
|
|
474
|
+
fail=1
|
|
475
|
+
fi
|
|
476
|
+
else
|
|
477
|
+
echo "FAIL claude-md size lanes: CLAUDE.md present but its anchor is missing"
|
|
478
|
+
fail=1
|
|
479
|
+
fi
|
|
480
|
+
|
|
481
|
+
# terminal audit banner — templates/fh_audit_check.zsh (sourced from every user's ~/.zshrc by install-wizard)
|
|
482
|
+
# fired 2 false lines forever (harvest glob nothing writes · state-marker sentinels aged as audits) and
|
|
483
|
+
# aborted whole on zsh NOMATCH for a fresh install. Lane = false lines gone · real overdue audits still warn.
|
|
484
|
+
if [ ! -f templates/fh_audit_check.zsh ]; then
|
|
485
|
+
_absent_subject_verdict "audit banner lanes" "templates/fh_audit_check.zsh" || fail=1
|
|
486
|
+
elif [ -f scripts/test_fh_audit_check_lanes.sh ]; then
|
|
487
|
+
if ! bash scripts/test_fh_audit_check_lanes.sh; then
|
|
488
|
+
fail=1
|
|
489
|
+
fi
|
|
490
|
+
else
|
|
491
|
+
echo "FAIL audit banner lanes: fh_audit_check.zsh present but its anchor is missing"
|
|
492
|
+
fail=1
|
|
493
|
+
fi
|
|
494
|
+
|
|
454
495
|
# typed-finding pipeline — fleet (multi-family, parallel) + reject stage (cross-family verdict, code
|
|
455
496
|
# drops false positives). Subject = scripts/finding_fleet.sh + scripts/finding_verify.py.
|
|
456
497
|
if [ ! -f scripts/finding_verify.py ]; then
|
|
@@ -268,19 +268,138 @@ OLLAMA_HOST_URL="${FH_OLLAMA_HOST:-http://127.0.0.1:11434}"
|
|
|
268
268
|
# carry a verdict". At 512 the same model answered `PASS`. Budget starvation and incapacity are
|
|
269
269
|
# different findings and must not be reported as one.
|
|
270
270
|
OLLAMA_NUM_PREDICT="${FH_OLLAMA_NUM_PREDICT:-512}"
|
|
271
|
+
# Per-model generate deadline (seconds). Overridable so the lanes can drive a mid-body stall without
|
|
272
|
+
# waiting four minutes; the default is unchanged.
|
|
273
|
+
OLLAMA_GEN_TIMEOUT="${FH_OLLAMA_GEN_TIMEOUT:-240}"
|
|
274
|
+
|
|
275
|
+
# _http <max-secs> <url> [json-body] — one request, and it KEEPS THE STATUS CODE.
|
|
276
|
+
# Sets HTTP_CODE (000 when no HTTP answer came back at all), HTTP_BODY, HTTP_RC (curl's own rc).
|
|
277
|
+
#
|
|
278
|
+
# 🟥 WHY NOT `curl -sf` (2026-09-24, Glimmer G1): `-f` throws the body away on ANY 4xx/5xx and prints
|
|
279
|
+
# nothing, so «the node answered "invalid model name"» and «no node answered» both reached the
|
|
280
|
+
# caller as the same empty string — and the empty string was rendered UNREACHABLE-THIS-RUN with
|
|
281
|
+
# «(measured, not inferred)» after it. What had been measured was the empty string, not reachability.
|
|
282
|
+
# Those two point the operator in opposite directions (network vs. name/inventory), so they must
|
|
283
|
+
# never share a label. Body and code travel together through one capture; the code is split off
|
|
284
|
+
# the LAST line — no pipe, so no rc is dropped on the way (pipefail class lock).
|
|
285
|
+
_http() {
|
|
286
|
+
local secs="$1" url="$2" data="${3:-}" raw
|
|
287
|
+
if [ -n "$data" ]; then
|
|
288
|
+
raw="$(curl -s --max-time "$secs" -w '\n%{http_code}' "$url" -d "$data" 2>/dev/null)"; HTTP_RC=$?
|
|
289
|
+
else
|
|
290
|
+
raw="$(curl -s --max-time "$secs" -w '\n%{http_code}' "$url" 2>/dev/null)"; HTTP_RC=$?
|
|
291
|
+
fi
|
|
292
|
+
HTTP_CODE="${raw##*$'\n'}"
|
|
293
|
+
case "$raw" in *$'\n'*) HTTP_BODY="${raw%$'\n'*}" ;; *) HTTP_BODY="" ;; esac
|
|
294
|
+
case "$HTTP_CODE" in [0-9][0-9][0-9]) : ;; *) HTTP_CODE="000" ;; esac
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
# _http_why — human reason for HTTP_CODE=000, from curl's rc. Only the common three are named; any
|
|
298
|
+
# other rc is printed as a number rather than guessed at.
|
|
299
|
+
_http_why() {
|
|
300
|
+
case "$HTTP_RC" in
|
|
301
|
+
7) echo "connection refused" ;;
|
|
302
|
+
28) echo "timed out" ;;
|
|
303
|
+
52) echo "empty reply — connection closed without an HTTP answer" ;;
|
|
304
|
+
6) echo "host not resolved" ;;
|
|
305
|
+
*) echo "curl rc=$HTTP_RC" ;;
|
|
306
|
+
esac
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
# _err_summary — the server's own words for a non-200: the JSON `error` field when there is one,
|
|
310
|
+
# else the first 80 chars of the raw body. One line, no parentheses (they close the label).
|
|
311
|
+
_err_summary() {
|
|
312
|
+
local s
|
|
313
|
+
s="$(printf '%s' "$HTTP_BODY" | python3 -c 'import json,sys
|
|
314
|
+
try: d=json.load(sys.stdin); e=d.get("error","") if isinstance(d,dict) else ""
|
|
315
|
+
except Exception: e=""
|
|
316
|
+
print(e if isinstance(e,str) else json.dumps(e))' 2>/dev/null)"
|
|
317
|
+
[ -n "$s" ] || s="$HTTP_BODY"
|
|
318
|
+
s="$(printf '%s' "$s" | tr '\r\n()' ' []' | cut -c1-80)"
|
|
319
|
+
[ -n "$s" ] || s="empty body"
|
|
320
|
+
printf '%s' "$s"
|
|
321
|
+
}
|
|
271
322
|
|
|
272
323
|
probe_ollama() {
|
|
273
324
|
command -v curl >/dev/null 2>&1 || { echo "ollama ABSENT — curl missing (absence measured)"; return 0; }
|
|
274
|
-
|
|
275
|
-
|
|
325
|
+
_http 10 "$OLLAMA_HOST_URL/api/version"
|
|
326
|
+
if [ "$HTTP_CODE" = "000" ]; then
|
|
327
|
+
printf 'ollama ABSENT — no server at the configured host (%s; absence measured, not assumed)\n' "$(_http_why)"
|
|
276
328
|
printf ' set FH_OLLAMA_HOST to probe a remote node; default is loopback\n'
|
|
277
329
|
return 0
|
|
278
|
-
|
|
330
|
+
fi
|
|
331
|
+
if [ "$HTTP_RC" -ne 0 ]; then
|
|
332
|
+
# An answer started (http code present) but did not finish — nothing about the host was measured.
|
|
333
|
+
printf 'ollama UNMEASURED — /api/version answered http %s but the transfer did not complete (%s)\n' "$HTTP_CODE" "$(_http_why)"
|
|
334
|
+
return 0
|
|
335
|
+
fi
|
|
336
|
+
if [ "$HTTP_CODE" != "200" ]; then
|
|
337
|
+
# Something IS listening — it just is not answering as an Ollama server. Not ABSENT.
|
|
338
|
+
printf 'ollama HOST-ERROR — something answered at the configured host, but /api/version returned http %s: %s\n' \
|
|
339
|
+
"$HTTP_CODE" "$(_err_summary)"
|
|
340
|
+
printf ' a server was reached, so this is not absence; check that FH_OLLAMA_HOST points at Ollama\n'
|
|
341
|
+
return 0
|
|
342
|
+
fi
|
|
343
|
+
# 🟥 «Any 200» is not «an Ollama server» (cross-family review, 2026-09-26). A host that answers
|
|
344
|
+
# 200 to everything and echoes the pinned name back in a generate envelope would otherwise reach
|
|
345
|
+
# PIN-OK(envelope) and JOIN THE PANEL — the envelope anchor is only a server-side fact if the
|
|
346
|
+
# server is the one we think it is. Require the Ollama shape: a JSON object with a string
|
|
347
|
+
# `version`. Anything else is HOST-ERROR and the leg stops.
|
|
348
|
+
if ! printf '%s' "$HTTP_BODY" | python3 -c 'import json,sys
|
|
349
|
+
d=json.load(sys.stdin)
|
|
350
|
+
raise SystemExit(0 if isinstance(d,dict) and isinstance(d.get("version"),str) and d["version"] else 1)' >/dev/null 2>&1; then
|
|
351
|
+
printf 'ollama HOST-ERROR — /api/version returned http 200 but not the Ollama shape {"version": "..."}: %s\n' "$(_err_summary)"
|
|
352
|
+
printf ' something answered, but it is not recognisably Ollama — nothing from this host enters the panel\n'
|
|
353
|
+
return 0
|
|
354
|
+
fi
|
|
279
355
|
|
|
356
|
+
# ── FH_OLLAMA_MODELS: comma-separated. Whitespace around an item is trimmed; whitespace INSIDE an
|
|
357
|
+
# item is REJECTED, not normalised. Chosen deliberately (2026-09-24 G1):
|
|
358
|
+
# · Ollama model names cannot contain whitespace, so an inner space means the caller used a
|
|
359
|
+
# different separator contract. Normalising would mean the calibrator GUESSING the input it
|
|
360
|
+
# was given — and a marker quotes this run's output, so "a b" and "a,b" would become
|
|
361
|
+
# indistinguishable in the record, hiding the contract drift that caused the incident.
|
|
362
|
+
# · Trimming "a, b" is not a guess — the commas are there, only padding is removed.
|
|
363
|
+
# · The cost of rejecting is one loud, cheap rephrase (the message prints the corrected value);
|
|
364
|
+
# the cost of guessing is silent. Exit stays 0 — detector, not gate.
|
|
280
365
|
local models="${FH_OLLAMA_MODELS:-}"
|
|
281
|
-
if [ -
|
|
282
|
-
|
|
283
|
-
|
|
366
|
+
if [ -n "$models" ]; then
|
|
367
|
+
local cleaned="" item bad="" IFS=,
|
|
368
|
+
for item in $models; do
|
|
369
|
+
item="$(printf '%s' "$item" | sed -E 's/^[[:space:]]+//; s/[[:space:]]+$//')"
|
|
370
|
+
[ -n "$item" ] || continue
|
|
371
|
+
case "$item" in *[[:space:]]*) bad="$item" ;; esac
|
|
372
|
+
cleaned="${cleaned:+$cleaned,}$item"
|
|
373
|
+
done
|
|
374
|
+
if [ -z "$cleaned" ]; then
|
|
375
|
+
# Explicitly set, but nothing survives trimming. Falling through to /api/tags would probe
|
|
376
|
+
# models the caller never named; staying silent would read as "no models".
|
|
377
|
+
printf 'ollama INPUT-ERROR — FH_OLLAMA_MODELS is set but has no model names after trimming: "%s"\n' "$models"
|
|
378
|
+
printf ' unset it to probe the listed models, or give a comma-separated list. Nothing was probed.\n'
|
|
379
|
+
return 0
|
|
380
|
+
fi
|
|
381
|
+
if [ -n "$bad" ]; then
|
|
382
|
+
printf 'ollama INPUT-ERROR — FH_OLLAMA_MODELS item contains whitespace: "%s"\n' "$bad"
|
|
383
|
+
printf ' the separator is a COMMA; model names cannot contain spaces. Nothing was probed.\n'
|
|
384
|
+
printf ' did you mean: FH_OLLAMA_MODELS="%s"\n' "$(printf '%s' "$cleaned" | tr -s '[:space:]' ',')"
|
|
385
|
+
return 0
|
|
386
|
+
fi
|
|
387
|
+
models="$cleaned"
|
|
388
|
+
else
|
|
389
|
+
_http 15 "$OLLAMA_HOST_URL/api/tags"
|
|
390
|
+
if [ "$HTTP_CODE" != "200" ] || [ "$HTTP_RC" -ne 0 ]; then
|
|
391
|
+
# A failed listing is not an empty listing. And a tags call that got no HTTP answer did not
|
|
392
|
+
# measure reachability either — say only what was measured.
|
|
393
|
+
if [ "$HTTP_CODE" = "000" ]; then
|
|
394
|
+
printf 'ollama model list UNMEASURED (tags call got no HTTP answer: %s) — not empty\n' "$(_http_why)"
|
|
395
|
+
elif [ "$HTTP_RC" -ne 0 ]; then
|
|
396
|
+
printf 'ollama model list UNMEASURED (tags call answered http %s but did not complete: %s) — not empty\n' "$HTTP_CODE" "$(_http_why)"
|
|
397
|
+
else
|
|
398
|
+
printf 'ollama REACHABLE but /api/tags returned http %s: %s — model list UNMEASURED, not empty\n' "$HTTP_CODE" "$(_err_summary)"
|
|
399
|
+
fi
|
|
400
|
+
return 0
|
|
401
|
+
fi
|
|
402
|
+
models=$(printf '%s' "$HTTP_BODY" | python3 -c 'import json,sys
|
|
284
403
|
try: d=json.load(sys.stdin)
|
|
285
404
|
except Exception: raise SystemExit
|
|
286
405
|
print(",".join(m["name"] for m in d.get("models",[])[:6]))' 2>/dev/null)
|
|
@@ -289,10 +408,21 @@ print(",".join(m["name"] for m in d.get("models",[])[:6]))' 2>/dev/null)
|
|
|
289
408
|
|
|
290
409
|
# Control runs ONCE per host, not per model: it is a property of the server, and repeating it per
|
|
291
410
|
# model would just multiply the cost of a fact that cannot differ.
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
411
|
+
# 🟥 A control that got NO answer is unmeasured — it was previously read as "accepts-bogus"
|
|
412
|
+
# because an empty body contains no "error". Silence is not acceptance.
|
|
413
|
+
local ctl_state
|
|
414
|
+
_http 20 "$OLLAMA_HOST_URL/api/generate" '{"model":"fh-calib-nonexistent:99b","prompt":"hi","stream":false}'
|
|
415
|
+
# 🟥 Only a 4xx is evidence of rejection. A 5xx is the server FAILING, which says nothing about
|
|
416
|
+
# whether it would have validated the name; 000 and an incomplete transfer measured nothing.
|
|
417
|
+
# All three are `unmeasured` (cross-family review, 2026-09-26: 5xx was read as rejects-bogus).
|
|
418
|
+
case "$HTTP_CODE" in
|
|
419
|
+
4[0-9][0-9]) ctl_state="rejects-bogus" ;;
|
|
420
|
+
200)
|
|
421
|
+
if printf '%s' "$HTTP_BODY" | grep -qiE '"error"|not found'; then ctl_state="rejects-bogus"
|
|
422
|
+
else ctl_state="accepts-bogus"; fi ;;
|
|
423
|
+
*) ctl_state="unmeasured" ;;
|
|
424
|
+
esac
|
|
425
|
+
[ "$HTTP_RC" -ne 0 ] && ctl_state="unmeasured"
|
|
296
426
|
|
|
297
427
|
local IFS=,
|
|
298
428
|
for m in $models; do
|
|
@@ -305,10 +435,35 @@ print(",".join(m["name"] for m in d.get("models",[])[:6]))' 2>/dev/null)
|
|
|
305
435
|
local body out env_model resp compact pin v
|
|
306
436
|
body=$(python3 -c 'import json,sys; print(json.dumps({"model":sys.argv[1],"prompt":sys.argv[2],"stream":False,"options":{"num_predict":int(sys.argv[3]),"temperature":0}}))' \
|
|
307
437
|
"$m" "$VERDICT_PROMPT" "$OLLAMA_NUM_PREDICT")
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
438
|
+
_http "$OLLAMA_GEN_TIMEOUT" "$OLLAMA_HOST_URL/api/generate" "$body"
|
|
439
|
+
# 🟥 A status line is not a completed answer. If curl failed AFTER the headers (timeout mid-body,
|
|
440
|
+
# connection reset), HTTP_CODE can read 200 while HTTP_BODY is whatever arrived — possibly a
|
|
441
|
+
# complete-looking JSON that would parse to PIN-OK and join the panel. rc≠0 wins over the code.
|
|
442
|
+
if [ "$HTTP_RC" -ne 0 ] && [ "$HTTP_CODE" != "000" ]; then
|
|
443
|
+
printf 'ollama %-22s UNMEASURED-THIS-RUN (http %s but the transfer did not complete: %s) — not in the panel\n' "$m" "$HTTP_CODE" "$(_http_why)"
|
|
444
|
+
continue
|
|
311
445
|
fi
|
|
446
|
+
# Three different events, three different labels — never collapse them again:
|
|
447
|
+
# 000 → no HTTP answer at all → UNREACHABLE-THIS-RUN (this one IS about the network)
|
|
448
|
+
# 4xx → the server answered and refused → MODEL-ERROR(<its words>) — name / inventory problem
|
|
449
|
+
# 5xx → the server answered and failed → SERVER-ERROR(<its words>) — load / OOM / runtime
|
|
450
|
+
# None of them joins the panel, and none of them is PIN-OK or UNTRUSTED-PIN: nothing was served.
|
|
451
|
+
case "$HTTP_CODE" in
|
|
452
|
+
000)
|
|
453
|
+
printf 'ollama %-22s UNREACHABLE-THIS-RUN (%s — no HTTP answer to the generate call)\n' "$m" "$(_http_why)"
|
|
454
|
+
continue ;;
|
|
455
|
+
4[0-9][0-9])
|
|
456
|
+
printf 'ollama %-22s MODEL-ERROR(%s) · control: %s\n' "$m" "$(_err_summary)" "$ctl_state"
|
|
457
|
+
printf ' the server WAS reached and answered http %s — check the model name and this node'"'"'s\n' "$HTTP_CODE"
|
|
458
|
+
printf ' inventory, not the network. Not in the panel: no model was served.\n'
|
|
459
|
+
continue ;;
|
|
460
|
+
200) : ;;
|
|
461
|
+
*)
|
|
462
|
+
printf 'ollama %-22s SERVER-ERROR(http %s: %s) · control: %s\n' "$m" "$HTTP_CODE" "$(_err_summary)" "$ctl_state"
|
|
463
|
+
printf ' the server WAS reached but failed to serve (load / memory / runtime). Not in the panel.\n'
|
|
464
|
+
continue ;;
|
|
465
|
+
esac
|
|
466
|
+
out="$HTTP_BODY"
|
|
312
467
|
env_model=$(printf '%s' "$out" | python3 -c 'import json,sys; print(json.load(sys.stdin).get("model",""))' 2>/dev/null)
|
|
313
468
|
resp=$(printf '%s' "$out" | python3 -c 'import json,sys; print((json.load(sys.stdin).get("response") or "").strip())' 2>/dev/null)
|
|
314
469
|
compact=$(printf '%s' "$resp" | tr -s '[:space:]' ' ' | sed 's/^ *//; s/ *$//')
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# test_claude_md_size_lanes.sh — CLAUDE.md 크기 가드 (2026-09-26 신설).
|
|
3
|
+
#
|
|
4
|
+
# 왜: Claude Code 는 세션 시작 시 CLAUDE.md 가 150.0k **문자**를 넘으면
|
|
5
|
+
# `⚠ CLAUDE.md is over the 150.0k-char limit` 경고를 띄운다. 허브 CLAUDE.md 는 tracked·출하 파일이라
|
|
6
|
+
# README 주 경로(git clone)로 들어온 모든 사용자가 그 경고를 본다(v3.16.0~v3.21.0 실측: 150,733 → 154,149).
|
|
7
|
+
# 파일은 주당 ~1k 씩 자라므로, 경고가 뜨기 **전에** 이 레인이 빨개지도록 한계를 145,000 으로 둔다.
|
|
8
|
+
# 무엇을 세나: Python `len()` 을 UTF-8 디코드한 텍스트에 건다 = **문자 수**(바이트 아님). CC 경고가 문자를
|
|
9
|
+
# 세므로 같은 단위다. `wc -c` 는 바이트라 한글 한 글자를 3 으로 세어 과차단한다(L4 가 그 차이를 박는다).
|
|
10
|
+
# 처방: 빨개지면 지우지 말고 **옮겨라** — 근거·실측·철회 경위를 detail 파일로 verbatim 이관하고 상주에는
|
|
11
|
+
# 규칙 + 포인터만 남긴다(선례: tracks/_meta/claude_md_diet_2026-09-26/ 의 diet.py·verify.py).
|
|
12
|
+
set -uo pipefail
|
|
13
|
+
HERE="$(cd "$(dirname "$0")" && pwd)"; ROOT="$(cd "$HERE/.." && pwd)"
|
|
14
|
+
LIMIT=145000
|
|
15
|
+
PASS=0; FAIL=0
|
|
16
|
+
ok(){ PASS=$((PASS+1)); printf ' ✅ %s\n' "$1"; }
|
|
17
|
+
no(){ FAIL=$((FAIL+1)); printf ' ❌ %s — %s\n' "$1" "${2:-}"; }
|
|
18
|
+
|
|
19
|
+
# size_check <file> <limit> → prints the char count; rc 0 = within, 1 = over, 2 = cannot measure.
|
|
20
|
+
size_check() {
|
|
21
|
+
python3 - "$1" "$2" <<'PY'
|
|
22
|
+
import sys
|
|
23
|
+
path, limit = sys.argv[1], int(sys.argv[2])
|
|
24
|
+
try:
|
|
25
|
+
n = len(open(path, encoding="utf-8").read())
|
|
26
|
+
except (OSError, UnicodeDecodeError) as e:
|
|
27
|
+
print(f"UNMEASURED: {e}"); sys.exit(2)
|
|
28
|
+
print(n); sys.exit(0 if n <= limit else 1)
|
|
29
|
+
PY
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
echo "── test_claude_md_size_lanes (limit ${LIMIT} chars) ──"
|
|
33
|
+
command -v python3 >/dev/null 2>&1 || { no "L0 환경" "python3 없음 — 레인 미측정(통과 아님)"; echo "PASS=$PASS FAIL=$FAIL"; echo "FAILED=1"; exit 1; }
|
|
34
|
+
D="$(mktemp -d 2>/dev/null)" || D=""
|
|
35
|
+
[ -n "$D" ] && [ -w "$D" ] || { no "L0 환경" "mktemp -d 불가 — 레인 미측정(통과 아님)"; echo "PASS=$PASS FAIL=$FAIL"; echo "FAILED=1"; exit 1; }
|
|
36
|
+
trap 'rm -rf "$D"' EXIT
|
|
37
|
+
|
|
38
|
+
# L2 known-positive: 150k ASCII chars (the CC warning line) must FAIL.
|
|
39
|
+
python3 -c 'import sys; open(sys.argv[1],"w",encoding="utf-8").write("a"*150000)' "$D/big.md"
|
|
40
|
+
OUT=$(size_check "$D/big.md" "$LIMIT"); RC=$?
|
|
41
|
+
[ "$RC" -eq 1 ] && ok "L2 known-positive: 150,000자 → FAIL (rc=1, count=$OUT)" || no "L2 known-positive" "rc=$RC out=$OUT — 가드가 죽었다"
|
|
42
|
+
|
|
43
|
+
# L3 known-negative: small file must PASS.
|
|
44
|
+
printf '# small\n' > "$D/small.md"
|
|
45
|
+
OUT=$(size_check "$D/small.md" "$LIMIT"); RC=$?
|
|
46
|
+
[ "$RC" -eq 0 ] && ok "L3 known-negative: 작은 파일 → PASS" || no "L3 known-negative" "rc=$RC out=$OUT"
|
|
47
|
+
|
|
48
|
+
# L4 unit = characters, not bytes: 100,000 Hangul chars = 300,000 bytes must PASS.
|
|
49
|
+
python3 -c 'import sys; open(sys.argv[1],"w",encoding="utf-8").write("가"*100000)' "$D/ko.md"
|
|
50
|
+
OUT=$(size_check "$D/ko.md" "$LIMIT"); RC=$?; BYTES=$(wc -c < "$D/ko.md" | tr -d ' ')
|
|
51
|
+
[ "$RC" -eq 0 ] && [ "$OUT" = "100000" ] && [ "$BYTES" -gt "$LIMIT" ] \
|
|
52
|
+
&& ok "L4 단위 = 문자: 한글 100,000자(${BYTES} bytes) → PASS" || no "L4 단위" "rc=$RC chars=$OUT bytes=$BYTES — 바이트를 세고 있다"
|
|
53
|
+
|
|
54
|
+
# L5 boundary: exactly LIMIT passes, LIMIT+1 fails.
|
|
55
|
+
python3 -c 'import sys; open(sys.argv[1],"w",encoding="utf-8").write("a"*int(sys.argv[2]))' "$D/eq.md" "$LIMIT"
|
|
56
|
+
python3 -c 'import sys; open(sys.argv[1],"w",encoding="utf-8").write("a"*(int(sys.argv[2])+1))' "$D/p1.md" "$LIMIT"
|
|
57
|
+
size_check "$D/eq.md" "$LIMIT" >/dev/null; R1=$?; size_check "$D/p1.md" "$LIMIT" >/dev/null; R2=$?
|
|
58
|
+
[ "$R1" -eq 0 ] && [ "$R2" -eq 1 ] && ok "L5 경계: ${LIMIT} PASS · $((LIMIT+1)) FAIL" || no "L5 경계" "eq rc=$R1 +1 rc=$R2"
|
|
59
|
+
|
|
60
|
+
# L6 absent file is UNMEASURED (rc=2), never a pass.
|
|
61
|
+
OUT=$(size_check "$D/nope.md" "$LIMIT"); RC=$?
|
|
62
|
+
[ "$RC" -eq 2 ] && ok "L6 부재 → UNMEASURED rc=2 (0 으로 접지 않는다)" || no "L6 부재" "rc=$RC out=$OUT"
|
|
63
|
+
|
|
64
|
+
# L1 the real subject: the hub CLAUDE.md.
|
|
65
|
+
if [ ! -f "$ROOT/CLAUDE.md" ]; then
|
|
66
|
+
no "L1 CLAUDE.md" "파일 부재 — 미측정(통과 아님)"
|
|
67
|
+
else
|
|
68
|
+
OUT=$(size_check "$ROOT/CLAUDE.md" "$LIMIT"); RC=$?
|
|
69
|
+
if [ "$RC" -eq 0 ]; then ok "L1 CLAUDE.md = ${OUT}자 ≤ ${LIMIT} (CC 경고선 150,000 까지 $((150000-OUT)))"
|
|
70
|
+
else no "L1 CLAUDE.md" "${OUT}자 > ${LIMIT} — 지우지 말고 detail 파일로 옮겨라(헤더 처방)"; fi
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
echo "PASS=$PASS FAIL=$FAIL"
|
|
74
|
+
[ "$FAIL" -eq 0 ] || { echo "FAILED=1"; exit 1; }
|