Skip to content

実装: preflight.run の GH_CONFIG_DIR を command-scoped に伝播する #2403

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: none
goal_ref: >
  Claude-GPT isolated HOME でも、bare preflight.run と repository evidence で
  確定した exact workflow GitHub CLI consumer command が、launcher から渡された
  GH_CONFIG_DIR を command-scoped に保持し、capability preflight と controlled
  Issue transaction を config-only authentication で完了可能にする。
change_kind: workflow-runtime

Parent Issue

none

Parent Goal Ref

Current Validated Scope

  • scripts/agent-guards/skill_runtime_exec.py::_sanitize_env() で、caller-provided GH_CONFIG_DIR を次の exact command ID だけへ child environment として伝播できるようにする。
    • preflight.run
    • contract_update.run.with_anchor
    • contract_update.run.with_human_context
    • repair_action.apply
    • structural_repair_action.apply
  • default command と上記以外の全 command は GH_CONFIG_DIR を strip し続ける。authority_transport.consume は artifact-only mode と contract-update mode を同じ command ID で持つため、mode 非区別の carrier 許可をしない。
  • LOOP_SPARK_MODE、LOOP_SPARK_FALLBACK、LOOP_PLANNED_OPERATIONS_JSON は、従来どおり bare preflight.run だけに許可する。
  • actual-process isolated-HOME E2E で、root capability preflight と canonical human-context contract update の両方を検証する。後者は executor → run_refinement_preflight.py → edit_issue_txn.py → controlled mutation consumer の child boundary まで通し、test-owned GH_CONFIG_DIR の presence/path identity、固定 fake gh の exact argv/order だけを観測する。

Remaining Parent Gaps

Background

  • 実装: agent-retrospective を optional plugin distribution として配布可能にする #2240 の Claude-GPT isolated HOME 再現では、launcher は native GH_CONFIG_DIR を渡す一方、production preflight.run の _sanitize_env() は渡さなかった。その結果、bare preflight.run からの GitHub auth/controlled read が model 開始前に失敗した。
  • PR fix: preserve GH_CONFIG_DIR for bare preflight.run #2407 の initial repair は preflight.run だけを allowlist に追加した。current-head consumer trace で、contract_update.run.with_anchor、contract_update.run.with_human_context、repair_action.apply、structural_repair_action.apply も別 executor invocation から edit_issue_txn.py と controlled GitHub read/PATCH/readback に到達することが確認された。
  • downstream transaction helpers は受け取った GH_CONFIG_DIR を credential carrier として保持するが、outer executor が strip 済みの値を復元できない。config-only gh auth login 環境では、entry preflight が成功した後に canonical controlled transaction が認証不能となる false-green が起こり得る。
  • Operator の owner semantic judgment(2026-08-30)により、この consumer-parity finding を 実装: preflight.run の GH_CONFIG_DIR を command-scoped に伝播する #2403 の controlled reframe として許可する。prefix match、全 mutation command、全 human-context command、global propagation は許可しない。

Outcome

Updated skill_runtime_exec.py and focused tests preserve only the caller-provided GH_CONFIG_DIR path for the finite, evidence-backed workflow GitHub CLI consumer command set under an isolated HOME. Deterministic tests prove all non-members still strip it, LOOP_* remains bare-preflight-only, and no credential value, configuration content, or HOME absolute path is persisted.

Runtime Verification Applicability

decision: immediate
reason: The defect crosses real executor and subprocess boundaries and is only reproduced under an isolated HOME with config-only GitHub CLI authentication.
applicable_acs: AC3
execution_environment: Isolated temporary HOME plus a test-owned empty GH_CONFIG_DIR and controlled fake GitHub boundaries; GH_TOKEN, GITHUB_TOKEN, GH_ENTERPRISE_TOKEN, and GITHUB_ENTERPRISE_TOKEN are absent; no live GitHub mutation.
skip_conditions: The runtime VC returns exit 77 when its isolated fixture/process environment cannot be constructed.
fallback_policy: A result that reaches a controlled transaction without the required path-identity marker, or that uses token/HOME global sharing, is FAIL.
artifact_requirements: PR evidence records only PASS/FAIL/SKIP, command identity, opaque path-identity/presence match, fixed argv, and order assertions; it must not retain token values, HOME absolute paths, or GitHub config contents.

In Scope

  • Add GH_CONFIG_DIR to _sanitize_env() only for the exact five command IDs listed in Current Validated Scope.
  • Keep the LOOP_* capability-request allowlist exclusive to preflight.run.
  • Add or update focused command-matrix tests for the exact members, non-members, and unset/empty behavior.
  • Extend the existing actual-process contract-update coverage to prove a test-owned GH_CONFIG_DIR reaches the controlled GitHub CLI consumer without token fallback, config reads, network, or live mutation.
  • Tighten the existing root capability fake gh to reject unexpected complete argv while preserving current production argv semantics.
  • Keep runtime evidence and fixtures secret-free; do not persist credential values or configuration contents.

Out of Scope

Acceptance Criteria

  • AC1: _sanitize_env() retains the caller-provided GH_CONFIG_DIR path identity only for preflight.run, contract_update.run.with_anchor, contract_update.run.with_human_context, repair_action.apply, and structural_repair_action.apply; it does not read or expose configuration contents.
  • AC2: Default commands and every command ID outside that finite set, including all preflight siblings and authority_transport.consume, omit GH_CONFIG_DIR; unset/empty values are not synthesized; no token value or HOME sharing is introduced; LOOP_* remains bare-preflight.run only.
  • AC3: Actual-process isolated-HOME E2E covers both executor → workflow_start_entry → root_entry_router → root capability probe and executor → contract_update.run.with_human_context → run_refinement_preflight.py → edit_issue_txn.py → controlled mutation consumer. It observes only GH_CONFIG_DIR presence/path identity, exact fake-gh argv, and ordering; it requires no token, configuration content, network, or live GitHub mutation.
  • AC4: Focused regression suites pass without live GitHub access or mutation and without SKIP/exit 77.

Verification Commands

# AC1
$ uv run --locked pytest .claude/skills/issue-refinement-loop/scripts/tests/test_skill_runtime_exec_env_allowlist.py
# AC2
$ uv run --locked pytest scripts/agent-guards/tests/test_trusted_toolchain_isolated_home.py -k sanitize_env
# AC2
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_operator_selected_scope_reframe.py::test_fixture_human_context_real_subprocess_reaches_contract_update_required_ac3
# AC3
$ uv run --locked pytest .claude/skills/issue-refinement-loop/scripts/tests/test_workflow_start_entry_canonical_executor.py
# AC3
$ uv run --locked pytest scripts/agent-guards/tests/test_skill_runtime_exec_anchor.py -k contract_update_phase
# AC4
$ uv run --locked pytest scripts/agent-guards/tests/test_isolated_anchor_single_authority.py

Allowed Paths

  • scripts/agent-guards/skill_runtime_exec.py
  • scripts/agent-guards/tests/
  • .claude/skills/issue-refinement-loop/scripts/tests/
  • .claude/skills/issue-refinement-loop/tests/test_operator_selected_scope_reframe.py

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合。ただし、この Issue で owner authorization 済みの exact P0 process-test path は controlled reframe により先に Allowed Paths へ追加してから扱う。
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合。
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)。ただし P1 host/account probe は 実装: root GitHub auth probe を対象host限定(--active --hostname github.com)に変更する #2404/fix: root github auth probe を --active --hostname github.com に限定する #2413 の独立 owner を優先し、本 Issue の completion blocker としない。
  • 後続 Phase / 別スコープへの波及が判明した場合。
  • nested SubAgent delegation が必要になった場合。
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合。
  • A required GitHub CLI consumer cannot be classified from an executor → actual child → consumer trace.
  • A newly discovered command ID outside the finite inventory requires GH_CONFIG_DIR, or a listed conditional command requires mode-specific propagation that command-ID policy cannot express.
  • secret / credential value または GitHub configuration content の取得・表示・保存が必要になった場合。
  • destructive operation、live GitHub mutation、または remote mutation outcome が不明な再試行が必要になった場合。
  • active parallel work が同一 logic に対して意味的に相反し、安全に reconcile できない場合。
  • 動作検証 AC の VC が SKIP(exit 77)を返した場合、または fallback 経由でのみ成功する場合。
  • repository canonical workflow が、この owner authorization とは別の genuine semantic owner judgment を要求する場合。

Required Skills

  • Python
  • pytest subprocess fixtures

Required Design References

  • docs/dev/runtime-verification-policy.md
  • docs/dev/secret-policy.md
  • docs/dev/agent-runtime-ops.md

Scope Delta(任意)

  • Current-head P0 consumer inventory established that the initial bare-only repair permits root capability preflight while stripping the same caller-provided config-only credential carrier from four separately invoked controlled GitHub consumer commands. Under the 2026-08-30 operator owner authorization, this is a controlled reframe of 実装: preflight.run の GH_CONFIG_DIR を command-scoped に伝播する #2403’s credential-parity goal, not a global propagation policy.
  • The finite set is limited to actual consumer traces. preflight.run.with_human_context uses credentialless reads; authority_transport.consume has unresolved mixed modes; all other candidates remain stripped. Functional distribution ownership, producer artifact scope, and wrapper scope remain unchanged.

Delivery Rule

1 Issue = 1 PR. Continue existing PR #2407 and its existing worktree/branch; do not open a second PR for #2403. Coordinate line-level edits with open #2393 and open PR #2409 before push. #2393’s future contract-update runtime migration and #2409’s retired launch-ledger removal do not change this finite carrier policy and are not dependencies.

Source

Scope Overlap Note

Notes for Reviewer

  • The E2E assertions may inspect only presence/path identity, exact fixed argv, and ordering. They must not print, serialize, retain, or compare token values, HOME absolute paths, or GitHub configuration content.
  • The fake gh must reject unexpected argv. Its PATCH behavior is local fixture-only; no live GitHub mutation is permitted.
  • Plugin installation, distribution artifact, GitHub generated source archive, release asset, SBOM, signing, attestation, and OS matrix concerns are non-applicable to this runtime environment propagation Issue.

Activity

  1. added
    phase/implementation
    agent/implementer
    enhancement
    on Aug 29, 2026
  2. squne121 commented on Aug 29, 2026

    @squne121
    OwnerAuthor

    Issue #2403 敵対的レビュー

    総合判定:REVISE

    問題設定そのものには実装価値がありますが、現状のまま着手すると「内部の構造検査は通るが、実際に配布・導入された環境では機能しない」状態を完成条件として認める危険があります。

    最大の問題は、セキュリティ不足ではありません。次の三点です。

    1. 生成側の検証と、実際の消費側の動作確認が分離されている

    2. 関連Issue・既存契約との所有権と優先順位が曖昧

    3. リポジトリ内資産、GitHubの自動生成source archive、明示的なrelease asset、Claude Codeのplugin導入物が同じものとして扱われかねない

    したがって、重いハーネスを増やすのではなく、利用者が実際に使う配布物を隔離環境へ導入し、本物のconsumerを一度起動する薄いスモークテストを完成条件に加えるべきです。Issue本文・コメント・timeline・明示参照された関連Issue/PRとリポジトリ資産を対象に照合しました。

    1. P0:producerの成功を確認しても、consumerの成功は証明できない

    Issueの完成条件は、生成されたファイル、メタデータ、セクション、ガード出力などの存在・形状へ寄りすぎています。

    しかし、実際に壊れやすいのはその後です。

    • 配布物にはファイルが入っているが、consumerが別の場所を読む

    • リポジトリルートでは解決できる相対パスが、plugin導入後には解決できない

    • 新しい契約を書き出すproducerと、旧契約を優先するconsumerが混在する

    • source checkout上のテストだけ通り、release assetには必要資産が含まれない

    • 導入済みpluginのキャッシュやplugin rootを考慮していない

    Claude Codeのpluginでは、plugin manifest、marketplace定義、plugin rootを基準とするコンポーネント配置が導入時の契約になります。したがって、リポジトリ内でファイルを直接読めることは、導入後の動作保証にはなりません。(Claude)-end確認を追加します。

    clean checkout
      → 正式な配布物を生成
      → 一時HOMEまたは一時設定ディレクトリへ正式手順で導入
      → リポジトリ外から実consumerを起動
      → 代表的な1ケースが期待結果になることを確認

    新しい汎用ハーネスは不要です。既存テストの隣に、配布物を対象とする一本のスモークテストを置けば十分です。


    2. P0:どの配布物を保証するIssueなのか固定されていない

    少なくとも次は別物です。

    • Git checkout

    • GitHubが自動生成するZIP/tarball

    • workflow artifact

    • GitHub Releaseへ明示的に添付するasset

    • Claude Code marketplaceから取得・展開されるplugin

    • 開発用のローカルplugin参照

    GitHub Releaseには追加assetを添付できますが、GitHubはそれとは別にタグからsource archiveを自動生成します。この二つを区別しなければ、「テストしたもの」と「利用者がダウンロードしたもの」が異なる状態になります。(GitHub Docs)査する
    2. 利用者はRelease画面の自動生成source archiveを取得する
    3. 自動生成archiveには、生成工程で追加される資産が存在しない
    4. CIはgreenだが、利用者の導入は失敗する

    最小修正

    Issue本文に次を明記してください。

    Authoritative distribution artifact:
    - ファイル名:
    - 生成コマンド:
    - 公開場所:
    - 利用者が実行する導入コマンド:
    

    Unsupported artifacts:

    • GitHub autogenerated source archives are not installation artifacts.

    source archive自体を正式配布物にするなら、生成工程に依存する資産を要求してはいけません。


    3. P0:関連Issueとのownershipとprecedenceが不十分

    今回の契約を追加するだけでは、既存のproducer、consumer、preflight、repair action、document contractのどれが権威を持つか決まりません。

    特に危険なのは、次のような二重SSOTです。

    新しいIssue:
    新セクション/新manifest/新判定結果を正とする

    既存consumer:
    従来セクション、旧artifact、旧precedenceを正とする

    この状態では、正しく生成された入力を渡しても、古いconsumerが無視したり、別のrequired section不足として人間判断へ戻したりします。ガードを追加しても解決せず、むしろ「どのガードが正しいか」という新しい問題が増えます。

    最小修正

    Issue本文に次の表を追加してください。

    役割 正式な所有者 今回の変更 旧契約の扱い
    producer 具体的なscript/skill 新形式を生成 旧形式を停止または併記
    consumer 具体的なscript/skill 新形式を読む precedenceを明記
    distribution 具体的なbuild処理 正式assetへ含める source archiveとの差を明記
    migration 今回または別Issue 既存データを扱う 対応期間を限定
    verification 既存テスト+薄いsmoke consumerまで確認 新しい汎用guardは作らない

    セキュリティ上の一般論ではなく、誤ったrepository mutationや契約更新を防ぐ場合だけ停止させるのが妥当です。


    5. P1:Acceptance Criteriaが内部表現に寄りすぎると変更コストが高い

    固定文字列、巨大snapshot、ファイル行数、特定の内部関数呼び出しなどを完成条件にすると、利用者の挙動を変えていないリファクタリングでもテストが壊れます。

    重視すべきなのは次です。

    • 正式な配布物が作れる

    • 正式な方法で導入できる

    • 実consumerが読める

    • 代表的な利用経路が成功する

    • 壊れた入力では部分更新を残さない

    • エラーから人間が復旧できる

    manifestやJSONの構造検査は一本あってよいですが、それを主たる成功条件にしない方がよいです。


    6. P2:新しい恒久ハーネスを増やす費用対効果が低い

    今回必要なのは、以下だけです。

    • 既存unit/contract test

    • 配布物のファイル一覧検査

    • 一時ディレクトリへの導入

    • 実consumerを一度動かすsmoke test

    • 必須ファイル一つを欠損させるfailure test

    以下は現段階では後回しで構いません。

    • 全OSの互換性マトリクス

    • 全旧バージョンとの組み合わせ検証

    • property-based testの大量追加

    • 新しいglobal preflight framework

    • 署名・SBOM・attestation

    • すべてのエラー文面を固定するsnapshot

    • 任意ファイルの欠損パターン総当たり

    公開範囲が広がり、第三者が不特定のartifactを取得する段階になってから、署名などを再検討すれば十分です。


    Issue本文へ入れるAcceptance Criteria案

    ## Scope and authority
    
    • #2403 owns:
      • [今回変更する契約を一つだけ記載]
    • #2403 does not own:
      • [関連Issueが引き続き所有する契約]
    • Canonical producer:
      • <具体的なscript / skill / command>
    • Canonical consumer:
      • <実際に配布物を読むscript / skill / command>
    • Authoritative distribution artifact:
      • <具体的なasset名>
    • GitHub autogenerated source archives:
      • supported / unsupported のどちらかを明示

    Acceptance Criteria

    1. Clean checkoutから次の単一コマンドで正式配布物を生成できる。

      &lt;canonical build command&gt;</code></pre><ol start="2"><li><p>生成された配布物には、consumerが必要とする資産が含まれる。</p><pre><code class="language-bash">&lt;archive listing or manifest validation command&gt;</code></pre></li><li><p>配布物には次が含まれない。</p><ul><li><p>リポジトリ外を指す絶対パス</p></li><li><p><code inline="">..</code> による展開先外参照</p></li><li><p>開発環境だけに存在するファイルへの参照</p></li><li><p>secret、ローカルキャッシュ、作業ログ</p></li></ul></li><li><p>空の一時環境へ、READMEに記載した正式手順だけで導入できる。</p><pre><code class="language-bash">HOME="$(mktemp -d)" &lt;canonical install command&gt;</code></pre></li><li><p>リポジトリルートをcurrent directoryにせず、実consumerを起動できる。</p><pre><code class="language-bash">cd "$(mktemp -d)"

    HOME="<temporary-home>" <real consumer command>

  3. 代表的なhappy-path一件が、期待するobservable resultを生成する。

    • expected exit code:

    • expected output/artifact:

    • expected repository mutation:

  4. 必須資産を一つ欠損させた場合は、部分更新を残さず、単一の診断と復旧方法を返す。

  5. 同じ配布物を二度導入しても、設定や登録が重複しない。

  6. 既存テストと上記smoke testが成功する。

  7. このIssueのためだけの新しいglobal guard、別SSOT、恒久的なpreflight layerは追加しない。

  8. 
    

    推奨アクション

    P0:実装前に行う

    • 正式な配布物を一つに限定する
    • producerとconsumerを実ファイル/実コマンド名で指定する
    • 関連Issueとのownership・precedenceを表にする
    • 実配布物を一時環境へ導入するsmoke testをACに追加する
    • GitHubの自動source archiveを正式配布物とするか明記する

    P1:実装PRで行う

    • 正式assetの生成処理
    • artifact内容の薄い構造検査
    • 一時HOMEへの導入と実consumer起動
    • 必須資産欠損時の一件だけのfailure test
    • copy-paste可能な導入・更新・削除または復旧手順

    後回し

    • 複数旧バージョンからのmigration matrix
    • Windows/macOS/Linuxの完全な組み合わせCI
    • cryptographic signing、SBOM、attestation
    • 詳細なschema evolution framework

    やらない

    • 新しい全体preflight frameworkを作る
    • 同じ契約をIssue本文、別JSON、別Markdownへ重複して持つ
    • consumerを起動せず、生成ファイルの存在だけで完了とする
    • すべての異常を人間判断へ送る
    • エラー文面の完全一致を主要な品質指標にする

    マージ/着手判断

    次の三点がIssue本文に入れば、GOへ変更してよいです。

    1. 利用者が取得する正式配布物が一意
    2. 隔離環境で実consumerまで通す再現手順がある
    3. 関連Issueとのproducer/consumer/precedence所有権が一意

    それまでは、実装より先にIssue本文を直す方が安価です。

    詳細な根拠・関連資産・検証結果をまとめた版はこちらです。

    • Issue #2403 敵対的レビュー全文
    • 安全な検証コマンドの実行ログ
    • レビューと調査証跡一式
    # Issue #2403 敵対的レビュー

    総合判定:REVISE

    問題設定そのものには実装価値がありますが、現状のまま着手すると「内部の構造検査は通るが、実際に配布・導入された環境では機能しない」状態を完成条件として認める危険があります。

    最大の問題は、セキュリティ不足ではありません。次の三点です。

    1. 生成側の検証と、実際の消費側の動作確認が分離されている
    2. 関連Issue・既存契約との所有権と優先順位が曖昧
    3. リポジトリ内資産、GitHubの自動生成source archive、明示的なrelease asset、Claude Codeのplugin導入物が同じものとして扱われかねない

    したがって、重いハーネスを増やすのではなく、利用者が実際に使う配布物を隔離環境へ導入し、本物のconsumerを一度起動する薄いスモークテストを完成条件に加えるべきです。Issue本文・コメント・timeline・明示参照された関連Issue/PRとリポジトリ資産を対象に照合しました。

    1. P0:producerの成功を確認しても、consumerの成功は証明できない

    Issueの完成条件は、生成されたファイル、メタデータ、セクション、ガード出力などの存在・形状へ寄りすぎています。

    しかし、実際に壊れやすいのはその後です。

    • 配布物にはファイルが入っているが、consumerが別の場所を読む
    • リポジトリルートでは解決できる相対パスが、plugin導入後には解決できない
    • 新しい契約を書き出すproducerと、旧契約を優先するconsumerが混在する
    • source checkout上のテストだけ通り、release assetには必要資産が含まれない
    • 導入済みpluginのキャッシュやplugin rootを考慮していない

    Claude Codeのpluginでは、plugin manifest、marketplace定義、plugin rootを基準とするコンポーネント配置が導入時の契約になります。したがって、リポジトリ内でファイルを直接読めることは、導入後の動作保証にはなりません。([Claude]1)-end確認を追加します。

    clean checkout
      → 正式な配布物を生成
      → 一時HOMEまたは一時設定ディレクトリへ正式手順で導入
      → リポジトリ外から実consumerを起動
      → 代表的な1ケースが期待結果になることを確認
    

    新しい汎用ハーネスは不要です。既存テストの隣に、配布物を対象とする一本のスモークテストを置けば十分です。


    2. P0:どの配布物を保証するIssueなのか固定されていない

    少なくとも次は別物です。

    • Git checkout
    • GitHubが自動生成するZIP/tarball
    • workflow artifact
    • GitHub Releaseへ明示的に添付するasset
    • Claude Code marketplaceから取得・展開されるplugin
    • 開発用のローカルplugin参照

    GitHub Releaseには追加assetを添付できますが、GitHubはそれとは別にタグからsource archiveを自動生成します。この二つを区別しなければ、「テストしたもの」と「利用者がダウンロードしたもの」が異なる状態になります。([GitHub Docs]2)査する
    2. 利用者はRelease画面の自動生成source archiveを取得する
    3. 自動生成archiveには、生成工程で追加される資産が存在しない
    4. CIはgreenだが、利用者の導入は失敗する

    最小修正

    Issue本文に次を明記してください。

    Authoritative distribution artifact:
    - ファイル名:
    - 生成コマンド:
    - 公開場所:
    - 利用者が実行する導入コマンド:
    
    Unsupported artifacts:
    - GitHub autogenerated source archives are not installation artifacts.

    source archive自体を正式配布物にするなら、生成工程に依存する資産を要求してはいけません。


    3. P0:関連Issueとのownershipとprecedenceが不十分

    今回の契約を追加するだけでは、既存のproducer、consumer、preflight、repair action、document contractのどれが権威を持つか決まりません。

    特に危険なのは、次のような二重SSOTです。

    新しいIssue:
      新セクション/新manifest/新判定結果を正とする
    
    既存consumer:
      従来セクション、旧artifact、旧precedenceを正とする
    

    この状態では、正しく生成された入力を渡しても、古いconsumerが無視したり、別のrequired section不足として人間判断へ戻したりします。ガードを追加しても解決せず、むしろ「どのガードが正しいか」という新しい問題が増えます。

    最小修正

    Issue本文に次の表を追加してください。

    役割 正式な所有者 今回の変更 旧契約の扱い
    producer 具体的なscript/skill 新形式を生成 旧形式を停止または併記
    consumer 具体的なscript/skill 新形式を読む precedenceを明記
    distribution 具体的なbuild処理 正式assetへ含める source archiveとの差を明記
    migration 今回または別Issue 既存データを扱う 対応期間を限定
    verification 既存テスト+薄いsmoke consumerまで確認 新しい汎用guardは作らない

    「関連Issueを参照する」だけでは不足です。どのIssueがどの契約を所有し、#2403が何を所有しないかまで書く必要があります。


    4. P1:失敗時の分類と復旧方法が完成条件に入っていない

    すべてをfail-closedにすると、個人開発では日常的な実行を止めるだけのガードになりやすいです。一方、必須資産が壊れているのに無言で継続すると誤った書き込みを行います。

    少なくとも次を分類すべきです。

    状態 推奨挙動
    任意の補助資産がない 警告して継続
    必須資産がない 明確なエラーで停止
    形式が壊れている 読み込み失敗箇所と修復方法を表示
    対応外バージョン 変更を行わず、更新方法を表示
    更新途中で失敗 既存の動作可能版を残す
    再実行 重複生成せず同じ結果になる

    セキュリティ上の一般論ではなく、誤ったrepository mutationや契約更新を防ぐ場合だけ停止させるのが妥当です。


    5. P1:Acceptance Criteriaが内部表現に寄りすぎると変更コストが高い

    固定文字列、巨大snapshot、ファイル行数、特定の内部関数呼び出しなどを完成条件にすると、利用者の挙動を変えていないリファクタリングでもテストが壊れます。

    重視すべきなのは次です。

    • 正式な配布物が作れる
    • 正式な方法で導入できる
    • 実consumerが読める
    • 代表的な利用経路が成功する
    • 壊れた入力では部分更新を残さない
    • エラーから人間が復旧できる

    manifestやJSONの構造検査は一本あってよいですが、それを主たる成功条件にしない方がよいです。


    6. P2:新しい恒久ハーネスを増やす費用対効果が低い

    今回必要なのは、以下だけです。

    • 既存unit/contract test
    • 配布物のファイル一覧検査
    • 一時ディレクトリへの導入
    • 実consumerを一度動かすsmoke test
    • 必須ファイル一つを欠損させるfailure test

    以下は現段階では後回しで構いません。

    • 全OSの互換性マトリクス
    • 全旧バージョンとの組み合わせ検証
    • property-based testの大量追加
    • 新しいglobal preflight framework
    • 署名・SBOM・attestation
    • すべてのエラー文面を固定するsnapshot
    • 任意ファイルの欠損パターン総当たり

    公開範囲が広がり、第三者が不特定のartifactを取得する段階になってから、署名などを再検討すれば十分です。


    Issue本文へ入れるAcceptance Criteria案

    ## Scope and authority
    
    - #2403 owns:
      - [今回変更する契約を一つだけ記載]
    - #2403 does not own:
      - [関連Issueが引き続き所有する契約]
    - Canonical producer:
      - `<具体的なscript / skill / command>`
    - Canonical consumer:
      - `<実際に配布物を読むscript / skill / command>`
    - Authoritative distribution artifact:
      - `<具体的なasset名>`
    - GitHub autogenerated source archives:
      - supported / unsupported のどちらかを明示
    
    ## Acceptance Criteria
    
    1. Clean checkoutから次の単一コマンドで正式配布物を生成できる。
    
       ```bash
       <canonical build command>
    1. 生成された配布物には、consumerが必要とする資産が含まれる。

      <archive listing or manifest validation command>
    2. 配布物には次が含まれない。

      • リポジトリ外を指す絶対パス
      • .. による展開先外参照
      • 開発環境だけに存在するファイルへの参照
      • secret、ローカルキャッシュ、作業ログ
    3. 空の一時環境へ、READMEに記載した正式手順だけで導入できる。

      HOME="$(mktemp -d)" <canonical install command>
    4. リポジトリルートをcurrent directoryにせず、実consumerを起動できる。

      cd "$(mktemp -d)"
      HOME="<temporary-home>" <real consumer command>
    5. 代表的なhappy-path一件が、期待するobservable resultを生成する。

      • expected exit code:
      • expected output/artifact:
      • expected repository mutation:
    6. 必須資産を一つ欠損させた場合は、部分更新を残さず、単一の診断と復旧方法を返す。

    7. 同じ配布物を二度導入しても、設定や登録が重複しない。

    8. 既存テストと上記smoke testが成功する。

    9. このIssueのためだけの新しいglobal guard、別SSOT、恒久的なpreflight layerは追加しない。

    
    ---
    
    ## 推奨アクション
    
    ### P0:実装前に行う
    
    - 正式な配布物を一つに限定する
    - producerとconsumerを実ファイル/実コマンド名で指定する
    - 関連Issueとのownership・precedenceを表にする
    - 実配布物を一時環境へ導入するsmoke testをACに追加する
    - GitHubの自動source archiveを正式配布物とするか明記する
    
    ### P1:実装PRで行う
    
    - 正式assetの生成処理
    - artifact内容の薄い構造検査
    - 一時HOMEへの導入と実consumer起動
    - 必須資産欠損時の一件だけのfailure test
    - copy-paste可能な導入・更新・削除または復旧手順
    
    ### 後回し
    
    - 複数旧バージョンからのmigration matrix
    - Windows/macOS/Linuxの完全な組み合わせCI
    - cryptographic signing、SBOM、attestation
    - 詳細なschema evolution framework
    
    ### やらない
    
    - 新しい全体preflight frameworkを作る
    - 同じ契約をIssue本文、別JSON、別Markdownへ重複して持つ
    - consumerを起動せず、生成ファイルの存在だけで完了とする
    - すべての異常を人間判断へ送る
    - エラー文面の完全一致を主要な品質指標にする
    
    ## マージ/着手判断
    
    次の三点がIssue本文に入れば、**GOへ変更してよい**です。
    
    1. 利用者が取得する正式配布物が一意  
    2. 隔離環境で実consumerまで通す再現手順がある  
    3. 関連Issueとのproducer/consumer/precedence所有権が一意  
    
    それまでは、実装より先にIssue本文を直す方が安価です。
    
    詳細な根拠・関連資産・検証結果をまとめた版はこちらです。
    
    - [Issue #2403 敵対的レビュー全文](sandbox:/mnt/data/issue2403/issue-2403-adversarial-review.md)
    - [安全な検証コマンドの実行ログ](sandbox:/mnt/data/issue2403/safe_check_results.md)
    - [レビューと調査証跡一式](sandbox:/mnt/data/issue2403/issue-2403-review-evidence.zip)
    
  • squne121 commented on Aug 29, 2026

    @squne121
    OwnerAuthor

    推奨は、#2403 をいきなりアンカーコメントの内容へ全面 reframe せず、まず controlled reframe で指摘の適用可否を再検証し、その後そのまま実装まで進めることです。

    アンカーコメントは REVISE ですが、主張のかなりの部分が「正式配布 artifact」「GitHub source archive」「Claude Code plugin 導入」「producer / consumer の配布契約」に寄っています。 一方、現在の #2403 は skill_runtime_exec.py::_sanitize_env() における bare preflight.run だけの GH_CONFIG_DIR command-scoped propagation が本体で、AC3 には isolated HOME で executor → workflow_start_entry → root_entry_router → workflow_capability_preflight を actual process で通す検証まで既に入っています。

    また、GitHub CLI の公式仕様でも GH_CONFIG_DIR は gh が設定ファイルを置き、参照するディレクトリを指定する環境変数です。したがって isolated HOME でこのパスだけを command-scoped に維持する、という #2403 の問題設定自体は筋が通っています。(GitHub CLI)

    特にアンカーコメントの plugin 配布論は #2240 がまさに所有しており、#2240 では plugins/agent-retrospective/、${CLAUDE_PLUGIN_ROOT}、claude --plugin-dir、clean-install smoke まで明示されています。これを #2403 へ持ち込むのは ownership の改善ではなく scope 混入になる可能性が高いです。

    並行作業についても、#2403 本文の現在の整理の方が妥当です。#2402 は同じ skill_runtime_exec.py を触りますが、編集意図は structural repair dispatch です。 #2393 も同ファイルを触るものの contract-update dedicated runtime migration で、しかも #2199 待ちを明示しています。 したがって 「同じファイルだから実装禁止」ではなく、同じ関数・同じ分岐・相反する意味変更が発生しているかを確認するべきです。

    私なら次の判定で進めます。

    項目 | 推奨 -- | -- plugin / release asset / source archive 対応 | Reject as non-applicable。#2240 側の責務 consumer まで実動確認せよ | 趣旨のみ採用。ただし #2403 AC3 の actual-process E2E で満たす。plugin install smoke には拡張しない producer / consumer SSOT 表追加 | 原則不要。この Issue は配布フォーマットを生成しない #2402 / #2393 との競合 | 実装前に semantic / line-level conflict を確認。ファイル一致だけでは停止しない #2403 実装 | controlled reframe 後、契約が implementation-ready ならそのまま実施 PR | dedicated worktree、Closes #2403、Draft PR、レビュー修正まで。merge はしない

    Claude-GPT には、アンカーコメントを「OWNER だから無条件に正しい」と扱わせず、repository evidence による claim-by-claim validation を先にやらせるのが重要です。

    #2403 (comment)
    を起点に、Issue #2403 の controlled reframe → 必要なら実装 → テスト → Draft PR → レビュー修正まで進めてください。

    人間承認は通常の調査・refinement・実装・テスト・コミット・Draft PR 作成・レビュー修正には不要です。
    merge は行わず、merge-ready の直前で停止してください。

    重要:
    アンカーコメントは OWNER の敵対的レビューですが、その内容を無条件に Issue contract へ転記しないでください。
    Issue #2403 の実スコープ、関連 Issue / PR、現在の main の実装、既存テストを照合し、各 finding を independently verified / partially applicable / non-applicable / superseded に分類してから controlled reframe してください。

    特に、アンカーコメントには Claude Code plugin distribution、GitHub autogenerated source archive、release asset、正式配布 artifact、plugin install smoke 等の論点があります。
    これらが本当に #2403 の goal / outcome / consumer boundary に属するのかを検証してください。
    #2240 等の別 Issue が所有している distribution scope を #2403 に混在させないでください。

    #2403 の現在の中心契約は以下です。

    • scripts/agent-guards/skill_runtime_exec.py::_sanitize_env()

    • caller-provided GH_CONFIG_DIR を command id preflight.run のときだけ child environment に保持する

    • bare preflight.run 以外の default / sibling command では引き続き strip する

    • GH_TOKEN / GITHUB_TOKEN / HOME の global sharing を導入しない

    • configuration content や token value をログ・artifact に保存しない

    • isolated HOME で actual-process E2E を行い、
      executor
      → workflow_start_entry
      → root_entry_router
      → workflow_capability_preflight
      を通して、model start 前に GitHub probe availability を確認する

    • 観測するのは GH_CONFIG_DIR の presence / path identity と capability outcome のみ

    • live credential や live GitHub mutation は要求しない

    GitHub CLI の GH_CONFIG_DIR は gh の configuration directory を指定する環境変数であるため、この command-scoped propagation 自体を plugin distribution 問題へ拡張しないでください。

    1. 最初に SubAgent を fan-out してください。

    最低でも以下の独立 SubAgent を起動してください。

    A. anchor-review-validator

    B. runtime-boundary-investigator

    • current main の
      scripts/agent-guards/skill_runtime_exec.py
      _sanitize_env()
      preflight.run
      workflow_start_entry
      root_entry_router
      workflow_capability_preflight
      と関連テストを読む

    • GH_CONFIG_DIR がどこで失われ、どの subprocess boundary まで渡す必要があるかを確認する

    • 現在の 実装: preflight.run の GH_CONFIG_DIR を command-scoped に伝播する #2403 AC3 が genuine consumer-equivalent / actual-process verification になっているか確認する

    • 最小 implementation delta を提示する

    • mutation は行わない

    C. overlap-concurrency-auditor

    必要なら追加 SubAgent を使って構いません。

    重要:
    全 SubAgent を起動した後、必ず terminal completion まで待ってください。
    一部の SubAgent が未完了の状態で refinement / implementation の最終判断をしないでください。
    SubAgent に nested SubAgent delegation はさせないでください。

    1. SubAgent 全完了後に結果を統合してください。

    anchor comment の各 finding を少なくとも以下に分類してください。

    • verified_and_applicable

    • partially_applicable

    • non_applicable

    • already_satisfied

    • contradicted_by_repository_evidence

    特に以下を明示判定してください。

    • 「正式配布 artifact を一つに固定すべき」

    • 「GitHub autogenerated source archive を supported / unsupported と明記すべき」

    • 「Claude Code plugin を一時 HOME に install する smoke test が必要」

    • 「producer / consumer / distribution / migration ownership table が必要」

    • 「actual consumer まで検証すべき」

    distribution / plugin 論点が #2240 等の別 scope であり #2403 に producer artifact 自体が存在しないなら、non_applicable として拒否してください。
    レビューコメントだからという理由だけで In Scope / AC / Allowed Paths を膨張させないでください。

    一方、「内部 shape test だけでなく実 subprocess boundary を通すべき」という一般論が #2403 に適用できる場合は、現在の AC3 actual-process isolated-HOME E2E が既に満たしているかを確認し、不足がある場合だけ最小 delta を提案してください。

    1. Issue 実装: preflight.run の GH_CONFIG_DIR を command-scoped に伝播する #2403 に対して issue-refinement-loop を実行してください。

    anchor human context:
    #2403 (comment)

    canonical main root / default branch 等、skill が要求する preflight 条件を満たして実行してください。

    controlled reframe の原則:

    • repository evidence を優先する

    • anchor の意図を尊重するが、技術的に別 Issue の scope である finding は取り込まない

    • 実装: preflight.run の GH_CONFIG_DIR を command-scoped に伝播する #2403 の goal を plugin distribution 問題へ変更しない

    • preflight.run 以外へ GH_CONFIG_DIR propagation を広げない

    • live credential / token / configuration content を要求しない

    • HOME global sharing を導入しない

    • 新しい global guard / generic preflight framework を作らない

    • 必要なら Issue 本文へ「distribution artifact applicability: N/A。本 Issue は runtime environment propagation であり配布 artifact を生成しない」程度の最小 clarification を加えてよい

    • 既存 AC3 で十分なら不要な AC 追加をしない

    refinement mutation を行った場合は、必ず fresh preflight を再実行し、最新 Issue contract を source of truth としてください。

    fresh preflight が typed structural repair / operator intervention / genuine human semantic judgment を要求した場合は、その taxonomy に従ってください。
    ただし、単なる同一ファイル編集、並行 worktree の存在、一般的な merge conflict の可能性だけを implementation prohibition にしないでください。

    1. controlled reframe 後、Issue が implementation-ready なら 実装: preflight.run の GH_CONFIG_DIR を command-scoped に伝播する #2403 を実装してください。

    専用 worktree / branch を使用してください。

    実装前に main と active worktree / PR の最新状態を再確認してください。
    #2402 / #2393 と同一ファイルを触っていても、edit intent が独立しているなら進めて構いません。
    実際に同一 logic へ相反する変更が存在する場合だけ、その conflict を解消してから進めてください。

    実装は最小差分にしてください。

    期待する中心 delta:

    • _sanitize_env() が command id preflight.run の場合だけ caller の GH_CONFIG_DIR を child env へ保持

    • caller に GH_CONFIG_DIR が存在しない場合に値を生成しない

    • default / sibling commands では strip を維持

    • GH_TOKEN

    • GITHUB_TOKEN

    • HOME
      等の propagation を新規に許可しない

    • config contents / credential values を読んだり evidence に保存したりしない

    「preflight.run.with_anchor」「preflight.run.with_human_context」等へ自動的に allowlist を拡張しないでください。
    Issue contract が明示的に bare preflight.run のみを所有している限り、その exact scope を維持してください。

    1. テストしてください。

    Issue #2403 の Verification Commands を source of truth とし、少なくとも以下を実行してください。

    uv run --locked pytest scripts/agent-guards/tests/test_trusted_toolchain_isolated_home.py -k sanitize_env

    uv run --locked pytest .claude/skills/issue-refinement-loop/scripts/tests/test_skill_runtime_exec_env_allowlist.py

    uv run --locked pytest .claude/skills/issue-refinement-loop/scripts/tests/test_workflow_start_entry_canonical_executor.py

    uv run --locked pytest scripts/agent-guards/tests/test_isolated_anchor_single_authority.py

    AC3 は test double の内部関数呼び出しだけではなく、Issue が指定する actual-process boundary を通していることを確認してください。

    isolated fixture が作れず exit 77 / SKIP になる場合は PASS に変換しないでください。

    runtime evidence には次を保存しないでください。

    • token value

    • GitHub config contents

    • credential contents

    • HOME absolute path

    必要なのは PASS / FAIL / SKIP、command identity、redacted な path presence / identity 程度です。

    1. 回帰を確認してください。

    変更対象周辺の focused regression を実行してください。
    新しい broad harness や全 OS matrix は作らないでください。
    既存テストで十分なものを新しい恒久 framework へ置換しないでください。

    1. Draft PR を作成してください。

    アンカーコメントのうち rejected / non-applicable とした finding についても、PR 本文に簡潔に理由を残してください。
    特に plugin distribution / release asset / autogenerated source archive を #2403 に取り込まなかった場合は、「#2403 does not produce or distribute such an artifact; #2240 owns plugin distribution」のように scope authority を明記してください。

    1. PR 作成後は impl-review-loop または repository の canonical review workflow を使用してください。

    レビューは現行 PR head に対して実施してください。
    REQUEST_CHANGES があれば verified finding だけを fix delta として実装し、再テストしてください。
    レビューコメントが別 Issue の scope を混入させている場合は再び repository evidence で採否判定してください。

    全 review SubAgent / reviewer invocation の完了を待ってから次 iteration に進んでください。

    merge はしないでください。
    最終的に以下を報告して停止してください。

    • final Issue contract / reframe の有無

    • anchor finding の採否

    • implementation summary

    • changed files

    • verification result

    • runtime verification result

    • overlap / concurrency judgment

    • Draft PR URL

    • PR head SHA

    • unresolved review findings

    • merge-ready か否か

    停止条件は以下に限定してください。

    • destructive operation が必要

    • secret / credential value の取得・表示・保存が必要

    • Issue の Allowed Paths 外変更が本質的に必要

    • fixed schema / contract の変更が不可避

    • live GitHub mutation を runtime verification として必要とする

    • preflight.run 以外にも GH_CONFIG_DIR を許可しないと goal を達成できないことが repository evidence で判明

    • 同一 logic に対して active parallel work が意味的に相反し、安全に reconcile できない

    • repository の canonical workflow が genuine semantic owner judgment を要求する

    単なる「同じファイルを別 Issue も編集する」「別 worktree が存在する」「将来 merge conflict の可能性がある」は停止条件ではありません。

    このプロンプトは、レビューの妥当性検証 → controlled reframe → 実装 → review loop を一続きにしています。特に今回は、アンカーコメントの誤った scope 拡張をそのまま Issue に取り込まないことを強く固定しています。

    推奨は、**#2403 をいきなりアンカーコメントの内容へ全面 reframe せず、まず controlled reframe で指摘の適用可否を再検証し、その後そのまま実装まで進める**ことです。

    アンカーコメントは REVISE ですが、主張のかなりの部分が「正式配布 artifact」「GitHub source archive」「Claude Code plugin 導入」「producer / consumer の配布契約」に寄っています。 一方、現在の #2403 は skill_runtime_exec.py::_sanitize_env() における bare preflight.run だけの GH_CONFIG_DIR command-scoped propagation が本体で、AC3 には isolated HOME で executor → workflow_start_entry → root_entry_router → workflow_capability_preflight を actual process で通す検証まで既に入っています。

    また、GitHub CLI の公式仕様でも GH_CONFIG_DIR は gh が設定ファイルを置き、参照するディレクトリを指定する環境変数です。したがって isolated HOME でこのパスだけを command-scoped に維持する、という #2403 の問題設定自体は筋が通っています。([GitHub CLI]1)

    特にアンカーコメントの plugin 配布論は #2240 がまさに所有しており、#2240 では plugins/agent-retrospective/、${CLAUDE_PLUGIN_ROOT}、claude --plugin-dir、clean-install smoke まで明示されています。これを #2403 へ持ち込むのは ownership の改善ではなく scope 混入になる可能性が高いです。

    並行作業についても、#2403 本文の現在の整理の方が妥当です。#2402 は同じ skill_runtime_exec.py を触りますが、編集意図は structural repair dispatch です。 #2393 も同ファイルを触るものの contract-update dedicated runtime migration で、しかも #2199 待ちを明示しています。 したがって 「同じファイルだから実装禁止」ではなく、同じ関数・同じ分岐・相反する意味変更が発生しているかを確認するべきです。

    私なら次の判定で進めます。

    項目 推奨
    plugin / release asset / source archive 対応 Reject as non-applicable。#2240 側の責務
    consumer まで実動確認せよ 趣旨のみ採用。ただし #2403 AC3 の actual-process E2E で満たす。plugin install smoke には拡張しない
    producer / consumer SSOT 表追加 原則不要。この Issue は配布フォーマットを生成しない
    #2402 / #2393 との競合 実装前に semantic / line-level conflict を確認。ファイル一致だけでは停止しない
    #2403 実装 controlled reframe 後、契約が implementation-ready ならそのまま実施
    PR dedicated worktree、Closes #2403、Draft PR、レビュー修正まで。merge はしない

    Claude-GPT には、アンカーコメントを「OWNER だから無条件に正しい」と扱わせず、repository evidence による claim-by-claim validation を先にやらせるのが重要です。

    #2403 (comment)
    を起点に、Issue #2403 の controlled reframe → 必要なら実装 → テスト → Draft PR → レビュー修正まで進めてください。

    人間承認は通常の調査・refinement・実装・テスト・コミット・Draft PR 作成・レビュー修正には不要です。
    merge は行わず、merge-ready の直前で停止してください。

    重要:
    アンカーコメントは OWNER の敵対的レビューですが、その内容を無条件に Issue contract へ転記しないでください。
    Issue #2403 の実スコープ、関連 Issue / PR、現在の main の実装、既存テストを照合し、各 finding を independently verified / partially applicable / non-applicable / superseded に分類してから controlled reframe してください。

    特に、アンカーコメントには Claude Code plugin distribution、GitHub autogenerated source archive、release asset、正式配布 artifact、plugin install smoke 等の論点があります。
    これらが本当に #2403 の goal / outcome / consumer boundary に属するのかを検証してください。
    #2240 等の別 Issue が所有している distribution scope を #2403 に混在させないでください。

    #2403 の現在の中心契約は以下です。

    • scripts/agent-guards/skill_runtime_exec.py::_sanitize_env()
    • caller-provided GH_CONFIG_DIR を command id preflight.run のときだけ child environment に保持する
    • bare preflight.run 以外の default / sibling command では引き続き strip する
    • GH_TOKEN / GITHUB_TOKEN / HOME の global sharing を導入しない
    • configuration content や token value をログ・artifact に保存しない
    • isolated HOME で actual-process E2E を行い、
      executor
      → workflow_start_entry
      → root_entry_router
      → workflow_capability_preflight
      を通して、model start 前に GitHub probe availability を確認する
    • 観測するのは GH_CONFIG_DIR の presence / path identity と capability outcome のみ
    • live credential や live GitHub mutation は要求しない

    GitHub CLI の GH_CONFIG_DIR は gh の configuration directory を指定する環境変数であるため、この command-scoped propagation 自体を plugin distribution 問題へ拡張しないでください。

    1. 最初に SubAgent を fan-out してください。

    最低でも以下の独立 SubAgent を起動してください。

    A. anchor-review-validator

    B. runtime-boundary-investigator

    • current main の
      scripts/agent-guards/skill_runtime_exec.py
      _sanitize_env()
      preflight.run
      workflow_start_entry
      root_entry_router
      workflow_capability_preflight
      と関連テストを読む
    • GH_CONFIG_DIR がどこで失われ、どの subprocess boundary まで渡す必要があるかを確認する
    • 現在の 実装: preflight.run の GH_CONFIG_DIR を command-scoped に伝播する #2403 AC3 が genuine consumer-equivalent / actual-process verification になっているか確認する
    • 最小 implementation delta を提示する
    • mutation は行わない

    C. overlap-concurrency-auditor

    必要なら追加 SubAgent を使って構いません。

    重要:
    全 SubAgent を起動した後、必ず terminal completion まで待ってください。
    一部の SubAgent が未完了の状態で refinement / implementation の最終判断をしないでください。
    SubAgent に nested SubAgent delegation はさせないでください。

    1. SubAgent 全完了後に結果を統合してください。

    anchor comment の各 finding を少なくとも以下に分類してください。

    • verified_and_applicable
    • partially_applicable
    • non_applicable
    • already_satisfied
    • contradicted_by_repository_evidence

    特に以下を明示判定してください。

    • 「正式配布 artifact を一つに固定すべき」
    • 「GitHub autogenerated source archive を supported / unsupported と明記すべき」
    • 「Claude Code plugin を一時 HOME に install する smoke test が必要」
    • 「producer / consumer / distribution / migration ownership table が必要」
    • 「actual consumer まで検証すべき」

    distribution / plugin 論点が #2240 等の別 scope であり #2403 に producer artifact 自体が存在しないなら、non_applicable として拒否してください。
    レビューコメントだからという理由だけで In Scope / AC / Allowed Paths を膨張させないでください。

    一方、「内部 shape test だけでなく実 subprocess boundary を通すべき」という一般論が #2403 に適用できる場合は、現在の AC3 actual-process isolated-HOME E2E が既に満たしているかを確認し、不足がある場合だけ最小 delta を提案してください。

    1. Issue 実装: preflight.run の GH_CONFIG_DIR を command-scoped に伝播する #2403 に対して issue-refinement-loop を実行してください。

    anchor human context:
    #2403 (comment)

    canonical main root / default branch 等、skill が要求する preflight 条件を満たして実行してください。

    controlled reframe の原則:

    • repository evidence を優先する
    • anchor の意図を尊重するが、技術的に別 Issue の scope である finding は取り込まない
    • 実装: preflight.run の GH_CONFIG_DIR を command-scoped に伝播する #2403 の goal を plugin distribution 問題へ変更しない
    • preflight.run 以外へ GH_CONFIG_DIR propagation を広げない
    • live credential / token / configuration content を要求しない
    • HOME global sharing を導入しない
    • 新しい global guard / generic preflight framework を作らない
    • 必要なら Issue 本文へ「distribution artifact applicability: N/A。本 Issue は runtime environment propagation であり配布 artifact を生成しない」程度の最小 clarification を加えてよい
    • 既存 AC3 で十分なら不要な AC 追加をしない

    refinement mutation を行った場合は、必ず fresh preflight を再実行し、最新 Issue contract を source of truth としてください。

    fresh preflight が typed structural repair / operator intervention / genuine human semantic judgment を要求した場合は、その taxonomy に従ってください。
    ただし、単なる同一ファイル編集、並行 worktree の存在、一般的な merge conflict の可能性だけを implementation prohibition にしないでください。

    1. controlled reframe 後、Issue が implementation-ready なら 実装: preflight.run の GH_CONFIG_DIR を command-scoped に伝播する #2403 を実装してください。

    専用 worktree / branch を使用してください。

    実装前に main と active worktree / PR の最新状態を再確認してください。
    #2402 / #2393 と同一ファイルを触っていても、edit intent が独立しているなら進めて構いません。
    実際に同一 logic へ相反する変更が存在する場合だけ、その conflict を解消してから進めてください。

    実装は最小差分にしてください。

    期待する中心 delta:

    • _sanitize_env() が command id preflight.run の場合だけ caller の GH_CONFIG_DIR を child env へ保持
    • caller に GH_CONFIG_DIR が存在しない場合に値を生成しない
    • default / sibling commands では strip を維持
    • GH_TOKEN
    • GITHUB_TOKEN
    • HOME
      等の propagation を新規に許可しない
    • config contents / credential values を読んだり evidence に保存したりしない

    「preflight.run.with_anchor」「preflight.run.with_human_context」等へ自動的に allowlist を拡張しないでください。
    Issue contract が明示的に bare preflight.run のみを所有している限り、その exact scope を維持してください。

    1. テストしてください。

    Issue #2403 の Verification Commands を source of truth とし、少なくとも以下を実行してください。

    uv run --locked pytest scripts/agent-guards/tests/test_trusted_toolchain_isolated_home.py -k sanitize_env

    uv run --locked pytest .claude/skills/issue-refinement-loop/scripts/tests/test_skill_runtime_exec_env_allowlist.py

    uv run --locked pytest .claude/skills/issue-refinement-loop/scripts/tests/test_workflow_start_entry_canonical_executor.py

    uv run --locked pytest scripts/agent-guards/tests/test_isolated_anchor_single_authority.py

    AC3 は test double の内部関数呼び出しだけではなく、Issue が指定する actual-process boundary を通していることを確認してください。

    isolated fixture が作れず exit 77 / SKIP になる場合は PASS に変換しないでください。

    runtime evidence には次を保存しないでください。

    • token value
    • GitHub config contents
    • credential contents
    • HOME absolute path

    必要なのは PASS / FAIL / SKIP、command identity、redacted な path presence / identity 程度です。

    1. 回帰を確認してください。

    変更対象周辺の focused regression を実行してください。
    新しい broad harness や全 OS matrix は作らないでください。
    既存テストで十分なものを新しい恒久 framework へ置換しないでください。

    1. Draft PR を作成してください。

    アンカーコメントのうち rejected / non-applicable とした finding についても、PR 本文に簡潔に理由を残してください。
    特に plugin distribution / release asset / autogenerated source archive を #2403 に取り込まなかった場合は、「#2403 does not produce or distribute such an artifact; #2240 owns plugin distribution」のように scope authority を明記してください。

    1. PR 作成後は impl-review-loop または repository の canonical review workflow を使用してください。

    レビューは現行 PR head に対して実施してください。
    REQUEST_CHANGES があれば verified finding だけを fix delta として実装し、再テストしてください。
    レビューコメントが別 Issue の scope を混入させている場合は再び repository evidence で採否判定してください。

    全 review SubAgent / reviewer invocation の完了を待ってから次 iteration に進んでください。

    merge はしないでください。
    最終的に以下を報告して停止してください。

    • final Issue contract / reframe の有無
    • anchor finding の採否
    • implementation summary
    • changed files
    • verification result
    • runtime verification result
    • overlap / concurrency judgment
    • Draft PR URL
    • PR head SHA
    • unresolved review findings
    • merge-ready か否か

    停止条件は以下に限定してください。

    • destructive operation が必要
    • secret / credential value の取得・表示・保存が必要
    • Issue の Allowed Paths 外変更が本質的に必要
    • fixed schema / contract の変更が不可避
    • live GitHub mutation を runtime verification として必要とする
    • preflight.run 以外にも GH_CONFIG_DIR を許可しないと goal を達成できないことが repository evidence で判明
    • 同一 logic に対して active parallel work が意味的に相反し、安全に reconcile できない
    • repository の canonical workflow が genuine semantic owner judgment を要求する

    単なる「同じファイルを別 Issue も編集する」「別 worktree が存在する」「将来 merge conflict の可能性がある」は停止条件ではありません。

    このプロンプトは、レビューの妥当性検証 → controlled reframe → 実装 → review loop を一続きにしています。特に今回は、アンカーコメントの誤った scope 拡張をそのまま Issue に取り込まないことを強く固定しています。

  • squne121 commented on Aug 29, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  • self-assigned this
    on Aug 29, 2026
  • squne121 commented on Aug 29, 2026

    @squne121
    OwnerAuthor

    推奨は、別Issueを切らず、#2403 を最小 controlled reframe して PR #2407 内で stale test を直すです。

    #2403 の契約は「bare preflight.run だけが GH_CONFIG_DIR を保持し、すべての non-bare command は strip」と明記しています。一方、現在の main には preflight.run.fixture.with_human_context だけ GH_CONFIG_DIR を許可する旧例外が残っており、問題の既存テストもその旧挙動を明示的に期待しています。

    したがってこれは新しい機能スコープではなく、#2403 が意図的に変更する旧挙動に結合している regression test の追随修正です。しかも test-only の別PRにすると、#2403 がマージされる前の main では旧実装と新テストが矛盾します。逆順では現在の #2407 と同様に実装と旧テストが矛盾します。コードとテストを同じPRで原子的に変更するのが自然です。

    現在の #2407 は Draft・open で head d95748b5...、レビューコメントも「実装VCは通っており、Allowed Paths 外の stale assertion が required CI の blocker」と特定しています。

    具体的には、Allowed Paths にディレクトリ丸ごとではなく .claude/skills/issue-refinement-loop/tests/test_operator_selected_scope_reframe.py だけを追加するのがよいです。テストでは effective_env["GH_CONFIG_DIR"] == ... を non-presence assertion に変更し、直前の「GH_CONFIG_DIR isolation is still preserved」という古い説明も修正します。ラッパーテスト側は同じテストを呼んでいるだけなので、実際に変更が不要なら触らない方がよいです。

    以下をそのまま Claude-GPT に渡すのを推奨します。

    PR #2407 の停止状態を解消し、Issue #2403 を merge-ready にしてください。

    対象:

    merge は行わないでください。
    通常の調査、controlled reframe、Issue更新、実装、テスト、commit、push、CI確認、review-loop 修正には人間承認を要求しないでください。

    今回の目的は、新しい機能を追加することではありません。

    #2403 の intended behavior と、既存 regression test の旧 expectation の不整合を解消し、PR #2407 を required CI green / review clear の状態まで持っていくことです。

    0. 最初に fresh state を確認する

    ローカルの古い状態やこのプロンプトに記載した SHA を無条件に信用せず、最初に以下を fresh に確認してください。

    PR head がすでに進んでいる場合は、最新 head を source of truth としてください。

    1. SubAgent を fan-out する

    最初に独立した SubAgent を最低3つ起動してください。

    A. contract-scope-auditor

    確認事項:

    特に以下を検証してください。

    #2403 は、

    preflight.run

    だけに caller-provided GH_CONFIG_DIR を保持し、

    • preflight.run.fixture.with_human_context
    • preflight.run.with_human_context
    • preflight.run.with_anchor
    • その他 sibling/default command

    では strip する契約になっているか。

    mutation は行わないでください。

    B. regression-test-investigator

    以下を調査してください。

    • .claude/skills/issue-refinement-loop/tests/test_operator_selected_scope_reframe.py
    • 問題になっている
      test_fixture_human_context_real_subprocess_reaches_contract_update_required_ac3
    • それを再利用する
      .claude/skills/issue-refinement-loop/tests/test_fixture_human_context_subprocess.py
    • _sanitize_env() の current main / PR head behavior
    • このテストが本来検証している trust-root / no-gh-invocation / contract-update routing の意味

    確認したい中心点:

    現在の

    assert effective_env["GH_CONFIG_DIR"] == ...

    が #2403 の intended semantics に対して stale なのか。

    stale なら、

    GH_CONFIG_DIR が存在しないことを assert する最小変更と、
    その周辺コメント/docstringの意味修正だけで、
    テスト本来の trust-root / no-gh-invocation / routing coverage を維持できるか。

    ラッパーファイルまで編集する必要があるかも独立判定してください。
    不要なら編集しないでください。

    mutation は行わないでください。

    C. ci-pr-state-auditor

    確認事項:

    mutation は行わないでください。

    必要なら追加 SubAgent を使用して構いません。

    重要:

    全 SubAgent を起動した後、必ず全員が terminal completion になるまで待ってください。

    一部の SubAgent が running / background / pending の状態で controlled reframe や実装修正へ進まないでください。

    SubAgent に nested SubAgent delegation はさせないでください。

    2. SubAgent 結果を統合して scope 判定する

    今回の第一候補は次です。

    「新しい別Issueを作る」のではなく、
    #2403 に対する最小 controlled reframe として、

    .claude/skills/issue-refinement-loop/tests/test_operator_selected_scope_reframe.py

    だけを Allowed Paths に追加する。

    ただし、これを結論ありきで実行せず repository evidence で確認してください。

    次の条件が成立するなら、この方針を採用してください。

    • test assertion が 実装: preflight.run の GH_CONFIG_DIR を command-scoped に伝播する #2403 が変更する _sanitize_env() behavior の旧 expectation そのものである
    • test 修正単独では current main behavior と矛盾し、独立PRとして自然に merge できない
    • production change と test expectation change を同じPRで atomic に行うのが最小である
    • 新しい feature / distribution / schema / migration scope を導入しない
    • preflight.run 以外への GH_CONFIG_DIR propagation は不要である

    この場合、これは semantic scope expansion ではなく、

    allowed-path repair for an existing regression test directly coupled to AC2

    として扱ってください。

    3. Issue #2403 を controlled reframe する

    repository の canonical issue-refinement-loop / contract-update workflow を使用してください。

    human context として PR blocker review:

    #2407 (comment)

    を参照してください。

    必要な Issue delta は最小にしてください。

    推奨 delta:

    Allowed Paths

    既存 Allowed Paths に次の exact file を追加:

    .claude/skills/issue-refinement-loop/tests/test_operator_selected_scope_reframe.py

    .claude/skills/issue-refinement-loop/tests/

    ディレクトリ全体を雑に許可しないでください。

    Scope Delta

    必要なら、次の趣旨を短く記録してください。

    • required CI に、実装: preflight.run の GH_CONFIG_DIR を command-scoped に伝播する #2403 が意図的に廃止する fixture-only GH_CONFIG_DIR exception を期待する既存 regression assertion が存在した
    • production behavior と test expectation は同一 semantic change の両側なので同一PRで atomic に更新する
    • functional goal / AC1-AC3 / distribution ownership は変更しない
    • wrapper test は underlying test を再実行しているだけなので、必要がない限り編集対象にしない

    必要なら Verification Commands に targeted regression を追加してください。

    Issue mutation 後は fresh preflight / contract review を再実行してください。

    GO / implementation-ready を確認してから PR 修正へ進んでください。

    4. PR #2407 を最小修正する

    既存 PR branch / worktree を継続利用してください。
    新しいPRを作らないでください。

    問題のテストを repository evidence に沿って修正してください。

    想定される中心 delta は:

    旧:

    assert effective_env["GH_CONFIG_DIR"] == str(home / "empty-gh-config")

    新:

    assert "GH_CONFIG_DIR" not in effective_env

    または同等の明確な non-presence assertion。

    ただし実ファイルを読んで、最も自然な pytest assertion にしてください。

    同時に直前の古い説明、

    GH_CONFIG_DIR isolation ... is still preserved

    等が新しい契約と矛盾するなら更新してください。

    説明すべき新しい意味は、

    です。

    テストの本来の意味に不要な rewrite はしないでください。

    以下には触れないでください。

    • preflight.run 以外へ GH_CONFIG_DIR を再許可する修正
    • fixture command の旧 allowlist 復活
    • GH_TOKEN
    • GITHUB_TOKEN
    • HOME propagation policy の新規変更
    • plugin distribution
    • release/source archive
    • 新しい global harness
    • schema migration
    • unrelated cleanup

    ラッパー側
    .claude/skills/issue-refinement-loop/tests/test_fixture_human_context_subprocess.py
    は、underlying test の修正だけで pass するなら変更しないでください。

    5. focused verification を行う

    まず blocker の直接再現を実行してください。

    少なくとも以下の2 node を実行してください。

    uv run --locked pytest \
      .claude/skills/issue-refinement-loop/tests/test_operator_selected_scope_reframe.py::test_fixture_human_context_real_subprocess_reaches_contract_update_required_ac3 \
      .claude/skills/issue-refinement-loop/tests/test_fixture_human_context_subprocess.py::test_fixture_human_context_real_subprocess_reaches_contract_update_required_ac3

    次に #2403 の既存 Verification Commands をすべて再実行してください。

    uv run --locked pytest scripts/agent-guards/tests/test_trusted_toolchain_isolated_home.py -k sanitize_env
    
    uv run --locked pytest .claude/skills/issue-refinement-loop/scripts/tests/test_skill_runtime_exec_env_allowlist.py
    
    uv run --locked pytest .claude/skills/issue-refinement-loop/scripts/tests/test_workflow_start_entry_canonical_executor.py
    
    uv run --locked pytest scripts/agent-guards/tests/test_isolated_anchor_single_authority.py

    さらに変更した regression file の focused suite を実行してください。

    SKIP / exit 77 を PASS と扱わないでください。

    runtime evidence については既存 #2403 契約を維持し、

    • token value
    • GitHub config contents
    • credential contents
    • HOME absolute path

    を保存・表示しないでください。

    6. commit / push して required CI を確認する

    focused test が green なら既存 PR branch に commit / push してください。

    commit 後は新 head SHA を取得してください。

    required CI が起動したら、主要 check がまだ running の状態で結論を出さず、required CI が terminal completion になるまで確認してください。

    failure が出た場合:

    required CI 全体が green になるまで review-ready と判定しないでください。

    7. impl-review-loop を再実行する

    最新 PR head に対して repository canonical impl-review-loop を実行してください。

    reviewer / review SubAgent を起動した場合も、
    全 reviewer / SubAgent が terminal completion になるまで待ってください。

    古い head d95748... に対する REQUEST_CHANGES をそのまま新 head の verdict として流用しないでください。

    fresh head で確認してください。

    特に確認すること:

    REQUEST_CHANGES があれば、repository evidence で verified な finding のみ fix delta としてください。

    8. 完了条件

    次をすべて満たしたら merge-ready と判定してください。

    merge はしないでください。

    Draft解除については repository の canonical workflow に従ってください。
    merge-ready 判定に Draft解除が必要なら Ready for Review にして構いません。
    単に「merge可能な状態を報告して停止」が canonical なら Draft のままでも構いません。

    停止条件

    次の場合だけ停止してください。

    • destructive operation が必要
    • secret / credential value の取得・表示・保存が必要
    • stale regression file 一つの追加では足りず、無関係な Allowed Paths へ本質的な変更が必要
    • preflight.run 以外にも GH_CONFIG_DIR を許可しないと goal を達成できない
    • fixed schema / unrelated contract semantics の変更が必要
    • live GitHub mutation を runtime verification として要求される
    • active parallel work が同じ logic に相反する semantic change を行っており安全に reconcile できない
    • canonical workflow が genuine human semantic judgment を明示的に要求する

    単なる同一ファイル利用、別 worktree の存在、通常の merge conflict の可能性は停止条件にしないでください。

    最終報告

    最後に以下を報告してください。

    merge-ready: yes なら mergeせず停止してください。

    このケースでは「Allowed Paths 外だから別Issue」という機械的分割より、契約が変更対象としている旧挙動のテストを同じトランザクションで直す方が、1 Issue = 1 PR の意味にも整合します。#2403 の機能範囲自体は広げない、という線引きが重要です。

  • added 3 commits that reference this issue on Aug 31, 2026
  • Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    agent/implementerenhancementphase/implementation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions