Skip to content

fix: fail-close latitude real-pilot preflight - #1275

Merged
squne121 merged 5 commits into
mainfrom
worktree-issue-1258-latitude-real-pilot-preflight-fail-closed
Jul 1, 2026
Merged

squne121 merged 5 commits into
mainfrom
worktree-issue-1258-latitude-real-pilot-preflight-fail-closed

Conversation

@squne121

@squne121 squne121 commented Jul 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

この PR は real pilot false-green 防止の contract repair を行うものです。

  • latitude:real-pilot:preflight を strict predicate ベースへ寄せ、gate 本体から fixture escape hatch を除去しました。
  • docs/dev/secret-policy.md と docs/dev/session-recording-policy.md に、strict allow 条件・source_digest の closed format・blocked / fail_closed の exit semantics を machine-readable に固定しました。
  • strict preflight の test matrix を補強し、positive allow path と execution_profile / pilot exception / digest / distribution 条件の direct negative を追加しました。

Checks

以下の検証で contract と blocked evidence を確認しました。
上記コマンド群は issue contract の Verification Commands と補助 policy check を日本語説明付きで再確認したものです。

  • rg -n "security:session-recording:fixture" package.json docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts PASS
  • rg -n "security:session-recording:runtime" package.json docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts PASS
  • rg -n "security:session-recording" package.json docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts PASS
  • rg -n "latitude:real-pilot:preflight" package.json .claude/scripts/check_session_recording_runtime_safety.py docs/dev/session-recording-policy.md docs/dev/secret-policy.md PASS
  • rg -n "pilot_activation_state" .claude/scripts/check_session_recording_runtime_safety.py .claude/scripts/lib/latitude_telemetry_safety.py docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts PASS
  • rg -n "source_digest" .claude/scripts/check_session_recording_runtime_safety.py .claude/scripts/lib/latitude_telemetry_safety.py docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts PASS
  • rg -n "blocked_until_activation" docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts PASS
  • git diff --name-only -- 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 PASS
  • pnpm test tests/session_recording_runtime_safety.test.ts PASS (155 passed)
  • rtk pnpm run security:session-recording:fixture PASS
  • rtk pnpm run security:session-recording:host expected blocked evidence (exit 1)
  • rtk pnpm run latitude:real-pilot:preflight expected blocked evidence (exit 1)
  • rtk pnpm run policy:check:secret PASS
  • rtk pnpm run policy:check:session PASS

Schema Change Applicability

schema 変更ではなく、既存 session_recording_runtime_safety/v2 の外形を維持したまま strict predicate の再評価経路と machine-readable contract を tightening した修正です。

  • decision: not_schema_change
  • reason: 既存 session_recording_runtime_safety/v2 の外形は維持しつつ、strict predicate の再評価経路と machine-readable contract を tightening したためです。

Schema Consumer Inventory

外部 consumer 追加はなく、この PR の影響は既存 verifier と docs contract の整合修正に閉じています。

  • 対象: なし
  • reason: 既存 JSON consumer に新 field は要求せず、strict preflight command が同じ JSON を閉じた条件で再評価するだけだからです。

Safety Claim Matrix

以下の表は「この PR で実装した safety contract」と「#1261 に残している未解決事項」を、レビュー時に誤読されないよう日本語で明示した safety claim です。
特に real pilot を今すぐ許可する変更ではなく、未充足条件が残る限り blocked または fail-closed に留める修正であることをここで再確認します。

Claim Implemented? Not controlled Evidence Follow-up
latitude:real-pilot:preflight は host verifier JSON を strict predicate で再評価し、execution_profile=host、pilot_activation_state=allow、pilot_exception.malformed=false、pilot_exception.raw_values_emitted=false、source_digest=sha256:<64hex>、components.latitude.verdict=safe、distribution.state=verified、registry_signature_verified=true、provenance_verified=true の同時成立時のみ allow する yes allow path の実運用充足は #1261 完了まで未到達 pnpm test tests/session_recording_runtime_safety.test.ts; rtk pnpm run latitude:real-pilot:preflight; .claude/scripts/check_session_recording_runtime_safety.py; docs/dev/secret-policy.md #1261
#1261 未完了の distribution / argv / remote cleanup evidence は未充足のまま扱い、real pilot gate は partial / blocked until #1261 に留める partial / blocked until #1261 #1261 自体の実装はこの PR のスコープ外 rtk pnpm run security:session-recording:host; rtk pnpm run latitude:real-pilot:preflight; docs/dev/session-recording-policy.md; docs/dev/secret-policy.md #1261
security:session-recording は host readiness proof ではなく、deterministic CI gate は security:session-recording:fixture、security:session-recording:runtime は fixture alias 互換面として固定する yes none rg -n "security:session-recording" package.json docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts; rtk pnpm run security:session-recording:fixture none
host preflight / strict preflight の blocked は CI required gate failure ではなく real pilot blocked evidence として扱い、blocked=exit 1 / fail_closed=exit 2 を docs に固定する yes host 環境で検出された credential / hook / cleanup unknown 自体の解消はこの PR では行わない rtk pnpm run security:session-recording:host; rtk pnpm run latitude:real-pilot:preflight; docs/dev/session-recording-policy.md; docs/dev/secret-policy.md #1261

Notes

補足として、この PR は real pilot を allow にするものではなく、未充足条件が残る間は blocked / fail-closed に留めるための修正です。

real pilot false-green 防止 contract repair として、session-recording script 境界と strict preflight gate を package/docs/tests/checker で揃える。
@github-actions

github-actions Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Preview URL

Preview removed (PR #1275 closed).

@squne121

squne121 commented Jul 1, 2026

Copy link
Copy Markdown
Owner Author
TEST_VERDICT:
  result: PASS
  mergeable: MERGEABLE
  merge_state_status: UNSTABLE
  branch_behind_main: false
  baseline_only: false
  verification_commands_pass: 10
  verification_commands_fail: 0
  verification_skipped_count: 0
  runtime_ac_results:
    - ac: AC1
      command: "rg -n "security:session-recording:fixture" package.json docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "fixture references found"
    - ac: AC2
      command: "rg -n "security:session-recording:runtime" package.json docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "runtime alias references found"
    - ac: AC3
      command: "rg -n "security:session-recording" package.json docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "bundle role docs and tests present"
    - ac: AC4
      command: "rg -n "latitude:real-pilot:preflight" package.json .claude/scripts/check_session_recording_runtime_safety.py docs/dev/session-recording-policy.md docs/dev/secret-policy.md"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "preflight command and docs present"
    - ac: AC5
      command: "pnpm test tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "strict preflight deny on top-level allow with blocked pilot; test file passed 140/140"
    - ac: AC6
      command: "rg -n "pilot_activation_state" .claude/scripts/check_session_recording_runtime_safety.py .claude/scripts/lib/latitude_telemetry_safety.py docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "activation state conditions present"
    - ac: AC7
      command: "rg -n "source_digest" .claude/scripts/check_session_recording_runtime_safety.py .claude/scripts/lib/latitude_telemetry_safety.py docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "source digest fail-closed checks present"
    - ac: AC8
      command: "pnpm test tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "negative controls for fixture and malformed states covered; test file passed 140/140"
    - ac: AC9
      command: "rg -n "blocked_until_activation" docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "blocked evidence wording present"
    - ac: AC10
      command: "git diff --name-only -- 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"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "no files outside Allowed Paths in worktree diff"

@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.

Verdict: REQUEST_CHANGES

Mergeability

  • mergeable=MERGEABLE, merge_state_status=UNSTABLE

Evidence Check

  • Allowed Paths: allowed_paths_review_gate.py で ok。変更 5 ファイルは contract snapshot の Allowed Paths 内です。
  • TEST_VERDICT_MACHINE v1: result: PASS、verification_skipped_count: 0、mergeable: MERGEABLE、merge_state_status: UNSTABLE を確認しました。
  • CI Verification: ci_verdict_summary.py を head e74870ea05caa884ec824909dc97cb0e43e15982 に束縛して実行した結果は status: failed で、required check PR Body Japanese Check が失敗しています。

Blockers

  • PR Body Japanese Check は head-scoped required check として失敗中です。失敗ログでは docs/dev/secret-policy.md に対して failed_blocks: 5、FAIL: 日本語比率不足 (aggregate=0.367, threshold=0.1, failed_blocks=5) が報告されており、current CI は all-pass ではありません。

LOOP_VERDICT_V2

verdict: REQUEST_CHANGES
reviewed_head_sha: "e74870ea05caa884ec824909dc97cb0e43e15982"
merge_ready: false
mergeability:
  mergeable: "MERGEABLE"
  merge_state_status: "UNSTABLE"
blockers:
  - "Required head-scoped check PR Body Japanese Check is failing on docs/dev/secret-policy.md due to 5 prose blocks below the Japanese threshold, so CI evidence is not all-pass."
required_auto_actions: []
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
  status: ok
allowed_paths_gate_source: review_subagent

@squne121

squne121 commented Jul 1, 2026

Copy link
Copy Markdown
Owner Author
TEST_VERDICT:
  result: PASS
  mergeable: MERGEABLE
  merge_state_status: BLOCKED
  branch_behind_main: false
  baseline_only: false
  verification_commands_pass: 10
  verification_commands_fail: 0
  verification_skipped_count: 0
  runtime_ac_results:
    - ac: AC1
      command: "rg -n \"security:session-recording:fixture\" package.json docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "PASS"
    - ac: AC2
      command: "rg -n \"security:session-recording:runtime\" package.json docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "PASS"
    - ac: AC3
      command: "rg -n \"security:session-recording\" package.json docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "PASS"
    - ac: AC4
      command: "rg -n \"latitude:real-pilot:preflight\" package.json .claude/scripts/check_session_recording_runtime_safety.py docs/dev/session-recording-policy.md docs/dev/secret-policy.md"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "PASS"
    - ac: AC5
      command: "pnpm test tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "PASS"
    - ac: AC6
      command: "rg -n \"pilot_activation_state\" .claude/scripts/check_session_recording_runtime_safety.py .claude/scripts/lib/latitude_telemetry_safety.py docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "PASS"
    - ac: AC7
      command: "rg -n \"source_digest\" .claude/scripts/check_session_recording_runtime_safety.py .claude/scripts/lib/latitude_telemetry_safety.py docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "PASS"
    - ac: AC8
      command: "pnpm test tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "PASS"
    - ac: AC9
      command: "rg -n \"blocked_until_activation\" docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "PASS"
    - ac: AC10
      command: "git diff --name-only -- 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"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "PASS"

@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.

Verdict: APPROVE

Mergeability

  • mergeable=MERGEABLE, merge_state_status=CLEAN

Evidence Check

  • Linked issue: Closes #1258 を確認し、contract snapshot https://github.com/squne121/loop-protocol/issues/1258#issuecomment-4858699244 の status: go と一致。
  • Allowed Paths: allowed_paths_review_gate.py を current head 7921b6913c7ba8f5459cc28a87e6963caac2cd74 で再計算し、変更 5 ファイルはすべて contract の Allowed Paths 内でした(status: ok)。
  • TEST_VERDICT_MACHINE: 最新コメント 2026-07-01T18:33:01Z を確認し、最終コミット 2026-07-01T18:27:58Z の後に verification_commands_pass: 10、verification_commands_fail: 0、verification_skipped_count: 0 が記録されています。
  • CI Verification: ci_verdict_summary.py --expected-head-sha 7921b6913c7ba8f5459cc28a87e6963caac2cd74 は status: all_pass。required checks は current head に束縛された成功のみで、pending / failed / stale はありません。
  • AC / scope: latitude:real-pilot:preflight strict gate、security:session-recording family の役割固定、negative tests、host blocked evidence の文書化が linked issue #1258 の AC1-AC10 と整合しています。新規 wrapper file も追加されていません。

Blockers

  • なし

Non-blockers

  • Draft PR ですが、LOOP_VERDICT_V2.merge_ready の判定上は blocker ではありません。

LOOP_VERDICT_V2

verdict: APPROVE
reviewed_head_sha: "7921b6913c7ba8f5459cc28a87e6963caac2cd74"
merge_ready: true
mergeability:
  mergeable: "MERGEABLE"
  merge_state_status: "CLEAN"
blockers: []
required_auto_actions: []
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
  status: ok
allowed_paths_gate_source: review_subagent

@squne121

squne121 commented Jul 1, 2026

Copy link
Copy Markdown
Owner Author

判定: REQUEST_CHANGES

このPRは方向性は正しいですが、このままのマージには反対です。security:session-recording family の誤読防止、latitude:real-pilot:preflight の追加、top-level decision: allow 単独判定の禁止は #1258 の目的に合っています。一方で、strict gate 本体・docs contract・test matrix の間にまだ穴があります。PRは現在open/draftで、変更は5ファイル・+283/-27です。

なお、ローカルでテストは実行していません。GitHub上のPR本文・差分・コメント、関連Issue/PR、該当リポジトリ資産、公式Web docsを根拠にした静的・契約レビューです。

良い点

package.json の command surface は概ね正しい方向です。security:session-recording が fixture gate を直接呼び、:runtime は fixture alias、:host と latitude:real-pilot:preflight は別コマンドとして分離されています。これは「fixture PASSをhost proofと誤読させない」という #1258 の主目的に沿っています。

strict preflight の実装も、少なくとも top-level decision/verdict/inspection_complete、pilot_activation_state、pilot_exception、Latitude component、distribution の basic verified flags を同時に要求しており、単純な decision: allow false-green は防いでいます。

docs 側も、Stop hookではなくpre-session host verifier JSONを正本にする、hook通過をactivation証明にしない、fixture PASSやtop-level allowをallow根拠にしない、という境界を明文化しています。Claude Code hooksはmatching hookが並列実行され、async hooksは制御決定に使えないため、この判断は外部仕様とも整合します。 ([Claude]1)

マージ阻止級の問題

B1. strict gate本体にfixture escape hatchが残っている

_apply_real_pilot_preflight_requirement() は SRRS_ALLOW_REAL_PILOT_PREFLIGHT_FIXTURE=1 があると execution_profile != host でも profile_ok にします。 テストヘルパーはfixture profile時にこの環境変数を実際にセットしており、strict gateをfixture入力で走らせています。

package scriptはhost profile固定で、host modeはSRRS_* overrideを拒否するため、通常導線では即座に突破されるわけではありません。 ただし「sole real-pilot pre-session gate」を名乗る関数本体に、非公開のfixture許可分岐を置くのは契約として弱いです。#1258はfixture profileやfixture-only signalをfail-closedにすることを要求しています。([GitHub]2)

修正案: SRRS_ALLOW_REAL_PILOT_PREFLIGHT_FIXTURE を削除し、strict predicateを純関数化してください。たとえば derive_real_pilot_preflight_decision(output) を作り、CLI実行profileとは独立したJSON fixtureでpositive/negativeをテストするのが安全です。

B2. docsのmachine-readable contractが実装より弱い

コードは components.latitude.verdict == safe、components.latitude.inspection_complete == true、distribution.state == verified、registry_signature_verified == true、provenance_verified == true まで見ています。 しかし docs/dev/secret-policy.md の allow_requires は、execution_profile、top-level fields、pilot_activation_state、pilot decision/reason codes、source_digest までしか列挙していません。

これは将来のcontract driftの温床です。docsを読む実装者は、Latitude componentやdistribution flagsを必須条件と認識できません。pilot_exception.malformed: false、pilot_exception.raw_values_emitted: false、components.latitude.verdict: safe、components.latitude.inspection_complete: true、components.latitude.distribution.state: verified、registry_signature_verified: true、provenance_verified: true をmachine-readableに追加すべきです。

B3. #1261未完了のdistribution/argv/remote cleanup evidenceを「充足済み」に見せている

#1261は、real pilot前提として resolved_registry_origin、dist_integrity、registry signature、provenance、lockfile digest、tarball SHA、installed entrypoint SHA、preload SHA、hook command SHA、closed enumのresolution_source、argv exposure、remote cleanup stateを強化対象にしています。

現状のhost distribution checkerは、global npm installを軽く見るだけで、packageが見つかっても state: unknown、registry_signature_verified: None、provenance_verified: None、inspection_gaps: ["registry_signature", "provenance_attestation"] を返します。 さらに出力側では tarball_sha256、installed_entrypoint_sha256、preload_sha256 が None、resolution_source が "unknown" に固定されています。

したがって、PR本文の「distribution evidence 完充足の同時成立時のみallow」は、現在の実装では言い過ぎです。正しくは「#1261未完了のため、real hostではdistribution/argv/cleanup evidenceが未充足となり、preflightはblocked/fail-closedに留まる」です。Safety Claim Matrixの該当行は Implemented: yes ではなく partial / blocked until #1261 に落とすべきです。

B4. strict preflightのnegative testsが足りない

追加テストは、fixture profile、top-level allow + blocked_until_activation、provenance unknown、pinned+verifiedでもfail_closed、の4系統です。 しかし #1258 AC8 が明示している pilot_activation_state: active という未定義enum、malformed pilot exception、source digest null/unknown/empty は、このstrict gate blockでは直接テストされていません。([GitHub]2)

最低限、strict predicateに対して以下を1キー1テストで落としてください。

  • execution_profile: fixture
  • decision != allow
  • verdict != safe
  • inspection_complete: false
  • pilot_activation_state: active
  • pilot_activation_state: blocked_until_activation
  • pilot_exception.decision != approve_timeboxed_real_pilot
  • pilot_exception.malformed: true
  • pilot_exception.reason_codes 非空
  • pilot_exception.raw_values_emitted: true
  • policy.source_digest が null / unknown / 空文字 / 不正形式
  • components.latitude.verdict != safe
  • components.latitude.inspection_complete: false
  • distribution.state != verified
  • registry_signature_verified != true
  • provenance_verified != true

また、positive allow testがありません。現在の「pinned package + verified provenance」ケースも最終的にはfail_closedを期待しており、allow pathの仕様が壊れても検知しづらいです。host modeでoverride不可なのは正しいので、CLIのpositive testではなく、純関数化したpredicateに対するpositive JSON fixtureを置くのが妥当です。

B5. source_digest 判定が弱い

source_digest_ok は「stringであり、空文字・unknown・null文字列ではない」だけです。 source_digest: present や source_digest: ok でも通る可能性があります。SSOTのdigestをreal pilot gateの条件にするなら、少なくとも sha256:<64hex> などのclosed formatにしてください。

B6. blocked と fail_closed のexit semanticsが曖昧

strict preflightは、元のverdictがblockedなら exit 1 を返し、それ以外の未充足は exit 2 にしています。 しかし #1258のruntime verification policyは、runtime unavailable、fixture-only signal、unknown distribution/cleanup evidenceをfail_closedとして扱う方向です。([GitHub]2)

一方でPR本文・docsではhost preflightのblocked/denyを「CI failureではなくreal pilot blocked evidence」として扱うとしています。これは方針としては理解できますが、どの条件がblockedで、どの条件がfail_closedかをmachine-readable tableにしないと、CI/reporting/レビューbotで解釈が割れます。

外部実装から見た追加リスク

Latitude公式docsは、Claude Code telemetryの導入に npx -y @latitude-data/claude-code-telemetry install を示し、--api-key=... をCLI引数で渡す例も掲載しています。また、手動設定ではStop hookに npx -y @latitude-data/claude-code-telemetry を置き、"async": true にする例があり、telemetry内容はprompts、responses、tool input/output、system contextを含むfull-fidelity telemetryと説明されています。([Latitude Docs]3)

つまり、このPRが守ろうとしている境界は過剰ではありません。npx -y、argv key exposure、async Stop hook、full prompt/tool I/O送信は、外部実装上の現実の導入経路です。だからこそ、fixture bypassや曖昧なdistribution証拠を残したまま「real pilot preflight」と呼ぶのは危険です。

npm側も、npm audit signatures はregistry signaturesとprovenance attestationsを検証でき、JSONにSigstore attestation bundleを含めるoptionがあります。ただしnpm docsは、lockfileなしのauditはdependency treeが毎回再構築され結果が変わり得ること、provenanceはsource/buildとの検証可能リンクであってmalicious code不在の保証ではないことも明記しています。([npmドキュメント]4)

#1261では、最低限 npm audit signatures --json --include-attestations、lockfile固定、exact semver、tarball SHA、installed entrypoint SHA、preload SHA、hook command SHA、provenance source/ref/workflow、registry origin、resolution_source enumを揃えるべきです。PR #1275ではそれを実装しないなら、「それらが未充足の間は絶対にallowしない」ことだけを明確にしてください。

要求する修正

このPRで最低限必要なのは次です。

  1. SRRS_ALLOW_REAL_PILOT_PREFLIGHT_FIXTURE をstrict gate本体から除去する。テストは純関数predicateに切り出して行う。
  2. docs/dev/secret-policy.md の allow_requires を実装のstrict predicateと完全一致させる。
  3. #1261未完了のdistribution/argv/remote cleanup evidenceを「未充足なのでblocked」と明記し、PR本文のSafety Claimを修正する。
  4. strict preflightのpositive fixtureとmutation negative testsを追加する。
  5. source_digest をclosed digest formatで検証する。
  6. blocked / fail_closed のexit code policyをmachine-readableに固定する。

現状は「正しい方向のcontract repair」ですが、「sole real-pilot pre-session gate」としてはまだレビューに耐えません。

@squne121

squne121 commented Jul 1, 2026

Copy link
Copy Markdown
Owner Author
TEST_VERDICT:
  result: FAIL
  mergeable: CONFLICTING
  merge_state_status: BLOCKED
  branch_behind_main: false
  baseline_only: false
  verification_commands_pass: 9
  verification_commands_fail: 1
  verification_skipped_count: 0
  runtime_ac_results:
    - ac: AC1
      command: 'rg -n "security:session-recording:fixture" package.json docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'matches in package.json and tests'
    - ac: AC2
      command: 'rg -n "security:session-recording:runtime" package.json docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'matches in package.json, docs, and tests'
    - ac: AC3
      command: 'rg -n "security:session-recording" package.json docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'bundle references found'
    - ac: AC4
      command: 'rg -n "latitude:real-pilot:preflight" package.json .claude/scripts/check_session_recording_runtime_safety.py docs/dev/session-recording-policy.md docs/dev/secret-policy.md'
      exit_code: 1
      status: fail
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'no matches'
    - ac: AC5
      command: 'pnpm test tests/session_recording_runtime_safety.test.ts'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '136 tests passed'
    - ac: AC6
      command: 'rg -n "pilot_activation_state" .claude/scripts/check_session_recording_runtime_safety.py .claude/scripts/lib/latitude_telemetry_safety.py docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'activation-state conditions present'
    - ac: AC7
      command: 'rg -n "source_digest" .claude/scripts/check_session_recording_runtime_safety.py .claude/scripts/lib/latitude_telemetry_safety.py docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'source-digest checks present'
    - ac: AC8
      command: 'pnpm test tests/session_recording_runtime_safety.test.ts'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '136 tests passed; negative controls exercised'
    - ac: AC9
      command: 'rg -n "blocked_until_activation" docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'blocked-evidence wording present'
    - ac: AC10
      command: 'git diff --name-only -- 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'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'no changed files outside the allowed set were listed'

@squne121

squne121 commented Jul 1, 2026

Copy link
Copy Markdown
Owner Author
TEST_VERDICT:
  result: PASS
  mergeable: MERGEABLE
  merge_state_status: UNSTABLE
  branch_behind_main: false
  baseline_only: false
  verification_commands_pass: 10
  verification_commands_fail: 0
  verification_skipped_count: 0
  runtime_ac_results:
    - ac: AC1
      command: 'rg -n "security:session-recording:fixture" package.json docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'package.json / docs / tests に fixture 参照あり'
    - ac: AC2
      command: 'rg -n "security:session-recording:runtime" package.json docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'runtime alias 参照あり'
    - ac: AC3
      command: 'rg -n "security:session-recording" package.json docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'security:session-recording family の定義あり'
    - ac: AC4
      command: 'rg -n "latitude:real-pilot:preflight" package.json .claude/scripts/check_session_recording_runtime_safety.py docs/dev/session-recording-policy.md docs/dev/secret-policy.md'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'package.json / script / docs に preflight surface あり'
    - ac: AC5
      command: 'pnpm test tests/session_recording_runtime_safety.test.ts'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '155 passed'
    - ac: AC6
      command: 'rg -n "pilot_activation_state" .claude/scripts/check_session_recording_runtime_safety.py .claude/scripts/lib/latitude_telemetry_safety.py docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'host verifier / docs / tests に pilot_activation_state 条件あり'
    - ac: AC7
      command: 'rg -n "source_digest" .claude/scripts/check_session_recording_runtime_safety.py .claude/scripts/lib/latitude_telemetry_safety.py docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'source_digest 条件あり'
    - ac: AC8
      command: 'pnpm test tests/session_recording_runtime_safety.test.ts'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'negative controls を含む test file が pass'
    - ac: AC9
      command: 'rg -n "blocked_until_activation" docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: 'blocked_until_activation の fail-closed 文言あり'
    - ac: AC10
      command: 'git diff --name-only -- 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'
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: '対象パスで追加差分なし'

@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: "a6407ef39cef3b4ad981f4058d5ae4dc9522e6d1"
merge_ready: false
mergeability:
  mergeable: "MERGEABLE"
  merge_state_status: "UNSTABLE"
blockers:
  - "Head-scoped required check PR Body Japanese Check is failing on a6407ef39cef3b4ad981f4058d5ae4dc9522e6d1, so CI evidence is not all-pass despite the latest TEST_VERDICT_MACHINE PASS."
required_auto_actions: []
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
  status: ok
allowed_paths_gate_source: review_subagent
  • primary_source_owner_comment: #1275 (comment)
  • linked_issue: #1258
  • contract_snapshot: #1258 (comment)
  • latest_test_verdict_machine: #1275 (comment)
  • head_scoped_ci: ci_verdict_summary.py --expected-head-sha a6407ef39cef3b4ad981f4058d5ae4dc9522e6d1 => status=failed, failed_checks=["PR Body Japanese Check"], pending_checks=[]
  • scope_check: changed files match the issue Allowed Paths list (status: ok by review).

@squne121

squne121 commented Jul 1, 2026

Copy link
Copy Markdown
Owner Author
TEST_VERDICT:
  result: PASS
  mergeable: MERGEABLE
  merge_state_status: CLEAN
  branch_behind_main: false
  baseline_only: false
  verification_commands_pass: 10
  verification_commands_fail: 0
  verification_skipped_count: 0
  reviewed_head_sha: "c4509439f336057a030f6c8af623a39602661c03"
  runtime_ac_results:
    - ac: AC1
      command: "rg -n "security:session-recording:fixture" package.json docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "fixture references found"
    - ac: AC2
      command: "rg -n "security:session-recording:runtime" package.json docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "runtime alias references found"
    - ac: AC3
      command: "rg -n "security:session-recording" package.json docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "bundle role docs and tests present"
    - ac: AC4
      command: "rg -n "latitude:real-pilot:preflight" package.json .claude/scripts/check_session_recording_runtime_safety.py docs/dev/session-recording-policy.md docs/dev/secret-policy.md"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "preflight command and docs present"
    - ac: AC5
      command: "pnpm test tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "155 passed"
    - ac: AC6
      command: "rg -n "pilot_activation_state" .claude/scripts/check_session_recording_runtime_safety.py .claude/scripts/lib/latitude_telemetry_safety.py docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "activation state conditions present"
    - ac: AC7
      command: "rg -n "source_digest" .claude/scripts/check_session_recording_runtime_safety.py .claude/scripts/lib/latitude_telemetry_safety.py docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "source digest fail-closed checks present"
    - ac: AC8
      command: "pnpm test tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "155 passed"
    - ac: AC9
      command: "rg -n "blocked_until_activation" docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "blocked evidence wording present"
    - ac: AC10
      command: "git diff --name-only -- 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"
      exit_code: 0
      status: pass
      fallback_detected: false
      artifact_present: not_required
      human_review_required: false
      stop_condition_triggered: false
      notes: "no paths returned"

@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.

Verdict: REQUEST_CHANGES

Mergeability

  • mergeable=MERGEABLE, merge_state_status=UNSTABLE

Evidence Check

  • Allowed Paths: allowed_paths_review_gate.py で ok。変更 5 ファイルは contract snapshot の Allowed Paths 内です。
  • TEST_VERDICT_MACHINE v1: result: PASS、verification_skipped_count: 0、mergeable: MERGEABLE、merge_state_status: UNSTABLE を確認しました。
  • CI Verification: ci_verdict_summary.py を head e74870ea05caa884ec824909dc97cb0e43e15982 に束縛して実行した結果は status: failed で、required check PR Body Japanese Check が失敗しています。

Blockers

  • PR Body Japanese Check は head-scoped required check として失敗中です。失敗ログでは docs/dev/secret-policy.md に対して failed_blocks: 5、FAIL: 日本語比率不足 (aggregate=0.367, threshold=0.1, failed_blocks=5) が報告されており、current CI は all-pass ではありません。

LOOP_VERDICT_V2

verdict: REQUEST_CHANGES
reviewed_head_sha: "e74870ea05caa884ec824909dc97cb0e43e15982"
merge_ready: false
mergeability:
  mergeable: "MERGEABLE"
  merge_state_status: "UNSTABLE"
blockers:
  - "Required head-scoped check PR Body Japanese Check is failing on docs/dev/secret-policy.md due to 5 prose blocks below the Japanese threshold, so CI evidence is not all-pass."
required_auto_actions: []
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
  status: ok
allowed_paths_gate_source: review_subagent

@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.

Verdict: APPROVE

Mergeability

  • mergeable=MERGEABLE, merge_state_status=CLEAN

Evidence Check

  • Primary sources: owner comment https://github.com/squne121/loop-protocol/pull/1275#issuecomment-4860334196、linked issue #1258、contract snapshot https://github.com/squne121/loop-protocol/issues/1258#issuecomment-4858699244、latest TEST_VERDICT_MACHINE https://github.com/squne121/loop-protocol/pull/1275#issuecomment-4860493298。
  • Allowed Paths: allowed_paths_review_gate.py を current head c4509439f336057a030f6c8af623a39602661c03 で再計算し status: ok。変更 5 ファイルは contract の Allowed Paths 内です。
  • TEST_VERDICT_MACHINE: 最新コメントは 2026-07-01T22:20:16Z 投稿で、current head commit c4509439f336057a030f6c8af623a39602661c03 (2026-07-01T22:11:03Z) の後です。verification_commands_fail: 0、verification_skipped_count: 0、pnpm test tests/session_recording_runtime_safety.test.ts は 155 passed、AC10 の changed-files 記述も current 5-file diff と一致しています。
  • CI Verification: gh pr checks 1275 は current head で Passed: 14 / Failed: 0。gh api repos/squne121/loop-protocol/commits/c4509439f336057a030f6c8af623a39602661c03/check-runs でも required check PR Body Japanese Check は job 84648952353 が success (2026-07-01T22:16:05Z) です。ci_verdict_summary.py --expected-head-sha c4509439f336057a030f6c8af623a39602661c03 は superseded された earlier failure job 84648202594 も同一 head 上で拾うため status: failed を返しましたが、GitHub の current required-check truth は all-pass でした。
  • AC / scope: owner comment の blocker だった fixture escape hatch、docs の machine-readable strict predicate、source_digest closed format、strict preflight の positive/negative matrix は current diff で解消されています。新規 wrapper file も追加されていません。

Blockers

  • なし

Non-blockers

  • Draft PR ですが、merge_ready 判定の blocker ではありません。
  • ci_verdict_summary.py は current head 上の superseded failure を fail と数えるため、この PR の live required-check truth と不一致です。review verdict では GitHub check-runs の current state を優先しました。

LOOP_VERDICT_V2

verdict: APPROVE
reviewed_head_sha: "c4509439f336057a030f6c8af623a39602661c03"
merge_ready: true
mergeability:
  mergeable: "MERGEABLE"
  merge_state_status: "CLEAN"
blockers: []
required_auto_actions: []
auto_fix_applied: []
follow_up_issue_requests: []
allowed_paths_gate:
  status: ok
allowed_paths_gate_source: review_subagent

@squne121
squne121 marked this pull request as ready for review July 1, 2026 22:59
@squne121
squne121 merged commit 60438d6 into main Jul 1, 2026
33 of 34 checks passed
@squne121
squne121 deleted the worktree-issue-1258-latitude-real-pilot-preflight-fail-closed branch July 1, 2026 22:59
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.

実装: latitude real-pilot preflight と session-recording script 境界を fail-closed にする

1 participant