fix(pre-push-review): codex-reviewer の background 移行回収を可能にする (#337) - #347
Merged
Conversation
…を追加 (#337 Phase A) Bash timeout による background 自動移行後に review 結果を回収できない 構造欠陥 (issue #337) の修正契約を spec-first Phase A として固定する。 tools 拡張 (Bash, TaskOutput, Read)、Background-move recovery 手順、 境界 3 種の execution-failed 終了、旧 Bash-only 文言の撤去を検査する。 現行 codex-reviewer.md に対して 6/6 red であることを確認済み。 Refs #337 Generated with [Claude Code](https://claude.com/claude-code)
3 レビュー (code / codex) の指摘に対応する: - 全 assert を `## Background-move recovery` セクションスコープ + 空白正規化 した canonical 一文の存在検査に変更し、既存の無関係文言への誤マッチを排除 - 回収意味論 (TaskOutput block=true・同一 task ID・terminal まで反復) を 一文契約として固定 - 境界 3 種 (task ID/path 喪失・回収予算超過・task 見失い) を per-case の 独立メソッドに分割し、各々に条件→execution-failed の対応を一文で固定 - rescue 壁打ちの補強 5 点 (block=true の明示・一文単位の条件結果固定・ 予算超過への execution-failed 必須化・path 喪失の明記・truncated 因果の 一文化) を反映 現行 codex-reviewer.md に対して 9/9 red、既存契約テスト green を確認済み。 Refs #337 Generated with [Claude Code](https://claude.com/claude-code)
codex review の must-fix 指摘 (無限 poll する実装が全 assert を pass し hang 欠陥を温存しうる) と手動確認案内の欠落に対応する: - POLL_SENTENCE の終了条件に「or the recovery budget is exhausted」を追加し 一文内で予算と整合 - 初回自動回収の予算定義 (最大 5 回 × 各 10 分 = 60 分の background shell 制限内) を BUDGET_DEFINITION_SENTENCE として契約化 - 予算超過時の report に「本 subagent を focused status-check question で resume する手動確認経路」の案内を要求 (parent-safe 契約の既存 resume 経路 を指名)。resume 後の確認は初回予算外の単発 bounded check と明記 - rescue 壁打ちの改善 3 点 (終了条件整合・回数と各 call 上限の同時固定・ resume check の予算外明記) を反映 現行 codex-reviewer.md に対して 11/11 red、既存契約テスト green を確認済み。 Refs #337 Generated with [Claude Code](https://claude.com/claude-code)
- task ID 単独喪失のみを terminal 条件とし、output file path は optional な 補完手段に降格 (path 単独喪失で回収可能な review を failed 化しない) - truncated かつ path 未捕捉/読み取り不能の組合せのみ execution-failed とし、 report の黙示的不完全受容を排除 (rescue 壁打ちの代替案を採用) - 回収予算の 60 分算術正当化を除去し、per-call を tool 最大 timeout (10 分) で固定 (短縮 timeout による予算食い潰し実装を契約上排除) - recovery_section ヘルパを fence 追跡 scanner 化し、fenced block 内の 同名見出しへの誤アンカーを排除。合成文字列による回帰テストを追加 BashOutput への tool 変更指摘は、TaskOutput の公式 tool スキーマが background shells を含む全 task type への対応を明記しているため不採用。 現行 codex-reviewer.md に対して md 契約系 11/11 red、ヘルパ回帰 green、 既存契約テスト green を確認済み。 Refs #337 Generated with [Claude Code](https://claude.com/claude-code)
…目レビュー指摘対応) - Read の使途を「truncated 時に同一 background task の recorded output file を読む」場合に限定する canonical 文を新設し、独立第二意見レビューが self-review へ静かに堕ちる経路 (独立 diff 読解の許容) を契約上排除 - 旧 Bash-only 設計の残存矛盾文言 3 種 (blanket read 禁止・Only the Bash tool・are all disallowed) の不在を negative assert に追加し、新旧併存の 自己矛盾指示を排除 - recovery_section の fence 判定をインデント付き fence に対応させ、 リスト内 fence の見出し様行で slice が誤る経路を閉塞。回帰ケースを追加 per-call timeout の tool 意味論固定への指摘は、TaskOutput の公式 tool スキーマ (block デフォルト true / timeout 上限 600000ms) を確認済みのため 不採用。 現行 codex-reviewer.md に対して md 契約系 12/12 red、ヘルパ回帰 green、 既存契約テスト green を確認済み。 Refs #337 Generated with [Claude Code](https://claude.com/claude-code)
… + checkpoint 対応) review cadence 5 サイクル到達に伴う advisor 根本方針 checkpoint の助言 (方式維持・5 巡目指摘反映で Phase A 確定・有限終了基準の設定) に従う: - resume 案内を診断専用に限定し、marker 昇格不能と fresh reviewer run の 必要性を canonical 文に明示 (auto-mark.sh の attestation lifecycle — resume 後 stop は marker promote 不能・terminal 拒否経路は pending 破棄 — との矛盾経路を閉塞) - background 移行は wrapper failure ではなく回収手順が non-zero-exit path に優先する、という優先順位文を新設 - tools: frontmatter 宣言の単一性 + 完全一致検査へ強化 (重複宣言の検出) - 旧 Bash-only 文言の negative assert を normalize 済み完全文の verbatim 不在検査に変更 (正当な絞り込み文言への過剰マッチを排除) 現行 codex-reviewer.md に対して md 契約系 13/13 red、ヘルパ回帰 green、 既存契約テスト green を確認済み。 Refs #337 Generated with [Claude Code](https://claude.com/claude-code)
rescue approve 済みの最終修正セットを反映し、advisor checkpoint で合意した 有限終了基準に基づき Phase A の red テスト契約を freeze する: - 記録指示を出所 (Bash の background-move result) を pin した完全命令文 RECORD_SENTENCE に置換 (否定文・矛盾文でも通る loose substring を排除) - 回収後 terminal 状態の handoff 分岐 HANDOFF_SENTENCE を新設 (成功 review は pass/findings、失敗 wrapper run は execution-failed へ正規化。失敗 run が review verdict に化けて marker 昇格に到達する経路を閉塞) - PRECEDENCE_SENTENCE を「move はそれ自体では wrapper failure ではない」 という分類の限定に修正 - 回収予算の per-call 数値 (ten minutes) を除去し「tool の最大 timeout」 表現に統一 (リポジトリ内に根拠の無い数値の埋め込みを回避) - fence scanner を delimiter 文字・run 長・閉じ行の空白限定で厳密化し、 4-backtick / tilde fence の回帰ケースを追加 現行 codex-reviewer.md に対して md 契約系 14/14 red、ヘルパ回帰 green、 既存契約テスト green を確認済み。以降の契約指摘は「受入不変条件の欠落」に 該当するもののみ受け付け、表現上の追加防御は Phase B 実装レビューに委ねる。 Refs #337 Generated with [Claude Code](https://claude.com/claude-code)
…se B) Phase A で freeze した契約テストを green 化する: - tools を Bash, TaskOutput, Read に拡張 (TaskOutput / Read は Background-move recovery 専用の回収手段) - Background-move recovery セクションを新設: background 移行結果が返す task ID / output file path の即時記録、TaskOutput (block=true) による terminal までの bounded 回収 (最大 5 call × tool 最大 timeout)、回収後 terminal 状態の report 契約への handoff、truncated 時の Read 補完、 境界 (task ID 喪失 / 予算枯渇 / task 見失い) の execution-failed 終了、 予算枯渇時の resume は診断専用 (marker 昇格不能) の明記 - Constraints の旧 Bash-only 文言を新 tools 構成に整合する文言へ改訂 (wrapper-only 実行サーフェスの意図は維持) - README の codex-reviewer tools 記述を更新し、v5.2.0 の変更点を追記 - version を 5.2.0 に minor bump (plugin.json / marketplace.json / root README / plugin README の 4 箇所同期) 契約テスト 15/15 green、report contract / model pins green、全スイート 442/443 (残 1 は issue #299 の既知環境要因) を確認済み。 Refs #337 Generated with [Claude Code](https://claude.com/claude-code)
… レビュー指摘対応) 回収した部分出力 (末尾チャンク等) を完全な report と誤認して pass に正規化 しうる穴への対応として、「完全性を確立できない回収出力は truncated として 扱う」定義文を Background-move recovery に追加する。これにより既存の truncated 分岐 (recorded output file の Read 補完 → 補完不能なら execution-failed) が完全性未確立ケースにも適用され、findings の黙殺を防ぐ。 Phase A 契約テストは変更なしで green を維持。 Refs #337 Generated with [Claude Code](https://claude.com/claude-code)
natsuume
force-pushed
the
fix/issue-337-codex-reviewer-bg-recovery
branch
from
July 26, 2026 08:02
951959b to
af71abf
Compare
natsuume
marked this pull request as ready for review
July 26, 2026 08:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
pre-push-review:codex-reviewersubagent が Bash timeout の background 自動移行後に review 結果を回収できない構造欠陥 (issue #337) を修正する。Phase A (このコミット群)
spec-first Phase A として、Phase B で
plugins/pre-push-review/agents/codex-reviewer.mdが満たすべき契約をtests/test_pre_push_codex_reviewer_bg_recovery.pyに固定した (現行 md に対して md 契約系 14/14 red、ヘルパ回帰 green)。契約の骨子:
tools:の単一宣言かつBash, TaskOutput, Readへの完全一致## Background-move recoveryセクションに、空白正規化した canonical 一文を要求:レビュー経緯
pre-push-review の 3 レビュー × 7 巡 + rescue 壁打ち 4 回 + review cadence 5 サイクル到達時の advisor 根本方針 checkpoint を経て、有限終了基準 (受入不変条件×識別的 assert の対応・既知 lifecycle/error path との無矛盾・Phase B でテスト変更なし) を満たして freeze した。7 巡目は codex/security pass、code は may-defer P3 のみ (helper の terminator 範囲・空 slice 診断・放置 wrapper の残余 state — いずれも受入不変条件の欠落ではなく defer 記録)。
Phase B (このあと)
plugins/pre-push-review/agents/codex-reviewer.mdの改訂 (契約テスト green 化)plugins/pre-push-review/README.mdの Bash-only 記述の更新Closes #337
🤖 Generated with Claude Code