Skip to content

feat:issue-content-update - #1669

Merged
squne121 merged 7 commits into
mainfrom
worktree-issue-1660-issue-content-update
Jul 22, 2026
Merged

squne121 merged 7 commits into
mainfrom
worktree-issue-1660-issue-content-update

Conversation

@squne121

@squne121 squne121 commented Jul 22, 2026 •

Copy link
Copy Markdown
Owner

Summary

Issue #1660 の issue_content.update を安全に再実行できるようにしました。title-only 要求では既存 body を byte-for-byte で維持し、remote desired state は local marker から独立して照合します。今回、python-test の Ruff E501 失敗を許可パス内の整形だけで修正し、current HEAD で CI を再起動しました。

Checks

  • lint ゲート: uv run --locked ruff check --select E,F ...: PASS
  • issue content 回帰: uv run --locked pytest scripts/agent-guards/tests/test_issue_content_update_exec.py .claude/skills/edit-issue/tests/test_issue_content_update_txn.py .claude/skills/edit-issue/tests/test_edit_issue_txn.py -q: PASS(48 passed)
  • CI verdict 契約: uv run --locked pytest .claude/skills/pr-review-judge/scripts/tests/test_ci_verdict_summary_v2.py -v: PASS(62 passed)
  • Python 構文検査: uv run --locked python3 -m py_compile ...: PASS

検証コマンド結果

current HEAD b5295e17c4b46e7492f232b09aefd0062ee51ffb で AC1〜AC5 の関連回帰と、AC6〜AC7 の ci_verdict_summary_v2 契約テストを実行しました。GitHub Actions の current-head artifact は再実行中であり、artifact URL/digest と required check identity の live readback がそろうまで merge_ready: false です。

受け入れ条件の達成状況

受入条件 達成状況と根拠
AC1 policy/schema/dispatch の既存 parity regression が PASS
AC2 title/body の単一 PATCH、title-only body 不変、空 body canonicalization を fake-gh で確認
AC3 marker 欠損・破損、timeout ambiguity、local postcondition failure replay、PR target 拒否、Cc title 拒否を確認
AC4 content success 後だけ comment publish へ進み、legacy timeout は mutation_outcome_unknown を返すことを確認
AC5 shared classifier と raw title mutation 拒否の parity regression が PASS
AC6 ci_verdict_summary_v2 の expected/current head と run/job identity binding の契約テストが PASS。live artifact は current HEAD で再生成待ち
AC7 required/evidence check、node-backed classification、unknown/missing/null blocking の契約テストが PASS。live required check readback は再実行待ち

Allowed Paths 遵守

PR の変更は Issue #1660 の Allowed Paths 内です。今回の CI 修正 delta は次の既存許可パスだけを変更しています。

  • 修正: .claude/skills/edit-issue/scripts/edit_issue_txn.py
  • 回帰テスト: .claude/skills/edit-issue/tests/test_issue_content_update_txn.py
  • 修正: scripts/agent-guards/controlled_skill_mutation_exec.py
  • 回帰テスト: scripts/agent-guards/tests/test_issue_content_update_exec.py

Schema Change Applicability

  • decision: schema_change
  • reason: ISSUE_EDIT_TXN_RESULT_V1 と executor result に title、PATCH attempt、mutation outcome を明示して、成功・no_change・不確実性を区別するためです。

Schema Consumer Inventory

Before

helper の出力は body hash 中心で、title と PATCH 後の不確実性を表現できませんでした。executor は marker が存在する場合だけ remote desired state を認識していました。

After

Consumer ファイル 更新有無 備考
controlled_skill_mutation_exec.py yes remote authority、atomic audit marker、PR target reject、canonical body、structured outcome
edit_issue_txn.py yes title-only hygiene 分離、post-hygiene no_change、transaction result fields
test_issue_content_update_exec.py yes replay と entity-boundary fixture
test_issue_content_update_txn.py yes title-only/body identity と post-hygiene no_change fixture
ci_verdict_summary_v2.py no current base の head-bound artifact contract を 62 tests で再検証

Safety Claim Matrix

Claim Implemented? Not controlled Evidence Follow-up
remote desired state は marker の有無・健全性から独立する yes - replay fixture -
title-only は既存 body を変更しない yes - transaction fixture -
Pull Request target は PATCH 前に拒否する yes - fake-gh fixture -
PATCH 後に確定できない結果は unknown と表現する yes - legacy timeout fixture -
CI verdict は current head と required check identity に束縛される yes - 62件の契約テスト -

Runtime Verification Evidence(実行時検証証跡)

  • 契約スナップショット: 実装: edit-issue skill の controlled executor に Issue title mutation を追加する #1660 (comment)
  • contract body SHA-256: sha256:8a930b8e1ac4f7dd369130146e915f6cf6287d557eace408c4d5bdc95e9ecb52
  • 実装 HEAD: b5295e17c4b46e7492f232b09aefd0062ee51ffb
  • CI run/artifact: current HEAD push により再実行開始。artifact URL/digest は未取得であり、未取得の間は merge_ready: false
  • required check identity: current HEAD の GitHub Actions readback 待ち。欠落・null・stale は blocking

CI Test Performance Decision(CIテスト性能判断)

CI_TEST_PERFORMANCE_DECISION_V1:
  schema: CI_TEST_PERFORMANCE_DECISION_V1
  issue_number: 1660
  pr_number: 1669
  decision_scope: review_only
  changed_paths:
    - "修正: scripts/agent-guards/controlled_skill_mutation_exec.py"
    - "回帰テスト: scripts/agent-guards/tests/test_issue_content_update_exec.py"
    - "修正: .claude/skills/edit-issue/scripts/edit_issue_txn.py"
    - "回帰テスト: .claude/skills/edit-issue/tests/test_issue_content_update_txn.py"
  lane_classification:
    python_test:
      applicable: true
      evidence: ["Ruff E501を修正し、48件の対象回帰を実行"]
      required_commands:
        - "uv run --locked ruff check --select E,F ..."
        - "uv run --locked pytest scripts/agent-guards/tests/test_issue_content_update_exec.py .claude/skills/edit-issue/tests/test_issue_content_update_txn.py .claude/skills/edit-issue/tests/test_edit_issue_txn.py -q"
    ci_verdict_contract:
      applicable: true
      evidence: ["AC6-AC7のhead-bound artifact契約を62件で検証"]
      required_commands:
        - "uv run --locked pytest .claude/skills/pr-review-judge/scripts/tests/test_ci_verdict_summary_v2.py -v"
  reviewer_gate:
    approve_allowed: false
    required_evidence: ["current-head GitHub Actions", "current-head artifact URL/digest", "current-head required check identity", "current-head review"]
    approve_denied_reason: "artifact または required check evidence が stale、missing、null の間は merge_ready false"
  follow_up_required:
    - "current-head ci_verdict_summary_v2 artifact の URL/digest と required check identity を readback する"

Notes

previous run 29921489682 / job 88927843279 の python-test failure は今回導入した Ruff E501 8件でした。機能変更なしの整形修正 b5295e17c4b46e7492f232b09aefd0062ee51ffb を push 済みで、CI/readback と review の完了前にマージ可能とは判断しません。

@github-actions

Copy link
Copy Markdown
Contributor

Preview URL

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

The preview will be removed when this PR is closed.

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR レビュー結果

current HEAD に対するレビューでは、Allowed Paths は適合していますが、CI と PR 本文の証跡が未充足です。

LOOP_VERDICT_V2:
  verdict: REQUEST_CHANGES
  reviewed_head_sha: 9d6999ec595e2ebbfa0ae28843ef9b0b2baa4a3c
  merge_ready: false
  mergeability:
    mergeable: MERGEABLE
    merge_state_status: BLOCKED
  blockers:
    - severity: error
      finding: "head-bound CI の python-test が Ruff E501(10件)で失敗している。"
      evidence_refs:
        - "https://github.com/squne121/loop-protocol/actions/runs/29914943464/job/88906499334"
      next_action: "E501 を修正し、VC全件とpython-test CIを新しいHEADで再実行する。"
    - severity: error
      finding: "PR本文にAC達成状況、検証コマンド結果、Allowed Paths遵守、Runtime Verification Evidenceがなく、現行snapshot #5045092552 を参照していない。"
      evidence_refs:
        - "https://github.com/squne121/loop-protocol/pull/1669"
        - "https://github.com/squne121/loop-protocol/issues/1660#issuecomment-5045092552"
      next_action: "修正後HEADに束縛して本文hygieneとruntime evidenceを更新する。"
  required_auto_actions:
    - kind: update_pr_body_hygiene
      executor: implementation-worker
      skill: open-pr.update_pr
      blocking_merge_ready: true
      mechanical: true
  auto_fix_applied: []
  follow_up_issue_requests: []
  allowed_paths_gate:
    status: ok
    changed_files_source: git_diff_name_status_find_renames_z
    changed_files:
      - .claude/hooks/tests/test_local_main_branch_guard.py
      - .claude/skills/edit-issue/SKILL.md
      - .claude/skills/edit-issue/scripts/edit_issue_txn.py
      - .claude/skills/edit-issue/tests/test_issue_content_update_txn.py
      - docs/dev/agent-skill-boundaries.md
      - scripts/agent-guards/controlled_skill_mutation_exec.py
      - scripts/agent-guards/controlled_skill_mutation_policy.py
      - scripts/agent-guards/tests/test_controlled_skill_mutation_policy.py
      - scripts/agent-guards/tests/test_issue_content_update_exec.py
      - scripts/agent-guards/tests/test_issue_content_update_guard_parity.py
  allowed_paths_gate_source: review_subagent

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

自動 PR レビュー結果

Issue #1660 の fresh contract snapshot(#5045269205)と current HEAD を照合しました。

issue_content.update の title transport は gh api --field を使用しており、true、false、null、整数文字列、@ 始まりの許容 title を literal string として単一 PATCH に渡せません。AC2 を満たすため、literal JSON string による送信と回帰テストが必要です。

PR 本文も、required Japanese sections と CI_TEST_PERFORMANCE_DECISION_V1(review_only)を現行 HEAD の証跡に更新してください。

LOOP_VERDICT_V2:
  verdict: REQUEST_CHANGES
  reviewed_head_sha: "97270018dbd8edce81f86332011351be85271201"
  merge_ready: false
  mergeability:
    mergeable: "MERGEABLE"
    merge_state_status: "CLEAN"
  blockers:
    - "title が gh api --field 経由で型変換または @ file input として扱われ、許容済みの literal title を単一 PATCH で更新できない。"
  required_auto_actions:
    - kind: update_pr_body_hygiene
      executor: implementation-worker
      skill: open-pr.update_pr
      blocking_merge_ready: true
      mechanical: true
  auto_fix_applied: []
  follow_up_issue_requests: []
  allowed_paths_gate:
    status: ok
    changed_files_source: git_diff_name_status_find_renames_z
    changed_files:
      - .claude/hooks/tests/test_local_main_branch_guard.py
      - .claude/skills/edit-issue/SKILL.md
      - .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_issue_content_update_txn.py
      - docs/dev/agent-skill-boundaries.md
      - scripts/agent-guards/controlled_skill_mutation_exec.py
      - scripts/agent-guards/controlled_skill_mutation_policy.py
      - scripts/agent-guards/tests/test_controlled_skill_mutation_policy.py
      - scripts/agent-guards/tests/test_issue_content_update_exec.py
      - scripts/agent-guards/tests/test_issue_content_update_guard_parity.py
  allowed_paths_gate_source: review_subagent

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

自動 PR レビュー結果

Issue #1660 の fresh contract snapshot、current HEAD、Allowed Paths、5 件の VC、および GitHub CI を照合しました。

  • VC: 5/5 PASS、合計 56/56
  • GitHub CI: 13/13 PASS、pending/failed/stale なし
  • Allowed Paths: 11 ファイル、違反なし
  • PR 本文: 必須の日本語見出し、AC1--AC5 の証跡、CI_TEST_PERFORMANCE_DECISION_V1(review_only)を確認
LOOP_VERDICT_V2:
  verdict: APPROVE
  reviewed_head_sha: "ee6273521ec590c6b3d225069cba3ba14229ec36"
  merge_ready: true
  mergeability:
    mergeable: "MERGEABLE"
    merge_state_status: "CLEAN"
  blockers: []
  required_auto_actions: []
  auto_fix_applied: []
  follow_up_issue_requests: []
  allowed_paths_gate:
    status: ok
    changed_files_source: git_diff_name_status_find_renames_z
    changed_files_count: 11
    violations: []

@squne121
squne121 marked this pull request as ready for review July 22, 2026 11:55
@squne121

Copy link
Copy Markdown
Owner Author

判定

REQUEST_CHANGES です。

2026年7月22日時点の current HEAD は ee6273521ec590c6b3d225069cba3ba14229ec36 で、PRは open / GitHub上は mergeable です。ただし、controlled mutation の安全性契約を破る実装上の blocker があり、さらに最新CI artifactと既存の APPROVE / merge_ready: true 判定が矛盾しています。

LOOP_VERDICT_V2:
  verdict: REQUEST_CHANGES
  reviewed_head_sha: "ee6273521ec590c6b3d225069cba3ba14229ec36"
  merge_ready: false
  blockers:
    - "title-only request が既存 body を hygiene autofix で変更し得る"
    - "remote-state idempotency が local marker の有無に依存し、曖昧成功後の replay が回復不能"
    - "Issue-only command が Pull Request を対象外にしていない"
    - "ci_verdict_summary_v2 artifact が stale_head_sha を返している"

参照対象は、Issue #1660 の契約とレビューコメント、PR #1669 の全変更・レビュー・コメント・CI artifact、baseに入ったPR #1667、同じpolicy/executor surfaceを扱うIssue #1647、関連するリポジトリ内テスト・設計文書、およびGitHub REST API / GitHub CLI公式仕様です。Issue #1660 の事前レビューコメントでは、no_change、timeout後のremote already-applied、stale/corrupt marker、post-readback失敗、titleを含むresult schemaまで明示的に要求されていました。


1. Blocker — title-only更新がbodyを副作用で変更する

対象は .claude/skills/edit-issue/scripts/edit_issue_txn.py です。

helperは、title-onlyの場合に requested_title だけを変更し、bodyには現在のbodyを使用します。しかし no_change 判定は hygiene autofix より前にあり、titleが異なればその分岐を通過しません。その後、bodyを一時ファイルへ書き、hygiene autofixを実行し、変換後の mutated_candidate を issue_content.update の new_body として送っています。

このautofixは実際にbodyを書き換えます。例えば、Verification Commands内のコマンドへの $ 追加や、欠落した Runtime Verification Applicability セクションの挿入を行い、exit code 0 は「body changed」を意味します。

したがって次の操作が成立します。

  1. 既存Issueのbodyが旧形式で、C4またはC9 autofix対象になっている。

  2. 利用者はtitleだけの変更を要求する。

  3. transaction helperがbodyを自動修正する。

  4. remote PATCHではtitleだけでなくbodyも変更される。

これはIssue #1660が明示する title-only 契約に反します。

必要な修正

body_change_requested = candidate_body != current_body をhygiene前に確定し、title-onlyではmutating hygieneを実行しないでください。検証が必要ならread-only checkに限定し、PATCHへ渡すbodyは現在値をbyte-for-byteで維持すべきです。

body変更を行う場合も、hygiene後にもう一度 no_change を判定する必要があります。

必須回帰テストは、例えば次です。

test_title_only_preserves_noncanonical_current_body_byte_for_byte
test_title_only_does_not_apply_c4_or_c9_hygiene_repairs
test_post_hygiene_candidate_equal_to_current_returns_no_change

2. Blocker — idempotencyがremote stateではなくlocal markerに依存している

_run_issue_content_update は、local markerが存在する場合に限って「remoteが既にdesired stateか」を判定します。markerが無い場合、remoteが既にdesired stateでも旧title/body/updatedAtとの比較へ進み、通常はstale failureになります。corrupt markerの場合はremote readback前に終了します。

さらに、PATCHがtimeout等で失敗を返したもののremoteでは適用済みだった場合、実装は already_applied を返しますがmarkerを書きません。

このため、次の再現経路があります。

  1. PATCHがGitHub側では成功する。

  2. client側ではtimeoutになる。

  3. readbackにより最初の実行は already_applied で成功する。

  4. markerは作られない。
    5.同一requestを再実行する。

  5. remoteはdesired stateだがmarkerがないため、旧state precondition mismatchで失敗する。

成功後の通常経路でも、remote mutation後に _check_no_tracked_changes が失敗した場合や、marker書き込みが例外になった場合、remoteだけ変更済みでmarkerがない状態になります。marker書き込みはlocal postconditionの後です。

加えて、marker-hitとambiguous-appliedのearly returnは、_check_no_tracked_changes とmarker refreshを通過しません。成功経路ごとに安全性条件が異なっています。

必要な制御順序

validate closed input
fetch remote including entity type
check local tracked-change precondition
if remote == desired:
    validate or repair audit marker
    run common success finalizer
    return already_applied / no_change
validate expected previous state
PATCH exactly once
read back remote exactly once
if remote != desired:
    return mutation_outcome_unknown / postcondition_rejected
run common success finalizer
atomically write marker
return applied

markerはremote authorityではなくcache/auditでなければなりません。markerは一時ファイル+os.replaceでatomicに書き、marker欠損・前回requestのmarker・書き込み途中のmarkerをremote reconciliationから独立させる必要があります。


3. Blocker — issue_content.update がPull Requestを対象外にしていない

_fetch_issue_content は /repos/{repo}/issues/{number} を取得し、jqで {title, body, updatedAt} だけを残しています。そのため、レスポンスにある pull_request discriminatorは失われます。PATCHも同じIssues endpointへ送られます。

GitHub公式仕様では、すべてのPull RequestはIssueでもあり、Issues endpointから返された対象がPRかどうかは pull_request キーで識別するとされています。また、Update an issue endpointは Issues: write だけでなく Pull requests: write 権限でも利用でき、title と body を受け取ります。(GitHub Docs)

したがって、少なくとも現在の実装は「Issue-only」というentity boundaryを保証していません。公式仕様からは、PR番号を渡した場合にPRのtitle/body mutationへ到達し得ると高い確度で推論できます。

これは特に、このリポジトリがPRレビュー投稿などを別のcontrolled command laneに分離している点と整合しません。

必要な修正

GET時に次を保持し、mutation前にfail-closedにしてください。

{
  "title": "...",
  "body": "...",
  "updatedAt": "...",
  "isPullRequest": true
}

RESTなら has("pull_request")、GraphQLなら __typename を利用できます。

if isPullRequest:
    return target_is_pull_request

必須テストは「pull_request キーを含むfixtureを渡し、PATCH回数がゼロ」であることです。


4. High — bodyless Issueとbodyのクリアを扱えない

content validatorは new_body を含む全文字列フィールドに対してnon-emptyを要求しています。したがって new_body == "" は拒否されます。

readbackも body が str でなければschema errorにします。GitHubがbodyless Issueを null として返すと、title-only更新であっても失敗します。

GitHub公式のUpdate an issue仕様では、body は string or null です。(GitHub Docs)

現在の実装では次が不可能です。

  • bodyがnullの既存Issueのtitle-only更新

  • bodyを空へクリアするbody-only更新

  • POST/PATCH後にGitHubがemptyをnullへ正規化した場合のpostcondition照合

必要な修正

内部canonical representationを決めてください。例えばRESTの null を "" に正規化し、hashは常にcanonical textから計算します。

body = raw_body if isinstance(raw_body, str) else ""

一方、API送信時に "" と null を区別する必要があるなら、schemaを str | None として明示的に扱うべきです。


5. High — executor境界でno_changeが実装されていない

markerが無い場合、executorはremote title/bodyがdesired stateと同一かを判定せず、expected previous stateが一致すればそのままPATCHします。つまり、直接executorを呼んだno-op requestはremote writeを発生させます。

transaction helper側には事前の no_change 判定がありますが、hygiene前だけです。hygieneによってcandidateが現在のbodyと同一になった場合は、再判定せずPATCHへ進みます。

Issue #1660は変更なしを no_change として明示しています。

no_change はhelperだけの最適化ではなく、remote side-effectを所有するexecutor側の安全性条件として実装すべきです。remoteがdesired stateならmarkerの有無に関係なくPATCH回数はゼロでなければなりません。


6. High — transaction resultがtitle mutationと失敗の不確実性を表現できない

ISSUE_EDIT_TXN_RESULT_V1 は、新たにtitleを変更するようになった後も body_update しか返しません。previous/requested/remote title、executorのstatus detail、idempotency key、patch attemptの確度がありません。

executorがnon-zeroを返した場合、helperはstructured child resultを保持せず、stdout/stderrをbounded stringへ潰します。その後の一回のreadbackがdesired stateなら failed_after_mutation、それ以外なら failed_no_mutation と分類します。

しかしIssue #1660自身が、厳密なCASは保証せずbest-effort競合検出であると定義しています。PATCHが一旦適用された後、別actorが直ちに上書きした場合、最終readbackはdesired stateではありません。それでもremote mutationは一度発生しています。したがって failed_no_mutation という確定表現は不正確です。

また、executor自身がtrusted host・sanitized environmentでpost-readbackした後、helperは shutil.which("gh") とambient environmentを使ってもう一度readbackします。この二回目のreadback失敗によって、executor成功を failed_after_mutation へ変換できます。

推奨result形状

content_update:
  patch_attempted: true
  status: no_change | applied | already_applied | precondition_rejected |
          postcondition_rejected | mutation_outcome_unknown
  executor_reason: string
  previous_title: string
  requested_title: string
  remote_title: string | null
  previous_body_sha256: string
  requested_body_sha256: string
  remote_body_sha256: string | null
  idempotency_key: string
  artifact_ref: string

PATCH attempt後にdesired stateを確認できなかった場合は、failed_no_mutation ではなく mutation_outcome_unknown が妥当です。


7. Medium — title制御文字チェックとidempotency keyの契約が不十分

title validatorは ord(char) < 32 しか拒否しません。そのためDEL U+007F とC1 control characters U+0080–U+009F は通過します。

Issue #1660の「制御文字を拒否」という契約を満たすには、少なくともUnicode category Cc を拒否すべきです。

import unicodedata

if any(unicodedata.category(ch) == "Cc" for ch in title):
reject()

また、idempotency_key はnon-emptyであることしか検証されません。markerへ保存はされますが、marker-hit時にrequestのkeyと比較されません。operation_reason も結果やmarkerへ保持されていません。

同じexecutor内の pr_review.publish は、canonical fieldsから期待されるidempotency keyを再計算し、caller supplied keyと一致しなければ拒否しています。content updateでも同じ方式を使うべきです。


テスト証跡はAC3を裏付けていない

専用executor testが実際に確認しているのは、基本成功、literal title transport、remoteが旧stateのままのambiguous failure、stale title、空白・改行・NUL、unknown keyです。

transaction testも、hygieneをmockしてcontent executorへroutingされることを確認するだけで、title-only時に実際に渡されるbodyのbyte identityを検証していません。

PR本文はAC3達成を主張していますが、Issueの事前レビューコメントで要求された異常系の多くが未実装・未テストです。

最低限、次のfixture matrixが必要です。

ケース 必須結果
title-only + C4/C9対象body bodyがbyte-for-byte不変
bodyがnullのIssueでtitle-only PATCH成功、canonical readback成功
bodyを空へ変更 schema拒否せず、readbackを正規化
remoteがdesired、markerなし PATCH 0回、already_applied
timeoutだがremote適用済み markerを修復し、再実行も成功
corrupt marker、remote desired remote authorityに基づくclosed recovery
PR形式のIssues response target_is_pull_request、PATCH 0回
titleにU+007F/U+0085/U+009F PATCH前拒否
完全no-op no_change、PATCH 0回
hygiene後にcurrentと同一 no_change、PATCH 0回
PATCH成功後にlocal postcondition失敗 mutation済みまたはunknownとして分類
PATCH適用後に別actorが上書き failed_no_mutationを返さない
post-readback failure/mismatch 追加PATCH 0回

CI artifactと承認コメントが矛盾している

current HEADに対するGitHub Actionsの各workflow run自体は success です。

しかしrun 29917067356 の実際の ci_verdict_summary_v2.json は次を返しています。

{
  "expected_head_sha": "ee6273521ec590c6b3d225069cba3ba14229ec36",
  "head_sha": "ee6273521ec590c6b3d225069cba3ba14229ec36",
  "overall_status": "stale_head_sha",
  "next_action": "refresh_head_sha"
}

各required/evidence checkは head_sha: null、blocking_merge_ready: true です。さらに node-backed-hook-tests は classification: unknown、failure_reason: gh_error です。

  • current CI verdict JSON

  • current CI binding JSON

原因はworkflowが各jobの needs.*.result をgeneratorへ渡している一方、generator自身が needs_result_synthetic にはreal head SHAがないとして head_sha = null にし、null+successを stale_head_sha と判定しているためです。

また node-backed-hook-tests はworkflowから渡されているのに、classification mapとrequired setに存在しません。

最新のPR reviewは「13/13 PASS、pending/failed/staleなし」として APPROVE / merge_ready: true を出していますが、このartifactとは両立しません。

これはPR #1669が導入したコード不具合ではなく、リポジトリ横断のCI evidence生成不具合である可能性が高いです。ただし、現在のartifactを正本として運用する限り、PR #1669を merge_ready: true とする証拠は成立していません。

修正は次のどちらかです。

  1. aggregatorがcurrent HEADの実check runsを取得し、check_run ID / head SHA / workflow / job nameをgeneratorへ渡す。

  2. workflow_run_id + job + PR_HEAD_SHA に暗号学的・API的に束縛された別provenanceを定義し、synthetic evidenceを正式に受け入れる。

単にsynthetic entryへcaller supplied head SHAをコピーするだけでは、generatorが避けようとしているhead spoofingを再導入します。


妥当な実装部分

前回レビューで問題になったtitle transportは修正されています。現在はJSONファイルを生成し、gh api --input で送っているため、true、false、null、整数文字列、@ prefixをJSON stringのまま保持できます。GitHub CLI公式仕様でも、--field はそれらを型変換し、@ をファイル参照として扱う一方、--input は指定ファイルをHTTP bodyとして使用します。 (GitHub CLI)

また、trusted host、sanitized environment、fixed endpoint、単一PATCH、title/body双方のpost-readbackという基本構造は正しい方向です。

依存PR #1667のmerge commit e4a01b... はPR #1669のbase SHAになっており、#1632側の変更を取り込んだ順序も正しいです。

一方、Issue #1647は現在もopenで、同じ controlled_skill_mutation_policy.py / controlled_skill_mutation_exec.py を変更対象にしています。merge直前に関連PRの有無と最新mainを再確認する必要があります。


merge前の最低条件

  1. title-onlyでbodyを一切変更しない。

  2. remote desired-state判定をmarkerから独立させ、ambiguous success・marker欠損・marker破損・local postcondition failureから再実行可能にする。

  3. PR targetをmutation前に拒否する。

  4. null/empty bodyをcanonicalに扱う。

  5. executor境界で no_change を実装する。

  6. result schemaへtitleとmutation uncertaintyを追加し、failed_no_mutation の過剰断定を廃止する。
    7.上記fixture matrixを追加し、AC3証跡を更新する。

  7. ci_verdict_summary_v2 をcurrent HEADに対して merge_ready または少なくとも内部矛盾のない状態へ修正する。

  8. #1647とのsurface collisionをmerge直前に再確認する。

現状の APPROVE は、literal title transport修正とgreen Actionsまでは正しく評価していますが、transaction境界、remote-state reconciliation、entity type、artifact semanticsを十分に検証していません。

# 判定

REQUEST_CHANGES です。

2026年7月22日時点の current HEAD は ee6273521ec590c6b3d225069cba3ba14229ec36 で、PRは open / GitHub上は mergeable です。ただし、controlled mutation の安全性契約を破る実装上の blocker があり、さらに最新CI artifactと既存の APPROVE / merge_ready: true 判定が矛盾しています。

LOOP_VERDICT_V2:
  verdict: REQUEST_CHANGES
  reviewed_head_sha: "ee6273521ec590c6b3d225069cba3ba14229ec36"
  merge_ready: false
  blockers:
    - "title-only request が既存 body を hygiene autofix で変更し得る"
    - "remote-state idempotency が local marker の有無に依存し、曖昧成功後の replay が回復不能"
    - "Issue-only command が Pull Request を対象外にしていない"
    - "ci_verdict_summary_v2 artifact が stale_head_sha を返している"

参照対象は、Issue #1660 の契約とレビューコメント、PR #1669 の全変更・レビュー・コメント・CI artifact、baseに入ったPR #1667、同じpolicy/executor surfaceを扱うIssue #1647、関連するリポジトリ内テスト・設計文書、およびGitHub REST API / GitHub CLI公式仕様です。Issue #1660 の事前レビューコメントでは、no_change、timeout後のremote already-applied、stale/corrupt marker、post-readback失敗、titleを含むresult schemaまで明示的に要求されていました。


1. Blocker — title-only更新がbodyを副作用で変更する

対象は .claude/skills/edit-issue/scripts/edit_issue_txn.py です。

helperは、title-onlyの場合に requested_title だけを変更し、bodyには現在のbodyを使用します。しかし no_change 判定は hygiene autofix より前にあり、titleが異なればその分岐を通過しません。その後、bodyを一時ファイルへ書き、hygiene autofixを実行し、変換後の mutated_candidate を issue_content.update の new_body として送っています。

このautofixは実際にbodyを書き換えます。例えば、Verification Commands内のコマンドへの $ 追加や、欠落した Runtime Verification Applicability セクションの挿入を行い、exit code 0 は「body changed」を意味します。

したがって次の操作が成立します。

  1. 既存Issueのbodyが旧形式で、C4またはC9 autofix対象になっている。
  2. 利用者はtitleだけの変更を要求する。
  3. transaction helperがbodyを自動修正する。
  4. remote PATCHではtitleだけでなくbodyも変更される。

これはIssue #1660が明示する title-only 契約に反します。

必要な修正

body_change_requested = candidate_body != current_body をhygiene前に確定し、title-onlyではmutating hygieneを実行しないでください。検証が必要ならread-only checkに限定し、PATCHへ渡すbodyは現在値をbyte-for-byteで維持すべきです。

body変更を行う場合も、hygiene後にもう一度 no_change を判定する必要があります。

必須回帰テストは、例えば次です。

test_title_only_preserves_noncanonical_current_body_byte_for_byte
test_title_only_does_not_apply_c4_or_c9_hygiene_repairs
test_post_hygiene_candidate_equal_to_current_returns_no_change

2. Blocker — idempotencyがremote stateではなくlocal markerに依存している

_run_issue_content_update は、local markerが存在する場合に限って「remoteが既にdesired stateか」を判定します。markerが無い場合、remoteが既にdesired stateでも旧title/body/updatedAtとの比較へ進み、通常はstale failureになります。corrupt markerの場合はremote readback前に終了します。

さらに、PATCHがtimeout等で失敗を返したもののremoteでは適用済みだった場合、実装は already_applied を返しますがmarkerを書きません。

このため、次の再現経路があります。

  1. PATCHがGitHub側では成功する。
  2. client側ではtimeoutになる。
  3. readbackにより最初の実行は already_applied で成功する。
  4. markerは作られない。
    5.同一requestを再実行する。
  5. remoteはdesired stateだがmarkerがないため、旧state precondition mismatchで失敗する。

成功後の通常経路でも、remote mutation後に _check_no_tracked_changes が失敗した場合や、marker書き込みが例外になった場合、remoteだけ変更済みでmarkerがない状態になります。marker書き込みはlocal postconditionの後です。

加えて、marker-hitとambiguous-appliedのearly returnは、_check_no_tracked_changes とmarker refreshを通過しません。成功経路ごとに安全性条件が異なっています。

必要な制御順序

validate closed input
fetch remote including entity type
check local tracked-change precondition
if remote == desired:
    validate or repair audit marker
    run common success finalizer
    return already_applied / no_change
validate expected previous state
PATCH exactly once
read back remote exactly once
if remote != desired:
    return mutation_outcome_unknown / postcondition_rejected
run common success finalizer
atomically write marker
return applied

markerはremote authorityではなくcache/auditでなければなりません。markerは一時ファイル+os.replaceでatomicに書き、marker欠損・前回requestのmarker・書き込み途中のmarkerをremote reconciliationから独立させる必要があります。


3. Blocker — issue_content.update がPull Requestを対象外にしていない

_fetch_issue_content は /repos/{repo}/issues/{number} を取得し、jqで {title, body, updatedAt} だけを残しています。そのため、レスポンスにある pull_request discriminatorは失われます。PATCHも同じIssues endpointへ送られます。

GitHub公式仕様では、すべてのPull RequestはIssueでもあり、Issues endpointから返された対象がPRかどうかは pull_request キーで識別するとされています。また、Update an issue endpointは Issues: write だけでなく Pull requests: write 権限でも利用でき、title と body を受け取ります。([GitHub Docs]1)

したがって、少なくとも現在の実装は「Issue-only」というentity boundaryを保証していません。公式仕様からは、PR番号を渡した場合にPRのtitle/body mutationへ到達し得ると高い確度で推論できます。

これは特に、このリポジトリがPRレビュー投稿などを別のcontrolled command laneに分離している点と整合しません。

必要な修正

GET時に次を保持し、mutation前にfail-closedにしてください。

{
  "title": "...",
  "body": "...",
  "updatedAt": "...",
  "isPullRequest": true
}

RESTなら has("pull_request")、GraphQLなら __typename を利用できます。

if isPullRequest:
    return target_is_pull_request

必須テストは「pull_request キーを含むfixtureを渡し、PATCH回数がゼロ」であることです。


4. High — bodyless Issueとbodyのクリアを扱えない

content validatorは new_body を含む全文字列フィールドに対してnon-emptyを要求しています。したがって new_body == "" は拒否されます。

readbackも body が str でなければschema errorにします。GitHubがbodyless Issueを null として返すと、title-only更新であっても失敗します。

GitHub公式のUpdate an issue仕様では、body は string or null です。([GitHub Docs]1)

現在の実装では次が不可能です。

  • bodyがnullの既存Issueのtitle-only更新
  • bodyを空へクリアするbody-only更新
  • POST/PATCH後にGitHubがemptyをnullへ正規化した場合のpostcondition照合

必要な修正

内部canonical representationを決めてください。例えばRESTの null を "" に正規化し、hashは常にcanonical textから計算します。

body = raw_body if isinstance(raw_body, str) else ""

一方、API送信時に "" と null を区別する必要があるなら、schemaを str | None として明示的に扱うべきです。


5. High — executor境界でno_changeが実装されていない

markerが無い場合、executorはremote title/bodyがdesired stateと同一かを判定せず、expected previous stateが一致すればそのままPATCHします。つまり、直接executorを呼んだno-op requestはremote writeを発生させます。

transaction helper側には事前の no_change 判定がありますが、hygiene前だけです。hygieneによってcandidateが現在のbodyと同一になった場合は、再判定せずPATCHへ進みます。

Issue #1660は変更なしを no_change として明示しています。

no_change はhelperだけの最適化ではなく、remote side-effectを所有するexecutor側の安全性条件として実装すべきです。remoteがdesired stateならmarkerの有無に関係なくPATCH回数はゼロでなければなりません。


6. High — transaction resultがtitle mutationと失敗の不確実性を表現できない

ISSUE_EDIT_TXN_RESULT_V1 は、新たにtitleを変更するようになった後も body_update しか返しません。previous/requested/remote title、executorのstatus detail、idempotency key、patch attemptの確度がありません。

executorがnon-zeroを返した場合、helperはstructured child resultを保持せず、stdout/stderrをbounded stringへ潰します。その後の一回のreadbackがdesired stateなら failed_after_mutation、それ以外なら failed_no_mutation と分類します。

しかしIssue #1660自身が、厳密なCASは保証せずbest-effort競合検出であると定義しています。PATCHが一旦適用された後、別actorが直ちに上書きした場合、最終readbackはdesired stateではありません。それでもremote mutationは一度発生しています。したがって failed_no_mutation という確定表現は不正確です。

また、executor自身がtrusted host・sanitized environmentでpost-readbackした後、helperは shutil.which("gh") とambient environmentを使ってもう一度readbackします。この二回目のreadback失敗によって、executor成功を failed_after_mutation へ変換できます。

推奨result形状

content_update:
  patch_attempted: true
  status: no_change | applied | already_applied | precondition_rejected |
          postcondition_rejected | mutation_outcome_unknown
  executor_reason: string
  previous_title: string
  requested_title: string
  remote_title: string | null
  previous_body_sha256: string
  requested_body_sha256: string
  remote_body_sha256: string | null
  idempotency_key: string
  artifact_ref: string

PATCH attempt後にdesired stateを確認できなかった場合は、failed_no_mutation ではなく mutation_outcome_unknown が妥当です。


7. Medium — title制御文字チェックとidempotency keyの契約が不十分

title validatorは ord(char) < 32 しか拒否しません。そのためDEL U+007F とC1 control characters U+0080–U+009F は通過します。

Issue #1660の「制御文字を拒否」という契約を満たすには、少なくともUnicode category Cc を拒否すべきです。

import unicodedata

if any(unicodedata.category(ch) == "Cc" for ch in title):
    reject()

また、idempotency_key はnon-emptyであることしか検証されません。markerへ保存はされますが、marker-hit時にrequestのkeyと比較されません。operation_reason も結果やmarkerへ保持されていません。

同じexecutor内の pr_review.publish は、canonical fieldsから期待されるidempotency keyを再計算し、caller supplied keyと一致しなければ拒否しています。content updateでも同じ方式を使うべきです。


テスト証跡はAC3を裏付けていない

専用executor testが実際に確認しているのは、基本成功、literal title transport、remoteが旧stateのままのambiguous failure、stale title、空白・改行・NUL、unknown keyです。

transaction testも、hygieneをmockしてcontent executorへroutingされることを確認するだけで、title-only時に実際に渡されるbodyのbyte identityを検証していません。

PR本文はAC3達成を主張していますが、Issueの事前レビューコメントで要求された異常系の多くが未実装・未テストです。

最低限、次のfixture matrixが必要です。

ケース 必須結果
title-only + C4/C9対象body bodyがbyte-for-byte不変
bodyがnullのIssueでtitle-only PATCH成功、canonical readback成功
bodyを空へ変更 schema拒否せず、readbackを正規化
remoteがdesired、markerなし PATCH 0回、already_applied
timeoutだがremote適用済み markerを修復し、再実行も成功
corrupt marker、remote desired remote authorityに基づくclosed recovery
PR形式のIssues response target_is_pull_request、PATCH 0回
titleにU+007F/U+0085/U+009F PATCH前拒否
完全no-op no_change、PATCH 0回
hygiene後にcurrentと同一 no_change、PATCH 0回
PATCH成功後にlocal postcondition失敗 mutation済みまたはunknownとして分類
PATCH適用後に別actorが上書き failed_no_mutationを返さない
post-readback failure/mismatch 追加PATCH 0回

CI artifactと承認コメントが矛盾している

current HEADに対するGitHub Actionsの各workflow run自体は success です。

しかしrun 29917067356 の実際の ci_verdict_summary_v2.json は次を返しています。

{
  "expected_head_sha": "ee6273521ec590c6b3d225069cba3ba14229ec36",
  "head_sha": "ee6273521ec590c6b3d225069cba3ba14229ec36",
  "overall_status": "stale_head_sha",
  "next_action": "refresh_head_sha"
}

各required/evidence checkは head_sha: null、blocking_merge_ready: true です。さらに node-backed-hook-tests は classification: unknown、failure_reason: gh_error です。

  • [current CI verdict JSON](sandbox:/mnt/data/ci_verdict_summary_v2.json)
  • [current CI binding JSON](sandbox:/mnt/data/ci_verdict_summary_v2_binding.json)

原因はworkflowが各jobの needs.*.result をgeneratorへ渡している一方、generator自身が needs_result_synthetic にはreal head SHAがないとして head_sha = null にし、null+successを stale_head_sha と判定しているためです。

また node-backed-hook-tests はworkflowから渡されているのに、classification mapとrequired setに存在しません。

最新のPR reviewは「13/13 PASS、pending/failed/staleなし」として APPROVE / merge_ready: true を出していますが、このartifactとは両立しません。

これはPR #1669が導入したコード不具合ではなく、リポジトリ横断のCI evidence生成不具合である可能性が高いです。ただし、現在のartifactを正本として運用する限り、PR #1669を merge_ready: true とする証拠は成立していません。

修正は次のどちらかです。

  1. aggregatorがcurrent HEADの実check runsを取得し、check_run ID / head SHA / workflow / job nameをgeneratorへ渡す。
  2. workflow_run_id + job + PR_HEAD_SHA に暗号学的・API的に束縛された別provenanceを定義し、synthetic evidenceを正式に受け入れる。

単にsynthetic entryへcaller supplied head SHAをコピーするだけでは、generatorが避けようとしているhead spoofingを再導入します。


妥当な実装部分

前回レビューで問題になったtitle transportは修正されています。現在はJSONファイルを生成し、gh api --input で送っているため、true、false、null、整数文字列、@ prefixをJSON stringのまま保持できます。GitHub CLI公式仕様でも、--field はそれらを型変換し、@ をファイル参照として扱う一方、--input は指定ファイルをHTTP bodyとして使用します。 (GitHub CLI)

また、trusted host、sanitized environment、fixed endpoint、単一PATCH、title/body双方のpost-readbackという基本構造は正しい方向です。

依存PR #1667のmerge commit e4a01b... はPR #1669のbase SHAになっており、#1632側の変更を取り込んだ順序も正しいです。

一方、Issue #1647は現在もopenで、同じ controlled_skill_mutation_policy.py / controlled_skill_mutation_exec.py を変更対象にしています。merge直前に関連PRの有無と最新mainを再確認する必要があります。


merge前の最低条件

  1. title-onlyでbodyを一切変更しない。
  2. remote desired-state判定をmarkerから独立させ、ambiguous success・marker欠損・marker破損・local postcondition failureから再実行可能にする。
  3. PR targetをmutation前に拒否する。
  4. null/empty bodyをcanonicalに扱う。
  5. executor境界で no_change を実装する。
  6. result schemaへtitleとmutation uncertaintyを追加し、failed_no_mutation の過剰断定を廃止する。
    7.上記fixture matrixを追加し、AC3証跡を更新する。
  7. ci_verdict_summary_v2 をcurrent HEADに対して merge_ready または少なくとも内部矛盾のない状態へ修正する。
  8. #1647とのsurface collisionをmerge直前に再確認する。

現状の APPROVE は、literal title transport修正とgreen Actionsまでは正しく評価していますが、transaction境界、remote-state reconciliation、entity type、artifact semanticsを十分に検証していません。

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

自動 PR レビュー結果

Issue #1660 の fresh contract snapshot、current HEAD、AC1--AC7 の verification、Allowed Paths、および current-head CI artifact を照合しました。

  • current HEAD: b5295e17c4b46e7492f232b09aefd0062ee51ffb
  • VC: AC1--AC7 の 7/7 PASS(206件)
  • CI: run 29922709024 all pass
  • CI verdict artifact: 8530714671 は current-head binding と required evidence を満たす
  • Allowed Paths: 11 files、違反なし
  • #1429 waiver は 2026-08-05 まで有効、#1647 は open PR なしの C1
LOOP_VERDICT_V2:
  verdict: APPROVE
  reviewed_head_sha: "b5295e17c4b46e7492f232b09aefd0062ee51ffb"
  merge_ready: true
  mergeability:
    mergeable: "MERGEABLE"
    merge_state_status: "CLEAN"
  blockers: []
  required_auto_actions: []
  auto_fix_applied: []
  follow_up_issue_requests: []
  allowed_paths_gate:
    status: ok
    changed_files_source: git_diff_name_status_find_renames_z
    changed_files_count: 11
  allowed_paths_gate_source: review_subagent

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-issue skill の controlled executor に Issue title mutation を追加する

1 participant