Skip to content

調査: dedicated preflight 初回の unauthorized_write_path=.venv/ を切り分ける #3043

Open

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: research
parent_issue: "none"
goal_ref: "control-plane preflight.run.with_human_context の初回のみ .venv/ 書込み監査で拒否される事象を、実 writer / execution root / uv environment の区別に基づき再現・分類し、必要な最小再発防止策を定める"
change_kind: research-only
dedupe_key: "control-plane:preflight-dedicated-venv-first-run-unauthorized-write:v1"

Source / Relation

  • #3023 の refinement 終了報告 の「preflight 初回 .venv / 再実行成功」の観測。
  • #2199 / #2200(closed): dedicated control-plane execution root と、UV_PROJECT_ENVIRONMENT による monitored tree 外への environment relocation / pre-dispatch preparation の既存対策。これを再実装する Issue ではない。
  • #1588(open)は implementation worktree bootstrap の launcher による project mutation を扱う。本件は preflight.run.with_human_context child の検証に限定。
  • #3039(open)は root-review scratch の concurrent peer write を扱う。本件の .venv/ とは path / command class が異なる。writer が同一なら関連付けて再利用する。

Observed Evidence / Uncertainty

2026-10-12 の Issue #3023 refinement 実行ログ(repository main ac82972d1e62b6327227173a430862b4451a60c5)では次の実行結果が報告された。

uv run --locked python3 scripts/agent-guards/skill_runtime_exec.py --command-id preflight.run.with_human_context --issue-number 3023 --repo squne121/loop-protocol --anchor-comment-url https://github.com/squne121/loop-protocol/issues/3023#issuecomment-6115633184
first: exit 2
SKILL_RUNTIME_FAIL: reason_code=unauthorized_write_path target_issue=3023 unauthorized write path=.venv/ recovery=do_not_write_outside_allowed_root
second (same command): exit 0; STATUS: pass; NEXT_ACTION: proceed
  • 元 session は main root の既存 .venv を調べたが、unauthorized write path=.venv/ の 実際の相対基準(dedicated dispatch root か primary root か)、実 writer、変更ファイルと同期開始時点を完全には特定していない。「main root の古い venv が原因」とはまだ言えない。
  • current skill_runtime_exec.py の dedicated production branch は、UV_PROJECT_ENVIRONMENT を monitored execution_root 外へ固定し、ensure_dedicated_execution_environment_ready() を before-snapshot 前に実行する設計。first-only refusal は、この既存不変条件との整合性を調べる価値があるが、現時点では regression 確定ではない。
  • 直後の成功は first-only failure の存在を否定しない。一方、単発ログだけでは uv 同期・同時実行 peer write・環境不備のどれが原因か確定できない。

Outcome

isolated test workspace で first-run / warm-run、dedicated execution_root / external UV_PROJECT_ENVIRONMENT、child-own / peer-write のそれぞれを区別した root cause/evidence が得られる。実際の defect が確定した場合に限り、既存 monitor の不正 write 検出を緩めず、最小修正と regression test を同一 Issue コメントまたは独立の実装 Issue に具体化する。#3023 の実装をブロックしない。

In Scope

  1. current main の skill_runtime_exec.py dedicated dispatch、_snapshot_repo_paths / _find_unauthorized_repo_changes、worktree_bootstrap_exec.py の environment preparation と関連テストを read-only で追い、.venv/ の相対基準と writer 候補を明示する。
  2. primary checkout を変更しない isolated fixture で cold/warm preflight を再現する。実 write delta(directory/file/mtime)、UV_PROJECT_ENVIRONMENT の実効 location、child と peer の区別を記録する。必要なら既存テストを再利用する。
  3. 既存 実装: control-plane preflight を dedicated linked worktree の identity probe と command class 分離で 4 production profile へ移行する #2199 / 実装: control-plane preflight の artifact confinement と #2190 全AC最終検証を実装する #2200 / 実装: worktree bootstrap を direct Python/no-project-mutation launcher に統一する #1588 / 実装: root review producer の scratch を executor snapshot の外へ移し repair_action.apply の peer 競合による unauthorized_write_path を解消する #3039 と再照合し、同一 failure class なら追記・再利用、別原因なら限定した repair proposal を作る。

Out of Scope

Acceptance Criteria

Verification Commands

# AC1
$ rg -n "ensure_dedicated_execution_environment_ready|UV_PROJECT_ENVIRONMENT|_find_unauthorized_repo_changes" scripts/agent-guards/skill_runtime_exec.py scripts/agent-ops/worktree_bootstrap_exec.py

# AC2
$ rg -n "unauthorized_write_path|dedicated_execution_venv_dir" scripts/agent-guards/tests/ tests/agent_ops/

# AC3
$ gh issue view 2199 --repo squne121/loop-protocol --json state,body

AC2 の source search は runtime 再現の代替ではない。再現・negative control の生出力と実測 path を Issue コメントに添付して判定する。

Allowed Paths

  • (none) — 調査は read-only。後続 implementation は別 Issue または既存 Issue の契約で管理する。

Stop Conditions

  • primary checkout / foreign worktree の状態変更や secret/credential の取得が必要な場合
  • 実 write provenance を保てない場合(未確認と明記)
  • 既存 Issue が同一 failure class を所有している場合は重複実装せず参照に統合

Delivery Rule

本件は独立した低優先度の観測・原因調査であり、#3023 の impl-review-loop を待機させない。defect が未確認なら、新しい harness hardening を実装しない。

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions