Skip to content

実装: CI Runtime Baseline を収集し job / step 単位の所要時間を可視化する #895

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "CI 各 job / step の実測所要時間を artifact と Step Summary に残し、高速化 PR で before/after 比較できる状態にする"
change_kind: mixed

Parent Issue

none(単独改善)

Parent Goal Ref

  • Goal: CI Runtime Baseline を計測し、高速化施策の判断根拠を作る
  • Desired Destination: .github/workflows/ci.yml に計測ステップが追加され、artifact と Step Summary で job 別所要時間が可視化された状態

Current Validated Scope

  • .github/workflows/ci.yml に計測ステップを追加する
  • docs/dev/ci-performance.md を新規作成する

Remaining Parent Gaps

  • Node/pnpm/uv setup の Composite Action 化(別 Issue 化予定)
  • Playwright E2E 安定化(別 Issue 化予定)
  • CI verdict artifact v2 正規化(別 Issue 化予定)
  • S3 cache / self-hosted runner の採用判断(計測結果後)

Outcome

.github/workflows/ci.yml に主要 step の所要時間計測が追加され、ci_runtime_baseline_v1.json artifact と GitHub Step Summary に job 別所要時間が出力された状態になり、docs/dev/ci-performance.md に記録フォーマットが追加される。

In Scope

  • .github/workflows/ci.yml の主要 job(typecheck / lint / test / build / e2e / python-test / actionlint)に計測ステップを追加する
  • 計測対象: pnpm install / pnpm typecheck / pnpm lint / pnpm test / pnpm build / playwright install / test:e2e:ci / uv python install / uv sync / pytest 群
  • 各 step の elapsed seconds を記録し ci_runtime_baseline_v1.json として artifact upload する
  • $GITHUB_STEP_SUMMARY に job 別所要時間表を出力する
  • docs/dev/ci-performance.md を新規作成し、3 回分の run 記録フォーマットを定義する
  • 計測追加により既存 CI の成否条件を変えない
  • 失敗時も可能な範囲で計測結果を残す
  • date +%s%3N による ms 計測(SECONDS は使わない)
  • artifact 名の一意化(ci-runtime-baseline-${{ github.job }}-${{ github.run_attempt }})
  • command failure 時も measurement record を保持する run_timed wrapper の実装
  • $GITHUB_STEP_SUMMARY への job 別 duration table 出力(各 job 最終 summary step で 1 回 append)

Out of Scope

  • 高速化そのものは行わない
  • node_modules cache の導入はしない
  • Playwright Docker 化はしない
  • S3 cache の導入はしない
  • CI job の統廃合は行わない

Required Design Constraints

  • ci_runtime_baseline_v1.json は runtime duration evidence であり、merge-ready verdict ではない。
  • CI verdict / required-advisory-evidence 判定は 実装: CI verdict artifact を正規化し AIエージェントの CI 待機・判定を安定化する #898 の ci_verdict_summary_v2 に委譲する。
  • command の exit status を変更してはならない。
  • failure 時も、既に取得できた measurement record は artifact として upload する。
  • SECONDS は authoritative metric として使わない。date +%s%3N による ms 計測を使う。
  • artifact 名は job ごとに一意にする(例: ci-runtime-baseline-${{ github.job }}-${{ github.run_attempt }})。複数 job から同一 artifact 名へ upload しない。
  • $GITHUB_STEP_SUMMARY は各 job の最終 summary step で 1 回 append する。
  • baseline comparison 用に run_id, run_attempt, head_sha, merge_sha, job, runner image, measurement_method を必ず含める。
  • Design A(Bash wrapper 方式)を採用する。権限追加なし。date +%s%3N で ms 計測する。

Acceptance Criteria

  • AC1: ci_runtime_baseline_v1 schema が docs/dev/ci-performance.md に定義されている
  • AC2: artifact 名が job ごとに一意であり、同一 artifact 名へ複数 job が upload しない
  • AC3: 各 measurement record に run_id, run_attempt, head_sha, merge_sha, job, step_id, status, elapsed_ms が含まれる
  • AC4: command failure 時も exit status を保持し、CI failure を mask しない(run_timed wrapper または同等実装)
  • AC5: artifact upload は failure 時にも可能な範囲で実行され、if: ${{ !cancelled() }} を使う
  • AC6: $GITHUB_STEP_SUMMARY に job 別 duration table が出力され、既存 e2e visual summary を上書きしない
  • AC7: docs/dev/ci-performance.md に bootstrap 3 runs と decision baseline 20 runs / P50 / P95 の使い分けが記載されている
  • AC8: 実装: Node / pnpm / uv setup を Composite Action 化し CI YAML 重複を削減する #896 以降も比較できる stable phase id が定義されている
  • AC9: 実装: CI verdict artifact を正規化し AIエージェントの CI 待機・判定を安定化する #898 の ci_verdict_summary_v2 と責務が分離されている
  • AC10: 既存 CI の pnpm typecheck / pnpm lint / pnpm test / pnpm build が通る

Verification Commands

# AC1
# baseline-expect: fail
$ rg -c "ci_runtime_baseline_v1" docs/dev/ci-performance.md

# AC2
# baseline-expect: fail
$ rg -c "github.job" .github/workflows/ci.yml

# AC3
# baseline-expect: fail
$ rg -c "ci_runtime_baseline_v1" .github/workflows/ci.yml

# AC4
# baseline-expect: fail
$ rg -c "status=|set +e|set -e" .github/workflows/ci.yml

# AC5
# baseline-expect: fail
$ rg -c "ci-runtime-baseline" .github/workflows/ci.yml

# AC6
# baseline-expect: fail
$ rg -c "ci-runtime-baseline" .github/workflows/ci.yml

# AC7
# baseline-expect: fail
$ rg -c "P50|P95" docs/dev/ci-performance.md

# AC8
# baseline-expect: fail
$ rg -c "phase_id|step_id|pnpm_install|uv_sync" .github/workflows/ci.yml

# AC9
# baseline-expect: fail
$ rg -c "ci_verdict_summary|898" docs/dev/ci-performance.md

# AC10
# baseline-expect: pass
$ pnpm typecheck

# Runtime Verification Applicability / CI syntax smoke
# baseline-expect: pass
$ rg -c "name: Run actionlint" .github/workflows/ci.yml

Runtime Verification Applicability

decision: not_applicable

CI workflow ファイルの変更は actionlint によるシンタックス検証のみをローカルで行える。
runtime 計測結果は実際の CI run が必要なため、本 AC の完全検証は CI で実施する。

Allowed Paths

  • .github/workflows/ci.yml
  • docs/dev/ci-performance.md

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合

Required Skills

  • GitHub Actions(workflow syntax / artifact upload / step summary)
  • Bash(date +%s%3N による ms 計測、exit status 保持 wrapper)

Scope Delta(任意)

N/A

Delivery Rule

1 Issue = 1 PR。worktree を使用。Draft PR として起票し、CI 通過後に ready にする。

Activity

  1. added
    enhancement
    phase/implementation
    triage-required
    agent/implementer
    on Jun 13, 2026
  2. squne121 commented on Jun 14, 2026

    @squne121
    OwnerAuthor

    結論

    判定: このまま実装に渡すのは NG。Issue 本文をリファインしてから着手すべきです。

    #895 の方向性自体は妥当です。CI 高速化の前に runtime baseline を取り、artifact と Step Summary に残すという目的は #894 の CI 運用設計とも整合します。#895 は typecheck / lint / test / build / e2e / python-test / actionlint を対象に、ci_runtime_baseline_v1.json と $GITHUB_STEP_SUMMARY へ所要時間を残す契約です。 コメントは現時点で 0 件です。

    ただし、現契約は artifact の衝突、失敗時欠損、比較不能な timing、#898 との責務混線 を起こしやすいです。


    関連 Issue / PR から見た位置づけ

    #895 は単独改善扱いですが、実質的には CI 改善系列の先頭です。#896 は Node/pnpm/uv setup の Composite Action 化で、本文中でも「#895 が先行」とされています。つまり #895 の計測ラベルは、#896 実施後も before/after 比較できる stable phase 名で設計する必要があります。

    #894 / PR #902 はすでに完了済みで、docs/dev/ci-operations.md に CI job taxonomy、agent merge-ready、artifact evidence、S3/external cache 判断基準を定義しています。#895 はこの方針を継承すべきです。 とくに #894 文書は、CI 高速化を baseline measurement → setup 重複削減 → E2E 安定化 → cache 拡張 の順に進め、S3/external cache は N=20 run の P50/P95 などを満たすまで採用しないと定義しています。

    #898 は ci_verdict_summary_v2 を扱う別 Issue で、required/advisory/evidence、head SHA、pending/skipped/cancelled などの判定 schema を定義します。#895 は runtime baseline だけを扱い、merge-ready 判定や CI verdict schema を侵食しない設計に分離すべきです。


    Blocking / High severity

    1. ci_runtime_baseline_v1.json の artifact topology が未定義

    #895 は ci_runtime_baseline_v1.json artifact を upload するとしていますが、artifact 名なのかファイル名なのか、job ごとに分けるのか、最終集約するのかが未定義です。

    これは危険です。actions/upload-artifact v4+ 系では artifact は immutable で、複数 job から同じ artifact 名へ追加 upload する運用はサポートされず、matrix/job ごとに一意名が必要です。if-no-files-found も warn/error/ignore を明示できます。([GitHub]1)

    修正案:

    • ファイル名: ci_runtime_baseline_v1.json
    • artifact 名: ci-runtime-baseline-${{ github.job }}-${{ github.run_attempt }}
    • あるいは runtime-baseline 集約 job を追加し、各 job の artifact を download → 1 つの ci-runtime-baseline artifact に再 upload

    最低限、Issue 本文に次を追加すべきです。

    - `ci_runtime_baseline_v1.json` はファイル名であり、artifact 名は job ごとに一意にする。
    - 複数 job から同一 artifact 名へ upload しない。
    - artifact 名には `${{ github.job }}` と `${{ github.run_attempt }}` を含める。

    2. $GITHUB_STEP_SUMMARY の扱いが甘い

    GitHub の job summary は $GITHUB_STEP_SUMMARY に Markdown を追記しますが、このファイルは step ごとに unique で、step 完了後に後続 step から前 step の summary は編集できません。さらに 1 step あたり 1 MiB 制限があります。([GitHub Docs]2)

    現行 e2e job はこの制約を理解しており、artifact upload 後に summary step を置く理由をコメントで明記しています。 #895 でも同じく、各 command step が個別に summary を書き散らすのではなく、最後に 1 回だけ runtime baseline summary を append する構造にすべきです。

    3. Bash SECONDS は baseline 指標として弱い

    #895 の Required Skills は Bash SECONDS を前提にしていますが、Bash manual 上 SECONDS は shell 起動からの秒数で、解像度は秒単位です。代入で reset できる一方、短い step は 0 秒になり得ます。([GNU]3)

    GitHub Actions の run step はそれぞれ別 shell として実行されるため、SECONDS を複数 step にまたがる信頼できる accumulator として使う設計は不適です。現行 workflow も pnpm install, pnpm typecheck, pnpm lint などが独立した run step です。

    推奨: SECONDS ではなく、少なくとも date +%s%3N による millisecond 計測、または GitHub REST API の workflow jobs / steps の started_at / completed_at を使うべきです。GitHub REST API は workflow job とその step 群の started_at / completed_at を返します。([GitHub Docs]4)

    4. 失敗時に計測 artifact が欠損しやすい

    #895 は「失敗時も可能な範囲で計測結果を残す」としています。 しかし naive に、

    SECONDS=0
    pnpm lint
    echo "$SECONDS"

    のように書くと、pnpm lint が失敗した時点で後続記録が実行されない可能性があります。逆に pnpm lint || true にすると CI 失敗を隠します。

    必要なのは、exit status を保存して、計測 record を書いてから、元の status で exit する wrapper です。

    run_timed() {
      local step_id="$1"
      shift
    
      local start_ms end_ms status
      start_ms="$(date +%s%3N)"
    
      set +e
      "$@"
      status=$?
      set -e
    
      end_ms="$(date +%s%3N)"
    
      # JSONL などに append。ここで command/status/elapsed_ms を保存する。
      printf '{"step_id":"%s","status":%s,"elapsed_ms":%s}\n' \
        "$step_id" "$status" "$((end_ms - start_ms))" >> ci-runtime-baseline.jsonl
    
      return "$status"
    }

    artifact upload は既存 e2e と同様、if: ${{ !cancelled() }} を基本にすべきです。現行 workflow も Playwright report / test-results を !cancelled() で upload しています。

    5. REST API 集約方式を検討していない

    高品質化するなら、各 step を Bash wrapper で包むより、最終 job で GitHub Actions の jobs API から実測 step duration を取る設計の方が保守性は高いです。API は workflow run attempt ごとの jobs と steps を返せます。([GitHub Docs]4)

    ただし現行 workflow の permissions は contents: read のみです。 API 集約方式で GITHUB_TOKEN を使うなら actions: read が必要になる可能性があり、#895 の Stop Conditions にある「権限昇格」に該当し得ます。したがって Issue 本文で次のどちらを採るか明示してください。

    • Design A: Bash wrapper 方式。権限追加なし。ただし YAML churn が大きく、uses: action の duration は取りにくい。
    • Design B: REST API collector job 方式。step duration を包括的に取れるが、actions: read permission の要否を明記し、権限変更をレビュー対象にする。

    私は Design B を第一候補にします。ただし権限変更を嫌うなら Design A で MVP 化すべきです。


    Issue 本文への改善草案

    追加すべき Required Design Constraints

    ## Required Design Constraints
    
    - `ci_runtime_baseline_v1.json` は runtime duration evidence であり、merge-ready verdict ではない。
    - CI verdict / required-advisory-evidence 判定は #898 の `ci_verdict_summary_v2` に委譲する。
    - command の exit status を変更してはならない。
    - failure 時も、既に取得できた measurement record は artifact として upload する。
    - `SECONDS` は authoritative metric として使わない。使う場合も coarse fallback として明記する。
    - artifact 名は job ごとに一意にする。複数 job から同一 artifact 名へ upload しない。
    - `$GITHUB_STEP_SUMMARY` は各 job の最終 summary step、または aggregator job の単一 summary step で append する。
    - baseline comparison 用に `run_id`, `run_attempt`, `head_sha`, `merge_sha`, `job`, `runner image`, `measurement_method` を必ず含める。

    ci_runtime_baseline_v1 schema 案

    {
      "schema_version": "ci_runtime_baseline_v1",
      "workflow": "ci",
      "run_id": 123456789,
      "run_attempt": 1,
      "event_name": "pull_request",
      "head_sha": "PR head SHA",
      "merge_sha": "workflow checkout SHA",
      "job": "typecheck",
      "measurement_method": "wrapper_ms",
      "runner": {
        "os": "Linux",
        "arch": "X64",
        "image_os": "ubuntu24",
        "image_version": "unknown"
      },
      "records": [
        {
          "step_id": "pnpm_install",
          "label": "pnpm install --frozen-lockfile",
          "command": "pnpm install --frozen-lockfile",
          "status": 0,
          "conclusion": "success",
          "started_at": "2026-06-14T00:00:00Z",
          "completed_at": "2026-06-14T00:00:12Z",
          "elapsed_ms": 12000
        }
      ]
    }

    docs/dev/ci-performance.md に必要な内容

    #895 は「3 回分の run 記録フォーマット」としていますが、#894 側では S3/external cache 判断に N=20 run の P50/P95 を要求しています。 したがって文書は次の 2 段階に分けるべきです。

    ## Baseline Recording Policy
    
    - Bootstrap baseline: 3 CI runs
    - Decision baseline: 20 CI runs
    - Required statistics:
      - job duration P50 / P95
      - setup/install duration P50 / P95
      - e2e duration P50 / P95
      - cache-sensitive phases: pnpm install, playwright install, uv sync
    - Do not compare runs with different event type, runner image, or head SHA class without marking them separately.

    修正後 Acceptance Criteria 案

    現在の AC は rg -c "elapsed|SECONDS|baseline" のような文字列検査が中心で、実効性が弱いです。次に置き換えるべきです。

    - [ ] AC1: `ci_runtime_baseline_v1` schema が `docs/dev/ci-performance.md` に定義されている
    - [ ] AC2: artifact 名が job ごとに一意であり、同一 artifact 名へ複数 job が upload しない
    - [ ] AC3: 各 measurement record に `run_id`, `run_attempt`, `head_sha`, `merge_sha`, `job`, `step_id`, `status`, `elapsed_ms` が含まれる
    - [ ] AC4: command failure 時も exit status を保持し、CI failure を mask しない
    - [ ] AC5: artifact upload は failure 時にも可能な範囲で実行され、cancelled run は既存方針どおり扱う
    - [ ] AC6: `$GITHUB_STEP_SUMMARY` には job 別 duration table が出力され、既存 e2e visual summary を上書きしない
    - [ ] AC7: `docs/dev/ci-performance.md` に bootstrap 3 runs と decision baseline 20 runs / P50 / P95 の使い分けが記載されている
    - [ ] AC8: #896 以降も比較できる stable phase id が定義されている
    - [ ] AC9: #898 の `ci_verdict_summary_v2` と責務が分離されている
    - [ ] AC10: `actionlint .github/workflows/ci.yml` が通る

    最終レビュー判定

    実装着手前に Issue #895 を修正してください。

    最小修正で済ませるなら、artifact 名一意化、exit status 保持、SECONDS 非依存、schema 明文化、#894/#898 との責務分界だけは必須です。より高品質にするなら、REST API collector job 方式を採用し、GitHub Actions の実 step duration をそのまま baseline artifact 化する設計に寄せるのがよいです。

  3. squne121 commented on Jun 14, 2026

    @squne121
    OwnerAuthor

    Refinement Loop: Human Escalation Required

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

    Blockers

    "VCP_UNKNOWN (AC1/AC7/AC9): docs/dev/ci-performance.md は新規作成対象のため baseline 未存在 → rg exit2 が human_judgment に分類される(実装 Issue で新規ファイルを対象とする VC の既知パターン)"
    
    "VCP_REGRESSION_GATE (AC10): pnpm typecheck # baseline-expect: pass が exit 1 で失敗 → pnpm typecheck の現状確認または inline baseline-expect アノテーション形式の確認が必要"
    
    "VCP_UNEXPECTED_PASS: rg -c \"name: Run actionlint\" .github/workflows/ci.yml が baseline でパス → # baseline-expect: pass アノテーションが必要"
    
  4. squne121 commented on Jun 14, 2026

    @squne121
    OwnerAuthor

    ▐▛███▜▌ Claude Code v2.1.177
    ▝▜█████▛▘ Sonnet 4.6 with medium effort · Claude Max
    ▘▘ ▝▝ ~/projects/LOOP_PROTOCOL

    ❯ /clear

    ❯ #895 (comment)
    を対象に issue-refinement-loop を人間承認不要で行って。

    ● Skill(issue-refinement-loop)
    ⎿  Successfully loaded skill

    ● Issue #895 の refinement loop を開始します。まず preflight スクリプトを実行します。

    ● Bash(uv run python3
    .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py
    --issue-number 895 \…)
    ⎿  Error: Exit code 1
    STATUS: warn
    NEXT_ACTION: proceed_with_notes
    MUST_READ:
    - .github/workflows/ci.yml
    - docs/dev/ci-performance.md
    COMMANDS:
    - [run_preflight] uv run python3
    .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py --issue-number
    895 --repo squne121/loop-protocol
    ARTIFACT:
    planner_input: /home/squne/projects/LOOP_PROTOCOL/.claude/artifacts/issue-refinement-
    loop/895/planner_input.json
    … +2 lines (ctrl+o to expand)

    ● warn で proceed_with_notes。preflight 結果と planner 入力を確認します。

    Read 1 file (ctrl+o to expand)

    ● Bash(uv run python3 -c "
    import json…)
    ⎿  {
    "schema_version": "refinement_preflight_result/v1",
    "status": "warn",
    … +39 lines (ctrl+o to expand)

    ● Bash(uv run python3 -c "
    import json…)
    ⎿  {
    "schema_version": "refinement_loop_planner_input/v1",
    "issue": {
    … +198 lines (ctrl+o to expand)

    ● anchor comment の内容を確認。planner decisions を確認します。

    ● Bash(ls /home/squne/projects/LOOP_PROTOCOL/.claude/artifacts/issue-refinement-loop/895/
    2>&1 &&
    uv run python3 -c "…)
    ⎿  planner_input.json
    raw_issue_snapshot.json
    refinement_preflight_result_v1.json
    … +2 lines (ctrl+o to expand)

    ● Bash(uv run python3 -c "
    import json…)
    ⎿  {
    "schema": "repair_issue_contract/v1",
    "dry_run": true,
    … +7 lines (ctrl+o to expand)

    ● Bash(uv run python3 .claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.py
    --input /home/squne/projects/LOOP_PROTOCOL/.claude/artifacts/issue-refin…)
    ⎿  Error: Exit code 2
    {
    "schema_version": "refinement_loop_plan/v1",
    "source": {
    "issue_number": null,
    "issue_body_sha256": null,
    "comments_sha256": null,
    "known_context_sha256": null,
    "generated_at": "2026-06-14T01:04:35.476791+00:00"
    },
    … +39 lines (ctrl+o to expand)

    ● Bash(uv run python3 .claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.py
    --help 2>&1 | head -30)
    ⎿  {
    "schema_version": "refinement_loop_plan/v1",
    "source": {
    … +27 lines (ctrl+o to expand)

    ● Bash(uv run python3 .claude/skills/issue-refinement-loop/scripts/plan_refinement_loop.py
    < /home/squne/projects/LOOP_PROTOCOL/.claude/artifacts/issue-refinement-…)
    ⎿  {
    "schema_version": "refinement_loop_plan/v1",
    "source": {
    … +70 lines (ctrl+o to expand)

    ● scope_signal_guard が triggered。参照を確認します。

    Read 2 files (ctrl+o to expand)

    ● Bash(uv run python3 -c "
    with open('.claude/skills/issue-refinement-loop/references/scope-signal-guard.md') as
    f:…)
    ⎿  # Scope Signal Guard

     ## Planner boundary
     … +40 lines (ctrl+o to expand)
    

    ● investigation_policy.required = true。.github/workflows/ci.yml を調査します。

    ● Bash(uv run python3 -c "
    with open('.github/workflows/ci.yml') as f:…)
    ⎿  name: ci

     on:
     … +324 lines (ctrl+o to expand)
    

    ● 調査完了。docs/dev/ci-performance.md は未存在、ci.yml の現状を把握。Step 2: Review
    を実行します。

    ● issue-reviewer(Step 2: Review issue #895)
    ⎿  Done (12 tool uses · 32.2k tokens · 1m 14s)
    (ctrl+o to expand)

    ● needs-fix (4 ブロッカー)。Step 4: Rewrite に進みます。まず pre-author static readiness
    check を実行します。

    ● Bash(gh issue view 895 --repo squne121/loop-protocol --json body -q .body >
    /tmp/issue_895_body.md 2>&1 && echo "OK: $(wc -c < /tmp/issue_895_body.md) bytes")
    ⎿  OK: 4161 bytes

    ● Bash(uv run python3
    .claude/skills/issue-contract-review/scripts/contract_readiness_check.py
    --mode preflight-static \…)
    ⎿  {
    "schema": "ISSUE_CONTRACT_READINESS_RESULT_V1",
    "status": "go",
    … +15 lines (ctrl+o to expand)

    ● readiness check は go (exit 0)。issue-author SubAgent を起動します。

    ● issue-author(Step 4: Rewrite issue #895 body)
    … +15 lines (ctrl+o to expand)

    ● readiness check は go (exit 0)。issue-author SubAgent を起動します。

    ● issue-author(Step 4: Rewrite issue #895 body)
    ⎿  Done (49 tool uses · 50.5k tokens · 6m 23s)
    (ctrl+o to expand)

    ● 本文更新成功(STATUS: ok)。Step 2 (Review) 2 回目を実行します。

    ⎿  {
    "schema": "ISSUE_CONTRACT_READINESS_RESULT_V1",
    "status": "go",
    … +15 lines (ctrl+o to expand)

    ● readiness check は go (exit 0)。issue-author SubAgent を起動します。

    ● issue-author(Step 4: Rewrite issue #895 body)
    ⎿  Done (49 tool uses · 50.5k tokens · 6m 23s)
    (ctrl+o to expand)

    ● 本文更新成功(STATUS: ok)。Step 2 (Review) 2 回目を実行します。

    ● issue-reviewer(Step 2 iteration 2: Review issue #895 after rewrite)
    ⎿  Done (9 tool uses · 31.5k tokens · 1m 2s)
    (ctrl+o to expand)

    ● まだ needs-fix(残り 1 ブロッカー)。Step 4 iteration 2: Rewrite で残件を修正します。

    ● Bash(gh issue view 895 --repo squne121/loop-protocol --json body -q .body 2>&1)
    ⎿  ## Machine-Readable Contract

     ```yaml
     … +149 lines (ctrl+o to expand)
    

    ● 現在の本文を確認。3 つの修正が必要です:

    1. Runtime Verification Applicability に decision: not_applicable フィールド追加

    2. AC1/AC7 の && 複合コマンド分離
    3. AC3/AC5/AC6/AC10 の # baseline-expect: pass アノテーションまたは VC 修正

    issue-author で残件を修正します。

    ● issue-author(Step 4 iteration 2: Fix remaining VC issues in issue #895)
    ⎿  Done (31 tool uses · 36.8k tokens · 3m 7s)
    (ctrl+o to expand)

    ● iteration 2 の rewrite 完了。Step 2 (Review) iteration 3 を実行します。

    ● issue-reviewer(Step 2 iteration 3: Final review of issue #895)
    ⎿  Done (10 tool uses · 31.2k tokens · 1m 12s)
    (ctrl+o to expand)

    ● iteration 3 で needs-fix かつ human_judgment_required、iteration 上限(3/3)に到達。Step 5:
    Termination (human_escalation) に進みます。

    ● Bash(uv run python3 -c "
    import json, sys…)
    ⎿  [publish_termination_report] comment posted for issue #895

    ● Bash(gh issue view 895 --repo squne121/loop-protocol --json url -q .url 2>&1)
    ⎿  #895

    ● refinement loop が完了しました。

    結果サマリー:

    • 反復回数: 3 回(anchor comment → review1 → rewrite1 → review2 → rewrite2 → review3 →
      上限到達)
    • 主な改善内容(適用済み):
      • Required Design Constraints セクション追加(artifact 名一意化、SECONDS 非推奨・date
        +%s%3N 採用、failure 時 exit status 保持、Design A 採用など)
      • AC セット全面刷新(AC1–AC10、anchor comment 改善案を反映)
      • VC 修正(regex \| → |、&& 複合コマンド除去、baseline-expect アノテーション、allowlist
        外 actionlint コマンド除去)
      • Runtime Verification Applicability: decision: not_applicable 追加
      • Required Skills / In Scope 更新
    • human_escalation 理由(残り 3 件):
      a. AC1/AC7/AC9 の VC が新規作成対象の docs/dev/ci-performance.md
      を参照しており、baseline で rg exit 2 → human_judgment 分類(新規ファイル VC
      の既知パターン)
      b. AC10 pnpm typecheck が baseline で exit 1(現状の typecheck 状態確認、または inline #
      baseline-expect: pass アノテーション形式の確認が必要)
      c. actionlint VC が baseline でパス → # baseline-expect: pass アノテーション追加が必要

    詳細は #895 のコメントを参照してください。

    ✻ Cooked for 19m 57s · 1 shell still running

    ※ recap: Issue #895(CI runtime baseline 計測)の refinement loop が完了し、anchor comment
    の改善案を Issue 本文に反映済み。残り 3 件の VC 判定問題を人間が確認してください。
    (disable recaps in /config)

    ❯ 結論: まだ実装に入れない方がよいです。
    ただし、#895 の仕様本体はほぼ実装可能です。止まっている主因は、Issue の要求仕様ではなく
    Verification Commands / refinement-loop 側の baseline 判定設計です。

    判定

    #895 は現在、CI runtime baseline を .github/workflows/ci.yml と
    docs/dev/ci-performance.md で実装する契約になっており、対象 job、artifact、Step
    Summary、失敗時保持、date +%s%3N、#898
    との責務分離まで明記されています。ここは実装仕様として概ね妥当です。

    ただし、最終コメントでは loop が human_escalation で停止しており、残件は次の 3
    件です。特に docs/dev/ci-performance.md は新規作成対象なので baseline
    では存在せず、rg が exit 2 になって human judgment に分類されています。

    #895 の現在の docs/dev/ci-performance.md は実際に未存在です。
    一方で、.github/workflows/ci.yml には Run actionlint が既に存在するため、rg -c "name: Run actionlint" は baseline で通ります。これを baseline-expect: pass
    と明示していないことが VCP_UNEXPECTED_PASS の原因です。

    なぜ修正が完了しなかったか

    主因は 3 つです。

    1. 新規ファイル対象 VC に baseline-expect: fail が付いていない
      docs/dev/ci-performance.md は 実装: CI Runtime Baseline を収集し job / step 単位の所要時間を可視化する #895 の成果物として新規作成するファイルです。baseline
      で存在しないのは正常ですが、現在の loop は rg docs/dev/ci-performance.md の exit 2
      を「期待された fail」ではなく human judgment に倒しています。

    2. baseline-expect の書き方が間違っている
      実装: CI Runtime Baseline を収集し job / step 単位の所要時間を可視化する #895 の AC10 は $ pnpm typecheck # baseline-expect: pass のような inline
      注釈になっていますが、現行 parser は baseline-expect
      を「コマンド直前のコメント行」から読む設計です。実装では直前行から annotation
      を抽出しています。
      つまり正しくは次です。

      # baseline-expect: pass
      $ pnpm typecheck
    3. 既存 pass の VC と実装差分 VC の分類が混ざっている
      pnpm typecheck や Run actionlint の存在確認は baseline で通ってよい regression
      check です。一方、ci_runtime_baseline_v1 や docs/dev/ci-performance.md の検索は
      baseline では fail すべき implementation delta check です。この区別を全 VC
      に明示しないと、loop が unexpected_pass / human_judgment を再発します。実装: baseline-expect VC annotation と deterministic repair pass で issue-refinement-loop 反復失敗を防ぐ #889 はこの問題を
      baseline-expect: pass|fail|deferred で解く親 Issue ですが、実装: CI Runtime Baseline を収集し job / step 単位の所要時間を可視化する #895
      側の本文にはまだ十分反映されていません。

    #895 の最小修正

    #895 の Verification Commands は、最低限こう直すべきです。

    # AC1
    # baseline-expect: fail
    $ rg -c "ci_runtime_baseline_v1" docs/dev/ci-performance.md
    
    # AC2
    # baseline-expect: fail
    $ rg -c "github.job" .github/workflows/ci.yml
    
    # AC3
    # baseline-expect: fail
    $ rg -c "ci_runtime_baseline_v1" .github/workflows/ci.yml
    
    # AC4
    # baseline-expect: fail
    $ rg -c "status=|set +e|set -e" .github/workflows/ci.yml
    
    # AC5
    # baseline-expect: fail
    $ rg -c "ci-runtime-baseline" .github/workflows/ci.yml
    
    # AC6
    # baseline-expect: fail
    $ rg -c "ci-runtime-baseline" .github/workflows/ci.yml
    
    # AC7
    # baseline-expect: fail
    $ rg -c "P50|P95" docs/dev/ci-performance.md
    
    # AC8
    # baseline-expect: fail
    $ rg -c "phase_id|step_id|pnpm_install|uv_sync" .github/workflows/ci.yml
    
    # AC9
    # baseline-expect: fail
    $ rg -c "ci_verdict_summary|898" docs/dev/ci-performance.md
    
    # AC10
    # baseline-expect: pass
    $ pnpm typecheck
    
    # Runtime Verification Applicability / CI syntax smoke
    # baseline-expect: pass
    $ rg -c "name: Run actionlint" .github/workflows/ci.yml

    加えて、#895 本文中の AC3 は merge_sha も含めるべきです。Required Design Constraints
    では merge_sha 必須と書いていますが、AC3
    には入っていません。ここは実装者が落としやすいです。

    関連 Issue 側の問題

    既存の改善 Issue 群を見ると、#900 は LLM rewrite 回数制限、#901 は annotation test の CI
    gate 化です。どちらも今回の根本対策に近いです。

    ただし #899 はタイトルと本文が食い違っています。タイトルは baseline_vc_preflight.py に --strict フラグを追加... ですが、本文は #900 と同じ LLM rewrite
    回数制限の内容になっています。これは改善 Issue として壊れています。

    改善 Issue 草案

    新規 Issue でもよいですが、最短は #899 の本文をこの内容に差し替えることです。

    実装: baseline_vc_preflight.py に --strict フラグと annotation

    正規化を追加し、新規ファイル VC の human_escalation を防ぐ

    Machine-Readable Contract

    contract_schema_version: v1
    issue_kind: implementation
    parent_issue: "889"
    goal_ref: "baseline-expect annotation の欠落・inline 誤記・新規ファイル対象 VC により
    issue-refinement-loop が human_escalation で停止する問題を防ぐ"
    change_kind: behavior
    dedupe_key: "follow-up:squne121/loop-protocol:issue-refinement-loop:baseline-expect-stric
    t-normalizer"

    Parent Issue

    Background

    #895 の issue-refinement-loop で、Issue 本文の大部分は修正されたが、最終的に
    human_escalation で停止した。

    主な原因は以下。

    1. 新規作成対象ファイル docs/dev/ci-performance.md を参照する VC が baseline で file
      not found / rg exit 2 となり、期待された implementation delta ではなく human_judgment
      に分類された。
    2. pnpm typecheck # baseline-expect: pass のような inline annotation が使われ、parser
      が baseline-expect として認識できなかった。
    3. baseline で pass してよい regression VC と、baseline で fail すべき implementation
      delta VC の型付けが Issue 本文に不足していた。
    4. annotation 欠落や誤記が reviewer / author の LLM rewrite に委譲され、反復を消費した。

    Outcome

    baseline_vc_preflight.py / contract_readiness_check.py / repair_issue_contract.py
    が、baseline-expect annotation の欠落・inline 誤記・新規ファイル VC を deterministic
    に検出または修復し、#895 型の Issue が不要に human_escalation しない状態になる。

    In Scope

    • baseline_vc_preflight.py に --strict フラグを追加する

      • annotation 欠落 VC を warning ではなく needs_fix にできる
      • strict 無効時は後方互換として warning のみ
    • inline # baseline-expect: pass|fail|deferred を検出し、needs_fix として修正指示を出す

      • 自動で「直前行 annotation」に正規化できる場合は repair 対象にする
    • 新規作成対象 Allowed Path を参照する rg / test -f VC に対し、baseline-expect: fail が欠落している場合は needs_fix にする

    • repair_issue_contract.py が以下を deterministic repair する

      • $ pnpm typecheck # baseline-expect: pass → 直前行 # baseline-expect: pass
      • 新規ファイル対象 VC に # baseline-expect: fail を付与
      • baseline で既存 pass する regression gate に # baseline-expect: pass を付与
    • contract_readiness_check.py が strict mode の結果を structured feedback として返す

    • pytest を追加し、実装: CI Runtime Baseline を収集し job / step 単位の所要時間を可視化する #895 型 fixture で regression を固定する

    Out of Scope

    Acceptance Criteria

    • AC1: baseline_vc_preflight.py に --strict が追加されている
    • AC2: inline # baseline-expect: pass|fail|deferred が invalid annotation placement
      として検出される
    • AC3: repair_issue_contract.py が inline baseline-expect を直前行 annotation
      に正規化できる
    • AC4: 新規 Allowed Path を対象にする VC で baseline-expect: fail 欠落を検出できる
    • AC5: 実装: CI Runtime Baseline を収集し job / step 単位の所要時間を可視化する #895 型 fixture で docs/dev/ci-performance.md の baseline 未存在が
      human_judgment ではなく body-author-fixable needs_fix になる
    • AC6: regression gate の pnpm typecheck は直前行 # baseline-expect: pass で
      expected_pass / go になる
    • AC7: Run actionlint のような既存 pass VC は直前行 # baseline-expect: pass で
      expected_pass / go になる
    • AC8: annotation 欠落を strict mode で needs_fix にできる
    • AC9: 既存の non-strict behavior は後方互換を維持する
    • AC10: 関連 pytest が CI の python-test で通る

    Verification Commands

    # AC1
    $ rg -n "strict" .claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py
    
    # AC2
    $ rg -n "inline.*baseline-expect|invalid.*baseline-expect"
    .claude/skills/issue-contract-review/scripts/
    
    # AC3
    $ rg -n "baseline-expect"
    .claude/skills/issue-refinement-loop/scripts/repair_issue_contract.py
    
    # AC4
    $ rg -n "new.*file|Allowed Paths|baseline-expect.*fail"
    .claude/skills/issue-contract-review/scripts/
    
    # AC5-AC9
    # preflight-scope: pr_review_only
    $ uv run pytest
    .claude/skills/issue-contract-review/scripts/tests/test_baseline_vc_preflight.py
    .claude/skills/issue-contract-review/scripts/tests/test_contract_readiness.py
    .claude/skills/issue-refinement-loop/scripts/tests/test_repair_issue_contract.py -q
    
    # AC10
    $ pnpm typecheck
    $ pnpm lint
    $ pnpm test
    $ pnpm build

    decision: not_applicable
    reason: "refinement-loop / issue-contract-review の静的検証・pytest 対象。ゲーム runtime
    動作には影響しない。"

    
    ## Allowed Paths
    
    * `.claude/skills/issue-contract-review/scripts/baseline_vc_preflight.py`
    * `.claude/skills/issue-contract-review/scripts/contract_readiness_check.py`
    * `.claude/skills/issue-contract-review/scripts/vc_contract_syntax.py`
    * `.claude/skills/issue-contract-review/scripts/tests/`
    * `.claude/skills/issue-refinement-loop/scripts/repair_issue_contract.py`
    * `.claude/skills/issue-refinement-loop/scripts/tests/`
    * `docs/dev/dor.md`
    
    ## Stop Conditions
    
    * baseline-expect grammar の破壊的変更が必要になった場合
    * #900 の rewrite history 実装が必要になった場合
    * #901 の CI required gate 化まで同時実装が必要になった場合
    
    * baseline-expect grammar の破壊的変更が必要になった場合
    * #900 の rewrite history 実装が必要になった場合
    * #901 の CI required gate 化まで同時実装が必要になった場合
    * GitHub branch protection 設定変更が必要になった場合
    
    * #901 の CI required gate 化まで同時実装が必要になった場合
    * GitHub branch protection 設定変更が必要になった場合
    
    ## Delivery Rule
    
    1 Issue = 1 PR。Draft PR として作成し、CI green 後に ready にする。
    
    ## 次アクション
    
    最短ルートは、**#895 本文の Verification Commands を上記の annotation
    形式に修正してから実装着手**です。
    その後、#899 は現在の title/body mismatch を直すか、この草案で差し替えるのがよいです。
    
    
    ● 明確な分析です。2 つ並行で対応します: #895 の VC 修正と #899 の確認。
    
    ● Bash(gh issue view 899 --repo squne121/loop-protocol --json title,body -q
        '"\(.title)\n---\n\(.body)"' 2>&1 | head -60)
    ⎿  実装: baseline_vc_preflight.py に --strict フラグを追加し annotation 欠落 VC
       を強制
        needs_fix にする
       ---
       … +57 lines (ctrl+o to expand)
    
    ● #899 の body は LLM rewrite 制限(#900 相当)で title(--strict
    フラグ)と不一致を確認。並行で対応します。
    
    ● issue-author(Fix issue #895 VC baseline-expect annotations)
    ⎿  Done (53 tool uses · 34.5k tokens · 3m 56s)
    (ctrl+o to expand)
    
    ● #895 修正完了。次に #899 の body を差し替えます。
    
    ● Bash(gh issue view 900 --repo squne121/loop-protocol --json title,body -q '.title' 2>&1)
    ⎿  実装: refinement-loop の LLM rewrite 最大 1 回制限と同一 category 再発時 human_esc
       alation を実装する
    
    ● #900 が LLM rewrite 制限を担当している。#899 の body を差し替えます。
    
    Read 1 file (ctrl+o to expand)
    
    ● Bash(gh issue edit 899 \
          --repo squne121/loop-protocol \…)
    ⎿  https://github.com/squne121/loop-protocol/issues/899
       OK
    
    ● 両件完了しました。
    
    #895 https://github.com/squne121/loop-protocol/issues/895
    - VC を全面修正: baseline-expect annotation をコマンド直前のコメント行形式に統一
    - AC1〜AC9 に # baseline-expect: fail、AC10 と actionlint VC に # baseline-expect: pass
    を追加
    - AC3 に merge_sha フィールドを追記
    - これで次回 issue-contract-review を通す準備が整った
    
    #899 https://github.com/squne121/loop-protocol/issues/899
    - title(--strict フラグ追加)と一致する body に差し替え
    - 旧 body の LLM rewrite 制限内容は #900 が担当するため #899 から除去
    - 新 body: baseline_vc_preflight.py / repair_issue_contract.py での annotation
    欠落・inline 誤記・新規ファイル VC 対応を対象とする実装 Issue に整理
    
    ✻ Cogitated for 5m 52s · 1 shell still running
    
  5. added 3 commits that reference this issue on Jun 14, 2026
  6. added 5 commits that reference this issue on Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/implementerenhancementphase/implementationtriage-required

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions