Skip to content

実装: canonical executor の Vitest results cache write を writer attribution に基づき狭域で判定する #2887

Open

Description

@squne121

Machine-Readable Contract

contract_schema_version: v1
issue_kind: implementation
parent_issue: none
goal_ref: "canonical executor の Vitest results cache write を child と peer に因果帰属し、真の peer false positive に限定して安全に解消する"
change_kind: workflow
dedupe_key: "canonical-executor:vitest-results-cache:attribution-gated:v1"

Parent Issue

none(単独改善)

Parent Goal Ref

Current Validated Scope

  • 実装: Auto mode の固定 /tmp scratch 上書き false-deny を run-scoped temporary workspace で解消する #2860 の structural repair consumer は exit 2 unauthorized_write_path、対象は node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json。ただし writer は未特定。
  • structural consumer を実行していない期間に同 path の size 84528 / SHA256 adea9697…(2026-10-03T00:07:31Z)から size 84480 / SHA256 e476027cd6b0036a99538f5290562ff74c49cf9703bc167dc60f1e44c84d7da8(00:22:34Z)への変化を観測。後からの ps/fuser は writer 不在。これは peer または child の原因証明ではない。
  • その後の bounded retry は同 integrity failure を再現せず、candidate_readiness / structural_readiness_needs_fix(EXTSURF001 LP010 LP016 LP019 RUNTIMEASSERT001 RVA001)、mutation_outcome: not_attempted で停止。修正済みとも再発確定ともみなさない。
  • 対象は scripts/agent-guards/skill_runtime_exec.py の事後検査と、追加する単一の回帰テスト。調査段階は read-only / non-destructive の bounded attribution とし、変更は peer false positive を独立証拠で確認した場合のみ。

Remaining Parent Gaps

なし(単独改善)。#2860 の scratch / Required Skills readiness は別途扱う。

Background

#2860 は別 ownership の scratch contract。前回の停止記録: #2860 (comment) 。#1526 は CLOSED の peer pytest cache guard precedent、#2151 は CLOSED の research-only not_reproduced disposition、#1363 は OPEN の optional strict_strace であり本件の必須依存ではない。

#1526 の狭域 race-tolerant な generated cache precedent を先に評価する。根本原因の候補は同時刻の peer cache writer と guarded child write の誤帰属だが未確定。決定論的修正は peer と確認できた時だけ既存機構を再利用し exact Vitest result-cache subtree に限定する。運用 workaround(テスト停止、cache 削除、権限緩和、検査無効化)は原因を示さず危険なため不採用。#2151 は当時 pnpm.test が child 起動前に rejected した研究結果であり今回の新証跡を無条件に吸収・reopen しない。#1363 の任意 tracing 実装待ちは要求しない。

Outcome

child/peer を区別した bounded evidence と disposition を残し、peer false positive の場合だけ狭域 guard 修正と回帰テストを含む単一 PR が canonical positive workflow・違反 negative controls の両方を通過する状態(帰属未確定または child 書き込みなら STOP し修正 PR を作らない)。

Runtime Verification Applicability

  • decision: immediate
  • reason: executor subprocess と独立 peer writer の同時 I/O、canonical workflow の可用性を同一 delivery で確認できるため。fixture 成功だけでは canonical acceptance としない。
  • applicable_acs: AC1, AC2, AC3, AC4
  • execution_environment: Linux、git、uv、pytest、pnpm、canonical executor に必要な通常の認証と隔離環境。独立 peer の観測は限定時間・対象 path のみに絞る。
  • skip_conditions: 必要な tooling・権限・隔離環境が無ければ runtime VC は exit 77 SKIP とし PASS へ変換せず STOP。
  • fallback_policy: tracing 不在や再現不能時に fixture / HOME override / cache 削除 / guard bypass の成功を canonical PASS に代用しない。
  • artifact_requirements: worktree-local artifacts/runtime-verification-AC*-.log に時刻・run head・command identity・process lineage・対象 path の before/after hash と exit code・attribution disposition を記録し、PR の Runtime Verification Evidence に機密を除いた要約を引用。未確定なら STOP として記録。

In Scope

  • 既存の child snapshot、Vitest cache path と peer process の関係を bounded / non-destructive に検証し、process lineage と書き込み時刻を照合して peer_confirmed / child_confirmed / inconclusive のいずれかを証跡化する。単なる時刻一致・事後 ps/fuser は peer_confirmed としない。
  • peer_confirmed の時だけ 実装: runtime guard が peer pytest nodeids を child write と誤帰属しないようにする #1526 と同じ narrow race-tolerant 機構を必要最小限に拡張する。子プロセス由来の違反と cache-root 外は引き続き fail-close。child_confirmed / inconclusive は原因・観測限界を Issue に報告して停止。
  • hermetic な独立 peer/cache write の positive と実際の child 不正書き込みおよび cache-root 外 write の negative を追加。fresh isolated session から workaround 無しで少なくとも一つの canonical positive workflow を確認する。

Out of Scope

Acceptance Criteria

  • AC1: bounded attribution の run-scoped 証跡に writer lineage と before/after integrity、peer_confirmed / child_confirmed / inconclusive の理由を記録する。peer と断定不能ならコード修正せず停止する。
  • AC2: peer_confirmed に限り狭域の regression が独立 peer の Vitest results cache write で unauthorized_write_path を誤報せず、実装: runtime guard が peer pytest nodeids を child write と誤帰属しないようにする #1526 の既存 guard と矛盾しない。
  • AC3: guarded child の実際の unauthorized write、および cache-root 外 write を別々の negative control で exit 2 のまま検出する。
  • AC4: 同一 delivery 内の fresh isolated session で通常の canonical positive workflow が workaround なしで完走し、SKIP / fallback を PASS とせず証跡を残す。
  • AC5: 既存の型・lint・テスト・build は PASS。scope 衝突を解決するまで並行して同一ファイルに実装しない。

Verification Commands

# AC1
$ uv run --locked python3 -m pytest -q scripts/agent-guards/tests/test_skill_runtime_exec_vitest_cache.py

# AC2
$ uv run --locked python3 -m pytest -q scripts/agent-guards/tests/test_skill_runtime_exec_vitest_cache.py

# AC3
$ uv run --locked python3 -m pytest -q scripts/agent-guards/tests/test_skill_runtime_exec_vitest_cache.py

# AC4
$ uv run --locked python3 scripts/agent-guards/skill_runtime_exec.py --command-id preflight.run --issue-number 2860 --repo squne121/loop-protocol

# AC5
$ pnpm typecheck
$ pnpm lint
$ pnpm test
$ pnpm build
$ uv run --locked python3 -m pytest -q scripts/agent-guards/tests/test_skill_runtime_exec_unauthorized_write_path.py

Allowed Paths

  • scripts/agent-guards/skill_runtime_exec.py
  • scripts/agent-guards/tests/test_skill_runtime_exec_vitest_cache.py

Stop Conditions

Required Skills

なし

Required Design References

  • docs/dev/workflow.md
  • docs/dev/runtime-verification-policy.md
  • docs/dev/agent-skill-boundaries.md

Scope Delta

N/A(起票時の宣言から変更なし)。

Delivery Rule

1 Issue = 1 PR。専用 worktree を使い Draft PR 既定。帰属未確定時は修正 PR を作らず STOP。#1363 は optional・依存登録なし。

Notes for Reviewer

Scope Collision (C1): overlap preflight は #2852 #2842 #2787 #2775 #1601 #1363 #420 #205 を advisory 候補として検出。非競合理由: #2852/#2775 は tests ディレクトリ包含、#2787 は research-only、#420/#205 は広い scripts 包含。#2842/#1601/#1363 は同じ executor file を編集し得るが Outcome は別。実装前に実際の open PR / worktree を照合し競合なら直列化する(統合せず、同時実装しない)。検索 source_status は issue_search=ok, issue_readback=ok。#2860 の scope は scratch workspace であり本 Issue へ移さない。

Activity

  1. added
    phase/implementation
    agent/implementer
    enhancement
    triage-required
    on Oct 3, 2026
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