Repository navigation
Closed
Labels
agent/implementerAI implementer agentarea/ai-opsAI operations and agent tooling areaenhancementNew feature or requestphase/implementationImplementation phaseworkflowWorkflow / skill automation changes
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "#928"
goal_ref: "agent_retro_index の canonical parent marker と trusted post-merge workflow を deterministic に固定する"
change_kind: mixedParent Issue
Parent Goal Ref
- Goal: merged PR / Issue / run report / manifest artifact / follow-up issue を横断参照する
agent_retro_index/v1を再生成し、parent issue から辿れる状態にする。 - Desired Destination: retro index の canonical payload / source comment set / trusted write pipeline が partial / ambiguous / orphan / blocked を区別しつつ、最小権限で parent marker comment を更新できる。
Current Validated Scope
- retro index builder script と helper を追加する。
.github/workflows/agent-retro-index.ymlを trusted context のみで設計する。agent_retro_index:v1/agent_retro_index_digest:v1の parent marker comment upsert を追加する。- source comment set digest と canonical index digest を workflow summary / parent marker comment に記録する。
Remaining Parent Gaps
- ChatGPT context export は 実装: export-chatgpt-context.mjs を追加し ChatGPT投入用 context bundle を生成する #939 で扱う。
- docs/skill handoff は 実装: agent-run-report.md / agent-retro-index.md と skill handoff を整備する #940 で扱う。
- EntireCLI safety は 実装: EntireCLI safety checker と conditional adoption guard を追加する #941 で扱う。
-
agent_retro_index/v1schema 自体の key set migration が必要になった場合は follow-up Issue に分離する。
Outcome
retro index builder、専用 comment helper、workflow、tests、package wiring が 1 PR で追加され、現行 agent_retro_index/v1 schema を維持したまま partial / ambiguous / orphan / blocked を区別して dry-run 再生成でき、trusted workflow が parent issue の canonical marker comment を最小権限で update-or-noop できる状態。
In Scope
- report comment 群から
agent_retro_index/v1payload を再生成する deterministic builder。 agent_run_reportmarker とは別 namespace の retro index parent marker / digest marker。- trusted
workflow_dispatch/ post-merge context のみを使う workflow。 - canonical index digest、source comment set digest、artifact digest の分離。
merge_sha -> associated PR API -> PR closing keywords -> machine-readable refs -> parent child list -> branch hintの順に解決する trust hierarchy。partialとblockedの厳密分類。- artifact は補助面、parent marker comment は永続正本とする設計。
Out of Scope
- ChatGPT bundle export。
- docs / skill handoff 更新。
- EntireCLI safety checker。
docs/schemas/agent-retro-index.schema.jsonの key set 変更。- shared
agent_run_reportmarker namespace への統合。
Acceptance Criteria
- AC1: 現行
agent_retro_index/v1schema を維持した payload が Child 1 schema を通る。 - AC2: PR / Issue 解決順序が
merge_sha -> associated PR API -> PR closing keywords -> machine-readable refs -> parent child list -> branch hintの固定順で解決され、branch pattern は weak hint としてのみ使われる。 - AC3: 複数候補・未解決候補は
ambiguous_links[]/orphan_reports[]に入り、non-authoritative な欠落はgeneration_verdict: partialになる。 - AC4: workflow は
workflow_dispatchと trusted post-merge context のみを使い、pull_request_targetを使わない。 - AC5: workflow は top-level
permissions: {}を維持し、read-only build job と write-enabled upsert job を分離する。 - AC6: artifact は補助生成のみで、永続正本は parent issue の marker comment である。
- AC7: workflow / CLI / helper は report・index・GitHub API response body の全文を stdout/stderr に出さず、summary-only 出力に制限する。
- AC8: canonical index digest と source comment set digest が
agent_retro_index_digest:v1marker と workflow summary に記録され、index JSON 本体へ未定義 key を追加しない。 - AC9:
agent_retro_index:v1parent marker とagent_retro_index_digest:v1digest marker をagent_run_reportmarker とは別 namespace で定義し、0件 create / 1件 update-or-noop / 2件以上 fail-closed にする。 - AC10:
generation_verdict=partialは orphan / ambiguous / non-authoritative missing data のみに使い、permission failure / validator failure / digest mismatch / duplicate marker はblockedにする。 - AC11: canonical index digest、source comment set digest、artifact digest を別々に扱い、write job は artifact download 後に schema validation と digest verification を再実行する。
- AC12: source comment set が retro index の trust boundaryを越える場合、full body を公開せず summary-only JSON と marker comment のみを出力する。
- AC13: retro index posting は専用 helper 経由で行い、shared
agent_run_reportownership tuple を再利用しない。 - AC14: 現行
agent_retro_index/v1schema に存在しない key が必要と判明した場合は、この Issue では実装せず follow-up Issue に分離して停止する。
Verification Commands
# AC1
# preflight-scope: pr_review_only
$ pnpm test
# AC2
# preflight-scope: pr_review_only
$ pnpm test
# AC3
# preflight-scope: pr_review_only
$ pnpm test
# AC4
# preflight-scope: pr_review_only
$ rg -n "workflow_dispatch|pull_request_target" .github/workflows/agent-retro-index.yml
# AC5
# preflight-scope: pr_review_only
$ rg -n "permissions: \\{\\}|contents: read|issues: read|issues: write|pull-requests: read|pull-requests: write" .github/workflows/agent-retro-index.yml
# AC6
# preflight-scope: pr_review_only
$ pnpm test
# AC7
# preflight-scope: pr_review_only
$ rg -n "cat .*report|cat .*index|JSON\\.stringify\\(.*index|tee .*index|jq \\.|set -x|gh api .*--verbose" .github/workflows/agent-retro-index.yml scripts/agent-logs/update-retro-index.mjs scripts/agent-logs/lib/retro-index-builder.mjs scripts/agent-logs/lib/retro-index-comment-helper.mjs
# AC8
# preflight-scope: pr_review_only
$ pnpm test
# AC9
# preflight-scope: pr_review_only
$ pnpm test
# AC10
# preflight-scope: pr_review_only
$ pnpm test
# AC11
# preflight-scope: pr_review_only
$ pnpm test
# AC12
# preflight-scope: pr_review_only
$ pnpm test
# AC13
# preflight-scope: pr_review_only
$ rg -n "agent_retro_index:v1|agent_retro_index_digest:v1|agent_run_report:v1" scripts/agent-logs/update-retro-index.mjs scripts/agent-logs/lib/retro-index-builder.mjs scripts/agent-logs/lib/retro-index-comment-helper.mjs tests/agent-logs/retro-index-comment-marker.test.ts
# AC14
# preflight-scope: pr_review_only
$ rg -n "schema migration|follow-up Issue|docs/schemas/agent-retro-index.schema.json" tests/agent-logs/retro-index-schema.test.ts scripts/agent-logs/update-retro-index.mjs scripts/agent-logs/lib/retro-index-builder.mjs scripts/agent-logs/lib/retro-index-comment-helper.mjsAllowed Paths
scripts/agent-logs/update-retro-index.mjsscripts/agent-logs/lib/retro-index*.mjs.github/workflows/agent-retro-index.ymltests/agent-logs/retro-index*.test.tspackage.json
Runtime Verification Applicability
decision: deferred
reason: "workflow write 実体確認は merge 後 trusted context が必要なため、local 実装では dry-run・static workflow inspection・artifact revalidation を success criteria にする"
deferred_destination:
- destination_type: issue
destination_ref: "#928"
deferred_verification_condition: "trusted post-merge context で parent issue marker upsert を実行できる状態になった後に live verification する"Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- trusted context 以外で write 権限を使わないと成立しないことが判明した場合
docs/schemas/agent-retro-index.schema.jsonの key set 変更が必要と判明した場合- shared
scripts/agent-logs/lib/github-comments.mjsを直接変更しないと成立しないことが判明した場合
Required Skills
- GitHub Actions / JavaScript
Scope Delta(任意)
- 現行 schema を維持するため、digest / source refs は index JSON 本体ではなく parent marker comment / workflow summary に記録する。
Delivery Rule
1 Issue = 1 PRで完了する。- Draft PR を既定とする。
- live workflow write の成立確認は deferred verification に分離する。
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentarea/ai-opsAI operations and agent tooling areaenhancementNew feature or requestphase/implementationImplementation phaseworkflowWorkflow / skill automation changes
Activity
squne121 commentedon Jun 18, 2026
結論
#938 は方向性自体は妥当ですが、このまま実装に渡すと 「AC は通るが、retro index として信頼できない」false green を作れます。特に重大なのは、#938 が「source comment refs と generated index digest を記録する」と要求している一方、既存の
agent_retro_index/v1schema はadditionalProperties: falseで、index-level のgenerated_at、repository、parent_issue、source_comment_refs、index_digest、algorithm_versionを受け付けない構造になっている点です。これは #938 の AC8 と schema 実体が衝突しています。#938 自体にコメントはありません。したがってレビュー対象は Issue 本文、親 #928、前段 Issue/PR、既存 schema/posting 実装、GitHub Actions/GitHub API の公式仕様です。
参照した関連 Issue / PR
親 #928 は、
agent_session_manifest/v1を provenance / validation / evidence index として残し、ChatGPT 改善検討用にagent_run_report/v1とagent_retro_index/v1を追加する delivery-rollup です。raw transcript、local path、secret 類は GitHub public surface に出さず、redacted report/index を Issue / PR comment に marker upsert で永続保存する設計です。前段 #934 は manifest 本文を Issue/PR comment に出さない境界を docs 側で固定し、redacted report/index だけを条件付き public comment 可にする整理です。
#935 / PR #955 は
agent_run_report/v1/agent_retro_index/v1schema と validator を追加し、retro index は report 本文の inline copy を禁止して、report_comment_url、report_digest、issue、pr、merge_sha、tags、friction_summary、quality_signals、follow_up_issues、orphan_reports、ambiguous_links、generation_verdictのような集約 field に閉じる方針です。#936 / PR #968 は lifecycle CLI を追加し、transcript 本文・local path・raw stdout/stderr を扱わず report を生成する前段です。
#937 / PR #977 は
agent_run_report/v1用の GitHub comment posting surface を追加し、stable ownership marker と digest marker、marker-addressed upsert、dry-run、duplicate fail-closed、permission/404/410/422/pagination test を固定しています。#939 は ChatGPT 投入用 context bundle、#940 は docs / skill handoff、#941 は EntireCLI safety checker で、いずれも #938 からは out of scope です。
敵対的レビュー
Blocker 1: #938 の AC8 は現行 schema では満たせない
#938 は「source comment refs と digest を index に保存する」「generated index の digest と source comment refs が記録される」ことを要求しています。ところが現行
agent-retro-index.schema.jsonの required key はschema、generation_verdict、entries、orphan_reports、ambiguous_linksだけで、additionalProperties: falseです。つまりsource_comment_refsやindex_digestを JSON index 本体へ追加できません。これは実装者が「digest marker は parent comment 側にあるから AC8 達成」と解釈して false green にできます。修正は二択です。
実装: agent_retro_index/v1 の canonical parent marker と trusted post-merge workflow を追加する #938 の scope を変更し、schema migration を別 Issue に分離する。
実装: agent_retro_index/v1 の canonical parent marker と trusted post-merge workflow を追加する #938 の AC8 を「index JSON 本体ではなく、parent marker comment の digest marker と workflow summary の source set digest に記録する」と明文化する。
ただし #938 の stop condition には schema / key set 変更が必要なら停止とあるため、現状のままでは実装途中で stop するのが正しいです。
Blocker 2:
agent_run_report用 upsert helper をそのまま使うと marker ownership が混線する#977 は
agent_run_report:v1の ownership marker と digest markerを追加しています。marker はagent_run_report:v1 repo=... issue=... pr=... run_id=...形式で、digest marker もagent_run_report_digest:v1です。#938 で parent issue に保存すべき正本は
agent_retro_index/v1です。ここで #977 の marker を再利用すると、parent comment 上で「run report」と「retro index」の所有権が同じ namespace になり、upsert 対象の取り違え・duplicate 判定漏れ・将来の export 側誤読が起きます。#938 には独立 marker が必要です。推奨 marker:
agent_run_reportの marker helper は参考実装として使ってよいですが、marker namespace は絶対に分けるべきです。Blocker 3: PR → Issue 解決順が「決定的」だが「信頼度階層」になっていない
#938 は
Linked PR/Closes #N/ branch pattern / parent issue refs / API linked data の固定順で解決するとしています。しかし、この順序は危険です。branch pattern は人間・AI が容易に間違えますし、parent issue refs は child list や tracker 構造と混ざります。GitHub API の commit-associated pull request endpoint は、default branch 上の commit について「その commit を入れた merged PR」を返せるため、post-merge workflow の PR 特定にはこちらを優先すべきです。(GitHub Docs)
推奨順序は次です。
validated
agent_run_reportの marker / payload にある target issue / PR。merge commit SHA → associated PR API。
PR body の
Closes|Fixes|Resolves #N。PR body / report body の machine-readable
Linked PR/Linked Issuefield。parent 導入: ChatGPT改善検討用のAI作業ログレポートをGitHubに永続保存する #928 の child issue list。
branch pattern。これは weak hint 扱い。
GitHub UI/API linked data。これは enrichment 扱いで、既存決定を上書きしない。
複数候補が出た場合は
ambiguous_links[]に入れてgeneration_verdict: partial。ただし validator failure、digest mismatch、permission failure、duplicate parent marker はpartialではなくblockedです。Blocker 4: workflow の write 権限分離が AC だけでは足りない
GitHub Actions の
permissionsは top-level / job-level で指定でき、明示した permission 以外はnoneになります。最小権限にするには top-levelpermissions: {}と job-level permission を分離する必要があります。(GitHub Docs) (GitHub Docs)#938 は top-level
permissions: {}と job-levelcontents: read,issues: write,pull-requests: writeを要求していますが、read-only index generation job と write comment job を分ける AC がありません。Issue comment の create/update には Issues または Pull requests の write permission が必要です。(GitHub Docs)推奨 workflow 構造:
pull_request_targetは使わない方針で正しいです。GitHub はpull_request_targetについて、default branch context で動き、untrusted code を checkout/build/run すると cache poisoning や write token / secret access の危険があると警告しています。(GitHub Docs)High 1: artifact digest を使うなら、canonical comment digest と混同してはいけない
actions/upload-artifactは artifact の SHA-256 digest output を持ちます。(GitHub)ただし artifact は補助面であり、#928 / #938 の正本は parent issue marker comment です。artifact digest は「build job が作った一時ファイルの検査値」で、parent comment の canonical payload digest とは別物として扱うべきです。
必要な digest は最低3つです。
この3つを混ぜると、artifact を再生成しただけで正本 digest が変わる、または入力 comment が変わったのに index payload が更新されない、という監査不能状態になります。
High 2: 「workflow log に cat しない」だけでは漏洩防止にならない
#938 の AC7 は
cat .*report|cat .*indexを grep しています。これは弱いです。
console.log(JSON.stringify(index))、gh apiの response body、Node の uncaught exception、Ajv error の raw value、shellset -x、tee、jq .でも同じ漏洩が起きます。AC7 は次に拡張すべきです。
さらに、CLI は成功時も
status,entry_count,orphan_count,ambiguous_count,canonical_index_digest,source_comment_set_digestだけを出し、本文は stdout/stderr に出さない設計にするべきです。High 3:
partialverdict の濫用で安全エラーを品質劣化に見せられる#938 は ambiguity / orphan を
partialにする設計です。これは正しいですが、permission denied、validator failure、digest mismatch、duplicate parent marker、source comment body parse failure までpartialに落とすと危険です。分類は固定してください。
高品質化した #938 実装案
1.
retro-indexschema 互換を先に決める現行 schema を変えないなら、#938 の index JSON は現行 field に閉じる必要があります。source refs / index digest は parent comment marker と workflow summary の machine-readable result に記録するしかありません。現行 schema に入れるなら #938 は止めて、#935 follow-up として schema migration を切るべきです。
推奨は後者です。
agent_retro_index/v1は index なので、最低限この形にした方が運用できます。2. builder は pure function と GitHub fetcher を分ける
lib/retro-index-builder.mjsは pure function にし、GitHub API やghCLI を直接呼ばない方がよいです。入力はreports[],prs[],issues[],parentIssue,sourceComments[]。出力は{ index, diagnostics, sourceSetDigest }。update-retro-index.mjsだけが GitHub fetch / upsert / artifact を扱う構造にします。これで tests は mocked REST ではなく fixture-based deterministic tests にできます。#937 側の comment upsert はすでに mocked REST tests を持っているため、#938 で同じ層を再実装する必要はありません。
3. parent comment upsert は report posting と別 namespace にする
実装 helper は #977 の
github-comments.mjsを参照してもよいですが、#938 の allowed paths はscripts/agent-logs/lib/retro-index*.mjsに限定されています。既存github-comments.mjsを変更したくなった時点で allowed paths に抵触します。したがって、#938 では以下のどちらかにしてください。
scripts/agent-logs/lib/retro-index-comments.mjsを新規作成し、既存 helperを import するだけにする。allowed paths に
scripts/agent-logs/lib/github-comments.mjsを明示追加する。後者は既存 report posting の regression risk が増えるため、前者が安全です。
4. workflow は build と write を明確に分離する
build-indexjob はissues: read,pull-requests: read,contents: readのみ。upsert-parent-commentjob だけissues: write,pull-requests: writeを持たせる。GitHub の permissions 仕様上、job-level permission を使えば token 権限を job ごとに絞れます。(GitHub Docs)write job は artifact を download した後に必ず以下を再実行します。
live upsert は
workflow_dispatch dry_run=falseまたはpush mainのみで許可し、PR context では常に dry-run にするべきです。#938 に追加すべき Acceptance Criteria
現在の AC1〜AC8 に加えて、以下を追加するのが妥当です。
実装者に渡すなら、この方針
この Issue は「builder を作る」ではなく、public-safe comment index の canonicalization と trusted write pipeline を作る Issue として扱うべきです。最初の作業は coding ではなく、現行 schema と AC8 の衝突を解消する契約修正です。
推奨する実装順は次です。
実装: agent_retro_index/v1 の canonical parent marker と trusted post-merge workflow を追加する #938 本文に AC9〜AC14 を追記、または schema migration follow-up を切る。
retro-index-builder.mjsを pure function として実装。retro-index-comments.mjsで report marker とは別の parent marker upsert を実装。update-retro-index.mjsは summary-only stdout、body は file/artifact/comment のみに限定。workflow は
push: main+workflow_dispatch、top-levelpermissions: {}、read job / write job 分離。tests は schema pass だけでなく、schema/AC 不整合、duplicate marker、digest mismatch、ambiguous/orphan、permission failure、log leak grep を含める。
最終判定は 要修正 です。#938 の目的は正しいですが、現行のままだと AC8/schema mismatch と marker namespace の未分離が残り、信頼できる
## 結論agent_retro_index/v1にはなりません。#938 は方向性自体は妥当ですが、このまま実装に渡すと 「AC は通るが、retro index として信頼できない」false green を作れます。特に重大なのは、#938 が「source comment refs と generated index digest を記録する」と要求している一方、既存の
agent_retro_index/v1schema はadditionalProperties: falseで、index-level のgenerated_at、repository、parent_issue、source_comment_refs、index_digest、algorithm_versionを受け付けない構造になっている点です。これは #938 の AC8 と schema 実体が衝突しています。#938 自体にコメントはありません。したがってレビュー対象は Issue 本文、親 #928、前段 Issue/PR、既存 schema/posting 実装、GitHub Actions/GitHub API の公式仕様です。
参照した関連 Issue / PR
親 #928 は、
agent_session_manifest/v1を provenance / validation / evidence index として残し、ChatGPT 改善検討用にagent_run_report/v1とagent_retro_index/v1を追加する delivery-rollup です。raw transcript、local path、secret 類は GitHub public surface に出さず、redacted report/index を Issue / PR comment に marker upsert で永続保存する設計です。前段 #934 は manifest 本文を Issue/PR comment に出さない境界を docs 側で固定し、redacted report/index だけを条件付き public comment 可にする整理です。
#935 / PR #955 は
agent_run_report/v1/agent_retro_index/v1schema と validator を追加し、retro index は report 本文の inline copy を禁止して、report_comment_url、report_digest、issue、pr、merge_sha、tags、friction_summary、quality_signals、follow_up_issues、orphan_reports、ambiguous_links、generation_verdictのような集約 field に閉じる方針です。#936 / PR #968 は lifecycle CLI を追加し、transcript 本文・local path・raw stdout/stderr を扱わず report を生成する前段です。
#937 / PR #977 は
agent_run_report/v1用の GitHub comment posting surface を追加し、stable ownership marker と digest marker、marker-addressed upsert、dry-run、duplicate fail-closed、permission/404/410/422/pagination test を固定しています。#939 は ChatGPT 投入用 context bundle、#940 は docs / skill handoff、#941 は EntireCLI safety checker で、いずれも #938 からは out of scope です。
敵対的レビュー
Blocker 1: #938 の AC8 は現行 schema では満たせない
#938 は「source comment refs と digest を index に保存する」「generated index の digest と source comment refs が記録される」ことを要求しています。ところが現行
agent-retro-index.schema.jsonの required key はschema、generation_verdict、entries、orphan_reports、ambiguous_linksだけで、additionalProperties: falseです。つまりsource_comment_refsやindex_digestを JSON index 本体へ追加できません。これは実装者が「digest marker は parent comment 側にあるから AC8 達成」と解釈して false green にできます。修正は二択です。
ただし #938 の stop condition には schema / key set 変更が必要なら停止とあるため、現状のままでは実装途中で stop するのが正しいです。
Blocker 2:
agent_run_report用 upsert helper をそのまま使うと marker ownership が混線する#977 は
agent_run_report:v1の ownership marker と digest markerを追加しています。marker はagent_run_report:v1 repo=... issue=... pr=... run_id=...形式で、digest marker もagent_run_report_digest:v1です。#938 で parent issue に保存すべき正本は
agent_retro_index/v1です。ここで #977 の marker を再利用すると、parent comment 上で「run report」と「retro index」の所有権が同じ namespace になり、upsert 対象の取り違え・duplicate 判定漏れ・将来の export 側誤読が起きます。#938 には独立 marker が必要です。推奨 marker:
agent_run_reportの marker helper は参考実装として使ってよいですが、marker namespace は絶対に分けるべきです。Blocker 3: PR → Issue 解決順が「決定的」だが「信頼度階層」になっていない
#938 は
Linked PR/Closes #N/ branch pattern / parent issue refs / API linked data の固定順で解決するとしています。しかし、この順序は危険です。branch pattern は人間・AI が容易に間違えますし、parent issue refs は child list や tracker 構造と混ざります。GitHub API の commit-associated pull request endpoint は、default branch 上の commit について「その commit を入れた merged PR」を返せるため、post-merge workflow の PR 特定にはこちらを優先すべきです。([GitHub Docs]1)
推奨順序は次です。
agent_run_reportの marker / payload にある target issue / PR。Closes|Fixes|Resolves #N。Linked PR/Linked Issuefield。複数候補が出た場合は
ambiguous_links[]に入れてgeneration_verdict: partial。ただし validator failure、digest mismatch、permission failure、duplicate parent marker はpartialではなくblockedです。Blocker 4: workflow の write 権限分離が AC だけでは足りない
GitHub Actions の
permissionsは top-level / job-level で指定でき、明示した permission 以外はnoneになります。最小権限にするには top-levelpermissions: {}と job-level permission を分離する必要があります。([GitHub Docs]2) ([GitHub Docs]2)#938 は top-level
permissions: {}と job-levelcontents: read,issues: write,pull-requests: writeを要求していますが、read-only index generation job と write comment job を分ける AC がありません。Issue comment の create/update には Issues または Pull requests の write permission が必要です。([GitHub Docs]3)推奨 workflow 構造:
pull_request_targetは使わない方針で正しいです。GitHub はpull_request_targetについて、default branch context で動き、untrusted code を checkout/build/run すると cache poisoning や write token / secret access の危険があると警告しています。([GitHub Docs]4)High 1: artifact digest を使うなら、canonical comment digest と混同してはいけない
actions/upload-artifactは artifact の SHA-256 digest output を持ちます。([GitHub]5)ただし artifact は補助面であり、#928 / #938 の正本は parent issue marker comment です。artifact digest は「build job が作った一時ファイルの検査値」で、parent comment の canonical payload digest とは別物として扱うべきです。
必要な digest は最低3つです。
この3つを混ぜると、artifact を再生成しただけで正本 digest が変わる、または入力 comment が変わったのに index payload が更新されない、という監査不能状態になります。
High 2: 「workflow log に cat しない」だけでは漏洩防止にならない
#938 の AC7 は
cat .*report|cat .*indexを grep しています。これは弱いです。
console.log(JSON.stringify(index))、gh apiの response body、Node の uncaught exception、Ajv error の raw value、shellset -x、tee、jq .でも同じ漏洩が起きます。AC7 は次に拡張すべきです。
さらに、CLI は成功時も
status,entry_count,orphan_count,ambiguous_count,canonical_index_digest,source_comment_set_digestだけを出し、本文は stdout/stderr に出さない設計にするべきです。High 3:
partialverdict の濫用で安全エラーを品質劣化に見せられる#938 は ambiguity / orphan を
partialにする設計です。これは正しいですが、permission denied、validator failure、digest mismatch、duplicate parent marker、source comment body parse failure までpartialに落とすと危険です。分類は固定してください。
partialpartialblockedblockedblockedblockedorphan_reports[]または skip高品質化した #938 実装案
1.
retro-indexschema 互換を先に決める現行 schema を変えないなら、#938 の index JSON は現行 field に閉じる必要があります。source refs / index digest は parent comment marker と workflow summary の machine-readable result に記録するしかありません。現行 schema に入れるなら #938 は止めて、#935 follow-up として schema migration を切るべきです。
推奨は後者です。
agent_retro_index/v1は index なので、最低限この形にした方が運用できます。{ "schema": "agent_retro_index/v1", "repository": "squne121/loop-protocol", "parent_issue": 928, "generated_at": "2026-06-18T00:00:00Z", "algorithm_version": "retro-index-builder@1", "generation_verdict": "partial", "source_scope": { "issue_numbers": [928, 934, 935, 936, 937, 938, 939, 940, 941], "merged_after": "2026-06-15T00:00:00Z" }, "source_comment_refs": [], "entries": [], "orphan_reports": [], "ambiguous_links": [], "index_digest": "sha256:..." }2. builder は pure function と GitHub fetcher を分ける
lib/retro-index-builder.mjsは pure function にし、GitHub API やghCLI を直接呼ばない方がよいです。入力はreports[],prs[],issues[],parentIssue,sourceComments[]。出力は{ index, diagnostics, sourceSetDigest }。update-retro-index.mjsだけが GitHub fetch / upsert / artifact を扱う構造にします。これで tests は mocked REST ではなく fixture-based deterministic tests にできます。#937 側の comment upsert はすでに mocked REST tests を持っているため、#938 で同じ層を再実装する必要はありません。
3. parent comment upsert は report posting と別 namespace にする
実装 helper は #977 の
github-comments.mjsを参照してもよいですが、#938 の allowed paths はscripts/agent-logs/lib/retro-index*.mjsに限定されています。既存github-comments.mjsを変更したくなった時点で allowed paths に抵触します。したがって、#938 では以下のどちらかにしてください。
scripts/agent-logs/lib/retro-index-comments.mjsを新規作成し、既存 helperを import するだけにする。scripts/agent-logs/lib/github-comments.mjsを明示追加する。後者は既存 report posting の regression risk が増えるため、前者が安全です。
4. workflow は build と write を明確に分離する
build-indexjob はissues: read,pull-requests: read,contents: readのみ。upsert-parent-commentjob だけissues: write,pull-requests: writeを持たせる。GitHub の permissions 仕様上、job-level permission を使えば token 権限を job ごとに絞れます。([GitHub Docs]2)write job は artifact を download した後に必ず以下を再実行します。
live upsert は
workflow_dispatch dry_run=falseまたはpush mainのみで許可し、PR context では常に dry-run にするべきです。#938 に追加すべき Acceptance Criteria
現在の AC1〜AC8 に加えて、以下を追加するのが妥当です。
実装者に渡すなら、この方針
この Issue は「builder を作る」ではなく、public-safe comment index の canonicalization と trusted write pipeline を作る Issue として扱うべきです。最初の作業は coding ではなく、現行 schema と AC8 の衝突を解消する契約修正です。
推奨する実装順は次です。
retro-index-builder.mjsを pure function として実装。retro-index-comments.mjsで report marker とは別の parent marker upsert を実装。update-retro-index.mjsは summary-only stdout、body は file/artifact/comment のみに限定。push: main+workflow_dispatch、top-levelpermissions: {}、read job / write job 分離。最終判定は 要修正 です。#938 の目的は正しいですが、現行のままだと AC8/schema mismatch と marker namespace の未分離が残り、信頼できる
agent_retro_index/v1にはなりません。[-]実装: agent_retro_index/v1 builder と post-merge workflow を追加する[/-][+]実装: agent_retro_index/v1 の canonical parent marker と trusted post-merge workflow を追加する[/+]squne121 commentedon Jun 18, 2026
更新内容
実装: agent_retro_index/v1 の canonical parent marker と trusted post-merge workflow を追加するに更新agent_retro_index/v1の canonical parent marker と trusted post-merge workflow を明示する形へ本文を更新検証結果
guard-issue-body.py: passcontract_readiness_check.py --mode static: status=gosha256:4922398ebe1beb13a80b242ed2e32e90c81778e7a3fca14fb6e8a732913c1a01備考
squne121 commentedon Jun 18, 2026
Refinement Loop: Approved
The issue has been approved and is ready for implementation.
approvedsqune121 commentedon Jun 18, 2026
Contract Review Result
fix(agent-logs): lock retro index writes to verified artifacts (#938)
feat(agent-logs): add retro index workflow (#938) (#1000)