Skip to content

feat(hooks): ask before an agent adds a lint suppression - #214

Merged
furedea merged 1 commit into
mainfrom
feat/ask-before-new-suppressions
Oct 18, 2026
Merged

furedea merged 1 commit into
mainfrom
feat/ask-before-new-suppressions

Conversation

@furedea-agent

@furedea-agent furedea-agent Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Part of #213. The numeric AGENTS.md rules become lint limits, and a real exception gets a per-site suppression with a reason. This PR makes adding such a suppression the user's decision.

  • agents/hooks/guard_suppression.py: an edit asks when it adds more suppression markers to a code file than it removes:
    • noqa, type: ignore, pyright: ignore, pylint: disable;
    • oxlint-disable, eslint-disable, biome-ignore, @ts-ignore, @ts-expect-error;
    • #[allow], #[expect];
    • shellcheck disable.
  • What passes: moving or removing a suppression, prose in non-code files such as Markdown, and edits without markers.
  • Coverage: it handles Edit, MultiEdit, Write (compared with the file on disk), and Codex apply_patch (per file).
  • Claude: the Write|Edit|NotebookEdit PreToolUse hook asks.
  • Codex: hook_adapter.py content suppression denies. Codex 0.163 treats a PreToolUse ask as unsupported and lets the call through (unsupported_permission_decision_fails_open). The denial tells Codex to ask the user instead.
  • Cost: only a few regex counts over the edit text.

Refs #213

Verification

  • uv run --frozen pytest tests: 1564 passed. New contracts cover:
    • six marker kinds across Python, TypeScript, and Rust;
    • a Write compared with the existing file;
    • moved, removed, prose, and marker-free edits that pass;
    • an apply_patch that asks;
    • the reason naming the file and the marker;
    • the Codex adapter denying.
  • ruff and ty passed.

🤖 Generated with Claude Code

The numeric AGENTS.md rules move into lint, with real exceptions
suppressed per site. Whether an exception is real is the user's call, so
an edit that adds more noqa, type: ignore, oxlint/eslint-disable,
@ts-expect-error, #[allow]/#[expect], or shellcheck markers to a code
file than it removes asks in Claude. Codex hooks cannot ask (an ask
fails open there), so Codex gets a denial and must ask the user.

Refs #213

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@furedea
furedea merged commit 8e2ffb2 into main Oct 18, 2026
11 checks passed
@furedea
furedea deleted the feat/ask-before-new-suppressions branch October 18, 2026 09:38
furedea added a commit that referenced this pull request Nov 11, 2026
agent-config と agent-harness
の最新を取り込みます.検証の記録を書き換えられなくする修正と,モデル判定でトークンやファイルが外に漏れる経路をふさぐ修正が入ります.

| 入力 | 取り込む変更 |
| --- | --- |
| agent-config | #154(検証の記録を守る),#156(トークンやファイルが漏れる経路をふさぐ) |
| agent-harness | #214(設定の `denyWrite` を残す),0.9.12 |

- [x] `darwin-rebuild switch` で反映済み
- [x] 生成された `~/.claude/settings.json` の sandbox `denyWrite` に
`~/.local/state/agent-harness/{verification,model-rules,trusted-owners,audit}`
が入っている
- [x] エージェントのシェルから `verification/` に書き込むと `Operation not permitted`
で失敗する(furedea/agent-config#153 を閉じた)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: furedea <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
furedea added a commit that referenced this pull request Nov 16, 2026
agent-config の PostToolUse フックが ADR 編集後に実行する `adr-check` を PATH
に置く.`jev-lint` と同じ方法で `home.packages` に追加し,`agent-config` 入力を #225
を含むリビジョンに更新する.

Refs furedea/agent-config#169

## 変更内容

- `nix/home/default.nix`: `adrCheckPackage =
agent-config.packages.${system}.adr-check;` を `jevLintPackage`
の隣に追加し,`home.packages` に加えた(furedea/agent-config#225).
- `flake.lock`: `agent-config` を `2ab23eb` → `138c542` に更新した(`nix flake
update agent-config`).

## agent-config の更新内容(2ab23eb → 138c542,23 コミット)

- lint: go-style / rust-style / python-style / TypeScript / bash-style /
github-actions-style / agents/AGENTS.md のルールを ast-grep・jev-lint・model
rules へ移行(#190, #191, #192, #193, #194, #195),Go の `util`・`common`
パッケージ検出(#202),ブロッキング ast-grep ルールの欠落修正(#216)
- hooks: 静的ルールエラーでの編集ブロックと ast-grep-ignore の保護(#203),ask
プレフィックスの限定(#199),リポジトリフック回避オプションの拒否(#212),コードセルの判定修正(#224)
- skills: issue / git / setup ワークフローを `development-cycle`
に統合(#211),agent 実行の verify ステップ削除(#213),範囲外指摘への回答と all-green 待機(#223)
- docs/ADR: MADR の採用(#215),スキル責務の配置(#208),コマンド判定の方針(#198),ast-grep
のブロック方針(#214),AGENTS.md の整理(#205)
- build/ci: マイナーバージョン上げの設定(#217),jev-lint モデルルールテストを CI で実行(#218)
- feat: `adr-check` コマンドの追加(#225)

## 検証

- `nix build '.#homeConfigurations."kaito@mbp".activationPackage'`:
成功.生成物の `home-path/bin` に `adr-check` が含まれることを確認した.
- `darwin-rebuild switch` は実行していない.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: furedea <[email protected]>
Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant