Repository navigation
feat(#547): extend phase_instance_id to accept CI-native ci:<slug>:<run_id>:<run_attempt> - #551
Conversation
…slug>:<run_id>:<run_attempt> format
Extends `phase_instance_id` in agent_session_manifest/v1 schema from the
single `issue-<N>:<phase>:<seq>` pattern to a two-format non-capturing group:
`^(?:issue-[0-9]+:[a-z_]+:[0-9]{3}|ci:[a-z0-9_.-]+:[1-9][0-9]*:[1-9][0-9]*)$`
This eliminates the 1000-collision limit introduced in #540 (where run_id %
1000 was used as a 3-digit seq) by letting CI workflows emit a fully unique
`ci:session-manifest:<run_id>:<run_attempt>` identifier instead.
Changes:
- docs/schemas/agent-session-manifest.schema.json: new dual-format pattern +
updated description noting producer_slug is a fixed slug, not workflow name
- scripts/generate-session-manifest.mjs: validatePhaseInstanceId uses same
pattern; --help and invalid-format errors now list both formats
- .github/workflows/session-manifest.yml: replaces PHASE_SEQ derivation with
--phase-instance-id ci:session-manifest:${{ github.run_id }}:${{ github.run_attempt }}
- tests/agent-session-manifest-phase-instance-id.test.ts: 11 new tests
covering AC1 (CI valid), AC2 (legacy valid), AC3 (malformed rejected)
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Verification Results for Issue #547All Acceptance Criteria verified successfully in worktree branch Verification Summary
Quality Gate Results
TEST_VERDICT:
result: PASS
mergeable: MERGEABLE
merge_state_status: BLOCKED
baseline_only: false
verification_commands_pass: 7
verification_commands_fail: 0
verification_commands_skip: 1
runtime_ac_results: []Implementation Details
|
squne121
left a comment
There was a problem hiding this comment.
Verdict: REQUEST_CHANGES
Mergeability
- mergeable=MERGEABLE, mergeStateStatus=CLEAN
Note: TEST_VERDICT_MACHINE recorded merge_state_status: BLOCKED, but gh pr view returns CLEAN. Using current API value (CLEAN).
Evidence Check
- AC coverage: 8/8 covered. AC7 is deferred (runtime_only) with CI
validate-generated-artifactjob passing on head SHA 14bd681. - Allowed Paths: All 4 changed files within allowed paths.
- CI Verification: All checks pass (build, e2e, lint, python-test, test, typecheck, validate-generated-artifact) on head SHA 14bd681.
- 検証コマンド結果: TEST_VERDICT_MACHINE (v1) present, 7 pass / 1 skip (AC7 runtime_only deferred). Quality gates (typecheck/lint/test/build) all PASS.
Blockers
-
Schema Change Applicability section missing (Step 4.5):
docs/schemas/agent-session-manifest.schema.jsonisagent_session_manifest/v1— an Initial Known Schema indocs/dev/schema-governance.md. PR diff modifies this schema'sphase_instance_idpattern. A## Schema Change Applicabilitysection withschema_change_applicability: schema_change(ornot_schema_changewith justification) is required perPR_REVIEW_JUDGE_APPROVE_PROHIBITION_SKIP_FALLBACK. -
Schema Consumer Inventory section missing (Step 4.5): The
agent_session_manifest/v1schema lists consumers: pr-review-judge, impl-review-loop, pilot smoke test issue, future aggregation script. A## Schema Consumer Inventorysection must be present listing each consumer, the before/after diff (pattern change), and update status perschema-governance.md. This is an additive/compatible change (new format added, old format preserved), but the consumer inventory must be documented. -
Safety Claim Matrix section missing (Step 4.6):
.github/workflows/session-manifest.ymlmatches.github/workflows/**, triggering the safety-sensitive path rule. A## Safety Claim Matrixsection is required with columns: Claim / Implemented? / Not controlled / Evidence / Follow-up.
Non-blockers
- AC7
verification_commands_skip: 1in TEST_VERDICT_MACHINE: The CIvalidate-generated-artifactjob passed on the same head SHA (run 26753571325, conclusion=success), providing CI_CHECK_RUN_SCOPED evidence for the runtime_only deferred AC. This is not treated as an additional blocker given the explicit deferred contract and passing CI evidence.
LOOP_VERDICT
verdict: REQUEST_CHANGES
blockers:
- schema_change_applicability_section_missing
- schema_consumer_inventory_section_missing
- safety_claim_matrix_section_missing
mergeable: MERGEABLE
mergeStateStatus: CLEAN
reviewed_head_sha: 14bd681a677dd4becdf160a5ed15ccd8673483f7
recommendations: []
follow_up_issue_requests: []
squne121
left a comment
There was a problem hiding this comment.
Verdict: REQUEST_CHANGES
Mergeability
- mergeable=MERGEABLE, mergeStateStatus=CLEAN
Note: TEST_VERDICT_MACHINE recorded merge_state_status: BLOCKED, but gh pr view returns CLEAN. Using current API value (CLEAN).
Evidence Check
- AC coverage: 8/8 covered. AC7 is deferred (runtime_only) with CI
validate-generated-artifactjob passing on head SHA 14bd681. - Allowed Paths: All 4 changed files within allowed paths.
- CI Verification: All checks pass (build, e2e, lint, python-test, test, typecheck, validate-generated-artifact) on head SHA 14bd681.
- 検証コマンド結果: TEST_VERDICT_MACHINE (v1) present, 7 pass / 1 skip (AC7 runtime_only deferred). Quality gates (typecheck/lint/test/build) all PASS.
Blockers
-
Schema Change Applicability section missing (Step 4.5):
docs/schemas/agent-session-manifest.schema.jsonisagent_session_manifest/v1— an Initial Known Schema indocs/dev/schema-governance.md. PR diff modifies this schema'sphase_instance_idpattern. A## Schema Change Applicabilitysection withschema_change_applicability: schema_change(ornot_schema_changewith justification) is required perPR_REVIEW_JUDGE_APPROVE_PROHIBITION_SKIP_FALLBACK. -
Schema Consumer Inventory section missing (Step 4.5): The
agent_session_manifest/v1schema lists consumers: pr-review-judge, impl-review-loop, pilot smoke test issue, future aggregation script. A## Schema Consumer Inventorysection must be present listing each consumer, the before/after diff (pattern change), and update status perschema-governance.md. This is an additive/compatible change (new format added, old format preserved), but the consumer inventory must be documented. -
Safety Claim Matrix section missing (Step 4.6):
.github/workflows/session-manifest.ymlmatches.github/workflows/**, triggering the safety-sensitive path rule. A## Safety Claim Matrixsection is required with columns: Claim / Implemented? / Not controlled / Evidence / Follow-up.
Non-blockers
- AC7
verification_commands_skip: 1in TEST_VERDICT_MACHINE: The CIvalidate-generated-artifactjob passed on the same head SHA (run 26753571325, conclusion=success), providing CI_CHECK_RUN_SCOPED evidence for the runtime_only deferred AC. This is not treated as an additional blocker given the explicit deferred contract and passing CI evidence.
LOOP_VERDICT
verdict: REQUEST_CHANGES
blockers:
- schema_change_applicability_section_missing
- schema_consumer_inventory_section_missing
- safety_claim_matrix_section_missing
mergeable: MERGEABLE
mergeStateStatus: CLEAN
reviewed_head_sha: 14bd681a677dd4becdf160a5ed15ccd8673483f7
recommendations: []
follow_up_issue_requests: []
squne121
left a comment
There was a problem hiding this comment.
Verdict: REQUEST_CHANGES
Mergeability
- mergeable=MERGEABLE, mergeStateStatus=CLEAN
Evidence Check
- AC coverage: 8/8 addressed (AC7 deferred/runtime_only with CI validate-generated-artifact PASS on head SHA 14bd681)
- Allowed Paths: 遵守(4 files, all within Allowed Paths)
- CI Verification: all 7 checks pass on head SHA 14bd681 (build/e2e/lint/python-test/test/typecheck/validate-generated-artifact)
- TEST_VERDICT_MACHINE: present, verification_commands_pass=7, skip=1 (AC7 runtime_only/deferred — satisfying deferred_verification_condition confirmed via validate-generated-artifact CI pass)
- 前回 blockers (Schema Change Applicability section, Safety Claim Matrix section): 両セクションが PR body に追加済み
Blockers
B1: Schema Consumer Inventory — rg command output missing (APPROVE_PROHIBITED)
Skill rule: "consumer 列挙コマンド(rg 等)の出力結果が PR 本文に含まれていない → APPROVE 禁止"
## Schema Consumer Inventory セクションは存在するが、rg 等による consumer 検索コマンドの実行結果が PR 本文に含まれていない。consumer table のみでは不十分。
schema-governance.md の agent_session_manifest/v1 detection pattern:
rg -n "agent_session_manifest/v1\|agent_session_manifest:v1\|agent-session-manifest" .
の出力結果を PR 本文に追加してください。
B2: Safety Claim Matrix — 必須列が不足 (APPROVE_PROHIBITED)
Skill rule: "Safety Claim Matrix の必須列: Claim / Implemented? / Not controlled / Evidence / Follow-up"
現在の matrix は 対象ファイル / 変更内容 / Safety 影響 / Claim 列を持つが、Implemented? / Not controlled / Evidence / Follow-up 列が存在しない。
.github/workflows/ パスへの変更により safety-sensitive PR と判定される。Not controlled 列と Evidence 列が存在しないため、APPROVE 禁止条件(Not controlled 評価・Evidence と VC の対応確認)を検証できない。
必須5列(Claim / Implemented? / Not controlled / Evidence / Follow-up)を含む形式に更新してください。本 PR の場合、Not controlled は空(workflow の ID 生成変更のみで security boundary 変更なし)、Evidence は pnpm test 288 passed / validate-generated-artifact CI pass を指すことが想定されます。
Non-blockers
なし(前回指摘の3セクション追加・CI pass・AC coverage はすべて解消)
LOOP_VERDICT
LOOP_VERDICT:
verdict: REQUEST_CHANGES
blockers:
- id: B1
rule: SCHEMA_CONSUMER_INVENTORY_RG_OUTPUT_MISSING
summary: "Schema Consumer Inventory に rg コマンド出力結果が含まれていない"
- id: B2
rule: SAFETY_CLAIM_MATRIX_REQUIRED_COLUMNS_MISSING
summary: "Safety Claim Matrix の必須列 (Implemented? / Not controlled / Evidence / Follow-up) が存在しない"
mergeable: MERGEABLE
mergeStateStatus: CLEAN
reviewed_head_sha: 14bd681a677dd4becdf160a5ed15ccd8673483f7
recommendations: []
follow_up_issue_requests: []
squne121
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Mergeability
- mergeable=MERGEABLE, mergeStateStatus=CLEAN
Evidence Check
- AC coverage: 8/8 — AC1-AC6 and AC8 PASS; AC7 deferred per Issue #547 contract (decision: deferred, destination: validate-generated-artifact CI step, CI check passed on head SHA 14bd681)
- Allowed Paths: compliant — all changed paths (docs/schemas/agent-session-manifest.schema.json, .github/workflows/session-manifest.yml, scripts/generate-session-manifest.mjs, tests/) are within Allowed Paths
- CI Verification: all 7 checks pass on head SHA 14bd681 (runs 26753571393 / 26753571325, conclusion=success); validate-generated-artifact satisfies deferred AC7 condition
- TEST_VERDICT_MACHINE: present, head SHA matches, verification_commands_pass=7, verification_commands_skip=1 (AC7 with explicit deferred waiver in contract)
Iteration 2 Blockers (resolved)
- Schema Consumer Inventory — rg コマンド出力が追加済み (7 lines of actual output)
- Safety Claim Matrix — 5 列形式 (Claim / Implemented? / Not controlled / Evidence / Follow-up) に修正済み
Blockers
なし
Non-blockers
なし
LOOP_VERDICT
verdict: APPROVE
blockers: []
mergeable: MERGEABLE
mergeStateStatus: CLEAN
reviewed_head_sha: 14bd681a677dd4becdf160a5ed15ccd8673483f7
recommendations: []
follow_up_issue_requests: []
判定: APPROVE寄り。ただし Draft 解除前に 1 件だけ補強推奨現状の実装は、Issue #547 の目的である「 良い点
schema 側も旧 関連 Issue との整合も概ね取れています。#547 は 敵対的に見た懸念Blocker ではないが、CLI integration test が薄いです。 追加するなら、以下の 3 ケースで十分です。 it('generator accepts CI-native phase_instance_id with --validate', async () => {
const result = await execa('node', [
'scripts/generate-session-manifest.mjs',
'--repository', 'squne121/loop-protocol',
'--phase-main-loop', 'impl',
'--phase-ledger-phase', 'post_commit_verification',
'--phase-instance-id', 'ci:session-manifest:12345678:1',
'--actor-type', 'github_action',
'--actor-name', 'session-manifest-workflow',
'--evidence-source-kind', 'ci_check',
'--evidence-source-ref', 'https://github.com/squne121/loop-protocol/actions/runs/12345678',
'--evidence-visibility', 'private_artifact',
'--format', 'json',
'--validate',
])
const manifest = JSON.parse(result.stdout)
expect(manifest.phase.phase_instance_id).toBe('ci:session-manifest:12345678:1')
})加えて、invalid case と help/error 文言も実行テストにしてください。 // invalid
ci:session-manifest:0:1
ci:session-manifest:12345678:0
ci:session manifest:12345678:1
// help / stderr
issue-<N>:<phase>:<seq>
ci:<producer_slug>:<run_id>:<run_attempt>
CI に Node.js 20 action deprecation warning が出ています。 GitHub に貼るレビュー案## Verdict: APPROVE with non-blocking test hardening
#547 の主目的である `phase_instance_id` の CI-native 化は満たしています。旧 `issue-<N>:<phase>:<seq>` 形式を維持したまま、schema / generator / workflow が `ci:<producer_slug>:<run_id>:<run_attempt>` を受け付けるようになっており、#540 の `(run_id + run_attempt) % 1000` による衝突リスクは解消されています。
Blocker はありません。
Non-blocking:
1. `tests/agent-session-manifest-phase-instance-id.test.ts` は schema validation 中心なので、generator CLI を実際に spawn する integration test を追加すると品質が上がります。
- positive: `node scripts/generate-session-manifest.mjs ... --phase-instance-id ci:session-manifest:12345678:1 --validate` が exit 0
- negative: `ci:session-manifest:0:1`, `ci:session-manifest:12345678:0`, `ci:session manifest:12345678:1` が exit 1
- help/error: `issue-<N>:<phase>:<seq>` と `ci:<producer_slug>:<run_id>:<run_attempt>` の両方を含む
2. `producer_slug` は schema 上は任意 `[a-z0-9_.-]+` なので、「session-manifest 固定」ではなく「固定 slug を使う producer registry 形式」として扱うのが正確です。session-manifest のみ許可したい場合は別 Issue で schema を狭めてください。
3. Checks に Node.js 20 action deprecation warning が出ているため、別 Issue で Node 24 対応を追うとよいです。
LOOP_VERDICT:
verdict: APPROVE
blockers: []
recommendations:
- add_generator_cli_integration_tests_for_ci_phase_instance_id
- track_node20_action_deprecation_as_followupこのままなら「Draft を解除して merge 可」でよいです。CLI integration test は merge 前に入れられるなら入れた方が堅いですが、現行 PR の scope では blocker 扱いにしません。 |
… ci-native format - AC4: positive test — generator --validate accepts ci:session-manifest:12345678:1 and issue-432:impl:001 - AC4 negative: run_id=0, run_attempt=0, space-in-slug all exit non-zero - AC5: --help output and invalid-format error message both list issue-<N>:<phase>:<seq> and ci:<producer_slug>:<run_id>:<run_attempt> Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Closes #547
Summary
docs/schemas/agent-session-manifest.schema.json:phase_instance_idpattern extended from singleissue-<N>:<phase>:<seq>to dual-format non-capturing group^(?:issue-[0-9]+:[a-z_]+:[0-9]{3}|ci:[a-z0-9_.-]+:[1-9][0-9]*:[1-9][0-9]*)$scripts/generate-session-manifest.mjs:validatePhaseInstanceIdupdated to same pattern;--helpand invalid-format error messages now list both formats withproducer_slugnote.github/workflows/session-manifest.yml:PHASE_SEQderivation removed; replaced with--phase-instance-id ci:session-manifest:${{ github.run_id }}:${{ github.run_attempt }}tests/agent-session-manifest-phase-instance-id.test.ts: 11 new tests (AC1 positive, AC2 backward-compat, AC3 negative cases, AC8 additional variants)Schema Change Applicability
issue-<N>:<phase>:<seq>形式は変更なし。既存 document は引き続き新 pattern を満たすci:<producer_slug>:<run_id>:<run_attempt>Schema Consumer Inventory
Consumer enumeration コマンド実行結果:
scripts/generate-session-manifest.mjs--phase-instance-id引数として受け取りscripts/validate-agent-session-manifest.mjsissue-<N>:...:000形式は引き続き validscripts/check-agent-session-manifests.mjspnpm manifest:checkentrypoint.github/workflows/session-manifest.yml--phase-instance-idに値を渡すci:session-manifest:${{ github.run_id }}:${{ github.run_attempt }}に更新済みtests/agent-session-manifest-producer.test.tsschema: 'agent_session_manifest/v1'docs/schemas/agent-session-manifest.mdSafety Claim Matrix
対象:
.github/workflows/session-manifest.yml(PHASE_SEQ生成ロジック →ci:session-manifest:${{ github.run_id }}:${{ github.run_attempt }}に置換)phase_instance_idの値が schema の新 pattern `^(?:issue-...ci:session-manifest:${{ github.run_id }}:${{ github.run_attempt }}を生成github.run_id/github.run_attemptの値は GitHub Actions が保証(ワークフロー外からの注入は不可)validate-generated-artifactCI step が artifact を schema check する。pnpm manifest:checkの exit code で確認issue-<N>:<phase>:<seq>形式が引き続き valid である(後方互換)rg -n "issue-[0-9].*ci:" docs/schemas/agent-session-manifest.schema.jsonexit 0PHASE_SEQベースの 1000 通り衝突リスクが解消されるrun_id(リポジトリ内一意)+run_attemptの組み合わせで事実上無制限run_id一意性は GitHub が保証PHASE_SEQ行が削除されci:session-manifest:...に置換)Verification
pnpm typecheckpnpm lintpnpm testpnpm builduv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.pyAC VC Results
rg -n "ci:[a-z0-9_\.-]" docs/schemas/agent-session-manifest.schema.jsonrg -n "issue-[0-9].*ci:" docs/schemas/agent-session-manifest.schema.jsonrg -n "[1-9][0-9]" docs/schemas/agent-session-manifest.schema.jsonrg -n "ci:session-manifest" scripts/generate-session-manifest.mjsrg -n "producer_slug" scripts/generate-session-manifest.mjsrg -n "ci:session-manifest" .github/workflows/session-manifest.ymlrg -rn "ci:session-manifest" tests/Allowed Paths Compliance
All changes are within Allowed Paths:
docs/schemas/agent-session-manifest.schema.json.github/workflows/session-manifest.ymlscripts/generate-session-manifest.mjstests/Contract Snapshot
#547 (comment)
AC7 (deferred)
AC7 (
pnpm manifest:check artifacts/agent-session-manifest-ci.json) is deferred to CI run per contract. Thesession-manifestworkflow'svalidate-generated-artifactstep will generate an artifact withphase_instance_id: ci:session-manifest:<run_id>:<run_attempt>and runpnpm manifest:checkagainst it.