Skip to content

fix: edit transaction が履歴 Issue の note-only 更新を既存 readiness 欠陥だけで拒否しないようにする (#2922) - #2934

Merged
squne121 merged 6 commits into
mainfrom
worktree-issue-2922-edit-txn-preexisting-readiness
Oct 5, 2026
Merged

squne121 merged 6 commits into
mainfrom
worktree-issue-2922-edit-txn-preexisting-readiness

Conversation

@squne121

@squne121 squne121 commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

Closes #2922 (本 PR のマージで Issue を完了します)

CLOSED の履歴 Issue に対する note-only 更新が、編集前から存在する readiness 欠陥だけを理由に edit_issue_txn.py で拒否される問題を解消します。

  • needs_fix(resolution_evidence なし)forwarding の拒否を live readback 後へ遅延します。live state は _fetch_issue の 1 回の readback(gh issue view --json title,body,updatedAt,state)から title / body / updatedAt / state を同一 snapshot として取得します(別 request の state 取得は行いません。state の欠落・非文字列・readback 失敗は fail-closed で従来の拒否 code を維持)。human_judgment / input_or_runtime_error は従来どおり即 fail-closed です。
  • 互換 lane は次をすべて満たす場合のみ成立します。live state が CLOSED、title 更新なし、native relationship が absent または no-op、hygiene autofix 後の mutated_candidate で ## Notes for Reviewer 以外の H2 section が live と同一、実 contract_readiness_check.py --mode static の (rule_id, category, section, minimal_context) multiset が live と candidate で完全一致。
  • checker 出力が JSON でない、または exit code が 0 / 1 以外の場合は fail-closed です。subset 修復と欠陥増加は拒否されます。
  • expected_previous_body_sha256 / updatedAt 照合、guard / hygiene、post-edit readback は従来どおり実行し、ISSUE_EDIT_TXN_RESULT_V1 の key / schema と成功時 errors 空は不変です。

受け入れ条件の達成状況

  • AC1: 達成。test_preexisting_readiness_note_only_allowed(needs_fix forwarding 経由と candidate static readiness 経由の両方)。
  • AC2: 達成。test_preexisting_readiness_worsened_rejected(新規欠陥、件数増加、subset 修復を拒否。line / fix_hint の差のみは許容)。
  • AC3: 達成。test_preexisting_readiness_open_issue_unchanged(OPEN は子プロセス起動なし・mutation なしで従来どおり拒否)。
  • AC4: 達成。test_preexisting_readiness_note_surface_only(各 H2 section の変更と hygiene autofix 由来の変更を拒否)。
  • AC5: 達成。test_preexisting_readiness_sha_and_readback_preserved。
  • AC6: 達成。test_preexisting_readiness_human_judgment_fail_closed。
  • AC7: 達成。test_preexisting_readiness_title_or_relationship_rejected。
  • AC8: 達成。test_preexisting_readiness_real_checker_integration と test_preexisting_readiness_checker_output_fail_closed。
  • AC9: 達成。test_preexisting_readiness_result_schema_unchanged。
  • AC10: 達成。.claude/skills/edit-issue/tests/ 配下 340 件が PASS。
  • AC11: 達成。test_preexisting_readiness_single_snapshot_fetch_issue と scripts/agent-guards/tests/test_skill_runtime_exec_anchor.py(21 件)が PASS。
  • AC12: 達成。test_preexisting_readiness_note_boundary_commonmark_fence_semantics(22 variant、判定 helper と run_transaction の end-to-end の双方)が PASS。

検証コマンド結果

  • AC1 から AC9 の各 VC(node id 指定の pytest)はすべて PASS。
  • AC10: uv run --locked pytest .claude/skills/edit-issue/tests/ -q は 340 passed。
  • AC11: uv run --locked pytest scripts/agent-guards/tests/test_skill_runtime_exec_anchor.py -q は 21 passed。
  • AC12: fence / H2 境界の regression は 22 passed。旧 _split_h2_sections に戻すと 22 variant 中 10 件が失敗することを確認済みです。
  • 変異検証として、multiset 比較、CLOSED 判定、note surface 比較をそれぞれ無効化すると新規 test が失敗することを確認しました。

Allowed Paths 遵守

変更ファイルは次の 4 件のみで、Allowed Paths(Issue #2922 の contract 更新で test_skill_runtime_exec_anchor.py を追加済み)に収まっています。

  • .claude/skills/edit-issue/scripts/edit_issue_txn.py
  • .claude/skills/edit-issue/tests/test_edit_issue_txn.py
  • .claude/skills/edit-issue/tests/test_edit_issue_txn_preexisting_readiness.py(新規)
  • scripts/agent-guards/tests/test_skill_runtime_exec_anchor.py(exact-argv の fake に state 付き argv を追加する最小追随のみ)

Checks

  • uv run --locked pytest .claude/skills/edit-issue/tests/ -q: 340 passed
  • uv run --locked ruff check .claude/skills/edit-issue: All checks passed
  • 関連する .claude/agents/tests と impl-review-loop の edit 関連 test: PASS
  • .github/ci/python-test-plan.json は .claude/skills/edit-issue/tests/ ディレクトリ target で新規 test file を既に網羅しているため、変更していません。

Schema Change Applicability

  • decision: not_schema_change
  • reason: ISSUE_EDIT_TXN_INPUT_V1 / ISSUE_EDIT_TXN_RESULT_V1 の key / schema は変更していません。

Schema Consumer Inventory

N/A
reason: schema 変更がないため consumer の洗い出し対象はありません。

Safety Claim Matrix

Claim Implemented? Not controlled Evidence Follow-up
OPEN Issue は従来どおり拒否される はい none test_preexisting_readiness_open_issue_unchanged -
欠陥増加・subset 修復・note surface 外変更・title / relationship 同居は拒否される はい none test_preexisting_readiness_worsened_rejected ほか -
checker 出力不正(非 JSON / exit code が 0, 1 以外)は fail-closed はい none test_preexisting_readiness_checker_output_fail_closed -

Notes

本 PR は Claude Code により作成されました。
🤖 Generated with Claude Code

IMPLEMENTATION_SCOPE_COVERAGE_V1:
  schema_version: "IMPLEMENTATION_SCOPE_COVERAGE_V1"
  issue_number: 2922
  issue_body_sha256: "sha256:6afc444434edf6dcd29240f7d6223f15fb0908cf8c50b770241c008872beb7ba"
  normalized_scope_manifest_sha256: "sha256:220def1c2e1a9318312f3f3bd70cb826ff6ee788aed81fc3046b54eb0e82432a"
  pr_head_sha: "d06812020014c40bbef106292f348206b156c7e9"
  scope_manifest: {"acceptance_criteria": ["## Notes for Reviewer の境界判定が CommonMark の fence semantics と一致する。4 spaces indent の fence 風 line は fence opener にならず、4-backtick opener は 3-backtick で閉じず、同種かつ opening 以上の長さの closer のみが閉じ、Notes より後ろの real H2(0-3 spaces indent 含む)の変更が互換 lane で拒否される(readiness defect multiset が偶然同一でも拒否される end-to-end を含む)。", "CLOSED でも title_update.required == true、または native_relationships が no-op でない(parent.action が set / remove、または add_* / remove_* が非空)transaction は互換 lane で拒否される。", "CLOSED でも、mutated_candidate の ## Notes for Reviewer 以外のいずれかの H2 section(Machine-Readable Contract、Outcome、In Scope、Out of Scope、Acceptance Criteria、Verification Commands、Allowed Paths、Stop Conditions、Delivery Rule 等)が live body と異なる更新は拒否される。hygiene autofix で変化した内容も比較対象に含まれる。", "_fetch_issue が 1 回の gh issue view --json title,body,updatedAt,state readback から state を取得し(別 request の state 取得 helper を持たない)、scripts/agent-guards/tests/test_skill_runtime_exec_anchor.py が PASS する。", "candidate が live body に無い readiness 欠陥を追加する、または同一 key の欠陥件数を増やす更新、および欠陥を一部解消する subset 更新は、従来どおり failed_no_mutation で拒否される。line_start / line_end / fix_hint の差だけでは拒否されない。", "edit_issue_txn.py、既存 test_edit_issue_txn.py、新規 test_edit_issue_txn_preexisting_readiness.py を含む .claude/skills/edit-issue/tests/ 配下の test がすべて PASS する。", "forwarding の human_judgment / input_or_runtime_error は live state・内容に関わらず従来どおり即 fail-closed(human_judgment、mutation なし)となる。", "live state が CLOSED で、body のみの transaction であり、mutated_candidate の ## Notes for Reviewer 以外の全 H2 section が live body と byte 同一で、live と candidate の blocking error multiset が完全一致する更新は、needs_fix forwarding 経由でも candidate static readiness 失敗経由でも pre-existing defect だけを理由に拒否されず、body 更新と readback が実行される。", "live state が OPEN の Issue(新規実装・再開 Issue を含む)は、live body に同じ欠陥があっても従来どおり拒否される。needs_fix(resolution_evidence 無し)forwarding は readiness_needs_fix_without_resolution_evidence で failed_no_mutation となり、子プロセス起動も mutation も行われない。", "互換 lane でも expected_previous_body_sha256 不一致と updatedAt 不一致は拒否され、post-edit readback 不一致は failed_after_mutation として報告される。", "互換 lane 成功時の ISSUE_EDIT_TXN_RESULT_V1 は key 集合が従来と同一で、errors が空である。", "実 contract_readiness_check.py --mode static を historical RUNTIMEASSERT001 系 fixture 本文に対して起動する test が存在し、live と note 追記後 candidate の error multiset 一致(行番号差を許容)と、欠陥増加時の不一致を検出する。checker 出力が JSON でない、または exit code が 0 / 1 以外の場合は fail-closed となる。"], "allowed_paths": [".claude/skills/edit-issue/scripts/edit_issue_txn.py", ".claude/skills/edit-issue/tests/test_edit_issue_txn.py", ".claude/skills/edit-issue/tests/test_edit_issue_txn_preexisting_readiness.py", "scripts/agent-guards/tests/test_skill_runtime_exec_anchor.py"], "change_kind": "workflow", "goal_ref": "gate 導入前の履歴 Issue の注記更新が、既存の readiness 欠陥だけを理由に edit transaction で拒否される状態を解消する", "in_scope": ["ISSUE_EDIT_TXN_RESULT_V1 の key / schema は変更せず、成功 result の errors は空のままとする(成功時 errors[] を telemetry に流用しない)。", "_fetch_issue の 1 回の live readback(--json title,body,updatedAt,state)から title / body / updatedAt / state を同一 snapshot として取得し、その state で CLOSED を判定する(caller 申告・別 request の state 取得は使わない)。この変更で exact-argv の fake が壊れる scripts/agent-guards/tests/test_skill_runtime_exec_anchor.py は、production の semantics を歪めず、fake の許容 argv に state 付き形を追随させる最小修正のみ行う。", "defect identity: live body と mutated_candidate の双方に実 contract_readiness_check.py --mode static を実行し、errors[] の各要素の (rule_id, category, section, minimal_context) を不透明な値とする multiset(collections.Counter、multiplicity 保持)が完全一致する。line_start / line_end / fix_hint は比較から除外する。minimal_context 等の prose は再パースしない。checker 出力が JSON でない、または exit code が 0 / 1 以外なら fail-closed とする。candidate が live に無い error を持つ、または件数が増える場合は拒否する。subset / partial repair は対象外(通常 readiness lane に任せる)。", "live state が CLOSED である。", "native_relationships が absent、または明確な no-op(parent.action == unchanged かつ add_* / remove_* がすべて空)である。", "note surface: 実際に write される hygiene autofix 後の mutated_candidate について、変更可能なのは ## Notes for Reviewer section のみ(無ければ追加)とし、それ以外の全 H2 section が live body と byte 同一である。比較対象は raw candidate ではなく mutated_candidate。H2 境界と fenced code block の判定は、独自 parser を持たず、repo の GFM/CommonMark 準拠 shared primitive(.claude/skills/create-issue/scripts/prose_boundary_policy.py の iter_markdown_blocks() / parse_atx_heading_line())を再利用する(indent 4 spaces 以上の fence 風 line は fence opener ではない、closing fence は同種かつ opening 以上の長さのみ、0-3 spaces indent の ATX H2 も H2 として扱う)。", "title_update が absent または required == false である。", "上記を新規 test file test_edit_issue_txn_preexisting_readiness.py の test で固定する(既存 test_edit_issue_txn.py は必要な更新・共通 helper 利用のみ)。gh の mutation / readback は fake でよいが、実 contract_readiness_check.py --mode static を historical RUNTIMEASSERT001 系 fixture 本文(hook-chain-runtime-smoke / subagent-lifecycle-causal-evidence-smoke の runtime_assertion_bindings 未宣言を再現するもの)に対して起動する test を最低 1 本含める。", "互換 lane は transaction 全体を拘束する。以下をすべて満たす場合のみ、candidate の readiness 失敗を pre-existing defect だけとして通す。", "前段 gate の遅延: readiness_forwarding_payload.readiness_result.status が needs_fix(resolution_evidence 無し)の場合のみ、_fetch_issue による live readback 後まで拒否判定を遅延する。human_judgment / input_or_runtime_error は従来どおり即 fail-closed とする。下記互換 lane の条件を 1 つでも満たさない場合は、従来と同一の readiness_needs_fix_without_resolution_evidence・failed_no_mutation・子プロセス起動なし・mutation なしを維持する。既存 guard を無条件には解除しない。", "通した場合も guard / hygiene、expected_previous_body_sha256 照合、updatedAt 照合、post-edit readback は従来どおり実行する。"], "schema_version": "IMPLEMENTATION_SCOPE_MANIFEST_V1"}

…いようにする (#2922)

CLOSED の履歴 Issue で、Notes for Reviewer 以外の H2 section が live と同一、かつ
実 contract_readiness_check.py の blocking 欠陥 multiset が live と完全一致する
更新に限り、pre-existing readiness 欠陥だけを理由にした拒否を行わない互換 lane を追加する。
needs_fix forwarding の拒否は live readback 後へ遅延し、_fetch_issue は state を取得する。
OPEN Issue、欠陥増加、subset 修復、note surface 外変更、title / relationship 同居は従来どおり拒否する。

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Preview URL

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

The preview will be removed when this PR is closed.

_fetch_issue が title,body,updatedAt,state を要求するようになり、exact argv で
照合する既存 fake gh (test_skill_runtime_exec_anchor.py) が拒否して
python-test-core が失敗していた。_fetch_issue は従来の
--json title,body,updatedAt に戻し、state は互換 lane が実際に必要とする
場合のみ _fetch_issue_state (gh issue view --json state) で live readback する。
readback 失敗・不正・欠落は fail-closed で従来の拒否 code を維持する。

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@squne121

squne121 commented Oct 4, 2026

Copy link
Copy Markdown
Owner Author

PR レビュー結果(impl-review-loop / iteration 1)

判定: APPROVE(レビュー対象 head 5df0b8d4cb29b0ba70c16b5e7e6369bd32588e97)

根拠

  • 変更ファイルは Allowed Paths の 3 件と完全に一致し、範囲外の変更はありません。
  • Verification Commands 11 件(AC1〜AC10)は current head で全て pass しました。AC10 の edit-issue/tests/ は 321 passed です。
  • required CI は 6 件全て成功し、mergeStateStatus は CLEAN です。
  • 初回 head 7e71a5ea では test_skill_runtime_exec_anchor.py の 5 件が失敗しましたが、_fetch_issue の argv を従来形へ戻し live state を別 readback で取得する修正で解消し、-k contract_update の 11 件が pass することを確認しました。

Blockers

なし

Warnings(非ブロッキング)

  • 転送された needs_fix かつ CLOSED かつ本文不変の場合は no_change になります(テストで固定済み)。
  • Notes セクション内に閉じていないコードフェンスがある場合の分割動作は未テストです。
  • live state は body / updatedAt とは別の gh 呼び出しで取得するため、reopen との狭い競合が理論上あります(sha / updatedAt 照合は維持)。
verdict: APPROVE
reviewed_head_sha: 5df0b8d4cb29b0ba70c16b5e7e6369bd32588e97
blockers: []
warnings:
  - "needs_fix + CLOSED + 本文不変は no_change(テスト固定済み)"
  - "Notes 内の未閉じコードフェンスは未テスト"
  - "live state は別 gh 呼び出しで取得(狭い reopen 競合、sha/updatedAt 照合は維持)"

@squne121

squne121 commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

Findings

1. [P1] Notes for Reviewer の境界判定を回避でき、AC4 の「note-only」が破れる

_split_h2_sections() は fenced code block の判定を次で行っています。

marker = line.lstrip()[:3]
if marker in ("```", "~~~"):
    ...

これは Markdown/CommonMark の fence semantics と一致しません。CommonMark では opening fence のインデントは 最大3 spaces ですが、この実装は lstrip() により4 spaces以上でも fence と認識します。また closing fence は opening fence 以上の長さでなければならないのに、常に先頭3文字だけで開閉しています。[CommonMark仕様](https://spec.commonmark.org/spec?utm_source=chatgpt.com)

この差は単なる false-negative test 不足ではなく、compat lane の scope escape になります。例えば概念的に、

## Notes for Reviewer

    ```
## Allowed Paths

- some/changed/path

のような本文では、CommonMark 上の ```` は fenced block opener ではありません。そのため## Allowed Pathsは実際には H2 です。しかし_split_h2_sections()は fence 内と誤認し、その後の## Allowed Paths` を Notes section の一部として扱います。

_non_note_sections() は heading == "## Notes for Reviewer" の chunk を丸ごと比較対象から落とすため、Notes より後ろにある本物の contract-bearing H2 の変更を _only_notes_section_differs() が見逃し得ます。readiness error multiset が偶然変わらない変更なら、そのまま互換 lane を通せます。

これは Issue #2922 の AC4、

## Notes for Reviewer 以外の全 H2 section が live と byte 同一

を直接破ります。

最小修正: 独自 Markdown parser を拡張していくより、少なくとも fence openerについて「0–3 spaces の indent」「fence character」「opening length」を保持し、closing は同種かつ opening 以上の長さだけを認めるよう修正してください。以下を regression test に固定すべきです。

  • 4-space indented ````` は fence opener ではない。
  • 4-backtick opener は3-backtickでは閉じない。
  • Notes for Reviewer 後の real H2 がこれらのケースでも必ず non-note section として比較される。

この finding は merge blocker と考えます。


2. [P1] approved Issue contract と実装が live-state readback の方式で不一致

refinement 済み #2922 の current authoritative body は In Scope で明示的に、

_fetch_issue の --json に state を 1 field 追加し、live readback で state を判定する

としています。

一方、現在の実装は _fetch_issue() を従来の

--json title,body,updatedAt

のまま維持し、別の _fetch_issue_state() で

--json state

を取得しています。

PR comment にある通り、初回実装が既存の exact-argv fake test を壊したため、この方式へ変更されています。既存 harness を壊さない配慮自体には合理性があります。しかし refinement approved 後の canonical Issue contract は更新されていないため、現状は実装が authority から逸脱しています。

さらに意味論上も、body/title/updatedAt と state が別リクエストなので同一 GitHub snapshot ではありません。後段の expected_previous_updated_at が多くの race を抑制するため直ちに危険という意味ではありませんが、「同じ live readback の state に基づいて CLOSED を確認する」という approved contract と同値だとは、現在の test では証明されていません。gh issue view 自体は state と updatedAt の双方を同じ --json call で取得可能です。[GitHub CLI](https://cli.github.com/manual/gh_issue_view?utm_source=chatgpt.com)

最小修正は二択です。

個人開発で workflow friction を増やさない観点では、後者でも構いません。ただし PR description だけで approved Issue contract を上書きするのは避けるべきです。


3. [P2 / evidence] 現 HEAD に対する fresh review がない

既存の impl-review-loop APPROVE comment は head

5df0b8d4cb29b0ba70c16b5e7e6369bd32588e97

をレビュー対象として明示しています。

現在の PR head は

f21bbef1d9ff65157e895ebec00ea812560abe5b

です。後者は main を merge した commit で、reviewed head より2 commits先です。

現在の GitHub Actions は確認できた範囲で、

  • ci: success
  • check-hook-integrity: success
  • agent-session-manifest: success
  • Check Japanese Content: success

なので、「CI が壊れている」という finding ではありません。また PR の effective changed files は依然3ファイルです。

ただし、この repository の運用上は review evidence を exact HEAD に bind するのが重要なので、5df0b8d4 に対する APPROVE を f21bbef1 の final review として再利用すべきではありません。

最小修正: 上記 P1 finding を修正後、current head で impl-review-loop の review phase を再実行する。main mergeだけだったことを理由に reviewを省略しない。


総合判定

REQUEST_CHANGES を推奨します。

最重要なのは Finding 1 です。現在の実装は目的としている狭い historical compatibility lane 自体はよく限定されていますが、独自の H2/fence parser が Markdown semantics とずれているため、まさにこの PR が守ろうとしている **「Notes 以外の contract surface は変更不可」**という境界に穴があります。

一方で、以下は確認できました。

  • PR は現在 draft / mergeable。
  • effective PR diff は Issue の Allowed Paths 3件に収まっています。
  • current HEAD の主要 CI は green。
  • human_judgment / runtime error の即 fail-closed、title/native-relationship の compat lane 排除、exact defect multiset、checker malformed-output fail-closed など、OWNER review で要求された主要事項は実装されています。
  • GitHub CLI で state を取得する API 選択自体は正当です。GitHub CLI

したがって、大規模な再設計や新しい gate/framework は不要です。Markdown section boundary の最小修正 + contract/readback方式の整合 + fresh HEAD review で十分だと判断します。

@squne121

squne121 commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

確認時点では、PR #2934 は Draft / OPEN、HEAD は f21bbef1d9ff65157e895ebec00ea812560abe5b、main は 0b230a34405ed3c36d7f4c500e0139406bfecfa7 です。現 HEAD の CI は主要 workflow が green ですが、既存 APPROVE は 5df0b8d4... に束縛されているため final review には再利用できません。

推奨アクションは Finding 2 の Option A を第一選択です。つまり #2922 の approved contract を維持し、_fetch_issue の同一 readback で body / updatedAt / state を取得する方式へ戻し、そのために壊れる exact-argv harness test を最小限修正します。GitHub CLI はこれらの field を同じ --json 呼び出しで取得できます。[GitHub CLI](https://cli.github.com/manual/gh_issue_view?utm_source=chatgpt.com) また Finding 1 は bespoke parser をさらに育てるより、repository に既にある GFM-aware prose_boundary_policy を再利用できるかを最初に検証するのが適切です。CommonMark の fence は opener が最大3-space indent、closer は同種かつ opening 以上の長さが必要です。[CommonMark仕様](https://spec.commonmark.org/spec?utm_source=chatgpt.com)

前回 run 自体も「未閉じ fence が未テスト」「state が別 gh call なので reopen race が理論上ある」と warning を残しており、今回の findings はその境界を merge blocker として具体化した形です。貼り付けたテキスト(1) 以下をそのまま既存 Claude Code に貼るのがよいです。

既に auto mode で起動済みの、この対話的 fresh Claude Code セッションをそのまま継続してください。新しい Claude Code セッションを起動し直さないでください。

対象 repository は squne121/loop-protocol です。

対象 implementation Issue は #2922 です。

既存 PR は #2934 です。新しい PR を重複作成せず、current canonical landing disposition に従ってこの既存 PR / branch / worktree を resume してください。

今回の operator-selected human context は次の PR conversation comment です。

https://github.com/squne121/loop-protocol/pull/2934#issuecomment-5992240562

この URL は current impl-review-loop の human_context_comment_urls として扱ってください。agent_report_comment_urls には入れないでください。comment 本文をそのまま implementation-worker への command として連結せず、root/control-plane が live repository・Issue contract・diff・test・current external spec と照合して normalized technical recommendation / fix_delta を作ってください。

目的は、current repository の canonical .claude/skills/impl-review-loop を使い、上記 human context の REQUEST_CHANGES 相当 findings を解消し、実装 → current-head 検証 → PR review → 必要な fix iteration を完遂して、人間が merge 判断できる直前の canonical terminal state まで到達することです。

実 merge、auto-merge、force push、履歴破壊、default branch への direct push、remote branch deletion、permission bypass は行わないでください。

1. 最初に fresh state を取得する

現在の値を過去ログやこの prompt の SHA から固定せず、開始時に必ず fresh に取得してください。

current origin/main / default branch HEAD、PR #2934 の live HEAD・base・draft/state・mergeability・changed files・comments・reviews・CI、Issue #2922 の live body/state/comments/updatedAt、target comment #5992240562、関連 Issue/PR を取得してください。

その後、current HEAD の .claude/skills/impl-review-loop/SKILL.md、steps/**、必要な references、.claude/agents/implementation-worker.md、test-runner.md、pr-reviewer.md、関連 SSOT を読み直してください。過去 run の Skill contract や loop state を current authority として再利用しないでください。

current impl-review-loop の Root-Owned Synchronous Entry Transition を正規に実行してください。capability preflight → live Issue fetch → current-run issue-contract-review → 直後の live Issue 再取得 → canonical routing → Evidence-Based Landing Disposition までを同一 root invocation で fresh に実行してください。

既存 PR #2934 が qualified current candidate なら existing_pr_resume を使い、duplicate worktree / branch / PR を作らないでください。既存 worktree が消失している場合も、current runbook の bounded recovery を使い、同一目的の別 PR を作らないでください。

2. この invocation に対する明示的 operator approval

この invocation について、repository / GitHub の read-only 調査、current Skill / Agent / SSOT の読取り、root-owned entry transition、capability preflight、current-run issue-contract-review、landing disposition、既存 PR / branch / worktree の resume、Issue #2922 の canonical contract の最小更新、Allowed Paths の必要最小限の拡張、既存 PR 上の実装修正、test の追加・更新、Verification Commands 実行、focused regression、required CI 確認、implementation-worker / test-runner / pr-reviewer および current canonical workflow が必要とする SubAgent の利用、通常 commit、fast-forward push、PR body / metadata / scope marker の更新、controlled PR review comment の publish、REQUEST_CHANGES に対する bounded fix iteration、stale-head rereview、canonical update-branch、修正可能 CI failure の原因調査と修正・再実行、recurrent defect の重複 Issue 検索、および後述条件を満たす再発防止 Issue の起票を明示的に承認します。

routine な「修正してよいですか」「Issue body を更新してよいですか」「commit/push してよいですか」「PR を更新してよいですか」「SubAgent を使ってよいですか」という追加承認を取りに戻らず、current canonical workflow の terminal boundary まで自律的に進めてください。

この承認は Claude Code の permission mode を変更しません。bypassPermissions、--dangerously-skip-permissions、hook / policy の迂回、secret / credential の取得・変更・公開、repository settings / IAM の変更、force push、履歴書換え、他 task の dirty worktree の変更・削除、実 merge / auto-merge は承認していません。

3. target comment の Finding 1 は merge blocker として処理する

Notes for Reviewer の H2 boundary 判定について、target comment の reproduction を実際に current HEAD で確認してください。単なる test 追加で済ませず、false-green にならないよう、現在の _split_h2_sections() が 4-space indented fence-like line や opening/closing length mismatch により real H2 を Notes 内へ誤分類できることを再現してください。

実装修正前に、repository 内の既存 Markdown boundary authority を調査してください。特に current .claude/skills/create-issue/scripts/prose_boundary_policy.py の iter_markdown_blocks()、fenced-line 判定、ATX heading parsing、level-2 section extraction、およびその tests が current main でも canonical/shared authority であるか確認してください。

current repository に既に GFM/CommonMark-aware な shared primitive があり、edit-issue runtime / fake harness の import boundary を壊さず再利用できるなら、独自 fence parser を拡張するよりその SSOT を再利用する方を優先してください。既存 guard-issue-body.py 等の edit-issue 側 consumer が同じ shared module をどうロードしているかも確認してください。

ただし shared module の top-level import が fake git repo / runtime boundary を壊す場合は、それを推測で無視しないでください。既存 harness を実際に走らせて確認し、current Allowed Paths / contract の範囲で最小解を選択してください。新しい parser framework や generic wrapper は作らないでください。

regression は最低でも、4 spaces indent の backtick/tilde sequence が fence opener として扱われないこと、4-backtick opener が3-backtick closerで閉じないこと、同種かつ opening 以上の長さの closer だけが閉じること、そして ## Notes for Reviewer より後ろの real ## Allowed Paths 等の contract-bearing H2 がこれらのケースでも必ず non-note section として比較されることを固定してください。

特に、readiness defect multiset が偶然同じままでも Notes 後方の real H2 を変更した candidate が compat lane で拒否される end-to-end regression を入れてください。helper 単体だけの happy-path test で終わらせないでください。

4. target comment の Finding 2 は Option A を第一選択とする

operator recommendation として、まず Option A を採用してください。

すなわち、approved Issue #2922 の semantic contract を維持し、_fetch_issue の一回の live readback から title / body / updatedAt / state を取得する設計へ戻してください。caller 申告の state や separate stale snapshot には依存しないでください。

初回実装でこれが scripts/agent-guards/tests/test_skill_runtime_exec_anchor.py の exact-argv fake を壊したことは既知です。production semantic を brittle fake に合わせて歪めるより、fake/harness を最小限追随させる方を優先してください。

ただし scripts/agent-guards/tests/test_skill_runtime_exec_anchor.py は現行 #2922 Allowed Paths 外なので、raw に編集して contract violation を起こさないでください。target human-context を根拠に、current repository-native contract update / issue-refinement lane が要求するなら、先に Issue #2922 の authoritative contract を controlled に最小修正してください。

その contract repair では、semantic goal を変更せず、Option A を成立させるために必要な exact harness regression path を Allowed Paths と verification coverage に追加するだけに留めてください。不要な source path、schema、Skill、docs、generic hardening を scope に足さないでください。

Issue body を更新した場合は body SHA、VC command hashes、contract snapshot、scope marker 等の旧 evidence を stale とみなし、current-run contract review と routing を fresh にやり直してください。既存 PR body の IMPLEMENTATION_SCOPE_COVERAGE_V1 等が旧 Issue body SHA / scope manifest を参照している場合は current canonical hygiene に従って更新してください。

Option A が current canonical evidence 上、本当に最小 scope では成立しないことが確認された場合に限り、fallback として Option B を許可します。その場合も PR description の prose だけで contract を上書きせず、current issue-refinement / controlled contract-update workflow を使って #2922 の authoritative contract を先に変更し、separate state readback を許容する条件、snapshot race の扱い、必要な regression test を明文化してから実装してください。

Option A が単に「既存 fake test を直す必要がある」という理由だけで Option B へ退避してはいけません。

5. implementation / test / review の SubAgent completion を必ず待つ

current Skill が定める implementation-worker、test-runner、pr-reviewer を正規の call shape で使ってください。必要なら codebase-investigator 等、current canonical workflow が要求する SubAgent も使って構いません。

各 SubAgent には task、target Issue/PR、authority、Allowed Paths / fix_delta、constraints、参照 evidence、expected output を明示し、親会話の暗黙 context に依存させないでください。

SubAgent を background dispatch しただけで完了扱いにしないでください。必ずその task の terminal completion notification を join し、final structured result を取得してから downstream step へ進んでください。

implementation-worker の完了前に Step 2 へ進まない、test-runner の final result と current-head VC adjudication が成立する前に pr-reviewer を起動しない、pr-reviewer の final verdict / reviewed_head_sha / blockers / warnings を取得する前に Step 5 を判定しない、という dependency order を守ってください。

SubAgent の単なる human_review_required: true 自己申告を停止 authority として扱わず、current canonical router / live evidence の判断に従ってください。

6. stale evidence を混ぜない

現在知られている旧 APPROVE は head 5df0b8d4cb29b0ba70c16b5e7e6369bd32588e97 に束縛されたものです。current PR head がそれと異なる限り final approval として再利用しないでください。

また、この prompt 作成時点では PR head が f21bbef1d9ff65157e895ebec00ea812560abe5b、main が 0b230a34405ed3c36d7f4c500e0139406bfecfa7 でしたが、これらも実行時 authority ではありません。開始時と各 mutation 後に live 値を再取得してください。

fix commit、Issue contract update、update-branch 等で HEAD / Issue body / VC binding のいずれかが変わったら、それ以前の test-runner result、review verdict、mergeability snapshot、terminal-gate evidence を current-head 成功証拠として合成しないでください。

修正後は fresh HEAD で Verification Commands、必要な focused regressions、required CI、pr-reviewer を再実行してください。main mergeだけの HEAD 変更でも exact-head review binding を省略しないでください。

7. verification の最低ライン

Issue #2922 の live Verification Commands を canonical source とし、contract update が入った場合は更新後の command set を使ってください。

加えて今回の failure class を固定する focused regression として、Finding 1 の fence/H2 scope-escape reproduction、Finding 2 の single-snapshot _fetch_issue contract、初回実装で壊れた scripts/agent-guards/tests/test_skill_runtime_exec_anchor.py の relevant/full regression を実行してください。

current head に対する .claude/skills/edit-issue/tests/ 全体と、repository が要求する required CI を確認してください。

「全 VC pass」だけで終端せず、current step4-adjudicate / step5-terminal-gate 等の canonical deterministic consumer を current Skill の手順通り使ってください。APPROVE 単独を terminal success にしないでください。

8. external research

Finding 1 の semantics が repository の shared prose_boundary_policy と tests だけで十分に確定できる場合は、その repository-native SSOT を優先して構いません。その場合は external research を無駄に増やさず external_research_skip_basis に根拠を記録してください。

upstream semantics の確認が必要なら、CommonMark の current official spec と GitHub CLI の current official manual を一次資料として確認してください。blog や二次記事を authority にしないでください。

9. recurrent defect / 再発防止 Issue

実装・調査・review 中に、#2922 の blocker を直すだけでは残る具体的で再現可能な recurrent root cause が確認された場合は、既存 Issue を検索してください。

特に、repository に canonical GFM boundary SSOT があるのに別 consumer が独自 fence/H2 parser を複製して同型 semantic drift を起こしている、または shared parser を利用できない runtime/import boundary が複数 consumer に同じ duplication を強制している、という事実が #2922 以外でも再現できるか確認してください。

同じ責務の既存 Issue があれば新規起票せず、その Issue を final report で示してください。既存 Issue がなく、#2922 では変更すべきでない別 path / consumer に同型 failure が具体的に残るなら、repository-native create-issue workflow で再発防止 Issue を起票してください。

その Issue は具体的 repro、affected consumers、root cause、AC、Verification Commands、#2922 / PR #2934 との relation を持たせ、generic security hardening、新 approval layer、schema registry、wrapper 増設だけを目的にしないでください。

一方、今回の P1 を #2922 の Allowed Paths 内で共有 SSOT 再利用によって完全に解消でき、独立した残存 failure class が確認できないなら、形式的に follow-up Issue を作る必要はありません。

10. 停止境界

通常の test failure、CI failure、REQUEST_CHANGES、stale head、BEHIND、contract snapshot の stale/missing advisory artifact、修正可能な PR body hygiene、既存 PR resume、bounded contract repair は停止理由にしないでください。

正当な停止候補は、current canonical router が explicit operator decision を織り込んだ後も返す genuine human_judgment_required、actual Git conflict で runbook が停止を要求する場合、destructive operation が不可避な場合、secret / credential 操作や permission bypass が必要な場合、evidence integrity を維持できない場合、authority 外の変更が不可避な場合、または current canonical loop 上限到達です。

target comment の Finding 1 / 2 自体は、今回この prompt で修正・必要最小限の contract repair を明示承認しているため、それだけを理由に routine human approval へ戻らないでください。

11. terminal state

最終目標は merge そのものではありません。current canonical impl-review-loop が draft_pr_ready / approved 相当の terminal state に到達し、人間が merge 判断できる直前まで進めてください。

current-head reviewer が APPROVE、blockers が空、current live mergeability と required CI が canonical terminal gate の条件を満たすまで bounded に修正・再検証してください。

終了時は、fresh PR # / URL、final HEAD SHA、final base/main SHA、Issue #2922 の final body SHA と contract update の有無、changed files、target comment Finding 1/2/3 の解消内容、Verification Commands 結果、追加 focused regressions、required CI、fresh reviewer verdict と reviewed_head_sha、Step 5 terminal route、再発防止 Issue の create/reuse/no-create 判断と根拠、残 blocker、そして merge / auto-merge を実行していないことを簡潔に報告してください。

まず current impl-review-loop、必要な steps/references/agent definitions、target comment、live Issue #2922、live PR #2934 を fresh に読み、target comment を human_context_comment_urls に束縛した current-run intake / root transition から開始してください。

この形なら、P1 を単に fix_delta へ投げるのではなく、Issue contract の不整合も canonical workflow 内で先に解消し、その後 exact HEAD で review をやり直すところまで自律実行対象になります。

Test and others added 3 commits October 5, 2026 19:24
…ck から取得する (#2922)

- _split_h2_sections を shared prose_boundary_policy の iter_markdown_blocks / parse_atx_heading_line に置換し、4 spaces indent の fence 風 line・closer 長さ・0-3 spaces indent の H2 による scope escape を解消
- _fetch_issue の --json を title,body,updatedAt,state にして別 request の _fetch_issue_state を削除
- regression test と anchor harness の許容 argv を追随

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
_only_notes_section_differs の捕捉対象に OSError を追加し、prose boundary SSOT が
ディスク上に存在しない場合も例外を伝播させず互換 lane を failed_no_mutation で拒否する。
回帰 test を追加。

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@squne121
squne121 marked this pull request as ready for review October 5, 2026 11:12
@squne121
squne121 merged commit 6b59f10 into main Oct 5, 2026
50 checks passed
@squne121
squne121 deleted the worktree-issue-2922-edit-txn-preexisting-readiness branch October 5, 2026 11:33
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.

実装: edit transaction が履歴 Issue の note-only 更新を pre-existing readiness 欠陥だけで拒否しないようにする

1 participant