Repository navigation
Closed
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "#1153"
goal_ref: "anchor comment #4858594357 の REQUEST_CHANGES に従い、fixture-only security script と host pre-session verifier の境界を fail-closed に固定し、real pilot 前提の canonical preflight command surface を false-green なしで追加する"
change_kind: mixedParent Issue
Parent Goal Ref
- Goal: EntireCLI + Latitude の観測データを public-safe な report/index に接続し、GitHub 経由の ChatGPT retrospective 導線を false-green なしで運用できる状態にする
- Desired Destination: real pilot は host pre-session verifier が
allowを返すまで blocked のまま維持し、fixture pass を host proof と誤読できない状態
Current Validated Scope
security:session-recording/:runtime/:fixture/:hostの責務名を current repo reality に揃える.claude/scripts/check_session_recording_runtime_safety.py --json --execution-profile hostを real pilot 前提の canonical preflight source command として package script と docs に固定する- fixture-only gate と host gate の expected result を tests / fixture で明示する
latitude:real-pilot:preflightは host 側 JSON を strict mode で再評価し、execution_profile/decision/verdict/inspection_complete/pilot_activation_state/pilot_exceptionの全条件を満たす場合のみ allow する- 実装: Latitude telemetry distribution / argv / remote cleanup gate を real pilot 前提で強化する #1261 が完了するまでは distribution / argv / remote cleanup に unknown が残る限り allow 不可であることを fail-closed に固定する
Remaining Parent Gaps
- Latitude distribution / argv / remote cleanup evidence の完全強化は 実装: Latitude telemetry distribution / argv / remote cleanup gate を real pilot 前提で強化する #1261 で扱う
- observation source reason_codes の closed contract は別 child issue で扱う
- Cloud pilot success contract / research/pilot: AI 駆動 session 記録 pilot smoke test (manifest 整合性 / Kill Switch 動作 / Secret 漏れ検査) #246 alignment は別 child issue で扱う
Outcome
security:session-recording が CI / deterministic fixture gate 専用であることと、latitude:real-pilot:preflight が host pre-session allow 判定の唯一の real pilot 前提 gate であることが docs / scripts / tests で固定され、fixture pass や top-level decision: allow 単独では host proof と誤読できない状態。
In Scope
security:session-recording:fixtureを CI / deterministic fixture only と明記するsecurity:session-recording:runtimeを削除するか fixture alias だと machine-readable に固定し、host proof と誤読不能にするsecurity:session-recordingを host readiness proof ではないと docs / tests / package script で固定するlatitude:real-pilot:preflightcommand を追加する- host verifier が nonzero、
execution_profile != host、decision != allow、verdict != safe、inspection_complete != true、pilot_activation_state != allow、pilot_exception.decision != approve_timeboxed_real_pilot、pilot_exception.malformed != false、pilot_exception.reason_codes非空のいずれかなら deny する - top-level
decision: allowや fixture pass 単独で real pilot allow に到達できないことを docs / tests / command surface で固定する - 実装: Latitude telemetry distribution / argv / remote cleanup gate を real pilot 前提で強化する #1261 が未完了の間は distribution / argv / remote cleanup が unknown のままなら
latitude:real-pilot:preflightを allow しない - host preflight の blocked / deny を CI failure ではなく real pilot blocked evidence として記録する
Out of Scope
- real prompt / real trace export / Cloud pilot 実走
- provider-side retention / delete verification
- distribution provenance / tarball digest / argv rotation policy / remote cleanup verification の完全強化そのもの
- observation source adapter / marker / retro index の設計変更
- 実装: Latitude telemetry distribution / argv / remote cleanup gate を real pilot 前提で強化する #1261 の実装をこの Issue に取り込むこと
Acceptance Criteria
- AC1:
security:session-recording:fixtureが CI / deterministic fixture only と docs / package script / tests で明示される - AC2:
security:session-recording:runtimeが host proof と誤読できない command surface に変更され、fixture alias のまま残す場合は machine-readable にその事実が固定される - AC3:
security:session-recordingが host readiness proof ではないと docs / tests / package script で明示される - AC4:
latitude:real-pilot:preflightが追加され、check_session_recording_runtime_safety.py --json --execution-profile hostを canonical source command として使う - AC5:
latitude:real-pilot:preflightは host verifier が exit 0 でもdecision != allowまたはpilot_activation_state != allowのとき deny し、top-leveldecision: allow単独では allow しない - AC6:
latitude:real-pilot:preflightはexecution_profile == host、decision == allow、verdict == safe、inspection_complete == true、pilot_activation_state == allow、pilot_exception.decision == approve_timeboxed_real_pilot、pilot_exception.malformed == false、pilot_exception.reason_codes == []を同時に満たす場合のみ allow する - AC7:
policy.source_digestが null / unknown / empty のとき、および 実装: Latitude telemetry distribution / argv / remote cleanup gate を real pilot 前提で強化する #1261 未完了により distribution / argv / remote cleanup の required evidence が unknown のときは allow しない - AC8: fixture profile、
decision: allowかつpilot_activation_state: blocked_until_activation、未定義 enumactive、malformed pilot exception を real pilot preflight deny / fail-closed にする negative tests が追加される - AC9: host preflight blocked / deny が CI required gate ではなく real pilot blocked evidence として docs / tests に固定される
- AC10: 変更は Allowed Paths 内に閉じ、
latitude:real-pilot:preflightのための新規 wrapper file は追加しない
Verification Commands
# AC1
# baseline-expect: pass
$ 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
# AC2
# baseline-expect: 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
# AC3
# baseline-expect: 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
# AC4
$ 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
# AC5
# preflight-scope: pr_review_only
$ pnpm test tests/session_recording_runtime_safety.test.ts
# AC6
# baseline-expect: 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
# AC7
# baseline-expect: 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
# AC8
# preflight-scope: pr_review_only
$ pnpm test tests/session_recording_runtime_safety.test.ts
# AC9
# baseline-expect: pass
$ rg -n "blocked_until_activation" docs/dev/session-recording-policy.md docs/dev/secret-policy.md tests/session_recording_runtime_safety.test.ts
# AC10
# preflight-scope: pr_review_only
$ 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-safetyAllowed Paths
package.jsondocs/dev/secret-policy.mddocs/dev/session-recording-policy.md.claude/scripts/check_session_recording_runtime_safety.py.claude/scripts/lib/latitude_telemetry_safety.pytests/session_recording_runtime_safety.test.tstests/fixtures/session-recording-runtime-safety/**
Runtime Verification Applicability
decision: immediate
reason: real pilot preflight command surface と host verifier JSON の fail-closed 条件を固定する issue であり、fixture profile / host profile / negative controls の runtime-level contract 検証が必要。
applicable_acs:
- AC5
- AC6
- AC7
- AC8
- AC9
execution_environment:
- local Node.js / pnpm test environment
- host verifier JSON generated by `.claude/scripts/check_session_recording_runtime_safety.py`
skip_conditions:
- host-specific runtime prerequisites が不足し `pnpm run latitude:real-pilot:preflight` を正常実行できない場合は SKIP ではなく fail-closed / blocked evidence として扱う
- fixture-only evidence しか取得できない場合は allow 判定を行わない
fallback_policy:
on_runtime_unavailable: fail_closed
on_fixture_only_signal: fail_closed
on_unknown_distribution_or_cleanup_evidence: fail_closed
artifact_requirements:
- `pnpm test tests/session_recording_runtime_safety.test.ts` の結果
- `pnpm run security:session-recording:fixture` の結果
- `pnpm run security:session-recording:host` の結果
- `pnpm run latitude:real-pilot:preflight` の結果
evidence:
- pnpm test tests/session_recording_runtime_safety.test.ts
- pnpm run security:session-recording:fixture
- pnpm run security:session-recording:host
- pnpm run latitude:real-pilot:preflightStop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
- secret value / raw request body / raw trace body / local absolute path を読む必要が生じた場合
- 実装: Latitude telemetry distribution / argv / remote cleanup gate を real pilot 前提で強化する #1261 完了前に exact package provenance / argv exposure / remote cleanup verification をこの Issue 単体で allow 可能にしないと前進できないと判明した場合
Required Skills
- Python runtime verification
- policy / preflight gate design
- TypeScript test maintenance
Scope Delta(任意)
N/A
Root Cause
現行 contract は security:session-recording:runtime が fixture alias である一方、security:session-recording がその alias を呼ぶため、名前だけで host/runtime の安全確認済みと誤読できる。さらに latitude:real-pilot:preflight が未定義で、pilot_activation_state の正規値 allow | blocked_until_activation | deny ではなく曖昧な active 相当を前提にしているため、top-level decision: allow や fixture PASS を real pilot readiness と誤読する false-green 余地が残っている。
Implementation Approach
security:session-recordingfamily の責務を docs / package / tests で再定義し、fixture alias と host proof を混同できないようにする.claude/scripts/check_session_recording_runtime_safety.pyに host JSON strict mode を追加し、latitude:real-pilot:preflightから canonical に呼ぶpilot_activation_state == allowと pilot exception 完全充足を allow 条件として tests / fixtures で固定する- 実装: Latitude telemetry distribution / argv / remote cleanup gate を real pilot 前提で強化する #1261 の未完了項目はこの Issue で実装しないが、unknown の間は allow 不可であることを fail-closed に明記する
Delivery Rule
- 1 Issue = 1 PR
- worktree:
.claude/worktrees/issue-<N>-latitude-real-pilot-preflight-fail-closed - branch:
worktree-issue-<N>-latitude-real-pilot-preflight-fail-closed - Draft PR 既定
- PR 本文に
Refs #1153を記載し、real pilot false-green 防止 contract repair であることを明示する
Notes for Reviewer
- owner comment
https://github.com/squne121/loop-protocol/issues/1258#issuecomment-4858594357を一次ソースとして、active語彙の除去、top-leveldecision単独判定の禁止、runtimealias の誤読防止、実装: Latitude telemetry distribution / argv / remote cleanup gate を real pilot 前提で強化する #1261 未完了時の allow 禁止を本文へ反映した #1261は dependency であり、実装: latitude real-pilot preflight と session-recording script 境界を fail-closed にする #1258 の中で provenance / argv / cleanup evidence の完全実装までは抱え込まない- 新規 wrapper file を増やさず、既存
.claude/scripts/check_session_recording_runtime_safety.pyを canonical source command の中心に据える
Metadata
Metadata
Assignees
Labels
agent/implementerAI implementer agentenhancementNew feature or requestphase/implementationImplementation phase
Activity
squne121 commentedon Jul 1, 2026
判定: REQUEST_CHANGES
#1258 の方向性は正しいです。ただし現状の Issue contract のまま実装すると、fixture gate の PASS を real pilot readiness と誤読する false-green をまだ作れます。特に
security:session-recording:runtimeが実体として fixture alias である一方、security:session-recordingがその alias を呼んでいるため、名前だけ見ると host/runtime の安全確認済みに見えます。現行package.jsonではsecurity:session-recordingがsecurity:session-recording:runtimeを呼び、runtimeはfixtureの単なる alias、hostは別 script です。latitude:real-pilot:preflightはまだ存在しません。#1258 自体にはコメントがありませんでした。したがって、根拠は #1258 本文、parent #1153、関連 Issue #1261/#1260/#1259、既存 PR #1162/#1226/#1230、現行 repo 資産、外部 docs を参照して評価しています。
主要ブロッカー
B1.
pilot_activation_state != activeは repo contract とズレている#1258 は
pilot_activation_state != active相当なら deny と書いていますが、現行 repo の closed state はactiveではなくallow / blocked_until_activation / denyです。docs/dev/session-recording-policy.mdでも complete case はallow、既定・不完全・synthetic-only はblocked_until_activation、reject はdenyです。このまま実装すると、実装者が
activeを新 enum として追加するか、既存allowを別名扱いするかで contract が割れます。#1258 の AC は次のように修正すべきです。activeという語を残すなら、active_equivalent: allowのように明示して、JSON 出力の正規値はallowに固定してください。B2. 現行 JSON の
decision: allowは real pilot allow ではない現行 checker は global verdict が
safeまたはnot_applicableなら top-leveldecision: allowにしますが、その後にpilot_activation_stateを別 field として出しているだけです。つまり、top-leveldecision: allowだけを見る wrapper は危険です。実際、既存テストは deterministic fixture gate について、exit 0 /
verdict: safeでありながらpilot_activation_state: blocked_until_activationであることを期待しています。これは正しい挙動ですが、wrapper が exit code または top-level decision だけを見ると real pilot を誤って通せます。latitude:real-pilot:preflightはcheck_session_recording_runtime_safety.py --json --execution-profile hostの stdout JSON を解析し、少なくとも以下を全部満たさなければ exit 1 または 2 にすべきです。B3.
security:session-recording:runtimeは削除または強制的にfixture名へ寄せるべき#1258 の最重要目的は「fixture pass を host proof と誤読できない状態」です。現行の
runtimealias は、その目的に反しています。推奨は次のどちらかです。
または破壊変更を避けるなら、
を維持しつつ、docs と tests で
runtime_is_fixture_alias: trueを machine-readable に固定し、latitude:real-pilot:preflightとは絶対に交差させないでください。現状の docs はsecurity:session-recording:hostを generic CI required gate に組み込まない、deterministic CI gate は fixture gate とする、と既に書いているので、package script と tests をこの記述へ一致させる必要があります。B4.
latitude:real-pilot:preflightは shell one-liner ではなく checker 内に strict mode を追加すべきAllowed Paths は既存 Python checker を含みますが、新規 wrapper file は含まれていません。#1258 の Stop Conditions も Allowed Paths 外変更を止める設計です。
したがって、最小実装は新規ファイルではなく、既存
.claude/scripts/check_session_recording_runtime_safety.pyに例えば以下のような mode を追加することです。package.jsonにはこう置くのが堅いです。この mode は通常 JSON の
exit_codeをそのまま信じず、B2 の allow 条件を再評価した上で preflight 用の exit code を返すべきです。B5. #1261 を out-of-scope にするなら、#1258 側で「未解決なら allow 不可」を明文化する必要がある
#1261 は exact package provenance、argv exposure、remote cleanup を real pilot activation の必須 evidence にする Issue です。そこでは
npx -y、provenance unknown、cleanup unknown のまま allow されない状態が outcome とされています。現行 host distribution check は、global npm install を軽く見るだけで、見つかっても
state: unknown、dist_integrity: None、registry_signature_verified: None、provenance_verified: None、inspection_gaps: ["registry_signature", "provenance_attestation"]を返します。これは #1261 未完了の間は安全側に倒れるので良いです。しかし #1258 の preflight wrapper が
pilot_activation_state: allowだけを見る設計だと、将来 #1220 側や docs 側の変更で配布物 evidence を飛ばして通す余地が残ります。latitude:real-pilot:preflightは最低でもcomponents.latitude.distribution.resolution_source != unknown、digest 類の non-null、signature/provenance verified を後続 #1261 完了までは blocked reason として扱うべきです。npm 側の実装としても、registry signatures と provenance は
npm audit signaturesで検証でき、JSON では sigstore attestation bundle を含める option があります。npm docs は package-lock なしの audit は毎回 dependency tree が再構築され結果が変わり得るとも警告しています。([npmドキュメント]1) したがって #1261 完了前に real pilot preflight をallow可能にする実装は、配布物検証の設計として弱すぎます。外部実装・公式 docs から見たリスク
Latitude の Claude Code telemetry 公式 docs は、installer として
npx -y @latitude-data/claude-code-telemetry installを示し、API key を--api-key=...で直接渡す例も載せています。さらに telemetry は prompts、responses、tool input/output、system context を含む full-fidelity telemetry と説明されています。([Latitude Docs]2)これは repo policy の警戒が過剰ではないことを意味します。
--api-keyargv exposure、floatingnpx -y、full prompt/tool I/O の外部送信が全部現実の導入経路に存在します。docs/dev/secret-policy.mdも argv key passing を forbidden とし、remote cleanup が machine_verified でない場合は activation を blocked のままにする設計です。Claude Code hooks についても、公式 docs は matching hooks が parallel に走ること、async hooks は decision/permissionDecision/continue による制御が効かないこと、command hooks が user 権限で動くことを明記しています。([Claude]3) ([Claude]3) したがって Stop hook の exit 0、async upload 完了、hook coexistence を activation proof にする設計は不適切です。repo docs が「Stop hook は diagnostic layer only、正本は pre-session host verifier JSON」としているのは妥当です。
npm provenance も万能ではありません。npm docs は provenance が source/build instructions の検証可能リンクを提供するが、malicious code がないことの保証ではないと明記しています。([npmドキュメント]4) そのため #1258 の preflight は「version pinned + signature verified」だけでなく、「どの source/ref からの package か」「entrypoint/preload/hook command digest が一致するか」まで #1261 と接続する必要があります。
追加すべき acceptance criteria
#1258 の AC は、次を足さないと不十分です。
また、
security:session-recordingfamily は以下を明示すべきです。追加すべき negative tests
最低限、
tests/session_recording_runtime_safety.test.tsに以下の negative controls が必要です。security:session-recording:fixtureは exit 0 でもlatitude:real-pilot:preflightの代替にならない。decision: allowでもpilot_activation_state: blocked_until_activationなら preflight deny。pilot_activation_state: allowでもpilot_exception.decision != approve_timeboxed_real_pilotなら deny。execution_profile: fixtureの JSON を preflight 入力にしたら deny。inspection_complete: falseなら deny。policy.source_digest: unknownなら deny。pilot_exception.malformed: trueまたは marker count != 1 なら fail-closed。pilot_activation_state: activeという未定義 enum を受け取ったら deny/fail-closed。LATITUDE_DEBUG=1、non-HTTPS destination、unknown destination、argv exposure possible、remote cleanup unknown は preflight deny。既存テストは remote cleanup unknown、argv exposure possible、digest incomplete、exact semver/floating spec の扱いをかなり良く押さえています。 ただし、それらはまだ
latitude:real-pilot:preflightcommand surface 自体の contract test ではありません。関連 Issue / PR との整合
#1162 は Latitude telemetry safety checker と Secret Inventory taxonomy を入れ、
security:session-recording:fixture/:hostを追加した前提 PR です。 #1226 はLATITUDE_PILOT_EXCEPTION_V1を repo policy YAML 正本にし、既定をapprove_synthetic_only、real pilot をblocked_until_activationに固定しています。 #1230 は capture capability を synthetic evidence only で固定し、real telemetry / real pilot / real trace export を実行しない前提を守っています。つまり #1258 は、新しい安全設計を作る Issue ではなく、既に積み上がった #1162/#1226/#1230 の境界を package scripts と docs で誤読不能にする Issue です。ここで曖昧な名前や
activeのような未定義 state を残すと、parent #1153 の目的である public-safe retrospective plane と private observation plane の分離を壊します。#1153 は raw prompt/tool I/O/system prompt 等を private observation plane に置き、public plane は validator 済み report/index に限定する設計です。最終レビューコメント案
この修正が入れば #1258 はかなり良い gate になります。現状のままだと、名前・exit code・top-level decision のどれかを人間または agent が読み違える余地が残っています。
squne121 commentedon Jul 1, 2026
変更内容
/tmp/issue_1258_rewrite.mdの内容を Issue 実装: latitude real-pilot preflight と session-recording script 境界を fail-closed にする #1258 にそのまま反映しました。security:session-recording:runtimeの fixture alias / host proof 境界、active語彙、実装: Latitude telemetry distribution / argv / remote cleanup gate を real pilot 前提で強化する #1261 未完了時の unknown 条件を本文へ反映しました。検証
check_vc_scope.py: PASSguard-issue-body.py --issue-kind implementation: all_passedcontract_readiness_check.py --mode preflight-static: status gosqune121 commentedon Jul 1, 2026
Refinement Loop: Approved
The issue has been approved and is ready for implementation.
approvedsqune121 commentedon Jul 1, 2026
Contract Review Result
squne121 commentedon Jul 1, 2026
implement-issue: 実装完了 (2026-07-02T03:09:00+09:00)
.claude/worktrees/issue-1258-latitude-real-pilot-preflight-fail-closedworktree-issue-1258-latitude-real-pilot-preflight-fail-closedpnpm test tests/session_recording_runtime_safety.test.ts: PASS (140 passed)rtk pnpm run security:session-recording:fixture: PASSrtk pnpm run security:session-recording:host: blocked evidence (exit 1)rtk pnpm run latitude:real-pilot:preflight: blocked evidence (exit 1)approve_synthetic_onlyと runtime blocker により blocked のままです。docs: repair Japanese prose blocks in secret policy (#1258)
docs: repair Japanese prose in session recording policy (#1258)
squne121 commentedon Jul 1, 2026
impl-review-loop: 完了 (2026-07-01T18:36:00Z)
fix: tighten latitude real-pilot gate (#1258)
squne121 commentedon Jul 1, 2026
impl-review-loop: 再開完了 (2026-07-01T22:20:00Z)
fix: fail-close latitude real-pilot preflight (#1275)