Skip to content

docs(#934): fix session recording public surface boundary - #951

Merged
squne121 merged 5 commits into
mainfrom
worktree-issue-934-step1
Jun 15, 2026
Merged

squne121 merged 5 commits into
mainfrom
worktree-issue-934-step1

Conversation

@squne121

@squne121 squne121 commented Jun 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

この節では変更の要点をまとめます。

  • session-recording policy を canonical github_issue_or_pr_comment subtree に寄せ、manifest 本文禁止・opaque ref only・report/index conditional posting を docs と checker の両方で固定
  • scripts/generate-session-manifest.mjs の github-comment surface を live public posting 用の current CLI surface から外し、historical legacy fixture として降格
  • manifest tests を legacy fixture / --allow-local-path fail-closed / help wording まで含めて更新し、false green で public posting を再開できないようにした

Checks

この節では受け入れ条件と検証結果をまとめます。

  • AC1 manifest body と run report / retro index の public surface 方針を別物として説明した
  • AC2 agent_session_manifest/v1 body 禁止と opaque ref のみ許可を明記した
  • AC3 agent_run_report/v1 / agent_retro_index/v1 は 実装: agent_run_report/v1 / agent_retro_index/v1 schema・fixtures・public-safe validator を追加する #935 / 実装: GitHub Issue / PR marker upsert と public-safe posting guard を追加する #937 後のみ conditional public comment 可、実装: #928 導入前に session-recording policy と report公開境界の drift を解消する #934 merge 時点では live public posting 禁止と明記した
  • AC4 phase_instance_id を issue-<N>:<main_loop_phase>:<seq> と ci:<producer_slug>:<run_id>:<run_attempt> の両形式に更新した
  • AC5 private artifact を secret-safe ではない retention-limited non-comment surface として再定義した
  • AC6 trusted context 限定、pull_request_target 不使用、posting job 限定 write permission を明記した
  • AC7 hook は diagnostic / prevention layer であり、正本は post-run validator + posting guard と明記した
  • AC8 legacy template / pilot wording を historical / non-current として降格した
  • AC9 scripts/generate-session-manifest.mjs の github-comment surface を historical fixture 扱いへ降格し、current public posting path として露出しないよう更新した
  • AC10 tests/agent-session-manifest.test.ts を legacy fixture 検証と --allow-local-path fail-closed に更新した
  • AC11 .claude/scripts/check_session_recording_policy.py が canonical subtree を exact assertion し、legacy alias は compatibility-only として fail-closed で検証する

検証コマンド結果

  • AC1 確認: rg -n "manifest body|agent_run_report|agent_retro_index|public surface|opaque ref" docs/dev/session-recording-policy.md docs/dev/onboarding/session-recording-tool.md docs/schemas/agent-session-manifest.md
  • AC2 確認: rg -n "body_allowed: false|manifest 本文.*(禁止|出さない)|opaque ref|artifact_digest|validation_verdict" docs/dev/session-recording-policy.md docs/dev/onboarding/session-recording-tool.md docs/schemas/agent-session-manifest.md
  • AC3 確認: rg -n "#935|#936|#937|conditional public comment|live public posting|exact marker upsert guard|dry-run" docs/dev/session-recording-policy.md docs/dev/onboarding/session-recording-tool.md docs/dev/schema-governance.md
  • AC4 確認: rg -n "issue-<N>:<main_loop_phase>:<seq>|ci:<producer_slug>:<run_id>:<run_attempt>|ci:session-manifest:" docs/dev/session-recording-policy.md docs/schemas/agent-session-manifest.md
  • AC5 確認: rg -n "private artifact|retention-limited|non-comment surface|secret-safe|public-safe|non-canonical" docs/dev/session-recording-policy.md docs/dev/onboarding/session-recording-tool.md docs/schemas/agent-session-manifest.md
  • AC6 確認: rg -n "trusted context|pull_request_target|issues: write|pull-requests: write|contents: read" docs/dev/session-recording-policy.md docs/dev/onboarding/session-recording-tool.md
  • AC7 確認: rg -n "security boundary ではない|post-run validator|posting guard|diagnostic|prevention" docs/dev/session-recording-policy.md docs/dev/onboarding/session-recording-tool.md
  • AC8 確認: rg -n "historical|non-current|not live public posting|legacy" docs/dev/onboarding/session-recording-tool.md docs/schemas/agent-session-manifest.md docs/dev/session-recording-policy.md
  • AC9 確認: rg -n "github-comment|historical|legacy|not live public posting" scripts/generate-session-manifest.mjs tests/agent-session-manifest.test.ts
  • AC10 確認: rg -n "github-comment|artifact_digest|opaque ref|historical" tests/agent-session-manifest.test.ts
  • AC11 確認: python3 .claude/scripts/check_session_recording_policy.py docs/dev/session-recording-policy.md
  • targeted manifest suite: pnpm test -- --run tests/agent-session-manifest.test.ts

Allowed Paths 遵守

  • 変更は docs/dev/session-recording-policy.md、docs/dev/onboarding/session-recording-tool.md、docs/schemas/agent-session-manifest.md、.claude/scripts/check_session_recording_policy.py、scripts/generate-session-manifest.mjs、tests/agent-session-manifest.test.ts のみ

Schema Change Applicability

この節では schema change 判定の理由を示します。

  • decision: schema_change
  • reason: agent_session_manifest/v1 の consumer-facing boundary と canonical public-surface key、関連 checker / producer help / tests の contract を current policy に合わせて更新したため

Schema Consumer Inventory

この節では consumer 影響範囲と更新要否を整理します。

変更対象 schema: agent_session_manifest/v1

before/after 差分:

# before
public_comment_boundary:
  canonical_key: github_issue_comment
  manifest_body_currently_emittable: true_like_cli_surface
  checker_exact_assertions: legacy_raw_transcript_only

# after
public_comment_boundary:
  canonical_key: github_issue_or_pr_comment
  manifest_body_allowed: false
  opaque_ref_only: true
  report_index_live_public_posting: forbidden_until_dependencies_merge
  github_comment_cli_surface: historical_legacy_fixture_only
  checker_exact_assertions: canonical_subtree_and_legacy_alias

Consumer 列挙(rg コマンド例と結果):

rg -l "agent_session_manifest/v1|agent_session_manifest:v1|agent-session-manifest" .
docs/dev/onboarding/session-recording-tool.md
docs/dev/schema-governance.md
docs/dev/session-recording-policy.md
docs/schemas/agent-session-manifest.md
docs/schemas/agent-session-manifest.schema.json
scripts/generate-session-manifest.mjs
tests/agent-session-manifest.test.ts
.claude/scripts/check_session_recording_policy.py

Consumer 更新状況:

Consumer ファイル 更新有無 備考
docs/dev/onboarding/session-recording-tool.md 更新済み current public surface boundary と artifact_url の non-canonical 性を反映
docs/dev/schema-governance.md 既存更新済み #934 / #935 の役割分離を維持
docs/dev/session-recording-policy.md 更新済み canonical subtree / alias / artifact semantics / action version drift を反映
docs/schemas/agent-session-manifest.md 更新済み historical template と artifact_url semantics を追記
.claude/scripts/check_session_recording_policy.py 更新済み canonical subtree exact assertion と legacy alias fail-closed を追加
scripts/generate-session-manifest.mjs 更新済み legacy fixture surface へ降格、deprecated alias warning、--allow-local-path fail-closed
tests/agent-session-manifest.test.ts 更新済み legacy fixture 検証と escape hatch rejection を追加
docs/schemas/agent-session-manifest.schema.json 不要(理由) machine-readable schema key 自体は変更していない

Compatibility Decision

この節では互換性判断を整理します。

  • change_type: semantic_change
  • compatibility: backward_compatible
  • migration_required: no
  • migration_or_followup: #935, #937
  • reason: schema JSON の互換性は維持しつつ、current public posting contract と executable surface の誤読を解消した

Safety Claim Matrix

この節では安全境界の主張と未制御範囲を明示します。

Claim Implemented? Not controlled Evidence Follow-up
manifest 本文を public comment に出さない canonical boundary を docs + checker + CLI help で固定した yes live posting runtime 実装自体は未導入 policy checker pass, AC1-AC11 VC #935, #937
report / retro index の live public posting を #935 / #937 完了まで禁止と明記した yes 実際の redaction validator / marker upsert guard は未実装 docs + checker exact assertion #935, #936, #937
legacy github-comment surface を current public posting path から外した yes hidden compatibility alias 自体の完全削除は周辺 consumer 整理が必要 targeted manifest suite follow-up if needed
artifact_url は retention-limited / auth-dependent / non-canonical locator と明記した yes artifact retention policy の運用変更まではこの PR では行わない docs updates follow-up if needed

Notes

この節では関連 issue などの補足を記します。

@github-actions

github-actions Bot commented Jun 15, 2026 •

Copy link
Copy Markdown
Contributor

Preview URL

Preview removed (PR #951 closed).

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOOP_VERDICT_V2

verdict: REQUEST_CHANGES
reviewed_head_sha: "3d73d3372df1bd60ee27521ee087133519fdc2fa"
merge_ready: false
mergeability:
mergeable: "MERGEABLE"
merge_state_status: "BEHIND"
linked_issue: "#934"
allowed_paths_gate:
status: ok
schema_consumer_gate:
status: ok
safety_claim_gate:
status: ok
blockers:

  • summary: "PR body が canonical section 名を満たしておらず、現在の本文は Summary / Checks / Schema Change Applicability / Schema Consumer Inventory / Safety Claim Matrix / Notes を欠落扱いで validator fail する"
    severity: high
    evidence_refs:
    • "scripts/pr_body_validator.py on current PR body: LP052 x6"
    • "PR #951 current body"
      next_action: "PR 本文を canonical heading に修正し、PR body validator と関連 check を再実行する"
  • summary: "required CI evidence が green ではなく、python-test が check_session_recording_policy.py で fail している"
    severity: high
    evidence_refs:
    • "CI_VERDICT_SUMMARY_V1 status=pending_or_queued failed_checks=[deploy-pr, PR Body Japanese Check, python-test]"
    • "python-test job 81525002364: public_surfaces.github_issue_comment missing or not a mapping"
      next_action: "docs/dev/session-recording-policy.md を既存 checker と整合させるか、checker 側の正本を同 issue scope で更新可能か再判定し、green evidence を取り直す"
  • summary: "CI が未収束で、e2e が進行中かつ deploy-pr も preview asset live check 404 で fail している"
    severity: medium
    evidence_refs:
    • "CI_VERDICT_SUMMARY_V1 pending_checks=[e2e]"
    • "deploy-pr job 81525001916: Verify preview assets are live -> curl 404"
      next_action: "失敗/保留 check を current head で解消して required CI evidence を確定させる"
      required_auto_actions:
  • kind: update_pr_body_hygiene
    executor: implementation-worker
    skill: open-pr.update_pr
    blocking_merge_ready: true
    mechanical: true
  • kind: update_branch
    executor: implementation-worker
    skill: implement-issue.update_branch
    blocking_merge_ready: true
    mechanical: true
    expected_head_sha: "3d73d3372df1bd60ee27521ee087133519fdc2fa"
    auto_fix_applied: []
    follow_up_issue_requests: []

@squne121

Copy link
Copy Markdown
Owner Author

判定

REQUEST_CHANGES です。

ただし、既存レビューの一部は古くなっています。PR #951 は現 head fe228558... では open / draft / mergeable で、変更は 4 files / +102 / -18 です。 以前の LOOP_VERDICT_V2 は head 3d73d337... に対して PR body / CI fail を指摘していましたが、現 head では関連 workflow が success まで進んでいます。

問題は CI の色ではなく、この PR が固定したい公開境界と、既存の実行可能 surface がまだ矛盾している点です。


良い点

PR の方向性は #934 / #928 と整合しています。agent_session_manifest/v1 の manifest 本文を Issue / PR comment に出さず、公開コメントでは artifact_digest / artifact_url / schema_ref / validation_verdict などの opaque ref だけを許可する、という境界は docs に入っています。

agent_run_report/v1 / agent_retro_index/v1 についても、#935 schema/redaction validator と #937 exact marker upsert guard が揃うまで live public posting を禁止する、と書けています。

phase_instance_id の drift も、schema 実体と prose の両方で issue-<N>:... と ci:<producer_slug>:<run_id>:<run_attempt> の 2 形式に寄っています。


Blocker 1: github-comment manifest body producer がまだ生きている

この PR の最大の問題です。

新しい docs は「agent_session_manifest/v1 の manifest 本文は Issue / PR comment に出さない」「過去の manifest comment template は historical / non-current」と明記しています。

しかし、実装 surface では scripts/generate-session-manifest.mjs が今も GitHub comment 用の full manifest body 出力を正式機能として持っています。help には --format json, github-comment が載り、example でも --format github-comment が示されています。 実際の formatter は <!-- agent_session_manifest:v1 start --> / end marker の間に manifest JSON 全文を fenced block として出力します。

さらに test もこの github-comment artifact を生成し、marker から JSON を抽出して validation する前提を維持しています。

これは docs 上の historical template とは違います。実行可能な CLI と test が「manifest body を GitHub comment 形式で出せる」と証明しているため、後続 AI / script がこの producer を根拠に public comment posting を復活させる false green になります。

修正要求:

最低限、次のどちらかが必要です。

  1. 実装: #928 導入前に session-recording policy と report公開境界の drift を解消する #934 の PR で Allowed Paths を拡張し、scripts/generate-session-manifest.mjs と tests/agent-session-manifest.test.ts を更新する。
    --format github-comment は削除、または legacy-historical-comment-fixture のような明示的に非 posting 用の名前へ変更し、通常 CLI help / example から消す。

  2. Allowed Paths を拡張しないなら、PR body / Safety Claim Matrix / docs に「実行可能 producer surface はまだ残っており、本 PR では無効化していない。public posting guard が入るまで使用禁止」と明記し、別 issue を blocker dependency にする。

現状のまま「manifest 本文禁止の current boundary を固定した」と claim するのは過大です。


Blocker 2: policy checker が弱く、CI green の保証が薄い

現 head の CI は成功していますが、check_session_recording_policy.py は新しい public-surface boundary をほとんど検証していません。

この checker が機械的に見ているのは、主に YAML parse、source_of_truth、taxonomy、kill switch、そして legacy key public_surfaces.github_issue_comment.raw_transcript_allowed == false です。 該当関数も github_issue_comment.raw_transcript_allowed しか見ていません。 main 側でもその check を呼んでいるだけです。 Markdown 本文側の検証も broad regex の存在確認に留まります。

つまり、次の重要契約は CI で直接保証されていません。

  • github_issue_or_pr_comment.agent_session_manifest.body_allowed == false
  • opaque_ref_allowed == true
  • agent_run_report.live_public_posting == forbidden_until_dependencies_merge
  • agent_retro_index.live_public_posting == forbidden_until_dependencies_merge
  • forbidden_content に full_prompt / full_command_output / secret_value が入ること
  • agent_session_manifest_allowed: true のような旧契約が復活していないこと

修正要求:

check_session_recording_policy.py または別の policy schema test で、新設 YAML subtree を exact assertion してください。最低限、以下は fail-closed で見るべきです。

manifest = data["public_surfaces"]["github_issue_or_pr_comment"]["agent_session_manifest"]
assert manifest["body_allowed"] is False
assert manifest["opaque_ref_allowed"] is True
assert "artifact_digest" in manifest["allowed_refs"]
assert "full_prompt" in manifest["forbidden_content"]
assert "full_command_output" in manifest["forbidden_content"]

for key in ["agent_run_report", "agent_retro_index"]:
    item = data["public_surfaces"]["github_issue_or_pr_comment"][key]
    assert item["body_allowed"] == "conditional"
    assert item["live_public_posting"] == "forbidden_until_dependencies_merge"

CI green は必要条件ですが、この PR の主張に対する十分条件ではありません。


Blocker 3: agent_run_report / agent_retro_index の canonical surface が legacy key 配下に置かれている

現在の YAML は agent_session_manifest を github_issue_or_pr_comment 配下に置いていますが、agent_run_report と agent_retro_index は legacy compatibility 用の github_issue_comment 配下に入っています。

しかし #928 / #934 / #937 の契約は Issue comment だけではありません。Issue / PR comment の marker upsert が public canonical surface です。#937 の marker も issue=<N> pr=<N|null> を含む形式で、PR comment も対象にしています。

このままだと後続実装者が次のどちらかで迷います。

  • github_issue_or_pr_comment が canonical なのか
  • github_issue_comment が canonical で、PR comment は派生なのか

修正要求:

public_surfaces.github_issue_or_pr_comment を canonical key にし、3 schema を同じ階層に置くべきです。

public_surfaces:
  github_issue_or_pr_comment:
    agent_session_manifest:
      body_allowed: false
      opaque_ref_allowed: true
      ...
    agent_run_report:
      body_allowed: conditional
      live_public_posting: forbidden_until_dependencies_merge
      ...
    agent_retro_index:
      body_allowed: conditional
      live_public_posting: forbidden_until_dependencies_merge
      ...
  github_issue_comment:
    compatibility_alias_of: github_issue_or_pr_comment
    raw_transcript_allowed: false

legacy checker 互換のために github_issue_comment を残すのはよいですが、新契約を legacy key 配下に増やすのは危険です。


Blocker 4: artifact_url を opaque ref として許可するなら、retention / auth / canonicality を明記する必要がある

PR は artifact_url を allowed ref に入れています。 ただし、artifact は永続正本ではありません。#928 の親契約では、artifact は補助面で、永続正本は Issue / PR comment の marker upsert です。

GitHub Actions artifacts/logs は retention policy の対象で、public repository では保持期間を 1〜90 日に設定できます。([GitHub Docs]1) actions/upload-artifact の README でも artifact-url は artifact / run / repository が存在する間だけ有効で、アクセスには GitHub login が必要と説明されています。また artifact-id / artifact-url / artifact-digest を出力できます。([GitHub]2)

現在 workflow は artifact retention 7 日で upload しています。 そのため、artifact_url を「後から辿れる証跡」として強く扱うと、#928 の “永続保存” 目標と衝突します。

修正要求:

docs に次を入れてください。

  • artifact_url は retention-limited / auth-dependent / non-canonical locator
  • canonical identity は artifact_digest、schema_ref、validation_verdict、必要なら workflow run URL / comment marker
  • artifact content は public-safe でなければならないが、artifact URL 自体は永続 evidence ではない

Blocker 5: artifact safety の責務境界が曖昧

PR は private artifact を secret-safe ではない legacy enum として再定義しており、この点は良いです。

一方で、現 workflow の artifact safety check は補助的 grep です。実際に step comment でも “belt-and-suspenders supplementary check only” としており、token-like pattern / absolute path prefix / transcript marker を見るだけです。 #935 では /home/, /Users/, C:\, file://, .env.local, .claude/settings.local.json, ghp_, github_pat_, sk-, AKIA, private key, VITE_SECRET_KEY, duplicate marker, fence breakout などを invalid fixture として固定する予定です。

ここで PR #951 の docs が「public-safe contract」を固定したと主張するなら、現時点の validator / scanner がどこまで未実装かも同じ場所に明記する必要があります。

修正要求:

session-recording-policy.md に次の責務分離を明記してください。


High: github-comment 出力に --allow-local-path escape hatch が残っている

generate-session-manifest.mjs は --allow-local-path を help に出し、secret pattern が absolute path の場合だけ warning に downgrade できます。

これは #935 の report/index posting mode では escape hatch 禁止という契約と相性が悪いです。 github-comment format が残るなら、この escape hatch は public comment format では使えないようにすべきです。

修正要求:

format === "github-comment" のときは --allow-local-path を無効化し、指定されたら fail closed にしてください。より良いのは、Blocker 1 の通り github-comment format 自体を legacy fixture surface へ降格することです。


High: workflow / docs の action version drift

policy docs は artifact upload を actions/upload-artifact@v4 と書いています。 しかし実 workflow は actions/upload-artifact@v6 を使っています。 upstream の actions/upload-artifact README では 2026-04-10 時点で v7.0.1 が latest release と表示され、hidden files は default exclude、artifact-digest などの outputs も記載されています。([GitHub]2)

これは即 merge blocker ではありませんが、配布物と policy の version 表記がズレると後続実装が古い挙動を前提にします。

修正要求:

docs では version を固定しないか、現在 workflow の version と一致させてください。artifact の semantics は id/url/digest/retention/hidden files の仕様として書き、action major version の説明と分離する方が堅いです。


Web 調査を踏まえた実装方針

GitHub comment upsert は gh pr comment --edit-last に寄せない方針が正しいです。GitHub CLI の --edit-last は “current user の最後の comment” を編集する機能であり、marker-addressed upsert ではありません。([GitHub CLI]3) GitHub REST の issue comments API は Issue と Pull Request の comments を扱い、GitHub は Pull Request も Issue の一種として扱います。([GitHub Docs]4) よって #937 の list → exact marker search → 0 create / 1 update / 2+ fail closed は維持すべきです。

Workflow 権限についても、この PR の方向は妥当です。GitHub Actions の permissions は top-level / job-level で最小化でき、指定されない権限は none になります。一方、pull_request_target は public fork 由来でも read/write repository permission を持ち得るため、posting workflow で使わない判断は正しいです。([GitHub Docs]5) job-level で issues: write / pull-requests: write を必要 job にだけ付ける設計も GitHub の workflow syntax と整合します。([GitHub Docs]5)

EntireCLI は #941 の通り、採用ではなく fail-closed checker の対象として扱うべきです。EntireCLI は prompts / transcripts / tool calls / file changes / metadata を capture し、checkpoint metadata を branch に保存し、default では code remote に push し得ます。([Entire]6) Security docs でも public repo なら transcript branch が public になり、redaction は best-effort、shadow branch に hardcoded secret が unredacted で残り得ると説明されています。([Entire]7)


最小修正セット

この PR を merge 可能に近づける最小セットは次です。

  1. public_surfaces.github_issue_or_pr_comment を canonical にし、agent_run_report / agent_retro_index もそこへ移す。
  2. check_session_recording_policy.py に新 policy subtree の exact assertions を追加する。
  3. scripts/generate-session-manifest.mjs の github-comment format を削除または legacy-only に降格し、help/example/test から public posting 可能に見える表現を消す。
  4. tests/agent-session-manifest.test.ts の generated github-comment artifact validates を、legacy detection test または rejection test に変える。
  5. artifact_url の retention/auth/non-canonical 性を docs に明記する。
  6. actions/upload-artifact の version drift を解消する。

現状の PR は docs の追加としてはかなり進んでいますが、最も危険な実行可能 surface が残っているため、敵対的レビューでは merge 不可です。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

実装: #928 導入前に session-recording policy と report公開境界の drift を解消する

1 participant