Repository navigation
docs(adr): amend ADR-0021 to one jev-lint review per Stop - #142
Conversation
Replace the per-rule, per-file jev-lint call and the harness-side cache with a single `jev-lint review --json` at Stop over the functions changed in the session. Reuse jev-lint's own verdict cache, stored outside the repository because jev-lint treats it as trusted input. Send code only for repositories that trusted_owners trusts, cap subjects per Stop, add an AGENT_MODEL_RULES=off kill switch, and name the first rules (M-05, M-21, M-60). ADR-0021 stays Proposed. Refs #74 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The tooling reference told readers not to enable clippy::pedantic at project start, while its own recommended config and the Rust templates enable it. State the actual rule: enable pedantic as warn, and allow an individual lint only with a reason. Refs #74 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
| - Forbid `unsafe` by default. | ||
| - Do not enable broad lint sets such as `clippy::pedantic` at project start. | ||
| - Add targeted lint configuration only when it catches mistakes the project actually cares about. | ||
| - Enable `clippy::pedantic` as `warn`. |
There was a problem hiding this comment.
P2 The new rule says to enable clippy::pedantic as warn, but the "Recommended package-level guard" a few lines below still has no pedantic entry. An agent that copies the snippet won't enable pedantic, so the bullet and the snippet still disagree, which is the mismatch this PR set out to fix. The snippet should say pedantic = { level = "warn", priority = -1 }. The priority = -1 part matters: without it, a group plus per-lint allows in the same [lints.clippy] table trips clippy::lint_groups_priority, and that becomes an error under the -D warnings gate above.
There was a problem hiding this comment.
Fixed in b612d11: the snippet now has pedantic = { level = "warn", priority = -1 }, and the bullet mentions the priority.
| - Do not enable broad lint sets such as `clippy::pedantic` at project start. | ||
| - Add targeted lint configuration only when it catches mistakes the project actually cares about. | ||
| - Enable `clippy::pedantic` as `warn`. | ||
| - Allow an individual lint only with a reason: `#[expect(..., reason = "...")]` at the site, or a `Cargo.toml` allow with a comment. |
There was a problem hiding this comment.
P2 "or a Cargo.toml allow with a comment" points agents around the suppression review. agents/hooks/guard_suppression.py asks the user about a new #[allow]/#[expect] only in files whose suffix is in CODE_SUFFIXES, and .toml isn't one of them. A crate-wide [lints.clippy] some_lint = "allow" in Cargo.toml therefore goes through with no prompt, even though it covers more code than a single #[expect] at the site. Either drop the Cargo.toml option for agents, or say that it needs the user's approval the same way a per-site suppression does.
There was a problem hiding this comment.
Fixed in b612d11: the bullet now says a crate-wide Cargo.toml allow needs the user approval, the same as a per-site suppression.
| single `jev-lint review --json` over the session's uncommitted changes with all model rules (`-R <rules dir>`), not | ||
| per edit and not once per rule and file. | ||
| - **Subjects and context.** `jev-lint` selects the subjects with each rule's ast-grep matcher and judges per function | ||
| (the rule's `subject:`). Each subject is judged with the function plus the same file's imports and enclosing | ||
| declarations (state arm `local`); no other file is sent. Only functions changed in the session are judged, at most |
There was a problem hiding this comment.
P2 The ADR gives two different scopes. The review call runs over "the session's uncommitted changes", while the next bullet says "Only functions changed in the session are judged". These differ in two ways:
- If the agent commits partway through a session, those functions drop out of the uncommitted diff and are never judged.
- Uncommitted edits made before the session started (by the user or an earlier session) are sent to the model and count toward the 20-subject cap.
Pick one scope. If it's "changed in the session", say how the hook builds that set, for example a diff against the session-start snapshot.
There was a problem hiding this comment.
Fixed in 8785c64: one scope is stated, the diff of the working tree against the HEAD recorded at session start. Functions committed mid-session are still judged; edits already uncommitted at start are included, and that over-inclusion is stated as accepted.
Review summaryThis PR only changes documentation (ADR-0021 and the rust-style skill), so no tests are needed for it. Nothing blocks the merge: I found no P0/P1 issues and three P2s.
🤖 Generated with Claude Code |
Record that agent-harness only ships the Nix-pinned jev-lint, and the Stop-time run is an agent-config Python hook beside the existing Stop wiring, gated by trusted_owners. The key comes from a 1Password Environment through `op run`, injected only into the jev-lint child. The run times out at 60 s, never blocks Stop, and reports a one-line notice when skipped or failed. The Rust JudgementBackend of agent-harness #209 is removed as dead code. Refs #74 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Add pedantic with priority -1 to the recommended [lints.clippy] table so the snippet matches the bullet and does not trip lint_groups_priority. Say that a crate-wide Cargo.toml allow needs the user's approval like a per-site suppression, since the suppression guard skips .toml files. Refs #74 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Pick one scope: the diff of the working tree against the HEAD recorded at session start, so functions committed mid-session are still judged. State that edits already uncommitted at start are included. Refs #74 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
| - Forbid `unsafe` by default. | ||
| - Do not enable broad lint sets such as `clippy::pedantic` at project start. | ||
| - Add targeted lint configuration only when it catches mistakes the project actually cares about. | ||
| - Enable `clippy::pedantic` as `warn`, with `priority = -1` so that per-lint entries in the same table override the group. |
There was a problem hiding this comment.
P2: This line now says to enable clippy::pedantic as warn, but the "Recommended package-level guard" [lints.clippy] block a few lines down still leaves it out. If an agent copies the recommended snippet, it gets a config without pedantic, which contradicts the rule this PR is adding. The PR description says the recommended config already enables pedantic, but this file's snippet doesn't. Consider adding pedantic = { level = "warn", priority = -1 } to the snippet. Also note that with cargo clippy -- -D warnings in the quality gate, warn behaves like deny in practice. That may be intended, but saying so would help.
| (M-05), error messages that name the operation and subject (M-21), and known-defect markers (`xfail`, | ||
| `test.fails`) that carry a comment naming the removal condition (M-60). Their prose is deleted when the rule is | ||
| promoted, not before. | ||
| - **Backend.** `jev-lint` is pinned with all its dependencies through Nix and never fetched with `npx` at run time, |
There was a problem hiding this comment.
P2: "Their prose is deleted when the rule is promoted, not before" contradicts the Prose is deleted, not kept decision above. That decision says the change that replaces a prose rule with a check deletes the prose in the same PR, so no second statement of the rule can drift. Under this new sentence, M-05, M-21, and M-60 would exist both as prose and as jev-lint rules until promotion. Promotion for model-judged rules is also gated on ADR-0020's corpus fitting, so that overlap could last indefinitely. Please either make the first-rules sentence match the general decision, or narrow the general decision to cover model-judged rules that haven't been promoted yet.
There was a problem hiding this comment.
Fixed in d60f8f6: the prose decision now has one exception, a model-judged rule that is not promoted keeps its prose until the promotion change deletes it, and the first-rules paragraph points to that decision.
|
Review summary (read-only) This PR only changes docs, so there is no runtime code to break and nothing that needs new tests. The ADR's references to Findings (no P0 or P1, so nothing blocks the merge):
Blocking findings: 0 |
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
| - **Cache.** The hook does not keep a cache of its own. It passes `jev-lint` its verdict cache (`-c <path>`) stored | ||
| outside the repository, under the agent state directory, because `jev-lint` documents the cache as trusted input | ||
| that can silence rules and a file inside the repository could be committed or edited by the agent. A backend | ||
| or model change is handled by `jev-lint`'s own cache keying. |
There was a problem hiding this comment.
P2: Moving the verdict cache to $XDG_STATE_HOME/agent-harness/model-rules/verdicts.json doesn't, by itself, stop the agent from altering it. No current hook guards writes under ~/.local/state: guard_command.py and command_permissions.json have no rule for it, and trusted_owners.py and audit_log.py write there freely. So an agent that can run jq/python/echo > can still plant a passing verdict and silence M-05/M-21/M-60, which is exactly the threat this paragraph cites. Since findings are advisory, the impact is low. Still, either narrow the claim (the cache is "not committed", not "not editable by the agent"), or record that the implementation must deny agent writes to that path (for example, a guard_command rule), with a test for it.
There was a problem hiding this comment.
Fixed in d60f8f6: the claim is narrowed to "not committed". The ADR now records that the hook change must add a guard rule denying agent writes to the verdict cache, with a test, and that until then findings stay advisory.
Review summaryDocs-only PR (ADR-0021 amendment + rust-style tooling note). No P0/P1 findings.
Checked and fine:
No tests are expected for this change; the hook itself isn't implemented here. |
jev-lint is a tool the agent-config Stop hook runs, like ast-grep, and agent-harness only distributes configuration. Record that it is pinned as packages.<system>.jev-lint in this repository's flake and installed by dotfiles from agent-config, instead of being shipped by agent-harness. Refs #74 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
| - Forbid `unsafe` by default. | ||
| - Do not enable broad lint sets such as `clippy::pedantic` at project start. | ||
| - Add targeted lint configuration only when it catches mistakes the project actually cares about. | ||
| - Enable `clippy::pedantic` as `warn`, with `priority = -1` so that per-lint entries in the same table override the group. |
There was a problem hiding this comment.
P2 — "warn" here really means "deny". The Quality Gates in this file (line 10 and the block above, cargo clippy --all-targets -- -D warnings) turn every warning into an error, so with pedantic = { level = "warn", priority = -1 } each pedantic lint fails the gate.
That clashes with ADR-0021, which this same PR amends: findings are reported first and only become blocking after a reviewed promotion. Here the whole pedantic group blocks on day one. An existing crate that follows this snippet will likely fail the gate at once, and the agent's only ways forward are many #[expect]s or crate-wide allows, both of which need user approval under the next bullet.
Pick one of these and state it: say that pedantic is effectively deny under the gate, or keep pedantic out of -D warnings (for example -D warnings -W clippy::pedantic ordering, or a separate non-gating pedantic run).
There was a problem hiding this comment.
Partly fixed in 7d0448a: the file now states that pedantic is effectively deny under the -D warnings gate, and that the way out is to fix the lint or allow it with a reason. Not changed: the clash with ADR-0021. That ADR covers how prose-rule checks report in the Stop hook, not the project clippy gate, and the required policy is pedantic at warn under the existing gate.
Review summaryThis PR changes only docs, so there's no runtime behaviour to test. I checked the ADR's references against the repo: Findings
The ADR amendment itself reads as internally consistent: a single Blocking findings (P0/P1): 0 |
The quality gate runs clippy with -D warnings, so a pedantic warning fails the build. Say so, and point to the two ways out: fix the lint or allow it with a reason. Refs #74 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Resolve two contradictions found in review. A model-judged rule that is not yet promoted keeps its prose until the promotion change, so the first-rules paragraph no longer conflicts with the prose-deletion rule. State that a cache under the state directory is only kept out of commits, and that denying agent writes to it needs a guard rule with a test in the hook change. Refs #74 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
| prose-to-check mapping (original text, location, tool, tests) is recorded in that PR's body only, not in the | ||
| repository. | ||
| `AGENTS.md` or the style skill in the same PR, so no second statement of the rule remains to drift. The one | ||
| exception is a model-judged rule that has not been promoted: its check is advisory and unfitted, so its prose stays |
There was a problem hiding this comment.
P2: This new exception keeps an unpromoted model-judged rule's prose alongside its jev-lint check. That contradicts the decision summary, which wasn't updated: it still says the ADR decides on "deleting a prose rule in the same change that replaces it with a check" to achieve "no prose that can drift from its check". All three first rules (M-05, M-21, M-60) fall under this exception, so for now the ADR's stated goal doesn't hold for any model rule. Please add the exception to the summary sentence, and list "prose and check coexist (and can drift) until a model rule is promoted" among the accepted costs.
There was a problem hiding this comment.
Fixed in 315fa6b: the decision summary now says a model-judged rule keeps its prose until it is promoted, and lists holding both prose and check until promotion as an accepted cost.
|
Review summary (read-only): this PR only changes documentation (ADR-0021 and the rust-style tooling reference), so no code paths or tests are affected.
Checked and fine: the referenced No blocking findings. |
The decision summary still said a prose rule is deleted in the change that replaces it and that no prose can drift from its check. Add the exception for unpromoted model-judged rules and the accepted cost of holding both prose and check until promotion. Refs #74 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
| owner's own repositories). For any other repository the hook skips model rules and says so in one line. An | ||
| environment variable (`AGENT_MODEL_RULES=off`) switches model rules off entirely. | ||
| - **Key handling.** The hook runs `op run --environment <id> -- jev-lint review --json -R <rules dir> -c <state | ||
| dir>/agent-harness/model-rules/verdicts.json`. The key comes from a 1Password Environment, is injected only into |
There was a problem hiding this comment.
[P2] The verdict cache path <state dir>/agent-harness/model-rules/verdicts.json is one global file for every repository, worktree, and session. Other verification state is scoped per worktree and session (agent-harness/verification/<worktree>/<session>/, see session_store.py). With a single file, two sessions that reach Stop at the same time, for example in parallel worktrees, both run jev-lint review -c on it. Unless jev-lint writes the cache atomically and under a lock, they can lose each other's updates or leave a truncated file, and every later run then fails with "unparsable" errors. Either scope the cache (for example per worktree), or state in the ADR that jev-lint's cache writes are safe when several processes write at once and that the hook serialises runs.
There was a problem hiding this comment.
Fixed in fefe212: the ADR now says the cache file is shared by every repository, worktree, and session, that jev-lint write atomicity is unverified, and that the hook serializes runs with a lock file next to the cache and gives up with a one-line notice if it cannot take the lock in time.
| and batches subjects per file, so a second cache would duplicate it and could disagree with it. | ||
| - **One `jev-lint run` call per rule and file.** Rejected: it forgoes `jev-lint`'s batching of up to 256 subjects per | ||
| file and its subject selection, and multiplies process starts and model calls. | ||
| - **Keeping the cache inside the repository.** Rejected: `jev-lint` treats the cache as trusted input that can silence |
There was a problem hiding this comment.
[P3] This rejection says the cache "must not live where the agent or a commit can alter it". The Cache decision above (line 48) says no current guard stops the agent from writing to the state-directory path either, and that a guard rule still has to be added. As written, the chosen location fails the same test the rejected one fails. Rewording this to "where a commit can alter it" would remove the contradiction. Another option is to make the deny-write guard part of the decision itself, not a follow-up.
There was a problem hiding this comment.
Fixed in fefe212: the rejected alternative now says "where a commit can alter it", and points to the guard rule of the Cache decision, which applies to the chosen location as well.
Review summaryThis PR changes documentation only (ADR-0021 and the rust-style tooling reference). There are no code changes, so no tests are missing. I found nothing that should block the merge.
I checked the rust-style change: the Blocking findings: 0 🤖 Generated with Claude Code |
Record that the verdict cache is one file shared by every repository, worktree, and session, so the hook serializes runs with a lock file next to it, because jev-lint's write atomicity is unverified. Reword the rejected in-repository alternative so it no longer claims a protection from agent writes that the chosen location only gets from the guard rule. Refs #74 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Review summary: no findings. This PR only changes documentation: it amends ADR-0021 and updates the
No executable behaviour changes, so no tests are needed. No correctness or security problems found. |
…ording The backend abstraction is gone, so the decision summary and the Backend bullet now say that jev-lint is built and pinned through Nix as packages.<system>.jev-lint in this repository and run directly by the hook. Record that op runs with a read-only 1Password service account limited to the jev Environment and an automation vault, whose token sits in the macOS Keychain and reaches only the op child process. Reject running op as the signed-in user, which prompts at every Stop. Refs #74 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
| - **Backend.** `jev-lint` is built and pinned with all its dependencies through Nix as `packages.<system>.jev-lint` | ||
| in this repository's flake, and dotfiles installs it from agent-config. It is never fetched with `npx` at run | ||
| time, and the hook runs the `jev-lint` command directly, so replacing it later, as ADR-0020's conditions allow, | ||
| means changing this hook. This replaces only the run mode of ADR-0020 (`npx` over a Nix-provided Node, whose transitive dependencies were not |
There was a problem hiding this comment.
P2 This revision says it "replaces only the run mode of ADR-0020" and that ADR-0020's choice "stands". But the same paragraph has the hook run jev-lint directly, and "Where it runs" removes the Rust JudgementBackend (agent-harness #209). ADR-0020's decision (and its title) adopts jev-lint behind the judgement backend abstraction "so that the backend can be replaced". So this ADR also drops the backend abstraction from ADR-0020, and it says nothing about that.
As written, the two Proposed ADRs disagree: ADR-0020 still requires the abstraction, while ADR-0021 says nothing in ADR-0020 changed except npx. Please list the abstraction as a second part of ADR-0020 that this ADR replaces (or amend ADR-0020 too, since it is still Proposed). Otherwise a later reader following ADR-0020 may re-add the abstraction that this PR declares dead code.
There was a problem hiding this comment.
Fixed in c7dd857: ADR-0021 now lists two parts of ADR-0020 that it replaces, the run mode and the judgement backend abstraction (dropped because the hook is the only caller), so the two Proposed ADRs no longer disagree.
There was a problem hiding this comment.
Also in d945d97: ADR-0020 now carries "Partly superseded by: ADR-0021" and a note naming the two replaced parts (run mode, backend abstraction) and what still holds (choice of jev-lint, evidence, accepted costs, per-rule cutoff fitting). Both ADRs stay Proposed.
Review summaryThis PR changes documentation only: it amends ADR-0021 and updates the rust-style clippy guidance. No code changed, so no tests are missing for changed behavior. Findings (0 blocking):
What I checked and found fine:
|
ADR-0021 removed the judgement backend abstraction that ADR-0020 adopts, but said it replaced only the run mode. Name both parts so the two Proposed ADRs no longer disagree. Refs #74 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
@codex review |
Mark ADR-0020 as partly superseded by ADR-0021 and add a note naming the two replaced parts, the run mode and the backend abstraction, and what still holds: the choice of jev-lint, the evidence, the accepted costs, and the per-rule cutoff fitting. Status stays Proposed. Refs #74 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Review summary: no findings. This PR only changes documentation: ADR-0020, ADR-0021 and the rust-style tooling reference. I checked it for internal contradictions and for claims that don't match the repo:
No code changed, so no tests are needed. Nothing blocks the merge. |
…150) Stop 時に,セッションの変更を `jev-lint review` のモデルルール(M-05,M-21,M-60)で採点する.既存の検証 Stop フローに統合し,指摘は「未採点の入力に対して 1 回だけ block,同じ入力では通知のみ」とする.ADR-0021 をこれに合わせて改訂した. 判断してほしい点:下記「ADR の想定と違った点」(`jev-lint review` は 1 回で「開始 HEAD からの作業ツリー差分」を採点できない). ## 挙動 | 状況 | 結果 | | ------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------- | | 未採点の入力で指摘あり | `{"decision":"block","reason":...}` を 1 回(エージェントに見える) | | 同じ入力で指摘あり | `systemMessage` のみ(`findings unchanged; not rerun`),再 block しない | | `stop_hook_active` が立っている | その Stop では `systemMessage` のみ.見せられなかった指摘は「未提示」として記録し,同じ入力の次の Stop で 1 回 block | | モデルルールが block | reason は「検証の報告,続けてモデルルールの指摘」 | | `AGENT_MODEL_RULES=off` | 保存済みレシートより先に判定し,常に 1 行の通知のみ | | キルスイッチ / 信頼されない repo / Keychain 項目なし / `op`・`jev-lint` なし / timeout / 非 0 終了 / 読めない JSON | `systemMessage` の 1 行のみ,block しない,レシートを残さず次の Stop で再試行 | | 検証が block | モデルルールは走らせない | ## 統合の理由(別 hook にしなかった) - 別 Stop hook は検証と並列に走り,「同じ入力では block しない」を 1 か所で適用できず,エージェントに見せるには 2 つ目の block が要る. - そのため `session_gate.stop()` が検証の後に `model_rules_gate.advise()` を呼び,`results.json` のレシート(`model_rules`)を同じ流儀で扱う.`verify` の明示コマンドは従来どおり検証のみ. ## ADR の想定と違った点(実機で確認) ADR-0021 は「開始 HEAD に対する作業ツリーの差分を 1 回の `jev-lint review --base` で」と書いていたが,jev-lint 0.7.0 の `dist/diff.js` を読み,実機(キー不要の `--dry-run`)で確かめたところ次のとおりだった. - `--base <commit>` は `<commit>...HEAD`(**コミット済みのみ**).ステージ済み・未コミット・未追跡は対象外. - `--base` なしは「作業ツリー vs HEAD」+未追跡ファイル(**未コミットのみ**). そこで 2 回のレビューに分けた(コミット済み:`--base <開始 HEAD>`,未コミット:`--base` なし).上限 20 は 2 つで共有し,同じ rule・file・line の指摘は 1 件にまとめる.開始 HEAD は `baseline.json` の `head` に記録する(古い記録や空 repo では未コミットのみ).ADR にこの理由を書いた.テスト `test_model_rule_files.py` が両モードの対象を固定している. ## process 境界 - `jev-lint review --json --no-config --fail-on error -R <rules> -c <cache> [--base <commit>]` を `op run --environment <id> --` の下で実行.件数の事前計測は `--dry-run`(キー不要,`op` なし). - ブリーフに無い追加:`--no-config`(repo の `.jev-lint.yaml` が送信先 `--base-url` を変えるのを防ぐ),`--fail-on error`(警告の指摘で非 0 終了にならないため). - 子プロセスの環境は許可リスト(PATH,HOME,USER,LANG,LC_ALL,XDG_STATE_HOME,TMPDIR)のみ.トークンは `op` の子にだけ渡す.stderr は捨てる.token と key は読まず・出さず・ログに残さない(`Credentials.__repr__` も隠す). - timeout 60 秒は process group ごと kill.予算は `min(90, 600 - 20 - 検証が使った時間)` で,残りが無ければ実行しない(Keychain 検索は 5 秒). - **孤児プロセスと,その上限:** Claude Code が hook を強制終了する(timeout,Ctrl+C,セッション終了)と,hook は後始末できず,macOS には親の死を子に伝える仕組みも無いため,`op` と `jev-lint` が残りうる.そこで子プロセスを `/usr/bin/timeout -s TERM -k 5 <予算>` の下で起動し,hook が死んでも自分の期限で終わるようにした(`--dry-run` を含む全ての子).hook 内の process group kill は,その 1 秒後の保険として残す. - 上限:予算(最大 60 秒)+ 5 秒. - **`timeout` の解決:** `/usr/bin/timeout` を絶対パスで呼ぶ(`PATH` に左右されず,`PATH` 上の偽物に差し替えられない).macOS は BSD 版,Linux は GNU 版が同じ場所にある.両方が受け付けるものだけを使う(短いオプション `-s TERM -k 5`,期限は小数の秒.BSD 版の man page で確認).`--version` の判定(probe)はやめた.`/usr/bin/timeout` が無ければ,通知なしで hook 内の kill だけに戻る(その場合,hook が殺されると子は自分で終わるまで残る). - **終了状態:** 124(期限切れ),137(GNU が KILL を送った後),-9(BSD の `timeout` は自分が属する process group に KILL を送るため,自身がシグナルで死に,Python では負の値で見える)をすべて「timed out」として通知する. - **実測(macOS,BSD `timeout`,キー不要):** hook を SIGKILL したあと,`TERM` を受け付ける子は 2.00 秒後(予算 2 秒),`TERM` を無視する子は 2.96 秒後(予算 2 秒+ `-k 1`)に終了した.`_Child.run` 経由では,`TERM` を無視する子が予算 1 秒+ `-k 5` の 6.01 秒で終わり,「timed out」と判定された. - 未コミットのレビューは,baseline と内容が異なるファイル(このセッションが変えた・作ったファイル)だけを渡す.最初から dirty で触っていないファイルは送らない. - **既知の限界(コミット済みのレビュー):** `--base <開始 HEAD>` は `start...HEAD` 全体を採点する.セッション中に `git pull` や rebase で取り込んだ上流のコミットも対象になり,共有上限 20 を使いうる.baseline は内容のスナップショットで,どのコミットがセッション由来かを区別できないため,この PR では解消しない(`claude-review` の P3,返信済み). - 件数上限:`--dry-run` の `subjects` と `cached` で,キャッシュ済みを除いて 20 以下ならそのまま.超える場合はファイル単位で貪欲に採り,残りを報告. ## ルール(Python / TypeScript) `agents/hooks/lint/model-rules/<language>/<id>/rule.yml`(`lint/rules` の ast-grep 静的ルールとは別ディレクトリ).しきい値 0.5 は未調整の仮値で,助言用.Go と Rust は後続. | ルール | Python の matcher | TypeScript の matcher | | ------------------------------------------- | --------------------------------------------------- | ---------------------------------------------- | | `command-query-naming`(M-05) | `function_definition` | `function_declaration`,`method_definition` | | `error-message-names-operation`(M-21) | `function_definition` かつ `raise_statement` を含む | 同左の関数かつ `throw_statement` を含む | | `known-defect-marker-names-removal`(M-60) | `decorated_definition` で decorator が `xfail` | `call_expression` で `test.fails` / `it.fails` | - M-60 は注釈がデコレータ(呼び出し)の外にあるため `state: located`(ファイル全体を送る).他は `local`. - 矢印関数は M-05 の対象外(今は拾わない). - 散文ルールは削除していない(昇格前).散文→チェックの対応表:M-05(AGENTS.md の命名),M-21(python-style のエラーメッセージ),M-60(python-style testing の xfail 注釈)はいずれも散文を残したまま助言チェックを追加. ## キャッシュ書き込みの guard とその限界 `secret_path_policy.json` に `**/agent-harness/model-rules/**` を追加(テストあり).この方針は access 種別を区別せず,パスを名指しする呼び出しを拒否する.**限界**:リテラルのパスしか見ない.実行時にパスを組み立てるコマンドや,書き込むプログラムは対象外で,sandbox は state ディレクトリ配下への書き込みを許している.偶発的・安易な編集への対策であり,意図的な書き換えは防げない(ADR と DESIGN に明記). ## 新しい lint 規則との関係 / ignore の削除 なし. ## 検証 - [x] `uv run --frozen pytest`:4642 passed,1 skipped(最終コミット 76bdf08 で実行) - [x] `timeout` まわりは Red 先行:fake を絶対パスに置き,argv(`-s TERM -k 5 <秒>`)と終了状態(124,137,-9)のテストを先に変えて,期待どおりの理由で失敗するのを確認してから実装した.`file-length`(500 行)に当たったため,テストを「判断」と「プロセス境界」の 2 ファイルに分け,共通の準備を `model_rules_support.py` に出した(テスト数は同じ). - [x] CI:`codex-review` 以外すべて通過(`claude-review` は最新コミットで P0/P1 なし).`codex-review` は Codex の利用上限("You have reached your Codex usage limits")で失敗しており,共通ルールどおり許容(ready, codex skipped: usage limit).`all-green` はその集約として赤. - [x] `claude-review` の指摘はすべて対応済み(P1: `stop_hook_active` で見せられなかった指摘,P2: Stop 予算,キルスイッチの順序,未触のファイルの送信,検証報告の欠落).セキュリティレビューの「レシート偽造」は,検証の既存レシートと同じ信頼モデルのため範囲外とし,コメントで回答(別 Issue 候補).`audit` の deptry は `known_first_party` に 5 モジュールを追加して解消. - [x] `ruff check`,`ruff format --check`,`ty check`:すべて通過 - [x] 新規テスト(fake の `security` / `op` / `jev-lint` を PATH に置く.Keychain・1Password・モデル・ネットワーク不使用,キー不使用): - block 1 回,同入力は通知のみ,変更入力で再 block,`stop_hook_active`,clean,対象 0 件 - argv と環境の完全一致,token は `op` の env だけ,許可リスト外の変数なし,token が出力に出ない - 件数上限(ファイル単位,キャッシュ済み除外,2 レビューで共有),キルスイッチ,信頼されない repo は何も読まない・送らない,Keychain 欠落,プログラム欠落,非 0 終了,timeout,読めない出力,ロック競合,一度失敗しても次で再試行 - 開始 HEAD の記録(空 repo,旧記録,不正な値) - 実 `jev-lint review --dry-run` で rule の読み込みと subject の選択(Python 4/1/1,TypeScript 3/1/1),コミット済み・未コミット・未追跡の扱い - 未検証:モデルを実際に呼んだ結果(キーがないため).`--json` の findings の形は `dist/types.d.ts` に合わせた fake で確認しており,実際の出力は新しいマシンの準備(docs/DESIGN.md)の後に一度確認が必要. ## TSDD に関する正直な注記 実装を先に書き,既存 3602 件が通ることを確認してからテストを書いた(Red を先に取っていない).その代わり,fake で境界の契約(argv・env・秘密の非露出)を固定し,実 `jev-lint` で matcher を確認した.ミューテーションテストは未実施. ## ADR の改訂 「指摘は block しない」を「未採点の入力に 1 回だけ block,同じ入力では二度と block しない」に置き換えた.理由:Stop の非 block 出力(`systemMessage`)はユーザーにしか届かず,エージェントが指摘を見られない.毎回 block するとエージェントが指摘を断った場合に同じ入力で止められ続ける.Environment ID と token はともに Keychain から読む(ブリーフに従い,ADR の `AGENT_MODEL_RULES_OP_ENVIRONMENT` を置き換え). ## 新しいマシンの準備 `docs/DESIGN.md` と `docs/DESIGN_ja.md` の「Stop 時のモデルルール」に記載. <details> <summary>スコープ・出典・前提</summary> - Refs #74(stage 3F の hook 側).ADR-0021 の改訂(#142)に続くもの. - dotfiles #449 が `jev-lint` を PATH に入れる. - 対象外:Go / Rust のルール,しきい値の較正,ルールの昇格,散文の削除,agent-harness 側の変更. - 並行して Stop に別 hook を足す案は上記のとおり不採用. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
概要
#74 段階 3F の設計変更を ADR-0021 に反映し,あわせて rust-style の
clippy::pedanticの記述を直します.変更
docs(adr)改訂jev-lint review --jsonを 1 回だけ実行する.判定単位は変更のあった関数,文脈は同一ファイルの import と外側の宣言(state armlocal),上限は 1 回の Stop で 20 件.キャッシュは jev-lint 自身のものを repo の外に置く.trusted_ownersが信頼する repo だけコードを送り,AGENT_MODEL_RULES=offで停止できる.最初の規則は M-05,M-21,M-60.結果は助言のみで止めない.docs(skills)pedanticrust-style/references/tooling.mdの「clippy::pedanticを有効にしない」を,「warnで有効にし,個別の lint は理由つきでのみ allow する」に直す.docs(adr)実行場所trusted_ownersの隣).鍵は 1Password Environment からop run --environmentで jev-lint の子プロセスにだけ渡し,hook は読まない.60 秒で打ち切り,Stop は止めず,skip や失敗は 1 行で通知する.agent-harness #209 の RustJudgementBackendは dead code として削除.docs(skills)snippet[lints.clippy]にpedantic = { level = "warn", priority = -1 }を追加し,crate 全体のCargo.tomlallow はユーザー承認が要ると明記.docs(adr)範囲HEADとの差分」の 1 つに統一.docs(adr)jev-lint の置き場packages.<system>.jev-lintとして Nix で固定し,dotfiles が agent-config から入れる(agent-harness は設定の配布のみ).判断
確認
dprint checkを両ファイルで実行し,問題なし.src/jev.ts,src/batch.ts,docs/reference.md,docs/cost.md.Refs #74
🤖 Generated with Claude Code