@chrono-meta/fh-gate 3.47.0 → 3.48.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.
@@ -11,25 +11,25 @@
11
11
  "plugins": [
12
12
  {
13
13
  "name": "fh-meta",
14
- "version": "3.47.0",
14
+ "version": "3.48.0",
15
15
  "description": "New in 2.2.0: BREAKING (gate): chamber step 6 now reads ACTUAL.md, not BUDGET.md — an in-flight chamber run whose actual cost sits in BUDGET.md blocks until the ACTUAL: line moves to tracks/_chamber/<slug>/ACTUAL.md (the runner prints the path). Why: BUDGET.md's pre-verdict hash IS the ordering witness, and step 6 hard-blocked until that same file changed, so every run that reached COMPLETE necessarily mutated a witnessed artifact and verify returned TAMPERED — the chamber's promotion condition was unsatisfiable by construction, not by strictness. Two roles (immutable witness / post-verdict calibration sink) had collided in one file; each was correct alone, so neither side's code showed the conflict. Also: ko-tech-writer Step 2/4-b scans are now calibration-backed (known-pair fixtures + reproducible command, shipped) — discrimination is proven, 'zero residue' is explicitly NOT; chamber lane suite 12 -> 33 including the runner x witness seam no test covered; chamber_run.sh now teaches the two-commit discipline (gate hashes and verdict hash must land in separate commits/PRs — it previously advised the opposite). New in 2.1.0: BREAKING (gate): `crossfamily: declined` in an Axes 2-3 marker now requires grounds naming a record path that RESOLVES on disk — bare `declined`, and `declined` justified by author judgment, are blocked at commit. Remedy: cite where the operator decision lives (e.g. `.. — operator declined sidecars, per knowledge/shared/rules/operational_adaptation.md`), or use `DEGRADED_PANEL_UNUSED` if a panel was reachable and you chose not to recruit it — which is what author judgment actually is. `declined` was the only enum value with no grounds requirement; a cross-family review then broke the first (vocabulary-grep) fix three ways — self-validating on the value's own token, vacuous keyword passes, and over-blocking real declinations in natural prose — so the check asserts a resolvable record instead of words. Also: standpoint axis gains `tier1b` (a STATIC read of a target repo, executed nothing) plus a decide-in-order procedure, after blind floor-tier sims graded pure cold-reads as `tier2` three rounds running; steel-quench Wave 1's sixth angle (gate-locality) gains the output-template row it never had, so a mandatory angle stops being structurally unreportable; verify-bidirectional gains category 5 (prescriptive doctrine statement); Sister Asset Protocol gains an active-adoption trigger; new resident doctrine — Mechanization Boundary, Local Execution First, Skeleton-not-Muscle, Expedition track, and this package's versioning policy. Hub meta-operations toolkit — 35 skills + 7 agents. New in 2.0.1: harness-doctor cadence hook, portability lint wired into pre-commit, branch_claim.sh claim-count-vs-tree-count warning, louder confidentiality-scan fail-open notice, fh-gate.sh missing-package.json survival, identity ① reclassified 🟢 (cross-harness adapters + relay argument channel). New in 1.4.53: `fh-codex-doctor` (npm bin) — Codex adapter drift scanner; reads the documented M1/M2/M3 skill tier map + skill/agent source and reports codex-native/adapter-required/claude-native/unclassified per unit, wired into `npm test`/`prepublishOnly` (fail-closed on unclassified Claude-native primitives). New in 1.4.49: steel-quench gains Step 0.6 Verdict-Invariance Probe (groundedness axis — a load-bearing judged gate's verdict must track behavior, not rubric phrasing; measured flip-count over cross-family paraphrases; arXiv:2605.06161 Policy Invariance anchor); multi_model_sidecar_strategy §Vendor-native harness (a model is strongest in its own vendor CLI — Claude/CC, GPT/codex, Gemini/Antigravity; a universal router degrades all of them, so it stays an autocomplete/QA sidecar, never orchestration); predelete_check.sh fail-closed rewrite; memory-hygiene A-TMA anchor. New in 1.4.48: phantom-quench + steel-quench gain external frontier anchors (arXiv:2607.02052 package-hallucination; arXiv:2607.02057 prompt-coverage-adequacy); README model-flat claim reframed from a per-release point-curve to structural invariants (operation flattens across tiers; depth tier-order fixed within a generation). New in 1.4.47: onboarding step ① surfaces the Mode D companion-store session-start load in the auto-read salience anchor (previously only in the local binding + rules, so a greeting could skip the load). New in 1.4.46: context-doctor command-output axis (route to rtk/proxy for verbose CLI stdout, complementing .claudeignore; risk-gated to token-scarce envs). New in 1.4.41: context-doctor 2026 trigger vocab (context engineering/rot/collapse) + phantom-citation hardening; hub measurement-integrity-checklist (cross-model measurement pre-flight: display-name pin/reps≥3/discriminating probe). New in 1.4.40: install-wizard queryable-wiki scaffold (INDEX + session-start read + R/W/C ingest). New in 1.4.39: auto-decorrelation (cross-family verifier sidecar recruitment) + video-ingest (capability-routed video ingestion). New in 1.4.x: verify-axis check-class taxonomy (mandatory-pass/measured/judged), no-reinvention Tier-0 inventory, 7-class failure taxonomy, Destructive-Op Gate, Wave-T (Temper), tier-floor governance, Mode D Model Notice, FC consent lane, default-Sonnet guidance. New in 1.3.0: public-surface-audit, field-harvest Mode B auto-trigger, 4-axis gate scope ext. Validated cross-CLI: Claude Code, Codex, Gemini.",
16
16
  "source": "./plugins/fh-meta"
17
17
  },
18
18
  {
19
19
  "name": "fh-commons",
20
- "version": "3.47.0",
20
+ "version": "3.48.0",
21
21
  "description": "Project-agnostic utility skills — 7 skills (convergence-loop · deliberation · mcp-circuit-breaker · token-budget-gate · ko-tech-writer · persona-cast · standpoint-review) + 7 agents (quench-challenger + the web-review cast: designer · ux-writer · fe-dev · be-dev · qa · a11y). Domain-independent utilities transplantable into any project.",
22
22
  "source": "./plugins/fh-commons"
23
23
  },
24
24
  {
25
25
  "name": "fh-qp",
26
- "version": "3.47.0",
26
+ "version": "3.48.0",
27
27
  "description": "QP (Quality Platform) — the generic edition of a field QA harness's Prepare→Automation→Regression loop as an FH plugin: 4 skills (qp router · qp-plan · qp-run · qp-regress) + qp_tools.sh (target-class · adapter-probe · mask · surface-reach · mtm-check · run-verbs, typed exit codes) + a zero-domain-constant profile slot + 29 known-pair lanes. Drives web targets through the session's Playwright MCP and desktop targets through computer-use MCP (mobile deferred); calls a registered qasp typed capability when one exists (strictest-wins) — none is registered today, so the MCP fallback is the first edition. Verdict contract: a MACHINE closure requires a recorded assertion; a failed first step is attributed BLOCKED, not FAIL; surface_reach counts every TC in the denominator. Born as chamber run #18 (EMIT, 2026-09-05).",
28
28
  "source": "./plugins/fh-qp"
29
29
  },
30
30
  {
31
31
  "name": "fh-preprep",
32
- "version": "3.47.0",
32
+ "version": "3.48.0",
33
33
  "description": "preprep — a presentation-preparation harness. 1 skill. One CLI over 17 lanes (7 built-in + 10 module) that reads a declared surface manifest and checks a talk's assets against each other: canonical terms, jargon glosses, retired vocabulary, inter-slide dependencies, pacing, get/put round-trips, adjacent duplication, slide relations, geometry, attribute consistency, fonts, diagrams, slide refs, and screen-parity between manuscript and deck. Verdict contract: exit 0 pass / 1 findings / 2 cannot-judge — a surface that could not be read is UNMEASURED, never 0. Promoted out of fh-commons 2026-09-13 after the skill grew past one role (routing / lane modules / fixtures).",
34
34
  "source": "./plugins/fh-preprep"
35
35
  }
package/README.ja.md CHANGED
@@ -60,7 +60,7 @@ cd your-repo && npx --package @chrono-meta/fh-gate fh-gate # 現在のリポ
60
60
 
61
61
  **1 回の実行で何が起き、何がかかるか。** 実行のたびに、変更ファイルをログイン済みのバックエンド CLI に送り、そこでレビューを 1 回呼び出します。そのアカウントの他の呼び出しと同じく課金・利用量に計上されます(`FH_BACKEND=cross` は最大 2 回、オプトインの層を有効にするとさらに増えます)。`FH_DRY_RUN=1` はプロンプトを出力するだけで何も呼び出しません(終了コード 12)。リポジトリのスクリプトをコピー上で実行するゲートの実行層(コピーであってサンドボックスではありません。信頼できない変更では使わないでください)は、`FH_GATE_EXEC=on` にしない限りオフです。既定のレビュー呼び出し自体は読み取りしかできません。`claude` には Read・Glob・Grep だけが渡され(シェル・書き込み・MCP サーバー・スキル・コマンドなし)、`codex` は `-s read-only` で動きます。`claude` では、レビュー対象のチェックアウトのプロジェクト設定・フック・`CLAUDE.md`・`.claude/rules` はその呼び出しで読み込まれません(`--setting-sources user` で動きます)。`codex` では、チェックアウトの `AGENTS.md` は送られず(`-c project_doc_max_bytes=0`)、あなたの codex の `config.toml` も読み込まれません(`--ignore-user-config`)。codex 0.164.0 で測ったところ、あなたの codex 設定が信頼済みとしているチェックアウトでも、その `.codex/config.toml` に書かれた MCP サーバーは起動しませんでした(そのチェックアウトのプロジェクトフックと `.rules` は測っていません)。`config.toml` のほかの設定(MCP サーバー、ログイン情報の保存方式、分析、テレメトリーなど)も、その呼び出しには適用されません。レビューが知らないうちに別の送り先へ行かないよう、fh-gate はまずそのファイルをテキストとして読みます。リクエストの送り先が書かれている場合(`openai` 以外の `model_provider`、`model_providers`、`openai_base_url`、`chatgpt_base_url`)はレビューを送らず、そのキー名を示して終了コード 10 で止まります。行末のコメントに書かれたものや、エスケープ(`\u`、`\U`、`\x`)で書かれたキーも数えます。ファイルを読み取れない場合も終了コード 10 で止まります。オプトインの `FH_REVIEWER=code-review` 呼び出しは読み取り専用ではありません(git の読み取りコマンドを使います)。信頼できる変更にだけ使ってください。また、まだ動作しません。ヘッドレスの `/code-review` は fh-gate が必要とする構造化された結果を返さないため(claude 2.1.330 で 0/11 — fh-gate 経由 0/5、直接 0/6)、現時点では `FH_REVIEWER=code-review` は常に終了コード 10 で止まります。
62
62
 
63
- **CI ステップを失敗させる終了コード。** そのままステップとして実行すると(`npx … fh-gate`)、0 以外の終了コードはすべてステップを失敗させます。1 PENDING(B グレードの指摘 — 注意して進める)も失敗で、2 BLOCKED・3 ESCALATE・10 ハーネスエラー・11 引数エラー・12 dry run も同じです。GitHub Action は代わりに判定へ変換します。既定では BLOCKED・ESCALATE・HARNESS_ERROR・ARG_ERROR・DRY_RUN・不明なコードで失敗し、PENDING は通します(`fail-on` 入力で変更できます)。
63
+ **CI ステップを失敗させる終了コード。** そのままステップとして実行すると(`npx … fh-gate`)、0 以外の終了コードはすべてステップを失敗させます。1 PENDING(B グレードの指摘 — 注意して進める)も失敗で、2 BLOCKED・3 ESCALATE・10 ハーネスエラー・11 引数エラー(CI 下で `--help`・`--version` を単独で渡した場合も含む — 意図した呼び出しは `CI= fh-gate --version`)・12 dry run も同じです。GitHub Action は代わりに判定へ変換します。既定では BLOCKED・ESCALATE・HARNESS_ERROR・ARG_ERROR・DRY_RUN・不明なコードで失敗し、PENDING は通します(`fail-on` 入力で変更できます)。
64
64
 
65
65
  **入口 ② — ハーネス全体を Claude Code の中で。**
66
66
 
package/README.ko.md CHANGED
@@ -82,7 +82,7 @@ cd your-repo && npx --package @chrono-meta/fh-gate fh-gate # 현재 레포
82
82
  0/11 — fh-gate 경유 0/5, 직접 0/6), 지금은 `FH_REVIEWER=code-review` 가 언제나 종료 코드 10 으로 멈춥니다.
83
83
 
84
84
  **CI 스텝을 실패시키는 종료 코드.** 그냥 스텝으로 돌리면(`npx … fh-gate`) 0 이 아닌 종료 코드는 모두 스텝을 실패시킵니다.
85
- 1 PENDING(B 등급 지적 — 알고 진행)도 실패이고, 2 BLOCKED · 3 ESCALATE · 10 하네스 오류 · 11 인자 오류 · 12 dry run 도
85
+ 1 PENDING(B 등급 지적 — 알고 진행)도 실패이고, 2 BLOCKED · 3 ESCALATE · 10 하네스 오류 · 11 인자 오류(CI 아래에서 `--help` · `--version` 을 홀로 줘도 — 일부러 부를 땐 `CI= fh-gate --version`) · 12 dry run 도
86
86
  마찬가지입니다. GitHub Action 은 대신 판정으로 바꿉니다. 기본값에서 BLOCKED · ESCALATE · HARNESS_ERROR · ARG_ERROR ·
87
87
  DRY_RUN · 모르는 코드에서 실패하고 PENDING 은 통과시킵니다(`fail-on` 입력으로 바꿀 수 있습니다).
88
88
 
package/README.md CHANGED
@@ -86,7 +86,7 @@ does not return the structured object fh-gate needs (measured 0/11 on claude 2.1
86
86
  direct), so `FH_REVIEWER=code-review` currently always exits 10.
87
87
 
88
88
  **Which exit codes fail a CI step.** Run as a plain step (`npx … fh-gate`), every non-zero exit fails it — including
89
- 1 PENDING (B-grade findings: proceed with care), as well as 2 BLOCKED, 3 ESCALATE, 10 harness error, 11 argument error
89
+ 1 PENDING (B-grade findings: proceed with care), as well as 2 BLOCKED, 3 ESCALATE, 10 harness error, 11 argument error (also a lone `--help` or `--version` under CI; for a deliberate call use `CI= fh-gate --version`)
90
90
  and 12 dry run. The GitHub Action maps them instead: by default it fails on BLOCKED, ESCALATE, HARNESS_ERROR,
91
91
  ARG_ERROR, DRY_RUN and an unknown code, and lets PENDING pass (its `fail-on` input).
92
92
 
package/README.zh.md CHANGED
@@ -60,7 +60,7 @@ cd your-repo && npx --package @chrono-meta/fh-gate fh-gate # 审查当前仓
60
60
 
61
61
  **跑一次会发生什么、花多少。** 每次运行都会把改动的文件发给你已登录的后端 CLI,并在那里调用一次审查,和该账号的其他调用一样计费或计入用量(`FH_BACKEND=cross` 最多两次,打开可选层会更多)。`FH_DRY_RUN=1` 只打印提示词,不调用任何东西(退出码 12)。门禁的执行层(在副本里运行你仓库自己的脚本;副本不是沙箱,不要用于不可信的改动)只有设置 `FH_GATE_EXEC=on` 才会打开。默认的审查调用本身只能读取:`claude` 只拿到 Read、Glob 和 Grep(没有 shell、写入、MCP 服务器、技能或命令),`codex` 以 `-s read-only` 运行。在 `claude` 上,被审查检出的项目设置、钩子、`CLAUDE.md` 和 `.claude/rules` 不会在这次调用中加载(以 `--setting-sources user` 运行)。在 `codex` 上,检出的 `AGENTS.md` 不会发送(`-c project_doc_max_bytes=0`),你自己的 codex `config.toml` 也不会加载(`--ignore-user-config`)。在 codex 0.164.0 上测得:即使你的 codex 配置信任这个检出,它的 `.codex/config.toml` 里声明的 MCP 服务器也没有启动(该检出的项目钩子和 `.rules` 没有测)。`config.toml` 里的其他设置(MCP 服务器、登录凭据存储方式、分析、遥测等)同样不适用于这次调用。为了不让审查悄悄发往别处,fh-gate 会先把这个文件当作文本读取:如果其中写明了请求的去向(不是 `openai` 的 `model_provider`、`model_providers`、`openai_base_url` 或 `chatgpt_base_url`),就不发送审查,而是给出那个键名并以退出码 10 停止。行尾注释里写的、用转义(`\u`、`\U`、`\x`)写的键也都算;文件无法读取时同样以退出码 10 停止。可选的 `FH_REVIEWER=code-review` 调用不是只读的(它会用 git 的读取命令),只用于可信的改动。而且它目前还不能用:无头模式下的 `/code-review` 不会返回 fh-gate 需要的结构化结果(在 claude 2.1.330 上 0/11——经 fh-gate 0/5,直接 0/6),所以 `FH_REVIEWER=code-review` 目前总是以退出码 10 停止。
62
62
 
63
- **哪些退出码会让 CI 步骤失败。** 直接作为步骤运行(`npx … fh-gate`)时,任何非 0 退出码都会让步骤失败:1 PENDING(B 级发现——知情后继续)也算失败,2 BLOCKED、3 ESCALATE、10 门禁自身错误、11 参数错误、12 dry run 同样如此。GitHub Action 则会先换成判定:默认在 BLOCKED、ESCALATE、HARNESS_ERROR、ARG_ERROR、DRY_RUN 和未知退出码时失败,PENDING 放行(可通过 `fail-on` 输入修改)。
63
+ **哪些退出码会让 CI 步骤失败。** 直接作为步骤运行(`npx … fh-gate`)时,任何非 0 退出码都会让步骤失败:1 PENDING(B 级发现——知情后继续)也算失败,2 BLOCKED、3 ESCALATE、10 门禁自身错误、11 参数错误(在 CI 下单独传 `--help` 或 `--version` 也算——有意调用请用 `CI= fh-gate --version`)、12 dry run 同样如此。GitHub Action 则会先换成判定:默认在 BLOCKED、ESCALATE、HARNESS_ERROR、ARG_ERROR、DRY_RUN 和未知退出码时失败,PENDING 放行(可通过 `fail-on` 输入修改)。
64
64
 
65
65
  **门 ② —— 在 Claude Code 里使用整套框架。**
66
66
 
@@ -63,7 +63,7 @@ Backend defaults:
63
63
  | `FH_BACKEND` | Command | Default model |
64
64
  |---|---|---|
65
65
  | `claude` | `claude --print --model "$FH_MODEL"` | `claude-sonnet-5-5` |
66
- | `codex` | `codex exec [-m "$FH_MODEL"] -` | `fh-gate`: not pinned — no `-m` unless `FH_MODEL` is set, so codex picks from its own catalog (measured on one ChatGPT login; set `FH_MODEL` for a stable model). `fh-run` and `fh-goal` still default to `gpt-5.5`, which codex 0.164.0 refuses for a ChatGPT-account login — set `FH_MODEL` there |
66
+ | `codex` | `codex exec [-m "$FH_MODEL"] -` | `fh-gate`, `fh-run` and `fh-goal`: not pinned — no `-m` unless `FH_MODEL` is set and nonempty, so codex picks from its own configuration and catalog (measured on one ChatGPT login). That also applies to API-key logins that used to get `gpt-5.5`: the model, cost and output can change with codex's defaults, so set `FH_MODEL` for a stable, reproducible model. After a successful unpinned codex run, `fh-run` and `fh-goal` print `→ <script>: codex default (not pinned, resolved <model or unknown>)` on stderr; their `model=` progress line and the prompt's `Model:` line now read `codex default (not pinned)` instead of a model id |
67
67
  | `auto` | `codex` if present, otherwise `claude` | backend default |
68
68
 
69
69
  ### `fh-run`
@@ -82,7 +82,7 @@ observations from one machine, not as documented behaviour.
82
82
  | plan limits from inside a session | `get_usage` returned the 5-hour and weekly windows with percent and reset time | a pacing input for long runs. No status-line run was observed from these desktop sessions: a desktop pet fed only by the status line kept a Claude value last written by a terminal session ~20 h earlier, and took a new one only when the status-line program was fed by hand |
83
83
  | run a cross-family check from a desktop session | `codex` and `agy` resolved and ran from the desktop shell: one reader-doc review on each, one two-round code review on `codex` | those invocations work; the full `auto-decorrelation` skill (panel discovery, consent) was not exercised from a desktop session |
84
84
  | a nested session in its own worktree writing a report into the main checkout | a Write hook refused the main-checkout path; the session wrote inside its worktree and the governor copied the file across | brief side sessions to write in their own tree and say so, or have the governor collect — FH's rule against committing FH assets from a worktree already assumes this |
85
- | deny rules and PreToolUse hooks under `bypassPermissions` | in a scratch folder, headless, Bash tool only, 3 runs: a `permissions.deny` match, a hook exiting 2 and a hook returning `ask` each left the command unrun (marker files 0/3 each); an unmatched control ran 3/3 | in those runs, rules and exit-2 hooks stopped commands with no classifier in the loop — a result for that configuration, not a guarantee for other tools or setups. `destructive_pre_gate.sh` exited 2 only with `FH_DESTRUCTIVE_BLOCK=1`; unset, a forced branch delete went through in bypass headless runs (3 of 3). Since 2026-11-03 it reads the payload's `permission_mode` and blocks by default under `bypassPermissions` (`FH_DESTRUCTIVE_BLOCK=0` keeps it advisory); other modes are unchanged. The hook wiring lives in the gitignored project settings, so a fresh clone has none until it is installed |
85
+ | deny rules and PreToolUse hooks under `bypassPermissions` | in a scratch folder, headless, Bash tool only, 3 runs: a `permissions.deny` match, a hook exiting 2 and a hook returning `ask` each left the command unrun (marker files 0/3 each); an unmatched control ran 3/3 | in those runs, rules and exit-2 hooks stopped commands with no classifier in the loop — a result for that configuration, not a guarantee for other tools or setups. `destructive_pre_gate.sh` exited 2 only with `FH_DESTRUCTIVE_BLOCK=1`; unset, a forced branch delete went through in bypass headless runs (3 of 3). Since 2026-11-03 it reads the payload's `permission_mode` and blocks by default under `bypassPermissions` (`FH_DESTRUCTIVE_BLOCK=0` keeps it advisory); since 2026-11-23 `auto` too, and in block mode an override written into the command (`# noqa`, `DESTRUCTIVE_OP_OK=`, `--no-verify`, `core.hooksPath`) is not honored; other modes are unchanged. The hook wiring lives in the gitignored project settings, so a fresh clone has none until it is installed |
86
86
 
87
87
  Also relevant from the [CLI changelog](https://code.claude.com/docs/en/changelog) (2.1.314, dated October 30, 2026, read
88
88
  2026-11-02): it added `permissions.blockWritesOutsideWorkingDirectories`, under which the Write, Edit and NotebookEdit tools
@@ -49,7 +49,7 @@ Caller reads verdict, decides: merge / hold / escalate
49
49
  | `FH_TASK_DESCRIPTION` | string | What the caller was trying to accomplish (context for adversarial pass) |
50
50
  | `FH_SECURITY_LENS` | `on` or `off` (default `off`) | Force security-adjacent focus in steel-quench |
51
51
  | `FH_BACKEND` | `claude`, `codex`, or `auto` (default `claude`) | Runtime backend. `auto` prefers Codex if installed, otherwise Claude |
52
- | `FH_MODEL` | model id | Overrides backend default (`claude-sonnet-5-5` for Claude). Codex in `fh-gate`: none pinned — with `FH_MODEL` unset no `-m` is passed and the record says `codex default (not pinned, resolved review <model or unknown>)` (one entry per pass, e.g. `, elephant <model>`). `fh-run` / `fh-goal` still default to `gpt-5.5` |
52
+ | `FH_MODEL` | model id | Overrides backend default (`claude-sonnet-5-5` for Claude). Codex in `fh-gate`: none pinned — with `FH_MODEL` unset no `-m` is passed and the record says `codex default (not pinned, resolved review <model or unknown>)` (one entry per pass, e.g. `, elephant <model>`). `fh-run` / `fh-goal`: also not pinned (no `-m` unless `FH_MODEL` is nonempty — API-key users who got `gpt-5.5` now get codex's default; set `FH_MODEL` for a reproducible model); after a successful unpinned codex run they print `→ <script>: codex default (not pinned, resolved <model or unknown>)` on stderr |
53
53
 
54
54
  ### Capture pattern (caller's responsibility)
55
55
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrono-meta/fh-gate",
3
- "version": "3.47.0",
3
+ "version": "3.48.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": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fh-commons",
3
- "version": "3.47.0",
3
+ "version": "3.48.0",
4
4
  "engines": {
5
5
  "claudeCode": ">=1.0.0"
6
6
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fh-meta",
3
- "version": "3.47.0",
3
+ "version": "3.48.0",
4
4
  "engines": {
5
5
  "claudeCode": ">=1.0.0"
6
6
  },
@@ -2,6 +2,40 @@
2
2
 
3
3
  ### [Unreleased]
4
4
 
5
+ ### [3.48.0] — 2026-11-23
6
+
7
+ Minor by the version policy. Three gate changes make a shipped gate refuse more by default. Two are in `fh-gate`: a help or version flag is honoured only on its own (#1190), and under CI even a lone one exits 11 (#1191). Both close the same hole, where a file list that reads as a flag printed help, exited 0 and was read as a pass with no review. They close it in the GitHub Action and in CI systems that set `CI`; it stays open in CI systems that do not set `CI` and in local hooks or scripts (named in the second entry). The third is in `destructive_pre_gate.sh`: in block mode, which now includes `auto` as well as `bypassPermissions`, an override written into the command it is judging no longer opens the block, more shapes block, and the block text says to ask the operator (#1192); a follow-up closes three holes a security review found in it (#1195). See their `BREAKING (gate):` entries. `fh-run` and `fh-goal` stop pinning a codex model (#1189). The new shipped lanes are L8 and L9 in `test_action_yml_lanes.sh`, M1–M4 in `test_fh_run_resolver_lanes.sh` and `test_fh_goal_change_detection_lanes.sh`, and K1–K99 in `test_destructive_pre_gate_lanes.sh`. Items marked «not in the npm package» are in the repository checkout only.
8
+
9
+ ### Changed
10
+ - BREAKING (gate): `fh-gate` (shipped), help and version flags with other arguments (#1190).
11
+ - What changed: `-h`, `--help`, `-V` and `--version` are honoured only as the sole argument. With any other argument, `fh-gate` exits 11 (argument error). In the GitHub Action (not in the npm package), exit 11 maps to `ARG_ERROR` with `reviewed=false`, and the step fails under the default `fail-on`.
12
+ - Why: the Action always calls `fh-gate "$FILES" "$LEVEL" github-action` and maps exit 0 to `verdict=PASS`, `reviewed=true`. A `files` input of `-h`, `--help`, `-V` or `--version` (a file literally named so, or a list built from PR data) printed help, exited 0 and was reported as a reviewed PASS (3.47.0 release security review, MEDIUM-1).
13
+ - What breaks: help or version with trailing arguments, including `FH_TARGET_FILES=x fh-gate -h quick`, now exits 11. `fh-gate -h` and `fh-gate --version` alone behave as before outside CI (see the next entry).
14
+ - Lanes: L8 in `scripts/test_action_yml_lanes.sh` runs the Action's run block against the real `fh-gate.sh`.
15
+ - BREAKING (gate): `fh-gate` (shipped), a lone help or version flag under CI (#1191).
16
+ - What changed: when the `CI` environment variable is set to anything other than empty, `0` or `false`, `fh-gate -h`, `--help`, `-V` and `--version` given alone still print their text, then exit 11 (argument error) instead of 0. GitHub Actions, GitLab, CircleCI, Travis and Buildkite set `CI`.
17
+ - Why: a plain CI step that runs `fh-gate "$FILES"` with `FILES=-h` passes the same arguments as a person typing `fh-gate -h`, so the rule above cannot see it: it printed help and exited 0, so the step passed and nothing was reviewed.
18
+ - What breaks: a deliberate `fh-gate --version` or `--help` in a CI step now fails that step. Workaround: `CI= fh-gate --version`.
19
+ - Still open: CI systems that do not set `CI` (Jenkins; Azure Pipelines sets `TF_BUILD` instead) and local git hooks or scripts that call `fh-gate "$FILES"` with one argument. There, `FILES=-h` still exits 0; check yourself that the file list does not start with `-` before calling `fh-gate`.
20
+ - Outside CI, and with `CI` empty, `0` or `false`, nothing changes. Lanes: L9 in `scripts/test_action_yml_lanes.sh`.
21
+ - BREAKING (gate): `destructive_pre_gate.sh` (shipped), block mode no longer takes an override from the command it is judging (#1192).
22
+ - What changed: block mode now also covers `permission_mode=auto`, not only `bypassPermissions` (explicit `FH_DESTRUCTIVE_BLOCK` still wins either way). In block mode, `# noqa: destructive-op` is ignored, and four more shapes block: `DESTRUCTIVE_OP_OK=` set anywhere in the command, `git push --no-verify`, `core.hooksPath` changed through `git -c` or `git config`, and remote deletes (`git push --delete` / `-d` / `:ref` / `--mirror` / `--prune`). The block text no longer names a way past: it tells the agent to stop and ask the operator, who runs the command from their own terminal.
23
+ - Why: measured in a headless `bypassPermissions` run (haiku, 3 of 3). The agent asked to force-push was blocked by this hook. It re-ran with `# noqa` because the block text said to. Then pre-push blocked it, and it re-ran with `DESTRUCTIVE_OP_OK=1` because pre-push's text said to. The remote history was rewritten. The agent that wrote the command was also the one granting the exception. In `auto` mode the classifier allowed the same direct force push 6 of 6 times.
24
+ - Who is affected: `bypassPermissions` and `auto` sessions that legitimately force-push, delete remote branches or tags, run `reset --hard` and the other destructive rows, or set those overrides. Such a session now has to go through the operator. So does `/install-wizard`'s `git config core.hooksPath templates/.git-hooks` step when an agent runs it in those modes. Branch deletes done through `gh pr merge --delete-branch` go through the GitHub API and are not affected. A doc edit made through Bash that only mentions `DESTRUCTIVE_OP_OK=1` also blocks in these modes, the same mention-as-data false positive the existing rows have.
25
+ - What does not change: advisory mode (`default`, `acceptEdits`, `plan`, `dontAsk`, or `FH_DESTRUCTIVE_BLOCK=0`) gets no new rows, and noqa still works. One advisory change comes from the follow-up below: a destructive command inside backticks now warns, as it already did inside `$(...)`. The pre-push hook is unchanged: an operator's own `DESTRUCTIVE_OP_OK=1 git push …` from their terminal works as before.
26
+ - Also affected: with `FH_DESTRUCTIVE_BLOCK=1` set in a `default`-mode session, `# noqa` no longer opens a block. That variable asks for blocking.
27
+ - Follow-up (#1195), three holes found by a security review of the merged change and reproduced in `bypassPermissions` (each passed with exit 0 before):
28
+ - `git config core.hooksPath get` (also `list`, `--get`, `-l`) set hooksPath to that word and switched off pre-push. The read exemption looked at the word after the key, which is the value. A read verb now counts only before the key, and a segment with `--comment` before the key is never a read. A value that starts with a backtick or a parenthesis (`` `printf /dev/null` ``, `"(disabled)"`) now counts as a write too. `git config get core.hooksPath`, `git config --get core.hooksPath` and `$(git config core.hooksPath)` stay clean.
29
+ - A remote delete with a push-option value of `-n` (`git push --delete origin x -o -n`) was taken for a dry run. No regex here can tell an option value from a flag once quotes are stripped, so the dry-run exemption is now off whenever the statement has a push option (`-o…`, `--pu…`) or `--`: the call blocks. A plain `--dry-run --delete` stays clean. A push option whose value looks like `:ref` also blocks; that false positive was there before.
30
+ - A destructive command inside backticks passed every row, while the same command inside `$(...)` was caught. It existed before this change, and the new rows inherited it. Backticks are now treated like `$(...)`, in both modes, and a dry-run in one substitution no longer clears a delete in the next.
31
+ - Review stopped at two codex rounds, not converged: round 2 still found new shapes, both fixed.
32
+ - Still open: indirection (a script that holds the push and sets the variable inside), editing settings or the hook file to drop the hook, deleting refs through the GitHub API (`gh api -X DELETE …/git/refs/…`), `dontAsk` mode, and pushes from a shell the agent did not type into. A determined agent gets past any client-side check. The floor is server-side branch protection, as the pre-push header says. Moving pre-push's own override out of band is a separate, larger change, not in this one. Lanes: K1–K99, B4, B6 and B10 in `scripts/test_destructive_pre_gate_lanes.sh`.
33
+ - `fh-run` and `fh-goal` (shipped) no longer pass `-m gpt-5.5` to codex when `FH_MODEL` is unset or empty; codex picks its own default, as `fh-gate` has done since #1186. Before, codex 0.164.0 refused `gpt-5.5` for a ChatGPT-account login (HTTP 400). `FH_MODEL=<id>` still passes `-m <id>`, and the claude default (`claude-sonnet-5-5`) is unchanged (#1189).
34
+ - After a successful unpinned codex run, each script prints one stderr line: `→ fh-run: codex default (not pinned, resolved <id>)` (or `fh-goal`). The id is read from codex's own stderr banner above the first `user` line, and must be id-shaped, or the line says `unknown`.
35
+ - The `model=` progress line and the prompt's `Model:` line now read `codex default (not pinned)` instead of a model id. A script that greps `model=gpt-5.5` there stops matching.
36
+ - API-key users who got `gpt-5.5` before now get codex's default, so the model, cost and output can change. Set `FH_MODEL` for a reproducible model. Both points are in `docs/codex-compat.md` and in `knowledge/shared/harness-core/fh_integration_contract.md`.
37
+ - `fh-goal` never exported its default, so the `fh-gate` step it runs was already unpinned. That is unchanged.
38
+
5
39
  ### [3.47.0] — 2026-11-22
6
40
 
7
41
  Minor by the version policy. `fh-gate`'s review calls change behaviour: the default, goldfish and elephant review calls are read-only, and no review call loads the reviewed checkout's settings, hooks or instruction files (#1179, #1181, #1182, #1183). The opt-in `/code-review` call is still not read-only. The codex review no longer pins a model and the record names the model each pass used (#1186). The GitHub Action passes its inputs as data (#1176). There are new shipped lanes (D13–D17 in `test_fh_gate_defaults_lanes.sh`, L7 in `test_action_yml_lanes.sh`, two cases in `templates/predelete_check.test.sh`) and two judged procedure lines (#1180, #1185).
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fh-preprep",
3
- "version": "3.47.0",
3
+ "version": "3.48.0",
4
4
  "engines": {
5
5
  "claudeCode": ">=1.0.0"
6
6
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fh-qp",
3
- "version": "3.47.0",
3
+ "version": "3.48.0",
4
4
  "engines": {
5
5
  "claudeCode": ">=1.0.0"
6
6
  },
@@ -21,7 +21,36 @@
21
21
  # FH_DESTRUCTIVE_BLOCK=1 to escalate to exit 2 (stderr → model, call blocked).
22
22
  # EXCEPTION (2026-11-03): with FH_DESTRUCTIVE_BLOCK unset and the hook payload's
23
23
  # permission_mode = bypassPermissions, it blocks by default — nobody reads an advisory before a
24
- # bypass-mode call runs. FH_DESTRUCTIVE_BLOCK=0 restores advisory there. Other modes unchanged.
24
+ # bypass-mode call runs. FH_DESTRUCTIVE_BLOCK=0 restores advisory there.
25
+ # 2026-11-23 (IG1 → operator pick A + A′): permission_mode = auto counts the same way (the
26
+ # classifier, not a human, decides the call — measured: it allowed a direct force push 6/6).
27
+ # Other modes (default, acceptEdits, plan, dontAsk) unchanged — dontAsk is a named residual.
28
+ #
29
+ # BLOCK MODE DOES NOT HONOR OVERRIDES WRITTEN INTO THE COMMAND (2026-11-23, A).
30
+ # Measured (tracks/_meta/inbound_guard_2026-11-23, KP-F v2, bypass, haiku 3/3): blocked here, the
31
+ # agent re-ran with `# noqa: destructive-op` because THIS guard's block text said to; blocked by
32
+ # pre-push, it re-ran with `DESTRUCTIVE_OP_OK=1` because pre-push's text said to — remote history
33
+ # rewritten. The one who writes the command was also the one granting the exception. So in block
34
+ # mode: (1) noqa is ignored; (2) block-only rows catch the agent switching off the next layer —
35
+ # `DESTRUCTIVE_OP_OK=` set anywhere in the command, `git push --no-verify`, core.hooksPath via
36
+ # `-c` or `git config` — and remote deletes (`push --delete`/`-d`/`:ref`/`--mirror`/`--prune`),
37
+ # which this guard had no row for, so `DESTRUCTIVE_OP_OK=1 git push origin --delete x` used to
38
+ # pass both layers; (3) the block text names no way past — it says ask the operator, who runs it
39
+ # from their own terminal. Advisory mode is byte-for-byte unchanged (noqa works, no new rows).
40
+ # What this does NOT close, by design: indirection (`bash x.sh` holding the push, env set inside
41
+ # the script), editing settings to drop the hook or set FH_DESTRUCTIVE_BLOCK=0, removing or
42
+ # rewriting the hook file itself (`rm`/`chmod -x` on pre-push — and the Edit/Write tools never
43
+ # reach this Bash hook at all), deleting refs through the GitHub API (`gh api -X DELETE
44
+ # …/git/refs/…` — neither layer sees it), abbreviations of the PRE-EXISTING force row
45
+ # (`--forc`), mention-as-data in block mode (an echo/heredoc that only names
46
+ # `DESTRUCTIVE_OP_OK=1` blocks), and pushes from a shell the agent did not type into. With
47
+ # FH_DESTRUCTIVE_BLOCK=1 set in a default-mode session, noqa no longer opens a block either —
48
+ # that variable asks for blocking. Fail-closed on purpose (block mode, follow-up to #1192): a push
49
+ # with a push option or `--` gets no dry-run exemption, and a push-option value shaped like `:ref`
50
+ # reads as a delete. A determined agent gets past any client-side check; the floor
51
+ # is server-side branch protection (pre-push header says the same). Static shell-string checks do
52
+ # not converge (FH measured 15 rounds on a sibling check), so review rounds here are capped at
53
+ # two. Lanes K1–K51 (input-from: IG1 KP-F v2 records, codex R1, Sonnet quench-challenger R1).
25
54
  # Unparseable/absent payload → silent exit 0 (an unparsed input is not a finding; block mode
26
55
  # fails open on a dead python3 — same accepted residual as pipe_verdict_guard, the surface is
27
56
  # the reversible Bash call, not the irreversible act itself).
@@ -99,8 +128,28 @@ if isinstance(m, str): sys.stdout.write(m)
99
128
  fi
100
129
  [ -n "$CMD" ] || exit 0
101
130
 
102
- # Explicit opt-out, checked before any rule.
103
- printf '%s' "$CMD" | LC_ALL=C grep -qE '#[[:space:]]*noqa:?[[:space:]]*destructive-op' && exit 0
131
+ # Block decision FIRST — whether noqa counts depends on it. Explicit FH_DESTRUCTIVE_BLOCK wins either
132
+ # way (1 = block, 0 = advisory). Unset: block when the session runs with permission_mode
133
+ # bypassPermissions or auto — there no human sees the advisory before the call runs, so a warning
134
+ # is a post-mortem (measured 2026-11-03, headless bypass, Sonnet: unset → branch deleted 3/3,
135
+ # =1 → kept 3/3; auto added 2026-11-23 after the classifier allowed a direct force push 6/6).
136
+ BLOCK_WHY=""
137
+ case "${FH_DESTRUCTIVE_BLOCK-}" in
138
+ 1) BLOCK_WHY="FH_DESTRUCTIVE_BLOCK=1." ;;
139
+ "") case "$PERM_MODE" in
140
+ bypassPermissions) BLOCK_WHY="permission_mode=bypassPermissions (no human sees a warning before the call runs)." ;;
141
+ auto) BLOCK_WHY="permission_mode=auto (a classifier, not a human, decides this call)." ;;
142
+ esac ;;
143
+ *) BLOCK_WHY="" ;; # 0 and any other explicit value: advisory, as before this default existed
144
+ esac
145
+
146
+ # Explicit opt-out — honored in ADVISORY mode only. In block mode an agent-written noqa is the
147
+ # agent granting itself the exception (IG1 KP-F v2: haiku 3/3), so it is noted and ignored.
148
+ NOQA_SEEN=""
149
+ if printf '%s' "$CMD" | LC_ALL=C grep -qE '#[[:space:]]*noqa:?[[:space:]]*destructive-op'; then
150
+ [ -z "$BLOCK_WHY" ] && exit 0
151
+ NOQA_SEEN=1
152
+ fi
104
153
 
105
154
  # Flatten to ONE line (grep is line-oriented; multi-line commands are the recurring shape) and pad
106
155
  # with spaces so end-of-string flags match uniformly (` -f` at line end == ` -f `).
@@ -120,9 +169,14 @@ printf '%s' "$CMD" | LC_ALL=C grep -qE '#[[:space:]]*noqa:?[[:space:]]*destructi
120
169
  # `git re\` + newline + `set --hard` split the token and miss (measured bypass).
121
170
  # Separators `&& || | & ( )` are space-padded so `:&&git reset --hard` and `--force|cat`
122
171
  # satisfy the leading/trailing boundary classes without whitespace in the original.
172
+ # A backtick is padded too: `` `git push origin --delete x` `` is a command substitution like
173
+ # `$(...)`, and before 2026-11-23 the backtick in front of `git` defeated every row's `[ (/]`.
123
174
  JOINED="${CMD//\\$'\n'/}"
124
175
  FLAT=" $(printf '%s' "$JOINED" | tr -d '\r' | tr '\n' ';' | sed 's/;/; /g' \
125
- | sed -E 's/(\&\&|\|\||[|&()])/ \1 /g' | tr -d '"'"'" | tr '\t' ' ' | tr -s ' ') "
176
+ | sed -E 's/(\&\&|\|\||[|&()`])/ \1 /g' | tr -d '"'"'" | tr '\t' ' ' | tr -s ' ') "
177
+ # Kept before git-option normalization: the normalizer below consumes `-c k=v`, which is exactly
178
+ # where `git -c core.hooksPath=/dev/null push` hides the pre-push switch-off (block-only row).
179
+ FLAT0="$FLAT"
126
180
 
127
181
  # Normalize git global options down to bare `git` BEFORE matching — the Axis-2 pass measured
128
182
  # `git -C /repo reset --hard` sailing through every git row, and this environment specifically
@@ -195,8 +249,120 @@ for entry in "${PATTERNS[@]}"; do
195
249
  "
196
250
  fi
197
251
  done
252
+
253
+ # Block-only rows (2026-11-23, A). Advisory mode never evaluates them, so advisory output is
254
+ # unchanged. Two groups: remote deletes (no row above saw them — pre-push did, and its env override
255
+ # was then the agent's to set), and the agent switching off the next layer. `FLAT0` is the
256
+ # pre-normalization flat: `-c core.hooksPath=` is consumed by the git-option normalizer.
257
+ # core.hooksPath is case-insensitive in git, hence the bracket classes.
258
+ if [ -n "$BLOCK_WHY" ]; then
259
+ # git config keys are case-insensitive (section and name): `CORE.hooksPath` is the same key.
260
+ HP='[cC][oO][rR][eE]\.[hH][oO][oO][kK][sS][pP][aA][tT][hH]'
261
+ # Dry-run neutralizer for the push rows below, applied to a COPY (FLATB) so the shared rows and
262
+ # the advisory output are untouched. Per statement: `[^|;&]*` cannot cross `&&`/`;`, so a dry-run
263
+ # in one statement never clears a real delete in the next. git accepts unique prefixes of long
264
+ # options, so `--dr…` is dry-run and the rows match `--de…`, `--no-v…`, `--mi…`, `--pru…`.
265
+ # A statement ends at `| ; &`, and also at a paren or backtick: a dry-run in one `$(...)` or
266
+ # backtick substitution must not clear a real delete in the next one (codex R1).
267
+ # A push option in the statement turns the exemption back off. Its value can carry `-n` as data
268
+ # (`-o -n`, `-on`, `--push -n`, `-o "foo -n"` once quotes are stripped) and no regex here can
269
+ # tell that value from a flag, so the call fails closed: it blocks (Sonnet review of #1192, codex R1).
270
+ # So does `--`: after it every word is a ref, and `refs/heads/-n` is a valid name (codex R2).
271
+ FLATB=$(printf '%s' "$FLAT" | sed -E 's/git push (([^|;&()`]* )?(--dr[a-z-]*|-[a-zA-Z]*n[a-zA-Z]*)[ ;])/git push_dryrun \1/g' \
272
+ | sed -E 's/git push_dryrun (([^|;&()`]* )?((-[a-zA-Z]*o|--pu[a-z-]*)([ =;]|[^ ;])|--[ ;]))/git push \1/g')
273
+ BLOCK_ONLY=(
274
+ "FLATB@@[ (/]git push ([^|;&]* )?(--de[a-z]*[ ;]|-[a-zA-Z]*d[a-zA-Z]*[ ;])@@git push --delete/-d removes a remote branch or tag"
275
+ "FLATB@@[ (/]git push ([^|;&]* )?\\+?:[^ ;]+[ ;]@@git push <remote> :<ref> deletes the remote ref"
276
+ "FLATB@@[ (/]git push ([^|;&]* )?(--mi[a-z]*|--pru[a-z]*)[ ;]@@git push --mirror/--prune deletes remote refs that are not local"
277
+ "FLATB@@[ (/]git push ([^|;&]* )?--no-v[a-z-]*[ ;]@@git push --no-verify skips the pre-push layer"
278
+ "FLAT0@@[ (/]git ([^|;&]* )?(-c +|--config-env[= ])${HP}=@@git -c/--config-env core.hooksPath=… replaces the pre-push layer for this command"
279
+ "FLAT0@@(^|[ (;&|])GIT_CONFIG_(KEY_[0-9]+=${HP}|PARAMETERS=[^;&|]*${HP})@@GIT_CONFIG_* naming core.hooksPath replaces the pre-push layer for this command"
280
+ "FLAT@@(^|[ (;&|])(export +)?DESTRUCTIVE_OP_OK=@@DESTRUCTIVE_OP_OK= written into the command is an override of the pre-push layer"
281
+ )
282
+ for entry in "${BLOCK_ONLY[@]}"; do
283
+ src="${entry%%@@*}"; rest="${entry#*@@}"
284
+ pattern="${rest%%@@*}"; desc="${rest#*@@}"
285
+ case "$src" in FLAT0) subj="$FLAT0" ;; FLATB) subj="$FLATB" ;; *) subj="$FLAT" ;; esac
286
+ if printf '%s' "$subj" | LC_ALL=C grep -qE "$pattern"; then
287
+ hits="${hits} ⚠️ DESTRUCTIVE-OP ${desc}
288
+ "
289
+ fi
290
+ done
291
+ # `git config … core.hooksPath` per statement: a READ (--get*, --list, -l, get, list, or no value
292
+ # after the key — `$(git config core.hooksPath)`, `… 2>/dev/null`, `… && next`) is clean; a WRITE
293
+ # (--unset*, --replace-all, --add, set/unset, or a value token) blocks. An empty value (`""`/`''`)
294
+ # vanishes when quotes are stripped, so it is checked on the raw command (codex R1).
295
+ # The value token after the key is a write unless it is a redirect (`2>/dev/null`, `>x`, `2>&1`)
296
+ # or a closing paren — a digit alone (`core.hooksPath 0`) is a value (codex R2).
297
+ # A read verb counts only BEFORE the key: after it, the word is the value — `git config
298
+ # core.hooksPath get` (or `… --get`, `… -l`) SETS hooksPath to «get» (Sonnet review of #1192).
299
+ HP_READ_RX='(--get(-all|-regexp|-urlmatch)?|--list| -l| get| list)( |$)'
300
+ # `--comment <text>` is for writes only, and its text can hold `get` (`--comment get`,
301
+ # `--comment "foo get"` once quotes are stripped): a segment with `--comm…` before the key is
302
+ # never a read (measured on git 2.50: both forms set hooksPath; codex R1).
303
+ hp_is_read() {
304
+ local pre; pre=$(printf '%s' "$1" | sed -E "s/${HP}.*//")
305
+ printf '%s' "$pre" | LC_ALL=C grep -qE -- '--comm' && return 1
306
+ printf '%s' "$pre" | LC_ALL=C grep -qE -- "$HP_READ_RX"
307
+ }
308
+ HP_WRITE=""
309
+ while IFS= read -r seg; do
310
+ [ -n "$seg" ] || continue
311
+ hp_is_read "$seg" && continue
312
+ if printf '%s' "$seg" | LC_ALL=C grep -qE -- "(--unset(-all)?|--replace-all|--add| set| unset) "; then HP_WRITE=1; break; fi
313
+ nxt=$(printf '%s' "$seg" | LC_ALL=C grep -oE -- "${HP} +[^ ]+" | head -1 | sed -E 's/^[^ ]+ +//')
314
+ if [ -n "$nxt" ] && ! printf '%s' "$nxt" | LC_ALL=C grep -qE '^(\)|[0-9]*[<>])'; then HP_WRITE=1; break; fi
315
+ done <<SEGS
316
+ $(printf '%s' "$FLAT" | LC_ALL=C grep -oE "[ (/]git config [^|;&()\`]*${HP}[^|;&()\`]*")
317
+ SEGS
318
+ # A value that starts with `(` or a backtick ends the segment above before any value is seen
319
+ # (`core.hooksPath `printf x``, `"(disabled)"` once quotes are stripped; codex R2). The key then
320
+ # followed by `(` is a write; followed by a backtick it is a write unless that backtick CLOSES a
321
+ # substitution the key sits in (an odd count of backticks before it). Reads keep their exemption.
322
+ # Runs only when that shape is present; if python fails there, it counts as a write.
323
+ if [ -z "$HP_WRITE" ] && printf '%s' "$FLAT" | LC_ALL=C grep -qE "${HP} +[(\`]"; then
324
+ hp_tail=$(printf '%s' "$FLAT" | python3 -c '
325
+ import re, sys
326
+ f = sys.stdin.read()
327
+ read_rx = re.compile(r"(--get(-all|-regexp|-urlmatch)?|--list| -l| get| list)( |$)")
328
+ for m in re.finditer(r"[ (/]git config ([^|;&()`]*?)core\.hookspath +([(`])", f, re.I):
329
+ pre = m.group(1)
330
+ if "--comm" not in pre and read_rx.search(" " + pre):
331
+ continue
332
+ if m.group(2) == "(" or f[:m.start(2)].count("`") % 2 == 0:
333
+ print("W"); break
334
+ ' 2>/dev/null) || hp_tail=W
335
+ [ "$hp_tail" = W ] && HP_WRITE=1
336
+ fi
337
+ # Empty value: checked on the raw command (quotes intact), per statement, same read exemption.
338
+ while IFS= read -r seg; do
339
+ [ -n "$seg" ] || continue
340
+ hp_is_read "$seg" && continue
341
+ HP_WRITE=1; break
342
+ done <<SEGS
343
+ $(printf '%s' "$JOINED" | LC_ALL=C grep -oE "git[^|;&()\`]*config[^|;&()\`]*${HP}[[:space:]]+(\"\"|'')")
344
+ SEGS
345
+ # Removing or renaming the whole [core] section drops core.hooksPath without naming it (codex R2).
346
+ printf '%s' "$FLAT" | LC_ALL=C grep -qE "[ (/]git config ([^|;&]* )?(--)?(remove|rename)-section +[cC][oO][rR][eE][ ;]" && HP_WRITE=1
347
+ [ -n "$HP_WRITE" ] && hits="${hits} ⚠️ DESTRUCTIVE-OP git config core.hooksPath changes or removes the directory the pre-push layer lives in
348
+ "
349
+ fi
198
350
  [ -n "$hits" ] || exit 0
199
351
 
352
+ if [ -n "$BLOCK_WHY" ]; then
353
+ # Block mode: exit 2 = stderr fed to the model as the blocking reason; stdout ignored by contract.
354
+ # The text names NO way past. Every way past it used to name (noqa here, DESTRUCTIVE_OP_OK in
355
+ # pre-push) was taken by the agent that read it (IG1 KP-F v2, haiku 3/3).
356
+ printf '%s' "$hits" >&2
357
+ printf '%s\n' " [BLOCKED] $BLOCK_WHY" >&2
358
+ [ -n "$NOQA_SEEN" ] && printf '%s\n' " A '# noqa: destructive-op' in the command is not honored in this mode." >&2
359
+ printf '%s\n' " In this mode an override written into the command is not honored." \
360
+ " Stop and ask the operator; if they want it, they run it from their own terminal." \
361
+ " Meanwhile: enumerate what this would destroy (git status / git log / git reflog) and" \
362
+ " report it — do not retry this call in another form." >&2
363
+ exit 2
364
+ fi
365
+
200
366
  hits="${hits} Advisory timing: this context reaches the model on the NEXT turn — the call may have
201
367
  already run (pre-action blocking = FH_DESTRUCTIVE_BLOCK=1). If it ran un-enumerated,
202
368
  recover FIRST: git status / git stash list / git reflog /
@@ -205,24 +371,6 @@ hits="${hits} Advisory timing: this context reaches the model on the NEXT t
205
371
  Destructive-Op Gate order: enumerate → recover → destroy — never destroy-then-check.
206
372
  Intentional and reviewed → re-run with trailing \`# noqa: destructive-op\`."
207
373
 
208
- # Block decision. Explicit FH_DESTRUCTIVE_BLOCK wins either way (1 = block, 0 = advisory). Unset:
209
- # block when the session runs with permission_mode=bypassPermissions — there no human sees the
210
- # advisory before the call runs, so a warning is a post-mortem (measured 2026-11-03, headless
211
- # bypass, Sonnet: unset → branch deleted 3/3, =1 → kept 3/3).
212
- BLOCK_WHY=""
213
- case "${FH_DESTRUCTIVE_BLOCK-}" in
214
- 1) BLOCK_WHY="FH_DESTRUCTIVE_BLOCK=1 — add noqa after review, or set FH_DESTRUCTIVE_BLOCK=0, to proceed." ;;
215
- "") [ "$PERM_MODE" = "bypassPermissions" ] && \
216
- BLOCK_WHY="permission_mode=bypassPermissions (no human sees a warning before the call runs) — add noqa after review, or set FH_DESTRUCTIVE_BLOCK=0 to keep advisory." ;;
217
- *) BLOCK_WHY="" ;; # 0 and any other explicit value: advisory, as before this default existed
218
- esac
219
- if [ -n "$BLOCK_WHY" ]; then
220
- # Block mode: exit 2 = stderr fed to the model as the blocking reason; stdout ignored by contract.
221
- printf '%s\n' "$hits" >&2
222
- printf '%s\n' " [BLOCKED] $BLOCK_WHY" >&2
223
- exit 2
224
- fi
225
-
226
374
  # Advisory mode: JSON on stdout, exit 0. Capture-then-emit; PYTHONIOENCODING pinned because the
227
375
  # text carries non-ASCII (⚠️) and an inherited ascii codec was measured to kill the emission
228
376
  # (pipe_verdict_guard lane C4). python3 owns escaping; on failure degrade to stderr (delivery
@@ -17,7 +17,8 @@
17
17
  # 3 — ESCALATE (human decision required)
18
18
  # 10 — Harness error (backend unavailable, timeout, missing/invalid structured
19
19
  # verdict, or status != SUCCESS) — always fail-closed, never silent-pass
20
- # 11 — Argument error (invalid level, no files)
20
+ # 11 — Argument error (invalid level, no files, or a help/version flag given with other arguments;
21
+ # also -h/--help/-V/--version alone when CI is set to anything but empty, 0 or false)
21
22
  # 12 — Dry-run (prompt emitted, NO review performed) — deliberately outside the
22
23
  # verdict range: a check that did not run must never be readable as PASS.
23
24
  #
@@ -145,10 +146,36 @@ EXIT_DRY_RUN=12
145
146
  # Unknown flags are an ERROR, never a filename. Silently demoting an unrecognized
146
147
  # argument to "a file to review" is the same shape as demoting an unknown mode to a
147
148
  # weaker check: the run continues, reports something, and the something is wrong.
149
+ # Help and version are honoured only ALONE (2026-11-22, 3.47.0 security review MEDIUM-1). With other arguments the
150
+ # first one is a file list position — the GitHub Action always passes three — and a list that happens to read
151
+ # `-h` (a file literally named so, or a list built from PR data) used to print help and exit 0, which the Action
152
+ # maps to PASS with reviewed=true: no review ran. Now that case is an argument error (exit 11, not a pass).
153
+ case "${1:-}" in
154
+ --version|-V|--help|-h)
155
+ if [[ $# -ne 1 ]]; then
156
+ printf '%s\n' "ERROR: '${1}' is honoured only on its own (got $# arguments)." >&2
157
+ printf '%s\n' " In the file-list position it is not a file list, and help is not a review — not a pass." >&2
158
+ exit 11
159
+ fi ;;
160
+ esac
161
+ # Under CI the same flag ALONE is not a pass either (2026-11-23, the residual named in #1190). A plain CI step
162
+ # that runs `fh-gate "$FILES"` with FILES=-h hands this script argv identical to a person typing `fh-gate -h`,
163
+ # so the argument count cannot tell them apart; the environment can. With CI set to anything but empty, 0 or
164
+ # false (GitHub Actions, GitLab, CircleCI, Travis and Buildkite set it), help and version still print, then exit
165
+ # 11. A deliberate call in CI: `CI= fh-gate --version`. Still open, by name: CI systems that do not set CI
166
+ # (Jenkins; Azure Pipelines sets TF_BUILD) and local git hooks or scripts that call `fh-gate "$FILES"`.
167
+ _fh_info_exit() {
168
+ case "${CI:-}" in
169
+ ''|0|false) _FH_VERDICT_EXIT=1; exit 0 ;;
170
+ esac
171
+ printf '%s\n' "ERROR: CI is set, so '${1}' printed above but exits 11 — under CI a lone help or version flag" >&2
172
+ printf '%s\n' " may be a file list that reads as a flag, and help is not a review. For a deliberate call: CI= fh-gate ${1}" >&2
173
+ exit 11
174
+ }
148
175
  case "${1:-}" in
149
176
  --version|-V)
150
177
  printf '%s\n' "fh-gate $VERSION"
151
- _FH_VERDICT_EXIT=1; exit 0
178
+ _fh_info_exit "$1"
152
179
  ;;
153
180
  --help|-h)
154
181
  printf '%s\n' "fh-gate $VERSION — FH governance gate"
@@ -161,6 +188,8 @@ case "${1:-}" in
161
188
  printf '%s\n' " fh-gate \"<files>\" review an explicit space-separated file list"
162
189
  printf '%s\n' " fh-gate \"<files>\" <level> level: quick (default) or full"
163
190
  printf '%s\n' " fh-gate --version | --help"
191
+ printf '%s\n' " (alone; under CI — CI set, not empty/0/false — they exit 11:"
192
+ printf '%s\n' " use CI= fh-gate --version for a deliberate call)"
164
193
  printf '%s\n' ""
165
194
  printf '%s\n' "Exit codes"
166
195
  printf '%s\n' " 0 PASS no findings"
@@ -197,7 +226,7 @@ case "${1:-}" in
197
226
  printf '%s\n' " FH_GATE_BASE=<ref> base the execution layer measures the change against"
198
227
  printf '%s\n' ""
199
228
  printf '%s\n' " https://github.com/chrono-meta/forge-harness"
200
- _FH_VERDICT_EXIT=1; exit 0
229
+ _fh_info_exit "$1"
201
230
  ;;
202
231
  -*)
203
232
  printf '%s\n' "ERROR: unrecognized option '${1}'." >&2
@@ -118,10 +118,13 @@ fi
118
118
 
119
119
  if [[ -z "${FH_MODEL:-}" ]]; then
120
120
  case "$FH_BACKEND" in
121
- codex) FH_MODEL="gpt-5.5" ;;
121
+ codex) FH_MODEL="" ;; # not pinned: codex picks a model the login accepts. The old pin, gpt-5.5, is
122
+ # refused for a ChatGPT login (HTTP 400, measured 2026-11-22 via fh-gate #1186).
123
+ # FH_MODEL=<id> still passes -m <id>.
122
124
  claude) FH_MODEL="claude-sonnet-5-5" ;;
123
125
  esac
124
126
  fi
127
+ FH_MODEL_LABEL="${FH_MODEL:-codex default (not pinned)}"
125
128
 
126
129
  if ! command -v "$FH_BACKEND" &>/dev/null; then
127
130
  echo "ERROR: '$FH_BACKEND' CLI not found." >&2
@@ -150,7 +153,7 @@ trap cleanup EXIT
150
153
 
151
154
  cat > "$PROMPT_FILE" <<PROMPT
152
155
  FH GOAL RUNNER v${VERSION}
153
- Backend: ${FH_BACKEND} | Model: ${FH_MODEL}
156
+ Backend: ${FH_BACKEND} | Model: ${FH_MODEL_LABEL}
154
157
 
155
158
  Task:
156
159
  ${GOAL_PROMPT}
@@ -173,7 +176,7 @@ if [[ "$FH_DRY_RUN" == "1" ]]; then
173
176
  exit 12
174
177
  fi
175
178
 
176
- echo "→ fh-goal v${VERSION} backend=${FH_BACKEND} model=${FH_MODEL} gate=${FH_GATE_LEVEL}" >&2
179
+ echo "→ fh-goal v${VERSION} backend=${FH_BACKEND} model=${FH_MODEL_LABEL} gate=${FH_GATE_LEVEL}" >&2
177
180
 
178
181
  _TIMEOUT_CMD=""
179
182
  if command -v gtimeout &>/dev/null; then
@@ -182,10 +185,19 @@ elif command -v timeout &>/dev/null; then
182
185
  _TIMEOUT_CMD="timeout ${FH_TIMEOUT}"
183
186
  fi
184
187
 
188
+ # With codex unpinned, name the model codex resolved, read from its own stderr banner above the `user` line
189
+ # only (the same rule as fh-gate #1186). Id-shaped or «unknown»; never the prompt or the reply.
190
+ _note_codex_model() {
191
+ [[ "$FH_BACKEND" == "codex" && -z "${FH_MODEL:-}" ]] || return 0
192
+ local _m
193
+ _m=$(awk '/^user$/{exit} /^model: /{sub(/^model: /, ""); print; exit}' "$ERR_FILE" 2>/dev/null || true)
194
+ [[ "$_m" =~ ^[A-Za-z0-9._:-]{1,64}$ ]] || _m="unknown"
195
+ echo "→ $1: codex default (not pinned, resolved $_m)" >&2
196
+ }
185
197
  run_backend() {
186
198
  case "$FH_BACKEND" in
187
199
  claude) ${_TIMEOUT_CMD} claude --print --model "$FH_MODEL" ;;
188
- codex) ${_TIMEOUT_CMD} codex exec -m "$FH_MODEL" - ;;
200
+ codex) ${_TIMEOUT_CMD} codex exec ${FH_MODEL:+-m "$FH_MODEL"} - ;;
189
201
  esac
190
202
  }
191
203
 
@@ -195,6 +207,7 @@ if ! run_backend < "$PROMPT_FILE" > "$OUTPUT_FILE" 2>"$ERR_FILE"; then
195
207
  exit 10
196
208
  fi
197
209
 
210
+ _note_codex_model fh-goal
198
211
  [[ "$FH_VERBOSE" == "1" ]] && cat "$ERR_FILE" >&2
199
212
  cat "$OUTPUT_FILE"
200
213
 
package/scripts/fh-run.sh CHANGED
@@ -143,10 +143,13 @@ fi
143
143
 
144
144
  if [[ -z "${FH_MODEL:-}" ]]; then
145
145
  case "$FH_BACKEND" in
146
- codex) FH_MODEL="gpt-5.5" ;;
146
+ codex) FH_MODEL="" ;; # not pinned: codex picks a model the login accepts. The old pin, gpt-5.5, is
147
+ # refused for a ChatGPT login (HTTP 400, measured 2026-11-22 via fh-gate #1186).
148
+ # FH_MODEL=<id> still passes -m <id>.
147
149
  claude) FH_MODEL="claude-sonnet-5-5" ;;
148
150
  esac
149
151
  fi
152
+ FH_MODEL_LABEL="${FH_MODEL:-codex default (not pinned)}"
150
153
 
151
154
  resolve_unit() {
152
155
  local mode="$1"
@@ -237,7 +240,7 @@ trap cleanup EXIT
237
240
 
238
241
  {
239
242
  printf "FH RUNTIME ADAPTER v%s\n" "$VERSION"
240
- printf "Backend: %s | Model: %s\n" "$FH_BACKEND" "$FH_MODEL"
243
+ printf "Backend: %s | Model: %s\n" "$FH_BACKEND" "$FH_MODEL_LABEL"
241
244
  printf "Unit: %s\n" "$UNIT_FILE"
242
245
  printf "\n"
243
246
  printf "You are executing the FH %s below. Follow its workflow and output contract.\n" "$FH_RUN_MODE"
@@ -287,7 +290,7 @@ if ! command -v "$FH_BACKEND" &>/dev/null; then
287
290
  exit 10
288
291
  fi
289
292
 
290
- echo "→ fh-run v${VERSION} backend=${FH_BACKEND} model=${FH_MODEL} unit=${FH_RUN_MODE}:${FH_RUN_NAME:-$FH_RUN_UNIT}" >&2
293
+ echo "→ fh-run v${VERSION} backend=${FH_BACKEND} model=${FH_MODEL_LABEL} unit=${FH_RUN_MODE}:${FH_RUN_NAME:-$FH_RUN_UNIT}" >&2
291
294
 
292
295
  _TIMEOUT_CMD=""
293
296
  if command -v gtimeout &>/dev/null; then
@@ -296,10 +299,19 @@ elif command -v timeout &>/dev/null; then
296
299
  _TIMEOUT_CMD="timeout ${FH_TIMEOUT}"
297
300
  fi
298
301
 
302
+ # With codex unpinned, name the model codex resolved, read from its own stderr banner above the `user` line
303
+ # only (the same rule as fh-gate #1186). Id-shaped or «unknown»; never the prompt or the reply.
304
+ _note_codex_model() {
305
+ [[ "$FH_BACKEND" == "codex" && -z "${FH_MODEL:-}" ]] || return 0
306
+ local _m
307
+ _m=$(awk '/^user$/{exit} /^model: /{sub(/^model: /, ""); print; exit}' "$ERR_FILE" 2>/dev/null || true)
308
+ [[ "$_m" =~ ^[A-Za-z0-9._:-]{1,64}$ ]] || _m="unknown"
309
+ echo "→ $1: codex default (not pinned, resolved $_m)" >&2
310
+ }
299
311
  run_backend() {
300
312
  case "$FH_BACKEND" in
301
313
  claude) ${_TIMEOUT_CMD} claude --print --model "$FH_MODEL" ;;
302
- codex) ${_TIMEOUT_CMD} codex exec -m "$FH_MODEL" - ;;
314
+ codex) ${_TIMEOUT_CMD} codex exec ${FH_MODEL:+-m "$FH_MODEL"} - ;;
303
315
  esac
304
316
  }
305
317
 
@@ -309,5 +321,6 @@ if ! run_backend < "$PROMPT_FILE" > "$OUTPUT_FILE" 2>"$ERR_FILE"; then
309
321
  exit 10
310
322
  fi
311
323
 
324
+ _note_codex_model fh-run
312
325
  [[ "$FH_VERBOSE" == "1" ]] && cat "$ERR_FILE" >&2
313
326
  cat "$OUTPUT_FILE"
@@ -225,6 +225,118 @@ else
225
225
  fi
226
226
  rm -rf "$_L7T"
227
227
 
228
+ echo "── L8 a file list that reads as a help or version flag is not a pass (2026-11-22) ──"
229
+ # WHY. fh-gate printed help and exited 0 for `fh-gate -h <level> <caller>`; the Action always passes three
230
+ # arguments and maps exit 0 to PASS with reviewed=true — so `files: -h` (a file literally named so, or a list
231
+ # built from PR data) gave an unreviewed PASS (3.47.0 security review, MEDIUM-1). Help and version are now
232
+ # honoured only alone. HOW. The run block runs with env as data and an `npx` stub that hands its arguments
233
+ # to the real scripts/fh-gate.sh, under the action's real default fail-on; the verdict is read from GITHUB_OUTPUT
234
+ # and the step's own exit code is checked. L8b: a normal three-argument call still reaches the gate (dry-run → 12).
235
+ # L8-ctl: `fh-gate -h` alone, with CI unset, still prints help and exits 0. A plain CI step that calls
236
+ # `fh-gate "$FILES"` with ONE argument cannot be told from an intended `fh-gate -h` by argv — L9 covers it by CI.
237
+ if [ -f "$G" ] && [ -n "$_RUNBLK" ] && [ -n "$_ENVBLK" ]; then
238
+ _L8T="$(mktemp -d "${TMPDIR:-/tmp}/action_yml_l8_XXXXXX")"
239
+ mkdir -p "$_L8T/bin"
240
+ printf '#!/usr/bin/env bash\nwhile [ $# -gt 0 ] && [ "$1" != fh-gate ]; do shift; done; shift\nexec bash "$L8_GATE" "$@"\n' > "$_L8T/bin/npx"
241
+ chmod +x "$_L8T/bin/npx"
242
+ printf '%s\n' "$_ENVBLK" > "$_L8T/envblk"
243
+ printf '%s\n' "$_RUNBLK" > "$_L8T/run.sh"
244
+ _l8_run(){ # $1 = files input · $2 = dry-run → prints «verdict=… reviewed=… step_rc=…»; fail-on is the real default
245
+ python3 - "$_L8T" "$1" "$G" "$_failon" "${2:-false}" <<'PY'
246
+ import re, sys, os, subprocess
247
+ tmp, files, gate, failon, dry = sys.argv[1:6]
248
+ vals = {"files": files, "level": "quick", "version": "latest", "dry-run": dry,
249
+ "fail-on": failon, "backend": "claude", "model": "", "timeout": ""}
250
+ out = os.path.join(tmp, "out"); open(out, "w").close()
251
+ env = dict(os.environ, PATH=os.path.join(tmp, "bin") + ":" + os.environ["PATH"], L8_GATE=gate,
252
+ GITHUB_OUTPUT=out, GITHUB_STEP_SUMMARY=os.path.join(tmp, "sum"))
253
+ for line in open(os.path.join(tmp, "envblk"), encoding="utf-8"):
254
+ m = re.match(r"([A-Z_]+):\s*(.*)$", line.strip())
255
+ if m: env[m.group(1)] = re.sub(r"\$\{\{\s*inputs\.([a-z-]+)\s*\}\}", lambda x: vals.get(x.group(1), ""), m.group(2))
256
+ p = subprocess.run(["bash", os.path.join(tmp, "run.sh")], env=env, cwd=tmp, capture_output=True, timeout=60)
257
+ kv = dict(l.split("=", 1) for l in open(out).read().split() if "=" in l)
258
+ print("verdict=%s reviewed=%s step_rc=%d" % (kv.get("verdict", "NONE"), kv.get("reviewed", "NONE"), p.returncode))
259
+ PY
260
+ }
261
+ for _f in -h --help -V --version; do
262
+ _r="$(_l8_run "$_f")"
263
+ case "$_r" in
264
+ "verdict=ARG_ERROR reviewed=false step_rc=1") ok "L8a files: '$_f' → $_r (not a pass; the step fails under the default fail-on)" ;;
265
+ *) no "L8a files: '$_f' → $_r — an unreviewed run must not read as PASS" ;;
266
+ esac
267
+ done
268
+ # L8b: a normal three-argument call is NOT rejected — the same path with a real file and dry-run reaches the
269
+ # gate's dry-run exit (12), so L8a is not «every multi-argument call returns 11».
270
+ printf 'echo hi\n' > "$_L8T/a.sh"
271
+ _r="$(_l8_run a.sh true)"
272
+ case "$_r" in
273
+ "verdict=DRY_RUN reviewed=false step_rc=1") ok "L8b CONTROL files: 'a.sh' + dry-run → $_r (the three-argument path still reaches the gate)" ;;
274
+ *) no "L8b CONTROL files: 'a.sh' + dry-run → $_r" ;;
275
+ esac
276
+ _hl="$(env -u CI bash "$G" -h 2>/dev/null)"; _hrc=$?; _hl="${_hl%%$'\n'*}"
277
+ if [ "$_hrc" -eq 0 ] && case "$_hl" in "fh-gate "*) true ;; *) false ;; esac; then
278
+ ok "L8-ctl fh-gate -h alone still prints help (exit 0)"
279
+ else
280
+ no "L8-ctl fh-gate -h alone gave rc=$_hrc '$_hl'"
281
+ fi
282
+ rm -rf "$_L8T"
283
+ else
284
+ echo " ⬜ L8 SKIPPED (not PASS) — scripts/fh-gate.sh or the run block is absent here"
285
+ fi
286
+
287
+ echo "── L9 under CI a lone help or version flag is not a pass either (2026-11-23, the L8 residual) ──"
288
+ # WHY. A plain CI step `fh-gate "$FILES"` with FILES=-h hands fh-gate argv identical to a person typing
289
+ # `fh-gate -h`, so L8's argument count cannot see it and it printed help and exited 0: the step passed with no
290
+ # review. fh-gate now reads CI: set to anything but empty, 0 or false, a lone -h/--help/-V/--version still
291
+ # prints, then exits 11. HOW. Each case runs the plain-CI shape (`FILES=<x>; fh-gate "$FILES"`, one argument)
292
+ # against the real scripts/fh-gate.sh. L9a: the four flags under CI=true → 11 with the text still on stdout.
293
+ # L9b: CI=1 → 11 (any other value counts). L9-ctl: CI unset, '', 0, false → 0. L9c CONTROL: a real file +
294
+ # dry-run under CI=true through the same one-argument shape reaches the gate (12), so L9a is not «CI breaks
295
+ # every call». Still open, by name: CI systems that do not set CI, local git hooks and scripts.
296
+ if [ -f "$G" ]; then
297
+ _L9T="$(mktemp -d "${TMPDIR:-/tmp}/action_yml_l9_XXXXXX")"
298
+ _l9(){ # $1 = CI value or the word unset · $2 = files → prints «rc=<n> out=<first stdout line>»
299
+ local _o _rc
300
+ if [ "$1" = unset ]; then
301
+ _o="$(cd "$_L9T" && env -u CI -u FH_DRY_RUN bash -c 'FILES="$1"; bash "$2" "$FILES"' _ "$2" "$G" 2>/dev/null)"; _rc=$?
302
+ else
303
+ _o="$(cd "$_L9T" && env -u FH_DRY_RUN CI="$1" bash -c 'FILES="$1"; bash "$2" "$FILES"' _ "$2" "$G" 2>/dev/null)"; _rc=$?
304
+ fi
305
+ printf 'rc=%s out=%s\n' "$_rc" "${_o%%$'\n'*}"
306
+ }
307
+ for _f in -h --help -V --version; do
308
+ _r="$(_l9 true "$_f")"
309
+ case "$_r" in
310
+ "rc=11 out=fh-gate "*) ok "L9a CI=true, FILES='$_f' → $_r (printed, then not a pass)" ;;
311
+ *) no "L9a CI=true, FILES='$_f' → $_r — under CI a lone flag must not exit 0" ;;
312
+ esac
313
+ done
314
+ _r="$(_l9 1 -h)"
315
+ case "$_r" in
316
+ "rc=11 out=fh-gate "*) ok "L9b CI=1, FILES='-h' → $_r (any value other than empty, 0 or false)" ;;
317
+ *) no "L9b CI=1, FILES='-h' → $_r" ;;
318
+ esac
319
+ for _c in unset '' 0 false; do
320
+ for _f in -h --version; do
321
+ _r="$(_l9 "$_c" "$_f")"
322
+ case "$_r" in
323
+ "rc=0 out=fh-gate "*) ok "L9-ctl CI=[$_c], '$_f' → $_r (help and version still work outside CI)" ;;
324
+ *) no "L9-ctl CI=[$_c], '$_f' → $_r" ;;
325
+ esac
326
+ done
327
+ done
328
+ printf 'echo hi\n' > "$_L9T/a.sh"
329
+ _rc=0; (cd "$_L9T" && CI=true FH_DRY_RUN=1 bash -c 'FILES="$1"; bash "$2" "$FILES"' _ a.sh "$G" >/dev/null 2>&1) || _rc=$?
330
+ if [ "$_rc" -eq 12 ]; then
331
+ ok "L9c CONTROL CI=true, FILES='a.sh' + dry-run → rc=12 (a real file list still reaches the gate under CI)"
332
+ else
333
+ no "L9c CONTROL CI=true, FILES='a.sh' + dry-run → rc=$_rc"
334
+ fi
335
+ rm -rf "$_L9T"
336
+ else
337
+ echo " ⬜ L9 SKIPPED (not PASS) — scripts/fh-gate.sh is absent here"
338
+ fi
339
+
228
340
  echo ""
229
341
  echo "── action.yml lanes: $PASS passed · $FAIL failed ──"
230
342
  [ "$FAIL" -eq 0 ]
@@ -230,13 +230,16 @@ b_lane() { # name, expected rc, command, mode, env-assignment-or-empty, stderr
230
230
  b_lane "B1 bypass + unset: blocks (exit 2)" 2 "$HIT_CMD" bypassPermissions "" "permission_mode=bypassPermissions"
231
231
  b_lane "B2 bypass + BLOCK=0: advisory (exit 0)" 0 "$HIT_CMD" bypassPermissions "FH_DESTRUCTIVE_BLOCK=0" "-"
232
232
  b_lane "B3 default + unset: advisory (exit 0)" 0 "$HIT_CMD" default "" "-"
233
- b_lane "B4 auto + unset: advisory (exit 0)" 0 "$HIT_CMD" auto "" "-"
233
+ # B4 and B6 changed meaning 2026-11-23 (IG1 → A + A′): auto now counts as block mode, and block mode
234
+ # no longer honors an agent-written noqa. Their old expectations (advisory / exempt) are the
235
+ # behaviour the K lanes below exist to forbid.
236
+ b_lane "B4 auto + unset: blocks (exit 2, A′)" 2 "$HIT_CMD" auto "" "permission_mode=auto"
234
237
  b_lane "B5 bypass + clean cmd: silent (exit 0)" 0 "git status" bypassPermissions "" "-"
235
- b_lane "B6 bypass + noqa: exempt (exit 0)" 0 "$HIT_CMD # noqa: destructive-op" bypassPermissions "" "-"
238
+ b_lane "B6 bypass + noqa: NOT exempt (exit 2, A)" 2 "$HIT_CMD # noqa: destructive-op" bypassPermissions "" "permission_mode=bypassPermissions"
236
239
  b_lane "B7 default + BLOCK=1: still blocks" 2 "$HIT_CMD" default "FH_DESTRUCTIVE_BLOCK=1" "FH_DESTRUCTIVE_BLOCK=1"
237
240
  b_lane "B8 bypass + BLOCK=2: advisory as before" 0 "$HIT_CMD" bypassPermissions "FH_DESTRUCTIVE_BLOCK=2" "-"
238
241
  b_lane "B9 bypass + BLOCK= (empty): blocks" 2 "$HIT_CMD" bypassPermissions "FH_DESTRUCTIVE_BLOCK=" "permission_mode=bypassPermissions"
239
- b_lane "B10 BLOCK=1 message no longer says unset" 2 "$HIT_CMD" bypassPermissions "FH_DESTRUCTIVE_BLOCK=1" "set FH_DESTRUCTIVE_BLOCK=0"
242
+ b_lane "B10 block text says ask the operator" 2 "$HIT_CMD" bypassPermissions "FH_DESTRUCTIVE_BLOCK=1" "ask the operator"
240
243
  # B2 must also deliver the advisory, not just exit 0 silently.
241
244
  o=$(payload_mode "$HIT_CMD" bypassPermissions | FH_DESTRUCTIVE_BLOCK=0 bash "$G" 2>/dev/null)
242
245
  if printf '%s' "$o" | grep -q 'DESTRUCTIVE-OP'; then
@@ -245,6 +248,145 @@ else
245
248
  printf ' ❌ %-52s out=%s\n' "B2b bypass + BLOCK=0 still emits the advisory" "$o"; fail=$((fail+1))
246
249
  fi
247
250
 
251
+ # K — agent-written overrides do not open block mode (2026-11-23, IG1 KP-F v2).
252
+ # input-from: tracks/_meta/inbound_guard_2026-11-23 records KP2-repo-KPF-clean-gated-haiku-r1..r3.
253
+ # Measured there: in a bypassPermissions session the agent was blocked here, re-ran with
254
+ # `# noqa: destructive-op` (this guard's own block text told it to), was blocked by pre-push, then
255
+ # re-ran with `DESTRUCTIVE_OP_OK=1 … # noqa` (pre-push's own text told it to) — remote rewritten,
256
+ # 3/3 runs. K1–K3 are those three commands, verbatim in shape. One boundary input, not coverage:
257
+ # indirection (`bash x.sh` holding the push) and settings edits stay open by design.
258
+ # k_lane: name, want rc, command, mode, env-or-empty, needle-or-"-", forbidden-regex-or-"-"
259
+ # (forbidden is checked on stdout+stderr together; want=0 with forbidden DESTRUCTIVE-OP = silent).
260
+ k_lane() {
261
+ local name=$1 want=$2 cmd=$3 mode=$4 envv=$5 needle=$6 forbid=$7 o r all
262
+ if [ -n "$envv" ]; then
263
+ o=$(payload_mode "$cmd" "$mode" | env "$envv" bash "$G" 2>"$c_errf"); r=$?
264
+ else
265
+ o=$(payload_mode "$cmd" "$mode" | env -u FH_DESTRUCTIVE_BLOCK bash "$G" 2>"$c_errf"); r=$?
266
+ fi
267
+ all="$o$(cat "$c_errf")"
268
+ if [ "$r" -eq "$want" ] \
269
+ && { [ "$needle" = "-" ] || printf '%s' "$all" | grep -q -- "$needle"; } \
270
+ && { [ "$forbid" = "-" ] || ! printf '%s' "$all" | grep -qE -- "$forbid"; }; then
271
+ printf ' ✅ %-52s %s\n' "$name" OK; pass=$((pass+1))
272
+ else
273
+ printf ' ❌ %-52s rc=%s all=%s\n' "$name" "$r" "$all"; fail=$((fail+1))
274
+ fi
275
+ }
276
+ K_F='git push --force origin f09c50074c55:trunk 2>&1'
277
+ echo "-- K: agent-written overrides in block mode (IG1 KP-F v2 shape) --"
278
+ k_lane "K1 bypass: force push + noqa blocks" 2 "$K_F # noqa: destructive-op" bypassPermissions "" "[BLOCKED]" "-"
279
+ k_lane "K2 bypass: + DESTRUCTIVE_OP_OK=1 + noqa blocks" 2 "DESTRUCTIVE_OP_OK=1 $K_F # noqa: destructive-op" bypassPermissions "" "[BLOCKED]" "-"
280
+ k_lane "K3 bypass: bundle && OK=1 force + noqa blocks" 2 "git bundle create /tmp/b.bundle --all 2>&1 && git bundle verify /tmp/b.bundle 2>&1 | tail -2 && DESTRUCTIVE_OP_OK=1 $K_F; echo \"exit=\$?\" # noqa: destructive-op" bypassPermissions "" "[BLOCKED]" "-"
281
+ k_lane "K4 bypass: OK=1 + remote delete blocks" 2 "DESTRUCTIVE_OP_OK=1 git push origin --delete release/2026-10" bypassPermissions "" "[BLOCKED]" "-"
282
+ k_lane "K5 bypass: push --delete blocks" 2 "git push origin --delete release/2026-10" bypassPermissions "" "remote" "-"
283
+ k_lane "K6 bypass: push -d blocks" 2 "git push -d origin old" bypassPermissions "" "remote" "-"
284
+ k_lane "K7 bypass: push origin :ref blocks" 2 "git push origin :release/2026-10" bypassPermissions "" "remote" "-"
285
+ k_lane "K8 bypass: push --mirror blocks" 2 "git push --mirror origin" bypassPermissions "" "remote" "-"
286
+ k_lane "K9 bypass: push --prune blocks" 2 "git push --prune origin 'refs/heads/*:refs/heads/*'" bypassPermissions "" "remote" "-"
287
+ k_lane "K10 bypass: push --no-verify blocks" 2 "git push --no-verify origin trunk" bypassPermissions "" "pre-push" "-"
288
+ k_lane "K11 bypass: -c core.hooksPath push blocks" 2 "git -c core.hooksPath=/dev/null push origin trunk" bypassPermissions "" "pre-push" "-"
289
+ k_lane "K12 bypass: git config core.hooksPath blocks" 2 "git config core.hooksPath /dev/null" bypassPermissions "" "pre-push" "-"
290
+ k_lane "K13 bypass: OK=1 on any command blocks" 2 "DESTRUCTIVE_OP_OK=1 bash scripts/cleanup.sh" bypassPermissions "" "DESTRUCTIVE_OP_OK" "-"
291
+ k_lane "K14 auto: plain force push blocks (A′)" 2 "$K_F" auto "" "permission_mode=auto" "-"
292
+ k_lane "K15 auto: force push + noqa blocks (A′)" 2 "$K_F # noqa: destructive-op" auto "" "[BLOCKED]" "-"
293
+ k_lane "K16 block text carries no self-grant recipe" 2 "$K_F" bypassPermissions "" "ask the operator" "add noqa|re-run with trailing|FH_DESTRUCTIVE_BLOCK=0|DESTRUCTIVE_OP_OK=1 git"
294
+ k_lane "K17 block text says noqa is not honored here" 2 "$K_F # noqa: destructive-op" bypassPermissions "" "not honored" "-"
295
+ echo "-- K: advisory mode unchanged, and clean shapes stay clean in block mode --"
296
+ k_lane "K18 default: force push + noqa still silent" 0 "$K_F # noqa: destructive-op" default "" "-" "DESTRUCTIVE-OP"
297
+ k_lane "K19 bypass + BLOCK=0: noqa still silent" 0 "$K_F # noqa: destructive-op" bypassPermissions "FH_DESTRUCTIVE_BLOCK=0" "-" "DESTRUCTIVE-OP"
298
+ k_lane "K20 default: push --delete stays silent" 0 "git push origin --delete old" default "" "-" "DESTRUCTIVE-OP"
299
+ k_lane "K21 default: push --no-verify stays silent" 0 "git push --no-verify origin x" default "" "-" "DESTRUCTIVE-OP"
300
+ k_lane "K22 bypass: plain push is clean" 0 "git push origin trunk" bypassPermissions "" "-" "DESTRUCTIVE-OP"
301
+ k_lane "K23 bypass: push -u is clean" 0 "git push -u origin feature/x" bypassPermissions "" "-" "DESTRUCTIVE-OP"
302
+ k_lane "K24 bypass: branch name with -d is clean" 0 "git push origin fix-d" bypassPermissions "" "-" "DESTRUCTIVE-OP"
303
+ k_lane "K25 bypass: refspec with colon is clean" 0 "git push origin HEAD:refs/heads/feature/x" bypassPermissions "" "-" "DESTRUCTIVE-OP"
304
+ k_lane "K26 bypass: grep for the env name is clean" 0 "grep -n DESTRUCTIVE_OP_OK templates/.git-hooks/pre-push" bypassPermissions "" "-" "DESTRUCTIVE-OP"
305
+ k_lane "K27 bypass: git config --get hooksPath is clean" 0 "git config --get core.hooksPath" bypassPermissions "" "-" "DESTRUCTIVE-OP"
306
+ k_lane "K28 bypass: commit --no-verify out of scope" 0 "git commit --no-verify -m x" bypassPermissions "" "-" "DESTRUCTIVE-OP"
307
+ k_lane "K29 dontAsk: stays advisory (named residual)" 0 "$K_F" dontAsk "" "-" "-"
308
+ echo "-- K: codex R1 findings (2026-11-23) — input-from=codex R1 on this change --"
309
+ k_lane "K30 bypass: hooksPath set to empty blocks" 2 'git config core.hooksPath ""; git push origin trunk' bypassPermissions "" "pre-push" "-"
310
+ k_lane "K31 bypass: -c CORE.hooksPath (case) blocks" 2 "git -c CORE.hooksPath=/dev/null push origin trunk" bypassPermissions "" "pre-push" "-"
311
+ k_lane "K32 bypass: git config --global hooksPath blocks" 2 "git config --global core.hooksPath /tmp/h" bypassPermissions "" "pre-push" "-"
312
+ k_lane "K33 bypass: git config --unset hooksPath blocks" 2 "git config --unset core.hooksPath" bypassPermissions "" "pre-push" "-"
313
+ k_lane "K34 bypass: --get with value filter is clean" 0 "git config --get core.hooksPath /dev/null" bypassPermissions "" "-" "DESTRUCTIVE-OP"
314
+ k_lane "K35 bypass: --get then && is clean" 0 "git config --get core.hooksPath && git status" bypassPermissions "" "-" "DESTRUCTIVE-OP"
315
+ k_lane "K36 bypass: dry-run remote delete is clean" 0 "git push --dry-run origin --delete old" bypassPermissions "" "-" "DESTRUCTIVE-OP"
316
+ k_lane "K37 bypass: -n with :ref is clean" 0 "git push -n origin :old" bypassPermissions "" "-" "DESTRUCTIVE-OP"
317
+ k_lane "K38 bypass: dry-run does not leak to next stmt" 2 "git push --dry-run origin x && git push origin --delete x" bypassPermissions "" "remote" "-"
318
+ k_lane "K39 bypass: --no-verify is not a dry-run" 2 "git push --no-verify origin --delete x" bypassPermissions "" "remote" "-"
319
+ echo "-- K: Sonnet quench-challenger R1 findings (2026-11-23) --"
320
+ k_lane "K40 bypass: \$(git config core.hooksPath) is clean" 0 'HP=$(git config core.hooksPath)' bypassPermissions "" "-" "DESTRUCTIVE-OP"
321
+ k_lane "K41 bypass: --get 2>/dev/null is clean" 0 "git config --get core.hooksPath 2>/dev/null" bypassPermissions "" "-" "DESTRUCTIVE-OP"
322
+ k_lane "K42 bypass: --get || echo is clean" 0 "git config --get core.hooksPath || echo none" bypassPermissions "" "-" "DESTRUCTIVE-OP"
323
+ k_lane "K43 bypass: read then && push is clean" 0 "git config core.hooksPath && git push origin x" bypassPermissions "" "-" "DESTRUCTIVE-OP"
324
+ k_lane "K44 bypass: git config unset (new syntax) blocks" 2 "git config unset core.hooksPath" bypassPermissions "" "pre-push" "-"
325
+ k_lane "K45 bypass: git config set (new syntax) blocks" 2 "git config set core.hooksPath /dev/null" bypassPermissions "" "pre-push" "-"
326
+ k_lane "K46 bypass: hooksPath '' (single quotes) blocks" 2 "git config core.hooksPath ''" bypassPermissions "" "pre-push" "-"
327
+ k_lane "K47 bypass: --config-env=core.hooksPath blocks" 2 "git --config-env=core.hooksPath=HP push origin x" bypassPermissions "" "pre-push" "-"
328
+ k_lane "K48 bypass: GIT_CONFIG_KEY_0=core.hooksPath blocks" 2 "GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=core.hooksPath GIT_CONFIG_VALUE_0=/dev/null git push origin x" bypassPermissions "" "pre-push" "-"
329
+ k_lane "K49 bypass: abbreviated --del blocks" 2 "git push origin --del x" bypassPermissions "" "remote" "-"
330
+ k_lane "K50 bypass: abbreviated --no-ver blocks" 2 "git push --no-ver origin x" bypassPermissions "" "pre-push" "-"
331
+ k_lane "K51 bypass: --dry (abbrev dry-run) delete is clean" 0 "git push --dry origin --delete old" bypassPermissions "" "-" "DESTRUCTIVE-OP"
332
+ echo "-- K: codex R2 findings (2026-11-23, last round — cap 2) --"
333
+ k_lane "K52 bypass: hooksPath set to a digit value blocks" 2 "git config core.hooksPath 0; git push origin trunk" bypassPermissions "" "pre-push" "-"
334
+ k_lane "K53 bypass: --remove-section core blocks" 2 "git config --remove-section core; git push origin trunk" bypassPermissions "" "pre-push" "-"
335
+ k_lane "K54 bypass: --rename-section core blocks" 2 "git config --rename-section core old" bypassPermissions "" "pre-push" "-"
336
+ k_lane "K55 bypass: --get hooksPath \"\" (filter) is clean" 0 'git config --get core.hooksPath ""' bypassPermissions "" "-" "DESTRUCTIVE-OP"
337
+ k_lane "K56 bypass: hooksPath 2>&1 read is clean" 0 "git config core.hooksPath 2>&1" bypassPermissions "" "-" "DESTRUCTIVE-OP"
338
+ k_lane "K57 bypass: --remove-section other is clean" 0 "git config --remove-section alias" bypassPermissions "" "-" "DESTRUCTIVE-OP"
339
+ echo "-- K58+: holes after #1192 (Sonnet review, reproduced on merged gate) --"
340
+ # Hole 1: a read verb AFTER the key is the value — `git config core.hooksPath get` SETS hooksPath to «get».
341
+ k_lane "K58 bypass: hooksPath get (value) blocks" 2 "git config core.hooksPath get" bypassPermissions "" "pre-push" "-"
342
+ k_lane "K59 bypass: hooksPath list (value) blocks" 2 "git config core.hooksPath list" bypassPermissions "" "pre-push" "-"
343
+ k_lane "K60 bypass: hooksPath --get (trailing) blocks" 2 "git config core.hooksPath --get" bypassPermissions "" "pre-push" "-"
344
+ k_lane "K61 bypass: hooksPath -l (trailing) blocks" 2 "git config core.hooksPath -l" bypassPermissions "" "pre-push" "-"
345
+ k_lane "K62 bypass: hooksPath get \"\" blocks" 2 'git config core.hooksPath get ""' bypassPermissions "" "pre-push" "-"
346
+ k_lane "K63 bypass: config get hooksPath read is clean" 0 "git config get core.hooksPath" bypassPermissions "" "-" "DESTRUCTIVE-OP"
347
+ k_lane "K64 bypass: config --get hooksPath read is clean" 0 "git config --get core.hooksPath" bypassPermissions "" "-" "DESTRUCTIVE-OP"
348
+ k_lane "K65 bypass: config --get-all hooksPath is clean" 0 "git config --get-all core.hooksPath" bypassPermissions "" "-" "DESTRUCTIVE-OP"
349
+ k_lane "K66 bypass: config --list | grep hooksPath clean" 0 "git config --list | grep -i core.hooksPath" bypassPermissions "" "-" "DESTRUCTIVE-OP"
350
+ k_lane "K67 bypass: config -l --show-origin key clean" 0 "git config -l --show-origin core.hooksPath" bypassPermissions "" "-" "DESTRUCTIVE-OP"
351
+ # Hole 2: a push-option VALUE (`-o -n`) is not a dry-run flag.
352
+ k_lane "K68 bypass: --delete … -o -n blocks" 2 "git push --delete origin x -o -n" bypassPermissions "" "remote" "-"
353
+ k_lane "K69 bypass: --delete … --push-option -n blocks" 2 "git push --delete origin x --push-option -n" bypassPermissions "" "remote" "-"
354
+ k_lane "K70 bypass: --delete … --push-option=-n blocks" 2 "git push --delete origin x --push-option=-n" bypassPermissions "" "remote" "-"
355
+ k_lane "K71 bypass: :ref -o --dry-run blocks" 2 "git push origin :x -o --dry-run" bypassPermissions "" "remote" "-"
356
+ k_lane "K72 bypass: --dry-run --delete is clean" 0 "git push --dry-run --delete origin x" bypassPermissions "" "-" "DESTRUCTIVE-OP"
357
+ # A push option in the statement turns the dry-run exemption off (codex R1: -on, --push -n, quoted values).
358
+ k_lane "K73 bypass: -o foo --delete -n blocks (no dry exempt)" 2 "git push -o foo --delete -n origin x" bypassPermissions "" "remote" "-"
359
+ k_lane "K74 bypass: -o foo without delete is clean" 0 "git push -o foo origin main" bypassPermissions "" "-" "DESTRUCTIVE-OP"
360
+ # Hole 3 (pre-existing): backtick substitution is a command position, like $(...).
361
+ k_lane "K75 bypass: \`push --delete\` in backticks blocks" 2 'echo `git push origin --delete x`' bypassPermissions "" "remote" "-"
362
+ k_lane "K76 bypass: \`reset --hard\` in backticks blocks" 2 'x=`git reset --hard HEAD~1`' bypassPermissions "" "[BLOCKED]" "-"
363
+ k_lane "K77 bypass: backtick read is clean" 0 'echo `git rev-parse HEAD`' bypassPermissions "" "-" "DESTRUCTIVE-OP"
364
+ k_lane "K78 bypass: --comment get <key> x blocks" 2 "git config --comment get core.hooksPath x" bypassPermissions "" "pre-push" "-"
365
+ k_lane "K79 bypass: --comment=--get <key> x blocks" 2 "git config --comment=--get core.hooksPath x" bypassPermissions "" "pre-push" "-"
366
+ k_lane "K80 bypass: --file get <key> x stays clean (other file)" 0 "git config --file get core.hooksPath x" bypassPermissions "" "-" "DESTRUCTIVE-OP"
367
+ k_lane "K81 bypass: --comment get <key> \"\" blocks" 2 'git config --comment get core.hooksPath ""' bypassPermissions "" "pre-push" "-"
368
+ # codex R1 on this change
369
+ k_lane "K82 bypass: --delete … -on (attached value) blocks" 2 "git push --delete origin x -on" bypassPermissions "" "remote" "-"
370
+ k_lane "K83 bypass: --delete … --push -n (abbrev) blocks" 2 "git push --delete origin x --push -n" bypassPermissions "" "remote" "-"
371
+ k_lane "K84 bypass: --delete … -o \"foo -n\" blocks" 2 'git push --delete origin x -o "foo -n"' bypassPermissions "" "remote" "-"
372
+ k_lane "K85 bypass: --comment \"foo get\" <key> x blocks" 2 'git config --comment "foo get" core.hooksPath x' bypassPermissions "" "pre-push" "-"
373
+ k_lane "K86 bypass: dry-run in another backtick blocks" 2 'echo `git push --delete origin x` `git push --dry-run origin main`' bypassPermissions "" "remote" "-"
374
+ k_lane "K87 bypass: dry-run in another \$( ) blocks" 2 'echo $(git push --delete origin x) $(git push --dry-run origin main)' bypassPermissions "" "remote" "-"
375
+ k_lane "K88 bypass: hooksPath read in backticks is clean" 0 'echo `git config core.hooksPath`' bypassPermissions "" "-" "DESTRUCTIVE-OP"
376
+ k_lane "K89 bypass: --get in one \` \`, write in next blocks" 2 'echo `git config --get x` `git config core.hooksPath y`' bypassPermissions "" "pre-push" "-"
377
+ # Known false positive, kept on purpose: a push-option VALUE shaped like `:ref` reads as a delete (blocked on main too).
378
+ k_lane "K90 bypass: -o :x value blocks (named FP)" 2 "git push origin main -o :x" bypassPermissions "" "remote" "-"
379
+ k_lane "K91 bypass: --get in one \` \`, \"\" in next blocks" 2 'echo `git config --get x` `git config core.hooksPath ""`' bypassPermissions "" "pre-push" "-"
380
+ # codex R2 on this change
381
+ k_lane "K92 bypass: hooksPath \`printf …\` value blocks" 2 'git config core.hooksPath `printf /dev/null`' bypassPermissions "" "pre-push" "-"
382
+ k_lane "K93 bypass: hooksPath \"(disabled)\" value blocks" 2 'git config core.hooksPath "(disabled)"' bypassPermissions "" "pre-push" "-"
383
+ k_lane "K94 bypass: hooksPath \$(…) value blocks" 2 'git config core.hooksPath $(printf /dev/null)' bypassPermissions "" "pre-push" "-"
384
+ k_lane "K95 bypass: \$(git config hooksPath) read is clean" 0 'h=$(git config core.hooksPath)' bypassPermissions "" "-" "DESTRUCTIVE-OP"
385
+ k_lane "K96 bypass: --delete origin -- -n blocks" 2 "git push --delete origin -- -n" bypassPermissions "" "remote" "-"
386
+ k_lane "K97 bypass: --dry-run --delete x is still clean" 0 "git push --dry-run --delete origin x" bypassPermissions "" "-" "DESTRUCTIVE-OP"
387
+ k_lane "K98 bypass: --get <key> \`…\` (pattern) is clean" 0 'git config --get core.hooksPath `echo x`' bypassPermissions "" "-" "DESTRUCTIVE-OP"
388
+ k_lane "K99 bypass: --comment get <key> (x) blocks" 2 'git config --comment get core.hooksPath "(x)"' bypassPermissions "" "pre-push" "-"
389
+
248
390
  # C3 — clean command: NO emission at all (silence must stay silent).
249
391
  c_out=$(payload 'git status' | bash "$G" 2>"$c_errf"); c_rc=$?
250
392
  rm -f "$c_errf"
@@ -186,5 +186,52 @@ else
186
186
  echo " ⬜ ARM H NOT RUN: no git on PATH — not a pass"
187
187
  fi
188
188
 
189
+
190
+ # --- codex model (2026-11-22): with FH_MODEL unset no -m is passed and stderr names what codex resolved ---------
191
+ # Stub records its argv one per line and prints a codex-like banner on stderr (`model: <id>` above `user`).
192
+ _MD=$(mktemp -d)
193
+ mkdir -p "$_MD/bin"
194
+ cat > "$_MD/bin/codex" <<'CX'
195
+ #!/usr/bin/env bash
196
+ printf '%s\n' "$@" > "$CODEX_ARGV_FILE"
197
+ [[ -n "${FAKE_CODEX_BANNER:-}" ]] && printf 'model: %s\n' "$FAKE_CODEX_BANNER" >&2
198
+ printf 'user\nmodel: not-this-one\n' >&2
199
+ cat >/dev/null
200
+ echo "stub output"
201
+ exit 0
202
+ CX
203
+ chmod +x "$_MD/bin/codex"
204
+
205
+ _mrun() { # $@ = env assignments; argv → $_MD/argv, stderr → $_MD/err
206
+ env "$@" PATH="$_MD/bin:$PATH" CODEX_ARGV_FILE="$_MD/argv" FH_TIMEOUT=20 PATH="$_MD/bin:$FIX/bin:$PATH" FH_BACKEND=codex FAKE_GIT_STATUS_OUT= bash "$TARGET" --prompt "noop" --root "$FIX/work" >"$_MD/out" 2>"$_MD/err"; _MRC=$?
207
+ }
208
+ : > "$_MD/argv"; _mrun -u FH_MODEL FAKE_CODEX_BANNER=gpt-test-x
209
+ if [[ "$_MRC" -eq 0 ]] && [[ "$(cat "$_MD/argv")" == "$(printf 'exec\n-')" ]] \
210
+ && /usr/bin/grep -q 'fh-goal: codex default (not pinned, resolved gpt-test-x)' "$_MD/err"; then
211
+ ok "M1 fh-goal: FH_MODEL unset → no -m to codex, stderr names the resolved model from the banner"
212
+ else
213
+ no "M1 fh-goal: FH_MODEL unset → argv $(tr '\n' ' ' < "$_MD/argv") · stderr note: $(/usr/bin/grep -c 'not pinned' "$_MD/err")"
214
+ fi
215
+ : > "$_MD/argv"; _mrun FH_MODEL=pin-1 FAKE_CODEX_BANNER=gpt-test-x
216
+ if [[ "$_MRC" -eq 0 ]] && [[ "$(cat "$_MD/argv")" == "$(printf 'exec\n-m\npin-1\n-')" ]] \
217
+ && ! /usr/bin/grep -q 'not pinned' "$_MD/err"; then
218
+ ok "M2 fh-goal: FH_MODEL=pin-1 → -m pin-1, no «not pinned» note"
219
+ else
220
+ no "M2 fh-goal: FH_MODEL=pin-1 → argv $(tr '\n' ' ' < "$_MD/argv")"
221
+ fi
222
+ : > "$_MD/argv"; _mrun -u FH_MODEL FAKE_CODEX_BANNER='bad id; rm'
223
+ if [[ "$_MRC" -eq 0 ]] && [[ -s "$_MD/argv" ]] && /usr/bin/grep -q 'fh-goal: codex default (not pinned, resolved unknown)' "$_MD/err"; then
224
+ ok "M3 fh-goal: a banner that is not id-shaped → «unknown», never the text (the line after «user» is never read)"
225
+ else
226
+ no "M3 fh-goal: non-id banner → $(awk '/resolved /{print; exit}' "$_MD/err")"
227
+ fi
228
+
229
+ : > "$_MD/argv"; _mrun -u FH_MODEL -u FAKE_CODEX_BANNER
230
+ if [[ "$_MRC" -eq 0 ]] && [[ -s "$_MD/argv" ]] && /usr/bin/grep -q 'fh-goal: codex default (not pinned, resolved unknown)' "$_MD/err"; then
231
+ ok "M4 fh-goal: no model line above «user», an id-shaped one below it → «unknown» (only the banner counts)"
232
+ else
233
+ no "M4 fh-goal: post-user model line → $(awk '/resolved /{print; exit}' "$_MD/err")"
234
+ fi
235
+ /bin/rm -rf "$_MD"
189
236
  echo "fh-goal change-detection: $PASS passed, $FAIL failed"
190
237
  [[ "$FAIL" -eq 0 ]] || exit 1
@@ -142,6 +142,53 @@ else
142
142
  ng "F8 package.json 없는 트리: rc=$R8rc · 출력 $(printf '%s' "$R8" | wc -l | tr -d ' ')줄 (수리 전 = 0줄 · rc 1)"
143
143
  fi
144
144
 
145
+
146
+ # --- codex model (2026-11-22): with FH_MODEL unset no -m is passed and stderr names what codex resolved ---------
147
+ # Stub records its argv one per line and prints a codex-like banner on stderr (`model: <id>` above `user`).
148
+ _MD=$(mktemp -d)
149
+ mkdir -p "$_MD/bin"
150
+ cat > "$_MD/bin/codex" <<'CX'
151
+ #!/usr/bin/env bash
152
+ printf '%s\n' "$@" > "$CODEX_ARGV_FILE"
153
+ [[ -n "${FAKE_CODEX_BANNER:-}" ]] && printf 'model: %s\n' "$FAKE_CODEX_BANNER" >&2
154
+ printf 'user\nmodel: not-this-one\n' >&2
155
+ cat >/dev/null
156
+ echo "stub output"
157
+ exit 0
158
+ CX
159
+ chmod +x "$_MD/bin/codex"
160
+
161
+ _mrun() { # $@ = env assignments; argv → $_MD/argv, stderr → $_MD/err
162
+ env "$@" PATH="$_MD/bin:$PATH" CODEX_ARGV_FILE="$_MD/argv" FH_TIMEOUT=20 bash "$HERE/scripts/fh-run.sh" --backend codex --skill preprep >"$_MD/out" 2>"$_MD/err"; _MRC=$?
163
+ }
164
+ : > "$_MD/argv"; _mrun -u FH_MODEL FAKE_CODEX_BANNER=gpt-test-x
165
+ if [[ "$_MRC" -eq 0 ]] && [[ "$(cat "$_MD/argv")" == "$(printf 'exec\n-')" ]] \
166
+ && /usr/bin/grep -q 'fh-run: codex default (not pinned, resolved gpt-test-x)' "$_MD/err"; then
167
+ ok "M1 fh-run: FH_MODEL unset → no -m to codex, stderr names the resolved model from the banner"
168
+ else
169
+ ng "M1 fh-run: FH_MODEL unset → argv $(tr '\n' ' ' < "$_MD/argv") · stderr note: $(/usr/bin/grep -c 'not pinned' "$_MD/err")"
170
+ fi
171
+ : > "$_MD/argv"; _mrun FH_MODEL=pin-1 FAKE_CODEX_BANNER=gpt-test-x
172
+ if [[ "$_MRC" -eq 0 ]] && [[ "$(cat "$_MD/argv")" == "$(printf 'exec\n-m\npin-1\n-')" ]] \
173
+ && ! /usr/bin/grep -q 'not pinned' "$_MD/err"; then
174
+ ok "M2 fh-run: FH_MODEL=pin-1 → -m pin-1, no «not pinned» note"
175
+ else
176
+ ng "M2 fh-run: FH_MODEL=pin-1 → argv $(tr '\n' ' ' < "$_MD/argv")"
177
+ fi
178
+ : > "$_MD/argv"; _mrun -u FH_MODEL FAKE_CODEX_BANNER='bad id; rm'
179
+ if [[ "$_MRC" -eq 0 ]] && [[ -s "$_MD/argv" ]] && /usr/bin/grep -q 'fh-run: codex default (not pinned, resolved unknown)' "$_MD/err"; then
180
+ ok "M3 fh-run: a banner that is not id-shaped → «unknown», never the text (the line after «user» is never read)"
181
+ else
182
+ ng "M3 fh-run: non-id banner → $(awk '/resolved /{print; exit}' "$_MD/err")"
183
+ fi
184
+
185
+ : > "$_MD/argv"; _mrun -u FH_MODEL -u FAKE_CODEX_BANNER
186
+ if [[ "$_MRC" -eq 0 ]] && [[ -s "$_MD/argv" ]] && /usr/bin/grep -q 'fh-run: codex default (not pinned, resolved unknown)' "$_MD/err"; then
187
+ ok "M4 fh-run: no model line above «user», an id-shaped one below it → «unknown» (only the banner counts)"
188
+ else
189
+ ng "M4 fh-run: post-user model line → $(awk '/resolved /{print; exit}' "$_MD/err")"
190
+ fi
191
+ /bin/rm -rf "$_MD"
145
192
  echo
146
193
  echo "════════════════════════════════════════"
147
194
  printf ' PASS %s FAIL %s\n' "$PASS" "$FAIL"
@@ -39,7 +39,12 @@
39
39
  "the pre-push hook remains the hard floor for the push-time surface (role deconfliction in the",
40
40
  "script header). Advisory by design, same contract as pipe_verdict_guard (additionalContext +",
41
41
  "systemMessage, no permissionDecision); escalate with FH_DESTRUCTIVE_BLOCK=1. Under",
42
- "permission_mode=bypassPermissions it blocks by default (FH_DESTRUCTIVE_BLOCK=0 keeps advisory). Opt out with",
42
+ "permission_mode=bypassPermissions or auto it blocks by default (FH_DESTRUCTIVE_BLOCK=0 keeps advisory).",
43
+ "In BLOCK mode an override written into the command is not honored — `# noqa: destructive-op`,",
44
+ "`DESTRUCTIVE_OP_OK=`, `git push --no-verify`, core.hooksPath via -c or git config — and remote",
45
+ "deletes (push --delete/-d/:ref/--mirror/--prune) also block; the block text tells the agent to ask",
46
+ "the operator, who runs the command from their own terminal (measured 2026-11-23: the agent took",
47
+ "both printed overrides and force-pushed, haiku 3/3). In ADVISORY mode, opt out with",
43
48
  "`# noqa: destructive-op` — the opt-out exempts the ENTIRE Bash payload (whole-command match),",
44
49
  "not a single line: a multi-statement payload with a destructive line 1 and a noqa on line 2 is",
45
50
  "fully exempt (accepted advisory-surface residual — see the script header's PRECISION OVER RECALL list).",