Repository navigation
Closed
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "1645"
child_id: head-bound-test-verdict-publisher
dedupe_key: "1645:head-bound-test-verdict-publisher:v1"
goal_ref: "protected execution artifact receipt だけを受け取り、target PR の pre/post HEAD barrier を満たす TEST_VERDICT_MACHINE/v2 コメントを dedicated transaction として公開する"
change_kind: code
preflight_scope: implementation
runtime_verification:
required: true
mode: read_only_github_integration
evidence_type: controlled-publisher-contractParent Issue
Depends On
- Child A(protected execution artifact producer)
Parent Goal Ref
- Goal: generic comment publisher を trust boundary にせず、HEAD-bound receipt を検証してだけ TEST_VERDICT を公開する。
- Desired Destination:
test_verdict.publishtransaction が target PR と linked Issue を別 field で扱い、投稿前後の HEAD readback を必須化する。
Current Validated Scope
- existing
issue_comment.publishは作成済み本文と marker の投稿だけを行い、target PR HEAD を検証しない。 pr_review.publishには expected head precondition と commit-bound postcondition の precedent がある。
Remaining Parent Gaps
- materializer/adjudicator/Step 2 consumer は Child C の責務。
Required Design References
docs/dev/agent-skill-boundaries.mddocs/dev/workflow.md
Outcome
test_verdict.publish policy/executor と unit test が追加され、Child A receipt に束縛された current-head TEST_VERDICT だけを idempotent に公開できる。
In Scope
- controlled skill mutation policy に
test_verdict.publishcommand id と closed request schema を追加する。 - executor は repository、target PR number、linked Issue number、expected head SHA、receipt digest、body SHA、idempotency key を独立に検証する。
- executor は POST 前と POST 後に target PR HEAD を readback し、drift、author/marker/body mismatch、duplicate marker を fail-closed にする。
- policy/executor tests を追加し、generic
issue_comment.publishinput だけでは TEST_VERDICT 公開に到達できないことを検証する。 producer_receiptをschemas/test-verdict-producer-receipt.schema.jsonに対してjsonschema.Draft202012Validatorでフル検証する(Scope Delta 参照)。- workflow run/job/check run/artifact の GitHub API live readback と artifact archive のダウンロード・digest 再計算による receipt 内容の独立検証を行う。
- 公開 body を receipt から決定論的に生成し、自由入力の body 文字列を受け付けない。
- idempotent retry 経路での fresh HEAD/Issue body 再検証、marker事前埋め込み拒否、POST後 marker 再確認、linked Issue の非PR確認を追加する。
Out of Scope
- GitHub Actions execution record の生成(Child A / 実装: protected TEST_VERDICT execution artifact producer を追加する #1646 の責務のまま)。
- materializer/adjudicator/Step 2 documentation の変更。
- raw
gh pr commentを正規経路にすること。 - 複数 executor 間の完全な分散 exactly-once(workflow 側の
concurrencygroup 設定など、repo 外のCI設定変更)。POST後の marker再確認による best-effort 検知のみを行い、限界を Safety Claim Matrix に明記する。
Acceptance Criteria
- AC1:
test_verdict.publishは target PR と linked Issue を別の required field として検証する。 - AC2: valid receipt と expected HEAD が一致する場合だけ、unique TEST_VERDICT marker を含むコメントを公開する。
- AC3: pre/post publish HEAD drift、receipt/body mismatch、author/marker mismatch、duplicate idempotency key は fail-closed で公開しない。
- AC4: generic
issue_comment.publishrequest は TEST_VERDICT publish transaction の代替にならない。 - AC5:
producer_receiptはschemas/test-verdict-producer-receipt.schema.jsonに対してjsonschema.Draft202012Validatorでフル検証される(producer/execution_payload_sha256を含むrequired/additionalProperties: falseを強制。未知フィールドを持つ receipt、producer欠落、execution_payload_sha256欠落は fail-closed で拒否)。 - AC6: executor は receipt 内の
producer(workflow_run_id / workflow_run_attempt / job_id / check_run_id)とexecution_artifact(artifact_id / artifact_archive_digest)を GitHub API から live readback し、workflow run の repository/head SHA、job の run 紐付け、check run の紐付け、artifact の digest が receipt の値と一致することを確認する。不一致・readback失敗は fail-closed で拒否する。 - AC7: executor は artifact archive を実際にダウンロードして sha256 を再計算し、receipt の
artifact_archive_digestと一致することを確認する。不一致は fail-closed で拒否する。 - AC8: 公開する comment body は verified receipt から決定論的に生成される(自由入力の body 文字列を受け付けない)。body 内に含まれる PR/Issue番号・HEAD・artifact識別子・result・per-AC coverage は receipt の値と一致する。
- AC9: idempotent retry 経路(既存 marker が1件見つかった場合)でも、POST 前と同様に PR HEAD と linked Issue body の fresh readback を行い、readback 開始時点と成功判定時点の間で drift があれば stale として扱い、tracked changes の再確認も行う。
- AC10: 入力 body に既に marker 文字列が含まれる場合、POST 前に fail-closed で拒否する。POST 後に marker 一覧を再取得し、1件以外なら
published_but_conflictedとして扱う。 - AC11: linked Issue 取得時に対象が
pull_requestフィールドを持つ(PR である)場合は fail-closed で拒否し、regular Issue のみを linked Issue として受理する。
Verification Commands
# AC1
# preflight-scope: pr_review_only
$ uv run --locked pytest scripts/agent-guards/tests/test_test_verdict_publish_exec.py -q
# AC2
# preflight-scope: pr_review_only
$ uv run --locked pytest scripts/agent-guards/tests/test_test_verdict_publish_exec.py -q
# AC3
# preflight-scope: pr_review_only
$ uv run --locked pytest scripts/agent-guards/tests/test_test_verdict_publish_exec.py -q
# AC4
# preflight-scope: pr_review_only
$ uv run --locked pytest scripts/agent-guards/tests/test_test_verdict_publish_exec.py -q
# AC5
# preflight-scope: pr_review_only
$ uv run --locked pytest scripts/agent-guards/tests/test_test_verdict_publish_exec.py -q
# AC6
# preflight-scope: pr_review_only
$ uv run --locked pytest scripts/agent-guards/tests/test_test_verdict_publish_exec.py -q
# AC7
# preflight-scope: pr_review_only
$ uv run --locked pytest scripts/agent-guards/tests/test_test_verdict_publish_exec.py -q
# AC8
# preflight-scope: pr_review_only
$ uv run --locked pytest scripts/agent-guards/tests/test_test_verdict_publish_exec.py -q
# AC9
# preflight-scope: pr_review_only
$ uv run --locked pytest scripts/agent-guards/tests/test_test_verdict_publish_exec.py -q
# AC10
# preflight-scope: pr_review_only
$ uv run --locked pytest scripts/agent-guards/tests/test_test_verdict_publish_exec.py -q
# AC11
# preflight-scope: pr_review_only
$ uv run --locked pytest scripts/agent-guards/tests/test_test_verdict_publish_exec.py -qAllowed Paths
scripts/agent-guards/controlled_skill_mutation_policy.pyscripts/agent-guards/controlled_skill_mutation_exec.pyscripts/agent-guards/tests/test_test_verdict_publish_exec.pyscripts/agent-guards/tests/test_controlled_skill_mutation_policy.py
Runtime Verification Applicability
decision: immediate
mode: read_only_github_integration
reason: "controlled publisher の PR readback と comment postcondition を fixture で検証する"
applicable_acs: [AC1, AC2, AC3, AC4]
execution_environment: "trusted default-branch protected publisher の fixture/read-only GitHub integration"
skip_conditions: "PR/Issue/receipt/HEAD/artifact identity readback unavailable"
fallback_policy: "skip/fallback をPASSへ変換せず publisher receiptをdiagnostic-onlyにする"
artifact_requirements: "Child A producer receipt + target PR pre/post HEAD readback + published comment receipt"Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- generic publisher の認可を TEST_VERDICT 用に広げる必要が生じた場合
- expected HEAD pre/post barrier または receipt binding を fail-open にする必要が生じた場合
Required Skills
なし
Scope Collision (C1)
- related_issue: 実装: isolation worktree agent の Issue comment request を issue_comment.publish controlled mutation lane へ parent delegation で接続する #1633, 実装: GitHub native dependency 解除の controlled executor を追加する #1632, 実装: live GitHub-bound Issue scope snapshot materializer を追加する #1629, 調査: skill runtime exec 経由の worktree mutation command-id 実行が block される根本原因を特定する #1608, 実装: playtest-log の JSON Schema / validator の追加 #420, 実装: .claude/skills 配下スクリプトの executable bit を監査し CI guard を追加する #205
- overlapping_paths:
scripts/agent-guards/controlled_skill_mutation_exec.py,scripts/agent-guards/controlled_skill_mutation_policy.py,scripts/agent-guards/tests/test_test_verdict_publish_exec.py - non_conflict_reason: 実装: isolation worktree agent の Issue comment request を issue_comment.publish controlled mutation lane へ parent delegation で接続する #1633 は generic issue comment parent delegation、実装: GitHub native dependency 解除の controlled executor を追加する #1632 は native dependency removal、実装: live GitHub-bound Issue scope snapshot materializer を追加する #1629 は Issue scope snapshot、調査: skill runtime exec 経由の worktree mutation command-id 実行が block される根本原因を特定する #1608 は research であり、target PR/linked Issue を分離した TEST_VERDICT receipt publish と pre/post HEAD barrier を所有しない。
- edit_intent: generic publisher の認可を広げず、新 command id の closed request/policy/executor/test だけを追加する。
- dependency_ordering: Child A の merged receipt contract と列挙 Issue の current PR state を readback してから開始する。
Scope Delta
PR #1827 に対する人間 OWNER の敵対的レビュー(PR #1827 comment、REQUEST_CHANGES)で以下が判明したため、AC5-AC11 を追加する。
- P0-1:
_validate_test_verdict_publish_fieldsがproducer_receiptの構造の一部(schema/pass_eligible/subject/contract/artifact の一部フィールド)しか検証せず、既存の正式 schema(schemas/test-verdict-producer-receipt.schema.json、producer/execution_payload_sha256必須・additionalProperties: false)に対するフル検証がなく、workflow run/job/check run/artifact の GitHub API live readback も artifact archive のダウンロード・digest 再計算もない。結果として自己申告 JSON だけで PASS を公開できてしまう(AC5-AC7 で対応)。 - P0-2: 公開 body の検証が非空文字列+
TEST_VERDICT_MACHINE/v2文字列含有の確認のみで、body 内の PR/Issue/HEAD/artifact/result/per-AC coverage が receipt と一致することを検証していない(AC8 で対応)。 - P1-1: idempotent retry 経路で HEAD/Issue body の fresh readback が readback開始時点のみで、成功判定時点までのdriftを再確認していない(AC9 で対応)。
- P1-2: marker precheck と POST が atomic でなく、並列実行で重複投稿されうる。POST後のmarker再確認による best-effort 検知を追加し、限界を明記する(AC10 で対応)。
- P1-3:
target_pr_number == issue_numberを reject する現行実装は維持する(reviewer の選択肢のうち最小変更の方針)。PR 実装: HEAD-bound TEST_VERDICT publisher transaction を追加する #1827 自体の本文記述の矛盾は fix_delta の PR 本文更新で解消し、新規 AC は追加しない。 - P1-4: linked Issue が実際に regular Issue(PR ではない)ことを検証していない(AC11 で対応)。
- 上記対応により Allowed Paths の追加は不要(既存4ファイル内で完結)。
schemas/test-verdict-producer-receipt.schema.jsonは読み取り専用参照のみで変更しない。
Delivery Rule
- 1 Issue = 1 PR。
- Child A の merged receipt contract を current main から readback してから着手する。
- normal commit / push のみを使用し、force push、hook disable、guard bypass、raw
gh pr commentを行わない。
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Activity
squne121 commentedon Jul 27, 2026
Issue #1647 の Runtime Verification Applicability を contract に合わせて補完しました。
Fresh static readiness:
status: gosqune121 commentedon Jul 27, 2026
Contract Review Result
squne121 commentedon Jul 27, 2026
Issue #1647 の Allowed Paths に
scripts/agent-guards/tests/test_controlled_skill_mutation_policy.pyを追加しました。新 command id の registry scope-pin 回帰テストを機械的に固定するための最小追加です。Fresh static readiness:
ISSUE_CONTRACT_READINESS_RESULT_V1 status: gosqune121 commentedon Jul 27, 2026
Contract Review Result
squne121 commentedon Jul 27, 2026
Contract Review Result
squne121 commentedon Jul 28, 2026
Contract Review Result
fix(test-verdict-publish): full receipt schema + GH Actions live read…
実装: HEAD-bound TEST_VERDICT publisher transaction を追加する (#1827)
実装: TEST_VERDICT consumer integration(materializer + receipt-aware ad…