Skip to content

実装: claude-gpt adapter の runtime smoke が launcher の解決した underlying Claude Code binary の version を runtime_version に記録するようにする #2954

Open

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "claude-gpt adapter の runtime smoke が、launcher の既存 resolver が選んだ underlying Claude Code binary の version を summary の runtime_version に結び付けて記録する"
change_kind: code
dedupe_key: "runtime-smoke:claude-gpt-adapter-runtime-version-binding:launcher-wrapper-version-none:v1"

Parent Issue

なし(単独改善)

Parent Goal Ref

  • Goal: claude-gpt adapter の runtime smoke evidence が、実際に選択された underlying Claude Code の version を記録し、runtime_only AC の「Claude Code X.Y.Z で検証した」という主張を別コマンドの偶然の一致に頼らず summary だけで追えるようにする。
  • Desired Destination: N/A(単独改善 Issue)。

Current Validated Scope

2026-10-06 に current main dfc297248e08e8e30ef30c5c718b9ae80bb57db7 の source と実機で確認した事実だけを write-capable scope の根拠とする。

Remaining Parent Gaps

Outcome

scripts/agent-ops/run_worktree_agent_runtime_smoke.py が、--claude-adapter claude-gpt で --claude-bin が launcher を指す場合に、launcher の既存の --dry-run JSON(launch_env.CLAUDE_GPT_CLAUDE_BIN)が示す underlying executable に対して --version を実行し、その出力を summary の runtime_version に記録する状態にする。選択された executable と version の binding は、fake launcher と PATH 上の別 version の decoy claude を使う focused test で固定され、native adapter の version capture と launcher の option parsing は変わらない。取得できない場合は version を捏造せず None のままにする。

In Scope

  • scripts/agent-ops/run_worktree_agent_runtime_smoke.py の runtime version 取得の変更(claude-gpt adapter のときだけ、launch.sh --dry-run を runner の実行と同じ環境で呼び、その JSON の launch_env.CLAUDE_GPT_CLAUDE_BIN を読み、その path に既存の capture_runtime_version() を適用する。dry-run が失敗する、path が無い、または --version が失敗した場合は None)。native adapter の経路は変更しない。
  • scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_claude_bin.py への focused test の追加(既存 test file を拡張し、新しい test file を作らない)。追加する test 関数名は test_claude_gpt_runtime_version_binds_to_launcher_dry_run_path(AC1)と test_claude_gpt_runtime_version_none_when_dry_run_or_version_unavailable(AC4)に固定する。fake launcher の --dry-run が underlying path X を報告し、X の fake binary が version V を返し、PATH 上に別 version の decoy claude を置いても summary の runtime_version が V になること、dry-run が失敗した場合と path が報告されない場合と --version が失敗した場合に None になることを pin する。
  • 実装者は、live 検証で記録された runtime_version と、launch.sh --dry-run が報告した path と readlink -f の結果を PR 本文に記録する。

Out of Scope

Runtime Verification Applicability

decision: immediate
reason: 変更対象 scripts/agent-ops/** は docs/dev/extension-surface-runtime-policy.yaml の runtime verification 対象であり、実 launcher の --dry-run JSON と実 Claude Code の --version を通した runtime_version の記録は、fake binary / fake launcher の unit test だけでは証明できないため。
applicable_acs: [AC5]
execution_environment: 現在の Claude Code session と repository の scripts/agent-ops/run_worktree_agent_runtime_smoke.py(claude 実行ファイルが利用可能で、scripts/claude-gpt/launch.sh と uv が利用可能であること)。無害な lifecycle smoke の fixture prompt を使う。mutation・外部 code 実行・permission 緩和・credential 利用は行わない。
skip_conditions: claude 実行ファイル、scripts/claude-gpt/launch.sh、uv のいずれかが利用不能な場合は、runner / VC は exit 77 と stdout 先頭 SKIP: で SKIP を宣言する(docs/dev/runtime-verification-policy.md の SKIP 規約に従う)。SKIP は PASS ではなく Stop Condition として扱う。
fallback_policy: unit test の PASS、fake launcher、runner の SKIP を AC5 の PASS として扱わない。runtime_version が claude --version の別コマンドの出力と偶然一致することだけを PASS 根拠にしない。
artifact_requirements: AC5 は worktree-local の artifacts/runtime-smoke/claude-gpt-runtime-version-binding/summary.md(main へ commit しない)を証跡とする。新しい schema・receipt・publisher は追加しない。
runtime_assertion_bindings:

  • profile: subagent-lifecycle-causal-evidence-smoke
    assertion: subagent_start_stop_causal_evidence_correlated
    disposition: not_applicable
    reason: 本 Issue の変更面は runner の runtime_version 取得だけであり、SubAgent の start / stop lifecycle や causal evidence の判定ロジックには触れない。AC5 の実 run は lifecycle fixture を使うが、検証対象は summary の runtime_version のみである。

Acceptance Criteria

  • AC1: claude-gpt adapter と launcher path を使う hermetic な代表ケース(fake launcher の --dry-run が underlying path X を報告し、PATH 上に別 version の decoy claude がある)で、summary の runtime_version が X の --version の出力になり、decoy の version にならない。
  • AC2: native adapter の version capture と既存の runtime_version test が変わらず PASS する。
  • AC3: launcher の option parsing(unknown_launcher_option と -- 以降の passthrough)の regression が PASS し、scripts/claude-gpt/ 配下に差分が無い。
  • AC4: dry-run の失敗、path 未報告、--version の失敗のいずれの場合も runtime_version は None のままで version が捏造されず、run 自体は version 取得の失敗だけを理由に FAIL しない。
  • AC5: --claude-adapter claude-gpt と --claude-bin "$PWD/scripts/claude-gpt/launch.sh" を使う実 run の summary で runtime_version が Claude Code を含む実 version 文字列であり(None ではない)、launch.sh --dry-run が報告した path と readlink -f の結果と実 --version の出力から選択された executable と version の対応が説明できる。

Verification Commands

# AC1
# baseline-expect: fail
$ uv run --locked pytest scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_claude_bin.py::test_claude_gpt_runtime_version_binds_to_launcher_dry_run_path -q

# AC2
# baseline-expect: pass
$ uv run --locked pytest scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke.py scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_runtime_evidence.py -q

# AC3
# baseline-expect: pass
$ uv run --locked pytest scripts/claude-gpt/tests/test_minimal_default_contract.py -q
# baseline-expect: pass
$ git diff --exit-code origin/main -- scripts/claude-gpt

# AC4
# baseline-expect: fail
$ uv run --locked pytest scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_claude_bin.py::test_claude_gpt_runtime_version_none_when_dry_run_or_version_unavailable -q

# AC5
# preflight-scope: runtime_only
$ uv run --locked python3 scripts/agent-ops/run_worktree_agent_runtime_smoke.py --runtime claude --mode structured --claude-adapter claude-gpt --claude-bin "$PWD/scripts/claude-gpt/launch.sh" --worktree "$PWD" --prompt-file scripts/agent-ops/tests/fixtures/runtime_vc_lifecycle_smoke_prompt.md --output-dir artifacts/runtime-smoke/claude-gpt-runtime-version-binding --timeout-seconds 300 --max-turns 6
# preflight-scope: runtime_only
$ rg -n "runtime_version: .*Claude Code" artifacts/runtime-smoke/claude-gpt-runtime-version-binding/summary.md

Allowed Paths

  • scripts/agent-ops/run_worktree_agent_runtime_smoke.py
  • scripts/agent-ops/tests/test_run_worktree_agent_runtime_smoke_claude_bin.py

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合(scripts/claude-gpt/ の変更が必要と判明した場合を含む)
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合(summary への新しい key の追加が必要になった場合を含む)
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
  • launch.sh --dry-run が実環境で server 診断や exec を伴う、または underlying path を報告しないと判明し、既存 mechanism の再利用では binding を説明できない場合(実装を止めて evidence を報告し、再 refinement を求める)
  • AC5 が SKIP(exit 77)または FAIL になった場合は PASS 扱いにせず、報告して停止する

Required Skills

なし

Required Design References

  • docs/dev/claude-gpt-runtime-prerequisites.md
  • docs/dev/runtime-verification-policy.md
  • docs/dev/extension-surface-runtime-policy.yaml
  • scripts/claude-gpt/launch.sh
  • scripts/claude-gpt/lib.sh

Delivery Rule

Notes for Reviewer

  • 選択した方針は「launcher の既存 --dry-run JSON の resolved path に対して既存の capture_runtime_version() を使う」である。launcher の option 追加(--version passthrough)は 実装: Claude-GPT launcher を upstream minimal client contract へ縮退し、launcher-owned isolation/policy 層を撤去する #2925 の最小 client contract を広げるため採らない。init event の claude_code_version による cross-check は、別の observation 経路で named-subagent-resume の evidence でしか使われておらず main summary に key を足す必要があるため、本 Issue では採らない。
  • binding の根拠は、runner の実行と同じ環境で launcher の resolver(CLAUDE_GPT_CLAUDE_BIN の優先と PATH の claude)が返した path に対して --version を実行する点にある。dry-run と本実行は別 invocation だが、同じ env と同じ resolver を通るため、別コマンドの偶然の一致ではない。
  • AC5 の VC は代表例であり、flag の調整が必要な場合は実装者が fixture と flag を既存の claude-gpt live test に合わせて調整してよい(Allowed Paths の範囲内で、AC の意味を変えない)。

Activity

  1. added
    phase/implementation
    agent/implementer
    enhancement
    on Oct 5, 2026
  2. squne121 commented on Oct 5, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop 終了報告(approved)

    実装 Issue #2954 の本文を refinement し、deterministic review が approve で終了しました。

    • 起票時の review は needs-fix(blocker 4 件)でした。内訳は runtime_assertion_bindings の欠落(RUNTIMEASSERT001)2 件、baseline で pass する VC の注記欠落(VCP_UNEXPECTED_PASS)2 件です。
    • runtime_assertion_bindings に not_applicable と理由を追加し、回帰 VC に baseline-expect: pass を付けました。新しい挙動を検証する 2 つの VC は、固定した新規 test の node-id と baseline-expect: fail に変更しました。Outcome、In Scope、AC の意味は変えていません。
    • 修正後の root review は status: ok / verdict: approve / next_action: proceed、blocker 0 件でした(body sha256 7d700fd38d206e8b46b73d85f4b5730350ff68fabb00325692c226914bc009fd)。非 blocking の advisory は runtime_assertion_disposition_classification の 1 件で、構造の分類のみです。
    • Step 2.5 の semantic review は、全 signal が false のため適用外としました。
    • 事前調査は、runner と launcher の source 読解(独立 SubAgent)と、launch.sh --dry-run の実機確認で行いました。dedupe search(open と closed)では、本件を所有する Issue は見つかりませんでした。
    • 起票時の overlap preflight は、実装: runtime smoke の expected_markers_missing が prompt echo を child marker と誤認する false-green を除去する #2944 と同じ runner file を Allowed Paths に含むと報告しました(overlap_requires_comment)。実装: runtime smoke の expected_markers_missing が prompt echo を child marker と誤認する false-green を除去する #2944 は expected_markers_missing の prompt echo を扱う別件で、変更する関数が異なるため吸収せず、Delivery Rule に競合の扱いを記載済みです。
    • この終了は実装の開始を authorize しません。実装の起動は live Issue の確認を経て別途行います。
    LOOP_HANDOFF_RESULT_V1:
      status: refinement_approved
      routing_action: none
      contract_review:
        status: go
        gate_result: missing_go
        latest_comment_url: none
        generated_at: 2026-10-05T22:10:00Z
        body_sha256: sha256:7d700fd38d206e8b46b73d85f4b5730350ff68fabb00325692c226914bc009fd
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: labels unchanged
      auto_fixes:
        result: auto_fixed
        required: []
        skipped: []
      blockers: []
      permissions:
        unavailable: []
      generated_at: 2026-10-05T22:10:00Z
      checked_body_sha256: sha256:7d700fd38d206e8b46b73d85f4b5730350ff68fabb00325692c226914bc009fd
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []
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/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions