Skip to content

実装: マージ済み PR の pr_review.publish marker を限定 archive し preflight 阻害を防ぐ #1602

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "マージ済み PR の pr_review.publish ローカル marker が後続 preflight を unauthorized_write_path で停止させず、remote GitHub state を authority とする限定 archive lifecycle を提供する"
change_kind: code
dedupe_key: "follow-up:squne121/loop-protocol:pr/1594:pr-review-publish-marker-lifecycle"
origin_skill: issue-refinement-loop
source_pr: "#1594"

Parent Issue

なし(単独改善)

Parent Goal Ref

Current Validated Scope

Remaining Parent Gaps

Outcome

scripts/agent-ops/pr_review_marker_archive_exec.py、回帰テスト、post-merge-cleanup handoff、および責務境界の SSOT が揃い、PR が remote で MERGED かつ marker/review/head binding を再検証できる場合に限り、当該 PR_REVIEW_PUBLISH_MARKER_V1 を repo 外 archive root へ退避して repo 側 marker を除去し、検証不能な marker は一切変更せず fail-close する状態。

In Scope

  • PR_REVIEW_PUBLISH_MARKER_V1 の exact path・regular file・strict JSON key/type・pr_number/repo/expected head/review URL/review_id の binding を、directory FD ベースの TOCTOU-safe 検証(openat2/openat+O_NOFOLLOW の FD-relative walk、同一 FD からの読み取り・hash・unlink 直前の再照合)で行う専用 archive executor を追加する。
  • executor は GitHub の merged-check endpoint(204=merged/404=unmerged)で対象 PR が MERGED であること、marker の review_id を primary key として exact review endpoint を取得し review id/URL/PR URL/state/commit/idempotency-derived body marker が一致することを確認した場合だけ、marker bytes の sha256 と archive metadata を authority 付きで解決した repo 外 archive root(no-overwrite semantics)に保存してから repo 側 marker を除去する。
  • 除去は unlink 前後で明確に区別された state machine(SOURCE_VALIDATED -> ARCHIVE_PREPARED -> ARCHIVE_DURABLE -> SOURCE_REMOVED -> SOURCE_REMOVAL_DURABLE -> COMMITTED)に従い、unlink 前の失敗は marker 保持、archive durable 後・unlink 前後の失敗は marker 現存確認可否に応じて source_retained または indeterminate を区別して返す。任意 path/glob、schema 不明、symlink/hardlink/non-regular file、open/closed-unmerged PR、remote readback 不一致は対象外として拒否する。
  • post-merge-cleanup worker がこの executor を merged_pr_number の review marker に限って呼び出せる手順を追加し、temp residue の report-only 原則・他 artifact family の削除禁止を維持する。
  • executor の許可対象、remote authority、archive metadata、fail-close と rollback/retention の責務境界を SSOT に記録する。
  • merged success、unmerged refusal、schema/path/file-kind refusal、remote binding mismatch、archive/postcondition failure、および unlink 前後の各失敗状態区分で repo marker 挙動を回帰テストで固定する。

Out of Scope

Acceptance Criteria

  • AC1: executor は exact artifacts/<pr>/issue-metadata/pr_review.publish/pr_review_publish.marker.json の regular PR_REVIEW_PUBLISH_MARKER_V1 だけを受け付け、PR number/repo/review URL/expected head/idempotency key の schema と binding を検証する。検証は pathname resolve に依存せず、repo root と marker の親 directory を directory FD として順次 open し(openat2(RESOLVE_BENEATH | RESOLVE_NO_SYMLINKS)、または openat + O_DIRECTORY/O_NOFOLLOW による FD-relative walk)、marker を O_RDONLY | O_NOFOLLOW | O_CLOEXEC で open して同一 FD から bytes を読み SHA-256 を計算する。fstat で regular file・st_nlink == 1・size 上限を確認し、unlink 直前に directory entry の st_dev/st_ino を開いている FD と再照合し、hardlink count もこの時点で再確認してから unlinkat(dir_fd, exact_name) で削除する。任意 path、glob、symlink/hardlink/non-regular file、検証後の TOCTOU 差し替え、不正 JSON/unknown schema は非0で拒否し repo 側 file を変更しない。
  • AC2: GitHub readback は marker の primary key である review_id を用いて exact review endpoint を取得し、response.id == marker.review_id、html_url == marker.review_url、pull_request_url が対象 repo/PR の canonical API URL、state == COMMENTED、commit_id == expected_head_sha、submitted_at が有効、body 中に idempotency-key 由来 marker が exactly once かつその SHA-256 が一致、を全て確認する。PR の merge 判定は文字列比較ではなく専用の merged-check endpoint(HTTP 204=merged/404=unmerged)で行う。これらすべてが確認できた場合だけ、marker bytes の sha256 と archive metadata を repo 外 archive root に保存する。archive root は authority precedence(XDG_STATE_HOME、fallback $HOME/.local/state)で解決し、relative path・symlink・他 UID owner・group/world-writable root は拒否し、directory mode 0700・file mode 0600 を強制する。archive layout は content-addressed(例: <state_root>/loop-protocol/pr-review-marker-archive/<repo-id>/<pr-number>/<marker-sha256>.archive.json)とし、renameat2(RENAME_NOREPLACE) または archive-root 内 exclusive temp file + link publish による no-overwrite semantics で既存 archive を上書きしない。保存後、repo 側 marker が不在であることを readback 検証する。
  • AC3: executor は SOURCE_VALIDATED -> ARCHIVE_PREPARED -> ARCHIVE_DURABLE -> SOURCE_REMOVED -> SOURCE_REMOVAL_DURABLE -> COMMITTED の state machine に従って結果を区別する。(a) source unlink より前の失敗は failed_before_archive とし marker を必ず保持する。(b) archive durable 達成後、source unlink の前後で失敗した場合は、marker 現存を確認できたときに限り archive_durable_source_retained を返し、marker 不在は確認できたが readback/directory fsync/結果出力のいずれかが失敗し状態を確定できないときは archive_durable_source_state_indeterminate を返す(この場合「marker を保持した」とは主張しない)。(c) source removal durable 達成後は archived として成功を返す。PR が open/closed-unmerged、remote review/head/repo binding が不一致、archive write が失敗、または removal postcondition が確認不能な場合も本状態機械に従って fail-close し、marker 現存を確認できないときは indeterminate を返す(保証できない保持は主張しない)。
  • AC4: post-merge-cleanup の手順は merged PR の exact review marker にだけ executor を適用し、tmp/、.claude/tmp/、.claude/worktrees/、他 artifact family の report-only / deletion 禁止を維持する。POST_MERGE_CLEANUP_REPORT_V1 には schema PR_REVIEW_MARKER_ARCHIVE_RESULT_V1 の pr_review_marker_archive result block を追加し、少なくとも status(archived|already_archived|source_retained|indeterminate|refused|environment_blocked)、reason_code、pr_number、source_relpath、marker_sha256、archive_locator、archive_durable、source_present_after、source_directory_synced、および merged/review_id/state/commit_id を含む remote サブオブジェクトを持つ。
  • AC5: SSOT が remote GitHub state を authority とし、archive は local cache/audit の lifecycle に限定され、preflight 側の generic ignore/allowlist を導入しない責務境界を明記する。

Runtime Verification Applicability

decision: immediate
reason: "POSIX file kind/path safety、repo 外 archive write、GitHub PR/review readback、failure-atomicity を実 filesystem と fake/recorded GitHub response の双方で検証する必要がある"
applicable_acs: [AC1, AC2, AC3]
execution_environment: "Linux/WSL、uv-managed Python、GitHub read-only API が利用可能な専用 worktree"
skip_conditions: "GitHub read-only API 又は POSIX file operations を利用できない環境では environment_blocked として停止し、archive success を主張しない"
fallback_policy: "remote state 未確認・archive write 未確認・repo marker removal 未確認は PASS に変換しない"
artifact_requirements: "archive metadata の marker_sha256、PR number、review URL、review_id、expected head、remote state、archive timestamp と repo marker absence readback"

Verification Commands

# AC1
$ uv run --locked pytest scripts/agent-ops/tests/test_pr_review_marker_archive_exec.py::test_rejects_noncanonical_marker_inputs_without_repo_mutation -q

# AC2
$ uv run --locked pytest scripts/agent-ops/tests/test_pr_review_marker_archive_exec.py::test_archives_only_remote_merged_and_review_id_bound_marker -q

# AC3
$ uv run --locked pytest scripts/agent-ops/tests/test_pr_review_marker_archive_exec.py::test_failure_state_machine_preserves_or_reports_indeterminate -q

# AC4
$ rg -n -- "PR_REVIEW_MARKER_ARCHIVE_RESULT_V1" .claude/skills/post-merge-cleanup/SKILL.md

# AC5
$ rg -n -- "PR_REVIEW_PUBLISH_MARKER_V1" docs/dev/agent-skill-boundaries.md

Allowed Paths

  • scripts/agent-ops/pr_review_marker_archive_exec.py(新規)
  • scripts/agent-ops/tests/test_pr_review_marker_archive_exec.py(新規)
  • scripts/agent-ops/tests/__init__.py(新規、テストパッケージ化に必要な空ファイル)
  • .github/ci/python-test-plan.json(scripts/agent-ops/tests/ を python-test lane に登録するために必要)
  • .claude/skills/post-merge-cleanup/SKILL.md
  • docs/dev/agent-skill-boundaries.md
  • .claude/settings.json(scripts/agent-ops/pr_review_marker_archive_exec.py を呼ぶ post-merge-cleanup executor の command allowlist エントリ追加のために必要)

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • repo 外 archive root を deterministic に束縛・permission/regular-file 検証できない場合
  • remote GitHub readback を実行せず marker を archive/remove しなければならない場合
  • marker schema、remote merge/readback authority、archive-before-removal postcondition の変更が必要になった場合
  • 別 artifact family、retention/rotation、又は preflight policy 変更へ scope 分割が発生する場合

Required Skills

  • Python
  • GitHub REST API readback
  • POSIX ファイルシステム安全性
  • pytest

Required Design References

Scope Delta

Scope Delta (PR #1628 review fix_delta, 追加)

  • source: PR 実装: マージ済み PR の pr_review.publish marker を限定 archive し preflight 阻害を防ぐ #1628 レビュー REQUEST_CHANGES(CI python-test job / node-backed-hook-tests job FAILURE)
  • validated_scope_delta: scripts/agent-ops/tests/__init__.py(テストディレクトリのパッケージ化に必須)と .github/ci/python-test-plan.json(scripts/agent-ops/tests/ を python-test lane に登録し G1 uncovered_changed_test_files gate を通すために必須)の 2 ファイルが実装時に必要と判明した。
  • deterministic_fix: 上記 2 ファイルを Allowed Paths に追加する。既存 In Scope / Acceptance Criteria のスキーマ・契約は変更しない。
  • workaround_comparison: scripts/agent-ops/tests/ を python-test-plan から除外したまま放置する方法は CI gate 常設という既存プロジェクト方針(新規テストは CI required job に登録必須)に反するため不採用。

Scope Delta (PR #1628 review fix_delta, 追加2)

  • source: PR 実装: マージ済み PR の pr_review.publish marker を限定 archive し preflight 阻害を防ぐ #1628 コメント OWNER セキュリティレビュー P1-1(scripts/agent-ops/pr_review_marker_archive_exec.py が Claude Code の command allowlist に含まれておらず、post-merge-cleanup からの自動呼び出し経路が動作しない)。
  • validated_scope_delta: .claude/settings.json の permissions.allow に exact command allow エントリ "Bash(uv run --locked python3 scripts/agent-ops/pr_review_marker_archive_exec.py *)" を追加する必要があると判明した。既存 In Scope / Acceptance Criteria のスキーマ・契約は変更しない。
  • deterministic_fix: .claude/settings.json を Allowed Paths に追加し、上記 exact command allow エントリのみを追加する。broad wildcard や他 command class への allow 拡張は行わない。
  • workaround_comparison: allowlist 追加を見送り手動実行前提のままにする方法は post-merge-cleanup の自動 archive 経路という Outcome を満たさないため不採用。

Delivery Rule

  • 1 Issue = 1 PR とし、専用 worktree で実装して Draft PR を作成する。
  • archive executor は post-merge-cleanup worker だけが、merged PR number と exact marker path を明示して呼び出す。任意 path の user input は受け付けない。

Notes for Reviewer

Activity

  1. added
    enhancement
    phase/implementation
    agent/implementer
    on Jul 18, 2026
  2. squne121 commented on Jul 18, 2026

    @squne121
    OwnerAuthor

    判定

    REQUEST_CHANGES — reframe_in_place。

    設計方向は正しいです。pr_review.publish marker を preflight 側で無視するのではなく、remote GitHub state を authority として限定的に repo 外へ退避する方針は妥当です。既存 publisher も local marker を cache/audit 扱いとし、remote readback を成功判定の正本にしています。

    ただし現契約のまま実装すると、「失敗時には marker を保持する」という AC を満たせない障害窓、TOCTOU による別ファイル削除、archive 証跡の上書き、post-merge report への結果欠落が残ります。Issue #1602 は現在 open、コメントはまだありません。

    マージブロッカー

    P0-1. AC3 の failure-atomicity は実現不能な形で矛盾している

    現契約はおおむね次の順序です。

    1. archive を保存する

    2. repo marker を除去する

    3. marker 不在を readback する

    4. いずれかを確認できなければ marker を保持して失敗する

    しかし、unlink が成功した直後に readback、directory fsync、結果出力のいずれかが失敗した場合、marker はすでに存在しません。再生成による rollback を実装しても、unlink と rollback の間にプロセス停止・OS crash が起きれば「失敗時は必ず marker を残す」は保証できません。

    さらに、ファイル本体への fsync だけでは directory entry の永続化は保証されず、archive 側と source 側それぞれの directory FD に対する fsync が必要です。(man7.org)

    AC3 を以下のように分解してください。

    • source unlink より前の失敗: marker は必ず保持

    • archive durable 後、source unlink 前後の失敗: durable archive を保持し、source の有無を indeterminate として返す

    • source removal durable 後: 成功

    • source removed 後の失敗に対して「marker を保持した」とは主張しない

    最低限、次の状態機械が必要です。

    SOURCE_VALIDATED
      -> ARCHIVE_PREPARED
      -> ARCHIVE_DURABLE
      -> SOURCE_REMOVED
      -> SOURCE_REMOVAL_DURABLE
      -> COMMITTED
    

    結果には failed_before_archive、archive_durable_source_retained、archive_durable_source_state_indeterminate、archived を区別して出すべきです。


    P0-2. pathname ベース検証では marker 差し替え競合を防げない

    既存 publisher の入力検証は、各 component の lstat、Path.resolve()、stat()、st_nlink を順番に確認しています。
    しかし検証後、bytes 読み取り前、hash 後、unlink 前のどこでも path entry は別 inode に交換できます。

    しかも現在の post-merge-cleanup SSOT 自身が、将来の削除 executor に対して「Path.resolve ではなく dir-fd chain で解決する」ことを要求しています。

    AC1 に以下を明記してください。

    • repo root、artifacts/<pr>/issue-metadata/pr_review.publish/ を directory FD として順次 open

    • openat2(RESOLVE_BENEATH | RESOLVE_NO_SYMLINKS)、または openat + O_DIRECTORY / O_NOFOLLOW による FD-relative walk

    • marker を O_RDONLY | O_NOFOLLOW | O_CLOEXEC で open

    • 同一 FDから bytes を読み、SHA-256 を計算

    • fstat で regular file、st_nlink == 1、size 上限、必要なら owner を確認

    • unlink 直前に directory entry の st_dev / st_ino と開いている FDを再照合

    • unlinkat(dir_fd, exact_name) 相当で削除

    • hardlink count も unlink 直前に再確認

    openat() 系が必要なのは、path prefix が並行して交換される race を pathname API だけでは避けられないためです。(man7.org) openat2 の RESOLVE_BENEATH、RESOLVE_NO_SYMLINKS、必要に応じた RESOLVE_NO_XDEV がこの用途に対応します。(man7.org)


    P0-3. remote binding が marker schema より弱い

    実際の PR_REVIEW_PUBLISH_MARKER_V1 には次が保存されています。

    • pr_number

    • repo

    • idempotency_key

    • expected_head_sha

    • review_id

    • review_url

    • published_at

    ところが #1602 の AC は review_url を中心に書かれ、より強い primary key である review_id の binding が明示されていません。

    archive executor は一覧検索ではなく、marker の review_id を使用して exact review endpoint を取得し、以下を全部検証すべきです。

    • response id == marker.review_id

    • html_url == marker.review_url

    • pull_request_url が対象 repo / PR の canonical API URL

    • state == COMMENTED

    • commit_id == expected_head_sha

    • submitted_at が有効

    • body 末尾に sha256(idempotency_key)[:32] 由来 marker が exactly once

    • idempotency key から取り出した body SHA-256 と remote body が一致

    • review author を検証するか、検証対象外にするかを threat model で明示

    GitHub の exact review API は review_id を入力とし、state、html_url、pull_request_url、submitted_at、commit_id を返します。(GitHub Docs)

    また、「PR state が MERGED」という文字列比較は REST 契約として曖昧です。専用の merged-check endpointを使い、HTTP 204 のみを merged と判定し、404 は unmerged として拒否してください。(GitHub Docs)

    API 呼び出しには trusted hostname、recommended media type、明示的な supported API version を固定し、ambient な gh 設定に依存させない方が安全です。現在の GitHub 公式例は X-GitHub-Api-Version: 2026-03-10 を使用しています。(GitHub Docs)


    P0-4. archive root の正本が未定義

    Issue は「repo 外の固定 state root」としていますが、以下が未定義です。

    • root の具体的な locator

    • XDG_STATE_HOME、HOME、専用 env のどれを authority とするか

    • relative path、repo 内 path、symlink、他 UID owner、group/world writable root の扱い

    • mode 0700 / file 0600

    • destination collision

    • cross-filesystem

    • NFS・network filesystem

    • test override の認可条件

    • archive filename と repository identity の namespacing

    関連 #1546 は既に、XDG_STATE_HOME、既定 $HOME/.local/state、repo 外、private owner/mode、create-once/no-overwrite という external state root 契約を定義しています。#1602 が #1546 を別 scope とするなら、依存せずに同等の resolver 契約を自己完結して定義するか、#1546 への明示的 dependency を追加すべきです。

    推奨 locator は次のような content-addressed 形式です。

    <XDG_STATE_HOME>/loop-protocol/
      pr-review-marker-archive/
        <repository-id-or-hash>/
          <pr-number>/
            <marker-sha256>.archive.json
    

    archive final は no-overwrite にしてください。通常の rename は destination を atomic replacement するため、監査証跡の上書きに使ってはいけません。Linux では renameat2(RENAME_NOREPLACE)、または archive-root 内 temp file と exclusive link/publish が候補です。cross-filesystem rename は EXDEV になります。(man7.org)


    P0-5. post-merge-cleanup の output contract に archive 結果を格納できない

    現在の POST_MERGE_CLEANUP_REPORT_V1 には marker archive の専用 field がありません。
    worker は「Procedure(8ステップ)」を実行し、同 schema の全フィールドを必ず返すと固定しています。

    このまま Skill に handoff を追記すると、次の問題が発生します。

    • archive 成功・拒否・partial failure の machine-readable 保存先がない

    • 9番目の step を追加すると worker の「8ステップ」が stale になる

    • main thread が archive failure を routing-critical と判断できない

    • Codex worker も同じ POST_MERGE_CLEANUP_REPORT_V1 を返すため consumer inventory が必要

    少なくとも次を追加してください。

    pr_review_marker_archive:
      schema: PR_REVIEW_MARKER_ARCHIVE_RESULT_V1
      status: archived | already_archived | source_retained | indeterminate | refused | environment_blocked
      reason_code: null | <bounded enum>
      pr_number: 1594
      source_relpath: artifacts/1594/issue-metadata/pr_review.publish/pr_review_publish.marker.json
      marker_sha256: sha256:...
      archive_locator: pr-review-marker-archive/...
      archive_durable: true
      source_present_after: false | true | unknown
      source_directory_synced: true
      remote:
        merged: true
        review_id: 4728229839
        state: COMMENTED
        commit_id: ...
    

    Allowed Paths には最低でも次を追加すべきです。

    • .claude/agents/post-merge-cleanup-worker.md

    • post-merge integration / hookchain test

    • exact command policy を導入する場合はその policy と両 guard の tests

    .agents/skills/post-merge-cleanup/SKILL.md は canonical Claude skill を読む薄い wrapper なので、本文変更は不要ですが consumer inventory には含めるべきです。

    High priority

    P1-1. tracked file を削除しない保証がない

    post-merge SSOT は将来の削除 executor に git ls-files / git status による untracked 確認を要求しています。

    executor は exact path が schema-validでも、次の場合は拒否すべきです。

    • index に登録済み

    • staged deletion/addition

    • submodule entry

    • skip-worktree / assume-unchanged の tracked entry

    • primary worktree 以外の source

    • default branch root と source repo root が不一致

    P1-2. idempotency / recovery matrix が必要

    最低限、以下を固定してください。

    Source | Archive | 判定 -- | -- | -- present-valid | absent | normal archive present-valid | same hash・valid | source removal retry present-valid | different bytes | collision、fail-close absent | valid matching archive | already_archived absent | archive absent | indeterminate_source_missing absent | invalid archive | corruption、fail-close

    二重起動では一方だけが final archive を publishし、他方は既存 archive を再検証して収束する必要があります。

    P1-3. archive envelope の exact schema がない

    archive metadata という説明だけでは実装とテストが分岐します。少なくとも以下を exact-key schema としてください。

    • schema/version

    • canonical repo full name と repository ID

    • source relative path

    • marker exact bytes または base64

    • marker SHA-256

    • source st_dev / st_ino / st_mode / st_uid / st_size

    • PR number

    • review ID / URL / author / state / submitted_at / commit_id

    • expected head

    • idempotency key

    • remote merged verification method

    • archived_at

    • transaction ID

    • executor version

    raw review bodyやtokenは保存せず、必要な hash と marker identity のみに限定するべきです。

    P1-4. failure injection が不足

    現状の3つの pytest nodeでは、以下を個別に固定できません。

    • short write、ENOSPC、EDQUOT、EIO

    • file fsync failure、archive directory fsync failure

    • source directory fsync failure

    • source inode swap

    • hardlink の検証後追加

    • symlink ancestor swap

    • concurrent two-process execution

    • destination same-hash / different-hash collision

    • EXDEV

    • 403 / 404 / 429 / 500 / 503

    • malformed GitHub JSON

    • wrong review ID / URL / pull_request_url

    • marker が body 中間にある

    • dismissed review

    • source absent recovery

    • post-merge report integration

    • archive 後に 実装: scope_rollup.run の GitHub inventory を完全 pagination で取得する #1593 preflight が実際に通る regression

    #1593 の OWNER reviewでも、広い1コマンドの verification が実装前から通る問題と、page-level failure injection 不足が既に指摘されています。#1602 でも同じ失敗を繰り返さず、ACごとに狭い node ID を用意すべきです。

    P1-5. 実装開始 base と shared-file 直列化が必要

    source PR #1594 は merge 済みで、当該 head の CI、hook integrity、manifest workflow は成功しています。
    ただし、その merge commit後にも main は進んでいます。

    実装開始時に以下を記録してください。

    • current origin/main SHA

    • .claude/skills/post-merge-cleanup/SKILL.md の blob SHA

    • docs/dev/agent-skill-boundaries.md の blob SHA

    • overlapping open PR の同一行変更有無

    • dependency / serial merge decision

    改訂後の最低 Acceptance Criteria

    1. Canonical source validation
      --pr-number だけを受け取り、source path は executor が導出する。dir-fd / inode-bound validation、exact schema、untracked、primary/default worktree を確認する。

    2. Exact remote verification
      merged endpoint 204、exact review ID GET、review ID / URL / PR URL / state / commit / submitted time / trailing marker / body hash を検証する。

    3. Durable no-overwrite archive
      private external root に immutable envelope を temp publishし、file + directoryを fsync。既存 final は上書きしない。

    4. Bound source removal
      open済み source inode と directory entry を再照合し、FD-relative unlink後に source directoryを fsync。

    5. Honest failure states
      unlink 前失敗は source retained。unlink 後の不明状態は indeterminate。保証できない source retention を主張しない。

    6. Idempotent reconciliation
      source/archive の全組み合わせ、concurrent invocation、partial transaction から決定論的に収束する。

    7. Post-merge integration
      POST_MERGE_CLEANUP_REPORT_V1 に typed result を追加し、temp residue や他 artifact family の deletion authority は拡張しない。

    8. Runtime verification
      実 filesystem、fake GitHub API、実 hookchain、archive 後の anchor preflight regressionを検証する。

    結論

    問題設定とスコープ分離は良好ですが、現状は implementation-ready ではありません。

    特に、次の3点を直さずに実装へ進むべきではありません。

    1. unlink 後も「失敗なら marker が残る」とする実現不能な AC

    2. dir-fd / inode binding を欠く pathname TOCTOU

    3. archive transaction と post-merge output schema の未定義

    これらを修正すれば、preflight の generic allowlist を広げず、remote authority を維持したまま、安全に lifecycle を閉じられます。

    GitHubへのコメント・Issue編集は行っていません。

    # 判定

    REQUEST_CHANGES — reframe_in_place。

    設計方向は正しいです。pr_review.publish marker を preflight 側で無視するのではなく、remote GitHub state を authority として限定的に repo 外へ退避する方針は妥当です。既存 publisher も local marker を cache/audit 扱いとし、remote readback を成功判定の正本にしています。

    ただし現契約のまま実装すると、「失敗時には marker を保持する」という AC を満たせない障害窓、TOCTOU による別ファイル削除、archive 証跡の上書き、post-merge report への結果欠落が残ります。Issue #1602 は現在 open、コメントはまだありません。

    マージブロッカー

    P0-1. AC3 の failure-atomicity は実現不能な形で矛盾している

    現契約はおおむね次の順序です。

    1. archive を保存する
    2. repo marker を除去する
    3. marker 不在を readback する
    4. いずれかを確認できなければ marker を保持して失敗する

    しかし、unlink が成功した直後に readback、directory fsync、結果出力のいずれかが失敗した場合、marker はすでに存在しません。再生成による rollback を実装しても、unlink と rollback の間にプロセス停止・OS crash が起きれば「失敗時は必ず marker を残す」は保証できません。

    さらに、ファイル本体への fsync だけでは directory entry の永続化は保証されず、archive 側と source 側それぞれの directory FD に対する fsync が必要です。([man7.org]1)

    AC3 を以下のように分解してください。

    • source unlink より前の失敗: marker は必ず保持
    • archive durable 後、source unlink 前後の失敗: durable archive を保持し、source の有無を indeterminate として返す
    • source removal durable 後: 成功
    • source removed 後の失敗に対して「marker を保持した」とは主張しない

    最低限、次の状態機械が必要です。

    SOURCE_VALIDATED
      -> ARCHIVE_PREPARED
      -> ARCHIVE_DURABLE
      -> SOURCE_REMOVED
      -> SOURCE_REMOVAL_DURABLE
      -> COMMITTED
    

    結果には failed_before_archive、archive_durable_source_retained、archive_durable_source_state_indeterminate、archived を区別して出すべきです。


    P0-2. pathname ベース検証では marker 差し替え競合を防げない

    既存 publisher の入力検証は、各 component の lstat、Path.resolve()、stat()、st_nlink を順番に確認しています。
    しかし検証後、bytes 読み取り前、hash 後、unlink 前のどこでも path entry は別 inode に交換できます。

    しかも現在の post-merge-cleanup SSOT 自身が、将来の削除 executor に対して「Path.resolve ではなく dir-fd chain で解決する」ことを要求しています。

    AC1 に以下を明記してください。

    • repo root、artifacts/<pr>/issue-metadata/pr_review.publish/ を directory FD として順次 open
    • openat2(RESOLVE_BENEATH | RESOLVE_NO_SYMLINKS)、または openat + O_DIRECTORY / O_NOFOLLOW による FD-relative walk
    • marker を O_RDONLY | O_NOFOLLOW | O_CLOEXEC で open
    • 同一 FDから bytes を読み、SHA-256 を計算
    • fstat で regular file、st_nlink == 1、size 上限、必要なら owner を確認
    • unlink 直前に directory entry の st_dev / st_ino と開いている FDを再照合
    • unlinkat(dir_fd, exact_name) 相当で削除
    • hardlink count も unlink 直前に再確認

    openat() 系が必要なのは、path prefix が並行して交換される race を pathname API だけでは避けられないためです。([man7.org]2) openat2 の RESOLVE_BENEATH、RESOLVE_NO_SYMLINKS、必要に応じた RESOLVE_NO_XDEV がこの用途に対応します。([man7.org]3)


    P0-3. remote binding が marker schema より弱い

    実際の PR_REVIEW_PUBLISH_MARKER_V1 には次が保存されています。

    • pr_number
    • repo
    • idempotency_key
    • expected_head_sha
    • review_id
    • review_url
    • published_at

    ところが #1602 の AC は review_url を中心に書かれ、より強い primary key である review_id の binding が明示されていません。

    archive executor は一覧検索ではなく、marker の review_id を使用して exact review endpoint を取得し、以下を全部検証すべきです。

    • response id == marker.review_id
    • html_url == marker.review_url
    • pull_request_url が対象 repo / PR の canonical API URL
    • state == COMMENTED
    • commit_id == expected_head_sha
    • submitted_at が有効
    • body 末尾に sha256(idempotency_key)[:32] 由来 marker が exactly once
    • idempotency key から取り出した body SHA-256 と remote body が一致
    • review author を検証するか、検証対象外にするかを threat model で明示

    GitHub の exact review API は review_id を入力とし、state、html_url、pull_request_url、submitted_at、commit_id を返します。([GitHub Docs]4)

    また、「PR state が MERGED」という文字列比較は REST 契約として曖昧です。専用の merged-check endpointを使い、HTTP 204 のみを merged と判定し、404 は unmerged として拒否してください。([GitHub Docs]5)

    API 呼び出しには trusted hostname、recommended media type、明示的な supported API version を固定し、ambient な gh 設定に依存させない方が安全です。現在の GitHub 公式例は X-GitHub-Api-Version: 2026-03-10 を使用しています。([GitHub Docs]5)


    P0-4. archive root の正本が未定義

    Issue は「repo 外の固定 state root」としていますが、以下が未定義です。

    • root の具体的な locator
    • XDG_STATE_HOME、HOME、専用 env のどれを authority とするか
    • relative path、repo 内 path、symlink、他 UID owner、group/world writable root の扱い
    • mode 0700 / file 0600
    • destination collision
    • cross-filesystem
    • NFS・network filesystem
    • test override の認可条件
    • archive filename と repository identity の namespacing

    関連 #1546 は既に、XDG_STATE_HOME、既定 $HOME/.local/state、repo 外、private owner/mode、create-once/no-overwrite という external state root 契約を定義しています。#1602 が #1546 を別 scope とするなら、依存せずに同等の resolver 契約を自己完結して定義するか、#1546 への明示的 dependency を追加すべきです。

    推奨 locator は次のような content-addressed 形式です。

    <XDG_STATE_HOME>/loop-protocol/
      pr-review-marker-archive/
        <repository-id-or-hash>/
          <pr-number>/
            <marker-sha256>.archive.json
    

    archive final は no-overwrite にしてください。通常の rename は destination を atomic replacement するため、監査証跡の上書きに使ってはいけません。Linux では renameat2(RENAME_NOREPLACE)、または archive-root 内 temp file と exclusive link/publish が候補です。cross-filesystem rename は EXDEV になります。([man7.org]6)


    P0-5. post-merge-cleanup の output contract に archive 結果を格納できない

    現在の POST_MERGE_CLEANUP_REPORT_V1 には marker archive の専用 field がありません。
    worker は「Procedure(8ステップ)」を実行し、同 schema の全フィールドを必ず返すと固定しています。

    このまま Skill に handoff を追記すると、次の問題が発生します。

    • archive 成功・拒否・partial failure の machine-readable 保存先がない
    • 9番目の step を追加すると worker の「8ステップ」が stale になる
    • main thread が archive failure を routing-critical と判断できない
    • Codex worker も同じ POST_MERGE_CLEANUP_REPORT_V1 を返すため consumer inventory が必要

    少なくとも次を追加してください。

    pr_review_marker_archive:
      schema: PR_REVIEW_MARKER_ARCHIVE_RESULT_V1
      status: archived | already_archived | source_retained | indeterminate | refused | environment_blocked
      reason_code: null | <bounded enum>
      pr_number: 1594
      source_relpath: artifacts/1594/issue-metadata/pr_review.publish/pr_review_publish.marker.json
      marker_sha256: sha256:...
      archive_locator: pr-review-marker-archive/...
      archive_durable: true
      source_present_after: false | true | unknown
      source_directory_synced: true
      remote:
        merged: true
        review_id: 4728229839
        state: COMMENTED
        commit_id: ...

    Allowed Paths には最低でも次を追加すべきです。

    • .claude/agents/post-merge-cleanup-worker.md
    • post-merge integration / hookchain test
    • exact command policy を導入する場合はその policy と両 guard の tests

    .agents/skills/post-merge-cleanup/SKILL.md は canonical Claude skill を読む薄い wrapper なので、本文変更は不要ですが consumer inventory には含めるべきです。

    High priority

    P1-1. tracked file を削除しない保証がない

    post-merge SSOT は将来の削除 executor に git ls-files / git status による untracked 確認を要求しています。

    executor は exact path が schema-validでも、次の場合は拒否すべきです。

    • index に登録済み
    • staged deletion/addition
    • submodule entry
    • skip-worktree / assume-unchanged の tracked entry
    • primary worktree 以外の source
    • default branch root と source repo root が不一致

    P1-2. idempotency / recovery matrix が必要

    最低限、以下を固定してください。

    Source Archive 判定
    present-valid absent normal archive
    present-valid same hash・valid source removal retry
    present-valid different bytes collision、fail-close
    absent valid matching archive already_archived
    absent archive absent indeterminate_source_missing
    absent invalid archive corruption、fail-close

    二重起動では一方だけが final archive を publishし、他方は既存 archive を再検証して収束する必要があります。

    P1-3. archive envelope の exact schema がない

    archive metadata という説明だけでは実装とテストが分岐します。少なくとも以下を exact-key schema としてください。

    • schema/version
    • canonical repo full name と repository ID
    • source relative path
    • marker exact bytes または base64
    • marker SHA-256
    • source st_dev / st_ino / st_mode / st_uid / st_size
    • PR number
    • review ID / URL / author / state / submitted_at / commit_id
    • expected head
    • idempotency key
    • remote merged verification method
    • archived_at
    • transaction ID
    • executor version

    raw review bodyやtokenは保存せず、必要な hash と marker identity のみに限定するべきです。

    P1-4. failure injection が不足

    現状の3つの pytest nodeでは、以下を個別に固定できません。

    • short write、ENOSPC、EDQUOT、EIO
    • file fsync failure、archive directory fsync failure
    • source directory fsync failure
    • source inode swap
    • hardlink の検証後追加
    • symlink ancestor swap
    • concurrent two-process execution
    • destination same-hash / different-hash collision
    • EXDEV
    • 403 / 404 / 429 / 500 / 503
    • malformed GitHub JSON
    • wrong review ID / URL / pull_request_url
    • marker が body 中間にある
    • dismissed review
    • source absent recovery
    • post-merge report integration
    • archive 後に 実装: scope_rollup.run の GitHub inventory を完全 pagination で取得する #1593 preflight が実際に通る regression

    #1593 の OWNER reviewでも、広い1コマンドの verification が実装前から通る問題と、page-level failure injection 不足が既に指摘されています。#1602 でも同じ失敗を繰り返さず、ACごとに狭い node ID を用意すべきです。

    P1-5. 実装開始 base と shared-file 直列化が必要

    source PR #1594 は merge 済みで、当該 head の CI、hook integrity、manifest workflow は成功しています。
    ただし、その merge commit後にも main は進んでいます。

    実装開始時に以下を記録してください。

    • current origin/main SHA
    • .claude/skills/post-merge-cleanup/SKILL.md の blob SHA
    • docs/dev/agent-skill-boundaries.md の blob SHA
    • overlapping open PR の同一行変更有無
    • dependency / serial merge decision

    改訂後の最低 Acceptance Criteria

    1. Canonical source validation
      --pr-number だけを受け取り、source path は executor が導出する。dir-fd / inode-bound validation、exact schema、untracked、primary/default worktree を確認する。

    2. Exact remote verification
      merged endpoint 204、exact review ID GET、review ID / URL / PR URL / state / commit / submitted time / trailing marker / body hash を検証する。

    3. Durable no-overwrite archive
      private external root に immutable envelope を temp publishし、file + directoryを fsync。既存 final は上書きしない。

    4. Bound source removal
      open済み source inode と directory entry を再照合し、FD-relative unlink後に source directoryを fsync。

    5. Honest failure states
      unlink 前失敗は source retained。unlink 後の不明状態は indeterminate。保証できない source retention を主張しない。

    6. Idempotent reconciliation
      source/archive の全組み合わせ、concurrent invocation、partial transaction から決定論的に収束する。

    7. Post-merge integration
      POST_MERGE_CLEANUP_REPORT_V1 に typed result を追加し、temp residue や他 artifact family の deletion authority は拡張しない。

    8. Runtime verification
      実 filesystem、fake GitHub API、実 hookchain、archive 後の anchor preflight regressionを検証する。

    結論

    問題設定とスコープ分離は良好ですが、現状は implementation-ready ではありません。

    特に、次の3点を直さずに実装へ進むべきではありません。

    1. unlink 後も「失敗なら marker が残る」とする実現不能な AC
    2. dir-fd / inode binding を欠く pathname TOCTOU
    3. archive transaction と post-merge output schema の未定義

    これらを修正すれば、preflight の generic allowlist を広げず、remote authority を維持したまま、安全に lifecycle を閉じられます。

    GitHubへのコメント・Issue編集は行っていません。

  3. squne121 commented on Jul 18, 2026

    @squne121
    OwnerAuthor

    Refinement Loop: Human Escalation Required

    The loop has terminated and requires human review. Cause: human judgment required

    Blockers

    "anchor_comment_final_classification_unresolved: OWNER REQUEST_CHANGES (https://github.com/squne121/loop-protocol/issues/1602#issuecomment-5010821362, reframe_in_place) の final_classification が未確定 (preliminary_classification=feedback_update_required)"
    
    "P0-1_ac3_failure_atomicity_unaddressed: unlink後の indeterminate 状態を含む state machine が AC3 に未反映"
    
    "P0-2_dirfd_toctou_validation_unaddressed: openat2/dir-fd based inode-bound validation が AC1 に未反映"
    
    "P0-3_review_id_binding_unaddressed: review_id を primary key とする exact remote 検証が未反映"
    
    "P0-4_archive_root_locator_undefined: archive root locator (XDG_STATE_HOME 等) と no-overwrite 保証が未定義"
    
    "P0-5_post_merge_output_schema_missing: POST_MERGE_CLEANUP_REPORT_V1 への pr_review_marker_archive 専用フィールドが未反映"
    
    "issue_reviewer_approve_is_structural_only: issue-reviewer の approve は C1-C11 構造チェックのみで上記の意味的ブロッカーは未検証"
    
  4. squne121 commented on Jul 18, 2026

    @squne121
    OwnerAuthor

    Contract Review Result

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-07-18T11:00:27Z"
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/1602
      body_sha256: "sha256:21599c845536f798e2f07007f7d2e21f7dbb04d430b9b0a562dd48106dee43b6"
      checks:
        readiness: go
        blockers: pass
        product_spec: pass
        product_spec_check: {"schema":"product_spec_check/v1","applicability":"applicable","decision":"pass","triggers":{"docs_product_allowed_paths":false,"tasks_md_mentioned":false,"specify_artifact_mentioned":false,"generated_task_mentioned":false,"product_spec_context_present":false,"machine_readable_contract_present":true},"conditions":{"docs_product_requires_spec_evidence":{"status":"pass","evidence":[]},"tasks_md_not_direct_source":{"status":"pass","evidence":[]},"specify_not_canonical":{"status":"pass","evidence":[]},"diff_first_rationale_present":{"status":"pass","evidence":[]},"generated_task_trace_present":{"status":"pass","evidence":[]},"task_dependencies_materialized":{"status":"pass","evidence":[]}},"blocked_reasons":[],"body_sha256":"sha256:21599c845536f798e2f07007f7d2e21f7dbb04d430b9b0a562dd48106dee43b6","source_provenance":{"source_type":"github_api","body_file":null}}
        vc_preflight:
          decision: pass
          classifications: [{"ac":"AC1","line":2,"raw_command":"uv run --locked pytest scripts/agent-ops/tests/test_pr_review_marker_archive_exec.py::test_rejects_noncanonical_marker_inputs_without_repo_mutation -q","command_hash":"sha256:9c69592cfa9cbaf3ea5c1d7dba24ed0d6e892d12f5519bec2dbd5331b1c4c2f0","execution_key_hash":"sha256:e7371a01631821bd2bbcf9398a6b6c3be60d714a2e4fc0897fd02b31d11e6545","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["no tests ran in 0.00s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":["ERROR: file or directory not found: scripts/agent-ops/tests/test_pr_review_marker_archive_exec.py::test_rejects_noncanonical_marker_inputs_without_repo_mutation"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":150,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null},{"ac":"AC2","line":5,"raw_command":"uv run --locked pytest scripts/agent-ops/tests/test_pr_review_marker_archive_exec.py::test_archives_only_remote_merged_and_review_id_bound_marker -q","command_hash":"sha256:70ab2a4160262630eeaccef29e66361826509f57442454cb9db6ac6d0cf6dcc1","execution_key_hash":"sha256:9496f3171c7be13429869addf28298885039c192f64be43eec93fdf7e7ed8a5b","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["no tests ran in 0.00s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":["ERROR: file or directory not found: scripts/agent-ops/tests/test_pr_review_marker_archive_exec.py::test_archives_only_remote_merged_and_review_id_bound_marker"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":137,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null},{"ac":"AC3","line":8,"raw_command":"uv run --locked pytest scripts/agent-ops/tests/test_pr_review_marker_archive_exec.py::test_failure_state_machine_preserves_or_reports_indeterminate -q","command_hash":"sha256:d905a4cbcbb0c3e91e9545e8244639d75bc0ac818264ec4fc7e4e72cd4fe1e0d","execution_key_hash":"sha256:e5dbae5326b23f1b38f42b769651c1545c53f47cc3766d5aa829aac04c09460f","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["no tests ran in 0.00s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":["ERROR: file or directory not found: scripts/agent-ops/tests/test_pr_review_marker_archive_exec.py::test_failure_state_machine_preserves_or_reports_indeterminate"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":144,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null},{"ac":"AC4","line":11,"raw_command":"rg -n -- \"PR_REVIEW_MARKER_ARCHIVE_RESULT_V1\" .claude/skills/post-merge-cleanup/SKILL.md","command_hash":"sha256:f5e0b293929481b11742ef62b6951a70403ab3167ed602605c2a17c4564b0845","execution_key_hash":"sha256:ceb29f5660208e6a5b62fda720c88156ebebcf9627edda3b5011d80767193987","runner":"exec","exit_code":1,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":[],"stdout_truncated":false,"stdout_original_line_count":1,"stderr_head":[],"stderr_truncated":false,"stderr_original_line_count":1,"runner_env_delta":{},"duration_ms":2,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null},{"ac":"AC5","line":14,"raw_command":"rg -n -- \"PR_REVIEW_PUBLISH_MARKER_V1\" docs/dev/agent-skill-boundaries.md","command_hash":"sha256:5a37091b12d0f6fe0be178faafbaff1b7d70328f2773df5ec86a814f0eb38686","execution_key_hash":"sha256:b12fa01eb6a538d39b8704c69a0b910dcfb91757cfe2b9df763511ecdf4dc109","runner":"exec","exit_code":1,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":[],"stdout_truncated":false,"stdout_original_line_count":1,"stderr_head":[],"stderr_truncated":false,"stderr_original_line_count":1,"runner_env_delta":{},"duration_ms":2,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null}]
      source: ensure_contract_snapshot_auto
      expected_contract_fingerprint: {"issue_number":1602,"contract_source_kind":"issue_comment","contract_source_id":"5011005394","contract_body_sha256":"sha256:21599c845536f798e2f07007f7d2e21f7dbb04d430b9b0a562dd48106dee43b6","allowed_paths_normalized_sha256":"717eb1602b5b29e153cb8de08055f2e5c68f0e1a4cc665282a219bcf700fcada","base_ref":"main","base_sha_at_snapshot":"c0048fab6e5544c5b599cd0feb8f85571a9bd4b8"}
  5. squne121 commented on Jul 18, 2026

    @squne121
    OwnerAuthor

    Refinement Loop: Approved

    The issue has been approved and is ready for implementation.

    LOOP_HANDOFF_RESULT_V1:
      status: impl_ready
      routing_action: run_impl_review_loop
      contract_review:
        status: go
        gate_result: fresh_go
        latest_comment_url: https://github.com/squne121/loop-protocol/issues/1602#issuecomment-5011005394
        generated_at: '2026-07-18T11:00:27Z'
        body_sha256: sha256:21599c845536f798e2f07007f7d2e21f7dbb04d430b9b0a562dd48106dee43b6
      metadata:
        title_prefix_ready: true
        phase_label_ready: true
      auto_fixes:
        result: auto_fixed
        required: []
        skipped: []
      blockers: []
      permissions:
        unavailable: []
      generated_at: '2026-07-18T11:00:27Z'
  6. squne121 commented on Jul 19, 2026

    @squne121
    OwnerAuthor

    Contract Review Result

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-07-19T08:34:47Z"
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/1602
      body_sha256: "sha256:783982b9ed234c5b911cae6797a00f2ac5bfff243349d23f9cd6d68584ec8e31"
      checks:
        readiness: go
        blockers: pass
        product_spec: pass
        product_spec_check: {"schema":"product_spec_check/v1","applicability":"applicable","decision":"pass","triggers":{"docs_product_allowed_paths":false,"tasks_md_mentioned":false,"specify_artifact_mentioned":false,"generated_task_mentioned":false,"product_spec_context_present":false,"machine_readable_contract_present":true},"conditions":{"docs_product_requires_spec_evidence":{"status":"pass","evidence":[]},"tasks_md_not_direct_source":{"status":"pass","evidence":[]},"specify_not_canonical":{"status":"pass","evidence":[]},"diff_first_rationale_present":{"status":"pass","evidence":[]},"generated_task_trace_present":{"status":"pass","evidence":[]},"task_dependencies_materialized":{"status":"pass","evidence":[]}},"blocked_reasons":[],"body_sha256":"sha256:783982b9ed234c5b911cae6797a00f2ac5bfff243349d23f9cd6d68584ec8e31","source_provenance":{"source_type":"github_api","body_file":null}}
        vc_preflight:
          decision: pass
          classifications: [{"ac":"AC1","line":2,"raw_command":"uv run --locked pytest scripts/agent-ops/tests/test_pr_review_marker_archive_exec.py::test_rejects_noncanonical_marker_inputs_without_repo_mutation -q","command_hash":"sha256:9c69592cfa9cbaf3ea5c1d7dba24ed0d6e892d12f5519bec2dbd5331b1c4c2f0","execution_key_hash":"sha256:2dc2652e4b1d7cdb991ad36a5f87c78a26ab827c9450d49f2d367ffc7d41642d","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["no tests ran in 0.00s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":["ERROR: file or directory not found: scripts/agent-ops/tests/test_pr_review_marker_archive_exec.py::test_rejects_noncanonical_marker_inputs_without_repo_mutation"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":261,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null},{"ac":"AC2","line":5,"raw_command":"uv run --locked pytest scripts/agent-ops/tests/test_pr_review_marker_archive_exec.py::test_archives_only_remote_merged_and_review_id_bound_marker -q","command_hash":"sha256:70ab2a4160262630eeaccef29e66361826509f57442454cb9db6ac6d0cf6dcc1","execution_key_hash":"sha256:1284d9a94079923e56b262881a85b14e9bdc316c891eebb2bfb450720beb6263","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["no tests ran in 0.00s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":["ERROR: file or directory not found: scripts/agent-ops/tests/test_pr_review_marker_archive_exec.py::test_archives_only_remote_merged_and_review_id_bound_marker"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":216,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null},{"ac":"AC3","line":8,"raw_command":"uv run --locked pytest scripts/agent-ops/tests/test_pr_review_marker_archive_exec.py::test_failure_state_machine_preserves_or_reports_indeterminate -q","command_hash":"sha256:d905a4cbcbb0c3e91e9545e8244639d75bc0ac818264ec4fc7e4e72cd4fe1e0d","execution_key_hash":"sha256:a66000cdd054fd6d7b7a1bde26a0f59f57a53374bf3f7eb6bd4088445bf39772","runner":"exec","exit_code":4,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":["no tests ran in 0.00s"],"stdout_truncated":false,"stdout_original_line_count":3,"stderr_head":["ERROR: file or directory not found: scripts/agent-ops/tests/test_pr_review_marker_archive_exec.py::test_failure_state_machine_preserves_or_reports_indeterminate"],"stderr_truncated":false,"stderr_original_line_count":3,"runner_env_delta":{},"duration_ms":215,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null},{"ac":"AC4","line":11,"raw_command":"rg -n -- \"PR_REVIEW_MARKER_ARCHIVE_RESULT_V1\" .claude/skills/post-merge-cleanup/SKILL.md","command_hash":"sha256:f5e0b293929481b11742ef62b6951a70403ab3167ed602605c2a17c4564b0845","execution_key_hash":"sha256:801dc546b12b8de75a537e9a401ecaaf411d46d959a32422f60011949ea4b7b3","runner":"exec","exit_code":1,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":[],"stdout_truncated":false,"stdout_original_line_count":1,"stderr_head":[],"stderr_truncated":false,"stderr_original_line_count":1,"runner_env_delta":{},"duration_ms":3,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null},{"ac":"AC5","line":14,"raw_command":"rg -n -- \"PR_REVIEW_PUBLISH_MARKER_V1\" docs/dev/agent-skill-boundaries.md","command_hash":"sha256:5a37091b12d0f6fe0be178faafbaff1b7d70328f2773df5ec86a814f0eb38686","execution_key_hash":"sha256:4a38a870eb19fc82654f85fe100019e2cda0d36467a58d93577ec64b03cc3aab","runner":"exec","exit_code":1,"classification":"expected_fail","category":"expected_baseline_fail","decision":"go","scope_class":"baseline_fail_expected","confidence":"high","stdout_head":[],"stdout_truncated":false,"stdout_original_line_count":1,"stderr_head":[],"stderr_truncated":false,"stderr_original_line_count":1,"runner_env_delta":{},"duration_ms":3,"fix_hint":null,"certified_target_paths":null,"annotations":{"baseline_expect":null,"vc_role":null,"missing_baseline_expect":false},"annotation_source":{"line":null,"raw":null},"strict":null,"repair":null}]
      source: ensure_contract_snapshot_auto
      expected_contract_fingerprint: {"issue_number":1602,"contract_source_kind":"issue_comment","contract_source_id":"5015048452","contract_body_sha256":"sha256:783982b9ed234c5b911cae6797a00f2ac5bfff243349d23f9cd6d68584ec8e31","allowed_paths_normalized_sha256":"af59bc485e40e084868bbac4b796a66c53a1395480ddd35e22782709f97c7a04","base_ref":"main","base_sha_at_snapshot":"4ab8ec2d9495638695ef774fb8737b509585f492"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/implementerenhancementphase/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions