Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "PR #2027 の follow-up として、Codex/Claude 共通の phase status・final report publisher を安全に実装する"
change_kind: workflow
Parent Issue
なし(単独改善)
Parent Goal Ref
- Goal: PR feat: Codex issue creator と editor を分離 #2027 の Allowed Paths 外にある impl-review-loop の status/final report 公開経路を、provider 差異に依存しない決定論的 publisher として分離する。
- Desired Destination: 新規 follow-up Issue として、設計・実装・検証を 1 Issue = 1 PR で完結する。
Current Validated Scope
impl-review-loopの root/control-plane が Codex/Claude 共通の閉じた phase status 入力を検証し、PR conversation comment を run 単位で marker-based upsert する経路。- implementation / verification / review / final の各 phase を current PR head に束縛し、publish 後の comment readback receipt を生成する経路。
- publish 前に停止しても同一 run marker を再利用して再開でき、duplicate または malformed marker、head drift、GitHub API エラーを fail-closed に分類する検証。
Remaining Parent Gaps
なし。PR #2027 の issue-creator / issue-editor role 分離および current-head 修復は本 Issue の対象外。
Outcome
Codex/Claude 共通の phase status と final report を、current head と comment receipt に束縛して run ごとに単一の PR コメントへ安全に upsert できる impl-review-loop publisher と、その回帰テストが追加されている状態。
Background
PR #2027 のレビューコメントで、テスト phase のコメント欠如は現行仕様、PR review / final report の公開欠如は control-plane 契約違反、iteration progress の共通公開 schema は仕様不足と整理された。PR #2027 への混在は Allowed Paths 外のため禁止する。
決定論的修正(採用): root/control-plane が既存の GitHub Issue Comments API marker/upsert 基盤を再利用し、閉じた status schema の検証、ownership marker 検索、POST/PATCH、postcondition readback、head-bound receipt を一つの publisher に集約する。
workaround(不採用): 各 provider の prompt / hook / gh pr comment --edit-last にコメント投稿を委ねる。run/phase 所有権を識別できず、並行実行・クラッシュ再開・hook 未発火で誤更新または公開漏れを防げないため採用しない。
Source
- source_url: feat: Codex issue creator と editor を分離 #2027 (comment)
- note_id: 1
- dedupe_key: follow-up:squne121/loop-protocol:pr/2027:1
- severity: optional_follow_up
In Scope
IMPL_REVIEW_LOOP_STATUS_V1の入力 schema と、provider、issue/PR/run、iteration、phase、state、head SHA、source-result digest を必須にする publisher を実装する。- root/control-plane からのみ publisher を同期呼出しし、worker / test-runner / pr-reviewer に GitHub write authority を追加しない。
- ownership marker と digest marker による run 単位の 0 件 POST / 1 件 PATCH / 2 件以上または malformed fail-closed、readback receipt、head drift 無効化、再開を実装する。
- 403、404、422、secondary rate limit、network timeout を分類して publish 失敗を loop 成功へ昇格させない。
- implementation / verification / review / final の phase と final report を current head に束縛して公開するよう、impl-review-loop の手順・テストを更新する。
Out of Scope
- PR feat: Codex issue creator と editor を分離 #2027 / Issue 実装: Codex issue-creator / issue-editor を分離し controlled mutation route を検証する #1952 の role cutover、runtime evidence、CI 修復、PR 本文の変更。
- worker、test-runner、pr-reviewer への GitHub write permission の付与。
- hook を正規 publisher に昇格する変更、GitHub の外部 API 仕様変更、既存 TEST_VERDICT routing authority の変更。
Acceptance Criteria
- AC1: Codex/Claude 共通の閉じた
IMPL_REVIEW_LOOP_STATUS_V1schema が、repository、issue_number、pr_number、run_id、iteration、phase、state、provider、head_sha、source_result_sha256 を検証し、不正入力を publish 前に拒否する。 - AC2: root/control-plane だけが publisher を呼び、worker / test-runner / pr-reviewer は GitHub write を行わない。
- AC3: 同一 repository / issue / PR / run_id の ownership marker は 0 件で POST、1 件で同一 comment ID への PATCH、2 件以上または malformed marker で fail-closed となる。
- AC4: implementation、verification、review、final の各公開値は publish 前後の current PR head と一致し、head drift 後の旧 APPROVE / final report は公開または成功扱いにならない。
- AC5: publish 成功時の receipt は comment_id、URL、payload digest、target PR、head SHA、run_id を含む readback 結果に束縛される。
- AC6: crash-after-result-before-publish を同じ run_id で再開しても、PR comment は 1 件だけになり、最終値へ更新される。
- AC7: 403、404、422、secondary rate limit、network timeout の各失敗は分類され、publish 失敗を loop 成功または approved 終端にしない。
- AC8:
gh pr comment --edit-lastを impl-review-loop の公開経路で使用せず、既存の marker comment 基盤を経由する。
Verification Commands
# AC1
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_publish_impl_review_loop_status.py -q
# AC2
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_publish_impl_review_loop_status.py -q
# AC3
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_publish_impl_review_loop_status.py -q
# AC4
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_publish_impl_review_loop_status.py -q
# AC5
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_publish_impl_review_loop_status.py -q
# AC6
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_publish_impl_review_loop_status.py -q
# AC7
$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_publish_impl_review_loop_status.py -q
# AC8
$ node --test tests/agent-logs/github-comment-upsert.test.ts
Allowed Paths
- .claude/skills/impl-review-loop/SKILL.md
- .claude/skills/impl-review-loop/steps/step-2-verification.md
- .claude/skills/impl-review-loop/steps/step-4-pr-review.md
- .claude/skills/impl-review-loop/steps/step-5-feedback-and-termination.md
- .claude/skills/impl-review-loop/scripts/publish_impl_review_loop_status.py
- .claude/skills/impl-review-loop/tests/test_publish_impl_review_loop_status.py
- scripts/agent-logs/lib/github-comments.mjs
- tests/agent-logs/github-comment-upsert.test.ts
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
なし
Required Design References
- docs/dev/agent-skill-boundaries.md#オーケストレーター設計原則
- docs/dev/agent-skill-boundaries.md#impl-review-loop V2 routing boundary
- docs/dev/workflows/impl-review-loop-design.md#Artifact and Evidence Contract
Scope Delta
N/A
Runtime Verification Applicability
- decision: not_applicable
- reason: publisher の schema、marker upsert、head binding、failure classification は fixture と mock GitHub client を用いた決定論的検証で完結し、実 agent runtime の PASS 主張を含まない。
Notes for Reviewer
- provider ごとの runtime adapter の正確な invocation surface は実装時に確認する。観測不能な native field を宣言値で補完せず、必要な追加経路が Allowed Paths 外なら Stop Conditions に従う。
- 既存 marker 基盤は
agent_run_report/v1を使用する。新 schema の marker 名を独自に追加する必要性は、既存基盤との互換性を確認してから判断する。 - Scope Collision (C1): related_issue=実装: 両review loopの人間向けGitHub作業履歴をphase-awareに整理し推奨理由を記録する #1908。実装: 両review loopの人間向けGitHub作業履歴をphase-awareに整理し推奨理由を記録する #1908 は人間向け履歴の phase-aware destination と rendering を扱い、新規専用 publisher の追加を明示的に Out of Scope とする。本 Issue は閉じた status schema、head-bound receipt、marker-based upsert / resume の publisher 実装だけを扱う。共通ファイルの並行変更を避けるため 実装: 両review loopの人間向けGitHub作業履歴をphase-awareに整理し推奨理由を記録する #1908 の merge 後に着手する。
Delivery Rule
- 1 Issue = 1 PR。専用 worktree と Draft PR を使用する。
- PR feat: Codex issue creator と editor を分離 #2027 には変更を混在させない。
- publisher の live GitHub mutation は root/control-plane の controlled executor に限定し、merge は人間が判断する。
Activity