Skip to content

実装: Latitude telemetry distribution / argv / remote cleanup gate を real pilot 前提で強化する #1261

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "#1153"
goal_ref: "anchor comment #4853598494 の P0 blocker に従い、Latitude telemetry distribution / argv exposure / remote cleanup gate を real pilot activation 前提で fail-closed に強化する"
change_kind: mixed

Parent Issue

#1153

Parent Goal Ref

  • Goal: EntireCLI + Latitude の観測データ導線を false-green なしで評価し、Cloud pilot / adoption decision を public-safe に記録する
  • Desired Destination: real pilot activation には exact package provenance・argv exposure state・remote cleanup state が machine-readable に揃っていることが必須で、unknown のまま allow されない状態

Current Validated Scope

  • Latitude distribution evidence を host checker と docs で exact package / integrity / provenance / digest(tarball_sha256 / installed_entrypoint_sha256 / preload_sha256 / hook_command_sha256 / resolution_source)単位に強化し、resolution_source_enum を closed set として扱う
  • argv_exposure_state を absent_verified と簡単に断定しない fail-closed contract にする
  • remote_cleanup_state は provider-side delete / retention verification が machine-verified でない限り blocked のままにする

Remaining Parent Gaps

Outcome

Latitude telemetry の real pilot activation が、exact package distribution evidence・argv exposure state・remote cleanup state を machine-readable に満たすときだけ allow され、npx -y や provenance unknown、cleanup unknown のまま false-green にならない状態。

In Scope

  • floating npx -y @latitude-data/claude-code-telemetry を real pilot preflight では blocked にする
  • exact semver package spec を必須にする
  • distribution evidence に resolved_registry_origin / dist_integrity / npm_registry_signature_verified / provenance_verified_or_explicitly_blocked / lockfile_digest / tarball_sha256 / installed_entrypoint_sha256 / preload_sha256 / hook_command_sha256 / resolution_source を追加または required 化する
  • resolution_source_enum を local_lockfile | project_local_install | npm_cache | global_install | npx_only | unknown に閉じる
  • argv_exposure_state を absent_verified | possible | unknown で扱い、unknown / possible では rotation required + blocked にする
  • shell history / terminal scrollback を自動収集しない
  • remote_cleanup_state は provider-side delete / retention verification が machine-verified でない限り unknown とし Cloud pilot close readiness では blocking にする

Out of Scope

  • real cloud credits 消費
  • provider console / remote delete の実行
  • secret rotation の代行
  • observation source schema / adapter / marker / retro index の設計変更

Acceptance Criteria

  • AC1: real pilot preflight で unpinned package が blocked になる
  • AC2: real pilot preflight で npx_only_without_exact_version が blocked になる
  • AC3: distribution evidence に registry origin / integrity / provenance / tarball / entrypoint / preload / hook digest / resolution source が machine-readable に出る
  • AC4: resolution_source が local_lockfile | project_local_install | npm_cache | global_install | npx_only | unknown の closed enum になる
  • AC5: argv_exposure_state が absent_verified | possible | unknown として扱われ、possible / unknown は activation blocked になる
  • AC6: shell history / terminal scrollback を自動で読まない契約が docs / tests に固定される
  • AC7: remote_cleanup_state が machine-verified でない限り unknown のまま Cloud pilot close readiness を block する

Runtime Verification Applicability

  • decision: immediate
  • reason: pnpm run security:session-recording:host が実プロセス(アクティブな Claude process 検査)・実環境変数(BUN_OPTIONS 等)・実ファイルシステム(/etc/environment.d 等)を実行環境上で検査するため、静的検証だけでは AC1/AC2/AC5/AC7 を検証できない。この host 実行コマンド、および同様に host 実行前提の pnpm run policy:check は VC preflight の pnpm allowlist(pnpm typecheck / pnpm lint / pnpm test / pnpm build のみ)に含まれないため、自動実行対象の Verification Commands には含めず、本セクションの artifact_requirements に基づき host 実行時の証跡を PR に添付する
decision: immediate
applicable_acs:
  - AC1
  - AC2
  - AC5
  - AC7
execution_environment:
  cli_tools:
    - pnpm
    - node
  auth_required: false
  network_required: false
skip_conditions:
  - "host execution profile が利用できない実行環境(アクティブな Claude process / 対象環境変数 / 対象ファイルシステムを検査できない sandbox 等)では SKIP(exit 77)として扱い、fail-closed でエスカレーションする"
fallback_policy:
  fallback_success_is_pass: false
  notes: "fixture-only / static 検証経由でのみ成功する場合は host execution profile の PASS とみなさない"
artifact_requirements:
  - "pnpm run security:session-recording:host の実行ログ・exit code(VC preflight の pnpm allowlist 外のため host 実行時に手動採取し PR の Runtime Verification Evidence セクションへ添付する)"
  - "pnpm run policy:check の実行ログ・exit code(同上の理由で自動実行対象外。AC3/AC4/AC6 の docs/schema 整合性確認として host 実行時に採取する)"
  - "distribution evidence machine-readable JSON 出力"

Verification Commands

pnpm run policy:check / pnpm run security:session-recording:fixture / pnpm run security:session-recording:host は VC preflight の pnpm allowlist(pnpm typecheck / pnpm lint / pnpm test / pnpm build のみ)に含まれないため、以下の自動実行ブロックには含めない。AC1/AC2(unpinned package / npx_only_without_exact_version の blocked 化)は host 実行専用の pnpm run security:session-recording:host でのみ動作検証されるため、直下の pnpm typecheck 等はトレーサビリティ用の AC マーカー添付のみを目的とし、AC1/AC2 自体の実行はここでは行わない。AC6(shell history / scrollback 非収集契約)は pnpm lint / pnpm test 内の静的契約テストで固定される。pnpm run security:session-recording:fixture が呼ぶ .claude/scripts/check_session_recording_runtime_safety.py --execution-profile fixture は tests/session_recording_runtime_safety.test.ts が同一 fixture 経由で既に検証しており、下記の pnpm test 実行で代替される。pnpm run policy:check と pnpm run security:session-recording:host は上記 Runtime Verification Applicability の artifact_requirements に従い host 実行時に手動採取する。

# AC1
# AC2
# AC6
$ pnpm typecheck
$ pnpm lint
$ pnpm test
$ pnpm build

以下の rg は distribution evidence フィールドの静的な存在確認。resolution_source / tarball_sha256 / installed_entrypoint_sha256 / preload_sha256 は .claude/scripts/lib/latitude_telemetry_safety.py に scaffold 済みのプレースホルダとして既に存在するため baseline でも一致する(promotion 型の検証であり # baseline-expect: pass を付与する)。hook_command_sha256 / argv_exposure_state / remote_cleanup_state は実装コードに未着手のため baseline では一致しない想定。

# AC3
# AC4
# baseline-expect: pass
$ rg -n "resolution_source" .claude/scripts/check_session_recording_runtime_safety.py .claude/scripts/lib/latitude_telemetry_safety.py
# baseline-expect: pass
$ rg -n "tarball_sha256" .claude/scripts/check_session_recording_runtime_safety.py .claude/scripts/lib/latitude_telemetry_safety.py
# baseline-expect: pass
$ rg -n "installed_entrypoint_sha256" .claude/scripts/check_session_recording_runtime_safety.py .claude/scripts/lib/latitude_telemetry_safety.py
# baseline-expect: pass
$ rg -n "preload_sha256" .claude/scripts/check_session_recording_runtime_safety.py .claude/scripts/lib/latitude_telemetry_safety.py
$ rg -n "hook_command_sha256" .claude/scripts/check_session_recording_runtime_safety.py .claude/scripts/lib/latitude_telemetry_safety.py
# AC5
$ rg -n "argv_exposure_state" .claude/scripts/check_session_recording_runtime_safety.py .claude/scripts/lib/latitude_telemetry_safety.py
# AC7
$ rg -n "remote_cleanup_state" .claude/scripts/check_session_recording_runtime_safety.py .claude/scripts/lib/latitude_telemetry_safety.py

Allowed Paths

  • package.json
  • docs/dev/secret-policy.md
  • docs/dev/session-recording-policy.md
  • .claude/scripts/check_session_recording_runtime_safety.py
  • .claude/scripts/lib/latitude_telemetry_safety.py
  • tests/session_recording_runtime_safety.test.ts
  • tests/fixtures/session-recording-runtime-safety/**

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • secret value / raw request body / raw trace body / shell history / terminal scrollback を読む必要が生じた場合
  • 動作検証 AC の VC が SKIP(exit 77)を返した場合(実行環境不可のためエスカレーション)
  • fallback 経由でのみ「成功」する場合(FAIL として扱い、実行環境を確認)

Required Skills

  • Python runtime verification
  • npm provenance / integrity verification
  • fail-closed policy design

Scope Delta(任意)

N/A

Activity

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

    @squne121
    OwnerAuthor

    判定

    REQUEST_CHANGES。#1261 は必要な Issue だが、現行 repo 実装は #1261 の AC を満たしていません。real pilot / Cloud pilot は BLOCKED 継続が妥当です。

    #1261 自体は、floating npx -y @latitude-data/claude-code-telemetry の禁止、exact semver、distribution evidence、closed resolution_source、argv_exposure_state、remote_cleanup_state を要求しており、方向性は正しいです。 ただし現行コードは、それらを 直接 gate していないため、現時点で allow path を作ると false-green になります。

    参照関係の整理

    #1261 は #1153 の real pilot safety gate の一部です。#1153 側では、Latitude は fail-open と扱い、missing telemetry を成功で隠さず availability: unavailable として残すこと、GitHub に永続化するのは public-safe report/index であり raw trace ではないことが固定されています。

    関連実装では、#1258 / PR #1275 が latitude:real-pilot:preflight を追加し、host/preflight は現状 expected blocked evidence として exit 1 になることを確認しています。 #1260 は Cloud pilot success contract 側で #1261 を hard blocker にしています。 #1220 / secret-policy も argv_exposure_state: absent_verified と remote_cleanup_state: machine_verified を activation 条件にしています。

    P0: real-pilot preflight predicate が #1261 の必須 evidence を見ていない

    現行の strict preflight は、host profile、top-level safe、pilot decision、source digest、Latitude safe、distribution.state == verified、registry_signature_verified == true、provenance_verified == true までは確認します。

    しかし #1261 が要求する以下を 直接確認していません。

    • resolved_registry_origin
    • lockfile_digest
    • tarball_sha256
    • installed_entrypoint_sha256
    • preload_sha256
    • hook_command_sha256
    • resolution_source
    • argv_exposure_state
    • remote_cleanup_state

    実際、現在の Latitude component output は tarball_sha256、installed_entrypoint_sha256、preload_sha256 を常に None、resolution_source を常に "unknown" で返しています。hook_command_sha256 は output に存在しません。

    これは P0 です。distribution.state: verified という要約 field だけを信じる設計にすると、下位 evidence が欠落しても preflight が通る余地があります。#1261 は「要約 state」ではなく「evidence completeness」を gate する Issue です。

    P0: host distribution checker が実際には verified evidence を作れない

    check_distribution() は fixture override では SRRS_LAT_DIST_* を見ますが、host mode では _check_distribution_host() に入り、npm list -g --depth=0 --json でグローバル package 存在を探すだけです。見つかった場合も package_spec は package 名だけで、version、integrity、provenance は未確定のまま state: unknown を返します。

    #1261 の目的は、npx / lockfile / npm cache / global install のどこから解決されたかを resolution_source として閉じ、exact package provenance を machine-readable に出すことです。現状の host checker は、その前提に到達していません。

    npm 側の実装としては、registry signature は npm audit signatures で検証できます。npm docs は registry signatures の検証コマンドを npm audit signatures として示し、署名が欠落する場合はエラーになり得ると説明しています。([npmドキュメント]1) provenance attestation も同じく npm audit signatures で検証でき、verified attestations count を返します。([npmドキュメント]2) ただし npm provenance は「悪意あるコードがない」ことの保証ではなく、source/build instructions への検証可能リンクです。([npmドキュメント]2)

    したがって、#1261 の provenance_verified_or_explicitly_blocked は妥当ですが、provenance_verified: true だけを trust boundary にしてはいけません。

    P0: argv_exposure_state が実装されていない

    secret-policy は argv_exposure_state: absent_verified | possible | unknown を contract とし、possible / unknown なら rotation required + blocked としています。 session-recording-policy も argv_exposure_state が possible / unknown なら real session start gate を blocked と明記しています。

    しかし現行コードの check_argv_credential() は /proc/self/cmdline、つまり checker 自身の argv だけを見ています。Claude / node / bun / npx / telemetry hook process の argv は見ていません。さらに output field は argv_exposure_state ではなく、generic な exposure_state / reason code に吸収されています。

    Latitude 公式 docs は installer に --api-key=lat_xxx を渡す例を掲載しており、これはまさに argv exposure risk です。([Latitude Docs]3) この risk を検証対象にしている #1261 に対して、現在の実装は false-negative になります。

    P0: remote_cleanup_state が存在しない

    #1261 は provider-side delete / retention verification が machine-verified でない限り remote_cleanup_state: unknown とし、Cloud pilot readiness を block する契約です。 secret-policy も human_attested は machine_verified の代替ではないと明記しています。 Cloud pilot contract でも remote_cleanup_state_required: machine_verified が hard blocker です。

    現行コードには remote_trace_state はありますが、remote_cleanup_state はありません。しかも default は unknown で、provider-side delete / retention を machine-verified する経路は未実装です。

    これは単なる命名差ではありません。remote_trace_state は「trace があるか」寄りで、#1261 が求める「retention / delete の検証」ではありません。

    P1: docs と checker の contract drift

    secret-policy の allow_requires は、現状 distribution.state: verified、registry_signature_verified: true、provenance_verified: true までしか strict allow 条件に含めていません。#1261 で必要な digest 群や argv / remote cleanup は blocked_or_fail_closed_until に書かれているだけです。

    一方、Cloud pilot contract は LATITUDE_DISTRIBUTION_GATE_V1 marker と evidence_digest を要求しています。 しかし現行実装にはこの marker schema / evidence digest producer がありません。

    結論として、docs は「#1261 が必要」と言っていますが、checker はまだ「#1261 の evidence が揃っているか」を判定していません。

    P1: テストが override 偏重で、実配布物の検証になっていない

    既存テストは SRRS_LAT_DIST_SPEC=unpinned で distribution_unpinned を確認し、pinned spec + provenance unknown で reason code を確認しています。 しかし実際の @latitude-data/claude-code-telemetry の lockfile / tarball / installed entrypoint / preload / hook command digest は検証していません。

    さらに argv exposure のテストも SRRS_LAT_ARGV_CREDENTIAL=present override による synthetic test であり、live process cmdline の検証ではありません。 これは CI fixture としては有用ですが、#1261 の real pilot gate には不足です。

    P1: async hook を evidence source にしてはいけない

    Latitude 公式 manual configuration は Stop hook command に unpinned npx -y @latitude-data/claude-code-telemetry を設定し、async: true にしています。([Latitude Docs]3) Claude Code docs では、matching hooks は parallel に実行され、async hook は Claude の実行を block / control できず、複数発火間の deduplication もないとされています。([Claude Platform Docs]4) ([Claude Platform Docs]4)

    したがって、hook exit 0、hook presence、Stop hook config の存在は capture success / cleanup success / no duplicate upload の証拠になりません。#1153 の既存レビューコメントが「hook exit 0 で trace 到達を PASS 判定するな」としているのは正しいです。

    修正方針

    #1261 は次のように実装しないと weak gate になります。

    1. LATITUDE_DISTRIBUTION_GATE_V1 を新設する

    最低限、以下の shape を checker output または marker artifact に追加してください。

    LATITUDE_DISTRIBUTION_GATE_V1:
      package_name: "@latitude-data/claude-code-telemetry"
      package_spec: "@latitude-data/[email protected]"
      exact_version: "x.y.z"
      resolved_registry_origin: "https://registry.npmjs.org"
      resolution_source: local_lockfile | project_local_install | npm_cache | global_install | npx_only | unknown
      npx_invocation: absent | exact_version | floating | unknown
    
      lockfile_digest: "sha256:<64hex>"
      dist_integrity: "sha512-..."
      npm_audit_signatures_verified: true
      npm_registry_signature_verified: true
      provenance_state: verified | unavailable_explicitly_blocked | unknown
    
      tarball_sha256: "sha256:<64hex>"
      installed_entrypoint_sha256: "sha256:<64hex>"
      preload_sha256: "sha256:<64hex>"
      hook_command_sha256: "sha256:<64hex>"
    
      argv_exposure_state: absent_verified | possible | unknown
      credential_rotation_state: not_required | required | completed_attested
      remote_cleanup_state: machine_verified | human_attested | unknown
    
      evidence_digest: "sha256:<64hex>"
      decision: allow | blocked | fail_closed
      reason_codes: []

    2. preflight predicate を direct field assertion に変える

    distribution.state == verified のような要約 state ではなく、上記 field を全部 direct に assert してください。

    特に以下は 1 つでも欠けたら blocked または fail_closed です。

    package_spec exact semver
    resolved_registry_origin approved
    resolution_source != unknown
    npx_invocation != floating
    lockfile_digest present
    npm_audit_signatures_verified == true
    npm_registry_signature_verified == true
    tarball_sha256 present
    installed_entrypoint_sha256 present
    preload_sha256 present
    hook_command_sha256 present
    argv_exposure_state == absent_verified
    credential_rotation_state != required
    remote_cleanup_state == machine_verified
    evidence_digest present
    

    3. host checker の検証順序を固定する

    推奨順序は次です。

    1. Claude settings / hook command を read-only で取得
    2. command から package spec を parse
    3. floating npx なら即 blocked: npx_only_without_exact_version
    4. project lockfile / local install / npm cache / global install / npx-only を順に解決
    5. resolution_source を closed enum で確定
    6. npm registry origin / dist.integrity / dist.tarball / signatures / attestations を取得
    7. isolated temp install または resolved install tree から entrypoint / preload を hash
    8. normalized hook command を hash
    9. live relevant processes の argv を presence-only で検査
    10. provider-side retention/delete verification artifact を要求
    11. 全 evidence を canonical JSON 化して evidence_digest を計算
    

    shell history / terminal scrollback は #1261 の契約どおり読まないでください。代わりに live process argv と local config surface だけを presence-only で見て、検査不能なら unknown に落とすべきです。

    4. negative fixtures を増やす

    少なくとも以下は latitude:real-pilot:preflight で blocked/fail_closed にする必要があります。

    floating npx: npx -y @latitude-data/claude-code-telemetry
    exact npx だが lockfile_digest missing
    exact semver だが dist_integrity missing
    registry origin mismatch
    npm audit signatures failed
    provenance unknown
    tarball_sha256 mismatch
    installed_entrypoint_sha256 missing
    preload_sha256 missing
    hook_command_sha256 missing
    resolution_source unknown
    argv_exposure_state unknown
    argv_exposure_state possible
    credential_rotation_state required
    remote_cleanup_state human_attested
    remote_cleanup_state unknown
    LATITUDE_DISTRIBUTION_GATE_V1 evidence_digest missing
    fixture JSON が distribution.state=verified だけを偽装
    

    実装エージェントへの指示案

    Issue #1261 を実装する。目的は real pilot preflight が Latitude telemetry の exact package provenance / argv exposure / remote cleanup evidence を直接検証し、unknown や floating npx を allow しない状態にすること。
    
    必ず関連 Issue / PR / docs を読む:
    - #1153 parent
    - #1157 containment
    - #1220 real pilot decision
    - #1258 / PR #1275 real-pilot preflight
    - #1260 / PR #1325 Cloud pilot contract
    - #1259 / PR #1293 reason code contract
    - docs/dev/secret-policy.md
    - docs/dev/session-recording-policy.md
    - .claude/scripts/check_session_recording_runtime_safety.py
    - .claude/scripts/lib/latitude_telemetry_safety.py
    - tests/session_recording_runtime_safety.test.ts
    
    実装要件:
    1. LATITUDE_DISTRIBUTION_GATE_V1 相当の machine-readable evidence object を追加する。
    2. distribution evidence に resolved_registry_origin / dist_integrity / npm_audit_signatures_verified / npm_registry_signature_verified / provenance_state / lockfile_digest / tarball_sha256 / installed_entrypoint_sha256 / preload_sha256 / hook_command_sha256 / resolution_source を含める。
    3. resolution_source は local_lockfile | project_local_install | npm_cache | global_install | npx_only | unknown の closed enum にする。
    4. floating `npx -y @latitude-data/claude-code-telemetry` は real pilot preflight で blocked にする。
    5. `argv_exposure_state` を absent_verified | possible | unknown として独立 field にし、possible / unknown は rotation required + blocked にする。
    6. shell history / terminal scrollback は読まない。live process argv と local config の presence-only 検査に限定する。
    7. `remote_cleanup_state` を machine_verified | human_attested | unknown として独立 field にし、machine_verified 以外は Cloud pilot readiness blocked にする。
    8. preflight predicate は distribution.state の要約だけでなく、全 required field を direct assert する。
    9. 既存 tests に negative fixture を追加し、要約 state の偽装だけでは allow にならないことを証明する。
    10. `pnpm typecheck`, `pnpm lint`, `pnpm test`, `pnpm build`, `pnpm run policy:check`, `pnpm run security:session-recording:fixture`, `pnpm run security:session-recording:host`, `pnpm run latitude:real-pilot:preflight` を実行し、host/preflight が expected blocked evidence になることを記録する。
    
    禁止:
    - real cloud credits 消費
    - provider console delete の実行
    - secret value / raw request body / raw trace body / shell history / terminal scrollback の読み取り
    - fixture-only override を host proof として扱うこと
    - hook exit 0 を capture / cleanup 成功の証拠にすること
    

    結論として、#1261 は close してはいけません。現行は「#1261 を必要とする前提」はかなり整っていますが、「#1261 の evidence を実際に machine gate する実装」はまだ未完成です。

  3. squne121 commented on Jul 4, 2026

    @squne121
    OwnerAuthor

    Refinement Loop: Human Escalation Required

    The loop has terminated and requires human review. Cause: human judgment required

    Blockers

    "scope_signal_guard_triggered"
    
    "scope_signal_guard_reason_code:new_allowed_path_layer"
    
    "anchor comment (issuecomment-4882715116, OWNER) は freeform directive のみで ANCHOR_SCOPE_REFRAME_V1 構造化payloadを含まず、scope_delta_authority.directive.confidence=inferred(explicit未満)のため contract_update_required に自動遷移できない"
    
    "review-issue の C5/C9 blocker は Step4 rewriteで解消済み(AC番号付与・Runtime Verification Applicability追加・Stop Conditions追加)。live check_issue_contract.py --issue 1261 は verdict: approve"
    
    "human判断が必要な点: anchor comment の内容(distribution evidence fields 追加要求等)が現在の Allowed Paths / In Scope と一致しているか、および Allowed Paths に含まれる .claude/scripts/lib/latitude_telemetry_safety.py が既存ファイルの継続編集であり新規アーキテクチャ層ではないことの確認"
    
  4. squne121 commented on Jul 5, 2026

    @squne121
    OwnerAuthor

    判定

    REQUEST_CHANGES。#1261 は必要だが、現状の repo 実装を前提に real pilot / Cloud pilot を allow するのは false-green です。
    #1261 は distribution provenance、argv exposure、remote cleanup を real pilot 前提で強化する Issue ですが、現行 checker はその必須 evidence を直接 gate していません。既存コメントの「BLOCKED 継続」判定は妥当です。

    主要な関連関係

    #1153 は private observation plane と public retrospective plane を分離し、raw transcript / full prompt / tool I/O / local path / API key を GitHub に出さない前提を固定しています。
    #1220 は argv_exposure_state: absent_verified、provider-side cleanup の machine verification、exact package evidence を real pilot activation 条件にしています。
    #1260 / PR #1325 は #1261 と #1220 を Cloud adoption の hard blocker として扱っています。
    PR #1275 は latitude:real-pilot:preflight を追加していますが、#1261 の distribution / argv / cleanup evidence 完成までは blocked のままにする位置づけです。

    P0 指摘

    1. strict preflight が #1261 の必須 evidence を見ていない

    _evaluate_real_pilot_preflight_output() は execution_profile == host、top-level safe、source_digest、pilot decision、Latitude safe、distribution.state == verified、registry_signature_verified == true、provenance_verified == true までは見ています。
    しかし #1261 が要求する resolved_registry_origin、lockfile_digest、tarball_sha256、installed_entrypoint_sha256、preload_sha256、hook_command_sha256、resolution_source、argv_exposure_state、remote_cleanup_state を直接 assert していません。現行 output でも tarball_sha256 / installed_entrypoint_sha256 / preload_sha256 は常に None、resolution_source は "unknown" です。

    攻撃的に見ると、これは「下位証跡が欠落していても、要約 field だけ verified: true に見えれば predicate が通る」構造です。#1261 は summary verdict ではなく evidence completeness を gate する Issue なので、ここは P0 です。

    2. host distribution checker が実配布物を検証していない

    check_distribution() の host path は npm list -g --depth=0 --json でグローバル package の存在を探すだけで、version、registry origin、lockfile digest、tarball digest、entrypoint/preload/hook hash、registry signature、provenance attestation を生成していません。見つかった場合も state: unknown と inspection gap を返すだけです。

    npm 公式は registry signature の検証に npm audit signatures を示し、署名欠落時はエラーになり得ると説明しています。([npm ドキュメント]1) また provenance attestation も npm audit signatures で検証できる一方、provenance は「悪意あるコードがない」保証ではなく、source/build instructions への検証可能リンクに過ぎません。([npm ドキュメント]2) ([npm ドキュメント]2)

    したがって、実装は最低でも「exact package spec → registry metadata → SRI / tarball sha256 → unpacked entrypoint/preload hash → normalized hook command hash → signature/provenance result → canonical evidence digest」まで落とす必要があります。

    3. argv_exposure_state が実装されていない

    現在の check_argv_credential() は /proc/self/cmdline、つまり checker 自身の argv だけを見ています。Claude / node / bun / npm / npx / telemetry hook の process argv は見ていません。
    一方、secret-policy は argv_exposure_state: absent_verified | possible | unknown を定義し、possible / unknown なら rotation required + activation blocked としています。

    Latitude 公式 docs は installer に --api-key=lat_xxx を渡す例を掲載しており、argv exposure は机上のリスクではありません。([Latitude Docs]3) この repo の checker は secret 値を読まず、presence-only で relevant process cmdline を確認し、読めない surface があれば unknown に落として block すべきです。

    4. remote_cleanup_state が存在しない

    現行コードにあるのは remote_trace_state で、default は unknown です。
    しかし #1261 が求めているのは provider-side retention / delete verification の remote_cleanup_state です。secret-policy でも human_attested は machine_verified の代替ではなく、machine verification がなければ activation は blocked とされています。 Cloud pilot contract も remote_cleanup_state_required: machine_verified を hard blocker にしています。

    remote_trace_state と remote_cleanup_state は別物です。trace が「無い/不明」かどうかと、retention/delete が machine-verified かどうかは同じ証跡ではありません。

    P1 指摘

    docs/dev/secret-policy.md は approve 時に exact version、lockfile digest、npm signature、tarball、entrypoint、preload、hook command digest を要求しています。 ただし latitude:real-pilot:preflight の allow predicate は現状 summary field に寄っており、docs と checker の contract drift が残っています。

    既存テストも override 偏重です。SRRS_LAT_PILOT_DIST_DIGESTS=complete や SRRS_LAT_PILOT_REMOTE_CLEANUP=machine_verified で activation を作れますが、実際の npm tarball / lockfile / entrypoint / preload / hook command を検証しているわけではありません。 strict predicate の positive fixture も distribution.state / registry_signature_verified / provenance_verified の summary に依存しています。

    Latitude 公式 manual configuration は Stop hook に unpinned npx -y @latitude-data/claude-code-telemetry と async: true を置く例です。([Latitude Docs]3) Claude Code docs では matching hooks は parallel に実行され、async hook は block/control できず、複数発火の deduplication もありません。([Claude Platform Docs]4) ([Claude Platform Docs]4) そのため hook exit 0 / hook presence / async upload は capture success や cleanup success の証跡にしてはいけません。

    修正方針

    #1261 は以下を close 条件にしてください。

    1. LATITUDE_DISTRIBUTION_GATE_V1 相当の machine-readable block を追加し、package_spec_exact、resolved_registry_origin、dist_integrity、npm_registry_signature_verified、provenance_verified_or_explicitly_blocked、lockfile_digest、tarball_sha256、installed_entrypoint_sha256、preload_sha256、hook_command_sha256、resolution_source、evidence_digest を必須化する。
    2. resolution_source は local_lockfile | project_local_install | npm_cache | global_install | npx_only | unknown の closed enum にし、unknown と floating npx_only は fail-closed。
    3. argv_exposure_state を top-level または components.latitude.argv に明示し、relevant process argv を presence-only で検査する。読めない process / OS unsupported は unknown。
    4. remote_cleanup_state を machine_verified | human_attested | unknown で実装し、machine_verified 以外は real pilot / Cloud pilot を block。
    5. preflight predicate は summary fields ではなく、上記の各 required field と evidence_digest を直接 assert する。
    6. negative fixture は最低限、floating npx、exact npx だが lockfile digest 欠落、signature false、provenance unknown、tarball hash 欠落、entrypoint/preload/hook hash 欠落、resolution_source unknown、argv possible/unknown、remote cleanup human_attested/unknown、summary-only fake verified を追加する。

    AI実装エージェントへの指示

    #1261 は「docs の要求を増やす Issue」ではなく「real pilot allow predicate の false-green を潰す Issue」として実装させてください。PR は latitude:real-pilot:preflight が、#1261 の distribution / argv / remote cleanup evidence をすべて machine-readable に検査し、1つでも欠落・unknown・human_attested・summary-only の場合に deny か fail_closed を返すところまでを完了条件にするべきです。

    現時点では close 不可。real pilot と Cloud adoption は BLOCKED 継続 が正しいです。

  5. squne121 commented on Jul 5, 2026

    @squne121
    OwnerAuthor

    Refinement Loop: Approved

    The issue has been approved and is ready for implementation.

  6. squne121 commented on Jul 5, 2026

    @squne121
    OwnerAuthor

    Contract Review Result (Human Override)

    人間承認による手動 override です。ensure_contract_snapshot.py --mode auto --post は pnpm test の regression gate blocked (AC6) により status: blocked_needs_refinement を返しましたが、原因を調査したところ Issue #1261 のスコープとは無関係な既存の baseline 不具合であることを確認しました。

    CONTRACT_REVIEW_RESULT_V1:
      status: go
      generated_at: "2026-07-05T22:29:11Z"
      generated_by: issue-contract-review
      issue_url: https://github.com/squne121/loop-protocol/issues/1261
      body_sha256: "sha256:b24ace6d754054c2f9767fa9f083540676a83b5e62eb85cc8a6d31fcfb780537"
      checks:
        readiness: go
        blockers: pass
        product_spec: pass
        vc_preflight: pass
      source: human_override
      override:
        approved_by: "human (squne121)"
        reason: "main branch の pnpm test フルスイート実行で tests/hooks/hooks-stdout-policy.test.ts の AC7 (test-codex-single-composite.mjs) が既存の並列実行タイムアウト(5000ms)で決定的に失敗する(単体実行では PASS)。Issue #1261 のスコープ(Latitude telemetry distribution/argv/remote cleanup gate)とは無関係な pre-existing baseline 不具合のため、人間承認によりこの VC preflight blocker を override して実装を続行する。"
        unrelated_baseline_issue: "tests/hooks/hooks-stdout-policy.test.ts > AC7: test-codex-single-composite.mjs runs within pnpm test — Error: Test timed out in 5000ms (full-suite実行時のみ再現、単体実行ではPASS)"
        follow_up_action: "別 Issue として当該タイムアウトの修正を追跡する予定"
  7. squne121 commented on Jul 5, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-07-06)

  8. squne121 commented on Jul 5, 2026

    @squne121
    OwnerAuthor

    PR #1352 fix_delta 対応完了(pr-review-judge REQUEST_CHANGES 対応)

    pr-review-judge の REQUEST_CHANGES 指摘(Blocker 1 / Blocker 2)に対応し、PR #1352 の本文のみを更新しました(コード変更なし)。

    Blocker 1: 必須セクション欠落 → 対応済み

    .claude/skills/pr-review-judge/references/ac-evidence-checks.md の Required PR セクションに従い、以下を追加しました。

    • ## 受け入れ条件の達成状況 — AC1〜AC7 それぞれについて [x] + 根拠 を記載
    • ## 検証コマンド結果 — pnpm typecheck/lint/test/build と、distribution evidence field(resolution_source / tarball_sha256 / installed_entrypoint_sha256 / preload_sha256 / hook_command_sha256 / argv_exposure_state / remote_cleanup_state)の rg 存在確認結果を記録
    • ## Allowed Paths 遵守 — 変更ファイル(gh pr view 1352 --json files で確認)が Issue 実装: Latitude telemetry distribution / argv / remote cleanup gate を real pilot 前提で強化する #1261 の Allowed Paths 内に収まっていることを明記

    Blocker 2: Runtime Verification Evidence 欠落 → 対応済み

    ## Runtime Verification Evidence(動作検証証跡) セクションを追加し、以下を正直に記載しました。

    • pnpm run security:session-recording:host の host 実行証跡は現時点で未添付であること
    • 現時点で完了しているのは fixture-only / static 検証(pnpm test 内の negative/positive fixture、rg によるフィールド存在確認)のみであること
    • host 実行環境が確保でき次第、人間が手動実行し実行ログ・ exit code を本セクションに追記すること
    • fixture-only の成功を host execution profile の PASS とはみなさない旨(fallback_policy.fallback_success_is_pass: false 準拠)

    実行方法

    .claude/skills/open-pr/scripts/update_pr.py wrapper(validator pre-write hook 経由)で PR body を更新しました。gh pr edit --body-file を直接呼び出してはいません。

    再レビューをお願いします。

  9. squne121 commented on Jul 6, 2026

    @squne121
    OwnerAuthor

    PR #1352 に OWNER から詳細な REQUEST_CHANGES があり、fix_delta で対応しました
    (詳細は #1352 (comment) 参照)。

    対応内容の要旨:

    • floating npx -y @latitude-data/claude-code-telemetry の検出を、Claude settings hook command の
      read-only parsing 優先に修正(lockfile/cache/global 分類より優先)。新規 field npx_invocation を追加。
    • argv exposure 検査を checker 自身の argv でなく、Claude/node/bun/npx/npm/Latitude を含む関連プロセス群への
      presence-only scan に変更。scan 未完了時は unknown(fail-closed)に統一。
    • strict real-pilot preflight predicate に package_spec exact semver / dist_integrity SRI 形式 /
      resolved_registry_origin 承認済み registry 一致 / npx_invocation floating block の field-level 検証を追加。
    • component verdict (components.latitude.verdict) の unknown 判定に argv_exposure_state /
      remote_cleanup_state / dist_state==unknown を追加。
    • 新規 reason code 8 種を追加。override rejection 時の JSON shape を安定化。
    • negative fixture を追加(floating npx / malformed digest / registry mismatch / exact semver missing /
      argv unknown)。pnpm test 92 files / 1427 tests 全 PASS。

    本 PR は #1261 を close しません。 host 実行証跡(pnpm run security:session-recording:host /
    pnpm run policy:check のログ)はサンドボックス環境では取得できず、本 fix_delta 後も未添付です。
    host 実行環境が確保でき次第、人間が手動実行してログを PR #1352 に追記した上で、改めて #1261 の
    close 判断を行ってください。

  10. squne121 commented on Jul 6, 2026

    @squne121
    OwnerAuthor

    PR #1352 に人間による host 実行証跡(pnpm run security:session-recording:host / pnpm run policy:check)を追記しました。AC1/AC2/AC3/AC4/AC5/AC6 の host verification が完了し、AC7 は provider 側の machine 検証(follow-up #1351)待ちのため意図通り blocked 扱いです。詳細は PR #1352 の「Runtime Verification Evidence」セクションを参照してください。

    PR: #1352

  11. squne121 commented on Jul 6, 2026

    @squne121
    OwnerAuthor

    人間の判断により、PR #1352 で Issue #1261 を close します。PR #1352 の Runtime Verification Evidence(host 実行証跡)を人間が確認した上での判断です。PR 本文に Closes キーワードを追加済みで、closingIssuesReferences にも本 Issue が反映されていることを確認しました。

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/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions