Skip to content

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

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: >-
  agent-retrospective の --since-last-retrospective 実行で、要求された runtime session evidence が
  collector 未配線・unavailable・partial なのに「retrospective 成功」「比較完了」と見なされる
  false-green を禁止し、source coverage と分析可能性を machine-readable に判定する。
change_kind: correctness
dedupe_key: "agent-retrospective:since-last:session-coverage-false-green:v1"

Parent Issue

none — 特定の delivery-rollup parent に従属しない standalone P0 correctness issue。agent-retrospective の
--since-last-retrospective 実運用確認セッション中に発見された false-green を是正する独立した bugfix であり、
## Required Design References に記載する #2192(agent-retrospective delivery parent)は設計文脈の参照のみで、
所有権上の親子関係ではない。

Parent Goal Ref

  • Goal: N/A(parent なし)
  • Desired Destination: N/A(parent scope が存在しないため、本 Issue 自体の Desired Outcome/Acceptance Criteria を正本とする)

Current Validated Scope

  • .claude/skills/agent-retrospective に session-window / --since-last-retrospective / source-coverage
    success semantics を新規実装する(write-capable。current main にはこれらの機能自体が存在しない)。
  • collector wiring validation ロジックの新規設計・実装。
  • required source と observed/selected/unavailable/partial の machine-readable coverage 表現の新規設計。
  • 詳細な write-capable path 一覧は ## Allowed Paths を正本とする。

Remaining Parent Gaps

N/A — 親 Issue が存在しないため対象外。

Outcome

--since-last-retrospective run が session source coverage 不足(collector 未配線・unavailable・partial)の
状態で selected_session_count: 0/checkpoint_advanced 等を「観測済みの 0 件」や「retrospective 完了」と
誤解釈できないよう machine-readable に区別され、focused tests・mutation test・live runtime verification が
すべて PASS している状態。

Runtime Verification Applicability

  • decision: immediate
  • reason: .claude/skills/agent-retrospective/scripts/run_retrospective.py は現在インストール済みの Claude Code
    CLI を headless subprocess として実際に起動する production コードであり、静的検証だけでは
    AC9(live runtime verification)を満たせないため(docs/dev/runtime-verification-policy.md 準拠)。
    applicable_acs: AC9
    execution_environment: 現在インストール済みの Claude Code CLI(headless claude -p --agent <name> subprocess)、ローカル repository worktree
    skip_conditions: Claude Code CLI 利用不能、gh auth 利用不能、または実行環境で GitHub network access が利用不能な場合(SKIP exit 77、docs/dev/runtime-verification-policy.md 準拠)
    fallback_policy: fixture/synthetic-only の PASS は AC9 の live proof を代替しない。取得不能な session source は unavailable として報告し、PASS へ昇格させない
    artifact_requirements: live run の stdout JSON(PublishRequest または typed failure)を PR evidence として添付する。raw transcript / credential / absolute local path は含めない

Summary

Semantic design review(Step 2.5、2026-09-10)による訂正: 以下の Observed Evidence は 2026-09-10 の
agent-retrospective 実運用確認セッション中に その場限りの working tree に対して 実装・実行されたものであり、
current main(squne121/loop-protocol)には一切 persist(commit/PR/merge)されていない。実際に rg/GitHub code
search で --since-last-retrospective / session_window / SessionWindowCoverageRegression 等を検索しても
current main には 0 件であり、run_retrospective.py の実際の argparse にも --since-last-retrospective は
存在しない(--target-issue ベースの per-issue delta モデルのみが実装済み)。

したがって本 Issue は greenfield 実装である: session watermark / --since-last-retrospective /
session-source coverage gate のいずれも current main には存在せず、本 Issue はこれらを新規に設計・実装する。
その設計の最初から、以下の false-green(process success と requested-analysis completeness の混同)を
起こさない invariant を満たすことを目標とする。

過去の(非 persist の)実運用確認では、--since-last-retrospective 相当の run 自体は成功扱いになり得た一方、
Claude Code / Claude-GPT の production session collector は配線されておらず、「session 件数・incomplete 件数を
計上できない」「permission/auto-mode 停止件数を定量化できない」状態のまま「実際の retrospective 実行が成功」
「pipeline 全体が動作」と報告され得ることが分かっている。本 Issue は、session evidence を必要とする
--since-last-retrospective(新規実装)run について、collector/source coverage を明示し、不足時に complete
と判定できないようにする correctness gate を、実装の最初から組み込む。

なお change_kind: correctness は「既存挙動の是正」ではなく、「false-green を起こし得る設計を新規機能の
実装時点から未然に防止する」という意味で用いている(本 Issue は greenfield 実装であり、is-broken な既存
挙動を修正するものではない)。既存の evidence/coverage 語彙(agent_improvement_candidate_v1.schema.json
の source_coverage、latitude_runtime_evidence_v1.schema.json の availability/reason_code)は
finding/Latitude 単位の粒度であり、本 Issue が対象とする session-window 全体の collector/source coverage
とは別の粒度である。AC1 の実装では、この既存2語彙を readback した上で、再利用可能なパターン(enum値・
indeterminate 強制ロジック・reason_code パターン)は明示的に揃えること。

Observed Evidence

この節は current main の既存挙動ではなく、2026-09-10 の non-persisted working tree での実装確認である
(Summary 参照)。false-green パターンの再現性の記録として残すが、本 Issue の実装対象は current main に存在
しない greenfield の機能である:

  • (非 persist 実装)run_retrospective.py --since-last-retrospective は exit code 0 で完走し得た。
  • (非 persist 実装)run.session_window.boundary_basis = first_run_no_prior_state 等のフィールドを返し得た。
  • checkpoint_advance_reason = no_new_sessions_selected、checkpoint_advanced = false のような値が、
    session collector 自体が未配線で計上対象が無い場合にも返り得た(「未完了sessionが0件」と証明した値では
    ないにもかかわらず)。
  • Claude Code の session JSONL と Claude-GPT の production evidence source を collector に接続しない場合、
    runtime別 session count / completion rate / interrupted rate / permission denial count は実測できない。
  • structured permission telemetry が未配線の場合、Claude-GPT friction は静的 evidence に基づく分析に留まる。
  • それでも orchestration process の exit code 0 のみをもって retrospective pipeline success と報告できて
    しまう構造的リスクがある。

raw transcript、prompt、tool I/O、credential、absolute local path は本 Issue に公開しない。

Problem

現在の成功判定では少なくとも次の3状態が区別不足である。

  1. orchestration succeeded — observer/evaluator/persistence pipeline が正常終了した。
  2. session source coverage complete — 対象 runtime の authoritative session evidence を collector が実際に観測した。
  3. requested analysis answerable — session count / completion rate / interruption / permission friction 等、ユーザーが要求した問いを evidence で回答できる。

1だけ成立して2・3が成立しない場合に最終結果を complete/success と表現できると、retrospective の主目的に対して false-green になる。

Desired Outcome

--since-last-retrospective を使う session-oriented retrospective では、各 required runtime source の coverage と requested-analysis completeness が明示され、collector 0件・必要 source unavailable・partial の run は complete と判定されない。

不足がある場合も、取得できた repository/static evidence を捨てずに degraded/partial として返してよい。ただし runtime比較を実測したかのような表現、0件と未観測の混同、checkpoint advancement による silent gap は禁止する。

In Scope

  • .claude/skills/agent-retrospective の session-window / source-coverage success semantics。
  • --since-last-retrospective 実行時の collector wiring validation。
  • required source と observed/selected/unavailable/partial の machine-readable coverage 表現。
  • selected_session_count = 0 と collector/source not observed の区別。
  • requested runtime comparison を complete と判定する gate。
  • first-run / zero-finding / zero-session 時の checkpoint disposition の明示。
  • focused tests、mutation test、live runtime verification。
  • production session source を既存 adapter/config から安全かつ決定論的に解決できる場合の最小 wiring。解決不能なら unavailable/blocked を正規状態として返し、推測・raw-path公開はしない。

Out of Scope

Acceptance Criteria

  • AC1: --since-last-retrospective run の result/envelope に、session source ごとの required | observed | unavailable | partial | not_requested を区別できる machine-readable coverage が存在する。実装前に既存の2つの evidence/coverage 取得可否語彙を readback すること: (1) agent_improvement_candidate_v1.schema.json の evaluation.source_coverage(complete|partial|unavailable|blocked の closed enum、source_coverage が partial/unavailable/blocked のとき evaluation_status を indeterminate に強制する allOf invariant 付き)、(2) latitude_runtime_evidence_v1.schema.json の availability(available|unavailable|error)+ reason_code(availability: available のとき null 強制)。本 AC のフィールドはこれら2つとは粒度が異なる(session-window 全体の collector/source 単位の coverage であり、finding 単位・Latitude 単位の evidence coverage ではない)ため新設してよいが、enum 値・reason_code パターン・indeterminate 強制ロジックのうち再利用可能な部分は明示的に揃え、意味が重なる第3の語彙を無自覚に増やさない。
  • AC2: required session source が1つも collector に配線されていない場合、selected_session_count: 0 を「0 sessions observed」として扱わない。typed configuration/coverage failure または degraded result とし、requested session analysis を complete にできない。
  • AC3: Claude Code + Claude-GPT 比較を要求した run で片方だけ unavailable/partial の場合、取得済み側の evidence は保持するが cross-runtime completion/interruption/permission comparison は unavailable または partial と判定し、数値を捏造しない。
  • AC4: 両 runtime の authoritative collector が配線され、window内に対象sessionが実際に0件の場合は、「coverage complete + selected 0」を表現できる。AC2 の未観測状態と決定論的に区別できる。
  • AC5: from_exclusive / to_inclusive / covered_sources の watermark invariant を新規実装の最初から満たし、未観測 required source を跨いで global checkpoint を進めない(SessionWindowCoverageRegression 相当の fail-closed guard を新規実装する。current main に同名の既存保護は無いため「弱化しない」ではなく「最初から満たす」ことを要求する)。
  • AC6: first-run、zero-finding、zero-session の各ケースで checkpoint_advanced / checkpoint_advance_reason / durable checkpoint の有無が明示され、次回 --since-last-retrospective がどの boundary を使うかを test で証明する。publish authorization が無いため durable checkpoint を確立できない場合は、その事実を complete checkpoint と誤報しない。
  • AC7: 「orchestration success」と「requested-analysis completeness」を最終 report で別判定にし、collector/source coverage 不足時に pipeline succeeded を retrospective completeness の根拠として使わない。
  • AC8: no-collector / one-source-unavailable / both-sources-zero / both-sources-nonzero / first-run-no-publication を focused tests で固定する。coverage gate を意図的に無効化した mutation で少なくとも1 test が red になることを確認する。
  • AC9: current installed Claude Code を用いた live verification を行い、fallback・fixture・synthetic-only の PASS を live proof に数えない。Claude-GPT production source を安全に取得できない場合は live result を unavailable とし、PASSへ昇格させない。
  • AC10: .claude/skills/agent-retrospective の全 test suite と repository-required checks が PASS する。

Verification Scenarios

A. --since-last-retrospective + required_sources={claude_code,claude_gpt} + collectors={} 
   => completeness != complete; selected=0 と報告しない

B. required={claude_code,claude_gpt}; claude_code observed; claude_gpt unavailable
   => per-source coverage retained; cross-runtime metrics unavailable/partial

C. required={claude_code,claude_gpt}; both collectors observed; both select 0 sessions
   => coverage=complete, selected_session_counts={claude_code:0,claude_gpt:0}

D. prior watermark covered both sources; current run wires one source only
   => fail closed before checkpoint advancement

E. first run with zero findings and no publish authorization
   => durable checkpoint disposition explicit; next run behavior deterministic

Verification Commands

# AC1
# AC2
# AC3
# AC4
# AC5
# AC6
# AC7
# AC8
# AC9
# AC10
$ uv run --locked pytest .claude/skills/agent-retrospective/scripts/tests/ -v
# AC10
$ pnpm typecheck
# AC10
$ pnpm lint
# AC10
$ pnpm test
# AC10
$ pnpm build

AC9 の live runtime verification は、uv run --locked python3 .../run_retrospective.py の直接呼び出しを
VC preflight allowlist(uv run pytest / uv run python3 -m pytest / 指定 CI smoke script のみ許可)へは
含めず、既存 scripts/tests/verify_latitude_runtime_evidence_live_cli.py と同じ opt-in・SKIP-based 規約
(pytest.skip()、stdout SKIP: prefix。CLI/認証/network unavailable は SKIP、予期しない失敗は FAIL、成功時は
public-safe artifact を生成して PASS)に従う新規 live-verification pytest test file
(.claude/skills/agent-retrospective/scripts/tests/ 配下)として実装する。この test file は上記の
包括的な pytest .claude/skills/agent-retrospective/scripts/tests/ -v 実行に自動的に含まれるため、
独立した VC 行は追加しない。実行不能な session source は unavailable として明示し、synthetic/fixture PASS
のみで AC9 の live proof に置き換えない。

Allowed Paths

実装前に current main を readback して最小化すること。現時点の候補:

  • .claude/skills/agent-retrospective/SKILL.md
  • .claude/skills/agent-retrospective/references/**
  • .claude/skills/agent-retrospective/schemas/**
  • .claude/skills/agent-retrospective/scripts/run_retrospective.py
  • .claude/skills/agent-retrospective/scripts/persist_retrospective_run.py
  • .claude/skills/agent-retrospective/scripts/collect_snapshot.py
  • .claude/skills/agent-retrospective/scripts/tests/**
  • scripts/claude-gpt/** は、既存 production evidence source を安全に surface するため不可欠と current-head 調査で証明された場合に限り追加する。scope expansion が必要なら先に Issue を再精緻化する。

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • raw/private session content や credential を public artifact に出す必要が生じた場合。
  • 新しい enforcing hook / permission broker / persistent control-plane が必要になった場合。
  • 実装: Claude-GPT Auto の issue-editor canonical transaction の false-deny を解消する #2433 の outcome を再実装する必要が生じた場合。
  • session source authority を推測で決める必要が生じた場合。
  • destructive git operation、secret access が必要な場合。

Required Skills

なし(issue-contract-review / implement-issue / pr-review-judge / ssot-discovery 等のワークフロー skill を除く、
本 Issue 固有のドメイン知識 skill は不要。Python / pytest / JSON Schema / Claude Code headless CLI subprocess の
既存知識のみで実装可能)。

Required Design References

Delivery Rule

  • まず /issue-refinement-loop <this issue> で current-head evidence と duplicate/overlap を再検証する。
  • ready 化後、実装は /impl-review-loop <this issue> の正式entrypointから行う。
  • 1 Issue = 1 branch/worktree = 1 Draft PR。
  • test-runner / doc-researcher / independent pr-reviewer の完了を待ち、HIGH/MEDIUM finding を解消してから Draft PR ready とする。
  • merge は人間操作。

Activity

  1. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 終了報告(Issue #2601)

    結果: approved(deterministic checker APPROVE、semantic design review 3周を経て残った finding は medium 1件のみで non-blocking)

    実施内容

    1. Step 0f preflight: 初回 STATUS: blocked(.github/ISSUE_TEMPLATE/implementation.yml が要求する Parent Issue/parent_issue 等 8 セクション欠落、disposition: human_review_required)。ユーザーに AskUserQuestion で確認し、「Parent 無し(standalone P0)」の human judgment を得た上で edit-issue controlled transaction(edit_issue_txn.py)で必要セクションを追加。再実行で STATUS: pass。
    2. Step 1 investigation(codebase-investigator): current main には session-window/watermark/--since-last-retrospective 関連の実装が一切存在しないこと(greenfield)、既存 Issue 導入: Claude-GPT運用ログの継続的レトロスペクティブと改善提案を行う agent-retrospective Skill を確立する #2192/実装: agent-retrospective に Claude Code・Claude-GPT・repository・GitHub・Web の deterministic source adapter を実装する #2236/検証: agent-retrospective のsecurity boundary・evaluation・dual-runtime smokeを統合検証する #2239/実装: Claude-GPT Auto の issue-editor canonical transaction の false-deny を解消する #2433/実装: #1939 Workstream 2 — completion transaction and reconciliation(stop reason taxonomy / runtime lane識別) #2489 との重複なし、Allowed Paths 過不足なしを確認。
    3. Step 2 review(run_root_review_pipeline.py produce): 3回実施。
      • 1回目: step_5_operator_intervention_required(VC preflight が $(...) command substitution 未対応。edit_issue_txn.py で修正)
      • 2回目: step_4(VC preflight allowlist 外の uv run python3 <script> 直接呼び出し。既存 verify_latitude_runtime_evidence_live_cli.py と同じ opt-in SKIP-based pytest パターンへ変更)
      • 3回目: step_2_5(deterministic APPROVE)
    4. Step 2.5 semantic design review(issue-design-reviewer): 3周実施。
      • 1周目: blocker「Observed Evidence が非 persist な過去セッションの記述を『既存実装』として誤って提示」→ greenfield framing へ全面書き換え
      • 2周目: high「既存の source_coverage/availability 語彙との整合検討が不足」→ AC1/Summary に既存語彙 readback・再利用指示を追加
      • 3周目: medium「AC2 の zero-collector 時の返り値形状(typed failure vs degraded result)が Desired Outcome と緊張関係」→ non-blocking warning として記録(requires_owner_choice: true、実装/レビュー時に owner 判断が必要)

    残った finding(要 owner 判断、non-blocking)

    • AC2: required source が1つも配線されていない場合の返り値形状(typed failure か degraded result か)を、実装時に明確化すること。.claude/artifacts/issue-refinement-loop/2601/4099434828944ef1/semantic_review_result.json に記録。

    Verification Commands(現時点で存在するのは repo 既存テストのみ。新規実装対象は未着手)

    $ uv run --locked pytest .claude/skills/agent-retrospective/scripts/tests/ -v
    LOOP_HANDOFF_RESULT_V1:
      status: impl_ready
      routing_action: run_impl_review_loop
      contract_review:
        status: go
        gate_result: fresh_go
        latest_comment_url: ""
        generated_at: "2026-09-10T03:58:00Z"
        body_sha256: "sha256:05df0ef2f9d3d3dd02f1546639495bae7adf7efa47847d48513250cedf92bcbc"
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: "no label mutation performed this cycle"
      auto_fixes:
        result: auto_fixed
        required:
          - kind: template_hygiene
            executor: implementation-worker
            result: applied
            evidence:
              before: "sha256:c28237063cf8aacd912679f76da10b1b72ac9bde47cc9fae74ebee8f9db32845"
              after: "sha256:05df0ef2f9d3d3dd02f1546639495bae7adf7efa47847d48513250cedf92bcbc"
              comment_url: ""
        skipped: []
      blockers: []
      permissions:
        unavailable: []
      generated_at: "2026-09-10T03:58:00Z"
      checked_body_sha256: "sha256:05df0ef2f9d3d3dd02f1546639495bae7adf7efa47847d48513250cedf92bcbc"
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []
  2. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  3. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了 (2026-09-10T04:25:55Z)

  4. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-09-10T04:45:00Z)

    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2612"
      head_sha: "9163ce33e880bb207eb2bd1f7a08965e8a768f10"
      issue_number: 2601
      termination_reason: approved
      merge_ready: false
      iteration: 2
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: impl-review-loop
      follow_up_issues: []
      note_only_observations:
        - dedupe_key: "2601:ac2-zero-collector-return-shape-ambiguity:v1"
          source_url: ".claude/artifacts/issue-refinement-loop/2601/4099434828944ef1/semantic_review_result.json"
          source_note_id: "semantic-design-review-round-3-medium-finding"
  5. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  6. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    impl-review-loop: 完了 (2026-09-10)

    IMPL_REVIEW_LOOP_RESULT_V1:
      schema_version: 1
      status: draft_pr_ready
      pr_url: "https://github.com/squne121/loop-protocol/pull/2612"
      head_sha: "07fbab2d1bcfca7961997004677e508cd54c9d85"
      issue_number: 2601
      termination_reason: approved
      merge_ready: true
      iteration: 2
    
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: impl-review-loop
      follow_up_issues: []
      note_only_observations:
        - dedupe_key: "2601:session-window-coverage-v1-schema:checkpoint-advanced-description-wording:v1"
          source_url: "https://github.com/squne121/loop-protocol/pull/2612"
          source_note_id: "pr-reviewer-non-blocking-warning-round2"
  7. squne121 commented on Sep 10, 2026

    @squne121
    OwnerAuthor

    post-merge-cleanup: 完了 (2026-09-10T09:00:00Z)

    • status: ok
    • 次アクション: なし(follow-up Issue・superseded PR・parent close 対象なし)

    PR #2612 マージ確認(merge commit c1525dad3e483a0b7bf2119965486c3330e37646)。post-merge-cleanup-worker の初回報告は
    「remote branch がまだ存在する」としていたが、gh api repos/.../branches/<branch>(404)および
    git ls-remote origin <branch>(空)で独立に再検証した結果、remote branch は既に削除済みと確認。
    worker の判定は stale だったため、正規の scripts/agent-ops/cleanup_exec.py --pr-number 2612 --linked-issue-number 2601 --worktree-path .claude/worktrees/issue-2601-agent-retrospective-since-last-retrospec --branch-name worktree-issue-2601-agent-retrospective-since-last-retrospec を実行し、
    status: ok(actions_taken: [worktree_remove, branch_delete])で local worktree・branch を削除した。

    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: post-merge-cleanup
      follow_up_issues: []
      note_only_observations:
        - dedupe_key: "2601:session-window-coverage-v1-schema:checkpoint-advanced-description-wording:v1"
          source_url: "https://github.com/squne121/loop-protocol/pull/2612"
          source_note_id: "pr-reviewer-non-blocking-warning-round2"
          summary: "session_window_coverage_v1.schema.json の checkpoint_advanced フィールド説明が、durable write 実装後もやや古い文言のまま。機能的な問題ではなく、起票不要と判断。"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions