Skip to content

実装: Claude-GPT isolated session の minimum control-plane capability を保証する(uv toolchain resolution + credentialless GitHub read) #2241

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "Claude-GPT isolated session から canonical control-plane preflight が uv toolchain 解決と GitHub read の両方で bootstrap/authentication 理由により停止しない状態を作る"
change_kind: mixed

Parent Issue

none

Parent Goal Ref

Current Validated Scope

  • scripts/agent-guards/skill_runtime_exec.py の trusted toolchain resolution ロジックを isolated HOME から分離する
  • Claude-GPT isolated session から credential なしで public GitHub Issue read を成立させる経路を追加する
  • docs/dev/workflow.md に Availability Invariant を追加する

Remaining Parent Gaps

  • なし(単独 Issue のため親 Issue に残る gap はない)

Outcome

scripts/agent-guards/skill_runtime_exec.py の trusted executable resolver が isolated HOME と結合しない generic な trust root 解決に変更され、Claude-GPT isolated session からの credentialless public GitHub Issue read 経路が追加され、docs/dev/workflow.md に Availability Invariant が追加された状態で、fresh Claude-GPT isolated session から HOME override や manual cache delete なしに preflight.run.with_human_context 相当の control-plane command が bootstrap/authentication 理由では停止せず完走し、その実行ログが証跡として記録されている状態。

Runtime Verification Applicability

decision: immediate
reason: "isolated HOME 下での uv toolchain 解決と credentialless GitHub read の成立は静的検証だけでは確認できず、fresh isolated Claude-GPT session からの実地実行によって証明する必要があるため"
applicable_acs:
  - AC5
execution_environment:
  cli_tools:
    - claude
    - uv
    - python3
  auth_required: false
  network_required: true
skip_conditions:
  - "claude-gpt launcher / herdr capability が実行環境に存在しない場合は SKIP(exit 77) とし PASS へ昇格しない"
fallback_policy:
  fallback_success_is_pass: false
  notes: "HOME override や manual cache delete を用いた fallback 経由の成功は FAIL として扱い PASS に変換しない"
artifact_requirements:
  - "artifacts/runtime-smoke/claude-structured/summary.md"

isolated HOME 下での uv toolchain 解決と credentialless GitHub read の成立は、静的検証だけでは確認できず、fresh isolated Claude-GPT session からの実地実行(worktree-agent-runtime-smoke 経由)によって証明する必要があるため decision: immediate とする。

In Scope

  • scripts/agent-guards/skill_runtime_exec.py の _safe_path_entries() / _trusted_uv_toolcache_dirs() / _resolve_trusted_executable() を変更し、trust root を isolated HOME(Path.home())から独立した経路(例: pwd.getpwuid(os.getuid()).pw_dir ベースの OS アカウント home、または launcher が明示的に渡す固定パス)で解決するようにする
  • _trusted_uv_toolcache_dirs() を uv 専用ハードコードから generic な _trusted_toolchain_dirs(executable_name) 相当へ一般化する
  • symlink/copy を採用する場合、realpath 解決・regular-file type 検証・trust root 配下の commonpath 検証・version 照合・ownership(uid) 検証を実装する
  • Claude-GPT isolated session から、host GH_TOKEN/GITHUB_TOKEN/GH_CONFIG_DIR を child 環境へ一切露出せずに、public GitHub Issue(squne121/loop-protocol)の canonical read を成立させる credentialless public REST GET 経路を追加する(認証ヘッダを一切付与しない)
  • docs/dev/workflow.md に Availability Invariant(security/isolation 強化変更は同一 delivery で最低1つの canonical positive workflow を fresh isolated session から実証しなければならない旨)を追加する
  • .claude/rules/project-constitution.md の「必須検証」節から上記 Availability Invariant への一行リンクを追加する
  • 上記変更に対応する pytest テスト(positive/negative 両方)を追加する
  • worktree-agent-runtime-smoke skill 等を用いた fresh isolated Claude-GPT session からの end-to-end positive control 実行ログを取得し、PR に証跡として添付する
  • .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py の _fetch_issue() / _fetch_issue_comments() を、isolated profile では新規 credentialless transport(github_credentialless_read.py の list_issue_comments() 等)経由に接続し、gh CLI へフォールバックしないようにする。gh executable を marker executable に差し替えても一度も起動されないことを behavioral test で証明する

Out of Scope

Acceptance Criteria

  • AC1: isolated HOME(claude-gpt launcher が設定する isolated HOME のまま、HOME override なし)で _resolve_trusted_executable("uv", ...) が uv の解決に成功する
  • AC2: host credential(GH_TOKEN/GITHUB_TOKEN/host GH_CONFIG_DIR の実値)が Claude-GPT child のプロセス環境変数・stdout・artifact のいずれにも一切出現しない
  • AC3: public GitHub Issue(squne121/loop-protocol 上の実在 Issue)の canonical read が、認証ヘッダなしで成立する
  • AC4: cross-repository(squne121/loop-protocol 以外)への read/write が発生せず、GET 以外の HTTP method(POST/PATCH/DELETE)を発行する経路がコード上に存在しない
  • AC5: HOME override や manual cache delete を一切使わずに、fresh Claude-GPT isolated session からの起動で preflight.run.with_human_context 相当の control-plane command が bootstrap/authentication 理由では停止せず完走する
  • AC6: 既存の fail-closed adversarial test(trust-path 外 symlink 差し替え等を block する既存/新規 harness)が引き続き block を維持する回帰確認が PASS する
  • AC7: docs/dev/workflow.md に Availability Invariant セクションが追加されている
  • AC8: isolated profile で run_refinement_preflight.py の Issue/comments 取得が credentialless transport 経由になり、gh executable を marker executable に差し替えても一度も起動されないことが behavioral test で証明される

Verification Commands

# AC1
$ uv run --locked pytest scripts/agent-guards/tests/test_trusted_toolchain_isolated_home.py::test_resolve_trusted_executable_uv_succeeds_under_isolated_home -v
# AC2
$ uv run --locked pytest scripts/agent-guards/tests/test_credentialless_github_read.py::test_sanitized_env_excludes_host_github_credentials -v
# AC3
$ uv run --locked pytest scripts/agent-guards/tests/test_credentialless_github_read.py::test_credentialless_public_issue_read_succeeds -v
# AC4
$ uv run --locked pytest scripts/agent-guards/tests/test_credentialless_github_read.py::test_credentialless_read_rejects_cross_repository_and_mutation_methods -v
# AC5
# preflight-scope: runtime_only
$ uv run --locked python3 scripts/agent-ops/run_worktree_agent_runtime_smoke.py --runtime claude --mode structured --worktree "$WORKTREE" --prompt-file tmp/runtime-smoke/claude-gpt-preflight.md --output-dir artifacts/runtime-smoke/claude-structured --timeout-seconds 180 --require-clean-postcondition
# AC6
$ uv run --locked pytest scripts/agent-guards/tests/test_skill_runtime_control_plane_exec.py -k test_sanitized_git_subprocess_env_path_is_trusted_allowlist_not_inherited -v
# AC7
$ rg -n "Availability Invariant" docs/dev/workflow.md
# AC8
$ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_run_refinement_preflight_credentialless_transport.py::test_isolated_profile_never_invokes_gh_marker_executable -v

Notes for Reviewer

Scope Collision (C1) preflight(check_issue_overlap.py)で scripts/agent-guards/skill_runtime_exec.py / docs/dev/workflow.md / scripts/claude-gpt/launch.sh / scripts/claude-gpt/lib.sh 等が以下の既存 OPEN Issue と Allowed Paths 文字列レベルで重複ヒットした(#1860 Owner Decision により advisory・起票停止理由にしない):

Allowed Paths

  • scripts/agent-guards/skill_runtime_exec.py
  • scripts/agent-guards/github_credentialless_read.py
  • scripts/agent-guards/tests/test_skill_runtime_preflight_bytecode_cache.py
  • scripts/agent-guards/tests/test_skill_runtime_control_plane_exec.py
  • scripts/agent-guards/tests/test_trusted_toolchain_isolated_home.py
  • scripts/agent-guards/tests/test_credentialless_github_read.py
  • scripts/claude-gpt/launch.sh
  • scripts/claude-gpt/lib.sh
  • docs/dev/workflow.md
  • .claude/rules/project-constitution.md
  • .claude/skills/issue-refinement-loop/tests/test_operator_selected_scope_reframe.py
  • .claude/skills/issue-refinement-loop/tests/test_fixture_human_context_subprocess.py
  • .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py
  • .claude/skills/issue-refinement-loop/tests/test_run_refinement_preflight_credentialless_transport.py

Stop Conditions

  • Allowed Paths 外の変更が必要と判明した場合
  • In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
  • 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
  • 後続 Phase / 別スコープへの波及が判明した場合
  • nested SubAgent delegation が必要になった場合
  • 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合。特に、認証済み GitHub read broker の新規実装が必要と判明した場合は本 Issue のスコープを超えるため停止し、follow-up Issue 化を提案する

Required Skills

なし

Required Design References

  • docs/dev/secret-policy.md
  • docs/dev/hook-boundaries.md
  • docs/dev/agent-runtime-ops.md
  • .claude/rules/project-constitution.md

Scope Delta(該当時のみ記載)

PR #2247 レビューで、scripts/agent-guards/skill_runtime_exec.py の trust root 変更(Path.home() → pwd.getpwuid(os.getuid()).pw_dir ベース)が、Allowed Paths 外の以下2ファイルの既存テストを real regression として壊すことが判明した(HOME monkeypatch で trust root を間接検証していたテストが、HOME非依存の新仕様と整合しなくなったため)。これらのテストを新仕様に合わせて更新するため Allowed Paths を拡張する。

追加する Allowed Paths:

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

変更内容: test_fixture_human_context_real_subprocess_reaches_contract_update_required_ac3 等が、trust root を HOME monkeypatch 経由で間接検証していた箇所を、pwd.getpwuid mock またはそれに相当する新仕様準拠の検証方法へ更新する(アサーション対象パスの意味を新しい trust root 定義に合わせるのみで、テストの検証意図・カバレッジは変えない)。


2回目の Scope Delta(PR #2247 への OWNER (squne121) の adversarial review、#2247 (comment) 、P1-1 blocker への対応):

OWNER レビューで、新規 github_credentialless_read.py が canonical production preflight(run_refinement_preflight.py の _fetch_issue()/_fetch_issue_comments())に未接続であり、gh api/gh issue view 経由の既存 fetch がそのまま残っているため、GitHub authentication failure という incident 後半が実質未解決である、という P1 blocker が指摘された。この修正には Allowed Paths 外の .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py の編集が必須のため Allowed Paths を拡張する。

追加する Allowed Paths:

  • .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py
  • .claude/skills/issue-refinement-loop/tests/test_run_refinement_preflight_credentialless_transport.py(新規)

変更内容: isolated profile 実行時に _fetch_issue()/_fetch_issue_comments() が github_credentialless_read.py の transport(GitHubReadTransport protocol、list_issue_comments() によるpagination追従を含む)を使用し gh へフォールバックしないよう transport selector を追加する。gh を marker executable に差し替えても一度も起動されないことを behavioral test(AC8)で証明する。

Activity

  1. squne121 commented on Aug 17, 2026

    @squne121
    OwnerAuthor

    create-issue transaction partial-failure

    Issue: #2241
    Failure stage: dedupe-race-detection
    Message: dedupe-search failed

    Requested:

    • labels: (none)
    • parent: (none)
    • blocked-by (dependencies): (none)
    • blocking: (none)
      Completed steps: create

    Failure context: command=gh issue list --repo squne121/loop-protocol --state open --search in:title "実装: Claude-GPT isolated session の minimum control-plane capability を保証する(uv toolchain resolution + credentialless GitHub read)" --limit 200 --json number,title,url
    output=HTTP 503: No server is currently available to service your request. Sorry about that. Please try resubmitting your request and contact us if the problem persists. (https://api.github.com/graphql)
    matching_issue_numbers=[]
    issue_number=2241

    Recovery hint: dedupe-race-detection — automatic recovery is not possible.
    Manual action required: inspect open issues with the same title and decide which to close.
    gh issue list --repo squne121/loop-protocol --state open --search '<title>'
    idempotent re-run: no (requires manual deduplication first)

    Please recover deterministically before re-running the create issue transaction.

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

    @squne121
    OwnerAuthor

    implement-issue: 実装完了

  4. squne121 commented on Aug 17, 2026

    @squne121
    OwnerAuthor

    implement-issue: fix_delta 対応完了(PR #2247 REQUEST_CHANGES 解消)

    pr-review-judge から受けた REQUEST_CHANGES の 2 blocker を解消しました。

    Blocker 1: CI 回帰(既存テスト2件が新 trust root と不整合)

    .claude/skills/issue-refinement-loop/tests/test_operator_selected_scope_reframe.py::test_fixture_human_context_real_subprocess_reaches_contract_update_required_ac3(および test_fixture_human_context_subprocess.py の importlib ラッパー)の env_probe 部分を、pwd.getpwuid を unittest.mock.patch.object で isolated home に差し替えた in-process 呼び出しに変更し、検証意図(trust root が isolated HOME に汚染されない/host env sanitize が機能する)を維持したまま新仕様に整合させました。2件とも PASS を確認済みです。

    Blocker 2: AC5 runtime verification 証跡が PR 本文に無い

    artifacts/runtime-smoke/claude-gpt-structured/summary.md の observed フィールド(raw prompt / 絶対 HOME パス / proxy sidechannel の host-local パスは redact)を docs/dev/runtime-verification-policy.md §7 テンプレに従って PR #2247 本文へ ## Runtime Verification Evidence セクションとして追記しました。

    検証結果

  5. squne121 commented on Aug 17, 2026

    @squne121
    OwnerAuthor

    impl-review-loop 完了: PR #2247 が merge-ready 状態です(本セッションではマージ操作を実行しません)。

    • head: e192d70
    • pr-reviewer verdict: APPROVE(blockers/warnings なし)
    • 全 required CI check PASS、mergeable: MERGEABLE、mergeStateStatus: CLEAN
    • AC5(runtime-verification): fresh Claude-GPT isolated session(--claude-adapter claude-gpt)から skill_runtime_exec.py --command-id preflight.run.with_human_context 相当の実行を確認、exit_code 0、tested_head が PR head と一致

    人間のマージ判断後の推奨手順は以下の通りです(このセッションからの引き継ぎ事項、詳細は本 Issue を起票した親スレッドの最終報告を参照):

    1. 本 PR fix: Claude-GPT isolated session の trusted uv toolchain 解決を HOME 分離から独立させる (#2241) #2247 の merge
    2. 実装: runtime guard が peer pytest nodeids を child write と誤帰属しないようにする #1526(.pytest_cache/v/cache/nodeids typed exact-file policy)の stale 実装: SubAgent 起動 ledger の更新を runtime guard の誤検知から除外する #1502 dependency を authoritative state(実装: SubAgent 起動 ledger の更新を runtime guard の誤検知から除外する #1502 は既に CLOSED 済み、readback 確認済み)に更新し、exact nodeids policy を実装
    3. fresh Claude-GPT session を新規起動
    4. HOME override / credential 再露出 / cache delete なしで 実装: control-plane preflight の remote default-ref OID observe/fetch/pin/verify プロトコルを実装する #2197 の preflight を再実行
    5. 実装: control-plane preflight の remote default-ref OID observe/fetch/pin/verify プロトコルを実装する #2197 の issue-refinement-loop を再開
  6. added a commit that references this issue on Aug 18, 2026
  7. squne121 commented on Aug 18, 2026

    @squne121
    OwnerAuthor

    PR #2247 に対する OWNER の敵対的レビュー(REQUEST_CHANGES、comment 5327969977)へ fix_delta で対応した(head 46aabeff)。

    対応結果サマリ

    • P1-2(redirect による cross-repository 越境): 修正済み。urllib.request.HTTPRedirectHandler を全面拒否するサブクラスを追加し、あらゆる redirect(301/302/303/307/308、任意 host/scheme)を CrossRepositoryReadRejected にした。negative test 5 種を追加。
    • P1-3(~/.local/bin same-UID trust root): 部分対応。ancestor owner/writability 検証・symlink 解決先検証・version 照合を追加したが、同一 UID 攻撃モデル自体は構造的に未解決(Not Controlled として PR 本文・docs/dev/workflow.md に明記)。
    • P1-4.1〜4.4(テストの fail-open/非因果性): 全て対応済み。HTTP status 分類・behavioral request assertion・_sanitize_env の実 subprocess black-box test・trust root 解決の実 subprocess black-box test を追加。
    • P1-1(credentialless reader の production preflight への未接続): 未着手。github_credentialless_read.py に transport 一式(list_issue_comments pagination・GitHubReadTransport Protocol・CredentiallessGitHubReadTransport)は追加したが、.claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py の _fetch_issue()/_fetch_issue_comments() への配線は、このファイルが Issue 実装: Claude-GPT isolated session の minimum control-plane capability を保証する(uv toolchain resolution + credentialless GitHub read) #2241 の Allowed Paths に含まれていないため実施できなかった。Scope Delta(Allowed Paths への run_refinement_preflight.py 追加)が必要。

    検証結果

    次のアクション

    P1-1 の production preflight 配線を完了するには、Issue #2241 の Allowed Paths に .claude/skills/issue-refinement-loop/scripts/run_refinement_preflight.py を追加する Scope Delta が必要。control-plane(人間)側で判断・追記をお願いしたい。

  8. squne121 commented on Aug 18, 2026

    @squne121
    OwnerAuthor

    PR #2247 の P1-1 blocker(OWNER adversarial review、#2247 (comment) )に対応し、head ba94b448 にて解消しました。

    対応内容

    run_refinement_preflight.py の _fetch_issue() / _fetch_issue_comments() に isolated Claude-GPT session profile 検出(_is_isolated_claude_gpt_profile()。Issue #2241 AC1 の HOME / real OS account home 乖離シグナルを再利用)を追加し、isolated profile では github_credentialless_read.py の CredentiallessGitHubReadTransport(list_issue_comments() の pagination 追従込み)経由で Issue/comments を取得、gh CLI へのフォールバックは一切行わないようにしました。isolated profile 以外(既存の human/agent context)は従来の gh issue view --json / gh api --paginate --slurp を無変更で維持しています。

    AC8 検証

    .claude/skills/issue-refinement-loop/tests/test_run_refinement_preflight_credentialless_transport.py を新規追加し、Issue 記載の exact command で PASS を確認しました:

    $ uv run --locked pytest .claude/skills/issue-refinement-loop/tests/test_run_refinement_preflight_credentialless_transport.py::test_isolated_profile_never_invokes_gh_marker_executable -v
    PASSED
    

    PATH の先頭に「呼び出されたらマーカーファイルを書き込み exit 7 する」marker gh 実行ファイルを配置した状態で isolated profile 相当の条件を作り、_fetch_issue()/_fetch_issue_comments() が credentialless transport 経由で成功し、marker gh が一度も起動されないことを behavioral に証明しています。加えて、credentialless データが既存 gh issue view --json 相当 shape へ正しく変換されること、pagination 追従、非 isolated profile では既存 gh 経路が変わらないことを検証するテストも追加しました(計4テスト、全て PASS)。

    回帰確認

    • .claude/skills/issue-refinement-loop/tests/ full suite: 1561 passed(他 consumer への回帰なし)
    • scripts/agent-guards/tests/test_credentialless_github_read.py + test_trusted_toolchain_isolated_home.py: 37 passed
    • pnpm typecheck / pnpm lint / pnpm build: 全て PASS
    • uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py: 24 passed

    scripts/agent-guards/tests/ full suite で2件(test_skill_runtime_exec_session_manifest.py)が failed しましたが、本 diff を git stash した状態でも独立に再現する既知の repo-tree hygiene 汚染(stray __pycache__/.pytest_cache 由来)が原因であり、本 fix_delta の変更とは無関係であることを確認済みです。

    詳細は PR #2247 本文の「P1-1 blocker 対応(head ba94b448)」セクションを参照してください。マージは行っておらず、人間判断待ちです。

  9. squne121 commented on Aug 18, 2026

    @squne121
    OwnerAuthor

    OWNER の adversarial review(P1-1〜P1-4)に対する fix_delta が完了しました。

    • PR fix: Claude-GPT isolated session の trusted uv toolchain 解決を HOME 分離から独立させる (#2241) #2247 head: ba94b4489d3f7bd0d8929f3553f124f0e3ec0112
    • P1-1(credentialless readerがcanonical production preflightに未接続): run_refinement_preflight.py の _fetch_issue()/_fetch_issue_comments() をisolated profileでcredentialless transport経由に接続、ghを marker executable化しても一度も起動されないことをbehavioral testで証明(AC8として Issue 本文に追加済み)
    • P1-2(redirectによるrepository境界越境): 全redirect拒否 + pagination先の再検証を実装、negative test 9件
    • P1-3(同一UID書き込み可能な~/.local/bin): ancestor owner/writability検証・symlink検証・version pattern照合を追加。同一UID脅威モデルの完全解決ではないことをPR本文とdocs/dev/workflow.mdに正直に "Not controlled" として明記
    • P1-4.1-4.4(fail-open/非因果的テスト): HTTPステータス別分類、behavioral request assertion、real subprocess black-box testを追加

    control-plane独立確認(pr-reviewer再実行): verdict APPROVE、blockers なし。AC5 runtime verificationも最終headで再実行し証跡更新済み。

    Issue本文は2回のScope Deltaで Allowed Paths を計14ファイルに拡張済み(run_refinement_preflight.py 等)。

    OWNER (squne121) の最終レビュー・マージ判断待ちです。本セッションではマージを実行しません。

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