Skip to content

実装: skill_runtime_exec の trusted uv resolver 失敗時の診断可能性とローカル dev 前提条件明示を改善する #2275

Closed

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "Issue #2251 / PR #2261 で発生した trusted uv resolver の診断可能性ギャップを埋め、ローカル dev 環境での再現手順を明示する"
change_kind: mixed

Parent Issue

none(単独改善)

Parent Goal Ref

  • Goal: なし(単独改善のため親 Issue なし)
  • Desired Destination: なし

Current Validated Scope

  • scripts/agent-guards/skill_runtime_exec.py の _resolve_trusted_executable("uv", ...) が uv_not_found を送出する箇所(uv 専用 lane。git・ssh 等が使う共有 _safe_path_entries() は変更しない)のエラーメッセージ改善。candidates_searched は shutil.which(name, path=safe_entries) へ実際に渡した safe_entries(account-home ~/.local/bin 候補を含む uv 専用候補列)をそのまま使い、再計算しない
  • docs/dev/workflow.md へのローカル dev 前提条件(CI hosted-toolcache lane / system-directory lane / no-sudo user-local lane の区別と exact version installer による復旧手順)の追記

Remaining Parent Gaps

Outcome

scripts/agent-guards/skill_runtime_exec.py の _resolve_trusted_executable("uv", ...) が uv_not_found で fail-closed する際に、shutil.which() へ実際に渡した candidate directory 列(candidates_searched)・pin 済み expected_version・存在有無に関わらず算出される recommended_install_dir(real account home の .local/bin)・remediation_hint を含む構造化 JSON 診断ペイロードを送出するようになり、かつ docs/dev/workflow.md に「CI hosted-toolcache lane・system-directory lane・no-sudo user-local lane を区別した、exact version pin の公式 installer によるローカル復旧手順」が明記された状態。uv 以外の trusted executable(git 等)の {name}_not_found 契約とその探索対象は一切変更しない。

Runtime Verification Applicability

  • decision: not_applicable
  • reason: trust candidate 集合・探索順・version 判定は変更せず、uv_not_found 例外構築とドキュメントだけを変更する。実際に shutil.which へ渡した path と例外 payload の一致は deterministic unit test で完全に検証できるため、fresh launcher session や live canary は要求しない。

In Scope

  • _resolve_trusted_executable("uv", ...) の探索失敗時、uv 分岐内のローカル変数(shutil.which(name, path=...) へ実際に渡した candidate 列。以下 safe_entries と呼ぶ)をそのまま使い、error / candidates_searched / expected_version / recommended_install_dir / remediation_hint を含む JSON を uv_not_found: prefix の後ろに付与した RuntimeError を送出する
    • candidates_searched は safe_entries をそのまま採用し、共有 _safe_path_entries() を呼び直して再計算しない(_safe_path_entries() 自体へ account-home lane を追加しない)
    • recommended_install_dir は real OS account home(pwd.getpwuid(os.getuid()).pw_dir)由来の <home>/.local/bin を、ディレクトリが未作成でも算出する。存在しないディレクトリを candidates_searched へ含めてはならない
    • expected_version は pyproject.toml の [tool.uv].required-version から取得する
  • name != "uv" の場合(git 等)は既存の {name}_not_found 文字列と探索対象を変更しない。account-home lane を非 uv executable の探索対象へ追加しない
  • docs/dev/workflow.md に、trusted uv の探索先を CI hosted-toolcache lane(/opt/hostedtoolcache/uv 等)・system-directory lane・no-sudo user-local lane(Issue 調査: uv trust boundary の sudo 要件を再検討する #2276/fix: no-sudo local-dev 向け trusted uv resolver に standard user-local lane を復元する #2280 で再許可された real account-home ~/.local/bin、pyproject.toml の exact version pin 一致時のみ)に区別して説明する新セクションを追加し、pyproject.toml の pin を取得して公式 versioned installer で UV_INSTALL_DIR を指定してインストールし uv --version で完全一致確認する復旧手順を明記する
  • scripts/agent-guards/tests/test_trusted_toolchain_isolated_home.py(既存ファイル。新規テストファイルは作成しない)に、shutil.which を patch して渡された path と例外 payload を直接比較する次の behavior-level pytest 関数を追加する
    • test_uv_not_found_diagnostic_payload_keys: uv_not_found payload のキー集合(error/candidates_searched/expected_version/recommended_install_dir/remediation_hint)を assert する
    • test_uv_not_found_candidates_searched_matches_safe_entries: candidates_searched が、当該呼び出しで shutil.which(..., path=...) へ実際に渡した candidate 列・順序と完全一致し、ambient PATH や偽 HOME 由来の path を含まないことを assert する
    • test_uv_not_found_recommended_install_dir_without_existing_dir: real-account .local/bin が存在しない fixture でも recommended_install_dir が pwd.getpwuid(os.getuid()).pw_dir/.local/bin を示し、かつ存在しない directory が candidates_searched へ含まれないことを assert する
    • test_non_uv_not_found_unchanged: git 等 name != "uv" の場合に既存の {name}_not_found 文字列が変わらず、account-home lane が探索対象へ追加されないことを assert する

Out of Scope

  • trust boundary の設計変更そのもの。Issue 調査: uv trust boundary の sudo 要件を再検討する #2276(decision record、CLOSED)で決定済み・Issue fix: no-sudo local-dev 向け trusted uv resolver に standard user-local lane を復元する #2280(実装、マージ済み)で実装済みであり、account-home ~/.local/bin は real account home(pwd.getpwuid 由来)かつ exact version pin 一致時のみの no-sudo local-dev lane として既に再許可されている
  • uv 以外の trusted executable 名(git 等)の探索候補・エラーメッセージ変更
  • 新しいカスタム例外クラス・新規 schema・新規 Hook・broker・live canary・診断専用 CLI・新規テストファイルの新設(別ファイルとしての追加)。テストは既存ファイル scripts/agent-guards/tests/test_trusted_toolchain_isolated_home.py への関数追加のみで完結させる
  • security-hardening 系 PR 全般への汎用レビューチェックリスト項目追加(candidate 集合・探索順・HOME 由来・version validation を変更しない本 Issue の変更範囲では runtime verification は not_applicable であり、live smoke 要求を新設しない)

Acceptance Criteria

  • AC1: _resolve_trusted_executable("uv", ...) が探索失敗した場合、uv_not_found: prefix に続く JSON payload を返し、キー集合に error・candidates_searched・expected_version・recommended_install_dir・remediation_hint を含む。test_uv_not_found_diagnostic_payload_keys がこれを assert する
  • AC2: candidates_searched は、当該呼び出しで shutil.which(..., path=...) へ渡した directory 列と順序を完全一致で含む。ambient PATH や env-spoofed HOME 由来の path は含まれない。test_uv_not_found_candidates_searched_matches_safe_entries がこれを assert する
  • AC3: real-account .local/bin が存在しない場合も recommended_install_dir は pwd.getpwuid(os.getuid()).pw_dir/.local/bin を示す。一方、存在しない directory を candidates_searched へ虚偽記載しない。test_uv_not_found_recommended_install_dir_without_existing_dir がこれを assert する
  • AC4: git 等の非 uv executable については、既存の {name}_not_found 文字列を変更せず、account-home lane を探索対象へ追加しない。test_non_uv_not_found_unchanged がこれを assert する
  • AC5: docs/dev/workflow.md の既存 trusted-uv 説明付近へ、CI hosted-toolcache lane・system-directory lane・no-sudo user-local lane を区別した復旧節(見出し ### Trusted uv のローカル開発復旧)を追加し、exact version の公式 installer による導入・version 確認を記載する
  • AC6: 既存の resolver 関連 pytest(test_trusted_toolchain_isolated_home.py / test_skill_runtime_control_plane_exec.py)と、AC1〜AC4 で追加した 4 つの diagnostic behavior test 関数が、ファイル全体実行で PASS する(AC1〜AC4 の VC は関数の存在のみを確認するため、実際の assertion 成立は本 AC6 の全体実行 PASS が担保する)

Verification Commands

# AC1
$ rg -n "^def test_uv_not_found_diagnostic_payload_keys" scripts/agent-guards/tests/test_trusted_toolchain_isolated_home.py
# AC2
$ rg -n "^def test_uv_not_found_candidates_searched_matches_safe_entries" scripts/agent-guards/tests/test_trusted_toolchain_isolated_home.py
# AC3
$ rg -n "^def test_uv_not_found_recommended_install_dir_without_existing_dir" scripts/agent-guards/tests/test_trusted_toolchain_isolated_home.py
# AC4
$ rg -n "^def test_non_uv_not_found_unchanged" scripts/agent-guards/tests/test_trusted_toolchain_isolated_home.py
# AC5
$ rg -n '^### Trusted uv のローカル開発復旧' docs/dev/workflow.md
# AC6
# baseline-expect: pass
$ uv run --locked pytest scripts/agent-guards/tests/test_trusted_toolchain_isolated_home.py scripts/agent-guards/tests/test_skill_runtime_control_plane_exec.py -q

Allowed Paths

  • scripts/agent-guards/skill_runtime_exec.py
  • scripts/agent-guards/tests/test_trusted_toolchain_isolated_home.py
  • docs/dev/workflow.md
  • scripts/agent-guards/trusted_runtime_capabilities.py
  • scripts/agent-guards/tests/test_trusted_runtime_capability_preflight.py
  • scripts/claude-gpt/workflow_capability_preflight.py
  • scripts/claude-gpt/tests/test_workflow_capability_preflight.py
  • scripts/agent-guards/tests/test_skill_runtime_control_plane_exec.py
  • docs/dev/claude-gpt-runtime-prerequisites.md

Stop Conditions

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

Required Skills

なし

Required Design References

Scope Delta(任意)

【2026-08-23 更新(人間 REQUEST_CHANGES、PR #2314 comment 反映)】Draft PR #2314 に対する人間 REQUEST_CHANGES を受け、以下の理由で Allowed Paths を拡張する(fix_delta iteration、マージ前の追加変更)。

  • P1-1(consumer 契約漏れ): PR 本文は _resolve_trusted_executable() の呼び出し元を本モジュール内 _resolve_child_argv のみと主張していたが誤り。scripts/agent-guards/trusted_runtime_capabilities.py の check_trusted_uv() が resolver を直接呼び、RuntimeError を捕捉して str(exc) を reason に格納し、scripts/claude-gpt/workflow_capability_preflight.py がそれを CLAUDE_GPT_WORKFLOW_CAPABILITIES_V1.checks.uv.reason へ投影する実 consumer 経路が存在する。今回の診断ペイロード変更のままだと reason が二重 JSON エンコードになるため、wrapper 側で prefix を剥がして JSON を parse し、reason は安定した reason code 文字列のまま、diagnostic を別フィールドとして伝播させる修正が必要。これに伴い scripts/agent-guards/trusted_runtime_capabilities.py / scripts/agent-guards/tests/test_trusted_runtime_capability_preflight.py / scripts/claude-gpt/workflow_capability_preflight.py / scripts/claude-gpt/tests/test_workflow_capability_preflight.py / scripts/agent-guards/tests/test_skill_runtime_control_plane_exec.py を Allowed Paths へ追加する。
  • P2-1(SSOT 分裂): workflow_capability_preflight.py の blocked reason は docs/dev/claude-gpt-runtime-prerequisites.md へ案内するが、詳細復旧手順は本 Issue で docs/dev/workflow.md に追加された。両文書が分裂しないよう、runtime prerequisites 文書から docs/dev/workflow.md の該当セクションへのリンクを追加する。これに伴い docs/dev/claude-gpt-runtime-prerequisites.md を Allowed Paths へ追加する。

本 Scope Delta は In Scope の固定契約(キー集合・スキーマ・型定義)を変更するものではなく、既存 consumer 経路との整合性確保と SSOT リンク追加に限定する(P1-2/P1-3/P2-2 は既存 Allowed Paths 内 docs/dev/workflow.md / scripts/agent-guards/tests/test_trusted_toolchain_isolated_home.py で完結する)。

Notes for Reviewer

Activity

  1. added
    enhancement
    phase/implementation
    triage-required
    agent/implementer
    on Aug 21, 2026
  2. squne121 commented on Aug 21, 2026

    @squne121
    OwnerAuthor

    Issue #2276(decision record、CLOSED)で trust boundary の決定が確定し、Issue #2280(実装 PR #2281、マージ済み)で account-home ~/.local/bin(real OS account home、pwd.getpwuid 由来、exact version pin 一致時のみ)が no-sudo local-dev 向け positive lane として再許可されました。本 Issue の前提(system dir 限定が妥当)はこの決定により更新が必要だったため、Outcome / Remaining Parent Gaps / In Scope / Out of Scope / Notes for Reviewer を整合化しました。AC1〜AC5・Allowed Paths・実装スコープ(診断可能性ギャップの解消のみ)自体は変更していません。

  3. squne121 commented on Aug 23, 2026

    @squne121
    OwnerAuthor

    判定

    REQUEST_CHANGES — 実装着手前に Issue #2275 の契約を修正すべきです。

    目的である「uv_not_found を自己解決可能なエラーにする」こと自体は有用です。ただし現行 Issue は、更新後の resolver 実装とACが噛み合っておらず、現在のままでも一部ACが偽陽性で通ります。また、Issueを字面どおり実装すると、PR #2281で一度発生した「user-local lane が git 等へ波及する回帰」を再誘発し得ます。

    Issueを閉じたり分割したりする必要はありません。Issue本文をin-placeで修正し、productionコード・既存テスト・短いドキュメントの3ファイルだけで完結させるのが妥当です。調査基準は main bad2b5b3ccae46da3ea0b4050feed1a974346f7c です。


    敵対的レビュー所見

    P1-1 — candidates_searched の取得元が現行実装と違う

    Issueは、candidates_searched に「_safe_path_entries() が返す探索済みcandidate directory一覧」を入れる契約です。ところが現在の実装では、uvだけが次の専用候補列を組み立てています。

    1. hosted toolcache
    2. real OS account home由来の ~/.local/bin
    3. system standard directories

    共有の _safe_path_entries() は、git・ssh等にも利用されるため、account-home ~/.local/bin を意図的に含みません。shutil.which()へ実際に渡しているのは、uv分岐内のローカル変数 safe_entries です。

    したがってIssueをそのまま実装すると、次のどちらかになります。

    • _safe_path_entries()を診断に使い、実際には探索したreal-account ~/.local/binが診断から欠落する
    • _safe_path_entries()側へaccount-home laneを入れ、git・sshにもuser-local pathを波及させる

    後者は、PR #2281の初期実装で実際に発見された回帰です。account-homeを共有PATHへ追加した結果、version pinのない偽gitが選択され得るため、最終的にuv専用laneへ修正されています。

    修正要件: candidates_searched は再計算せず、shutil.which(name, path=safe_path)へ渡した、その場のsafe_entriesをそのまま使うこと。診断強化はname == "uv"だけに限定し、git_not_found等の非uvエラーは変更しないこと。


    P1-2 — AC1〜AC4が「機能」ではなく「単語の存在」しか検証していない

    AC1とAC2は、productionコード内にcandidates_searched、remediation_hintという文字列があるかをrgするだけです。未使用変数、コメント、到達不能コードでもPASSします。Issue自身も、この2識別子を「決定論的検証のためのマーカー」としています。

    さらにAC3は次のgrepだけです。

    rg -n "/opt/hostedtoolcache/uv" docs/dev/workflow.md

    しかし現在のdocs/dev/workflow.mdは、既存のControlled / Not Controlled説明内ですでに/opt/hostedtoolcache/uvへ言及しています。つまり、#2275を一切実装していない現在のmainでもAC3はPASSします。

    既存テストも診断内容を検証していません。例えばfake HOMEのテストは、環境依存でuv_not_foundまたはuv_version_mismatchのどちらかなら受理し、候補列・hint・version・install先を一切assertしていません。

    修正要件: grep ACをbehavior-level pytestへ置き換えること。最低限、例外を実際に発生させ、構造化payloadをparseして内容をassertする必要があります。


    P1-3 — テストファイルをAllowed Pathsから除外しており、正しさを証明できない

    Issueは「新規pytestテストファイルを追加しない」だけでなく、Allowed Pathsに既存テストファイルも含めていません。その一方で、既存テストの再実行だけをAC5としています。

    これでは次を証明できません。

    • candidates_searchedが実際にshutil.which()へ渡したPATHと一致する
    • candidate順序が保持される
    • ambient PATHや偽HOMEが混入していない
    • account-home laneがuvにだけ存在する
    • git_not_found等の既存エラー契約が変わっていない

    Pythonのshutil.which(cmd, path=...)は、明示されたpath内を探索します。したがってテストではshutil.whichをpatchし、渡されたpathと例外payloadを直接比較するのが最も単純で正確です。([Python documentation]1)

    修正要件: 新しいテスト基盤は不要です。既存の次のファイルだけをAllowed Pathsへ追加してください。

    scripts/agent-guards/tests/test_trusted_toolchain_isolated_home.py
    

    P1-4 — remediationがno-sudo決定と衝突し、別の行き止まりを作る

    Issue本文ではremediation_hintとして「system標準ディレクトリへtrusted executableを配置する」案内を要求しています。しかし#2276は、開発エージェントへsudoを要求しないことを固定制約とし、PR #2281でreal-account ~/.local/binをcanonical no-sudo local-dev laneとして復元しています。

    また、/opt/hostedtoolcacheはGitHub-hosted runnerのtool cacheであり、一般的なローカルLinux環境の「system標準インストール先」ではありません。([GitHub Docs]2)

    Astral公式のuv installerは、user executable directoryへのインストール、versionを含めたinstaller URL、UV_INSTALL_DIRによる配置先指定を提供しています。リポジトリ側は[tool.uv].required-version = "==0.11.29"を正本としており、required-version不一致時はuv自身も実行を拒否します。 ([Astral Docs]3)

    したがってローカル向けの第一案内は、次であるべきです。

    • real OS account home由来の<home>/.local/bin
    • pyproject.tomlから取得したexact version
    • 公式versioned installer
    • インストール後のuv --version完全一致確認
    • sudo不要

    /opt/hostedtoolcache/uvはCI laneとして別枠で説明し、ローカル開発者へ作成を求めるべきではありません。


    P2-1 — 「探索した場所」と「推奨インストール先」は別フィールドが必要

    現行 _trusted_account_home_uv_dir() は、real account homeの.local/binディレクトリがすでに存在する場合だけ候補として返します。ディレクトリ自体がまだない初回セットアップ失敗では、candidates_searchedに.local/binは入りません。

    そのため、candidates_searchedだけでは復旧先を示せません。

    診断payloadは少なくとも次を分離すべきです。

    {
      "error": "uv_not_found",
      "candidates_searched": [],
      "expected_version": "0.11.29",
      "recommended_install_dir": "/home/<user>/.local/bin",
      "remediation_hint": "..."
    }
    • candidates_searched: 実際にwhichへ渡した探索列
    • recommended_install_dir: ディレクトリが存在しなくても算出するreal-account user-local path
    • expected_version: pyproject.tomlから取得したpin

    これ以上のreason taxonomyや新規schemaは不要です。


    P2-2 — 汎用的な「security-hardening PRのローカルsmoke」追加は重複ハーネスになる

    AC4は、security-hardening系PRのレビューチェックリストへ「ローカル dev 環境でのスモークテスト」を追加する要求です。しかしdocs/dev/workflow.mdにはすでにAvailability Invariantがあり、trust boundaryやisolationを変更するdeliveryには、fresh isolated sessionからcanonical positive workflowを実証するよう要求しています。

    #2275は候補集合・順序・trust判定を変更せず、エラー文字列とdocsだけを変更するIssueです。runtime verification policy上も、unit testで完結する変更はnot_applicableにできます。

    したがってAC4は次のいずれかにすべきです。

    • 推奨: AC4自体を削除する
    • 残す場合: candidate集合、探索順、HOME由来、version validationを変更するPRだけに限定する

    単に「security-hardening」という広い分類へ追加すると、診断文言変更やdocs修正までlive smoke対象と解釈され、人間・エージェント双方の作業を不必要に止めます。


    P2-3 — goal_ref の参照が誤っている

    goal_refは「PR #2251」と記載していますが、#2251はIssueであり、実装PRは#2261です。#2276では同じ参照誤りがすでに訂正されています。

    次へ修正すべきです。

    goal_ref: "Issue #2251 / PR #2261 で発生した trusted uv resolver の診断可能性ギャップを..."

    推奨する最小実装

    新しいcustom exception、schema、Hook、broker、live canary、診断専用CLIは不要です。jsonはすでにproductionモジュールでimportされています。

    既存のuv_not_found prefixを維持し、その後ろへJSONを付ける程度で十分です。

    if not resolved:
        if name != "uv":
            # 非 uv の既存契約は変更しない
            raise RuntimeError(f"{name}_not_found")
    
        account_home = _os_account_home()
        recommended_install_dir = (
            os.path.join(account_home, ".local", "bin")
            if account_home
            else None
        )
    
        diagnostic = {
            "error": "uv_not_found",
            # shutil.which に実際に渡した候補をそのまま使用する
            "candidates_searched": safe_entries,
            "expected_version": _required_uv_version(project_root),
            "recommended_install_dir": recommended_install_dir,
            "remediation_hint": (
                "Install the exact pyproject.toml [tool.uv].required-version "
                "into the real OS account user-local bin directory, verify "
                "`uv --version`, then retry."
            ),
        }
    
        raise RuntimeError(
            "uv_not_found: "
            + json.dumps(diagnostic, ensure_ascii=False, sort_keys=True)
        )

    重要なのは、候補をもう一度helperから再構築しないことです。whichへ渡したsafe_entriesと診断payloadは同じオブジェクトを正本にします。

    ドキュメント側の復旧手順は、概ね次の形で足ります。version literalを文書へ二重管理せず、pyproject.tomlから取得します。

    required_uv="$(
      python3 - <<'PY'
    import pathlib
    import tomllib
    
    data = tomllib.loads(pathlib.Path("pyproject.toml").read_text(encoding="utf-8"))
    pin = data["tool"]["uv"]["required-version"]
    if not pin.startswith("=="):
        raise SystemExit(f"required-version is not an exact pin: {pin}")
    print(pin[2:])
    PY
    )"
    
    account_home="$(
      python3 - <<'PY'
    import os
    import pwd
    
    print(pwd.getpwuid(os.getuid()).pw_dir)
    PY
    )"
    
    curl -LsSf "https://astral.sh/uv/${required_uv}/install.sh" \
      | env UV_INSTALL_DIR="${account_home}/.local/bin" sh
    
    test "$("${account_home}/.local/bin/uv" --version)" = "uv ${required_uv}"

    この手順は、resolverと同じpwd.getpwuid(os.getuid())由来のhomeを使い、sudoや/opt/hostedtoolcacheの手動構築を要求しません。公式installerのversion指定とinstall directory指定を利用する構成です。([Astral Docs]3)


    修正版Acceptance Criteria案

    Acceptance Criteria

    • AC1: _resolve_trusted_executable("uv", ...)が探索失敗した場合、uv_not_found: prefixに続くJSON payloadを返し、キー集合にerror、candidates_searched、expected_version、recommended_install_dir、remediation_hintを含む。
    • AC2: candidates_searchedは、当該呼び出しでshutil.which(..., path=...)へ渡したdirectory列と順序を含めて完全一致する。ambient PATHやenv-spoofed HOME由来のpathは含まれない。
    • AC3: real-account .local/binが存在しない場合も、recommended_install_dirはpwd.getpwuid(os.getuid()).pw_dir/.local/binを示す。一方、存在しないdirectoryをcandidates_searchedへ虚偽記載しない。
    • AC4: git等の非uv executableについては、既存の{name}_not_found文字列を変更せず、account-home laneを探索対象へ追加しない。
    • AC5: docs/dev/workflow.mdの既存trusted-uv説明付近へ、CI hosted-toolcache lane、system-directory lane、no-sudo user-local laneを区別した短い復旧節を追加し、exact versionの公式installerによる導入・version確認を記載する。
    • AC6: 既存のresolver関連pytestと、新規diagnostic behavior testがPASSする。

    Allowed Paths

    scripts/agent-guards/skill_runtime_exec.py
    scripts/agent-guards/tests/test_trusted_toolchain_isolated_home.py
    docs/dev/workflow.md
    

    Runtime Verification Applicability

    decision: not_applicable
    reason: >
      trust candidate集合・探索順・version判定は変更せず、
      uv_not_found例外構築とドキュメントだけを変更する。
      実際にshutil.whichへ渡したpathと例外payloadの一致は
      deterministic unit testで完全に検証できるため、
      fresh launcher sessionやlive canaryは要求しない。

    Verification Commands

    uv run --locked pytest \
      scripts/agent-guards/tests/test_trusted_toolchain_isolated_home.py \
      -k "uv_not_found_diagnostic or non_uv_not_found" -v
    uv run --locked pytest \
      scripts/agent-guards/tests/test_trusted_toolchain_isolated_home.py \
      scripts/agent-guards/tests/test_skill_runtime_control_plane_exec.py \
      -q
    rg -n '^### Trusted uv のローカル開発復旧' docs/dev/workflow.md

    結論

    現行Issueをそのまま実装するのは不適切です。問題はセキュリティ不足ではなく、現行コードと契約の不一致、偽陽性AC、診断behavior testの欠落です。

    採るべき方針は次です。

    • Issue #2275をin-placeで修正する
    • 診断はuvだけに限定する
    • 実際にwhichへ渡した候補列を正本にする
    • exact versionとno-sudo user-local install先を示す
    • 既存テストファイルへdeterministic testを追加する
    • 汎用Hook、schema、live canary、sudo、専用toolchain storeは追加しない
    • 重複する「全security-hardening PR向けsmoke checklist」は削除する

    これなら個人趣味開発の作業速度を落とさず、uv_not_foundが発生したときに、人間とAIエージェントの双方が一回で復旧できます。

  4. squne121 commented on Aug 23, 2026

    @squne121
    OwnerAuthor

    issue-refinement-loop: approved

    OWNER のアドバーサリアルレビュー(https://github.com/squne121/loop-protocol/issues/2275#issuecomment-5383794422)を反映し、Issue 本文を in-place で修正しました。

    反映内容

    1. goal_ref の誤参照(PR fix: trusted uv resolver から account-home .local/bin を除外し CWE-427 search-selection risk を縮小する #2251 → 正しくは Issue fix: trusted uv resolver から account-home .local/bin を除外し CWE-427 search-selection risk を縮小する #2251 / PR fix: trusted uv resolver から account-home .local/bin を除外し CWE-427 search-selection risk を縮小する (#2251) #2261)を修正
    2. candidates_searched の取得元を、共有 _safe_path_entries() の再計算ではなく uv 分岐が実際に shutil.which() へ渡す safe_entries(ローカル変数)に固定し、PR fix: no-sudo local-dev 向け trusted uv resolver に standard user-local lane を復元する #2281 で一度発生した「user-local lane が git/ssh へ波及する回帰」の再誘発を防止
    3. recommended_install_dir(推奨インストール先、ディレクトリ未作成でも算出)と candidates_searched(実際に探索した場所)を分離
    4. 旧 AC1〜AC3 の識別子・文字列存在確認(rg)のみの検証を、既存テストファイル scripts/agent-guards/tests/test_trusted_toolchain_isolated_home.py への 4 つの named behavior-level pytest 関数追加 + 全体実行 PASS(AC6)による二層構成へ置換(新規テストファイルは作成しない)
    5. remediation_hint の第一案内を、no-sudo 制約(調査: uv trust boundary の sudo 要件を再検討する #2276)と矛盾する system 標準ディレクトリ案内から real OS account home 由来の ~/.local/bin への exact version installer 導入案内へ修正
    6. security-hardening 全般への汎用スモークテスト追加要求(旧 AC4)を削除。本 Issue は candidate 集合・探索順・trust 判定を変更しないため Runtime Verification Applicability は not_applicable のまま
    7. Allowed Paths へ scripts/agent-guards/tests/test_trusted_toolchain_isolated_home.py を追加

    検証

    • 決定論的 review パイプライン(run_root_review_pipeline.py produce): VERDICT: approve(blockers 0)
    • issue-contract-review(run_contract_review_once.py): status: go(vc_preflight_status: pass、baseline 5件 expected_fail・1件 expected_pass の想定通りの分布)
    • 最終 body_sha256: sha256:125aa243012a35ccdaa364d5bb35e58e5bdfa614143d7c318cde3d86cd864d2b

    Final Gate: passed(CONTRACT_REVIEW_RESULT_V1.status == go を実際に確認した通常経路)

    LOOP_HANDOFF_RESULT_V1:
      status: impl_ready
      routing_action: run_impl_review_loop
      contract_review:
        status: go
        gate_result: fresh_go
        latest_comment_url: null
        generated_at: "2026-08-23T02:40:34Z"
        body_sha256: "sha256:125aa243012a35ccdaa364d5bb35e58e5bdfa614143d7c318cde3d86cd864d2b"
      metadata:
        title_prefix_ready: true
      label_sync_observation:
        kind: presentation_sync
        result: noop
        detail: "label mutation not performed in this loop run"
      auto_fixes:
        result: auto_fixed
        required: []
        skipped: []
      blockers: []
      permissions:
        unavailable: []
      generated_at: "2026-08-23T02:41:00Z"
      checked_body_sha256: "sha256:125aa243012a35ccdaa364d5bb35e58e5bdfa614143d7c318cde3d86cd864d2b"
      checker_exit_code: 0
      missing_sections: []
      missing_contract_keys: []
    FOLLOW_UP_MATERIALIZATION_RESULT_V1:
      schema_version: 1
      materialized_by: issue-refinement-loop
      follow_up_issues: []
      note_only_observations: []
  5. squne121 commented on Aug 23, 2026

    @squne121
    OwnerAuthor

    root-owned entry router audit

    route: invoke_impl_review_loop
    reason: fresh_review_go_live_equality

  6. squne121 commented on Aug 23, 2026

    @squne121
    OwnerAuthor

    implement-issue: 実装完了

    IMPLEMENT_RESULT_V1:
      status: ok
      generated_at: 2026-08-23T00:00:00Z
      generated_by: implement-issue
      issue_url: https://github.com/squne121/loop-protocol/issues/2275
      pr_url: https://github.com/squne121/loop-protocol/pull/2314
      worktree: .claude/worktrees/issue-2275-trusted-uv-diagnostics
      branch: worktree-issue-2275-trusted-uv-diagnostics
      verification:
        typecheck: not_applicable
        lint: not_applicable
        test:
          passed: 66
          failed: 0
          files: 2
        build: not_applicable
      allowed_paths_compliance: true
      warnings:
        - "Python-only変更のため pnpm typecheck/lint/test/build は対象外(scripts/agent-guards/** と docs/dev/workflow.md のみ変更)"
      errors: []
    • PR: fix: uv_not_found 診断可能性とローカル dev 復旧手順を追加する #2314
    • Worktree: .claude/worktrees/issue-2275-trusted-uv-diagnostics
    • Branch: worktree-issue-2275-trusted-uv-diagnostics
    • Verification: uv run --locked pytest scripts/agent-guards/tests/test_trusted_toolchain_isolated_home.py scripts/agent-guards/tests/test_skill_runtime_control_plane_exec.py -q → 66 passed
    • AC1-AC5 rg VC: 全て PASS 確認済み
    • Allowed Paths: scripts/agent-guards/skill_runtime_exec.py / scripts/agent-guards/tests/test_trusted_toolchain_isolated_home.py / docs/dev/workflow.md の3ファイルのみ変更(git diff --stat で確認)
    • 後続: PR レビュー(pr-review-judge)→ マージ → post-merge-cleanup
  7. self-assigned this
    on Aug 23, 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/implementationtriage-required

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions