Skip to content

fix: Step 2 canary が広域 pytest collection を exit 77 で中断しないようにする - #2909

Merged
squne121 merged 3 commits into
mainfrom
worktree-issue-2903-step2-canary-collection
Oct 4, 2026
Merged

squne121 merged 3 commits into
mainfrom
worktree-issue-2903-step2-canary-collection

Conversation

@squne121

@squne121 squne121 commented Oct 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • 非 opt-in の serial な広域 pytest collection で opt-in Step 2 canary が pytest.exit(returncode=77) を呼び、他の test nodes ごと session を終了していた問題を修正しました。
  • canary の実行形態を pytest が解決済みの target 引数(config.args)から判定します。serial かつ解決済み target が canary ファイル 1 つ、またはその exact node-id だけの「明示単独 runtime」で unavailable のときだけ、capsys.disabled() 内で行頭 SKIP: を stdout に出して exit 77 にします。
  • directory 指定・他 file との混在・directory + -k で結果的に 1 件になった実行・target 引数なし・xdist worker では、canary item だけを pytest.skip() にし、session は継続して独立した failure を隠しません。item skip の経路は追加の stdout を出しません。
  • gh auth status の OSError / subprocess.TimeoutExpired だけを producer 起動前の unavailable として扱います(明示的な型のみで、広い except Exception は使いません)。producer 起動後の失敗は従来どおり FAIL です。
  • 新規 test_step2_canary_collection_contract.py で、実際の canary module を対象に hermetic な子 pytest を sys.executable -m pytest で起動し、exit code・stdout の行頭 SKIP:・node 単位の outcome(junit xml)・実 -n 2 の xdist を検証します。
  • 本 PR の対象外: canary live path の PIPE → wait(timeout) → communicate() の順序(別 Issue 実装: opt-in Step 2 canary live path の pipe 待機順序による潜在 deadlock を解消する #2907 の責務のため変更していません)、baseline_vc_preflight.py / conftest / pytest 設定、実装: Auto mode の固定 /tmp scratch 上書き false-deny を run-scoped temporary workspace で解消する #2860 の uv fixture 起因の failures。

受け入れ条件の達成状況

  • AC1: directory 指定・他 file との混在・directory + -k で 1 件だけ残った実行・target 引数なしで、canary item のみ skip し session は exit 77 にならず、無関係な failing node は FAIL のまま exit 1、独立 failure が無ければ exit 0 になることを子 pytest で確認しました。
  • AC2: 明示単独(file のみ、-k / -m 付き、exact node-id、相対 path と symlink 経由)の unavailable で child.returncode == 77 かつ child.stdout の行頭に SKIP: が出ることを、stdout の行単位で assert しています。gh auth status の timeout / OSError も同じ結果で、producer 起動後の RuntimeError / TimeoutExpired は SKIP に変換されず FAIL(exit 1)です。親 regression は子が SKIP を正しく表現したことを検証して PASS しますが、live producer の PASS ではありません。
  • AC3: LOOP_CANARY_STEP2_LIVE_ENABLE が未設定・0・空・不正値では producer 起動境界(subprocess.Popen)にも gh auth status にも到達せず、1 のときだけ認証確認の後に run_root_review_pipeline.py produce を含む argv で起動境界へ進むことを、子 process 内の test-double で観測しました(実 network なし)。--collect-only は opt-in 1 でも body を実行しません。
  • AC4: 実際の -n 2 の xdist で、canary は item skip、独立 failure は可視、後続 node は実行され、INTERNALERROR / crash がないことを junit xml と -rA で確認しました。
  • AC5: broad VC は exit 77 による中断も worker crash もなく最後まで完走しました。結果は下記の検証コマンド結果を参照してください(3 failed は既存・無関係な failure です)。

検証コマンド結果

$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_step2_canary_collection_contract.py -q
43 passed in 12.0s   (AC1〜AC4 の VC。fix_delta 後。旧 canary に差し戻すと追加した verbosity 別の行頭 SKIP 回帰と testpaths 回帰の 6 件が failed になることを確認済み)

$ uv run --locked pytest .claude/skills/create-issue/tests/ .claude/skills/issue-refinement-loop/tests/ -q   (AC5)
3 failed, 2711 passed, 1 skipped, 3 deselected in 383s   -> exit 1(exit 77 ではない)
failed node-id(すべて既存・無関係。本変更の前の main でも同じ 3 件が uv_version_mismatch で fail することを確認済み):
  test_command_registry.py::TestAuthorityTransportPrivilegedExecutorRealSubprocessDispatch::test_decide_run_dispatches_to_real_subprocess
  test_command_registry.py::TestAuthorityTransportPrivilegedExecutorRealSubprocessDispatch::test_authority_transport_produce_dispatches_to_real_subprocess
  test_command_registry.py::TestAuthorityTransportPrivilegedExecutorRealSubprocessDispatch::test_authority_transport_consume_dispatches_to_real_subprocess
skipped 1 件は canary の item skip です。

$ uv run --locked ruff check .claude/skills .claude/scripts scripts schemas   -> All checks passed

fix_delta(OWNER レビュー対応)の検証結果: 単独 runtime の SKIP: 行は -q 有無・通常・-v・-vv のすべてで stdout の行頭に出て exit 77 を維持します(canary 単体の直接実行でも 4 通りとも exit 77・行頭 SKIP: 1 行を確認)。config.args_source が ArgsSource.ARGS 以外(testpaths / invocation dir)の場合は単独 runtime と見なさず item skip になります。gh auth status の想定外例外(RuntimeError)は SKIP/77 に変換されず exit 1 のまま、producer 起動境界にも到達しないことを 1 case で固定しました。

本 PR は #2860 の PASS を主張しません。上記 3 failed は #2860 側の uv fixture 起因の独立した failure です。

Allowed Paths 遵守

  • 変更ファイル:
    • .claude/skills/issue-refinement-loop/tests/test_step2_execution_surface_canary.py
    • .claude/skills/issue-refinement-loop/tests/test_step2_canary_collection_contract.py(新規)
  • Allowed Paths 逸脱: なし(conftest / baseline_vc_preflight.py / pytest 設定 / python-test-plan.json は変更していません。新規 file は既存の登録済み directory 配下です)

Checks

  • uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_step2_canary_collection_contract.py -q(35 passed)
  • uv run --locked pytest .claude/skills/create-issue/tests/ .claude/skills/issue-refinement-loop/tests/ -q(上記のとおり、既存の 3 failed を除いて PASS)
  • uv run --locked ruff check .claude/skills .claude/scripts scripts schemas
  • 本 PR は test file のみの変更で、TypeScript / build には影響しません(pnpm の 4 コマンドは対象外です)

Schema Change Applicability

  • decision: not_schema_change
  • reason: test file の判定ロジックと regression の追加のみで、既存 schema・wire・fixed contract は変更しません。

Schema Consumer Inventory

N/A
reason: schema_change ではなく、既存 consumer の before/after 差分も発生しません。

Safety Claim Matrix

Claim Implemented? Not controlled Evidence Follow-up
opt-in 以外で live producer を起動しない(read-only の範囲を維持) yes none 子 process 内 test-double で Popen / gh auth 未到達を確認(unset / 0 / 空 / 不正値) N/A
gh auth status の OSError / TimeoutExpired 以外を SKIP に変換しない yes none producer 起動後の RuntimeError / TimeoutExpired が FAIL(exit 1)になる子 pytest N/A
広域 collection で他 test の failure を隠さない yes none directory / 混在 / -k / 引数なし / 実 -n 2 で独立 failure が FAIL のまま残る N/A

Notes

IMPLEMENTATION_SCOPE_COVERAGE_V1:
  schema_version: "IMPLEMENTATION_SCOPE_COVERAGE_V1"
  issue_number: 2903
  issue_body_sha256: "sha256:7d49fcfd67cbe559ad70e6efe93d6a977ad47b4a117fea5aae77fbba6e25df3c"
  normalized_scope_manifest_sha256: "sha256:efb2c98df9228220840a11656ff44680af2e28cf2861c93e2dd79b419be29333"
  pr_head_sha: "aeac8c8c87812d6c91ae6001bff87399e872e5c0"
  scope_manifest: {"acceptance_criteria": ["#2860 の fresh broad VC(create-issue/tests/ と issue-refinement-loop/tests/ を対象とする下記 VC)は canary による exit 77 中断も worker crash もなく最後まで走り終わり、最終結果(passed / failed / skipped 件数と failed node-id)が報告される。残る failure は node-id と原因を記録し、既存・無関係な failure と本変更が導入した regression を区別して報告する。既存 failure を抑制せず、#2860 の PASS を主張しない。「exit 77 が消えた」だけでは success としない。", "実際の pytest -n 2 を用いた isolated fixture で、xdist worker 上の canary は item skip になり、worker / controller を crash させず(INTERNALERROR なし)、独立 failure は可視のまま、後続 node が実行される。既存の canary の fail-closed route と read-only 範囲を維持する。", "明示 opt-in(LOOP_CANARY_STEP2_LIVE_ENABLE=1)以外は read-only live producer の起動境界に進まず、opt-in 有効時に限り従来の live path(認証確認 → producer 起動)に進む。この観測は子 process 内の test-double で行い実 network を使わない。canary 単独の collection skip / 広域 pytest の exit 0 / --collect-only の exit 0 は live producer PASS の証拠にならない。", "明示的な単独 canary runtime invocation(canary ファイルのみ、または canary の exact node-id のみの serial 実行)が unavailable(上記定義。gh auth status の timeout を含む)なら、child の stdout に行頭 SKIP: が出て exit code は 77 になる。自動検証は親 regression が isolated child pytest を起動して child.returncode == 77 かつ child.stdout に行頭 SKIP: の行があること(stdout + stderr の部分文字列一致は不可)を assert する。親 regression は PASS できるが、child の意味は SKIP であり live producer PASS とは読み替えない。gh auth status timeout 以外の例外(producer 起動後の失敗など)は SKIP に変換されない。", "非 opt-in の通常 serial pytest collection(canary を directory 指定または他 file と混在させた実行)で canary node に到達しても session が exit 77 で終了せず、canary item のみ skip して後続 node まで実行し、node 単位の結果を報告する。実在の無関係な failing node は FAIL のまま残り exit 1 になる。独立 failure が無ければ exit 0 になる。directory 指定から -k で canary 1 件だけ残った実行も単独 runtime と誤分類せず item skip になる。"], "allowed_paths": [".claude/skills/issue-refinement-loop/tests/test_step2_canary_collection_contract.py(新規)", ".claude/skills/issue-refinement-loop/tests/test_step2_execution_surface_canary.py"], "change_kind": "code", "goal_ref": "通常 pytest collection が opt-in Step 2 canary に中断されず独立の失敗を報告できる", "in_scope": ["canary の実行形態を、pytest が解析した target(config.args)から判定する。判定に他 test の failure 数・実行順・collected 件数(testscollected 等)・raw command 文字列の部分一致・config.invocation_params.args を使わない。unavailable 時の挙動は下表で固定する(unavailable = 下記「unavailable の定義」)。", "focused hermetic tests(test_step2_canary_collection_contract.py)は、子 pytest を sys.executable -m pytest の subprocess(既存様式)で起動し、**実際の canary module** を対象にする(判定ロジックをテスト側へコピーしてそのコピーだけを試験しない)。新しい generic runner / harness / registry / evidence schema は作らない。", "opt-in case は実 network / 実 producer を呼ばない。子 process 内の test-double(shutil.which / subprocess.run / subprocess.Popen の差し替え)で、(i) opt-in 値が未設定・0・空・不正値では producer 起動境界(Popen)に到達しないこと、(ii) 1 のときだけ実 canary コードが認証確認の後に producer 起動境界へ進み、渡された argv が run_root_review_pipeline.py produce を含むことを観測する。", "unavailable の定義: (a) LOOP_CANARY_STEP2_LIVE_ENABLE が未設定または 1 以外、(b) gh が PATH にない、(c) gh auth status が非ゼロ終了、(d) gh auth status 自体の実行失敗(OSError)または subprocess.TimeoutExpired。(d) の timeout は **producer 起動前の認証可否確認**に限り unavailable に含める。捕捉は (OSError, subprocess.TimeoutExpired) のような明示的な型に限定し、except Exception 等の広い変換で producer 本体の欠陥・timeout・failure を SKIP 化しない(producer 実行後の失敗は従来どおり FAIL)。", "「明示的な単独 runtime invocation」= 解決済み target が canary ファイル 1 つ(またはその exact node-id)だけの serial 実行。同一性は resolve 済み path で比較する。xdist worker は常に非単独として扱う。", "単独 runtime の SKIP: は child の **stdout** に行頭 SKIP: で出す。既存の -q 呼び出しを維持し、SKIP 通知の print だけを公開 fixture の capsys.disabled()(capture 外)に出す方式を採用する(-s を単独 runtime コマンドの必須条件にする案より現行コードの変更が小さく、既存 -q 呼び出しとの互換性を保つ)。item skip の経路では capture 外 stdout を出さない(広域 run の出力を汚さない)。", "子 pytest の環境は各 case が自分で構成する。親 process の LOOP_CANARY_STEP2_LIVE_ENABLE / PYTEST_XDIST_WORKER(および PYTEST_XDIST_*)/ PYTEST_ADDOPTS / PYTEST_PLUGINS / PYTEST_CURRENT_TEST を継承させず、case ごとに明示した値だけを渡す。追加 plugin はテストが意図して -p で渡すもの以外を許さない。親側に opt-in や worker 変数が残っていても子の挙動が変わらないことを 1 case で検証する。", "実 xdist: 既存 dev dependency の pytest-xdist で小さい isolated fixture を実際に -n 2 で走らせ、canary item が skip、独立 failure が可視、後続 / 無関係 node が実行され、INTERNALERROR / worker crash / controller crash がないことを node 単位の outcome(-rA または junit xml)で確認する。PYTEST_XDIST_WORKER=gw0 を置くだけの単体模擬は AC4 の唯一の証拠にしない。"], "schema_version": "IMPLEMENTATION_SCOPE_MANIFEST_V1"}

非 opt-in の serial 広域 collection で canary が pytest.exit(77) し、他の test nodes ごと
session を終了していた。pytest 解決済み target (config.args) から「明示単独 runtime」を判定し、
単独時のみ capsys.disabled() 内の行頭 SKIP: stdout と exit 77、それ以外は item skip にする。
gh auth status の OSError / TimeoutExpired だけを producer 起動前の unavailable として扱う。
hermetic な子 pytest(実 canary module、test-double、実 -n 2 xdist)の focused regression を追加。

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

Preview removed (PR #2909 closed).

@squne121

squne121 commented Oct 4, 2026

Copy link
Copy Markdown
Owner Author

pr-reviewer 判定: APPROVE(iteration 0)

  • reviewed_head_sha: aeac8c8(投稿前の PR head と一致)
  • Allowed Paths gate: ok(変更は canary test と新規 contract test の 2 ファイルのみ)
  • required CI(head 束縛): lint / build / typecheck / test / validate-generated-artifact がすべて pass
  • AC1〜AC4: test-runner の独立実行で 35 passed。AC5(pr_review_only)は CI 証跡で reviewer が判定し、全 Python suite で 0 failure、exit 77 や INTERNALERROR なし。ローカルの broad run で出た 3 件(test_command_registry.py の RealSubprocessDispatch、uv_version_mismatch)は stash 後も再現する既存・無関係の失敗で、CI では通過している
  • mutation 検証: 旧 canary に戻すと 21 件が fail。broad except Exception の mutation は生き残るため、follow-up 候補のテストギャップとして記録
  • 実装: opt-in Step 2 canary live path の pipe 待機順序による潜在 deadlock を解消する #2907(PIPE/wait/communicate)の順序は未変更
verdict: APPROVE
reviewed_head_sha: "aeac8c8c87812d6c91ae6001bff87399e872e5c0"
blockers: []
warnings:
  - "mutation gap: gh auth status 境界の broad except Exception をテストが検出できない(実装自体は正しい)"
  - "env 漏れ検証の control 側 assertion が弱い(isolation 側の assertion は有効)"
  - "ローカル AC5 の 3 件は uv_version_mismatch 由来の既存失敗。CI では 0 failure"

@squne121

squne121 commented Oct 4, 2026

Copy link
Copy Markdown
Owner Author

判定:REQUEST_CHANGES — 修正方針は妥当ですが、小さな契約違反が2点残っています

広域 pytest を止めないという主目的には、適切な方向の修正です。ただし、単独実行の判定と SKIP: の出力に、それぞれ再現可能な抜けがあります。 修正は canary 内の数行と既存回帰テストへのケース追加で済む見込みです。汎用ハーネスや承認ゲートを増やす必要はありません。

レビュー対象は head aeac8c8c87812d6c91ae6001bff87399e872e5c0、base fc34b8d6be5f6f110aaa7552bd2127fb590054dc です。この head の CI ワークフローは成功しており、既存レビューも APPROVE ですが、以下の2ケースは追加テストの対象から漏れています。

検証範囲について先に明記します。こちらでは PR の判定・出力 helper の処理を変更せず抜き出した隔離再現を Python 3.13.5 / pytest 9.0.2 で実行しました。リポジトリ全体の locked テスト、実 xdist、live producer は実行していません。一方、リポジトリが使用する pytest 9.0.3 の公式実装も取得し、今回の論点に関係する引数解決と出力処理を照合しています。


1. P2 — capsys.disabled() だけでは、SKIP: が行頭に出ることを保証できない

対象:
.claude/skills/issue-refinement-loop/tests/test_step2_execution_surface_canary.py:176–179

現在は次の処理です。

with capsys.disabled():    print(stdout_line, flush=True)pytest.exit(message, returncode=77)

capture の外へ出す方針は正しいです。しかし、「出力が capture に消されない」ことと、「新しい行の先頭に出る」ことは別です。

pytest の通常表示では、テスト開始前にファイル名が、verbose 表示では node-id が出力されます。pytest 9.0.3 の pytest_runtest_logstart() でも、この先行出力を確認できます。capsys.disabled() は capture を一時解除する API であり、先行出力との間に改行を入れる API ではありません。 pytest ドキュメント

再現結果

隔離再現で単独ファイルを -q なしで実行すると、stdout は次の形になりました。

test_step2_execution_surface_canary.py SKIP: canary not enabled

-v では次の形になります。

test_step2_execution_surface_canary.py::test_ac9_producer_smoke_canary_against_issue_2584 SKIP: canary not enabled

どちらも exit code は 77 ですが、

any(line.startswith("SKIP:") for line in child.stdout.splitlines())

は False です。-q -v の組み合わせでも同じ問題を確認しました。

したがって、単独 runtime の unavailable を「stdout 行頭 SKIP: + exit 77」で観測する契約を満たしません。これは単なる見栄えではなく、厳密に ^SKIP: を検出する側からは宣言を見失う問題です。Issue #2903 はこの行頭契約を明示しています。

なぜ既存テストが通るか

新規テストの _run_child() が、子 pytest のコマンドに 常に -q を追加しています。単独ファイルのパラメータも、選択オプションの -k / -m は試しますが、verbosity の変化は試していません。

推奨修正

単独 runtime 分岐だけで、メッセージの前に改行を出せば十分です。

with capsys.disabled():    print(f"\n{stdout_line}", flush=True)

広域 collection の item-skip 分岐は変更しません。これなら余分な出力が広域テストに混ざりません。

回帰テストは、既存 _run_child() に渡す追加引数を []、["-v"]、["-vv"] として、すべてで 77 と行頭 SKIP: を両方確認すれば足ります。テスト helper に新しい出力制御機構を作る必要はありません。


2. P2 — testpaths 由来の「引数なし実行」を、明示単独 runtime と誤判定する

対象:
.claude/skills/issue-refinement-loop/tests/test_step2_execution_surface_canary.py:150–159

現在の判定は、worker でないことを確認した後、config.args が1件で canary の実パスと一致すれば単独 runtime とします。その target がどこから来たかは確認していません。

しかし pytest は、CLI に target がなくても、testpaths の設定から config.args を構成します。pytest 9.0.3 の _decide_args() は、この場合に ArgsSource.TESTPATHS を返します。つまり、明示指定と既定選択で config.args の内容が同じになることがあります。

再現条件

一時的な pytest.ini を次のようにします。

[pytest]
testpaths = test_step2_execution_surface_canary.py

その設定の root から、target を指定せず実行します。

python -m pytest -q

隔離再現で観測した pytest の設定は次のとおりでした。

config.args        = ["test_step2_execution_surface_canary.py"]
config.args_source = TESTPATHS

期待値は canary の item skip と exit 0 ですが、現実装は単独 runtime と判断し、exit 77 になりました。

Issue #2903 は「target 引数なし(rootdir / testpaths 解決)」を item skip とする契約なので、これはその取りこぼしです。ただし、現在のリポジトリの pyproject.toml には testpaths の指定がないため、現行の通常コマンドがすべて壊れるという指摘ではありません。設定によって発火する境界ケースです。

なぜ既存テストが通るか

test_no_target_arguments_item_skip() は、空の設定を用い、cwd=layout.suite で実行しています。これは invocation directory からの探索を確認しますが、root から testpaths を解決するケースを確認していません。

推奨修正

既存の path 判定の前に、pytest 自身が提供する引数の由来を確認します。

if os.environ.get("PYTEST_XDIST_WORKER"):    return Falseif config.args_source is not pytest.Config.ArgsSource.ARGS:    return Falsetargets = list(config.args)

ArgsSource は公式 API に記載されており、ARGS、INVOCATION_DIR、TESTPATHS を区別できます。raw command の解析や config.invocation_params.args への逆戻りは不要です。pytest ドキュメント

追加テストは、既存 layout の ini に canary の symlink を testpaths として設定し、layout.root から target なしで _run_child() を呼ぶ1ケースで十分です。期待値は exit 0、canary の outcome が skipped、capture 外の SKIP: 行なしです。


隔離再現のまとめ

以下は、今回こちらで実行した結果です。「修正後」は上記の 引数由来チェックと改行追加だけを入れたものです。

呼び出し | 現実装の結果 | 小修正後 -- | -- | -- 明示ファイル+-q | 77、行頭 SKIP: あり | 同じ 明示ファイル、通常表示 | 77、行頭 SKIP: なし | 77、行頭あり 明示ファイル+-v | 77、行頭 SKIP: なし | 77、行頭あり 明示ファイル+-q -v | 77、行頭 SKIP: なし | 77、行頭あり target なし、testpaths が canary 1件 | 77 | 0、item skip directory+-k ac9 -q | 0、item skip | 同じ

reproduce_boundaries.pyとreproduction-results.jsonを添付します。これらは不具合の切り分け用であり、リポジトリに追加する正式な回帰テストは、現 PR と同様に実際の canary module を対象にしてください。

非ブロッカー:認証境界の mutation gap は、1ケースで補強できる

既存レビューが挙げている **「except Exception に広げる mutation が生き残る」**点は、そのとおりです。test-double の認証確認側には timeout、OSError、非ゼロ終了がありますが、それ以外の例外を投げるモードがありません。一方、現在の canary 実装自体は (OSError, subprocess.TimeoutExpired) に限定しているため、現時点の実装不具合として格上げする必要はありません。

補強するなら、認証確認の test-double で RuntimeError を投げる1ケースを追加し、exit 1、canary が failed、行頭 SKIP: なし、producer 未起動を確認するだけで十分です。大きな mutation framework や例外型の総当たりは勧めません。

環境分離テストの control 側も returncode != 77 だけなので、意図した plugin import failure などまで確認すると説明力が上がります。ただし、これも今回の2件と違い、現在の実装が壊れているという指摘ではありません。

関連 Issue・PR を踏まえ、今回広げない方がよい範囲

#2860 の独立した失敗は、今回の修正と切り離すべきです。 発見元のコメントは、canary による session 中断と、先行する3件の uv_version_mismatch を別問題として記録しています。今回の実装報告でも broad run は最後まで走り、3件の既存 failure を隠さず報告しています。この扱いは維持してよいです。

PIPE → wait() → communicate() の問題を、この PR の必須修正に混ぜる必要もありません。 Python 公式文書が警告する待機パターンですが、既に #2907 が専有し、#2903 のマージ後に同ファイルを修正する依存関係まで定義されています。重複起票や並行修正は、むしろ作業を増やします。Python documentation

live producer や Claude Code の background+join の再実地検証も、今回の完了条件へ追加しない方がよいです。 導入 PR #2622 は、pytest 内の producer smoke と実際の Claude Code 実行境界を明確に分離しています。今回扱う collection・exit code・stdout は、外部サービス不要の子 pytest で検証するのが適切です。


推奨する着地点は、2ファイルのスコープを維持したまま、args_source の確認と改行を追加し、その境界ケースを既存 contract test へ載せることです。 そのうえで locked 環境の focused regression と既存 CI を再実行すればよく、全 pytest の exit 77 を成功扱いする変更、canary の一律除外、新たな承認・証跡ハーネスは不要です。

## 判定:REQUEST_CHANGES — 修正方針は妥当ですが、小さな契約違反が2点残っています

広域 pytest を止めないという主目的には、適切な方向の修正です。ただし、単独実行の判定と SKIP: の出力に、それぞれ再現可能な抜けがあります。 修正は canary 内の数行と既存回帰テストへのケース追加で済む見込みです。汎用ハーネスや承認ゲートを増やす必要はありません。

レビュー対象は head aeac8c8c87812d6c91ae6001bff87399e872e5c0、base fc34b8d6be5f6f110aaa7552bd2127fb590054dc です。この head の CI ワークフローは成功しており、既存レビューも APPROVE ですが、以下の2ケースは追加テストの対象から漏れています。

検証範囲について先に明記します。こちらでは PR の判定・出力 helper の処理を変更せず抜き出した隔離再現を Python 3.13.5 / pytest 9.0.2 で実行しました。リポジトリ全体の locked テスト、実 xdist、live producer は実行していません。一方、リポジトリが使用する pytest 9.0.3 の公式実装も取得し、今回の論点に関係する引数解決と出力処理を照合しています。


1. P2 — capsys.disabled() だけでは、SKIP: が行頭に出ることを保証できない

対象:
.claude/skills/issue-refinement-loop/tests/test_step2_execution_surface_canary.py:176–179

現在は次の処理です。

with capsys.disabled():
    print(stdout_line, flush=True)
pytest.exit(message, returncode=77)

capture の外へ出す方針は正しいです。しかし、「出力が capture に消されない」ことと、「新しい行の先頭に出る」ことは別です。

pytest の通常表示では、テスト開始前にファイル名が、verbose 表示では node-id が出力されます。pytest 9.0.3 の pytest_runtest_logstart() でも、この先行出力を確認できます。capsys.disabled() は capture を一時解除する API であり、先行出力との間に改行を入れる API ではありません。 [pytest ドキュメント](https://docs.pytest.org/en/9.0.x/how-to/capture-stdout-stderr.html)

再現結果

隔離再現で単独ファイルを -q なしで実行すると、stdout は次の形になりました。

test_step2_execution_surface_canary.py SKIP: canary not enabled

-v では次の形になります。

test_step2_execution_surface_canary.py::test_ac9_producer_smoke_canary_against_issue_2584 SKIP: canary not enabled

どちらも exit code は 77 ですが、

any(line.startswith("SKIP:") for line in child.stdout.splitlines())

は False です。-q -v の組み合わせでも同じ問題を確認しました。

したがって、単独 runtime の unavailable を「stdout 行頭 SKIP: + exit 77」で観測する契約を満たしません。これは単なる見栄えではなく、厳密に ^SKIP: を検出する側からは宣言を見失う問題です。Issue #2903 はこの行頭契約を明示しています。

なぜ既存テストが通るか

新規テストの _run_child() が、子 pytest のコマンドに 常に -q を追加しています。単独ファイルのパラメータも、選択オプションの -k / -m は試しますが、verbosity の変化は試していません。

推奨修正

単独 runtime 分岐だけで、メッセージの前に改行を出せば十分です。

with capsys.disabled():
    print(f"\n{stdout_line}", flush=True)

広域 collection の item-skip 分岐は変更しません。これなら余分な出力が広域テストに混ざりません。

回帰テストは、既存 _run_child() に渡す追加引数を []、["-v"]、["-vv"] として、すべてで 77 と行頭 SKIP: を両方確認すれば足ります。テスト helper に新しい出力制御機構を作る必要はありません。


2. P2 — testpaths 由来の「引数なし実行」を、明示単独 runtime と誤判定する

対象:
.claude/skills/issue-refinement-loop/tests/test_step2_execution_surface_canary.py:150–159

現在の判定は、worker でないことを確認した後、config.args が1件で canary の実パスと一致すれば単独 runtime とします。その target がどこから来たかは確認していません。

しかし pytest は、CLI に target がなくても、testpaths の設定から config.args を構成します。pytest 9.0.3 の _decide_args() は、この場合に ArgsSource.TESTPATHS を返します。つまり、明示指定と既定選択で config.args の内容が同じになることがあります。

再現条件

一時的な pytest.ini を次のようにします。

[pytest]
testpaths = test_step2_execution_surface_canary.py

その設定の root から、target を指定せず実行します。

python -m pytest -q

隔離再現で観測した pytest の設定は次のとおりでした。

config.args        = ["test_step2_execution_surface_canary.py"]
config.args_source = TESTPATHS

期待値は canary の item skip と exit 0 ですが、現実装は単独 runtime と判断し、exit 77 になりました。

Issue #2903 は「target 引数なし(rootdir / testpaths 解決)」を item skip とする契約なので、これはその取りこぼしです。ただし、現在のリポジトリの pyproject.toml には testpaths の指定がないため、現行の通常コマンドがすべて壊れるという指摘ではありません。設定によって発火する境界ケースです。

なぜ既存テストが通るか

test_no_target_arguments_item_skip() は、空の設定を用い、cwd=layout.suite で実行しています。これは invocation directory からの探索を確認しますが、root から testpaths を解決するケースを確認していません。

推奨修正

既存の path 判定の前に、pytest 自身が提供する引数の由来を確認します。

if os.environ.get("PYTEST_XDIST_WORKER"):
    return False

if config.args_source is not pytest.Config.ArgsSource.ARGS:
    return False

targets = list(config.args)

ArgsSource は公式 API に記載されており、ARGS、INVOCATION_DIR、TESTPATHS を区別できます。raw command の解析や config.invocation_params.args への逆戻りは不要です。[pytest ドキュメント](https://docs.pytest.org/en/stable/reference/reference.html)

追加テストは、既存 layout の ini に canary の symlink を testpaths として設定し、layout.root から target なしで _run_child() を呼ぶ1ケースで十分です。期待値は exit 0、canary の outcome が skipped、capture 外の SKIP: 行なしです。


隔離再現のまとめ

以下は、今回こちらで実行した結果です。「修正後」は上記の 引数由来チェックと改行追加だけを入れたものです。

呼び出し 現実装の結果 小修正後
明示ファイル+-q 77、行頭 SKIP: あり 同じ
明示ファイル、通常表示 77、行頭 SKIP: なし 77、行頭あり
明示ファイル+-v 77、行頭 SKIP: なし 77、行頭あり
明示ファイル+-q -v 77、行頭 SKIP: なし 77、行頭あり
target なし、testpaths が canary 1件 77 0、item skip
directory+-k ac9 -q 0、item skip 同じ

reproduce_boundaries.py隔離再現スクリプトとreproduction-results.json実行結果の JSONを添付します。これらは不具合の切り分け用であり、リポジトリに追加する正式な回帰テストは、現 PR と同様に実際の canary module を対象にしてください。

非ブロッカー:認証境界の mutation gap は、1ケースで補強できる

既存レビューが挙げている **「except Exception に広げる mutation が生き残る」**点は、そのとおりです。test-double の認証確認側には timeout、OSError、非ゼロ終了がありますが、それ以外の例外を投げるモードがありません。一方、現在の canary 実装自体は (OSError, subprocess.TimeoutExpired) に限定しているため、現時点の実装不具合として格上げする必要はありません。

補強するなら、認証確認の test-double で RuntimeError を投げる1ケースを追加し、exit 1、canary が failed、行頭 SKIP: なし、producer 未起動を確認するだけで十分です。大きな mutation framework や例外型の総当たりは勧めません。

環境分離テストの control 側も returncode != 77 だけなので、意図した plugin import failure などまで確認すると説明力が上がります。ただし、これも今回の2件と違い、現在の実装が壊れているという指摘ではありません。

関連 Issue・PR を踏まえ、今回広げない方がよい範囲

#2860 の独立した失敗は、今回の修正と切り離すべきです。 発見元のコメントは、canary による session 中断と、先行する3件の uv_version_mismatch を別問題として記録しています。今回の実装報告でも broad run は最後まで走り、3件の既存 failure を隠さず報告しています。この扱いは維持してよいです。

PIPE → wait() → communicate() の問題を、この PR の必須修正に混ぜる必要もありません。 Python 公式文書が警告する待機パターンですが、既に #2907 が専有し、#2903 のマージ後に同ファイルを修正する依存関係まで定義されています。重複起票や並行修正は、むしろ作業を増やします。[Python documentation](https://docs.python.org/3/library/subprocess.html)

live producer や Claude Code の background+join の再実地検証も、今回の完了条件へ追加しない方がよいです。 導入 PR #2622 は、pytest 内の producer smoke と実際の Claude Code 実行境界を明確に分離しています。今回扱う collection・exit code・stdout は、外部サービス不要の子 pytest で検証するのが適切です。


推奨する着地点は、2ファイルのスコープを維持したまま、args_source の確認と改行を追加し、その境界ケースを既存 contract test へ載せることです。 そのうえで locked 環境の focused regression と既存 CI を再実行すればよく、全 pytest の exit 77 を成功扱いする変更、canary の一律除外、新たな承認・証跡ハーネスは不要です。

@squne121

squne121 commented Oct 4, 2026

Copy link
Copy Markdown
Owner Author

live state と current impl-review-loop を確認しました。PR #2909 は現在も Draft/Open、対象 OWNER コメント 5975502310 が最新の top-level コメントで、2 件の具体的 REQUEST_CHANGES を要求しています。pytest 9.0 系でも Config.ArgsSource は ARGS / INVOCATION_DIR / TESTPATHS を区別し、capsys.disabled() は capture を一時停止する API であって行頭改行を保証するものではないため、指摘の技術的前提も妥当です。[pytest ドキュメント](https://docs.pytest.org/en/9.0.x/_modules/_pytest/config.html?utm_source=chatgpt.com)

また前回は step4-adjudicate が AC5 の pr_review_only_current_authorization_mismatch で blocking のまま、canonical step5-terminal-gate を通さずに終了していました。今回はその迂回を繰り返さず、正規 terminal gate まで通すことを成功条件にするのが重要です。貼り付けたテキスト(1)

そのまま対話的 Claude Code に貼れる prompt です。

repo は squne121/loop-protocol。

対象は PR #2909、特に OWNER の top-level PR conversation comment ID 5975502310 です。source Issue は #2903 です。

あなたは既に auto mode で起動済みの対話的 Claude Code session です。現在の session を継続してください。ただし、過去 session の state、保存済み artifact、過去の APPROVE、過去に観測した SHA、CI 結果を current authority として再利用せず、最初に live repository / GitHub state を fresh に取得してください。

目的は current repository の .claude/skills/impl-review-loop を正規手順どおり使い、OWNER comment 5975502310 の REQUEST_CHANGES を実装し、実装 → 独立検証 → current-head CI → fresh PR review → 必要な fix loop → canonical terminal gate まで進め、最終的に current Skill が正当に

IMPL_REVIEW_LOOP_RESULT_V1.status: draft_pr_ready

相当を出せる、人間が merge 判断できる直前まで完遂することです。

merge / auto-merge / Issue close / post-merge cleanup は行わないでください。

この invocation における人間判断

comment 5975502310 自体は OWNER の REQUEST_CHANGES ですが、この prompt はその REQUEST_CHANGES に対応して作業を再開し、指摘を修正するための新しい明示的人間判断です。

したがって、この invocation では comment 5975502310 が REQUEST_CHANGES を含むこと自体を「未解消 human veto なので何もせず停止する」理由にしないでください。

comment 5975502310 を 今回処理すべき trusted human review / fix_delta の authority として読み、そこに書かれた具体的 defect を修正してください。

ただし、作業開始後に より新しい OWNER コメントで明示的に「停止」「変更しないでください」等が投稿されている場合は、その fresh comment を current human veto として扱ってください。

明示的な承認

この invocation について、repository-native workflow が必要とする通常の非破壊作業を明示的に承認します。iteration ごとの追加承認は不要です。

承認対象:

を承認します。

これは Claude Code permission bypass の承認ではありません。現在の auto mode を維持してください。

以下は禁止します。

  • bypassPermissions
  • --dangerously-skip-permissions
  • permission / hook / security boundary の緩和
  • secret / credential の取得・変更・公開
  • force push
  • default branch への直接 push
  • merge / auto-merge
  • foreign worktree / branch の変更・削除
  • evidence / CI identifier / workflow artifact identifier の捏造

0. 最初に live state と current repository contract を読む

最初に fresh に最低限以下を確認してください。

GitHub

current HEAD の repository contract

最低限:

  • .claude/skills/impl-review-loop/SKILL.md
  • .claude/skills/impl-review-loop/steps/preparation.md
  • steps/step-1-implementation.md
  • steps/step-2-verification.md
  • steps/step-4-pr-review.md
  • steps/step-5-feedback-and-termination.md
  • steps/step-5-mergeability-handling.md
  • .claude/agents/implementation-worker.md
  • .claude/agents/test-runner.md
  • .claude/agents/pr-reviewer.md
  • Step 4 が利用する current pr-review-judge contract
  • Issue 実装: opt-in Step 2 canary が通常 pytest 収集全体を exit 77 で中断しないようにする #2903 の Required Design References

を読んでください。

必要なら installed locked pytest の API と official pytest 9.0.x docs を照合してください。特に:

  • Config.args
  • Config.args_source
  • pytest.Config.ArgsSource.ARGS
  • INVOCATION_DIR
  • TESTPATHS
  • capsys.disabled()

の current semantics は推測しないでください。

この prompt に書かれた過去 SHA は authority にしません。fresh live value を使ってください。

1. Root-Owned Entry Transition / Landing Disposition を fresh に実行

source Issue #2903 に対して current canonical Root-Owned Synchronous Entry Transition と intake / landing disposition を実行してください。

comment 5975502310 は今回 user が明示選択した human review context です。current context protocol が human-context comment URL / ID の binding を要求する場合は正規に渡してください。

PR #2909 が current exact linked open/draft candidate であることが確認できた場合は、canonical producer が返す

  • existing_pr_resume
  • start_data_plane: false
  • resume_existing_pr

等の 実際の current result をそのまま consume してください。

既存 PR / branch / worktree があるのに、新しい worker branch や duplicate PR を作らないでください。

既存 worktree が dirty / foreign ownership の場合は勝手に clean/reset/remove せず、current canonical recovery procedure に従ってください。

2. comment 5975502310 の mandatory fix_delta

comment の 2 件は今回の blocker です。

Blocker A — SKIP: の stdout 行頭契約

現実装は capsys.disabled() で capture 外へ出していますが、pytest の terminal progress 出力が先行した場合に

test_file.py SKIP: ...

や

node-id SKIP: ...

となり、^SKIP: を満たさないケースがあります。

必要条件:

  • 明示単独 runtime unavailable の exit code は従来どおり 77
  • stdout に 独立した行として行頭 SKIP: が存在する
  • -q の有無に依存しない
  • 通常 verbosity、-v、必要なら -vv でも保証する
  • broad collection / item-skip 経路には capture 外 SKIP: を追加しない
  • live producer semantics は変更しない

OWNER comment の print(f"\n{stdout_line}", flush=True) は有力な最小案ですが、実コードと pytest の current semantics を確認したうえで最小かつ明確な実装を選んでください。

回帰テストは 実際の canary module に対して行い、少なくとも verbosity が変わった場合でも

  • child exit == 77
  • child.stdout.splitlines() 内に line.startswith("SKIP:")

が成立することを確認してください。

helper 自体に新しい generic output framework を作らないでください。

Blocker B — testpaths を明示単独 invocation と誤認する

Issue #2903 の契約では target 引数なしで rootdir / testpaths により canary が選択された場合は item skip です。

config.args が canary 1 件に見えても、それが CLI の明示 target 由来とは限りません。

installed pytest / official API を確認し、明示単独 runtime 判定では pytest 自身の source information を利用してください。

期待する semantic は概ね:

  • xdist worker → standalone ではない
  • config.args_source == pytest.Config.ArgsSource.ARGS のときだけ明示 target 候補
  • TESTPATHS → standalone ではない
  • INVOCATION_DIR → standalone ではない
  • その後に既存の resolved-path / exact-node-id 判定

です。

ただし current API を fresh に検証してから実装してください。

raw command string の解析、testscollected == 1、failure 件数、config.invocation_params.args への逆戻りで代替しないでください。

回帰テストでは isolated config で canary symlink を testpaths に設定し、target を明示せず root から child pytest を実行して、

  • exit 0
  • canary item は skipped
  • session abort なし
  • capture 外の行頭 SKIP: なし

を node-level evidence で確認してください。

3. 推奨する追加回帰 — auth boundary mutation gap

comment 5975502310 と前回 reviewer が指摘した

gh auth status 境界を except Exception に広げても既存テストが検出できない

という mutation gap は、巨大な follow-up framework を作るほどの問題ではありません。

current Issue #2903 の In Scope / Allowed Paths と矛盾しないことを確認できるなら、今回同じ contract test に最小 1 ケース追加することを推奨します。

例:

  • child double の gh auth status が RuntimeError を raise
  • child は SKIP/77 に変換されない
  • test node は FAIL / exit 1
  • stdout に行頭 SKIP: がない
  • producer Popen には到達しない

これにより (OSError, subprocess.TimeoutExpired) だけを unavailable へ変換する契約を回帰として固定できます。

新しい mutation framework、例外総当たり、generic harness は作らないでください。

前回 warning の「env leak control assertion が弱い」点は、同じファイル内の極小修正で意味のある assertion にでき、current Issue contract を広げない場合だけ改善してください。今回の 2 blocker より優先しません。

4. Scope を広げない

Issue #2903 の live Allowed Paths を authority にしてください。現在も従来どおりであれば変更対象はこの 2 ファイルだけです。

  • test_step2_execution_surface_canary.py
  • test_step2_canary_collection_contract.py

current live Issue が違う値なら live value を使用してください。

今回混ぜてはいけないもの:

#2907 は既に pipe deadlock risk の owner です。同じ defect を再起票しないでください。

5. Step 1 — implementation-worker

current landing disposition が既存 PR 再開を指示したら、PR #2909 の現在の branch/worktree を再利用してください。

implementation-worker を current Skill の canonical task name で起動し、child message には明示的に以下を含めてください。

SubAgent dispatch だけで完了扱いにしないでください。

final result を取得し、その後 terminal completed を確認してから次へ進んでください。

worker が通常の test failure を見つけても、scope 内で修正可能なら自律修正してください。

6. Step 2 — test-runner による fresh current-head verification

implementation-worker 完了後、PR の current head を fresh に再取得してください。

その head に対して test-runner を起動し、Issue #2903 の current Verification Commands を実行してください。

最低限:

  • focused canary contract regression
  • verbosity variation
  • testpaths no-target regression
  • auth RuntimeError regressionを追加した場合はその結果
  • 実 xdist contract
  • Issue が要求する broad AC5 VC

を確認します。

broad VC に既存の無関係 failure が残る場合:

  • node-id
  • exit code
  • failure cause
  • current PR delta との因果
  • baseline / CI との比較

を記録し、failure を suppress しないでください。

「exit 77 が消えた」だけを AC5 PASS と解釈しないでください。

test-runner についても final report と terminal completed の両方を確認してから downstream へ進んでください。

7. Step 4 current-head gate と pr_review_only を正規に処理する

ここは前回の run で特に重要だった箇所です。

前回は AC5 が preflight-scope: pr_review_only であるため local test-runner の evidence だけでは current authorization を満たせず、

pr_review_only_current_authorization_mismatch:AC5

で step4-adjudicate が blocking になったまま、後段で route_loop_verdict_v2() を直接使う workaround に進みました。

今回はこの bypass を再利用しないでください。

current step-4-pr-review.md / adjudicator / current CI producer contract を読み、current Skill が要求する正規の方法で Step 4 gate を成立させてください。

具体的には:

  • current-head binding tuple を fresh に作る
  • Issue body SHA / ordered VC command hashes / PR head を current値に束縛
  • pr_review_only が real CI-backed producer evidence を要求する場合は、実際の GitHub Actions run/check/artifact から正規 evidence を取得する
  • workflow_run_id / attempt / check_run_id / artifact digest 等が必要なら実値だけを使用する
  • fake / guessed identifier を絶対に作らない
  • current Skill が pr-reviewer を verification owner とする supported route を定義している場合はその route に従う
  • local test-runner result を勝手に CI producer result に昇格しない

required CI が current head で完了するまで current Skill の bounded wait procedure に従ってください。

修正可能 CI failure は自律的に調査・修正・再検証してください。

8. fresh pr-reviewer

Step 4 gate が reviewer invocation を許可したら、current head に対して fresh pr-reviewer を起動してください。

以前の APPROVE は comment 5975502310 より前の stale review なので authority にしません。

reviewer には明示的に確認させてください。

  • comment 5975502310 の blocker A が解消されたか
  • blocker B が解消されたか
  • real canary module を regression が試験しているか
  • verbosity に依存せず行頭 SKIP: が成立するか
  • TESTPATHS / INVOCATION_DIR と explicit ARGS が正しく区別されるか
  • broad collection は item skip のままか
  • auth boundary が broad exception 化されていないか
  • Allowed Paths
  • Issue AC / current Verification Commands
  • current required CI
  • 実装: opt-in Step 2 canary live path の pipe 待機順序による潜在 deadlock を解消する #2907 のコードを触っていないか
  • regression が happy-path-only / false-green でないか

reviewer が REQUEST_CHANGES を返した場合は、人間へ戻さず current bounded loop 内で fix_delta として Step 1 に戻してください。

pr-reviewer も final verdict と terminal completed の双方を確認してください。

9. Step 5 — canonical terminal gate を必ず通す

成功判定に route_loop_verdict_v2() の approved を単独で使わないでください。

current step-5-feedback-and-termination.md の正本どおり、terminal approval は必ず

adjudicate_vc_result.py step5-terminal-gate

の current production path を経由してください。

同じ fresh decision cycle から:

  • current PR head
  • live mergeability
  • mergeStateStatus
  • current base
  • main drift facts
  • reviewer verdict
  • saved dispatch seq
  • current Issue body SHA
  • ordered command hashes
  • valid current VC adjudication

を束縛してください。

step5-terminal-gate が exit 0 を返した場合だけ approved / draft_pr_ready としてください。

前回のように VC gate が blocking のまま route_loop_verdict_v2() だけで merge-ready とみなすことは禁止です。

route が以下なら current Skill に従って自律継続してください。

  • continue_loop → fix_delta を Step 1 へ
  • route_to_update_branch → implementation-worker に update-branch を委譲し verification + review 再実行
  • route_scope_clean_reconciliation → canonical reconciliation 後に resume
  • route_stale_head_rereview → current head で re-review
  • CI-related fail-closed → bounded current-head reevaluation
  • ordinary REQUEST_CHANGES → bounded fix/retest/re-review

current LOOP_POLICY_V1 の max iteration を超えて無限反復しないでください。

10. 再発防止 Issue

今回の 2 blocker は #2903 / PR #2909 の current scope 内で直接修正すべき defect なので、新規 Issue へ逃がさないでください。

auth RuntimeError mutation gap も current Allowed Paths 内の 1 regression で閉じられるならこの PR で閉じるのを優先してください。

それ以外に作業中、

  • 同じ failure class が今後も別 Issue / PR で再発しそう
  • current scope に混ぜるべきでない
  • concrete reproduction / evidence がある

defect を発見した場合は、まず OPEN/CLOSED Issue / PR を fresh search して dedupe してください。

既存 owner があれば新規 Issue は作らず最終報告に示してください。

既存 owner がなく独立 defect なら、repository-native create-issue workflow を使い follow-up Issue を作成して構いません。

特に、今回も canonical step4-adjudicate → step5-terminal-gate が pr_review_only の正当な CI evidence を current repository workflow から生成・消費できず、同じ workaround を要求することが fresh に再現した場合は、それ自体が recurrent workflow defect の候補です。

その場合:

  1. 既存 owner Issue / PR を検索
  2. 重複がなければ concrete reproduction と affected scripts/contract を記載した最小 follow-up Issue を作る
  3. 実装: opt-in Step 2 canary が通常 pytest 収集全体を exit 77 で中断しないようにする #2903 の Allowed Paths を勝手に拡張してその workflow defect をこの PR で修正しない
  4. canonical gate を迂回して draft_pr_ready を捏造しない

としてください。

「念のため」の generic hardening、追加 schema、wrapper、approval gate は起票しないでください。

11. 停止境界

以下以外では iteration ごとの人間承認を求めないでください。

停止候補:

  • destructive operation が必要
  • secret / credential 操作が必要
  • force push / history rewrite が必要
  • permission / policy bypass が必要
  • current user instructionより新しい OWNER の明示停止指示
  • actual Git conflict (CONFLICTING / DIRTY) で canonical runbook が解消不能
  • irreconcilable scope conflict / Allowed Paths 外変更が必須
  • evidence integrity を維持できない
  • current canonical loop の max iteration 到達
  • current repository contract が明示する true human judgment gate

通常の test failure、CI failure、REQUEST_CHANGES、BEHIND、stale head、deterministic validation failure、SubAgent の human_review_required: true 自己申告だけでは停止しないでください。

12. 最終成功条件

最低限すべて確認してください。

  • comment 5975502310 の 2 blocker が current head で解消
  • current Issue 実装: opt-in Step 2 canary が通常 pytest 収集全体を exit 77 で中断しないようにする #2903 Allowed Paths compliance
  • implementation-worker final result + terminal completed
  • test-runner final result + terminal completed
  • current Verification Commands が current head に束縛
  • required CI が current head で成立
  • fresh pr-reviewer final result + terminal completed
  • fresh reviewer verdict == APPROVE
  • blockers == []
  • previous stale APPROVE を再利用していない
  • live mergeability が current Skill の承認条件を満たす
  • stale head ではない
  • canonical step5-terminal-gate が exit 0
  • current Skill が正当に draft_pr_ready を emit できる

ここまで到達したら停止してください。

merge / auto-merge / Issue close / post-merge cleanup はしないでください。

最終報告

最後に簡潔に実値で報告してください。

fresh evidence がない項目を推測で PASS / approved / completed / merge-ready と報告しないでください。

この prompt では、今回の OWNER REQUEST_CHANGES を「停止理由」ではなく今回明示的に処理を承認された fix_deltaとして扱うことと、前回残った terminal-gate 迂回を禁止することを明確にしています。

squne121 and others added 2 commits October 4, 2026 11:08
…2903)

- 単独 runtime の SKIP 出力を改行始まりにし、-q 有無・通常・-v・-vv の全てで
  stdout の行頭 SKIP: と exit 77 を維持する
- config.args_source が ARGS 以外 (testpaths / invocation dir) の場合は
  単独 runtime と見なさず item skip にする
- 回帰テストを追加: verbosity 別の行頭 SKIP、testpaths 由来 canary の item skip、
  gh auth status の想定外例外が SKIP/77 に変換されないこと

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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.

実装: opt-in Step 2 canary が通常 pytest 収集全体を exit 77 で中断しないようにする

1 participant