Skip to content

feat: agent-retrospective に session-window coverage / --since-last-retrospective を追加する - #2612

Merged
squne121 merged 5 commits into
mainfrom
worktree-issue-2601-agent-retrospective-since-last-retrospec
Sep 10, 2026
Merged

squne121 merged 5 commits into
mainfrom
worktree-issue-2601-agent-retrospective-since-last-retrospec

Conversation

@squne121

@squne121 squne121 commented Sep 10, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • --since-last-retrospective(新規実装)向けに .claude/skills/agent-retrospective へ session-window / source-coverage の false-green 防止 gate を greenfield で追加する(P0: agent-retrospective の --since-last-retrospective で session collector 未配線を false-green にしない #2601)。current main には該当機能自体が存在しなかった。
  • 新規 session_window_coverage/v1 schema を追加し、required session source ごとの required | observed | unavailable | partial | not_requested 5値 coverage を machine-readable に表現する(AC1)。既存 2 語彙(agent_improvement_candidate_v1.schema.json の source_coverage closed enum、latitude_runtime_evidence_v1.schema.json の availability/reason_code forcing invariant)を readback した上で、パターン(enum 値・reason_code forcing・indeterminate 相当の allOf invariant)を踏襲しつつ、粒度が異なる(session-window/collector 単位)ため新設した。
  • collector 未配線(AC2)・cross-runtime 片側 unavailable(AC3)・coverage complete かつ selected 0(AC4)を決定論的に区別し、selected_session_count を「0 件観測」と「未観測」で絶対に混同しない。
  • from_exclusive/to_inclusive/covered_sources watermark と SessionWindowCoverageRegression fail-closed guard を実装し、未観測 required source を跨いで checkpoint を進めない(AC5。cross-run で required_sources を絞った場合の巻き戻り漏れも検出する専用テストあり)。
  • orchestration.status(pipeline 実行成否)と analysis_completeness(要求分析の完全性)を構造的に分離し、pipeline 成功を retrospective completeness の根拠にしない(AC7)。
  • durable checkpoint の advance は publish_authorized なしでは常に blocked_no_publish_authorization とし、proposal を already-durable と誤報しない(AC6)。fix_delta(下記参照)で --prior-watermark-file への atomic durable write が実装済み — publish_authorized: True かつ checkpoint が実際に advance した run は、そのファイルへ新しい watermark を書き戻し、次回 invocation がそれを読み戻す(GitHub-comment ベースの新規永続化プロトコル・DB・daemon は依然として導入していない。あくまで caller 供給のローカル --prior-watermark-file 自体が durable state であるという既存設計を維持したまま、それを書く主体がこの authorized invocation自身になっただけ)。

Fix Delta(OWNER レビュー指摘への対応)

OWNER の敵対的レビュー(PR コメント: issuecomment-5613892754)で、初回実装に P0 構造的欠陥が2件・追加修正が5件発見された。全7件を本 commit で解消した。

# Finding 対応 証明する test
1 (P0) prior_watermark が session 選択に実際に適用されていなかった(watermark は reporting 用に計算されるのみで resolve_claude_code_session_paths() に決して feed back されない false-green) resolve_claude_code_session_paths() に min_completed_at/max_completed_at を追加し、collect_session_sources() から window bound として配線。境界は exclusive-lower/inclusive-upper((from_exclusive, to_inclusive])。session の completion signal は transcript 自身の最新 timestamp(無ければ mtime にフォールバック、単独の authoritative selector にはしない) test_collect_session_sources_applies_window_bounds_to_claude_code/test_resolve_claude_code_session_paths_boundary_exclusive_lower_inclusive_upper/test_run_since_last_retrospective_cli_second_run_excludes_prior_window_sessions/live: test_since_last_retrospective_window_filtering_excludes_old_sessions_live(実session file の最古のcompletion timestampを実際の watermark boundaryとして使用)
2 (P0) claude_gpt collector にこの retrospective 自身の freshly-minted run_id を correlation nonce として渡していた構造的バグ(過去の launch の nonce と一致するはずがない) collect_session_sources() は run_nonce=None で collect_claude_gpt_source() を呼ぶように変更。run_nonce=None の場合、sink file 自身の in-window records から観測された実際の nonce を auto-derive する(単一 nonce のみ観測できた場合に限る。複数/ゼロ観測時は fail closed で unavailable) test_collect_claude_gpt_source_auto_derives_nonce_from_sink_content/test_collect_claude_gpt_source_ambiguous_multiple_nonces_fails_closed/test_run_since_last_retrospective_cli_claude_gpt_uses_real_nonce_not_run_id/live: test_since_last_retrospective_claude_gpt_nonce_correlation_live(CLAUDE_GPT_HOOK_SINK_PATH が実際に設定されている場合のみ実行、未設定時は明示的に SKIP)
3 durable checkpoint persistence が存在せず、checkpoint_advanced: true は proposal のまま(人間が手動で --prior-watermark-file を書き換えないと次回 run に反映されない) _write_prior_watermark_file()(atomic temp-file + os.replace)を追加。checkpoint が実際に advance した run が、authorized な同一 invocation 内でその同じファイルへ書き戻す test_run_since_last_retrospective_cli_writes_watermark_file_on_advancement/test_run_since_last_retrospective_cli_does_not_write_watermark_file_when_not_authorized/test_run_since_last_retrospective_cli_second_invocation_reads_back_written_watermark(write→readback を1つの test で end-to-end 証明)
4 --prior-watermark-file の読み込み/JSON parse が main() 側で run_since_last_retrospective_cli() 呼び出しより前・その typed-failure try/except の外側で行われており、欠落/破損ファイルが raw FileNotFoundError/JSONDecodeError として CLI 呼び出し元に漏れていた 読み込み/parse を run_since_last_retrospective_cli() 自身の内部・その try/except boundary の内側へ移動。欠落パスは正当な first-run bootstrap(orchestration.status: succeeded)、既存だが破損した JSON のみ typed failure(orchestration.status: failed, reason_code: JSONDecodeError)として区別する test_run_since_last_retrospective_cli_missing_watermark_file_bootstraps_as_first_run/test_run_since_last_retrospective_cli_malformed_watermark_json_is_typed_failure/test_main_missing_watermark_file_never_raises_raw_exception/test_main_malformed_watermark_file_never_raises_raw_exception
5 jsonschema.validate() は format_checker を明示的に渡さない限り format keyword を検証しない(ライブラリ自身の既定挙動)ため、schema の watermark.from_exclusive/to_inclusive の format: "date-time" が実質的に無視されていた 依存追加なし(rfc3339-validator は未導入かつ repo-root pyproject.toml 編集は Allowed Paths 外)でモジュールスコープの jsonschema.FormatChecker を stdlib datetime.fromisoformat ベースで自作し、validate_session_window_coverage() へ渡すよう変更 test_schema_rejects_invalid_date_time_string/test_schema_accepts_valid_date_time_string
6 既存 agent_session_manifest/v1 を window index として再利用できないか、という設計上の問い 調査した。agent_session_manifest/v1 は per-Main-Loop-phase の記録であり、GitHub Issue/PR comment に opaque ref として public 投稿される形式(scripts/generate-session-manifest.mjs は stdout 出力のみでローカル永続 index を作らない)で、phase_instance_id/issue_number をキーとし、ローカル ~/.claude/projects/<slug>/*.jsonl ファイルとの対応が無く、読み戻しには gh network 呼び出しが必要で、かつ記録された Main Loop phase 以外の生 Claude Code session を一切カバーしない(publish されなかった session は静かに欠落する)。この window index としての採用を却下し、transcript 自身の timestamp を主経路として維持する判断を _claude_code_session_completed_at() の docstring に記録した コード comment(run_retrospective.py、_claude_code_session_completed_at() docstring)に調査根拠を明記。新規 DB/daemon は追加していない
7 live test (verify_since_last_retrospective_live_cli.py) が既存の1テストのみで、Finding 1/2 の P0 修正を実際に証明していなかった 2つの live test を追加。(a) test_since_last_retrospective_window_filtering_excludes_old_sessions_live: 実環境の実 session file のうち最古の completion timestamp を実際の watermark boundary として使い、production の run_since_last_retrospective_cli() が返す selected_session_count が pre-run で観測した全件数より厳密に小さいことを検証する(並行して動く他の Claude Code session による host 上のレースを避けるため、2回の別々の real-time呼び出しの厳密一致ではなく、この不変条件で検証する設計にした)。(b) test_since_last_retrospective_claude_gpt_nonce_correlation_live: production と同じ CLAUDE_GPT_HOOK_SINK_PATH 解決機構を使い、未設定時(プレーンな対話 pytest 実行では常に未設定)は明示的に SKIP、実際に設定されていれば実 sink file に対する nonce auto-derivation を検証する 上記2 live test 自体(verify_since_last_retrospective_live_cli.py)。ローカルでの実行結果は「## AC9 動作検証」節参照

Design Decision(Issue 本文で明示的に flag された open ambiguity への回答)

AC2 の「required session source が1つも collector に configured されていない場合、typed configuration/coverage failure にするか degraded result にするか」という open ambiguity(semantic_review_result.json 記載)に対して、本 PR は degraded result(analysis_completeness: "unavailable"、exit code 0、例外を投げない) を採用した。理由:

  • Issue 自身の ## Desired Outcome が「不足がある場合も...evidence を捨てずに degraded/partial として返してよい」と明記している。
  • AC7 が「orchestration success」と「requested-analysis completeness」を明確に分離することを要求しており、collector 未配線を hard exception にすると、pipeline 自体が失敗したかのように誤読される。
  • run_since_last_retrospective_cli() は内部で例外を捕捉し、orchestration.status: "failed" として型付きで返す設計にしており、真のバグ(例: repo_root が git checkout でない)と「単に session source が未配線」を別軸で表現する。

Checks

  • pnpm typecheck
  • pnpm lint
  • pnpm test
  • pnpm build
  • uv run --locked pytest .claude/skills/agent-retrospective/scripts/tests/ -v(794 passed, 11 deselected — 既存 opt-in live CLI テストの deselect は本 PR 起因ではない既存挙動。test_session_window_coverage.py 単体は 55 passed)
  • uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py(24 passed)
  • uv run --locked ruff check .claude/scripts scripts schemas .claude/skills(All checks passed)
  • 上記コマンドをすべて本 fix_delta 反映後の HEAD(07fbab2d1bcfca7961997004677e508cd54c9d85)でローカル実行し、成功したことを確認してからチェックしています

AC9 動作検証(verify_since_last_retrospective_live_cli.py)

opt-in pytest(verify_since_last_retrospective_live_cli.py)を verify_latitude_runtime_evidence_live_cli.py と同じ SKIP 規約で実装している(fix_delta で 3 test に拡張済み)。ローカル実行結果:

  • claude CLI(PATH 上に存在)チェックは全 test で通過。
  • このリポジトリの worktree(.claude/worktrees/issue-2601-...)自身の $HOME/.claude/projects/<repo-slug>/ には本 worktree 固有のセッション履歴が存在しないため、3 test すべてが claude_code_sessions_dir_not_found / CLAUDE_GPT_HOOK_SINK_PATH_env_var_not_set_no_active_claude_gpt_launch で正しく SKIP した(fabrication なし、実環境の実際の状態。fix_delta で SKIP artifact のファイル名を test ごとに分離し、複数 test が同じ artifact ファイルを上書きしないよう修正した)。
  • 同じロジックをこの skill が既に production 保持している main checkout(~/.claude/projects/-home-squne-projects-LOOP-PROTOCOL/)に向けて手動確認したところ(本 PR のコード自体は変更していない、collector の実データに対する手動 sanity check):
    • collect_claude_code_source が実在する 4676 件の *.jsonl セッションファイルに対して status: complete/partial を返すことを確認。
    • Finding 1 の window filtering を、実在する最古の session の実際の completion timestamp を watermark boundary として使う手動実行で確認: production の run_since_last_retrospective_cli() が返す selected_session_count が pre-run で観測した全件数(4676件)より厳密に少ない値(例: 4672件)を返し、境界より古い session が正しく除外されることを確認した。
    • Finding 2 の nonce auto-derivation を、host 上の実際の過去 claude-gpt launch の hook-sink file(run_nonce/UserPromptSubmit+Stop pair を含む実データ)に CLAUDE_GPT_HOOK_SINK_PATH を向けた手動実行で確認: run_nonce=None のまま status: observed, selected_session_count: 1 を返すことを確認した(この retrospective invocation 自身は claude-gpt launch nonce を一切知らないにもかかわらず、sink file 自身の内容から正しく auto-derive されている)。

備考: Issue 本文は「この live test file は pytest .../tests/ -v の包括的な実行に自動的に含まれるため、独立した VC 行は追加しない」と記載しているが、本リポジトリの pytest 既定 python_files パターン(test_*.py)は verify_*.py にマッチしないため、verify_since_last_retrospective_live_cli.py はこのリポジトリの全ての既存 sibling live-test file(verify_latitude_runtime_evidence_live_cli.py 等)と同様、直接パス指定でのみ収集される opt-in test であり、pytest .claude/skills/agent-retrospective/scripts/tests/ -v には自動的に含まれない(これは本 PR が導入した挙動ではなく、リポジトリ全体の既存の opt-in live-test 規約であり、修正対象としていない)。AC9 の実体(live proof が存在し、SKIP-based で fabrication しない)は満たされている。

AC8 mutation test(手動検証、コミットには非含有)

guard_checkpoint_advancement の raise SessionWindowCoverageRegression(...) を一時的に pass へ書き換えて test_session_window_coverage.py を再実行したところ、以下 2 test が red になることを確認した(確認後 revert 済み・commit には含めていない):

  • test_ac5_guard_raises_on_direct_regression
  • test_ac5_ac8_scenario_d_narrowed_required_sources_blocks_via_guard_not_step1

受け入れ条件の達成状況

Issue #2601 は AC1〜AC10 の 10 個を持つ。本 PR(HEAD=07fbab2d1bcfca7961997004677e508cd54c9d85)で全 AC を実装済み(fix_delta で Finding 1-7 を修正した後の状態)。

  • AC1: .claude/skills/agent-retrospective/schemas/session_window_coverage_v1.schema.json に required|observed|unavailable|partial|not_requested の 5 値 source_coverage enum を定義し、compute_source_coverage_entry()/compute_source_coverage_map()(run_retrospective.py)が生成する。既存 2 語彙を readback したうえでパターンを踏襲。test_ac1_source_coverage_five_state_vocabulary_reuses_collector_enum/test_ac1_unrecognized_collector_status_fails_closed/test_ac1_claude_gpt_selected_session_count_uses_complete_sessions_provenance — PASS
  • AC2: compute_analysis_completeness() が required source 全未配線時に selected_session_count: 0 を「0 件観測」と誤報せず degraded/typed coverage failure として扱う — test_ac2_ac8_no_collector_scenario_a_zero_wired_never_complete — PASS
  • AC3: 片側 unavailable/partial のとき取得済み側の evidence は保持しつつ cross-runtime comparison を unavailable/partial にし数値を捏造しない — test_ac3_ac8_one_source_unavailable_scenario_b_evidence_retained — PASS
  • AC4: 両 runtime 配線済みかつ window 内 session 実測 0 件の「coverage complete + selected 0」を AC2 の未観測状態と決定論的に区別 — test_ac4_ac8_both_sources_zero_scenario_c_complete_distinct_from_ac2(fix_delta 後は window filtering が実際に機能するため、この区別が false-green ではなく genuine な steady-state として証明されている) — PASS
  • AC5: from_exclusive/to_inclusive/covered_sources watermark invariant と SessionWindowCoverageRegression(guard_checkpoint_advancement())の fail-closed guard — test_ac5_watermark_covers_only_observed_sources/test_ac5_guard_raises_on_direct_regression/test_ac5_guard_noop_on_first_run/test_ac5_ac8_scenario_d_narrowed_required_sources_blocks_via_guard_not_step1/test_ac5_guard_still_blocks_after_selector_fix_when_source_regresses(fix_delta 追加 — window-aware selector 修正後も guard が引き続き機能することを再確認) — PASS
  • AC6: compute_checkpoint_disposition() が first-run / zero-finding / zero-session / no-publish-authorization の各ケースで checkpoint_advanced/checkpoint_advance_reason/durable checkpoint 有無を明示。fix_delta で durable checkpoint の実際の write/readback を実装(Finding 3) — test_ac6_ac8_scenario_e_first_run_no_publication_blocked_explicit/test_ac6_first_run_with_authorization_advances/test_ac6_no_new_sessions_selected_when_prior_state_exists/test_run_since_last_retrospective_cli_writes_watermark_file_on_advancement/test_run_since_last_retrospective_cli_second_invocation_reads_back_written_watermark(fix_delta 追加) — PASS
  • AC7: orchestration.status(pipeline 実行成否)と analysis_completeness(要求分析の完全性)を構造的に分離し、pipeline 成功を completeness の根拠にしない — test_ac7_orchestration_succeeded_even_when_analysis_completeness_unavailable/test_ac7_run_since_last_retrospective_cli_never_raises_reports_orchestration_failed — PASS
  • AC8: no-collector / one-source-unavailable / both-sources-zero / both-sources-nonzero / first-run-no-publication の 5 scenario を含む AC1〜AC8 focused test(test_session_window_coverage.py 55 tests)で固定。guard_checkpoint_advancement の raise SessionWindowCoverageRegression(...) を一時的に pass へ書き換える mutation test を手動実行し、2 test が red になることを確認済み(「AC8 mutation test」節参照) — PASS
  • AC9(動作検証, decision: immediate): verify_since_last_retrospective_live_cli.py を verify_latitude_runtime_evidence_live_cli.py と同じ opt-in・SKIP 規約で実装(fix_delta で 3 test に拡張、Finding 7 参照)。今回改めてローカル再実行した結果、本 worktree 自身の $HOME/.claude/projects/<repo-slug>/ にはこの worktree 固有のセッション履歴が存在しないため全 test が正しく SKIP(exit 77 相当・fabrication なし)。production 保持している main checkout へ手動照合した際は実在する *.jsonl に対し window filtering・nonce correlation とも実データで正しく機能することを確認済み(コード自体は本 PR で変更なし、「## AC9 動作検証」節参照) — PASS(legitimate SKIP、fallback PASS への昇格なし)
  • AC10: .claude/skills/agent-retrospective の全 test suite と repository-required checks が PASS — 下記「## 検証コマンド結果」参照 — PASS

検証コマンド結果

Issue #2601 の ## Verification Commands に記載された全コマンドおよび project constitution の必須検証を、本 PR head(HEAD=07fbab2d1bcfca7961997004677e508cd54c9d85、fix_delta 反映後)で改めて再実行した結果:

# AC1-AC10
$ uv run --locked pytest .claude/skills/agent-retrospective/scripts/tests/ -v
→ PASS (794 passed, 11 deselected — 既存 opt-in live CLI テストの deselect は本 PR 起因ではない既存挙動)

# AC10
$ pnpm typecheck
→ PASS (tsc --noEmit, エラーなし)

# AC10
$ pnpm lint
→ PASS (eslint ., 出力なし = No issues found)

# AC10
$ pnpm test
→ PASS (Test Files: 108 passed (108) / Tests: 1939 passed (1939))

# AC10
$ pnpm build
→ PASS (tsc && vite build, ビルド成功)

project constitution が要求する追加ゲート:

$ uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py
→ PASS (24 passed)

$ uv run --locked ruff check .claude/scripts scripts schemas .claude/skills
→ PASS (All checks passed)

Allowed Paths 遵守

git diff --name-only main...HEAD(本 PR head HEAD=07fbab2d1bcfca7961997004677e508cd54c9d85)で取得した変更ファイルは以下の 5 件のみである(fix_delta で collect_snapshot.py が新たに変更対象に加わった)。

  • .claude/skills/agent-retrospective/schemas/session_window_coverage_v1.schema.json(新規)
  • .claude/skills/agent-retrospective/scripts/run_retrospective.py(更新)
  • .claude/skills/agent-retrospective/scripts/collect_snapshot.py(更新、fix_delta で追加。Finding 1/2 の collector-level 修正)
  • .claude/skills/agent-retrospective/scripts/tests/test_session_window_coverage.py(新規)
  • .claude/skills/agent-retrospective/scripts/tests/verify_since_last_retrospective_live_cli.py(新規)

Issue #2601 の ## Allowed Paths は以下を候補として挙げており、上記 5 件はすべてこの範囲内に収まる(scripts/claude-gpt/** の追加は不要だったため未使用)。

  • .claude/skills/agent-retrospective/schemas/** ← session_window_coverage_v1.schema.json が該当
  • .claude/skills/agent-retrospective/scripts/run_retrospective.py ← 完全一致
  • .claude/skills/agent-retrospective/scripts/collect_snapshot.py ← 完全一致
  • .claude/skills/agent-retrospective/scripts/tests/** ← test_session_window_coverage.py/verify_since_last_retrospective_live_cli.py が該当

Allowed Paths 外のファイル変更は存在しない。

Schema Change Applicability

  • decision: schema_change
  • reason: 新規 session_window_coverage/v1 schema(.claude/skills/agent-retrospective/schemas/session_window_coverage_v1.schema.json)を追加した。fix_delta では schema 定義自体は変更していない(validator の format_checker 適用のみ追加、Finding 5)。

Schema Consumer Inventory

変更対象 schema: session_window_coverage/v1(新規)

before/after 差分:

# before
# 存在しない(current main に session-window coverage schema なし)

# after
schema_version: session_window_coverage/v1
orchestration: { status: succeeded|failed, reason_code: string|null }
required_sources: [string, ...]
source_coverage:
  <source_id>: { status: required|observed|unavailable|partial|not_requested, reason_code: string|null, selected_session_count: int|null }
analysis_completeness: complete|degraded|unavailable
cross_runtime_comparison: { status: available|partial|unavailable, reason_code: string|null } | null
watermark: { from_exclusive: string|null, to_inclusive: string, covered_sources: [string, ...] }
checkpoint: { checkpoint_advanced: bool, checkpoint_advance_reason: string }

Consumer 列挙(rg コマンド例と結果):

rg -l "session_window_coverage" .
./.claude/skills/agent-retrospective/scripts/run_retrospective.py
./.claude/skills/agent-retrospective/scripts/tests/verify_since_last_retrospective_live_cli.py
./.claude/skills/agent-retrospective/scripts/tests/test_session_window_coverage.py
./.claude/skills/agent-retrospective/schemas/session_window_coverage_v1.schema.json

Consumer 更新状況:

Consumer ファイル 更新有無 備考
.claude/skills/agent-retrospective/scripts/run_retrospective.py 更新済み(producer/consumer 兼務) build_session_window_coverage_result() が生成し validate_session_window_coverage() が自己検証する(fix_delta で format_checker 適用を追加)。--since-last-retrospective CLI mode がこの envelope を stdout に出力する唯一の producer。
.claude/skills/agent-retrospective/scripts/collect_snapshot.py 更新済み(fix_delta で追加) collect_claude_code_source()/collect_claude_gpt_source() が window bound / auto-derived nonce を受け取れるよう拡張(Finding 1/2)。schema 自体は生成しない(run_retrospective.py 側が consumer)。
.claude/skills/agent-retrospective/scripts/tests/test_session_window_coverage.py 更新済み(fix_delta で regression test 追加) schema 往復検証・forcing invariant・format 検証の negative test を含む。
.claude/skills/agent-retrospective/scripts/tests/verify_since_last_retrospective_live_cli.py 更新済み(fix_delta で 2 live test 追加) live 環境に対する schema-valid 出力検証。
外部 caller(impl-review-loop 等) 不要(未対応・本 PR スコープ外) 本 PR は schema と CLI mode の追加のみ。オーケストレーター側からの --since-last-retrospective 呼び出し配線は別 Issue(この PR には含まれていない、In Scope 上も含まれていない)。

Compatibility Decision(互換性判定)

  • change_type: additive(追加のみ)
  • compatibility: backward_compatible(後方互換)
  • migration_required: no(不要)
  • migration_or_followup: N/A(該当なし)
  • reason: 新規 schema・新規 CLI フラグ(--since-last-retrospective)の追加のみ。既存の run_cli() / デフォルト CLI 引数契約・既存 schema には非破壊的な変更(--repository-id 等の required=True を required=False にした上で main() 冒頭で手動必須チェックへ置き換えたが、デフォルトモードの実効的な必須性・エラーメッセージ挙動は変えていない)。fix_delta は既存の collect_claude_code_source()/collect_claude_gpt_source()/resolve_claude_code_session_paths() の呼び出しシグネチャに キーワード引数 を追加しただけで、既存の位置引数呼び出しは非破壊的。

Visual Impact Declaration(視覚影響申告)

該当なし(UI/DOM/CSS 変更を含まない)。

Safety Claim Matrix

Claim Implemented? Not controlled Evidence Follow-up
--since-last-retrospective は headless Agent subprocess(claude -p --agent ...)を一切起動しない(既存 observer/evaluator pipeline とは独立した collector-only 経路) yes run_since_last_retrospective_cli() の実装(invoke_agent/AgentInvocationRequest を一切参照しない)。uv run --locked pytest .claude/skills/agent-retrospective/scripts/tests/test_session_window_coverage.py -v(55 passed) N/A
collector 未配線・unavailable な session source を observed/complete として誤報しない(false-green 防止が本 Issue の主目的) yes test_ac2_ac8_no_collector_scenario_a_zero_wired_never_complete ほか AC1-AC8 focused tests(test_session_window_coverage.py、55 passed)。AC8 mutation 検証(guard 無効化で 2 test が red、PR body「AC8 mutation test」節参照) N/A
prior_watermark は実際に session 選択に適用される(reporting のみに計算され selection に feed back されない false-green ではない) yes fix_delta Finding 1。test_collect_session_sources_applies_window_bounds_to_claude_code/test_run_since_last_retrospective_cli_second_run_excludes_prior_window_sessions/live: test_since_last_retrospective_window_filtering_excludes_old_sessions_live(実 session file に対する window filtering を実データで証明) N/A
claude_gpt correlation nonce はこの retrospective invocation 自身の run_id ではなく、対象 launch 自身が観測した nonce から auto-derive される yes fix_delta Finding 2。test_run_since_last_retrospective_cli_claude_gpt_uses_real_nonce_not_run_id/test_collect_claude_gpt_source_ambiguous_multiple_nonces_fails_closed(複数/ゼロ観測時は fail closed) N/A
durable checkpoint の advance は publish_authorized: True を明示しない限り proposal のまま。authorized 時は --prior-watermark-file へ atomic 書き戻しを行い、次回 invocation がそれを読み戻す(新規 GitHub-comment 永続化プロトコル・DB・daemon は追加しない) yes fix_delta Finding 3。test_run_since_last_retrospective_cli_writes_watermark_file_on_advancement/test_run_since_last_retrospective_cli_does_not_write_watermark_file_when_not_authorized/test_run_since_last_retrospective_cli_second_invocation_reads_back_written_watermark N/A
claude_code/claude_gpt collector 設定解決はローカルファイルパス・既存 env var 規約のみを読み、raw absolute path や credential を出力に含めない yes _scrub()(collect_snapshot.py、既存・未変更)を経由した CollectorResult をそのまま利用。verify_since_last_retrospective_live_cli.py の raw path 非包含 assertion(fix_delta 追加の2 test も同様のassertionを含む) N/A

記載ルール遵守: Not controlled が非空の行は現時点で存在しない(fix_delta で Finding 3 の durable persistence が実装されたため、以前の「durable persistence write path はスコープ外」の限定を削除した)。PR title / summary で無限定の complete/safe 等は使っていません。

Notes

  • Related issue: Closes P0: agent-retrospective の --since-last-retrospective で session collector 未配線を false-green にしない #2601(本 PR が close する対象 Issue。AC1〜AC10 全項目の充足を上記「## 受け入れ条件の達成状況」で確認済み)
  • MVP scope: --since-last-retrospective の session-window coverage / watermark / checkpoint disposition 計算層。fix_delta で durable checkpoint の実際の write/readback(Finding 3)を追加したが、GitHub-comment ベースの新規永続化プロトコルや別 daemon は依然として導入していない(既存のローカル --prior-watermark-file 設計の範囲内)。オーケストレーターからの実配線は本 PR に含まない(Issue の In Scope 通り、collector-only の最小 wiring に限定)。
  • AI / NotebookLM usage: 実装は Claude Code(本 PR)による。NotebookLM は使用していない。
  • 備考: --since-last-retrospective は greenfield 実装のため、CLI 引数の --repository-id/--target-issue/--request-id/--idempotency-key を argparse の required=True から required=False + main() 内の手動必須チェックへ変更した(--since-last-retrospective モードではこれらを要求しないため)。既存デフォルトモードの挙動(未指定時にエラーで停止する)は維持している(test_main_default_mode_still_requires_target_issue_args で検証)。
  • fix_delta 対応: OWNER レビュー指摘(PR コメント issuecomment-5613892754)の Finding 1-7 全件を本 commit(07fbab2d)で解消した。詳細は上記「## Fix Delta」節を参照。

…trospective を追加する (#2601)

Session collector 未配線・unavailable・partial を "0 sessions observed" や
"retrospective 完了" と誤解釈しない machine-readable coverage を新規実装する。

- 新規 session_window_coverage/v1 schema(既存 agent_improvement_candidate_v1
  の source_coverage、latitude_runtime_evidence_v1 の availability/reason_code
  パターンを踏襲した required|observed|unavailable|partial|not_requested 5値)
- collect_snapshot.py の既存 collect_claude_code_source /
  collect_claude_gpt_source をそのまま再利用する最小 collector wiring
  ($HOME/.claude/projects/<repo-slug>/ と CLAUDE_GPT_HOOK_SINK_PATH の
  既存規約を再利用、未解決時は None のまま集計しない)
- from_exclusive/to_inclusive/covered_sources watermark と
  SessionWindowCoverageRegression fail-closed guard(cross-run で
  required_sources を絞った際の checkpoint 巻き戻り漏れも検出)
- orchestration.status と analysis_completeness を構造的に分離し、
  pipeline 成功を retrospective completeness の根拠にしない
- durable checkpoint は publish_authorized なしでは advanced と誤報しない
  (--prior-watermark-file による proposal-only 設計。新規 GitHub-comment
  永続化プロトコルは追加しない)
- focused tests 32件 + mutation 検証(guard の raise を無効化すると
  2 test が red になることを確認済み、コミットには含めない)
- AC9 live verification: 既存 verify_latitude_runtime_evidence_live_cli.py
  と同じ opt-in SKIP 規約の新規 pytest ファイル

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Preview URL

✅ verified live assets: https://squne121.github.io/loop-protocol/pr-2612/

The preview will be removed when this PR is closed.

@squne121

Copy link
Copy Markdown
Owner Author

結論

Verdict: REQUEST_CHANGES です。
現 HEAD 9163ce33e880bb207eb2bd1f7a08965e8a768f10 まで確認しました。これは main 取り込み merge commit を含む現在の PR HEAD です。

CI は通っており、source_coverage の5状態化、orchestration.status と analysis_completeness の分離、coverage regression guard という方向性自体はよいです。しかし 「前回 retrospective 以降」という機能の中心である時間 window が実際の session 選択に適用されていません。さらに Claude-GPT 側には nonce identity の取り違えがあります。この2点はテストが green でも実利用で壊れるため、merge blocker と判断します。

Issue #2601 は AC4 で「window 内の対象 session が0件」、AC5 で from_exclusive/to_inclusive watermark、AC6 で「次回 --since-last-retrospective がどの boundary を使うか」を明示的に要求しています。

Findings

  1. [BLOCKER / P0] watermark が session selection に一切使われておらず、--since-last-retrospective が実質 “all sessions” になっています。
    現実装の resolve_claude_code_session_paths() は session directory 以下の 全 **/*.jsonl を返します。その全パスを既存 collect_claude_code_source() にそのまま渡しています。 一方、既存 collector 自身は「どの session が run の scope に入るかは orchestration layer が決める」という契約です。 compute_session_window() で行っているのは prior の to_inclusive を from_exclusive にコピーし、新しい to_inclusive を生成するだけで、この境界は collection にフィードバックされません。

    例えば初回までに A/B という2 session があり checkpoint=T1、その後 session を一件も実行せず再実行すると、A/B をまた読み selected_session_count=2 にします。したがって本来の no_new_sessions_selected に到達せず、古い session が毎回「新規」として再集計されます。

    テストもこの defect を見逃しています。test_ac6_no_new_sessions_selected_when_prior_state_exists() は実際の古い JSONL と watermark を渡して選択を検証せず、最初から sessions_read=0 の fake CollectorResult を組み立てています。つまり selector ではなく downstream の if 文だけをテストしています。

    修正は大きなハーネス不要です。run 開始時に window_end を一度固定し、(prior.to_inclusive, window_end] に入る session だけを collector に渡してください。最低限、「旧 session 1件+新規なし→0」「旧1件+新規1件→1」「初回→全対象」の real JSONL integration test が必要です。mtime だけに依存するより transcript 内 timestamp/session metadata を使うべきです。

  2. [BLOCKER / P0] Claude-GPT collector に retrospective 自身の新規 UUID を run_nonce として渡しているため、既存の Claude-GPT session evidence と identity が一致しません。
    run_since_last_retrospective_cli() は run_id 未指定時に新しい UUID を生成し、それを collect_session_sources(... run_nonce=resolved_run_id) に渡します。 Claude-GPT branch はその値をそのまま collect_claude_gpt_source(... run_nonce=run_nonce) に渡しています。

    しかし既存 collector は JSONL から record.run_nonce == run_nonce のものだけを採用し、一件も一致しなければ stale_runtime_evidence / unavailable とします。 さらに既存 launcher の hook sink 自体が launcher 側 nonce による hook-sink-<nonce>.jsonl です。

    つまり「retrospective run identity」と「過去 Claude-GPT session の evidence identity」が混同されています。CLI から arbitrary な過去 nonce を合わせる手段もありません。デフォルト source は claude_code,claude_gpt なので、通常利用では cross-runtime coverage が構造的に unavailable へ落ちやすい設計です。

    retrospective run ID と source evidence nonce を分離してください。Claude-GPT は window 内に属する sink/session identity を列挙し、それぞれ自身の nonce で検証する形が妥当です。新しい registry を作る必要はなく、既存の hook-sink metadata / session manifest を索引として使えます。

  3. [HIGH / P1] checkpoint_advanced: true が durable checkpoint を一切更新していません。
    コード自身が「durable persistence は OUT OF SCOPE」「checkpoint_advanced: true は proposal」と明記しています。 しかし disposition は publish_authorized=True だけで checkpoint_advanced: True を返します。 Issue AC6 は durable checkpoint の有無と、次回 run がその boundary を使うことの testまで要求しています。

    ここで GitHub comment persistence や承認 control-plane を追加するのは、この個人開発では過剰です。最小構成なら --prior-watermark-file を --watermark-file 相当の read/write state とし、coverage complete 時だけ temp-file + rename で atomically 更新するのが適切です。永続化を本 PR から本当に外すなら、少なくとも checkpoint_advanced は checkpoint_advance_proposed に変えないと意味が嘘になります。

  4. [HIGH / P1] malformed/missing --prior-watermark-file が typed failure envelope にならず、生例外になります。
    コメント上は since-last モードが「常に schema-valid envelope を出し exit 0」としていますが、Path(...).read_text() と json.loads() は run_since_last_retrospective_cli() を呼ぶ前に実行されています。 FileNotFoundError / JSONDecodeError はその内部の catch-all に届きません。

    単純に watermark acquisition/validation まで entrypoint の typed-failure boundary 内へ移してください。これはセキュリティ強化ではなく、CLI の基本的な operational reliability 修正です。

  5. [MEDIUM / P2] schema の format: "date-time" は現在の validator 呼び出しでは検証されません。
    schema は from_exclusive / to_inclusive に format: "date-time" を指定しています。 ところが validator は単なる [jsonschema](https://python-jsonschema.readthedocs.io/_/downloads/en/v4.12.1/pdf/).validate(instance=..., schema=...) です。 Python jsonschema の公式ドキュメントでは、format_checker を渡さない限り format validation は実行されないと明記されています。(jsonschema)

    Draft202012Validator(schema, format_checker=Draft202012Validator.FORMAT_CHECKER) を使い、不正 timestamp の negative test を1件追加すれば十分です。

  6. [MEDIUM / P2] 既存 agent_session_manifest/v1 と Claude Code hook identity をもっと利用した方が、実装が単純かつ堅牢です。
    この repo には既に session manifest SSOT があり、recorded_at、actor.session_id、runtime_lane、completion_outcome 等を保持しています。 また現在の Claude Code 公式 Hooks API は各イベントに session_id と transcript_path を渡し、SessionEnd にも同じ identity が渡されます。(Claude)

    したがって $HOME/.claude/projects/<repo-slug> を再構築して全 JSONL を glob する方式だけを authority にするより、既存 manifest/hook metadata を window index とし、必要な transcript だけ読むのがよいです。既存 manifest が全 session をカバーしない箇所だけ transcript scan に fallback すればよく、新規 DB や daemon は不要です。

  7. [MEDIUM / P2] AC9 live test が今回の本丸2件を検証していません。
    live test は required_sources=["claude_code"]、prior_watermark=None 固定です。つまり「2回目の window selection」と「Claude-GPT nonce correlation」はどちらも一度も実機経路を通りません。 そのため CI が green でも Finding 1/2 がそのまま残れます。

    live harness を増築する必要はありません。既存 test を「prior boundary を与えた2回目」を含むよう少し延長し、Claude-GPT が利用可能な環境では real nonce/sink correlation を1回確認する程度で足ります。Claude-GPT が unavailable なら明示的 unavailable のままでよく、それを無理に FAIL にする必要もありません。

評価できる点

この PR の AC2 の false-zero 防止、5-state coverage、orchestration と completeness の分離、未観測 source を跨ぐ guard は残す価値があります。また既存 collector の redaction / public-safe boundary をそのまま再利用している判断も合理的です。

一方、この PR に追加の sandbox、permission broker、approval gate、複雑な security receiptを増やすことは推奨しません。今回不足しているのは security hardness ではなく、session-window のデータモデルと identity correlation です。そこへ実装コストを集中させるべきです。

Merge 条件

私なら Finding 1 と 2 を必須修正、Finding 3 と 4 も #2601 を Closes するなら同 PR 内で修正します。Finding 5〜7 は小さいので同時修正が妥当です。特に Finding 1 は feature 名そのものを無効化しているため、現在の CI/内部 APPROVE を根拠に merge することには反対です。

修正後の理想形は、「既存 metadata を索引に (from_exclusive, to_inclusive] を決定 → runtime ごとの正しい session identity で collector → coverage 判定 → 単純な local watermark を atomic 更新」です。これなら現状よりハーネスを増やさず、実用性もかなり上がります。

@squne121

Copy link
Copy Markdown
Owner Author

推奨は、Issue #2601 / 既存 PR #2612 の impl-review-loop を、対象コメントを新しい fix_delta として再開することです。前回の impl-review-loop は 04:45 UTC に APPROVE まで到達していますが、その後 05:57 UTC に今回の REQUEST_CHANGES が追加されています。したがって前回 APPROVE は現在のレビュー状態を表しません。

対象コメントの P0/P1 は同 PR 内で解消するのが妥当です。特に現実装には「Claude Code session を全 *.jsonl から収集」「retrospective の新規 run_id を Claude-GPT の run_nonce に渡す」「watermark file の読み込みが typed-failure boundary の外」「session-window schema が通常の jsonschema.validate」という指摘対象の経路が実際にあります。PR は Closes #2601 を掲げており、Issue AC6 も次回 run が boundary を使うことまでテストで要求しているため、Finding 3 の durable watermark も今回直す方が整合します。

また、新規 DB/daemon を作るより既存 agent_session_manifest/v1 を window index に利用する方向が適しています。リポジトリには既に manifest schema と producer が存在します。

以下を、そのまま 既に auto mode で起動済みの対話的 Claude Code に渡すのを推奨します。

PR #2612 / Issue #2601 の既存実装について、以下の OWNER review comment を新しい human feedback / fix_delta として取り込み、.claude/skills/impl-review-loop を再開してください。

Target PR:
#2612

Target human-context / review comment:
#2612 (comment)

対象 Issue:
#2601

この対話プロンプト自体を最新の direct interactive human instruction として扱ってください。対象コメントの REQUEST_CHANGES は修正要求として消費し、その finding を解消するために実装→検証→PR review loop を継続してください。対象コメントより後に投稿された、未撤回の明示的な OWNER 停止指示が live Issue / PR 上に存在する場合だけ、それを別途評価してください。

impl-review-loop の intake では、上記対象コメント URL を明示的に human_context_comment_urls として渡してください。投稿者アカウント等から provenance を推測せず、このプロンプトで明示指定された URL であることを human-context origin の根拠にしてください。

既存 PR・既存 canonical worktree・既存 branch を再利用し、fresh implementation を重複して開始しないでください。開始時に live Issue、live PR、対象コメント、現在の PR HEAD、base、mergeability、dirty state、最新 CI、review/thread、関連する既存 repository assets を再取得し、対象コメントが評価した HEAD から変更があれば必ず current HEAD を authority としてください。

作業方針は以下です。

  1. .claude/skills/impl-review-loop/SKILL.md とその normative steps を読み、Issue P0: agent-retrospective の --since-last-retrospective で session collector 未配線を false-green にしない #2601 を対象に loop を resume してください。前回の APPROVE/終了報告は今回の OWNER review comment より古いため、現在の承認根拠として再利用しないでください。

  2. Step 1 / Implementation は必ず SubAgent に委譲してください。対象コメントの全 finding を fix_delta として渡し、SubAgent の完了を待ってください。SubAgent が動作中のまま次 Step や最終報告へ進まないでください。

  3. Finding 1 と Finding 2 は P0 merge blocker として必須修正してください。
    Finding 1 については run 開始時に to_inclusive/window_end を一度だけ freeze し、session selection 自体を (prior.to_inclusive, window_end] に限定してください。単に watermark を result に表示するだけでは不可です。mtime-only を authoritative selector にせず、利用可能なら transcript/session metadata または既存 session manifest/hook identity を索引にしてください。既存 metadata が網羅しない場合だけ deterministic fallback scan を使ってください。

    Finding 2 については retrospective invocation の run_id と、過去 Claude-GPT evidence の source/session nonce を完全に分離してください。新しく生成した retrospective UUID を過去 session collector の nonce として流用しないでください。window 内の既存 hook-sink/session identity を列挙し、それぞれ自身の記録済み nonce/identity で evidence を検証してください。新規 registry/DB/daemon は原則追加せず、既存 hook-sink metadata、session manifest、既存 production evidence source を優先して再利用してください。

  4. Finding 3 と Finding 4 も、PR が Closes #2601 を維持するなら同 PR 内で必須修正してください。
    checkpoint については checkpoint_advanced: true と実際の durable state を一致させてください。最小構成を優先し、現在の --prior-watermark-file を read-only proposal のまま残すより、必要なら明確な read/write watermark state として整理し、coverage complete かつ advancement が許可された場合のみ temp file + atomic rename などで durable update してください。次回 --since-last-retrospective が実際にその boundary を読む integration test を必須にしてください。実装上どうしても durable write を行わない設計を採るなら、checkpoint_advanced という完了済みを意味する名称・PR body・AC6 claim を残してはいけません。

    malformed / missing watermark file の read、JSON decode、schema validation を run_since_last_retrospective_cli() 相当の typed-failure boundary の内側へ移し、生の FileNotFoundError / JSONDecodeError を CLI 外へ漏らさないでください。

  5. Finding 5〜7 も小規模で同スコープ内に収まる限り今回まとめて修正してください。
    format: date-time を実際に検証する Draft 2020-12 validator + format checker を使用し、不正 timestamp の negative test を追加してください。
    既存 agent_session_manifest/v1、hook/session identity、recorded timestamp を window index として利用できるか current repository implementation を調査してから設計してください。
    live test は first-run だけでなく prior boundary を与えた second-run を含め、少なくとも「旧 session のみ→selected 0」「旧 session + window 内新規 session→selected 1」を production-compatible path で検証してください。Claude-GPT source が利用可能な環境では real sink/nonce correlation を確認し、利用不能なら unavailable を明示して synthetic PASS に昇格させないでください。

  6. regression test は downstream の fake CollectorResult だけで済ませず、selector/correlation の実経路を通してください。最低限 real temporary JSONL/session metadata を使って以下を固定してください。
    first run → 全 window 対象を選択。
    prior watermark + 新規 session なし → selected 0。
    prior watermark + 新規 session 1件 → 新規 1件だけ選択。
    boundary 上の exclusive/inclusive semantics。
    Claude-GPT retrospective run_id と source nonce の非同一ケース。
    missing watermark file。
    malformed JSON watermark。
    invalid date-time。
    durable checkpoint write → 次 run readback。
    source unavailable/partial 時に checkpoint が gap を跨がないこと。

  7. 対象コメントで評価されている既存の良い部分、特に 5-state source coverage、false-zero 防止、orchestration.status と analysis_completeness の分離、coverage regression guard、既存 public-safe/redaction boundary は不要に作り直さず維持してください。security harness、permission broker、新規 approval infrastructure、sandbox、receipt systemなど、本修正に不要な仕組みは追加しないでください。品質・実用性・correctness に実装コストを集中してください。

  8. 実装後は Step 2 / Verification を独立した SubAgent に委譲し、その SubAgent の終了を待ってください。Issue P0: agent-retrospective の --since-last-retrospective で session collector 未配線を false-green にしない #2601 の Verification Commands、変更範囲の focused tests、agent-retrospective 全 suite、repository-required checks を current HEAD で実行してください。失敗した場合は結果を implementation-worker の fix_delta に戻し、自動で修正→再検証してください。

  9. Verification が current HEAD で green になった後だけ、Step 4 / PR Review を別の SubAgent に委譲してください。pr-reviewer には Issue P0: agent-retrospective の --since-last-retrospective で session collector 未配線を false-green にしない #2601、対象 OWNER comment の全 finding、current diff、current HEAD、CI evidence、既存関連 implementation/assets を渡し、対象コメントの finding が「コード変更されたから解決済み」と推測されないよう、各 finding を実装と test evidence に照合させてください。pr-reviewer SubAgent の作業完了を必ず待ってください。

  10. pr-reviewer が REQUEST_CHANGES を返したら .claude/skills/impl-review-loop の通常 routing に従い Step 1 へ戻し、blockers を次の fix_delta として自動処理してください。stale-head、main drift、BEHIND、CI failure 等も skill の canonical routing に従って自動処理してください。SubAgent の単なる human_review_required: true 自己申告や advisory artifact の欠落だけを理由に、この interactive session へ承認を求めないでください。

auto mode で実行中なので、通常の implementation、test、format/lint、commit、既存 branch への publish、PR body 更新、review feedback 対応、CI 再確認、必要な ready-for-review 遷移は、skill / repository policy が許可する範囲で人間への逐次承認なしに進めてください。

PR body は最終 implementation と一致するよう更新してください。古い test count、古い HEAD、解消済み limitation、durable persistence は OUT OF SCOPE 等の現在と矛盾する claim を残さないでください。Closes #2601 は Issue #2601 の AC1〜AC10 を current implementation が実際に満たす場合のみ維持してください。

最終終了条件は .claude/skills/impl-review-loop の current-head APPROVE、blockers なし、required verification/CI green、live mergeability が merge 直前の状態まで到達したことです。

絶対に PR を merge しないでください。
auto-merge も有効化しないでください。
merge は人間が行います。

破壊的操作、secret/credential の公開・変更、force push / history rewrite、または repository policy 上の明示的 hard stop が必要になった場合のみ停止してください。それ以外の通常のレビュー修正では人間承認を求めず loop を継続してください。

最後に、すべての SubAgent が終了済みであることを確認してから、current HEAD、実施した fix、全 finding の disposition、verification/CI、最終 reviewer verdict、live mergeability、残 blocker、PR が merge 直前まで到達したかを簡潔に報告してください。

この形なら、前回 APPROVE を誤って再利用せず、今回の OWNER review を明示的 provenance 付きで取り込み、P0/P1 を実装へ戻した上で impl-review-loop 本来の実装→独立検証→再レビュー循環に載せることができます。現在 PR は open / mergeable / draft なので、merge 自体を行わない停止点とも整合します。

Test and others added 2 commits September 10, 2026 16:03
… checkpoint を修正する (#2601)

OWNER REQUEST_CHANGES (PR #2612 issuecomment-5613892754) の Finding 1-7 に対応する fix_delta。

- Finding 1: prior_watermark が session 選択に実際に適用されていなかった false-green を修正。
  `resolve_claude_code_session_paths()` に min/max_completed_at bound を追加し、
  `collect_session_sources()` から window_start_exclusive/window_end_inclusive として配線した。
- Finding 2: claude_gpt collector が retrospective 自身の run_id を correlation nonce として
  誤用していた構造的バグを修正。`run_nonce=None` でこの launch の実際の観測 nonce から
  auto-derive する経路を追加(`collect_claude_gpt_source`)。
- Finding 3: durable checkpoint persistence を追加。`_write_prior_watermark_file()`
  (atomic temp-file + os.replace)が checkpoint_advanced 時に --prior-watermark-file へ
  書き戻し、次回invocationが読み戻す。
- Finding 4: --prior-watermark-file の読み込み/parse を main() の外側から
  run_since_last_retrospective_cli() 自身の typed-failure boundary の内側へ移動。
  欠落パスは正当な first-run bootstrap として扱い、破損 JSON のみ typed failure とする。
- Finding 5: jsonschema.validate() に format_checker を渡し、schema の
  format: "date-time" 制約を実際に強制する。
- Finding 6: 既存 agent_session_manifest/v1 を window index として再利用する可能性を調査し、
  per-phase GitHub comment 経由(gh network 必須・session 粒度で未索引)である理由から
  transcript-timestamp ベースの選択を主経路として維持する判断を
  `_claude_code_session_completed_at()` のdocstringに記録した。
- Finding 7: live test (`verify_since_last_retrospective_live_cli.py`) に、実データによる
  window filtering 除外証明・claude_gpt nonce correlation 証明の2テストを追加した。

test_session_window_coverage.py に regression test を追加(55 tests、実 fixture ベース)。

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@squne121
squne121 marked this pull request as ready for review September 10, 2026 08:15
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.

P0: agent-retrospective の --since-last-retrospective で session collector 未配線を false-green にしない

1 participant