Skip to content

実装: cloud_pilot_success_result/v1 の正本 artifact placement と public-safe projection を決める #1330

Closed
1 of 1 issue completed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#1153"
goal_ref: "PR #1325 レビューコメント(OWNER, REQUEST_CHANGES, P2, https://github.com/squne121/loop-protocol/pull/1325#issuecomment-4882061533)の follow_up_issue_required に従い、cloud_pilot_success_result/v1 の正本 artifact placement を決定し、public-safe projection の固定項目を machine-readable に定義する"
change_kind: docs
cloud_pilot_success_result_placement_decision_v1:
  candidate_options:
    - embed_in_agent_run_report_v1
    - standalone_cloud_pilot_success_result_v1
    - hybrid_reference_from_agent_run_report
  selected_option: hybrid_reference_from_agent_run_report
  decision_required: true
  decision_recorded_as_of_this_issue: true
  decision_source: "OWNER adversarial review, https://github.com/squne121/loop-protocol/issues/1330#issuecomment-4892894141"
  rejected_options:
    embed_in_agent_run_report_v1:
      reason: "docs/schemas/agent-run-report.schema.json は top-level additionalProperties:false かつ observationSourceMetrics も additionalProperties:false(許可フィールドは trace_count/span_count/prompt_tokens/completion_tokens/total_tokens の5つのみ)。cloud pilot の result 本体を embed するには schema 本体変更が必要になり、本 Issue の Stop Condition(agent_run_report/v1 schema 本体変更禁止)と衝突するため reject。ただし opaque reference(github_comment / observation_projection_digest)の embed のみは許可する。"
    standalone_cloud_pilot_success_result_v1:
      reason: "standalone のみだと #1153 の GitHub retrospective 導線から result artifact が孤立するため、agent_run_report からの参照が必須。単独案として reject し hybrid を採用。"
must_define_after_decision:
  - marker_schema
  - schema_path
  - checker_command
  - digest_policy
  - github_comment_upsert_policy
  - raw_trace_body_publication_forbidden_fields
checker_schema_test_scope:
  in_this_issue: design_decision_and_docs_only
  requires_follow_up_issue: true
  follow_up_issue_ref: TBD_after_this_issue_merge
  follow_up_issue_materialization_required_before_close: true

Parent Issue

#1153

Parent Goal Ref

  • Goal: Cloud pilot の採用判断を false-green なしで記録し、adopt_cloud / adopt_self_host / conditional_adoption / withdraw の decision を public-safe に残す
  • Desired Destination: cloud_pilot_success_contract_v1(実装: Cloud pilot success contract を #246 と canonical に整合させる #1260)と cloud_pilot_success_result_v1(本 Issue が扱う実行結果 artifact)の正本配置が競合なく確定し、既存 agent_run_report/v1 の schema 制約と整合する状態

Current Validated Scope

Remaining Parent Gaps

Outcome

cloud_pilot_success_result/v1 の正本 artifact placement が embed_in_agent_run_report_v1 / standalone_cloud_pilot_success_result_v1 / hybrid_reference_from_agent_run_report のいずれかとして machine-readable に決定され、marker_schema / schema_path / checker_command / digest_policy / github_comment_upsert_policy / raw_trace_body_publication_forbidden_fields が docs 上に固定された状態。checker / schema コードの実装は本 Issue では行わず、決定後の別 follow-up Issue に委ねてよい。placement 決定は本 Issue で hybrid_reference_from_agent_run_report として確定し(OWNER レビューによる)、決定後の6項目を ADR に固定する。

In Scope

Out of Scope

  • real Cloud pilot 実行、external credits 消費
  • provider-side trace 読み出し
  • cloud_pilot_success_result/v1 の checker / schema / negative fixture の実装コード(決定後の別 follow-up Issue に委ねる)
  • cloud_pilot_success_contract_v1(実装: Cloud pilot success contract を #246 と canonical に整合させる #1260)の decision_rules_v1(adopt/conditional/withdraw 閾値)そのものの定義
  • retention policy の実運用適用

Acceptance Criteria

  • AC1: artifact_placement_decision.selected_option: hybrid_reference_from_agent_run_report が新規 ADR (docs/adr/0005-cloud-pilot-success-result-artifact-placement.md) の単一 YAML block として machine-readable に固定される。同ファイル内に decision block は1個だけであること。
  • AC2: rejected_options.embed_in_agent_run_report_v1 / rejected_options.standalone_cloud_pilot_success_result_v1 の reason が同 YAML block に含まれる。
  • AC3: marker_schema(外側marker + digest marker + payload schema + target fields + duplicate handling)が ADR に定義される。
  • AC4: schema_path が ADR に定義され、exists_in_this_issue: false / implementation_follow_up_required: true が明記される(本 Issue ではファイル未作成のまま)。
  • AC5: checker_command が ADR に定義され、exists_in_this_issue: false / implementation_follow_up_required: true が明記される。
  • AC6: digest_policy(digest_algorithm/digest_input/canonicalization/forbidden_digest_inputs を含む)が ADR に定義される。
  • AC7: github_comment_upsert_policy(pagination-aware・duplicate-safe・stale digest fail-closed)が ADR に定義される。
  • AC8: raw_trace_body_publication_forbidden_fields(trace/span attributes/events/request/response/header/env/argv/path/provider URL を含む拡張リスト)が ADR に定義され、docs/dev/secret-policy.md にも同リストへの参照が追記される。
  • AC9: 本 Issue が 実装: Cloud pilot success contract を #246 と canonical に整合させる #1260 / 実装: cloud_pilot_success_contract_v1 の checker/schema/negative fixtureを実装する #1326 の docs-only contract 定義を前提とした設計判断 Issue であり、checker / schema コードの実装を別 follow-up Issue に委ねる方針が cloud_pilot_success_result_checker_follow_up_required: true として ADR に明記され、follow_up_issue_ref が TBD_after_decision のまま Issue を close しないことが明記される。
  • AC10: cloud_adoption_allowed_now: false(実装: cloud_pilot_success_contract_v1 の checker/schema/negative fixtureを実装する #1326 完了前および本 Issue の follow-up checker 実装前は採用不可)が ADR に明記される。
  • AC11: ADR 内の decision YAML block を単一の python3 -c "assert ..." コマンド(compound operator を含まない)で parse でき、selected_option / rejected_options / follow_up_issue_ref のキーが存在することを検証する VC が追加される。
  • AC12: docs/dev/agent-run-report.md に「agent_run_report/v1 への Cloud pilot 統合は opaque reference のみ(github_comment / observation_projection_digest)、inline result body / inline metrics は禁止」という一文が追記される。

Verification Commands

$ pnpm typecheck
$ pnpm lint
$ pnpm test
$ pnpm build
# AC1
# baseline-expect: fail
$ rg -c "cloud_pilot_success_result_placement_decision_v1" docs/adr/0005-cloud-pilot-success-result-artifact-placement.md
# AC2
# baseline-expect: fail
$ rg -n "rejected_options" docs/adr/0005-cloud-pilot-success-result-artifact-placement.md
# AC3
# baseline-expect: fail
$ rg -n "marker_schema" docs/adr/0005-cloud-pilot-success-result-artifact-placement.md
# AC4
# baseline-expect: fail
$ rg -n "schema_path" docs/adr/0005-cloud-pilot-success-result-artifact-placement.md
# AC5
# baseline-expect: fail
$ rg -n "checker_command" docs/adr/0005-cloud-pilot-success-result-artifact-placement.md
# AC6
# baseline-expect: fail
$ rg -n "digest_policy" docs/adr/0005-cloud-pilot-success-result-artifact-placement.md
# AC7
# baseline-expect: fail
$ rg -n "github_comment_upsert_policy" docs/adr/0005-cloud-pilot-success-result-artifact-placement.md
# AC8
# baseline-expect: fail
# preflight-scope: pr_review_only
$ rg -n "raw_trace_body_publication_forbidden_fields" docs/adr/0005-cloud-pilot-success-result-artifact-placement.md docs/dev/secret-policy.md
# AC9
# baseline-expect: fail
$ rg -n "cloud_pilot_success_result_checker_follow_up_required" docs/adr/0005-cloud-pilot-success-result-artifact-placement.md
# AC10
# baseline-expect: fail
$ rg -n "cloud_adoption_allowed_now" docs/adr/0005-cloud-pilot-success-result-artifact-placement.md
# AC11
# baseline-expect: fail
# preflight-scope: pr_review_only
$ uv run python3 -c "assert all(k in str(__import__('yaml').safe_load(open('docs/adr/0005-cloud-pilot-success-result-artifact-placement.md').read().split(chr(96)*3+'yaml')[1].split(chr(96)*3)[0])) for k in ['selected_option', 'rejected_options', 'follow_up_issue_ref'])"
# AC12
# baseline-expect: fail
$ rg -n "opaque reference" docs/dev/agent-run-report.md

Allowed Paths

  • docs/adr/0005-cloud-pilot-success-result-artifact-placement.md
  • docs/dev/secret-policy.md
  • docs/dev/agent-run-report.md
  • docs/dev/session-recording-policy.md

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • agent_run_report/v1 の schema 本体(docs/schemas/agent-run-report.schema.json 等)を変更する必要があると判明した場合(本 Issue は docs 上の decision 記録に限定し、schema 本体変更は別 follow-up Issue の scope とする)

Required Skills

  • workflow contract design
  • policy / docs alignment
  • public-safe telemetry governance

Runtime Verification Applicability

  • decision: not_applicable
  • reason: 本 Issue は docs 上の machine-readable decision 記録(artifact placement の 3 択決定と 6 項目の固定)に限定され、プロセス起動や実 Cloud pilot 実行を伴わない。静的検証(typecheck / lint / test / build / rg による文字列存在確認)のみで完結する。

Scope Delta(任意)

N/A

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. added
    enhancement
    phase/implementation
    triage-required
    agent/implementer
    on Jul 4, 2026
  2. squne121 commented on Jul 6, 2026

    @squne121
    OwnerAuthor

    敵対的レビュー結果

    Verdict: REQUEST_CHANGES。
    #1330 は必要な follow-up ですが、現状のまま実装すると「docs に文字列を置いただけで設計判断が通った」false-green になります。採用すべき placement は hybrid_reference_from_agent_run_report です。cloud_pilot_success_result/v1 の実体は standalone の public-safe result artifact/comment に置き、agent_run_report/v1 には opaque reference と digest だけを入れる設計に寄せるべきです。

    今回確認した範囲では、#1330 は open・コメントなしで、#1325 の OWNER レビュー指摘を受けて「artifact placement と public-safe projection を決める」設計判断 Issue になっています。候補は embed_in_agent_run_report_v1 / standalone_cloud_pilot_success_result_v1 / hybrid_reference_from_agent_run_report の三択で、決定後に marker_schema / schema_path / checker_command / digest_policy / github_comment_upsert_policy / raw_trace_body_publication_forbidden_fields を docs に固定する契約です。

    最大の問題

    1. embed_in_agent_run_report_v1 は、現行 schema では実質的に不正

    agent_run_report/v1 は top-level で additionalProperties: false です。必須 top-level fields に cloud_pilot_success_result のような拡張口はありません。さらに observationSourceMetrics も additionalProperties: false で、許可される metrics は trace_count / span_count / prompt_tokens / completion_tokens / total_tokens の5つだけです。#1330 自身もこの制約を認識していますが、三択の候補に embed_in_agent_run_report_v1 を同列で残しているため、実装者が「agent_run_report に Cloud pilot metrics を足す」方向へ誤読できます。これは #1330 の Stop Condition である「agent_run_report/v1 schema 本体変更が必要なら停止」と衝突します。

    JSON Schema の additionalProperties: false は同一 schema object 内で宣言済みの property 以外を拒否するため、閉じた object schema を後から雑に拡張すると検証不能・不合格になりやすいです。外部仕様上も、この設計で拡張したい場合は unevaluatedProperties 等を含む明示的な schema 設計が必要です。([json-schema.org]1)

    修正方針:
    embed_in_agent_run_report_v1 は「result 本体を embed する案」ではなく、最大でも evidence_refs / observation_projection_digest への 参照 embed と定義し直すべきです。result 本体を入れる案は #1330 の範囲では reject と明記してください。

    2. 現行 AC が rg 文字列存在確認に寄りすぎている

    #1330 の AC1〜AC8 は、最終的に rg -n "artifact_placement_decision" 等で文字列が見つかれば通り得る構造です。これは #246 が明示的に潰そうとしている false-green パターンと同型です。#246 は、AI self-report・grep・単発確認だけで PASS に見せられる構造を問題視し、authoritative evidence、negative control、availability/source 付き metrics を要求しています。

    修正方針:
    docs-only Issue でも、最低限は次を AC に入れるべきです。

    • decision block は 単一 YAML block として定義する
    • rg -c で block が 1件だけであることを確認する
    • YAML parse を実行し、selected_option / rejected_options / implementation_follow_up_issue_ref を機械的に検証する
    • follow_up_issue_ref: TBD_after_decision のまま close しない
    • schema_path と checker_command は「予約名」か「実装済み」かを明示する

    3. schema_path / checker_command を docs-only で固定するなら、予約状態を明記しないと危険

    #1326 は cloud_pilot_success_contract_v1 の checker/schema/negative fixture 実装 Issue で、#1330 が扱う result placement は scope 外です。#1325 も Safety Claim Matrix で cloud_pilot_success_result/v1 の正本配置は未制御・#1330 follow-up と明記しています。

    したがって #1330 が schema_path や checker_command を「定義」しても、そのファイル・コマンドが存在しないなら、採用判断に使える検証器ではありません。

    修正方針:
    #1330 内では次のように固定するのが安全です。

    schema_path:
      reserved_path: docs/schemas/cloud-pilot-success-result.schema.json
      exists_in_this_issue: false
      implementation_follow_up_required: true
    
    checker_command:
      reserved_command: pnpm run cloud-pilot-success-result:check
      exists_in_this_issue: false
      implementation_follow_up_required: true
    
    cloud_pilot_success_result_checker_follow_up_required:
      value: true
      follow_up_issue_ref: "#<new_issue_number>"
      adoption_allowed_before_checker: false

    推奨 placement

    採用: hybrid_reference_from_agent_run_report

    理由は単純です。

    つまり、result 本体は standalone、agent_run_report には参照だけが一番破綻しにくいです。

    具体的に固定すべき contract

    #1330 の成果物は、最低限この程度まで具体化してください。

    cloud_pilot_success_result_placement_decision_v1:
      selected_option: hybrid_reference_from_agent_run_report
      canonical_result_artifact:
        schema: cloud_pilot_success_result/v1
        surface: github_issue_comment
        body_kind: public_safe_projection_only
      agent_run_report_integration:
        allowed: true
        mode: opaque_reference_only
        allowed_reference_kinds:
          - github_comment
          - observation_projection_digest
        inline_result_body_allowed: false
        inline_cloud_pilot_metrics_allowed: false
      rejected_options:
        embed_in_agent_run_report_v1:
          reason: agent_run_report/v1 and observationSourceMetrics are closed schemas; full result embedding requires schema change outside this issue
        standalone_cloud_pilot_success_result_v1:
          reason: standalone-only breaks GitHub retro discoverability unless referenced from agent_run_report or retro context

    marker_schema の要求水準

    GitHub comment を正本にするなら、marker は ownership と digest を分けるべきです。既存の ChatGPT retro marker も外側 marker と digest marker を分けています。

    推奨:

    <!-- CLOUD_PILOT_SUCCESS_RESULT_V1 repo=squne121/loop-protocol target=issue:<pilot_issue> parent_issue=1153 result_id=<stable-id> -->
    <!-- CLOUD_PILOT_SUCCESS_RESULT_DIGEST_V1 sha256:<64hex> -->
    

    payload は fenced JSON/YAML にし、少なくとも以下を持たせるべきです。

    schema: cloud_pilot_success_result/v1
    result_id: stable_id
    parent_issue: "#1153"
    contract_issue: "#1260"
    placement_issue: "#1330"
    gate_refs:
      session_recording_smoke: "#246"
      latitude_real_pilot_decision: "#1220"
      latitude_distribution_gate: "#1261"
      success_contract_checker: "#1326"
    decision:
      value: adopt_cloud | adopt_self_host | conditional_adoption | withdraw
      decision_ready: false
    metrics:
      attempted_runs_denominator: ...
      eligible_run_count: ...
      trace_arrival_rate: ...
      request_to_span_coverage: ...
      upload_retry_count: ...
      local_spool_remaining: ...
      end_to_end_latency_p95_seconds: ...
      credits_per_eligible_run: ...
    safety:
      raw_values_emitted: false
      forbidden_field_scan: pass
      redaction_false_negative_count: 0

    github_comment_upsert_policy の要求水準

    GitHub の Issue comment API は list/create/update が分かれており、update は comment_id 指定です。Pull Request も Issue として扱われます。したがって upsert は「検索して、なければ create、1件なら update、複数なら fail-closed」にする必要があります。([GitHub Docs]2) ([GitHub Docs]2) ([GitHub Docs]2)

    推奨 contract:

    github_comment_upsert_policy:
      target_surface: github_issue_comment
      list_comments:
        pagination_required: true
        per_page: 100
      match_selector:
        exact_outer_marker: CLOUD_PILOT_SUCCESS_RESULT_V1
        match_fields:
          - repo
          - target
          - parent_issue
          - result_id
      zero_matches: create
      one_match: update_existing_comment_by_comment_id
      multiple_matches: fail_closed
      stale_digest_mismatch: fail_closed
      actor_restriction:
        allowed_authors:
          - repository_owner
          - github-actions[bot]
      duplicate_comment_creation_allowed: false

    digest_policy の要求水準

    digest は public-safe projection の canonical body に対してだけ計算してください。raw trace body、prompt、tool I/O、API key、local path などを hash 化して public に出すのは避けるべきです。hash でも、低エントロピー値や既知形式の secret は推測攻撃の対象になります。

    推奨:

    digest_policy:
      digest_algorithm: sha256
      digest_input: canonical_public_safe_projection_json
      canonicalization:
        encoding: utf8
        newline: lf
        object_key_order: lexical
        insignificant_whitespace: stripped
      forbidden_digest_inputs:
        - raw_trace_body
        - raw_prompt
        - raw_tool_input
        - raw_tool_output
        - credential_value
        - local_path
        - argv
        - stdout
        - stderr
      digest_publication_allowed: true
      raw_source_digest_publication_allowed: false

    既存 repo でも、public projection digest を canonical JSON から再計算して一致しない report を fail-closed にする設計がすでにあります。#1330 はこの既存方針に合わせるべきです。

    raw_trace_body_publication_forbidden_fields はもっと広くするべき

    現行 docs では forbidden fields として raw_transcript、transcript_excerpt、full_command_output、stdout、stderr、local_path が明示されています。

    Cloud pilot result ではさらに以下を禁止にしてください。

    raw_trace_body_publication_forbidden_fields:
      - raw_trace_body
      - raw_span_body
      - raw_event_body
      - span_attributes_raw
      - resource_attributes_raw
      - request_body
      - response_body
      - request_headers
      - response_headers
      - authorization
      - cookie
      - set_cookie
      - api_key
      - credential
      - raw_prompt
      - full_prompt
      - system_prompt
      - tool_input
      - tool_output
      - command_line
      - argv
      - env
      - stdout
      - stderr
      - full_command_output
      - local_path
      - shell_history
      - terminal_scrollback
      - provider_console_url_unredacted

    OpenTelemetry の span は trace/span ID だけでなく attributes、events、links、status などを持ち得ます。public projection は raw span attributes/events をそのまま出すのではなく、count、coverage、latency、digest、closed enum reason code へ落とすべきです。(OpenTelemetry)

    trace ID を出す場合も、W3C Trace Context の trace-id / parent-id は形式制約があります。公開するなら raw ID ではなく hashed/correlated ID にするか、少なくとも形式検証済みの public-safe ID として扱うべきです。(W3C)

    #1261 / #1220 / #1326 との整合

    #1220 は closed completed で、Latitude real pilot exception decision gate を定義済みです。#1261 も closed completed で、distribution / argv / remote cleanup gate を強化済みです。一方で #1326 はまだ open で、cloud_pilot_success_contract_v1 checker/schema/negative fixture は未完了です。#1330 も open です。したがって #1260 の not_adoption_ready_until_1261_1326_and_artifact_placement_complete: true は、少なくとも #1326 と #1330 が閉じるまでは採用判断をブロックします。

    注意点として、#1261 の Issue state が completed でも、result contract 側では「Issue が closed か」ではなく field-level evidence が machine-verified かを参照するべきです。#1260 の hard blocker は remote_cleanup_state_required: machine_verified を要求しており、unknown のまま Cloud adoption を許可しない契約です。

    最小修正案

    #1330 は以下を追加・変更しないと merge 可能な Issue にはなりません。

    1. artifact_placement_decision.selected_option: hybrid_reference_from_agent_run_report を明記する。
    2. embed_in_agent_run_report_v1 は「full result embed 不可。reference only なら hybrid」と定義する。
    3. standalone_cloud_pilot_success_result_v1 は「単独正本としては可。ただし discoverability のため agent_run_report reference 必須」と定義する。
    4. marker_schema に outer marker、digest marker、payload schema、target fields、duplicate handling を含める。
    5. schema_path / checker_command は実装済みではなく reserved であること、follow-up Issue が必須であることを明記する。
    6. digest_policy は public projection canonical digest に限定し、raw/secret/hash 公開を禁止する。
    7. github_comment_upsert_policy は pagination-aware・duplicate-safe・stale digest fail-closed にする。
    8. raw_trace_body_publication_forbidden_fields は trace/span attributes/events/request/response/header/env/argv/path/provider URL まで含める。
    9. Verification は rg だけでなく、YAML parse、single block count、selected option enum、follow-up ref 非 TBD を確認する。
    10. 実装: cloud_pilot_success_contract_v1 の checker/schema/negative fixtureを実装する #1326 完了前、または 実装: cloud_pilot_success_result/v1 の正本 artifact placement と public-safe projection を決める #1330 の follow-up checker 実装前に cloud_adoption_allowed_now を true にできないと明記する。

    最終判定

    #1330 の方向性は正しいですが、現状は 「設計判断 Issue」としても未固定部分が多すぎるです。特に embed_in_agent_run_report_v1 の扱い、rg ベース AC、schema_path/checker_command の予約状態、raw trace 禁止項目の狭さが危険です。

    採用すべき設計は hybrid。
    cloud_pilot_success_result/v1 の本体は standalone public-safe projection artifact/comment。agent_run_report/v1 は既存 schema を壊さず、github_comment / observation_projection_digest の opaque reference だけを持つ。これが #1153 の GitHub retrospective 導線、#1260 の fail-closed decision contract、現行 agent_run_report/v1 schema の三者を同時に満たす最小リスク案です。

  3. squne121 commented on Jul 6, 2026

    @squne121
    OwnerAuthor

    Refinement Loop: Approved

    The issue has been approved and is ready for implementation.

  4. squne121 commented on Jul 6, 2026

    @squne121
    OwnerAuthor

    Contract Review Result

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-07-06T13:59:05Z"
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/1330
      body_sha256: "sha256:184ed906a137e072efc925549bb440bedef7094d038eecabac539e1898d46d56"
      checks:
        readiness: go
        blockers: pass
        product_spec: pass
        vc_preflight: pass
      source: ensure_contract_snapshot_auto
  5. squne121 commented on Jul 6, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-07-06T23:20:00Z)

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/implementerenhancementphase/implementationtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions