Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "#242"
goal_ref: "manifest producer が生成した artifact が agent_session_manifest/v1 schema に適合することを CI の required check として検証し、schema 違反の PR が main にマージされないようにする"
change_kind: workflowParent Issue
Parent Goal Ref
- Goal: agent session manifest の生成・検証・保存を CI パイプラインで自動化し、session 記録が常に schema に準拠した状態を保証する
- Desired Destination: PR CI が manifest を自動生成・validate し、schema 違反の PR が main にマージできない状態
Current Validated Scope
.github/workflows/session-manifest.ymlの job 名変更(agent-session-manifest / validate-generated-artifact)と validation step 追加- artifact 生成後・upload 前の public-safe hard-fail check 追加
docs/dev/session-recording-policy.mdまたはdocs/dev/ci-required-checks.mdへの required check 手順記載
Remaining Parent Gaps
- なし(本 Issue が docs: session 記録 Kill Switch policy と検証コマンド整備 (session-recording-policy.md) #242 の required check enforcement follow-up を担当する)
Required Skills
- GitHub Actions workflow YAML
- GitHub branch protection / rulesets
- pnpm / Node.js
Background
PR #426(Issue #402)で agent_session_manifest/v1 の hook/CI wiring が完了した。Issue #402 の "Remaining Parent Gaps" に「manifest validation gate を required check に昇格する enforcement は別 follow-up」と明記されており、本 Issue はその follow-up である。
Issue #378 の Out of Scope にも「GitHub branch protection で required check に昇格させる作業」と明記されている。
現状: .github/workflows/session-manifest.yml が artifact を生成するが、manifest が schema validation に通るかどうかを CI の required check として強制していない。
Goal
manifest producer が生成した artifact が agent_session_manifest/v1 schema に適合することを CI の required check として検証し、schema 違反の PR が main にマージされないようにする。
Outcome
.github/workflows/session-manifest.yml に manifest schema validation ステップが追加され、生成 artifact を pnpm manifest:check で検証する required check が CI 上に存在する。schema / semantic 違反の PR は main にマージできない。
Desired Destination
manifest artifact を PR CI の required check で schema validate し、fail した PR が merge できない状態。
In Scope
.github/workflows/session-manifest.ymlまたは新規 workflow に manifest schema validation ステップを追加- validation が fail した場合 workflow を fail させる
- required check への昇格(repository settings / branch protection rule への追加手順を docs に記載)
- job name を
agent-session-manifest / validate-generated-artifactに変更 - artifact 生成後・upload 前に public-safe hard-fail check を追加(absolute path / token-like string / transcript marker)
--phase-instance-idを CI run-specific な値(ci:${{ github.workflow }}:${{ github.run_id }}:${{ github.run_attempt }})に変更- merge queue 使用有無の docs 明示、または
merge_grouptrigger 追加
Out of Scope
- manifest schema 自体の変更(実装: agent_session_manifest/v1 schema に producer フィールドを追加し script_generated / hook_generated / github_action_generated を厳密 enum 表現する #401 で完了済み)
- Secret 管理境界(実装: Claude Code / GitHub Actions の Secret 到達面を上流で制限する secure-secret-boundary を導入する #412 が担当)
- hook wiring 変更(実装: agent_session_manifest/v1 producer を .claude/settings.json hooks と .github/workflows で自動 invoke する #402 で完了済み)
pnpm manifest:checkentrypoint 自体の実装(実装: agent_session_manifest producer output の schema validation gate (pnpm manifest:check) を追加する #378 が担当)
Acceptance Criteria
- AC1:
.github/workflows/session-manifest.ymlに、生成済み manifest artifact をpnpm manifest:check artifacts/<file>.jsonで検証する step が存在する - AC2: validation step は artifact upload より前に実行され、schema / semantic violation 時に job を fail させる
- AC3: required check に登録する exact check context を docs に明記する(check context:
agent-session-manifest / validate-generated-artifact) - AC4: required check 名は全 workflow で一意であり、workflow 名・job_id・job name の違いが docs に明記されている
- AC5: public repo artifact 前提の public-safe hard-fail check が存在する(absolute path / token-like string / transcript/local_file marker)
- AC6: branch protection または ruleset のどちらを SSOT とするかを docs に明記する
- AC7: required check 設定後の確認コマンド、または admin 権限がない場合の stop condition が docs にある
- AC8: merge queue を使う場合は
merge_grouptrigger がある。使わない場合は docs に明示する
Verification Commands
# AC1
$ rg -n 'pnpm manifest:check artifacts/.+\.json' .github/workflows/session-manifest.yml
# AC2
$ rg -n 'pnpm manifest:check' .github/workflows/session-manifest.yml
# AC3
$ rg -rn 'agent-session-manifest / validate-generated-artifact' docs/
# AC4
$ rg -n 'validate-generated-artifact' .github/workflows/session-manifest.yml
# AC5
$ rg -n 'FAIL.*token-like\|token-like.*detected' .github/workflows/session-manifest.yml
# AC6
$ rg -rn 'branch protection\|ruleset' docs/
# AC7
$ rg -rn 'required_status_checks\|admin.*stop condition\|stop condition.*admin' docs/
# AC8
$ rg -rn 'merge_group\|merge queue' .github/workflows/session-manifest.yml docs/Allowed Paths
.github/workflows/session-manifest.yml(job 名変更・validation step 追加・public-safe check 追加・merge_group 対応)docs/dev/session-recording-policy.mdまたはdocs/dev/ci-required-checks.md(required check 手順・exact check context 記載)tests/fixtures/agent-session-manifest/(workflow contract test / invalid fixture、任意)
Stop Conditions
- Allowed Paths 外への変更が必要と判明した場合
pnpm manifest:check自体の実装が必要と判明した場合(実装: agent_session_manifest producer output の schema validation gate (pnpm manifest:check) を追加する #378 に分離)- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格が必要になった場合
- job name 変更が他 workflow の required check 登録と競合すると判明した場合
- merge queue 使用有無の判断が branch protection / ruleset 設定の前提になる場合
Runtime Verification Applicability
decision: not_applicable
rationale: 全 AC が決定論的 script verification (rg / yaml 構造検査) で成立し、外部 CLI / auth / network / fallback semantics を伴わない。
Related
- Parent: docs: session 記録 Kill Switch policy と検証コマンド整備 (session-recording-policy.md) #242
- Anchor PR: feat(#402): wire agent_session_manifest/v1 producer to hooks and CI #426
- Anchor Issue: 実装: agent_session_manifest/v1 producer を .claude/settings.json hooks と .github/workflows で自動 invoke する #402
- Sibling (validation entrypoint): 実装: agent_session_manifest producer output の schema validation gate (pnpm manifest:check) を追加する #378
- Sibling (secret boundary): 実装: Claude Code / GitHub Actions の Secret 到達面を上流で制限する secure-secret-boundary を導入する #412
Source
source: post_merge_cleanup
anchor_pr: "https://github.com/squne121/loop-protocol/pull/426"
anchor_issue: "https://github.com/squne121/loop-protocol/issues/402"
dedupe_key: "402-followup:manifest-validation-gate-required-check"
created_by: post-merge-cleanup
created_at: "2026-05-28T00:00:00Z"
Activity
squne121 commentedon May 31, 2026
判定: REQUEST_CHANGES
#432 は方向性は正しいですが、現状の Issue 契約のまま実装すると「required check に見えるが、実際には生成 artifact を検証していない」「required check 名を誤って設定して merge block が効かない」「public repo artifact の安全性を過信する」リスクがあります。
#432 の目的は、
agent_session_manifest/v1の schema 違反 PR を main に merge できないようにすることです。Issue 本文も、PR #426 / Issue #402 で hook/CI wiring は済みだが、required check enforcement は follow-up だと位置付けています。([GitHub]1) 既存 #402 は GitHub Actions artifact workflow を作り、pull_request_target不使用、read-only permission、artifact upload を導入済みです。([GitHub]2) #378 はpnpm manifest:checkを追加し、.github/workflows/ci.ymlのtestjob に入れる設計です。([GitHub]3)Blockers
B1: required check に設定すべき「check 名」が Issue に定義されていない
GitHub の required status check は、workflow 名ではなく job 名が基準です。GitHub Docs は、workflow check の name format は
<job name>であり、required checks は workflow / matrix / event trigger type を考慮しないと明記しています。([GitHub Docs]4) また、branch protection で required status checks を使う場合、複数 workflow で同じ job name を使うと ambiguous になり PR merge がブロックされ得るため、job name を一意にすべきです。([GitHub Docs]5)現行
.github/workflows/session-manifest.ymlの job name はGenerate agent session manifestです。([GitHub]6) #432 の AC3 は「required check 昇格手順を docs に記載」だけですが、どの check context を required にするのかが未指定です。これは運用者がsession-manifest、generate、Generate agent session manifest、ci / testのどれを選ぶべきか誤る余地を残します。修正案:
docs には required check 名として
agent-session-manifest / validate-generated-artifactをそのまま記載する。job_idとnameを分けるなら、branch protection / ruleset に登録するのはname側であることを明記する。B2: 現行
pnpm manifest:checkは、生成 artifact を既定では検証していない#432 の Goal は「manifest producer が生成した artifact が schema に適合すること」を required check で検証することです。([GitHub]1) しかし現在の
manifest:checkの default target はdocs/schemas/examples/**/*.jsonとtests/fixtures/agent-session-manifest/valid-*だけです。([GitHub]7) つまり、.github/workflows/session-manifest.ymlが生成するartifacts/private-agent-session-manifest-ci.jsonは、明示指定しない限りpnpm manifest:checkの対象外です。現行 workflow は producer を
--validate付きで実行し、stdout を artifact JSON に redirect しています。([GitHub]6) これは一定の validation ですが、#432 が要求している required check としての manifest validation gate には弱いです。#378 が entrypoint として作ったpnpm manifest:checkを、生成 artifact に対して直接走らせるべきです。修正案:
AC1 / AC2 も
rgだけではなく、pnpm manifest:check artifacts/agent-session-manifest-ci.jsonが workflow にあることを要求するべきです。B3: AC2 の検証方法が regex 依存で、実際の fail-close を証明しない
#432 の AC2 は「schema 違反の manifest artifact で workflow が fail する」ですが、Verification Commands は
exit 1|if-no-files-found: error|failをrgするだけです。([GitHub]1) これは「fail と書いてある」ことしか見ません。invalid manifest を実際に validator に食わせて fail する証跡にはなりません。#378 の PR #431 では invalid schema、marker roundtrip、redaction violation、empty target などの test case が実装・検証されています。([GitHub]8) #432 はその成果を利用し、少なくとも workflow 上では生成 artifact を
pnpm manifest:check <artifact>に通す必要があります。より強い AC:
可能なら allowed paths に
tests/を追加し、workflow contract test を置くべきです。現行 #432 の Allowed Paths は workflow と docs だけなので、fail-close の回帰テストを入れにくい設計です。([GitHub]1)B4: branch protection / rulesets の実設定と docs 記載が混同されている
#432 は「required check への昇格」を In Scope に入れつつ、repository settings / branch protection rule への追加手順を docs に記載するとしています。([GitHub]1) しかし GitHub の protected branches は repository settings 側の状態であり、PR のファイル差分だけでは merge block を保証できません。Protected branches は required status checks などの requirements を branch に課す仕組みです。([GitHub Docs]5)
Issue の Desired Destination は「fail した PR が merge できない状態」ですが、AC3 は docs 記載だけなので、実際の repo 設定が変わったかを証明できません。([GitHub]1)
修正案: #432 を二段に分ける。
docs には最低限これを入れるべきです。
GitHub required status checks は、選択対象になるには過去 7 日以内にその repo で成功している必要があるため、初回導入時は workflow を一度成功させてから required check に登録する手順も必要です。([GitHub Docs]9)
B5: merge queue を使う場合、
merge_grouptrigger がないと required check が未報告になるGitHub Docs は、required checks を使う repo で merge queue を使う場合、workflow に
merge_groupevent を追加しないと status check が発火せず、merge が失敗すると説明しています。([GitHub Docs]9) 現行session-manifest.ymlはpushとpull_requestのみです。([GitHub]6)#432 では merge queue の利用有無が未定義です。将来 merge queue を有効化する余地があるなら、今のうちに以下を入れるべきです。
merge queue を使わない方針なら、docs に「merge queue 未使用。使用開始時は
merge_grouptrigger を追加する」と明記する。B6: artifact を「private」と呼ぶ設計は危険。public repo artifact は public-safe 前提で扱うべき
現行 docs は、public repo では GitHub Actions artifact が REST API 経由でアクセス可能であり、「private artifact」は secret-safe を意味しないと明記しています。([GitHub]10) GitHub Docs も、Actions artifacts は REST API で download / delete / retrieve でき、public resources なら認証なしで使える場合があると説明しています。([GitHub Docs]11)
にもかかわらず、現行
session-manifest.ymlの public-safe check は絶対パス検出だけが hard fail で、token-like strings は warning-only です。([GitHub]6) #432 で required check に昇格するなら、warning-only は不十分です。required check は merge gate なので、public artifact に載せてはいけないものは hard fail にする必要があります。修正案:
理想は shell grep ではなく、#378 の semantic validator に public artifact safety rule を寄せることです。
B7: 生成 manifest の provenance が
issue-402:impl:001に固定されている現行 workflow は
--phase-instance-id "issue-402:impl:001"を固定値として渡しています。([GitHub]6) #432 で required check 化するなら、今後の CI artifact がいつまでも Issue #402 の実装 phase を名乗るのは provenance として不正確です。修正案:
--phase-instance-id "ci:${{ github.workflow }}:${{ github.run_id }}:${{ github.run_attempt }}"または PR / issue 番号を持たない CI artifact 用に schema 上の phase instance naming policy を docs に明記する。
望ましい Issue #432 の改訂版 AC
実装方針の最小パッチ
#432 の Allowed Paths を維持するなら、最小変更は以下です。
.github/workflows/session-manifest.ymlpnpm manifest:check artifacts/agent-session-manifest-ci.jsonを追加。phase-instance-idを run-specific に変更。merge_groupを追加。docs/dev/ci-required-checks.mdまたはdocs/dev/session-recording-policy.mdgh apiによる確認コマンドを記載。最終コメント案
squne121 commentedon May 31, 2026
refinement-loop applied anchor comment feedback (B1-B7) from #432 (comment)
Changes applied:
## Outcomesection with concrete post-implementation verification statement## In Scopewith job name change, public-safe hard-fail check,--phase-instance-idCI run-specific value, and merge queue docs/trigger requirement## Acceptance Criteriawith AC1-AC8 (exact check context, uniqueness, public-safe check, SSOT docs, admin stop condition, merge queue)## Verification Commandswith LP016-format bare# AC<N>lines covering all 8 ACs## Allowed Pathsto addtests/fixtures/agent-session-manifest/for regression tests[-]feat: manifest validation gate を required-check に昇格する[/-][+]実装: manifest validation gate を required-check に昇格する[/+]squne121 commentedon May 31, 2026
Contract Snapshot (2026-05-31T05:11:32Z)
.github/workflows/session-manifest.ymlに manifest schema validation step と public-safe hard-fail check が追加され、required check 運用を docs で再現できる状態.github/workflows/session-manifest.yml,docs/dev/session-recording-policy.mdordocs/dev/ci-required-checks.md,tests/fixtures/agent-session-manifest/.claude/worktrees/issue-432-manifest-validation-gate-required-checkworktree-issue-432-manifest-validation-gate-required-checksqune121 commentedon May 31, 2026
はい。少なくとも添付ログの #432 については、create-issue / edit-issue 側で Issue の ready tuple 正規化が漏れている疑いが強いです。
根拠は次です。
feat: manifest validation gate を required-check に昇格するenhancementのみimpl-review-loopは実装:/implement:prefix とphase/implementationlabel を要求つまり、本文 contract は整っているのに、Issue の外側メタデータだけ canonical ready tuple に同期されていない状態です。
修正対象としてはこう切るのが妥当です。
さらに、
edit-issueには次の postcondition を入れるべきです。今回の #432 でいえば、最低限の修正はこれです。
ただし、これだけでは完全ではなく、ログ上は
CONTRACT_REVIEW_RESULT_V1 status: goコメントも未 materialize なので、issue-contract-reviewの正式実行も別途必要です。件名・ラベル漏れは create/edit の責務、contract snapshot 未作成は review flow の責務、と分けて直すのがよいです。fix: keep CI manifest phase_instance_id schema-compatible (#432)
squne121 commentedon May 31, 2026
implement-issue: 実装完了 (2026-05-31T05:27:00Z)
.claude/worktrees/issue-432-manifest-validation-gate-required-checkworktree-issue-432-manifest-validation-gate-required-checkrg -n 'pnpm manifest:check artifacts/.+\.json' .github/workflows/session-manifest.yml: PASSrg -n 'pnpm manifest:check' .github/workflows/session-manifest.yml: PASSrg -n 'agent-session-manifest / validate-generated-artifact' docs/: PASSrg -n 'validate-generated-artifact' .github/workflows/session-manifest.yml: PASSrg -n 'FAIL.*token-like\|token-like.*detected' .github/workflows/session-manifest.yml: PASSrg -n 'branch protection\|ruleset' docs/: PASSrg -n 'required_status_checks\|admin.*stop condition\|stop condition.*admin' docs/: PASSrg -n 'merge_group\|merge queue' .github/workflows/session-manifest.yml docs/: PASSpnpm typecheck: PASSpnpm lint: PASSpnpm test: PASS (15 files / 266 tests)pnpm build: PASSfix: narrow manifest transcript marker detection (#432)
fix(#432): address review blockers — artifact rename, belt-and-suspen…
ci: retrigger checks for branch protection evaluation (#432)
feat: enforce manifest validation required check (#432) (#540)