Skip to content

fix: normalize close-not-planned anchor decisions - #2478

Merged
squne121 merged 7 commits into
mainfrom
worktree-issue-2472-anchor-scope-reframe-close-not-planned
Sep 3, 2026
Merged

squne121 merged 7 commits into
mainfrom
worktree-issue-2472-anchor-scope-reframe-close-not-planned

Conversation

@squne121

@squne121 squne121 commented Sep 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • close_not_planned を ANCHOR_SCOPE_REFRAME_V1 の排他的な decision として追加しました。
  • trusted OWNER の structured/freeform terminal marker を not_planned disposition に正規化し、既存の human_judgment_required termination lane へ送ります。
  • category binding と false-positive 防止を含む回帰テストを追加しました。

Checks

Schema Change Applicability

  • decision: schema_change
  • reason: ANCHOR_SCOPE_REFRAME_V1 に additive な close_not_planned decision と allowed_path_deltas の decision-dependent exclusivity を追加します。

Schema Consumer Inventory

変更対象 schema: ANCHOR_SCOPE_REFRAME_V1 (anchor_scope_reframe_v1.schema.json)

before/after 差分:

# before
required: [schema_version, target, decision, allowed_path_deltas, rationale, required_rerun]
decision: approve_scope_delta

# after
approve_scope_delta: allowed_path_deltas required and non-empty
close_not_planned: allowed_path_deltas forbidden
decision: [approve_scope_delta, close_not_planned]

Consumer 列挙:

rg -l 'anchor_scope_reframe_v1|ANCHOR_SCOPE_REFRAME_V1' .claude/skills/issue-refinement-loop

run_refinement_preflight.py、plan_refinement_loop.py、scope_signal_delta.py、decide_next_loop_action.py、anchor schema/preflight tests、および skill/reference documents を確認しました。

Consumer 更新状況:

Consumer ファイル 更新有無 備考
scripts/run_refinement_preflight.py 更新済み schema validation 後の close-only normalization、OWNER gate、category binding、termination routing を実装
scripts/plan_refinement_loop.py 不要 normalized known_context を消費し、schema payload を直接再解釈しない
scripts/scope_signal_delta.py 不要 scope-delta evidence の既存 producer。close-only lane は scope delta を生成しない
scripts/decide_next_loop_action.py 不要 既存 human_judgment_required enum をそのまま消費
tests/test_anchor_scope_reframe_close_not_planned.py 追加 AC1–AC14 の schema、trust、routing、freeform negative cases
tests/test_anchor_context_multi_turn_supersession.py 更新 AC15: legacy mutation_category: close fixture を decision: close_not_planned / authorized_mutation_category: not_planned / implementation_go: false の normalized contract へ移行

Compatibility Decision(互換性判断)

この変更は既存の scope-delta 契約を維持し、新しい close-only disposition だけを追加します。

  • change_type: additive
  • compatibility: backward_compatible
  • migration_required: no
  • migration_or_followup: N/A
  • reason: existing approve_scope_delta payload は required/non-empty delta constraint を維持し、close-only payload のみ新たに受理します。

Safety Claim Matrix

安全性に関する主張は、今回実装した trust boundary と unit regression の範囲だけに限定します。

Claim Implemented? Not controlled Evidence Follow-up
close-only disposition is limited to an OWNER and exact not_planned category yes Issue VC AC4–AC8 PASS; focused regression suite 128 PASS
fenced, blockquoted, and prose marker false positives are not accepted yes Issue VC AC11–AC14 PASS
close-only preflight does not produce scope-delta contract updates yes Issue VC AC9 PASS

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

この変更は CI workflow の性能改善を主張せず、schema/test lane の実行証跡だけを記録します。

CI_TEST_PERFORMANCE_DECISION_V1:
  schema: CI_TEST_PERFORMANCE_DECISION_V1
  issue_number: 2472
  pr_number: 2478
  decision_scope: docs_only
  changed_paths:
    - .claude/skills/issue-refinement-loop/schemas/anchor_scope_reframe_v1.schema.json
    - .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py
    - .claude/skills/issue-refinement-loop/tests/test_anchor_scope_reframe_close_not_planned.py
    - .claude/skills/issue-refinement-loop/tests/test_anchor_context_multi_turn_supersession.py
  lane_classification:
    fast_static:
      applicable: true
      evidence: [ruff check passed for changed Python files]
      required_commands: [uv run --locked ruff check]
    python_unit:
      applicable: true
      evidence: [schema path requires python_unit; focused suite passed 128 tests]
      required_commands: [uv run --locked pytest]
    contract_artifact:
      applicable: true
      evidence: [schema contract and contract test changed]
      required_commands: [Issue #2472 Verification Commands]
    integration:
      applicable: false
      evidence: [no workflow, UI, or external integration path changed]
      required_commands: []
  baseline_inputs:
    ci_runtime_baseline_v1_available: false
    run_count: 0
    p50_p95_ready: false
  artifact_consistency:
    ci_test_selection_v1_checked: true
    missing_pytest_args: []
  risk_flags: [baseline_insufficient]
  reviewer_gate:
    approve_allowed: true
    required_evidence: [CI_CHECK_RUN_SCOPED]
    approve_denied_reason: null
    evidence_note: required CI checks (typecheck/lint/test/build/python-test/validate-generated-artifact) all pass on head 80e71cda0b4bcf70de3a75d30bc186c9d08df395
  follow_up_required: []

Notes

Accept trusted OWNER close-only dispositions without scope deltas and route them to existing human judgment handling.

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

github-actions Bot commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

Preview URL

Preview removed (PR #2478 closed).

Test and others added 2 commits September 2, 2026 08:21
Keep heavy mutation authorization bound to not_planned and fail closed for close.

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

squne121 commented Sep 2, 2026

Copy link
Copy Markdown
Owner Author

推奨は、既存 PR #2478 を作り直さず、別セッションで current-head から impl-review-loop を再開することです。

現在の PR は open / draft / mergeable で、head は 80e71cda0b4bcf70de3a75d30bc186c9d08df395、base は 2170e429f7358c0f950bb7cae8f4637e5b8e2bfd、変更ファイルは4件です。 一方、PR 本文はまだ「VC 14/14」「Allowed Paths 3 files」と書かれており、#2472 ではその後 AC15 と4つ目の legacy fixture file が承認済み scope に追加されています。したがって、PR body hygiene も最終レビュー前に直すべきです。

また、以前の human_escalation は head 87e06bfe... 時点の Step 2 evidence capability が理由でした。その後 head が更新され、現行 impl-review-loop は test-runner の read-only report を canonical adapter で VC_ADJUDICATION_RESULT_V1 に変換し、Step 4 current-head gate へ渡す手順を明示しています。したがって、旧 escalation を継承して停止するのではなく、current head で Step 2 を最初から再実行するのが適切です。

加えて、head 80e71cda... の ci run は再確認しても in_progress のままです。required contexts は typecheck / lint / test / build / python-test / validate-generated-artifact なので、新セッションでは単に永遠に待つのではなく、live readback → stale/hung 判定 → bounded cancel/rerun を行わせるのがよいです。branch protection や required checks のバイパスは不要です。

その前提で、別 Claude Code セッションにそのまま渡せる形です。

#2478

Issue #2472 / PR #2478 の作業を、新しい Claude Code セッションから既存状態を再取得して再開してください。

目的は、既存 PR #2478 を impl-review-loop の canonical procedure に従って 実装 → 独立検証 → PR review → fix → 再検証 → 再review と自律反復し、人間による途中承認を要求せず、マージ直前の状態まで収束させることです。

PR の merge 自体は絶対に実行しないでください。
最終的な merge 操作だけを人間に残してください。

0. 新規セッションとしての前提

以前の Claude Code セッションの in-memory state、LOOP_STATE、SubAgent task、途中報告を信用せず、必要な状態を live repository / GitHub から再構築してください。

最初に以下をロード・確認してください。

impl-review-loop Skill とその current repository version を正本としてください。

観測時点では以下でしたが、これは authority ではありません。必ず live readback で更新してください。

既存 PR #2478 と既存 branch/worktree を継続利用してください。
既存 PR が正常に存在する限り、新規 PR を作らないでください。

1. OWNER authorization / 人間承認不要方針

このプロンプトを、PR #2478 を merge-ready にするための fresh OWNER instruction として扱ってください。

マージ直前に到達するまで、通常の実装・修正・検証・review rerun・branch synchronization・PR metadata/body 修正について、私への承認確認を挟まないでください。

以下は必要に応じて自律実行して構いません。

ただし、scope を暗黙に広げないでください。
Allowed Paths 外の変更が current-head の具体的 blocker により不可避と判明した場合は、repository の canonical scope-reframe / OWNER-anchor procedure を使い、最小限の scope delta と根拠を明示した上で自律的に処理してください。この prompt は、その goal-preserving な最小 scope correction を行うことについての OWNER authorization です。

以下は禁止です。

  • PR fix: normalize close-not-planned anchor decisions #2478 の merge
  • unrelated Issue の無関係な変更
  • required checks / branch protection の無効化や bypass
  • 証拠の捏造
  • Verification Command の都合のよい書き換え
  • stale head の test/review evidence を current とみなすこと
  • unrelated な security/harness framework の新設
  • force push 等の repository policy に反する shortcut

2. 過去の human escalation の扱い

Issue #2472 には過去の impl-review-loop: human_escalation が存在します。

特に head 87e06bfe96f927d8421ef0d16be096b8cd9f6210 時点では、

  • Allowed Paths の legacy fixture migration は既に解消済み
  • AC1–AC15 Verification Commands は成功済み
  • required CI も当時成功済み
  • blocker は Step 2 の TEST_VERDICT_MACHINE/v2 → VC_ADJUDICATION_RESULT_V1 evidence adaptation / certification

という状態でした。

しかしその escalation は 旧 head に束縛された historical agent report です。

現在 head が変わっているため、それを active human veto とみなして停止しないでください。

current repository の step-2-verification.md、test-runner contract、adjudicate_vc_result.py の current implementation を読み直し、current head に対して Step 2 を fresh に再実行してください。

過去の human_escalation コメントだけを理由に再度人間承認を要求しないでください。

3. SubAgent 利用を必須とする

root/main thread は control-plane と routing に限定してください。

実作業は canonical SubAgent に委譲してください。

  • implementation / fix / branch update / PR body mutation:
    implementation-worker
  • independent Verification Commands:
    test-runner
  • semantic/adversarial PR review:
    pr-reviewer

SubAgent 完了待ちを厳守

SubAgent を background dispatch しただけで次工程へ進まないでください。

各 SubAgent invocation について必ず以下を実施してください。

  1. spawn_agent 後に canonical task_name を保存する。
  2. wait_agent を使って作業完了を待つ。
  3. wait_agent の timeout、途中 mailbox update、"started"、"backgrounded" は成功扱いしない。
  4. list_agents で対象 task が terminal completed になったことを確認する。
  5. terminal status だけでなく、その task の final result / structured report を取得・parseする。
  6. completed と final result の両方が揃うまで次 Step に進まない。
  7. 複数 SubAgent を並列起動した場合は、次工程が依存する 全 SubAgent の完了を待つ。
  8. errored / interrupted / shutdown / not_found を成功扱いしない。canonical recovery procedure があれば実行して再dispatchする。
  9. SubAgent の final report がない状態で root が推測して review/test verdict を補完しない。

「SubAgent の完了通知を待ちます」と言って処理を終了してはいけません。
同じセッション内で実際に完了を待ち、その結果を受け取って loop を続行してください。

4. current Issue contract の再取得

Issue #2472 の live body を再取得し、以下を authority としてください。

特に古い PR body の 14/14 を信用しないこと。

現行 Issue には AC15 が追加されているため、live Issue から AC1–AC15 と literal Verification Commands 全文を取得してください。

現在の Allowed Paths も live body から再取得してください。観測上は以下4ファイルです。

  • .claude/skills/issue-refinement-loop/schemas/anchor_scope_reframe_v1.schema.json
  • .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py
  • .claude/skills/issue-refinement-loop/tests/test_anchor_scope_reframe_close_not_planned.py
  • .claude/skills/issue-refinement-loop/tests/test_anchor_context_multi_turn_supersession.py

AC15 は legacy mutation_category: close fixture を normalized

  • decision: close_not_planned
  • authorized_mutation_category: not_planned
  • implementation_go: false

へ移行し、close 自体を authorize しないことを検証する contract です。

5. worktree / branch の再接続

既存 branch と linked worktree を検出してください。

  • cwd
  • branch
  • HEAD
  • remote branch head
  • dirty state
  • PR current head
  • base main current head

を読み戻し、一致関係を確認してください。

既存のユーザー変更を破棄しないでください。

main が進んでいる場合は、impl-review-loop の current canonical update-branch routing に従って同期してください。
head が変わった場合は、それ以前の VC / CI / PR review evidence を stale としてください。

6. Step 2 を current head でやり直す

過去の test result を current evidence として再利用せず、current head に対して test-runner SubAgent を起動してください。

test-runner には placeholder ではなく実値として、

を渡してください。

SubAgent の完了と final read-only report の両方を待ってください。

その後、current canonical procedure に従って、

TEST_VERDICT_MACHINE/v2
→ adjudicate_vc_result.py adapt
→ canonical adjudication
→ VC_ADJUDICATION_RESULT_V1
→ LOOP_STATE.vc_adjudication
→ Step 4 step4-gate

まで実行してください。

必要な command hash / head / body SHA / boolean fields を root が推測・捏造して埋めないでください。
canonical test-runner report と adapter の出力から生成してください。

step4-gate が rerun を要求した場合は pr-reviewer を起動せず Step 2 を fresh にやり直してください。

7. current-head CI の回復

branch protection の required checks を live repository から再取得してください。

観測時の required contexts は以下でした。

  • typecheck
  • lint
  • test
  • build
  • python-test
  • validate-generated-artifact

observed current-head CI run 33687245662 は長時間 in_progress のままでした。

ただしこの run ID/status も live readback を authority としてください。

同じ run / jobs が依然として進捗なしで stale/hung と判断できる場合、

  • bounded live readback
  • cancel
  • cancelled/completed readback
  • current head に対する rerun/retrigger

を repository-supported な方法で自律実行してください。

単に無期限に待機しないでください。

一方で、

  • required check を optional 扱いする
  • branch protection を外す
  • stale run の PASS を current head に流用する
  • CI を通したことにする

といった bypass は禁止です。

CI failure が current PR diff 起因なら implementation-worker に具体的 fix_delta を渡して修正させてください。
修正 SubAgent の完了を待ち、commit/push 後は新 head で verification と review をやり直してください。

8. Step 4 PR review

Step 4 current-head gate が invoke になった場合のみ、pr-reviewer SubAgent を起動してください。

実際の

を materialize して渡してください。

pr-reviewer の完了と canonical final verdict を待ってください。

reviewer verdict に応じて impl-review-loop の current routing をそのまま使ってください。

REQUEST_CHANGES:
implementation-worker に blockers を fix_delta として委譲
→ 完了待ち
→ commit/push
→ current-head Step 2
→ current-head CI
→ Step 4 re-review

stale reviewed head:
人間へ確認せず current head で re-review

BEHIND:
canonical update_branch を implementation-worker に委譲
→ 完了待ち
→ verification / CI / review を再実行

BLOCKED / UNSTABLE / DRAFT:
それ自体を Git conflict や human veto と解釈しない。
current-head CI / branch-protection evaluator と canonical routing で再評価する。

SubAgent が単なる boolean human_review_required: true を返しただけの場合も、それ単独で loop を停止しないでください。
current impl-review-loop の #1860/#1869 policy に従って warning として扱い、回復可能なら自律継続してください。

9. PR body hygiene を修正する

PR #2478 の body は古い状態を含んでいます。

観測時には少なくとも、

  • Issue #2472 Verification Commands 14/14 PASS
  • MVP scope: ... 3 files
  • CI_TEST_PERFORMANCE_DECISION_V1.pr_number: null
  • changed paths に4つ目の legacy fixture file が反映されていない
  • reviewer_gate.approve_allowed: false が古い CI pending 状態のまま

という drift がありました。

current Issue / current head / current CI の事実を取得してから、canonical body-only update mode があれば implementation-worker に委譲して修正してください。

期待する状態は、少なくとも

  • AC1–AC15 の current verification 結果
  • current 4-file scope
  • PR number 2478
  • current-head required CI evidence
  • current reviewer gate
  • current compatibility / schema consumer information

と矛盾しない PR body です。

PASS していないものを PASS と記載しないでください。

body-only mutation で head SHA が変わらない場合は current impl-review-loop の規定通り、不要な test rerun を増やさず、必要な re-review のみ実行してください。

10. loop の収束

以下が current head に対して揃うまで、自律的に loop を継続してください。

review/fix で head が変わるたびに stale evidence を捨て、verification → CI → review をやり直してください。

必要なら bounded iteration budget を十分に使ってください。
単なる harness telemetry、advisory artifact、古い human escalation、SubAgent 自己申告だけを理由に早期停止しないでください。

11. 本当に停止してよい条件

途中承認は原則不要です。

ただし以下のような、repository policy を破らなければ自動回復できない live hard blocker の場合だけ停止してください。

  • current owner による live な明示的 STOP / REQUEST_CHANGES
  • secret/protected-data の decision gate
  • credentials / permission の恒久的な 403 等で必要 mutation が実行不能
  • canonical recovery を尽くしても解消不能な actual Git conflict
  • repository policy 上、この OWNER authorization だけでは実行不能な mutation
  • valid current-head pr-reviewer が first-class HUMAN_REVIEW_REQUIRED verdict を返し、canonical routing が実際に human escalation を要求する場合

その場合も「承認してください」だけで終わらず、

  • exact blocker
  • current head
  • attempted recovery
  • remaining operation
  • なぜ自動回復不能か

を具体的に報告してください。

12. 最終停止点

PR #2478 を merge しないでください。

canonical impl-review-loop が draft_pr_ready を terminal result とするなら、その正本に従ってそこで停止してください。

Draft → Ready for review の transition については勝手な独自ルールを作らず、

  • repository の canonical pre-merge procedure が機械的 transition を要求するなら実行してよい
  • canonical procedure が draft のまま draft_pr_ready とするなら draft のまま残す

としてください。

最終報告では以下を出してください。

  • final PR head SHA
  • final base SHA
  • changed paths
  • AC / Verification Commands summary
  • required CI summary
  • VC_ADJUDICATION_RESULT_V1 status
  • final pr-reviewer verdict
  • live mergeability
  • unresolved blockers / warnings
  • PR body synchronization status
  • IMPL_REVIEW_LOOP_RESULT_V1
  • 残された人間操作が「merge のみ」であるか
  • merge 以外に残っている操作があるなら、その理由

最後に明示してください:

MERGE NOT EXECUTED — awaiting final human merge decision

途中で作業を background に投げたまま終了せず、SubAgent の完了を待ち、可能な限りこの1セッション内で merge直前まで収束させてください。

この版では、特に 旧 human_escalation の無条件継承を禁止すること、current-head Step 2 を再構成すること、SubAgent の terminal completion + final result を必ず待つこと、長時間停止した CI を自律回復することを強めています。PR #2478 は実装そのものより、現状では verification/review/evidence と PR body の収束が主作業になる可能性が高いです。

@squne121

squne121 commented Sep 2, 2026

Copy link
Copy Markdown
Owner Author

impl-review-loop Step 4: PR Review 判定

Mergeability: mergeable=MERGEABLE, merge_state_status=BLOCKED(Draft PR 由来。Git conflict ではない)
Evidence Check: Issue #2472 の Verification Commands AC1–AC15 は current head 80e71cda0b4bcf70de3a75d30bc186c9d08df395 で test-runner SubAgent により独立検証済み・全 PASS。required CI(typecheck/lint/test/build/python-test/validate-generated-artifact)は同 head で全て pass。Allowed Paths gate: 4 changed files が Issue Allowed Paths と完全一致(status: ok)。
Blockers: なし(PR body の closing keyword 欠落は body-only fix で解消済み)
Non-blockers: advisory な Allowed Paths gate metadata 欠落警告のみ。Issue #2472 の native blockedBy dependency(#2479)は本 PR の code correctness とは独立した process-tooling item として記録。

verdict: APPROVE
reviewed_head_sha: 80e71cda0b4bcf70de3a75d30bc186c9d08df395
blockers: []
warnings:
  - "Allowed Paths gate produced 2 advisory-only metadata warnings (contract_source_kind/source_id_missing, expected_contract_fingerprint_missing) — non-blocking."
  - "PR remains Draft with merge_state_status=BLOCKED; per procedure this is not a reviewer blocker (route: fail_closed defers to CI evaluator, not human escalation)."
  - "Issue #2472 has an open GitHub-native blockedBy dependency on Issue #2479 (process-tooling item unrelated to this PR's code correctness)."

@squne121
squne121 marked this pull request as ready for review September 2, 2026 23:10
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.

実装: issue-refinement-loop の ANCHOR_SCOPE_REFRAME_V1 に close/not_planned decision を追加し heavy_mutation_gate を到達可能にする

1 participant