Skip to content

実装: edit-issue transaction script を追加し issue-author の shell 手順と context load を削減する #1287

Closed
1 of 1 issue completed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "edit-issue の長い Bash 手順を controlled metadata executor 消費型の単一 transaction script に集約し、issue-author の raw Issue mutation 経路と context load を削減する"
change_kind: mixed
dependency_policy:
  required_for_txn_helper: "#1284 / PR #1295"
  required_for_end_to_end_raw_mutation_removal: "#1291 / PR #1298"

Parent Issue

なし(単独改善)

Parent Goal Ref

  • Goal: Issue 本文更新の backup / guard / readiness / controlled mutation / readback / optional comment を 1 transaction として決定論的に実行する
  • Desired Destination: issue-author が既存 Issue body/comment mutation で raw gh issue edit / gh issue comment / raw gh api PATCH|POST を production path として直接実行しない状態

Current Validated Scope

  • .claude/skills/edit-issue/scripts/edit_issue_txn.py(新規)で ISSUE_EDIT_TXN_INPUT_V1 を受ける transaction helper を追加する
  • ISSUE_EDIT_TXN_INPUT_V1 / ISSUE_EDIT_TXN_RESULT_V1 の closed schema 正本を docs/dev/agent-skill-boundaries.md に追加する
  • .claude/skills/edit-issue/SKILL.md を transaction invocation / failure routing / controlled executor consumption 中心へ圧縮する
  • .claude/agents/issue-author.md を edit_issue_txn.py の input/output 契約 consumer に更新し、既存 Issue body/comment mutation で raw gh issue edit / gh issue comment を許可しない
  • transaction テストを .claude/skills/edit-issue/tests/test_edit_issue_txn.py に追加する

Remaining Parent Gaps

Outcome

edit_issue_txn.py が current issue readback、candidate body validation、guard / hygiene / readiness、issue_body.update と issue_comment.publish の controlled executor 呼び出し、final readback、bounded JSON result 出力を 1 transaction として実行し、edit-issue/SKILL.md と issue-author.md が raw Issue mutation 手順ではなく transaction 呼び出し契約だけを参照する状態。

Background

edit-issue/SKILL.md は backup、feedback 取得、baseline VC check、guard、contract readiness、gh issue edit、rollback、ready tuple readback、success comment までを長い Bash 手順として保持している。issue-author も Bash 制約コメントで gh issue create / gh issue edit / gh issue comment を許可しており、既存 Issue body/comment mutation が raw GitHub CLI 経路へ戻りやすい。

#1284 / PR #1295 で issue_body.update、issue_comment.publish、contract_snapshot.publish の controlled metadata executor lane は実装済みである。issue_body.update は previous_body_sha256 / previous_updated_at による stale-write 防止と post-readback を持ち、issue_comment.publish は marker readback を持つ。input file namespace は artifacts/{issue_number}/issue-metadata/{command-id}/ 配下に固定されている。

#1291 / PR #1298 は local main guard に残る raw gh issue edit/comment allowlist を controlled executor lane へ一本化する follow-up であり、2026-07-03 時点で PR #1298 は open / not merged である。そのため本 Issue は txn helper の局所移行と、end-to-end raw mutation removal の依存を分離して扱う。

In Scope

  • ISSUE_EDIT_TXN_INPUT_V1 の closed schema を定義する。v1 では issue_number / repo / new_body_file / readiness_forwarding_payload / comment_mode / expected_previous_body_sha256 / expected_previous_updated_at を扱い、title_update は受け付けても no-mutation failure にする
  • ISSUE_EDIT_TXN_RESULT_V1 の closed schema を定義する。status は ok | no_change | failed_no_mutation | failed_after_mutation | human_judgment とし、mutation_started、body_update / comment_publish の attempted/status、previous/new/current body sha、artifact refs、bounded errors を含める
  • transaction order を固定する: current issue readback → previous body sha 算出 → candidate body load → guard-issue-body → hygiene autofix → contract readiness preflight → controlled executor input JSON 生成 → issue_body.update 実行 → final readback → optional issue_comment.publish → bounded result 出力
  • guard / hygiene / readiness / stale precondition failure では controlled executor を呼ばず、failed_no_mutation を返す
  • body update 成功後に comment publish / final readback / result capture が失敗した場合は failed_after_mutation、mutation_started=true、rollback_attempted=false を返す
  • executor input JSON は artifacts/{issue_number}/issue-metadata/issue_body.update/{txn_id}.input.json と artifacts/{issue_number}/issue-metadata/issue_comment.publish/{txn_id}.input.json にのみ生成する
  • 子プロセスは subprocess.run([...], capture_output=True, text=True, shell=False) で呼び、txn 自身の stdout は最後の 1 JSON object のみにする
  • edit-issue/SKILL.md と .claude/agents/issue-author.md から、既存 Issue body/comment mutation の production instruction として raw gh issue edit / gh issue comment / raw gh api PATCH|POST を使う手順を除去する

Out of Scope

Acceptance Criteria

  • AC1: ISSUE_EDIT_TXN_INPUT_V1 / ISSUE_EDIT_TXN_RESULT_V1 の closed schema が docs/dev/agent-skill-boundaries.md に追加され、body/comment mutation の authority が controlled executor command id に限定されている
  • AC2: edit_issue_txn.py は body/comment mutation に scripts/agent-guards/controlled_skill_mutation_exec.py の issue_body.update / issue_comment.publish だけを使い、raw gh issue edit / gh issue comment / raw gh api --method PATCH|POST / shell=True / bash -c / sh -c / python -c を production path に含まない
  • AC3: title_update または body/comment 以外の metadata mutation が要求された場合、txn は controlled executor を呼ばず failed_no_mutation または human_judgment を返す
  • AC4: guard / hygiene / readiness / stale body sha / stale updatedAt の failure は mutation-before-failure なしで failed_no_mutation になり、controlled executor input の作成または executor invocation が行われない
  • AC5: body update 成功後に comment publish または final readback が失敗した場合、result は failed_after_mutation、mutation_started=true、rollback_attempted=false、remote current body sha と artifact refs を含む
  • AC6: stdout は exactly one bounded JSON object で、old/new issue body、raw reviewer feedback、raw child stdout/stderr を含まず、error message 長と件数が上限で切られる
  • AC7: controlled executor input files は artifacts/{issue_number}/issue-metadata/{command-id}/ 配下にのみ作られ、絶対パス / .. / symlink / hardlink を authority input として使わない
  • AC8: .claude/skills/edit-issue/SKILL.md と .claude/agents/issue-author.md は transaction invocation と result routing を参照し、既存 Issue body/comment mutation の raw GitHub CLI 手順を production instruction として残していない
  • AC9: 実装: local_main_branch_guard の raw gh issue edit/comment allowlist を controlled executor lane へ移行して deprecate する #1291 / PR fix: raw issue metadata mutation を controlled executor に一本化 #1298 への依存は required_for_end_to_end_raw_mutation_removal として明記され、本 Issue の success は txn helper の局所移行と混同されない

Verification Commands

# AC1
$ uv run --locked pytest .claude/skills/edit-issue/tests/test_edit_issue_txn.py -k schema_contracts_are_closed
# AC2
$ uv run --locked pytest .claude/skills/edit-issue/tests/test_edit_issue_txn.py -k no_raw_issue_mutation_or_shell_escape_in_production_path
# AC3
$ uv run --locked pytest .claude/skills/edit-issue/tests/test_edit_issue_txn.py -k title_update_rejected_without_controlled_executor
# AC4
$ uv run --locked pytest .claude/skills/edit-issue/tests/test_edit_issue_txn.py -k no_mutation_before_guard_readiness_or_stale_precondition
# AC5
$ uv run --locked pytest .claude/skills/edit-issue/tests/test_edit_issue_txn.py -k body_update_success_comment_or_readback_failure_maps_failed_after_mutation
# AC6
$ uv run --locked pytest .claude/skills/edit-issue/tests/test_edit_issue_txn.py -k stdout_single_bounded_json_no_body_or_child_output_leak
# AC7
$ uv run --locked pytest .claude/skills/edit-issue/tests/test_edit_issue_txn.py -k executor_inputs_under_issue_metadata_namespace
# AC8
$ uv run --locked pytest .claude/skills/edit-issue/tests/test_edit_issue_txn.py -k skill_and_issue_author_no_raw_existing_issue_mutation_contract
# AC9
$ uv run --locked pytest .claude/skills/edit-issue/tests/test_edit_issue_txn.py -k dependency_policy_separates_txn_helper_from_end_to_end_raw_removal

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/SKILL.md
  • .claude/agents/issue-author.md
  • docs/dev/agent-skill-boundaries.md

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • title_update_requested_without_controlled_title_executor が発生した場合
  • guard_or_readiness_failed_before_mutation が発生した場合
  • controlled executor input を artifacts/{issue_number}/issue-metadata/{command-id}/ 配下に生成できない場合
  • remote body sha または updatedAt が issue_body.update 前に変化した場合
  • body update は成功したが final readback を検証できない場合
  • comment publish marker が重複、欠落、または body hash mismatch になった場合

Required Skills

なし

Scope Delta(任意)

source decision
Anchor comment issuecomment-4875189861 title_update と automatic rollback を v1 scope 外にし、controlled executor consumption と bounded result schema に scope を固定
#1284 / PR #1295 txn helper の required dependency として扱う
#1291 / PR #1298 end-to-end raw mutation removal の dependency として扱い、本 Issue の局所 helper completion と分離

Runtime Verification Applicability

runtime_verification:
  decision: not_applicable
  required: false
  reason: "本 Issue は edit-issue transaction helper と docs/agent contract の静的・unit-test 可能な変更であり、browser/UI/runtime smoke を要求しない"
  applicable_acs: []
  deferred_destination: null
  artifact_requirements: []

Notes for Reviewer

  • 実装: edit-issue transaction script を追加し issue-author の shell 手順と context load を削減する #1287 v1 は “existing issue body/comment mutation は controlled executor のみ” に限定する。create_issue_txn.py との共通化や title controlled executor 追加は行わない
  • edit_issue_txn.py は子プロセス stdout/stderr をそのまま relay せず、result JSON に bounded code/message と artifact ref だけを含める
  • rollback_required を使う場合でも v1 invariant は rollback_attempted=false とし、自動 rollback は別 Issue の設計対象にする

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added
    enhancement
    phase/implementation
    triage-required
    agent/implementer
    state/blocked
    on Jul 2, 2026
  2. squne121 commented on Jul 3, 2026

    @squne121
    OwnerAuthor

    判定

    REQUEST_CHANGES。 #1287 の方向性は正しいです。現在の edit-issue は raw gh issue edit/comment と手順書内の長い shell 手順に依存しており、Issue body mutation を controlled executor に寄せる価値は高い。ただし、#1287 の本文のまま実装すると「transaction helper」という名前に対して、title 更新不能、rollback 契約不成立、raw mutation 経路の残存、bounded stdout の漏洩リスク、schema 未固定が残ります。対象 Issue は state/blocked 付きで、コメントは空でした。

    確認した関連資産

    #1284 / PR #1295 で、issue_body.update、issue_comment.publish、contract_snapshot.publish の controlled metadata executor lane は既に実装済みです。policy 側には command id と per-command schema が定義され、新 3 command は LOOP_ISSUE_NUMBER が任意だが存在時は一致必須、という root/default branch 実行向けの binding になっています。 executor 側も、input-file を artifacts/{issue}/issue-metadata/{command-id}/ 配下に限定し、絶対パス・..・symlink・hardlink を拒否し、schema と issue_number を検証します。

    #1291 / PR #1298 は、local main 側に残る raw gh issue edit/comment allowlist を閉じて controlled executor lane に一本化する follow-up です。PR #1298 は open / not merged で、raw issue mutation の must-block、controlled metadata command の must-allow、repair hint の非推奨経路排除を実装対象にしています。 したがって #1287 が「raw gh issue edit/comment は実行不能」と主張するなら、#1291/#1298 の merge 状態を前提条件に入れるべきです。

    現行 edit-issue はまだ raw mutation を直接使っています。Step 5 は gh issue edit "$ISSUE_NUMBER" --body-file "$NEW_BODY" と --title を使い、失敗時 rollback も gh issue edit --body-file "$ORIG" です。 さらに結果コメントや rollback failure comment も raw gh issue comment です。 issue-author 側も Bash 制約コメントで gh issue create / gh issue edit / gh issue comment を許可しており、#1287 の AC1 と衝突します。

    外部仕様から見た攻撃面

    gh issue edit は body だけの狭い API ではありません。GitHub CLI の公式 manual では、assignee、blocked-by/blocking、labels、project、sub-issue、body、body-file、milestone、parent、title、type など広い Issue metadata を変更でき、--body-file - で stdin からも body を読めます。([GitHub CLI]1) ([GitHub CLI]1) つまり #1287 の「raw gh issue edit 禁止」は妥当ですが、テストは --body-file tmp/foo.md だけでなく --title、--add-label、--remove-label、--parent、--add-sub-issue、--body-file - なども明示的に落とす必要があります。

    gh issue comment も単なる create ではありません。公式 manual は --body / --body-file に加え、stdin、--create-if-none、--delete-last、--edit-last、--editor、--web、--yes を持っています。([GitHub CLI]2) そのため #1287 の negative test は raw comment publish だけでは足りず、edit/delete/interactive/web/stdin 経路まで block する必要があります。

    REST の Update an issue endpoint も body 専用ではなく、title、body、assignee、state、state_reason、milestone、labels、assignees、issue field values、type まで扱います。([GitHub Docs]3) ([GitHub Docs]3) #1284 executor が issue_body.update として body だけを PATCH している設計は、raw gh issue edit より blast radius を絞るという意味で正しいです。GitHub CLI の gh api は field を追加すると既定 method が POST に変わるため、executor のように --method PATCH/POST を argv-list で明示する設計も妥当です。([GitHub CLI]4)

    Python 側は subprocess.run([...]) の argv-list / shell=False を維持すべきです。Python 公式 docs は、標準では shell を暗黙に呼ばないため shell metacharacters を child process に安全に渡せる一方、shell=True を明示した場合は shell injection を避ける quoting がアプリケーション責任になる、と説明しています。([Python documentation]5) #1287 の新 edit_issue_txn.py では shell=True、bash -c、sh -c、python -c を全面禁止にしてください。

    Blocker 1: title_update が実装不能

    #1287 の入力案は body_update / title_update / comment_mode を含みますが、#1284 の controlled executor lane に存在する body mutation は issue_body.update だけです。policy でも issue_body.update は “Issue body の stale-write 防止付き更新” と定義され、issue_comment.publish は comment、contract_snapshot.publish は snapshot 投稿です。 docs 側の metadata lane も 3 command id のみを正本化しており、title 専用 executor はありません。

    現行 edit-issue は title_change がある場合 raw gh issue edit --title を body update と同じ Step 5 で実行します。 しかし #1287 は raw gh issue edit を禁止します。したがって v1 で title_update を許すと、実装者は raw gh issue edit に戻るか、issue_body.update の責務を破って title も扱わせる誘惑に落ちます。

    修正要求: #1287 v1 では title_update を scope 外にしてください。title 変更が必要なら status: human_judgment または unsupported_title_update で no-mutation fail にする。title も controlled 化するなら、別 Issue で issue_title.update または issue_metadata.update command id を設計し、stale-write precondition、schema、postcondition、marker、tests を #1284 と同水準で追加するべきです。

    Blocker 2: rollback 契約が transaction として未成立

    #1287 は「mutation 後に rollback が必要な状態」と「mutation 前 failure」を区別したいようですが、現在の controlled executor は stale-write と post-readback をかなり強く持っています。issue_body.update は mutation 前に remote body sha と updatedAt を readback し、input の previous_body_sha256 / previous_updated_at と一致しなければ mutation しません。mutation 後も new_body_sha256 と remote readback を照合します。

    この設計では、rollback が必要になるのは主に「body update は成功したが、その後の comment publish、ready tuple 検証、result capture、postcondition check が失敗した」ケースです。ところが #1287 は rollback 用の stale precondition を定義していません。元 body へ戻すには、rollback 自体も 別の issue_body.update として、直前の remote body sha / updatedAt を読み直し、previous_* = txn が書いた new body の現状態、new_body = backup body にする必要があります。現行の rollback は raw gh issue edit --body-file "$ORIG" なので、このままでは #1287 の controlled mutation 方針と矛盾します。

    修正要求: 自動 rollback は v1 から外すか、明確に controlled rollback として定義してください。推奨は、v1 では自動 rollback せず、以下の状態分類に限定することです。

    ISSUE_EDIT_TXN_RESULT_V1:
      status: ok | no_change | failed_no_mutation | failed_after_mutation | human_judgment
      mutation_started: true | false
      body_update:
        attempted: true | false
        controlled_executor_status: ok | failed | not_run
        previous_body_sha256: "sha256:..."
        new_body_sha256: "sha256:..."
      comment_publish:
        attempted: true | false
        controlled_executor_status: ok | failed | not_run
      rollback_required: true | false
      rollback_attempted: false   # v1 invariant
      remote_current_body_sha256: "sha256:..."
      errors:
        - code: bounded_code
          message: bounded_message_no_body_text

    rollback を入れるなら rollback_attempted、rollback_result、rollback_previous_body_sha256、rollback_previous_updated_at、rollback_new_body_sha256 を必須にしてください。曖昧な “rollback needed” だけでは、人間も agent も安全に再実行できません。

    Blocker 3: #1287 の “transaction” は artifacts namespace と接続していない

    #1284 は input file namespace を artifacts/{issue_number}/issue-metadata/{command-id}/ に統一しています。docs でも command id ごとの subtree 分離が明記されています。 executor もこの containment を実際に検証します。

    一方、現行 edit-issue は tmp/issue_<N>_backup_<ts>.md と tmp/issue_<N>_new.md を使う前提です。backup helper も body を tmp/ に保存し、metadata JSON も tmp/ に置きます。 これは controlled executor の input-file binding と噛み合いません。

    修正要求: edit_issue_txn.py は executor input JSON を必ず以下に生成する、と #1287 に明記してください。

    artifacts/{issue_number}/issue-metadata/issue_body.update/{txn_id}.input.json
    artifacts/{issue_number}/issue-metadata/issue_comment.publish/{txn_id}.input.json
    

    backup body を tmp/ に残す運用は許しても、executor に渡す authority file は artifacts/.../issue-metadata/... 配下だけにするべきです。stdout に body 本文を出さず、result には body_sha256 と artifact path/ref だけを返すのが安全です。

    Blocker 4: bounded stdout が弱い

    #1287 AC3 は「stdout は bounded JSON のみ」としていますが、実装上は子プロセスの stdout/stderr を漏らしやすい箇所が多い。guard-issue-body.py は JSON/YAML 出力を持ち、contract readiness checker、hygiene autofix、controlled executor も JSON/diagnostic を出します。現行 helper 群は subprocess を多数呼ぶ構造です。

    修正要求: edit_issue_txn.py は子プロセスをすべて capture_output=True, text=True, shell=False で実行し、txn 自身の stdout は最後の 1 JSON object だけにしてください。stderr は原則ゼロ、または --debug 時だけ bounded diagnostics。result schema には new_body、old_body、reviewer_feedback_text、raw child stdout/stderr を入れない。エラー message は長さ上限、例えば 300–500 chars、配列件数上限を固定してください。

    追加テストは最低限これです。

    test_stdout_is_single_json_object_when_guard_emits_stdout
    test_stdout_does_not_contain_new_body_or_feedback_payload
    test_error_messages_are_truncated
    test_child_stderr_not_forwarded_unbounded
    

    Blocker 5: readiness / guard failure と mutation ordering が不十分

    #1287 AC2 は「guard/readiness failure では mutation しない」と言いますが、どの readback とどの artifact が authority かが曖昧です。現行 edit-issue は guard、hygiene autofix、contract readiness static check、raw mutation、readiness tuple readback、fail comment という長い手順です。

    修正要求: #1287 に transaction order を固定してください。

    1. read current issue: title, body, updatedAt
    2. compute previous_body_sha256
    3. construct candidate new body
    4. run guard-issue-body
    5. run hygiene autofix
    6. run contract readiness preflight
    7. if any blocker: emit failed_no_mutation; do not call controlled executor
    8. build ISSUE_BODY_UPDATE_INPUT_V1
    9. invoke controlled_skill_mutation_exec.py --command-id issue_body.update --json
    10. read back body/updatedAt/labels/title as ready tuple
    11. optionally publish comment through issue_comment.publish only
    12. emit ISSUE_EDIT_TXN_RESULT_V1
    

    特に Step 7 と Step 9 の間に raw gh issue edit、raw gh api PATCH、raw gh issue comment、raw gh api POST が存在しないことを static test で固定するべきです。

    Blocker 6: local main raw allowlist の未 merge 状態を #1287 が無視している

    #1291 は、#1284 後も local_main_branch_guard.py の raw Issue mutation allowlist が残り、2 つの認可経路が並存することを問題化しています。 PR #1298 はその修正を実装していますが、取得時点では open / not merged です。

    #1287 が issue-author と edit-issue の中から raw mutation を消すだけなら、#1291 を hard dependency にしなくても局所的には進められます。しかし「raw issue body/comment mutation が production path として消える」ことを AC に含めるなら #1291/#1298 が前提です。

    修正要求: #1287 の dependency を次のどちらかに分けてください。

    dependency_policy:
      required_for_txn_helper: "#1284 / PR #1295"
      required_for_end_to_end_raw_mutation_removal: "#1291 / PR #1298"

    これを曖昧にすると、PR レビューで “実装は pass だがローカル main では raw gh がまだ通る” という状態を APPROVE してしまいます。

    Blocker 7: issue-author 圧縮が schema consumer 更新になっていない

    #1287 は .claude/agents/issue-author.md を圧縮対象にしていますが、現行 agent 定義は Issue mutation の権限境界そのものを Bash コメントで規定しています。gh issue edit/comment を許すコメントが残る限り、SubAgent は新 txn をバイパスできます。 また、docs は SubAgent 定義に詳細手順を埋めることを anti-pattern としており、正本は docs/dev/agent-skill-boundaries.md に置く設計です。

    修正要求: #1287 は schema consumer inventory を必須化してください。

    Consumers to update:
    - .claude/skills/edit-issue/SKILL.md
    - .claude/agents/issue-author.md
    - docs/dev/agent-skill-boundaries.md
    - tests that grep raw gh mutation paths
    

    さらに ISSUE_EDIT_TXN_INPUT_V1 / ISSUE_EDIT_TXN_RESULT_V1 の正本を docs/dev/agent-skill-boundaries.md に置き、SKILL.md と agent は呼び出し契約だけを参照する形にするべきです。

    #1287 本文への具体的な修正案

    追加すべき “Out of Scope”:

    out_of_scope:
      - title_update via raw gh issue edit
      - label/milestone/assignee/parent/sub-issue mutation
      - automatic rollback unless implemented through controlled issue_body.update
      - adding new controlled executor command ids

    追加すべき “Stop Conditions”:

    stop_conditions:
      - title_update_requested_without_controlled_title_executor
      - guard_or_readiness_failed_before_mutation
      - controlled_executor_input_cannot_be_written_under_artifacts_issue_metadata
      - remote body sha or updatedAt changed before issue_body.update
      - body update succeeded but final readback cannot be verified
      - comment publish marker duplicate or body hash mismatch

    追加すべき AC:

    AC0: ISSUE_EDIT_TXN_INPUT_V1 / RESULT_V1 closed schema is added to docs/dev/agent-skill-boundaries.md.
    AC1: issue-author and edit-issue contain no production instruction that allows raw gh issue edit/comment for existing issue body/comment mutation.
    AC2: edit_issue_txn.py invokes only controlled_skill_mutation_exec.py for body/comment mutation; no raw gh issue edit/comment and no raw gh api PATCH/POST exist outside controlled executor.
    AC3: title_update is rejected with failed_no_mutation until a controlled title executor exists.
    AC4: guard/readiness/hygiene blocker prevents any controlled executor invocation.
    AC5: stale body sha or updatedAt mismatch returns failed_no_mutation.
    AC6: body update success + later comment/readback failure returns failed_after_mutation with mutation_started=true and rollback_attempted=false.
    AC7: stdout is exactly one bounded JSON object and never contains old/new issue body or opaque reviewer feedback.
    AC8: executor input files are created only under artifacts/{issue}/issue-metadata/{command-id}/.
    AC9: result carries previous/new/current body sha and artifact refs sufficient for safe manual recovery.
    

    追加すべき Verification Commands:

    $ rg -n "gh issue edit|gh issue comment|gh api --method (PATCH|POST)|shell=True|bash -c|sh -c|python -c" .claude/skills/edit-issue .claude/agents/issue-author.md
    # expected: only tests/docs negative examples, no production path
    
    $ uv run --locked pytest .claude/skills/edit-issue/tests/test_edit_issue_txn.py -k "no_mutation_before_guard_or_readiness"
    
    $ uv run --locked pytest .claude/skills/edit-issue/tests/test_edit_issue_txn.py -k "title_update_rejected_without_controlled_executor"
    
    $ uv run --locked pytest .claude/skills/edit-issue/tests/test_edit_issue_txn.py -k "stale_precondition_maps_to_failed_no_mutation"
    
    $ uv run --locked pytest .claude/skills/edit-issue/tests/test_edit_issue_txn.py -k "body_update_success_comment_failure_maps_failed_after_mutation"
    
    $ uv run --locked pytest .claude/skills/edit-issue/tests/test_edit_issue_txn.py -k "stdout_single_bounded_json_no_body_leak"
    
    $ uv run --locked pytest .claude/skills/edit-issue/tests/test_edit_issue_txn.py -k "executor_inputs_under_issue_metadata_namespace"

    実装方針

    edit_issue_txn.py は create_issue_txn.py のような “CLI transaction helper” に寄せる方向でよいです。create_issue_txn.py は dedupe、create、labels、subissue/dependency、readback、partial failure audit comment を 1 helper に集約しています。 ただし create_issue_txn.py は gh issue create や label edit を直接呼ぶ設計なので、#1287 でそのまま common 化するのは危険です。#1287 v1 は “existing issue body/comment mutation は controlled executor のみ” に限定した別 helper にしてください。

    推奨 flow は次です。

    edit_issue_txn.py
      ├─ readonly gh issue view: title, body, labels, updatedAt
      ├─ compute previous_body_sha256
      ├─ render candidate new body
      ├─ run guard/hygiene/readiness with captured stdout/stderr
      ├─ reject title_update unless controlled title executor exists
      ├─ write ISSUE_BODY_UPDATE_INPUT_V1 under artifacts/{issue}/issue-metadata/issue_body.update/
      ├─ invoke controlled_skill_mutation_exec.py --command-id issue_body.update --json
      ├─ readback final body/updatedAt/ready tuple
      ├─ optional issue_comment.publish with deterministic marker
      └─ print ISSUE_EDIT_TXN_RESULT_V1 only
    

    #1287 はこの形に contract を締めれば、#1284 で入った高品質な executor lane を正しく消費できます。現状のままだと、実装者が title_update と rollback を処理するために raw gh issue edit へ戻るか、controlled executor の責務を拡張してしまう可能性が高いです。

  3. squne121 commented on Jul 3, 2026

    @squne121
    OwnerAuthor

    Refinement Loop: Approved

    The issue has been approved and is ready for implementation.

  4. squne121 commented on Jul 3, 2026

    @squne121
    OwnerAuthor

    Contract Review Result

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-07-03T10:40:51Z"
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/1287
      body_sha256: "sha256:559d8e04786e249bbd775498909ecf7ec5533a92d36a7f0bc9e406a47d74b47e"
      checks:
        readiness: go
        blockers: pass
        product_spec: pass
        vc_preflight: pass
      source: ensure_contract_snapshot_auto
  5. squne121 commented on Jul 3, 2026

    @squne121
    OwnerAuthor

    implement-issue 完了: PR #1301 / worktree .claude/worktrees/issue-1287-edit-issue-txn / branch worktree-issue-1287-edit-issue-txn / verification 9/9 PASS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/implementerenhancementphase/implementationstate/blockedtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions