Skip to content

feat: Codex issue creator と editor を分離 - #2027

Merged
squne121 merged 15 commits into
mainfrom
worktree-issue-1952-codex-creator-editor
Aug 8, 2026
Merged

squne121 merged 15 commits into
mainfrom
worktree-issue-1952-codex-creator-editor

Conversation

@squne121

@squne121 squne121 commented Aug 8, 2026 •

Copy link
Copy Markdown
Owner

Summary

Codex の Issue mutation role を issue-creator(新規作成専用)と issue-editor(既存 Issue 編集専用)へ分離し、旧 issue-author の active caller / owner / producer / executable route を cutover します。

この変更では、作成権限と既存本文の編集権限を明確に分離し、旧ロールへの実行経路を残さないことを目的とします。

Closes #1952。この PR は Issue #1952 を分割せず、1 Issue = 1 PR を維持します。

Checks

  • reviewed_head_sha: 20f8216be32fa947260d1caedcbb4ab897f3d772
  • base_sha: 04a79898af4ebe7c75a3e0389b361e444a38bd26
  • current-head required CI: push 後に head-scoped に再確認します。

ここに記録する値は、今回の PR head と base を再読してから取得したものです。過去の検証結果を current head の結果として流用しません。

受け入れ条件の達成状況

  • AC1: issue-creator / issue-editor の専用 TOML と canonical Skill surface を契約テストで検証。
  • AC2: active caller / owner / producer / executable route を creator/editor へ移行。旧 issue-author は active 対象 0。
  • AC3: root Skill symlink の mode、link target、containment、hash、duplicate/thin-wrapper refusal を検証。
  • AC4: create/edit の canonical Skill、transaction input、controlled executor/readback chain を静的契約で検証。
  • AC5: spawned runtime の required native field が観測不能な場合は、runner が exit 77/SKIP に分類。TOML・fixture・定数を runtime PASS に昇格しない。
  • AC6: creator/edit、editor/create、unknown は canonical transaction parser の不完全 input を用いた pre-executor refusal を観測し、executor invocation は false。
  • AC7: bridge/inventory/parity/refinement regression は PASS。実装: SubAgent 発火前に bounded local context bundle を生成し Claude/Codex の両 loop で consume する #1909 は将来 stale prose の advisory、実装: Claude Code / Codex CLI の implementation-worker に bounded read-only delegation parity を追加する #1943 に current code/fixture schema の blocking conflict はなし。

検証コマンド結果

  • 静的契約・runtime smoke・bridge・refinement をまとめて確認した結果: uv run --locked pytest tests/test_codex_issue_creator_editor_contract.py tests/test_codex_issue_creator_editor_runtime_smoke.py tests/test_codex_agent_bridge_contract.py tests/test_issue_refinement_ops_review.py -q: 78 passed, 1 skipped。
  • uv run --locked pytest scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke.py -q: 63 passed。
  • node scripts/check-codex-agents.mjs: PASS。
  • uv run --locked python3 scripts/check_codex_agent_config.py --assert-runtime-contract: PASS。
  • uv run --locked python3 scripts/check_claude_codex_agent_parity.py --strict: PASS。
  • git diff --check origin/main...20f8216be32fa947260d1caedcbb4ab897f3d772: PASS。

Runtime Verification Evidence(実行時証跡)

この節では runtime が実際に観測できた値と、観測不能だった値を明確に区別します。

reviewed_head_sha: 20f8216be32fa947260d1caedcbb4ab897f3d772
ac5:
  outcome: skip
  runner_exit_code: 77
  reason: required_native_runtime_fields_unavailable_or_noneligible_checkout
  prohibited_fallback: [TOML, static_fixture, test_constant]
ac6:
  outcome: pass
  receipt: invalid_transaction_input_rejected_pre_executor
  executor_invocation_observed: false
  mutation_transport_observed: false
artifact_scope: worktree_local_allowlist_only
published_artifact_id: unavailable
published_artifact_digest: unavailable

SKIP は PASS ではありません。AC5 の positive runtime evidence を static evidence へ読み替えず、AC6 の deterministic pre-executor refusal と区別します。

Allowed Paths 遵守

current head の 27 changed paths は #1952 の current Allowed Paths に含まれます。今回の P1 は tests/test_codex_issue_creator_editor_runtime_smoke.py のみで、非適格 detached checkout を runtime PASS に誤分類しない回帰です。

Schema Change Applicability

  • decision: schema_change
  • reason: runtime evidence を declared / observed / unavailable に区別する consumer update。実行時に取得できない情報を期待値で埋めず、検証結果を安全に区別するための更新です。

この変更は、宣言値を実観測値として扱わないための schema update です。

Schema Consumer Inventory

この一覧は、観測不能な runtime 情報を宣言値で補完しないために、変更前後の consumer 契約と担当ファイルを対応付けます。

# before
runtime_evidence:
  checkout_identity_failure: receipt_absent_unclassified
# after
runtime_evidence:
  checkout_identity_failure: unavailable_exit_77_skip
  receipt_absence: fail_closed_diagnostic
Consumer ファイル 更新有無 備考
tests/test_codex_issue_creator_editor_runtime_smoke.py 更新 checkout identity と receipt 不在を fail-closed に扱う
scripts/agent-ops/run_worktree_agent_runtime_smoke.py 更新済み declared/observed/SKIP と pre-executor receipt を出力
schemas/catalog.yaml 更新済み creator=create、editor=edit を記録

Safety Claim Matrix

次の表は、この PR が実際に保証する範囲と、外部ランタイムのようにこの PR 単独では制御できない範囲を分けて記録します。

Claim Implemented? Not controlled Evidence Follow-up
wrong route の mutation 前拒否 yes 任意 raw CLI の絶対阻止 transaction parser receipt #1952
unavailable runtime field の PASS 昇格禁止 yes Codex native event の公開可否 runner exit 77/SKIP #1952
controlled executor authority yes 外部 runtime の強制 contract/preflight test #1952

CI Test Performance Decision(CI 検証判断)

この節では CI の対象選択、未カバー項目、必須レーンを日本語で明示します。

変更テストを漏れなく選択しつつ、必要な CI レーンを省略しない判断を以下に記録します。

CI_TEST_PERFORMANCE_DECISION_V1:
  issue_number: 1952
  pr_number: 2027
  reviewed_head_sha: 20f8216be32fa947260d1caedcbb4ab897f3d772
  changed_tests: 7
  uncovered_tests: 0
  lanes: [python_unit, contract_artifact, required_ci]
  risk_flags: []

Notes

@squne121
squne121 force-pushed the worktree-issue-1952-codex-creator-editor branch from 8e9dd99 to d1cbe38 Compare August 8, 2026 06:45
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Preview URL

✅ verified live assets: https://squne121.github.io/loop-protocol/pr-2027/

The preview will be removed when this PR is closed.

@squne121

squne121 commented Aug 8, 2026

Copy link
Copy Markdown
Owner Author

判定

REQUEST_CHANGES。PR #2027 はまだ merge-ready ではありません。
最新確認時点で PR は Draft、mergeable ですが、base は d949a8d…、head は d9f6302… なのに、PR 本文の current-head 検証は依然 248d2d5… に固定されています。したがって本文の AC5/AC6 PASS と Runtime Verification Evidence は、現 head の証跡としては失効しています。

優先度順の敵対的レビュー結果は次です。

  1. P0 — AC5/AC6 の runtime evidence が自己充足的です。 test_codex_issue_creator_editor_runtime_smoke.py は child identity については runtime の session_meta.agent_role を使えている一方、effective_permission_profile は agent TOML、Skill configuration/hash はローカルファイル、executor/route decision/mutation_attempted=false はテスト入力と定数から再構成しています。特に canonical_skill_sha256 と loaded_readback_sha256 が同じローカル SKILL.md を二度 hash しているだけなのは、child が実際にその Skill をロード/readback した証明ではありません。 runner 自身も effective_agent_type = requested_agent_type、loaded_skills_source = static_frontmatter としており、root-side の requested 値を effective evidence に昇格しています。 これは 実装: Codex issue-creator / issue-editor を分離し controlled mutation route を検証する #1952 AC5 の「static fallback を runtime PASS にしない」という契約と正面衝突します。 さらに repo の .codex/config.toml 自身が、project-local config は profile routing の runtime evidence ではないと明記しています。 OpenAI 公式仕様でも child spawn 時には親 turn の live sandbox/approval override が再適用されるため、agent TOML の default_permissions を effective permission とみなすことはできません。([OpenAI Developers]1) 一方、OpenAI Codex の実装では turn_context に permission_profile、approval/sandbox、model、turn_skills が存在するため、spawned child の rollout の turn_context を直接読む方向が妥当です。([GitHub]2)

  2. P0 — 4 active caller の cutover が GitHub head に未到達です。 ユーザー側では未コミット修正済みとのことですが、現 head では references/index.md がまだ issue-author を owner とし、 refinement-loop-plan-output.md が rewrite を issue-author へ forward し、 speckit-taskstoissues/SKILL.md が create route を issue-author と記述し、 schemas/catalog.yaml も issue_contract/v1 producer を issue-author としています。 実装: Codex issue-creator / issue-editor を分離し controlled mutation route を検証する #1952 AC2 は callers が旧 role を要求・参照しないことを要求しているので、4件を commit/push して current head で negative inventory を取り直すまでは未達です。

  3. P0 — 修正: issue-refinement-loop で trusted OWNER directive を重複承認なしに contract update へ正規化する #1951 snapshot recovery は stale 検出を弱めず修復すべきです。 PR fix: trusted OWNER directive を contract update へ正規化 #2026 はすでに head df53a5f…、8 changed files まで進んでいますが、PR 本文の live evidence は古い 0ddc8fa… のままです。 ABA 対策は古い snapshot を再承認するのではなく、stale -> refresh_required -> fresh read receipt -> publish直前再read -> mutation -> postcondition readback とすべきです。GitHub REST は ETag による conditional GET を提供しますが、PATCH 等の unsafe method に一般的な conditional request は保証していません。したがって ETag/updatedAt/body hash を fresh-read receipt に束縛し、application-level CAS を構成するのが安全です。([GitHub Docs]3) A→B→A でも旧 snapshot が復権しない regression test が必要です。

  4. P0 — current-head gates が終端していません。 d9f6302… の CI では多数の job が成功していましたが、確認時には Python/E2E が非終端で、Japanese Content は failure でした。 Japanese Content は PR body ratio 自体は PASS し、Check changed Markdown files が FAIL しています。 したがって gh run view ... --log-failed で実ログを取得して原因ファイルを直す必要があります。component VRT は今回の運用契約どおり report-only とし、branch protection が要求していない限り merge blocker に昇格させるべきではありません。

  5. P1 — AC6 の並列化は方向性は正しいですが、単発 51.36 秒だけでは不十分です。 OpenAI 公式も subagent は探索・テストなど独立した read-heavy 作業の並列化に向く一方、write-heavy 並列化は conflict risk が高いとしています。([OpenAI Developers]1) rejection 3 route は mutation 禁止なので並列化適性があります。ただし各 case の output dir、parent/child session、marker、tested HEAD の独立性を検証し、複数回実行して VC 100 秒未満を再現させるべきです。CI 化するなら GitHub Actions の max-parallel で bounded concurrency を明示できます。([GitHub Docs]4)

配布形態については現在の方向でよいです。OpenAI 公式は .agents/skills の repo-local Skill と symlink target の追跡をサポートし、repo 内 workflow には直接配置、複数 repo への配布段階で plugin packaging を推奨しています。したがって #1952 で plugin 化や Skill 複製を持ち込む必要はありません。([OpenAI Developers]5)

また、今回の gpt-5.3-codex-spark 指定はこの人間指示に基づく今回限りの worker 利用とします。issue-creator / issue-editor の常設 model を Spark に変更する修正は明示的に禁止するのが適切です。

以下をそのまま Codex CLI に渡せる形にします。Claude Code から実行する場合も、利用可能な controlled Codex delegation surface があれば同じ契約で Spark worker を起動させてください。

PR #2027 adversarial fix-review loop — merge直前まで自律実行

対象:

Objective

PR #2027 を current main / current PR head / current Issue #1952 contract に対して敵対的に再レビューし、発見した defensible な P0/P1 を自律修正する。

実装、テスト、commit、push、PR body 更新、CI 確認、再レビューを反復し、以下をすべて満たすところまで進める。

ただし merge は実行しない。Issue も close しない。
最終状態は merge ボタンを押す直前までとする。

通常の bounded implementation / test / commit / push / PR update について人間承認を要求しない。

停止条件は以下だけ:

  • destructive operation
  • secret / credential の取得・露出が必要
  • external paid service が必要
  • repository policy を越える privilege widening が必要
  • GitHub/Codex 認証・権限が実際に不足
  • Issue Allowed Paths 外の変更が不可避
  • fixed contract 自体が実装不能で OWNER の新判断なしに解けない
  • 新規 Issue 作成が必須

MODEL_GOVERNANCE — 必須

このプロンプト自体を、OWNER による今回の明示的な human authorization とする。

gpt-5.3-codex-spark は この実行中の bounded subagent worker に限って使用してよい。

禁止:

  • .codex/agents/issue-creator.toml の常設 model を gpt-5.3-codex-spark に変更しない
  • .codex/agents/issue-editor.toml の常設 model を gpt-5.3-codex-spark に変更しない
  • project/global default subagent model を Spark に変更しない
  • 今回の人間指定を永続的な model policy として repository に materialize しない

既存の permanent agent model configuration は #1952 の別要件が明示しない限り維持する。

Spark は bounded worker であり、最終 PR judgment、scope expansion、Issue authoring、merge decision を担当させない。

SUBAGENT POLICY

開始直後に subagents を使う。

可能なら repository の spark-worker custom agent を使用し、明示的に gpt-5.3-codex-spark を選ぶ。

同時 child 数は repository の live config を最初に確認し、その制約以内にする。
同一ファイルを複数 worker に並行編集させない。
read-heavy investigation / test / log analysis は並列化してよい。
write-heavy repair は file ownership を分離するか直列化する。

最初の wave は以下の3 workerを優先する。

Spark A — caller / contract cutover

  • current PR head と uncommitted diff を調査

  • issue-author active caller/owner/producer の残存を分類

  • 特に:

    • .claude/skills/issue-refinement-loop/references/index.md
    • .claude/skills/issue-refinement-loop/references/refinement-loop-plan-output.md
    • .claude/skills/speckit-taskstoissues/SKILL.md
    • schemas/catalog.yaml
  • create-only authority は issue-creator

  • existing-Issue edit/rewrite authority は issue-editor

  • historical mention と active executable/procedural reference を区別

  • 既存の未コミット修正を捨てず、その差分をレビューして必要な最小修正のみ行う

Spark B — runtime evidence

  • tests/test_codex_issue_creator_editor_runtime_smoke.py
  • scripts/agent-ops/run_worktree_agent_runtime_smoke.py
  • spawned Codex child rollout/session evidence
    を調査する
  • expected/static value と observed/runtime value の provenance を1フィールドずつ分類
  • AC5/AC6 を誤って PASS にできる経路を列挙
  • 最小 fix を提案・実装する

Spark C — regression / concurrency / CI

  • AC5/AC6 regression design
  • rejection 3 route の bounded parallelization
  • session/output cross-talk
  • timeout VC
  • CI selection
  • Japanese Content failure
    を担当する

全 worker の終了を待ち、main thread が findings を統合する。

Spark worker の raw log を main context に貼らない。
返却は finding、path/line、root cause、recommended change、tests の compact summary に限定する。

PHASE 0 — LIVE AUTHORITY SNAPSHOT

何も捨てたり checkout し直したりする前に以下を実行する。

既存の uncommitted changes は OWNER の進行中 work とみなす。
reset --hard, checkout -- ., blind stash 等で消さない。

PR / Issue / CI の live state をローカル記憶や古い artifact より優先する。

current head SHA を REVIEW_HEAD として固定してから各 review iteration を開始する。
途中で head が変化したら旧 review verdict を破棄し、新 SHA で再レビューする。

PHASE 1 — PR #2026 SNAPSHOT RECOVERY を先に検証

#1951 / PR #2026 の snapshot-recovery 修正を operational prerequisite として確認する。
#1951 の変更を #2027 に混ぜない。

特に ABA 問題について以下を要求する。

古い snapshot:
A(body/hash, updatedAt/generation)
→ Issue 更新 B
→ body が再び A と同一内容へ戻る

このとき旧 A snapshot は authority を回復してはならない。

設計は以下の state transition にする。

stale_snapshot
→ refresh_required
→ authenticated fresh read
→ new read receipt
→ publish直前 fresh re-read / compare
→ mutation
→ postcondition fresh readback

fresh read receipt は最低限:

  • repository identity
  • issue number
  • current body hash
  • current updatedAt
  • fetch generation または ETag が取得できるなら ETag
  • source URL
  • captured timestamp
    を束縛する。

body hash の一致だけで freshness を認めない。

mutation の直前に再readし、
receipt と current body/hash/updatedAt/generation が一致しなければ mutation を中止し再materializeする。

GitHub PATCH が一般的な If-Match CAS を提供すると仮定しない。
ETag は conditional GET / freshness evidence として利用し、write CAS は application layer の pre-mutation read/compare で構成する。

最低限の regression:

  • A→B: old snapshot reject
  • A→B→A: old A snapshot reject
  • stale detection 後 fresh snapshot rebuild: accept
  • refresh 後 publish 直前に再更新: reject
  • issue number/repository mismatch: reject
  • fresh mutation 後 postcondition readback mismatch: fail
  • generated agent comment が human authority に昇格しない
  • explicit human-context lane のみ trusted OWNER directive として扱う

#2026 の Allowed Paths 内だけで修正する。

PR #2026 を current-head tests / CI / fresh review まで進める。
必要なら commit/push/PR body 更新まで行う。
ただし merge しない。

#2026 が #2027 の作業継続に必要な runtime helper を提供する場合も、
1 Issue = 1 PR を壊す cherry-pick はしない。
最終 dependency order を #2026 -> #2027 として残す。

PHASE 2 — #2027 ACTIVE CALLER CUTOVER

既存 uncommitted fixes を最初にレビューする。

current GitHub head に残っている issue-author active references をすべて分類する。

最低対象:

  • references index
  • refinement-loop-plan-output
  • speckit-taskstoissues
  • schemas/catalog

修正原則:

  • 新規 Issue create authority / producer → issue-creator
  • 既存 Issue body/comment rewrite/edit authority → issue-editor
  • generic historical prose は必要なら残せるが、active owner/caller/producer として残さない
  • deprecated path を compatibility mapping で黙って green にするだけの修正は禁止

repo-wide search を行う。

rg -n "issue-author|issue_author|ISSUE_AUTHOR" .

結果を以下に分類する。

  • active caller
  • active owner/producer
  • active executable route
  • compatibility fixture
  • historical documentation
  • unrelated schema/result name

AC2 の PASS 条件は active caller/owner/producer/executable route がゼロであること。
historical mention を機械的に全削除する必要はない。

4件の既存 uncommitted fix が正しければそのまま活用し、commit/push する。

PHASE 3 — AC5 RUNTIME EVIDENCE を真の observed evidence にする

最重要。

現在のように expected/static source から runtime evidence を組み立ててはいけない。

各 field を明示的に:

  • observed
  • declared
  • derived_from_observed
  • unavailable
    のどれかへ分類する。

declared を observed と表示したら FAIL。

3A. spawned child identity

parent thread ID と child session ID を exact correlation する。
複数候補・曖昧候補は fail closed。

Codex child rollout の session_meta.agent_role を runtime identity authority とする。
requested_agent_type == child_agent_type_observed を検証する。

root-side の
effective_agent_type = requested_agent_type
だけを runtime proof にしてはならない。

3B. effective permission / sandbox / model

agent TOML の default_permissions を effective runtime permission として記録しない。

spawned child session の rollout にある turn_context を解析し、
利用可能なら以下を observed evidence として取得する。

  • permission_profile
  • approval_policy
  • sandbox_policy / filesystem policy
  • model
  • turn_id
  • child session correlation

expected TOML 値との比較は
declared_* vs observed_*
として別フィールドにする。

runtime field が CLI version で取得不能なら unavailable とし、
static value で穴埋めして PASS にしない。

3C. Skill evidence

ローカル canonical file を二回 hash して
canonical_skill_sha256 == loaded_readback_sha256
とする実装を廃止する。

必要なのは:

  1. canonical repo Skill path/realpath/hash — static contract evidence
  2. spawned child が実際に選択/readした Skill — runtime evidence

child turn_context.turn_skills が十分な runtime identity/path 情報を持つならそれを使う。

hash まで得られない場合、
child 内で固定された read-only attestation を実行し、
exact canonical Skill path の realpath と SHA-256 を取得する。
raw transcript 全体は保存せず、allowlisted field のみ parser が抽出する。

child の自由文自己申告だけを evidence にしない。

3D. executor / route decision

ROUTE_CONTRACTS dict や pytest parameter から
selected_executor, effective_route, route_decision
を生成して runtime evidence と呼ばない。

positive route では、mutation を行わずに
controlled executor / dispatcher の dry-run・preflight route decision を実際に通す。

既存 create_issue_txn.py / edit_issue_txn.py に safe dry-run / validation surface があるなら再利用する。
無い場合は Allowed Paths 内で最小の deterministic observation surface を作る。

実 mutationは禁止。

observed evidence として:

  • selected executor
  • route
  • decision
  • transaction/preflight result
    を得る。

3E. refusal

wrong-route prompt に
「拒否してこの marker を出せ」
と命令し、モデルが marker を返しただけでは AC6 PASS にしない。

creator→edit
editor→create
unknown route

はいずれも mutation-capable executor より前の deterministic route guard / controlled preflight で拒否させ、その observed decision を証拠化する。

モデル最終文は補助情報でしかない。

3F. mutation_attempted

mutation_attempted = False を定数で書かない。

executor invocation / mutation transport / controlled transaction counter 等、
observed event から導出する。

clean worktree だけでは GitHub mutation が無かった証明にならない。

3G. evidence hygiene

persist してよいものは allowlist-only:

  • IDs
  • hashes
  • paths relative to repo
  • role
  • route
  • permission/profile enum
  • executor name
  • booleans
  • terminal event
  • tested SHA
  • Codex version

raw transcript、token、credential、full prompt、unbounded tool result を保存しない。

PHASE 4 — AC6 PERFORMANCE / PARALLEL ISOLATION

3 rejection routes は mutation prohibited なので bounded parallel execution を許可する。

ただし以下を検証する。

  • case ごとに unique output dir
  • unique run ID
  • unique parent/child session correlation
  • marker/evidence cross-talk なし
  • 全 case の tested_head が同一
  • shared artifact overwrite なし
  • worktree postcondition clean
  • GitHub mutation なし
  • runtime session scanner が別 case の child を拾わない

単発成功だけでなく少なくとも複数回反復し、
VC 100 秒以内の wall-clock が再現することを確認する。

flaky なら無制限並列化せず concurrency を下げる。

timing evidence は:

  • exact command
  • case count
  • concurrency
  • per-case duration
  • total wall clock
    を残す。

PHASE 5 — #1909 / #1943 SEMANTIC PREFLIGHT

#1909 と #1943 の current body と current main を読む。

#1909 の contract に旧 issue-author topology が残っていても、
それ自体を #1952 のコード scope に混ぜない。

判定:

#1943 も同様に semantic conflict のみ判定する。
literal Allowed Paths overlap だけで block しない。

新規 Issue は作らない。

PHASE 6 — VALIDATION

current head に対して最低限以下を実行する。

Issue #1952 Verification Commands 全件。

加えて:

  • node scripts/check-codex-agents.mjs
  • uv run --locked python3 scripts/check_codex_agent_config.py --assert-runtime-contract
  • uv run --locked python3 scripts/check_claude_codex_agent_parity.py --strict
  • relevant agent inventory tests
  • runtime runner tests
  • changed issue-refinement-loop regression tests
  • git diff --check

main に追加済みの Skill structural validator も確認する。
python scripts/validate_skill_contracts.py --json
の invalid/broken count を読み、
関連 pytest/gate も実行する。
単に process exit 0 だけを成功条件にしない。

CI test selection を再生成し:

  • changed tests
  • uncovered tests
  • lane selection
    を current diff に対して再検証する。

PHASE 7 — CURRENT CI

push 後、必ず新しい PR head SHA を取得する。

旧 SHA の green check を再利用しない。

GitHub Actions を current head で確認する。

failure があれば:
gh run view <run-id> --log-failed
または job 単位の log を取得して root cause を読む。

特に Japanese Content は
「PR body ratio」ではなく changed Markdown failure の実ログを確認し、
原因となったファイルだけを修正する。

component VRT が report-only であることを live workflow / branch protection でも確認する。
required check なら解消する。
本当に report-only なら MERGE_READY blocker にしないが、最終報告には残す。

required checks が pending/queued の間は MERGE_READY と宣言しない。

PHASE 8 — ADVERSARIAL REVIEW LOOP

各 implementation commit 後に fresh review を行う。

review は必ず current PR head SHA に束縛する。

Spark worker は最終 judgment を行わない。
最終 review は pr-reviewer / pr-review-judge または main reasoning lane で行う。

毎 iteration:

  1. current main を fetch
  2. current PR head を取得
  3. diff / Issue contract / related Issues / CI / comments を再取得
  4. P0/P1/P2 を独立判定
  5. P0/P1 のうち defensible なものを全て修正
  6. tests
  7. commit
  8. push
  9. current-head CI
  10. fresh review

stale review SHA の verdict を次 iteration に流用しない。

以下が揃うまで bounded iteration を継続する。

新規 finding が出なくなった時点で終了する。

PHASE 9 — PR BODY REFRESH

#2027 PR body の stale evidence をすべて current head へ更新する。

必須:

  • exact final head SHA
  • exact base/main SHA
  • AC ごとの current-head command/result
  • AC5 observed-vs-declared provenance
  • AC6 concurrency / wall-clock
  • SKIP 77 があれば PASS と区別
  • required CI status
  • report-only failures
  • Allowed Paths compliance
  • Safety Claim Matrix
  • Closes #1952

current head と書きながら別 SHA の結果を貼らない。

#2026 を修正した場合も同様に、
PR body に古い live-preflight SHA を残さず final head の evidence へ更新する。

PHASE 10 — PRE-MERGE TERMINAL STATE

条件を全部満たした場合:
-必要なら Draft を Ready for review に変更してよい

  • merge はしない
  • Issue close はしない

最終出力は以下だけを compact に返す。

PRE_MERGE_RESULT_V1

  • pr_2026_head_sha
  • pr_2026_verdict
  • pr_2027_head_sha
  • pr_2027_base_sha
  • pr_2027_verdict
  • reviewed_head_sha
  • current_main_sha
  • p0_remaining
  • p1_remaining
  • ac1_ac7
  • runtime_evidence_authority
  • ac6_wall_clock
  • required_checks
  • report_only_failures
  • active_issue_author_references
  • dependency_order
  • merge_performed: false
  • human_approval_needed: false | true
  • blockers

pr_2027_verdict: MERGE_READY は、
current-head fresh review が approve 相当かつ required checks が全成功の場合だけ許可する。

それ以外は REQUEST_CHANGES または BLOCKED とし、事実を成功へ読み替えない。

この場の ChatGPT ツールセットには Codex の spawn_agent を直接起動する操作面が公開されていないため、私が実際に Spark subagent を起動したとは扱っていません。上の実行プロンプトでは、今回の人間指定を明示的な一時 authorization として Spark worker を優先使用しつつ、常設 issue-creator / issue-editor のモデル設定は保護するよう固定しています。

@squne121

squne121 commented Aug 8, 2026

Copy link
Copy Markdown
Owner Author

テスト、レビュー、再実装ループフェイズおよび最終報告などのコメントがない。CodexCLIの時だけ(ClaudeCodeのときはコメントがある)。仕様の差異によるものか調査して、同様の挙動をさせるにはどうしたらいいかWEB調査してほしい。
impl-review-loop スキルの問題か?

@squne121

squne121 commented Aug 8, 2026

Copy link
Copy Markdown
Owner Author

判定

REQUEST_CHANGES。現状の PR #2027 はマージ不可です。

確認時点の PR は Draft・open、HEAD は e8e36f7b6362cb79cbc41d676e4ea8d749375a0d です。一方、PR 本文の AC 検証は旧 HEAD 248d2d586def16e189aa8f59d7e58537fc0d0a6a に固定されたままで、現 HEAD の ci workflow も failure です。

重大度別では、P0 が2件、P1が4件あります。


重大指摘

P0-1 — AC2は現 HEAD でも未達。旧 issue-author の active caller が残っている

Issue #1952 の AC2 は、agent 定義だけでなく、inventory、fixture、callers が旧 role を要求・参照しないことを要求しています。また、OWNER reframe により次の4ファイルは明示的に Allowed Paths へ追加されています。

しかし、現 HEAD には以下が残っています。

  • references/index.md

    • AC/VC reflection の owner が issue-author
    • follow-up materialization が orchestrator + issue-author
  • refinement-loop-plan-output.md

    • fail-closed rewrite を issue-author に forward
    • structured repair の主体も issue-author
  • speckit-taskstoissues/SKILL.md

    • Issue 起票は issue-author / create-issue 経由と記載
  • schemas/catalog.yaml

    • issue_contract/v1 などの producer owner が issue-author
    • definition path も削除対象の .claude/skills/issue-author/ を指している

これは単なる文書上の古い名称ではありません。実行時 caller、rewrite authority、schema producer topology に残る active reference です。旧 agent を削除した状態では、dispatch failure、存在しない Skill への参照、あるいは orchestrator による暗黙 fallback を誘発します。

修正要求

役割を操作別に分けてください。

  • 新規 Issue 作成・follow-up materialization → issue-creator

  • 既存 Issue 本文の rewrite・repair・AC/VC reflection → issue-editor

  • schema catalog は単純な一括 rename ではなく、

    • initial producer
    • post-creation mutator/editor
      を区別すること

さらに、現 HEAD に対して少なくとも次の negative inventory を required test にしてください。

rg -n \
  'issue-author|\.claude/skills/issue-author|\.codex/agents/issue-author' \
  .claude .codex schemas scripts tests

historical migration note や fixture 名として許可する箇所は、明示的 allowlist に限定すべきです。


P0-2 — AC5/AC6の「runtime evidence」は、かなりの部分がテスト側の再構成値

runtime smoke は Codex child の spawn や terminal event の一部を観測しています。しかし、AC5/AC6 の主要 field は child runtime の観測値ではありません。

_source_manifest() は次のように証跡を組み立てています。

  • effective_permission_profile

    • .codex/agents/{role}.toml の default_permissions を読む
    • コード自身が「Codex structured event stream では独立観測できない」と認めている
  • effective_skill_configuration

    • ROUTE_CONTRACTS とローカル path から決定
  • canonical_skill_sha256

  • loaded_readback_sha256

    • 同じローカル SKILL.md を二度 hash
  • selected_executor

    • hard-coded ROUTE_CONTRACTS から決定
  • effective_route / route_decision

    • テスト引数 route と refusal から決定
  • mutation_attempted

    • 常に False
  • marker_verified_by_runner

    • 常に True

特に拒否テストは、誤 route を実際の mutation entrypoint に投入して enforcement layer に拒否させているのではありません。

テストプロンプトが最初から、

拒否して、指定 marker を出力せよ

と指示し、返された marker を確認しています。これはモデルの指示追従テストであって、creator が edit authority を行使できないことを証明する authorization test ではありません。

Issue #1952 は、static fallback を runtime PASS に昇格しないこと、requested/effective agent、effective profile、loaded/readback hash、executor、route decision、mutation attempted を actual spawned runtime で証跡化することを要求しています。現実装はこの条件を満たしていません。

修正要求

証跡 schema を declared_* と observed_* に分離してください。

declared:
  agent_type: issue-creator
  permission_profile: workspace-write
  canonical_skill_path: .agents/skills/create-issue/SKILL.md

observed:
  child_agent_type: issue-creator
  effective_permission_profile:
    status: observed | unavailable
    value: null
    source_event: null
  loaded_skill:
    realpath: null
    sha256: null
    source_event: null
  executor:
    path: null
    invocation_observed: false
  mutation:
    attempted: unknown
    observed_channels: []

原則は以下です。

  1. TOML・fixture・定数由来の値を effective_* と呼ばない。
  2. runtime が field を公開しない場合は unavailable とし、期待値を代入しない。
  3. loaded Skill hash は child 側の readback receipt または runner が観測した実際の file-open/tool event に束縛する。
  4. executor は hard-coded mapping ではなく、実際の command/tool invocation を観測する。
  5. mutation_attempted=false は、filesystem、Git、GitHub API、shell、network の観測対象を明記できる場合だけ成立させる。
  6. 観測できない AC5 field がある場合は Issue 契約どおり exit 77 / SKIP とし、PASS にしない。

誤 route の陰性試験も、自然言語で「拒否せよ」と頼むのではなく、creator に edit transaction input を渡すなど、実際の誤 route entrypointを通し、controlled executor の前段で拒否された receipt を検証すべきです。


P1-1 — PR本文と証跡がcurrent HEADに束縛されていない

PR本文は「current head 248d2d… で検証」としていますが、実際の HEAD は e8e36f7… です。さらに本文では artifacts/agent-runtime-smoke/... を current-head artifact としていますが、artifact ID、digest、CI run ID、取得可能な attachment への束縛がありません。

現在の本文では、第三者レビュー時に次を判別できません。

  • どの commit で5 route smokeを実行したか
  • 現 HEAD との差分後に再実行したか
  • artifact がローカル worktree のみに存在するのか
  • summary と source manifest が後編集されていないか

修正要求

最終 push 後にのみ本文を再生成し、少なくとも以下を載せてください。

reviewed_head_sha: e8e36f...
runtime_evidence:
  workflow_run_id: <id>
  artifact_id: <id>
  artifact_digest: sha256:<digest>
  producer_commit_sha: e8e36f...
  command_sha256: sha256:<digest>
  completed_at: <timestamp>

HEAD が変化した時点で、旧 artifact は stale として無効化してください。


P1-2 — current HEAD の required gate が失敗している

現 HEAD の ci workflow は completed/failure です。したがって、PR本文の全 AC PASS と current-head verification 完了という主張は成立しません。

Step 4 の契約も、required checks が failed、pending timeout、no checks、skipped only の場合に fail-closedで REQUEST_CHANGES とすることを要求しています。

少なくとも次を完了するまでは Draft 維持が妥当です。

  • current HEAD の CI failure を修正
    -全 required checks の成功
  • current HEAD で AC1–AC7 を再実行
    -その HEAD に対する独立レビュー
  • PR本文を同じ HEAD に更新

P1-3 — 指定コメントの症状は「Codexの仕様差」だけではない

OWNER コメントは、Codex CLI 実行時にテスト、レビュー、再実装フェーズ、最終報告のコメントがない点を問題にしています。

現行 impl-review-loop の契約を分解すると、結論は次のとおりです。

テストフェーズのコメント欠如

仕様どおりです。

Step 2 は、test-runner がPRコメントを投稿せず、read-only report を root/control-plane に返すと明示しています。TEST_VERDICT comment の存在も routing 正本ではありません。

したがって、「Claude Code の時と同じようにテスト進捗コメントを残す」ことを要求するなら、これは実装バグ修正ではなく仕様変更です。

PRレビューコメントの欠如

契約違反です。

Step 4 は、pr-reviewer 自身は read-only としつつ、control-plane が gh pr comment --body-file で verdict コメントを投稿することを明示しています。本文には verdict、reviewed_head_sha、blockers、warnings が必要です。

最終報告の欠如

正規の impl-review-loop が終端まで実行されたなら契約違反です。

Step 5 は終了理由、loop state、blockers、human escalation 等を終了報告コメントへ materialize する設計です。

再実装フェーズの進捗コメント

現行契約では、各 implementation iteration を必ずPRコメントへ公開する統一 schema がありません。内部 LOOP_STATE と child result は定義されていますが、可視化は必須化されていません。

したがって指定コメントへの直接回答は以下です。

一部は impl-review-loop の仕様不足、一部は実行時のcontrol-plane契約違反です。Codex CLIの構造上コメントできないわけではありません。

また、PR上に durable な run_id、skill invocation receipt、phase receipt がないため、今回は「正規の /impl-review-loop が起動されなかった」のか、「起動されたが publish step が脱落した」のかを事後に判別できません。この判別不能性自体が workflow defect です。


P1-4 — raw gh pr comment 依存では冪等性・再開性・並行実行に弱い

現行 Step 4 は、control-plane が通常の gh pr comment --body-file を呼ぶ最小設計です。ところが、リポジトリには既に以下を備えた marker-comment 実装があります。

  • repo / issue / PR / run ID の ownership marker
  • payload SHA256
  • body size validation
  • malformed/duplicate marker 検出
  • 403 / 404 / 410 / 422 / secondary rate limit の分類
  • GitHub Issue Comments API を用いた list/create/update

これを使わず、モデルに毎回 plain gh pr comment を忘れず呼ばせる設計は脆弱です。

GitHub CLI の --edit-last は「現在のユーザーによる最後のコメント」を編集するだけで、run/phase 固有のコメントを識別しません。並行run、手動コメント、別automationが介在すると誤更新します。(GitHub CLI)

PR conversation comment は GitHub API 上では Issue Comments endpoint で管理でき、comment IDを指定して正確に更新できます。([GitHub Docs]2)

必要な実装

worker、test-runner、pr-reviewer は引き続き read-only に保ち、root/control-plane が同期的に deterministic publisher を呼ぶ構造にしてください。

schema_version: impl_review_loop_status/v1
repository: squne121/loop-protocol
issue_number: 1952
pr_number: 2027
run_id: <stable-run-id>
iteration: 1
phase: implementation | verification | review | final
state: running | passed | failed | blocked | skipped
provider: codex | claude
head_sha: <current-head>
source_result_sha256: sha256:<digest>
updated_at: <timestamp>

PR上にはrun単位で1つの状態コメントを upsertします。

<!-- impl_review_loop_status:v1 repo=squne121/loop-protocol pr=2027 run_id=<id> -->
<!-- impl_review_loop_status_digest:v1 sha256=<digest> -->

処理順序は以下です。

  1. current HEAD と Issue body digest を読む。
  2. child result を閉じたschemaで検証する。
  3. ownership marker で既存コメントを検索する。
  4. 0件ならPOST、1件ならcomment IDを指定してPATCH。
  5. 2件以上またはmalformed markerならfail-closed。
  6. 投稿後にコメント本文、digest、target PR、HEADを再読する。
  7. comment_id、URL、digest、HEADを publisher receipt として保存する。
  8. publish失敗時はループ成功にしない。

「implementation、verification、reviewごとに新規コメントを増やす」のではなく、進捗は1コメントを更新し、最終結果だけlinked Issueへ残す方が、通知スパムと履歴汚染を抑えられます。


Codex CLIとClaude Codeの仕様差について

Codexにも SubagentStop と Stop があり、SubagentStop には agent_id、agent_type、subagent transcript、最終assistant messageが含まれます。したがって、subagent完了を検出してrootへ返す機構は存在します。([OpenAI Developers]3)

また、codex exec --json はJSONLで thread.started、turn.completed、turn.failed、item.*、error 等を出力し、--output-schema で最終結果を構造化できます。provider-neutralなcontrol-planeを構成するには十分なsurfaceです。([OpenAI Developers]4)

Claude Code側にも SubagentStop があり、agent_id、agent_type、subagent transcript、最終メッセージをhookへ渡せます。([Claude]5)

ただし、Codex hookには以下の運用上の注意があります。

  • repo-local hook はproject trustに依存する
  • 複数のmatching command hookは並行起動される
  • hook sourceが複数ある場合は全て読み込まれる ([OpenAI Developers]3)

したがって、hookをGitHubコメント公開の唯一の正規経路にするべきではありません。

推奨する責務分離は次です。

  • SubagentStop / Stop

    • telemetry
    • orphaned run検出
    • child transcript/result回収
  • root/control-plane

    • schema validation
    • HEAD drift確認
    • deterministic comment upsert
    • postcondition readback
    • retry / fail-closed判定

これにより、Claude CodeとCodex CLIの違いをhook adapter内に閉じ込め、GitHub上の挙動を共通化できます。


PR #2027内で直すものと、別Issueに分けるもの

PR #2027で必須

  1. 4 active caller の issue-author cutover。
  2. AC5/AC6 evidence を静的再構成から実観測へ変更。
  3. 誤routeを実際のentrypointへ投入する陰性試験。
  4. current HEADに全証跡を再束縛。
  5. CI failure修正。
  6. PR本文の stale SHA、テスト数、artifact情報更新。
  7. current HEADに対する独立レビュー verdict の投稿。

別Issue/PRにすべきもの

impl-review-loop のphase-comment parity修正は、Issue #1952 の Allowed Paths に含まれていません。Issue #1952自身も、Allowed Paths外の変更が必要になった場合を停止条件としています。

そのため、同じPRへ無断で impl-review-loop、Codex hooks、publisher infrastructure の変更を混ぜるべきではありません。OWNERが #1952 を再reframeしない限り、次のfollow-up Issueが妥当です。

Follow-up Issue草案

Title

impl-review-loop: Codex/Claude共通のphase status・final report publisherを実装する

Acceptance Criteria

  1. Codex/Claude双方が同じ IMPL_REVIEW_LOOP_STATUS_V1 を生成する。
  2. worker/reviewer/test-runnerはGitHub writeを持たない。
  3. root control-planeがmarker-based upsertを実行する。
  4. implementation / verification / review / finalの各遷移がhead-boundで記録される。
  5. 再実行しても同じrun markerのコメントは1件だけ存在する。
  6. HEAD drift後に旧 APPROVE を公開しない。
  7. crash-after-result-before-publishを再開可能にする。
  8. 403、404、422、secondary rate limit、network timeoutをfail-closedで分類する。
  9. untrusted hook、hook未発火、複数hook並行実行でも正規publisherは影響を受けない。
  10. Codex exec --json、interactive Codex、Claude Codeそれぞれのintegration testを持つ。
  11. final reportには run_id、Issue/PR、reviewed HEAD、iteration、termination reason、comment receiptを含める。
  12. gh pr comment --edit-last を使用しない。

マージ許可条件

PR #2027を再レビュー可能な状態にする最低条件は次です。

  • issue-author のactive callerが0件
  • AC5/AC6の全fieldに declared / observed provenanceがある
  • 誤route拒否がモデルの自己申告ではなく、enforcement receiptで確認できる
  • unavailable fieldを期待値で補完しない
  • current HEADとPR本文のevidence SHAが一致
  • current HEADのrequired CIが全成功
  • artifacts/agent-runtime-smoke が取得可能なartifact ID・digestに束縛されている
  • current HEADに対するPR review verdictコメントが存在
  • ownerコメント #5225472309 に、仕様差・実行契約違反・follow-up方針を明記した回答がある

現状では、PR本文の AC2、AC5、AC6達成宣言はいずれも撤回または未達へ戻すべきです。本レビューではGitHubへのコメント投稿や変更操作は行っていません。

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.

実装: Codex issue-creator / issue-editor を分離し controlled mutation route を検証する

1 participant