Repository navigation
feat(refinement): fixture human-context runtime profile - #2143
Conversation
Preview URLPreview removed (PR #2143 closed). |
判定PR #2143 は
ただし敵対的に Issue #2136 の live contract と PR #2143 の実 diff を再照合すると、#2136 内に少なくとも4件の契約 blocker が残っています。 Severity | Finding | 判定 -- | -- | -- P1 | AC4 の gh canary が PATH に入っていない | confirmed P1 | optional であるべき transport flag が mandatory | confirmed P1 | fixture confinement が target Issue artifact root ではなく repo root | confirmed P1 | AC3 fixture が known_context.human_context_comment_urls を直接注入 | confirmed P2 | same-head PR-body edit を stale epoch と識別できない trusted workflow race | design gap / inferenceP1: AC4 の |
| Severity | Finding | 判定 |
|---|---|---|
| P1 | AC4 の gh canary が PATH に入っていない |
confirmed |
| P1 | optional であるべき transport flag が mandatory | confirmed |
| P1 | fixture confinement が target Issue artifact root ではなく repo root | confirmed |
| P1 | AC3 fixture が known_context.human_context_comment_urls を直接注入 |
confirmed |
| P2 | same-head PR-body edit を stale epoch と識別できない trusted workflow race | design gap / inference |
P1: AC4 の gh canary が実質的に機能していない
#2136 の live contract は、AC4 の negative control として E2E child の PATH 先頭に gh canary を置くことを要求し、token unset や空の GH_CONFIG_DIR だけでは証明にならないと明示しています。
ところが PR #2143 のテスト自身が、
It is not placed on PATH
と明記しています。実際、$HOME/.local/bin/gh は作っていますが env["PATH"] を変更していません。
したがって、
assert not sentinel.exists()
が PASS しても、「gh が呼ばれなかった」は証明できません。canary ではない実 gh が解決された場合を検出できないからです。PR 本文の「fixture/human-context E2E は live GitHub に到達しない」という Safety Claim は現状過大です。PR 本文でもこの claim を AC3/AC4 の根拠にしています。
production executable trust を緩めるのではなく、test-only child environment で canary が実際に gh として resolve されることまで negative control で証明すべきです。
P1: optional transport pair が mandatory に変わっている
#2136 は --investigation-evidence-transport-path を optional flag pair として定義しています。
しかし新 registry entry は argv に常時その pair を含め、placeholder も "required": True です。 PR diff でもその状態が確認できます。
さらに executor 側も fixture+human-context command では transport path 欠落を拒否します。つまり AC1 の public command grammar 自体が Issue contract と一致していません。
transport-present happy path が PASS していても AC1 達成にはなりません。transport-absent の正当な invocation を regression として追加する必要があります。
P1: fixture の confinement が target Issue artifact root になっていない
#2136 は fixture を target Issue の artifact root 内に confinement し、その外を AC2 で拒否する契約です。
ところが _is_safe_repo_relative_fixture_path() が確認しているのは、実質的に
commonpath(root, resolved) == repo_root
までです。つまり repository 内なら通る実装です。
しかも positive E2E 自身が、
fixture_rel = "fixtures/ac3.json"
として repo root 直下の fixtures/ に作っています。
これは AC2 が要求する security boundary をテスト自身が迂回している状態です。fixture を例えば .claude/artifacts/issue-refinement-loop/<issue>/... に移し、issue number に束縛して confinement 判定する必要があります。
P1: AC3 が known_context を test fixture から直接注入している
#2136 は、real subprocess E2E の success を test 側からの known_context 直接注入で代替してはならない、と明示しています。
しかし _ac3_fixture() は、
"known_context": {"human_context_comment_urls": [anchor_url], ...}
を直接設定しています。
そのため --human-context-comment-url の production wiring が壊れていても、fixture 内の既知 context が positive route を助ける可能性があります。これは #2086 で過去に問題になった「real subprocess を称しながら authority context を test 側から供給する false-green」にかなり近い構造です。
fixture 側の human-context known_context は空にし、CLI flag → executor → preflight → planner の経路だけで contract_update_required に到達させるべきです。
visual-impact-policy-trusted の扱い
#2143 で security workflow を緩和せず停止した判断そのものは正しいです。#2145 はこの defect を明示的に分離しており、trusted consumer の PR-body read を producer と byte-equivalent にすることだけを扱います。また #2145 の contract では、この trusted check は branch protection required check ではなく P2 tracking と記録されています。
ただし branch-protection の required-status API は今回の GitHub App 権限では 403 だったため、「non-required」は #2145 の live authority に基づく判断であり、私から branch protection 設定そのものを独立 readback できたわけではありません。
修正方法については、単純な shell command substitution より、API JSON を trusted-side Python で parse し、body.encode("utf-8") を byte write する方法を推奨します。現状は trusted side が gh api ... --jq ... > pr_body.txt、producer が printf '%s' "$PR_BODY" です。 GitHub CLI の --jq は jq query を提供するインターフェースで、jq では --join-output/-j が「output 後の newline を付けない」専用オプションです。(GitHub CLI)
JSON decode → UTF-8 bytes write なら、元 body が本当に末尾 LF を含むケースまで保存できます。#2145 の fixture も「末尾改行なし」だけでなく、空 body、1個/複数個の末尾 LF、日本語、複数行、shell metacharacter を入れると品質が上がります。
なお #2144 は現在も Draft/Open で、同じ .github/workflows/visual-impact-trusted-consumer.yml と resolve_visual_impact.py を変更しています。 #2145 の worktree を開始する前に #2144 の current diff と再度 overlap 判定することが必須です。
高速に更新される main への耐性
ここは かなり改善されていますが、まだ完全ではありません。
#2102 は main advancement を通常の concurrency event として扱い、base-bound evidence の invalidation/rebind、latest-main net diff、expected-head/expected-old CAS、bounded drift retry、scope-clean reconciliation を実装する契約です。 再確認時点でも #2143 の base SHA は b6a69e... のままで、PR head も de5ccca... のままです。 したがって 今回の #2143 は今この瞬間には base drift していません。
弱いのは Git commit の drift ではなく、同じ head SHA のまま変化できる authority です。
現在 CI は PR の edited でも起動し、同一 ref の古い run を cancel-in-progress します。 GitHub Actions の concurrency は同じ group の in-progress run を cancel できますが、workflow_run: completed は triggering workflow の成功・失敗にかかわらず発生します。([GitHub Docs]2)
一方 trusted consumer の stale 判定は現在 workflow_run.head_sha != live PR head_sha が中心です。
したがって推論上、
PR body edit → head SHA は同じ → producer run generation は変わる → 古い workflow_run と新 live body が混ざる
という same-head metadata race を stale_head として識別できません。
改善するなら evidence epoch を単なる {base_sha, head_sha} ではなく、
{main_sha, issue_body_sha256, issue_updated_at, pr_head_sha, pr_body_sha256, producer_run_id, run_attempt}
程度まで拡張するのがよいです。body が変わったら security corruption 扱いではなく stale_pr_metadata_epoch、head が変われば stale_head_epoch、main が変われば #2102 reconciliation、と failure taxonomy を分離できます。
また複数 ClaudeCode/CodexCLI session では、全 main drift で full restart する必要はありません。old_main..new_main が PR の changed paths、Allowed Paths、または transitive control-plane dependencies と交差するときだけ evidence を選択 invalidation し、CI/security/review の base-bound evidence は常に再束縛する、という #2102 の方向が適切です。
推奨順序
まず #2143 の4件を同じ PR 内で修正し、AC1–AC6 を literal contract に対して再実行してください。その後 current main/head/body を再readし、独立 review をやり直します。#2145 は #2143 の修正と混ぜず、#2144 との overlap を解消してから別 worktree/PR で扱うのがよいです。
この ChatGPT 環境には SubAgent を実際に spawn/join する機能がないため、今回こちらから複数 SubAgent を起動して完了待ちすることはできませんでした。以下の CodexCLI prompt では、read-only SubAgent を並列起動し、全員 terminal になるまで mutation を禁止する join barrier を明示しています。
あなたは squne121/loop-protocol の root orchestrator である。
対象:
- Issue 実装: preflight.run.with_human_context に gh fixture 対応を追加し AC3 positive route の real subprocess E2E を完成する #2136
- PR feat(refinement): fixture human-context runtime profile #2143
- 関連 Issue 実装: visual-impact-policy-trusted の PR body 独立検証を producer 側改行取り扱いと一致させ pr_body_digest_mismatch 誤検知を解消する #2145
- overlap candidate PR 実装: visual-impact-policy-trusted に TS import graph transitive reachability の trusted-side 独立検証を追加する #2144
- main-drift architecture 実装: issue-refinement-loop / impl-review-loop の main drift を自動再束縛・scope-clean reconciliation する #2102
- reviewer transport implement: recover reviewer transport failures and cryptographically bind compact verdicts to artifacts #2054 / PR 実装: reviewer transport failure を semantic judgment から分離し compact V2 verdict を artifact に暗号学的束縛する #2142
目的:
- PR feat(refinement): fixture human-context runtime profile #2143 を live Issue 実装: preflight.run.with_human_context に gh fixture 対応を追加し AC3 positive route の real subprocess E2E を完成する #2136 contract に対して敵対的に再レビューする。
- confirmed blocker があれば 実装: preflight.run.with_human_context に gh fixture 対応を追加し AC3 positive route の real subprocess E2E を完成する #2136 Allowed Paths 内だけで修正する。
- current
mainが高速に前進することを正常な concurrency event として扱い、stale evidence を再利用しない。 - 実装: visual-impact-policy-trusted の PR body 独立検証を producer 側改行取り扱いと一致させ pr_body_digest_mismatch 誤検知を解消する #2145 の trusted visual-policy defect は 実装: preflight.run.with_human_context に gh fixture 対応を追加し AC3 positive route の real subprocess E2E を完成する #2136 に混入させず、実装: visual-impact-policy-trusted に TS import graph transitive reachability の trusted-side 独立検証を追加する #2144 との overlap を確認して別スコープとして扱う。
- 実装・テスト・独立レビューまで人間承認不要で進める。ただし merge は実行しない。
- destructive operation、secret exposure、権限昇格、Allowed Paths 外変更、security gate の弱化は hard stop とする。
0. Live authority を最初に再取得する
過去の SHA・本文・チェック結果を authority として信用しない。
必ず fresh に取得する:
origin/maincurrent SHA- Issue 実装: preflight.run.with_human_context に gh fixture 対応を追加し AC3 positive route の real subprocess E2E を完成する #2136 current body、updated_at、body sha256
- PR feat(refinement): fixture human-context runtime profile #2143 current base/head SHA、draft/state/mergeability
- PR feat(refinement): fixture human-context runtime profile #2143 current changed paths / diff / comments / reviews / checks
- Issue 実装: visual-impact-policy-trusted の PR body 独立検証を producer 側改行取り扱いと一致させ pr_body_digest_mismatch 誤検知を解消する #2145 current body/state
- PR 実装: visual-impact-policy-trusted に TS import graph transitive reachability の trusted-side 独立検証を追加する #2144 current head/state/diff/changed paths
- Issue implement: recover reviewer transport failures and cryptographically bind compact verdicts to artifacts #2054 / PR 実装: reviewer transport failure を semantic judgment から分離し compact V2 verdict を artifact に暗号学的束縛する #2142 の current state
- repository の current worktree / branch / dirty state
取得した値を LIVE_AUTHORITY_V1 として保持する。
実装開始後も、次の境界ごとに current main / PR head / Issue body を readback する:
- mutation 前
- commit 前
- push 前
- review 前
- PR body 更新前
- final verdict 前
main drift は通常の concurrency event とする。
#2102 の current contract / implementation を再利用し、main drift 自体で implementation iteration budget を消費しない。
古い CI / review / scope snapshot / contract snapshot を current evidence として再利用しない。
1. SubAgent fan-out
root coordinator から read-only SubAgent を並列起動する。
各 SubAgent は子 SubAgent を起動してはならない。
各 SubAgent に mutation authority を与えてはならない。
最低5 lane:
A. contract-diff-auditor
- Issue 実装: preflight.run.with_human_context に gh fixture 対応を追加し AC3 positive route の real subprocess E2E を完成する #2136 live contract と PR feat(refinement): fixture human-context runtime profile #2143 diff を field-by-field / AC-by-AC 比較
- optional/required grammar
- fixture confinement
- root-no-worktree
- shell=False
- production lane non-widening
- Stop Conditions
を監査
B. negative-control-auditor
- AC3/AC4 real subprocess E2E を敵対的レビュー
- gh canary reachability
- PATH / HOME / GH_CONFIG_DIR / token env
- known_context injection
- real registry/executor/preflight/planner reachability
- false-green の可能性
を監査
C. trusted-visual-auditor
- 実装: visual-impact-policy-trusted の PR body 独立検証を producer 側改行取り扱いと一致させ pr_body_digest_mismatch 誤検知を解消する #2145 と
.github/workflows/visual-impact-trusted-consumer.yml - producer
.github/workflows/ci.yml - PR 実装: visual-impact-policy-trusted に TS import graph transitive reachability の trusted-side 独立検証を追加する #2144 overlap
を read-only 調査 - PR body byte transport
- jq newline
- trailing newline preservation
- workflow_run trust boundary
を監査
D. concurrency-epoch-auditor
- 実装: issue-refinement-loop / impl-review-loop の main drift を自動再束縛・scope-clean reconciliation する #2102 の main-drift implementation
- GitHub Actions concurrency
- workflow_run
- PR body
edited - same-head metadata race
を監査 - fast-moving main を前提とした evidence invalidation policy を提案
E. external-spec-researcher
一次情報のみを使用:
- GitHub Actions official docs
- GitHub CLI official manual
- jq official manual
- Python subprocess docs
- pytest docs
必要な仕様だけを収集する。
JOIN BARRIER
A-E 全 SubAgent が terminal result を返すまで一切 mutation しない。
失敗・timeout した SubAgent は semantic approval に変換しない。
transport failure と semantic verdict を分離する。
#2054 が current main に未マージなら、その原則を手作業でも維持する。
A-E 全結果を root coordinator が統合し、
ADVERSARIAL_PREFLIGHT_V1
を作成してから implementation に進む。
2. 次の4 finding を「仮説」として必ず再検証する
過去レビューを盲信せず live diff で CONFIRMED / DISPROVED を判定する。
Finding 1: gh canary が reachable でない疑い
Issue #2136 AC4 は E2E child の PATH 先頭に gh canary を置く契約である。
PR #2143 の既知実装では $HOME/.local/bin/gh を作る一方、
test docstring が「PATH には置かない」と記述していた。
確認事項:
- actual child environment で
ghがどこに resolve されるか - canary が実際に accidental gh invocation を捕捉可能か
- executor
_sanitize_env()/ executable trust が PATH をどう扱うか
CONFIRMED の場合:
- production executable trust/PATH validation は絶対に緩めない
- test-only E2E environment だけで canary が実際に
ghとして resolve されるようにする - canary resolution 自体を negative-control test で証明する
- canary invocation は sentinel + nonzero exit
- live network success を PASS にしない
Finding 2: optional transport pair が mandatory の疑い
Issue #2136 の live contract で
--investigation-evidence-transport-path
が optional flag pair か再確認する。
registry / validator / exact parser / executor が transport absent shape を拒否しているなら CONFIRMED。
CONFIRMED の場合:
- transport-present と transport-absent の両方を valid grammar とする
- duplicate / reordered /
--flag=value/ partial pair / unknown token は reject - registry の既存 optional-flag-pair infrastructure があれば再利用
- schema/key-set 変更が必要なら勝手に拡張せず
scope_change_requiredで hard stop
Finding 3: fixture confinement が repo-root のみに留まる疑い
Issue #2136 AC2 の fixture root を live body から正確に読み取る。
_is_safe_repo_relative_fixture_path() が単に repository-root confinement しか行わず、
positive fixture が fixtures/ac3.json 等に置かれているなら CONFIRMED。
CONFIRMED の場合:
- fixture を target Issue artifact root 配下へ移す
- issue number に binding
- absolute path
..- leading
- - NUL / LF / CR
- symlink escape
- wrong issue artifact root
を child 起動前に拒否する。
production fixture profile の既存 semantics は変えない。
Finding 4: known_context test injection の疑い
AC3 fixture が
known_context.human_context_comment_urls
を anchor URL で事前投入していないか調べる。
Issue contract がこれを AC3 success 根拠として禁止している場合、
fixture injection を削除する。
修正後は:
CLI
→ skill_runtime_exec
→ registry/policy
→ run_refinement_preflight
→ human-context derivation
→ planner/classifier
だけで
contract_update_required
かつ
implementation_allowed == false
へ到達させる。
direct run_preflight()、stub registry、test-side derived authority injection を代替証拠にしない。
3. #2136 implementation
confirmed blocker のみ修正する。
変更可能なのは current Issue #2136 の live Allowed Paths のみ。
毎回 live body から再取得すること。
実装方針:
- smallest safe delta
- production
preflight.run.with_human_contextを widen しない - sibling test-only command に限定
- shell=False 維持
- local_only 維持
- mutation:false 維持
- canonical root/default branch binding 維持
- repo / issue / anchor / transport binding を弱めない
- security rejection を PASS に変えない
4. Verification
Issue #2136 の literal Verification Commands を live body から抽出し、全件実行する。
加えて最低限:
- registry tests
- registry security tests
- policy anchor tests
- executor anchor tests
- AC3/AC4 stable subprocess node
- production
preflight.run.fixture - production
preflight.run.with_human_context - agent-report / unlabelled negative lanes
- authority transport regressions
- full issue-refinement-loop suite
- relevant agent-guards suite
- Ruff on changed Python
git diff --check
AC3/AC4 では以下を machine-verifiable に記録:
- exact subprocess argv
- effective test-only environment classification
- gh canary resolved path
- sentinel absent
- no live GitHub success fallback
- route.action
- implementation_allowed
- fixture resolved path
- fixture issue-root binding
- transport-present case
- transport-absent case
test count は古い PR body からコピーしない。
current HEAD で再計測する。
5. main drift reconciliation
implementation 中に origin/main が前進した場合:
- old_base / new_base を記録
- current PR head を再read
- Issue body sha256 を再read
old_base..new_basechanged paths を収集- PR Allowed Paths / direct dependencies / transitive control-plane dependencies と交差判定
- 実装: issue-refinement-loop / impl-review-loop の main drift を自動再束縛・scope-clean reconciliation する #2102 の scope-clean reconciliation を利用
- stale evidence epoch を破棄
- latest-main net diff で Allowed Paths を再gate
- semantic ambiguity が無ければ自動継続
- CAS mismatch / conflict / contract drift は fail-closed
main drift だけで fix iteration budget を消費しない。
evidence epoch は最低限:
- main_sha
- issue_body_sha256
- issue_updated_at
- pr_head_sha
- pr_body_sha256
- relevant workflow_run_id
- run_attempt
を追跡する。
6. Independent final review
実装担当とは別の read-only reviewer SubAgent を新規起動する。
過去 SubAgent の verdict を再利用しない。
review input:
- current Issue body
- current main
- current PR head
- full diff
- literal AC
- current tests
- current CI
- confirmed/disproved findings
- main drift history
P0/P1/P2 を明示する。
review transport failure の場合:
- semantic approval として扱わない
- bounded retry
- retry 枯渇なら environment_failure
- fallback approval を捏造しない
GitHub PR review publisher が current repository contract 上利用可能なら、
current head SHA に束縛して review evidence を永続化する。
権限・契約上不可能なら local artifact として明示し、
「GitHub submitted review 済み」とは報告しない。
7. PR #2143 更新
全 #2136 blocker が解消した場合のみ PR body を更新する。
必須:
- reviewed main SHA
- current PR head SHA
- current Issue body SHA
- AC1-AC6 fresh results
- gh canary の実 reachability evidence
- fixture confinement evidence
- optional transport present/absent evidence
- known_context non-injection evidence
- full regression count
- Ruff
- diff check
- independent review verdict
- unresolved external check を明確に分離
merge は実行しない。
8. #2145 / trusted visual-policy
#2136 の修正と同一 PR に混ぜない。
まず:
- Issue 実装: visual-impact-policy-trusted の PR body 独立検証を producer 側改行取り扱いと一致させ pr_body_digest_mismatch 誤検知を解消する #2145 live body
- PR 実装: visual-impact-policy-trusted に TS import graph transitive reachability の trusted-side 独立検証を追加する #2144 current diff/head/state
- open Issues/PRs の Allowed Paths overlap
を fresh に調べる。
PR #2144 は trusted consumer workflow を並行変更している可能性があるため、
hunk-level conflict と semantic overlap を確認する。
safe に独立実装できない場合は
overlap_reconciliation_required
で停止し、別 session の変更を上書きしない。
#2145 を実装する権限・scope が明確に存在する場合のみ専用 worktree で進める。
PR body の byte-exact 取得では:
tr -d '\n'を使わないecho -nに依存しない- shell command substitution による trailing-newline loss を避ける
- API JSON を trusted/base-branch Python で parse
- body string を UTF-8 bytes として write
する方式を第一候補として検証する。
fixture:
- empty
- single line
- multiline
- Japanese / Unicode
- no trailing LF
- one trailing LF
- multiple trailing LF
- shell metacharacters
を含める。
producer の pr_body_sha256 と trusted-side rederived SHA256 が
同一 body bytes で一致することを証明する。
workflow trust boundary は弱めない。
candidate PR head のコードを privileged workflow_run job で実行しない。
9. same-head PR metadata race の調査
次を adversarial scenario として検証する:
T0:
PR head = H
PR body digest = B1
CI run R1 starts
T1:
head は H のまま PR body を B2 に edit
R1 が cancel/completed
CI run R2 starts
T2:
workflow_run consumer が R1 artifact を受け取る
live PR head は H
live PR body は B2
現在の stale check が head SHA のみなら、
R1 を stale と識別できない可能性がある。
これは #2145 の newline fix と別 scope か判定する。
別 scope の場合:
- 実装: visual-impact-policy-trusted の PR body 独立検証を producer 側改行取り扱いと一致させ pr_body_digest_mismatch 誤検知を解消する #2145 に勝手に追加実装しない
- follow-up candidate として
stale_pr_metadata_epoch
taxonomy と evidence を報告する - 新規 Issue 作成が current Stop Conditions に抵触するなら作成せず停止報告のみ
推奨 epoch:
{pr_head_sha, pr_body_sha256, producer_run_id, run_attempt}
10. Safety / stop conditions
即時 hard stop:
- destructive git operation
- force push
- protected branch direct update
- secret/token 出力
- permission escalation
- security workflow/check の緩和
- Allowed Paths 外変更
- Issue contract の無断書換え
- schema/key-set の無断変更
-別 agent/worktree の変更上書き - ambiguous concurrent edit
- unresolved CAS mismatch
- current-head readback failure
他セッションの worktree を cleanup/delete しない。
11. 最終出力
最後に次の machine-readable report を返す:
ISSUE_2136_ADVERSARIAL_RECOVERY_RESULT_V1
必須フィールド:
status:
- merge_ready
- needs_fix
- environment_failure
- scope_change_required
- overlap_reconciliation_required
- hard_stop
authority:
- main_sha
- issue_body_sha256
- issue_updated_at
- pr_number
- pr_head_sha
- pr_base_sha
- pr_body_sha256
subagents:
- launched
- completed
- failed_or_blocked
- dangling
- roles
findings:
- id
- severity
- status: confirmed|disproved|fixed
- evidence
- changed_paths_if_fixed
verification:
- ACごとの fresh result
- regression count
- ruff
- diff_check
- canary_resolved_path
- canary_invoked
- fixture_root_binding
- optional_transport_present
- optional_transport_absent
main_drift:
- detected
- old_base
- current_base
- reconciliation
- stale_evidence_invalidated
review:
- current_head_reviewed
- verdict
- blockers
- transport_status
- github_review_persisted
trusted_visual:
- current_check_status
- issue_2145_state
- pr_2144_overlap
- newline_defect_status
- same_head_metadata_race_status
remaining_blockers:
- exact blocker list
next_action:
- exact next executable action
merge は実行しない。
全 SubAgent が terminal で dangling: 0 であることを最後に確認する。
この prompt の重要点は、#2145 を先に直して #2143 を通すのではなく、まず #2143 自身の false-green AC を潰すことです。trusted visual check が直ったとしても、現状の #2136 AC2/AC3/AC4 は merge-ready の証拠として不足しています。
独立 current-head レビュー
独立 read-only review で、AC1–AC6、Allowed Paths、optional transport pair、Issue artifact-root confinement、argparse 前 raw argv reject、fixture の
verdict: APPROVE
reviewed_head_sha: "29c21a4e1cc2ebdd4ea5af7f1c3c02a96f49d2e3"
blockers: []
warnings:
- "GitHub submitted formal review ではなく、repository contract に従う current-head evidence comment。"
- "#2145/#2144 trusted workflow overlap と stale_pr_metadata_epoch は #2136 scope 外。" |
|
調査時点では、PR #2143 の head は 旧レビューで指摘された4件、つまり「実効 また 以下をそのまま Claude Code に渡せます。 Claude Code 作業プロンプト — PR #2143 impl-review-loopRepository: Objective既存 PR #2143 に対して repository-native の current main への追従・競合解消 → 実装修正 → Verification → required CI → 独立 adversarial PR review → fix_delta → 再検証 を、通常の iteration ごとの人間承認を求めず自律的に反復してください。 最終到達点は **マージそのものではなく「マージ直前」**です。 以下をすべて同一 fresh PR head について満たした時点で停止してください。
PR を merge してはいけません。 Autonomy policy通常の実装、テスト、commit、push、conflict resolution、review fix、再レビューについて、人間の iteration approval を求めないでください。 ただし、これは security / permission / repository guard の bypass を意味しません。 禁止:
rebase 後の push が必要な場合は repository runbook に従い、必要な場合のみ repository-native Authority / freshness ruleこの prompt に書かれた SHA、CI 状態、過去 verdict は starting observation にすぎず authority ではありません。 作業開始時と、各 mutation 後、最終判定直前に必ず live state を再取得してください。 最低限: git fetch origin main
git rev-parse origin/main
gh issue view 2136 \
--repo squne121/loop-protocol \
--json title,body,state,comments,updatedAt
gh pr view 2143 \
--repo squne121/loop-protocol \
--json \
number,state,isDraft,headRefName,headRefOid,baseRefName,mergeable,mergeStateStatus,body,comments,reviews
gh pr diff 2143 \
--repo squne121/loop-protocol過去の Mandatory repository sources最初に以下を live read してください。 Primary contract
Repository workflow
live repository の記述を、この prompt より優先してください。 Mandatory historical investigationIssue/PR 番号から内容を推測せず、live body / comments / diff を取得してください。 最低限:
Current-state conflict handlingprompt 作成時点では PR #2143 は main advancement による conflict 状態でした。 したがって live state でも root thread が直接 conflict edit を行わず、 解決後は必ず:
してください。 旧 head の test/CI/review evidence を merge readiness に流用してはいけません。 SubAgent disciplineroot thread は control-plane に限定してください。 root が直接:
を兼任しないでください。 repository-native dispatch に従い、
を使ってください。 各 SubAgent は nested SubAgent delegation をしないでください。 各 dispatch について:
を確認し、最終判定前に timeout や途中 mailbox message を completion と扱わないでください。 External research変更対象の技術について Web research を行ってください。 一次資料を優先してください。 最低限: GitHub CLI official documentation確認事項:
目的:
Python official documentation確認事項:
pytest official documentation確認事項:
Git official documentation確認事項:
external research の結論は raw human instruction として worker に渡さず、root が repository evidence と突き合わせて Adversarial review requirements単なる「Issue の文字列どおり実装されているか」ではなく、security boundary と false-green の両方を攻撃してください。 以下は 仮説です。必ず current main + fresh PR diff で prove / falsify してください。 H0 — stale approval / stale CI旧 PR head の approval や CI success は、current main への conflict resolution 後には無効です。 以下を fresh head に bind し直してください。
PR 本文の evidence も fresh values に更新してください。 H1 — P1 candidate: target Issue artifact-root 自体の symlink alias現在の実装が概念的に、 prefix = f".claude/artifacts/issue-refinement-loop/{issue_number}/"
artifact_root = realpath(join(root, prefix))
resolved = realpath(join(root, path))
commonpath([artifact_root, resolved]) == artifact_rootのような判定なら、次を敵対的に試してください。 その上で lexical path が、 である場合に parser が誤って accept しないか確認してください。 同様に:
を確認してください。 Issue #2136 AC2 の意味は単なる repository confinement ではなく、 target Issue #2136 の artifact root への binding です。 If confirmedAllowed Paths 内の最小修正で、target Issue artifact root 自体やその trusted path components の symlink substitution を reject してください。 既存 security utility / precedent があれば再利用してください。 過剰な新 security framework は作らないでください。 最低限、次の regression test を追加してください。 fixture と transport の双方を確認してください。 H2 — optional transport pair の end-to-end 証明不足
以下を層ごとに確認してください。
parser unit test が PASS するだけで、executor が absent case を誤拒否していない証明になるか敵対的に評価してください。 executor 層が独立して regression 可能なら、transport-absent の real-executor regression を追加してください。 ただし AC3 の
を別目的として分離してください。 H3 — raw argv serialize → shlex parse round-tripcurrent executor が raw argv を、 " ".join(raw_argv)で string 化した後、policy 側が 特に:
について placeholder contract がそもそも禁止しているか確認してください。 Case Acontract がこれらを明示的に禁止している: → reject regression を追加し、現在の grammar が intentional であることを固定。 Case Bcontract 上 valid: → string round-trip に依存せず argv-native validation にするか、少なくとも lossless な quoting を使用。 ただし production parser の一般化や grammar widening は行わないでください。 H4 — gh canary が本当に executor child から resolve されるか以下をすべて確認してください。
単に、 assert not sentinel.exists()だけを見て PASS にしないでください。 実際に child environment で H5 — production lane isolation新しい test-only sibling により、以下が accidentally widen されていないか確認してください。
特に production
が漏れていないことを確認してください。 H6 — authority / binding laundering以下を negative test してください。
いずれも canonical child の起動前、または transport validation 境界で fail-closed になることを確認してください。 H7 — known_context false-green の再発AC3 positive E2E fixture に以下を直接 inject してはいけません。 human-context authority は、 を実際に通って導出されることを確認してください。 H8 — local clone / test isolationreal-assets test が local clone + copy を利用している場合、source repository の dirty / mutable state を accidentally test input として取り込まないことを確認してください。
Scope controlIssue #2136 の live 現在の契約で許可されたファイル以外が必要になった場合は、勝手に scope expansion しないでください。 特に以下はこの PR に混ぜない:
ただし current main との Git conflict を Issue #2136 の変更を保存するために解消することは conflict runbook の範囲で処理してください。 Implementation looprepository-native default 各 iteration: REQUEST_CHANGES
人間承認を挟まない。 stale reviewed headfresh head で再レビュー。 BEHINDrepository-native update-branch route に従う。 CONFLICTING / DIRTYCONFLICTING PR Escalation Runbook に従う。 BLOCKED / UNSTABLE / UNKNOWNrepository-native routing と bounded retry を使用し、自己判断で approval に昇格させない。 VerificationIssue #2136 の live 加えて、今回の adversarial review で追加・変更した failure mode の targeted tests を実行してください。 最低限の regression scope: uv run --locked pytest \
.claude/skills/issue-refinement-loop/tests/test_command_registry.py \
.claude/skills/issue-refinement-loop/tests/test_command_registry_security.py \
-q
uv run --locked pytest \
scripts/agent-guards/tests/test_skill_runtime_policy_anchor.py \
scripts/agent-guards/tests/test_skill_runtime_exec_anchor.py \
-q
uv run --locked pytest \
.claude/skills/issue-refinement-loop/tests/test_fixture_human_context_subprocess.py::test_fixture_human_context_real_subprocess_reaches_contract_update_required_ac3 \
-q
uv run --locked pytest \
.claude/skills/issue-refinement-loop/tests/ \
-qIssue の supplemental Ruff command も current live body から取得して実行してください。 さらに: git diff --checkを実行。 agent-guards 全体が repository policy 上必要なら current canonical command で実行してください。 test count を prompt 内の過去値に合わせる必要はありません。fresh result を正本としてください。 Required CIpush 後は current PR head SHA を再取得してください。 repository の branch protection / current repository policy から required checks を live resolve してください。 旧 workflow run の success を再利用しないでください。 required check failure があれば、CI log helper を使って root cause を取得し、fix_delta に含めて loop を継続してください。 Final independent adversarial reviewCI success 後、fresh reviewer には実値として:
を渡してください。 reviewer は最低限: verdict: APPROVE | REQUEST_CHANGES | HUMAN_REVIEW_REQUIRED
reviewed_head_sha: "<exact current head>"
blockers: []
warnings: []を返すこと。 レビュー投稿前後で PR head を readback し、head が変わったら verdict を stale として破棄し fresh review をやり直してください。 PR body update最終 fresh head について PR 本文の evidence を更新してください。 最低限:
過大 claim をしないでください。 特に、 のような security claim は、それを直接壊そうとする negative control が PASS した場合だけ Completion condition次の条件が すべて同一 head SHA に対して成立したら終了してください。 completion:
issue_2136_ac1_ac6: pass
allowed_paths: pass
verification_commands: pass
supplemental_checks: pass
required_ci: pass
reviewer_verdict: APPROVE
reviewed_head_matches_current_head: true
blockers: []
live_mergeability_route: approved
worktree_clean: true
unresolved_conflict: false
dangling_subagents: 0その時点で、 として停止してください。 merge は実行しないでください。
Hard-stop reportrepository-native hard stop に到達した場合は、承認を求める曖昧な質問ではなく、停止理由を具体的に返してください。 IMPL_REVIEW_LOOP_RESULT_V1:
status: draft_pr_ready | human_escalation | max_iterations | hard_stop
issue: 2136
pr: 2143
current_main_sha: "<sha>"
current_pr_head_sha: "<sha>"
mergeability:
mergeable: "<value>"
merge_state_status: "<value>"
verification:
status: pass | fail
commands: []
required_ci:
status: pass | fail | incomplete
checks: []
review:
verdict: APPROVE | REQUEST_CHANGES | HUMAN_REVIEW_REQUIRED | null
reviewed_head_sha: "<sha|null>"
blockers: []
warnings: []
adversarial_hypotheses:
H1_issue_root_symlink_alias: confirmed | falsified | unresolved
H2_optional_transport_e2e: confirmed | falsified | unresolved
H3_raw_argv_roundtrip: confirmed | falsified | unresolved
H4_gh_canary_resolution: confirmed | falsified | unresolved
H5_production_lane_isolation: confirmed | falsified | unresolved
H6_binding_fail_closed: confirmed | falsified | unresolved
H7_known_context_false_green: confirmed | falsified | unresolved
H8_test_isolation: confirmed | falsified | unresolved
changed_paths: []
out_of_scope_findings: []
subagents:
launched: 0
completed: 0
failed_or_blocked: 0
dangling: 0
termination_reason: "<reason>"取得不能な evidence を推測で PASS にしないでください。 このプロンプトの主眼は、いま残っている |
29c21a4 to
a978c06
Compare
…erage (H2) H1 (confirmed): `_is_safe_issue_artifact_path()`'s realpath+commonpath confinement is bypassable when a directory inside -- or exactly at -- the artifact-root prefix is a symlink, since both sides of the comparison resolve through the same symlink and still agree. Added `_path_contains_symlink_component()` to reject any symlinked path component (fixture, transport, intermediate dir, or the artifact-root prefix itself / sibling-issue-root alias) before realpath resolution. H3 (confirmed): skill_runtime_exec.py re-serializes already-parsed argv into a `" ".join(...)` string before the policy layer re-tokenizes it with `shlex.split()` for validation, while the REAL child argv is built separately from the untouched original values. A fixture/transport path containing whitespace/quotes/backslash could validate a different (truncated) substring than the one actually forwarded to the real child. `_is_safe_repo_relative_fixture_path()` now rejects those characters outright, and skill_runtime_exec.py additionally validates `args.fixture` / `args.investigation_evidence_transport_path` directly (argv-native, before any serialization) for the fixture+human-context sibling. H2: added a real-subprocess regression proving the executor's own admission/dispatch path (not just the parser) accepts the `--investigation-evidence-transport-path`-absent case. H4/H5/H6/H7/H8: investigated, already adequately covered by the existing PR #2143 test suite -- no changes required.
Verdict: APPROVEIndependent review at head Verification performed
Blockers(none) verdict: APPROVE
reviewed_head_sha: "9a7037e900e1d3fbaa4e8489c813a8a8e1c713d8"
blockers: []
warnings: [] |
Summary
fixture と human-context を同時に渡す test-only sibling command
preflight.run.fixture.with_human_contextを追加し、real executor subprocess から real preflight/planner までを offline E2E で検証します。production のpreflight.run.with_human_contextは変更していません。今回の hardening は、transport の optional pair、Issue artifact-root confinement、argparse 前の raw argv exact gate、CLI 由来の human-context authority、実到達する
ghcanary と空のGH_CONFIG_DIRを対象にします。Closes #2136(本 PR は Issue #2136 を完了させます。)
Checks
fe3c2f8aca410a1f0b085bd64566fb596d5b94089a7037e900e1d3fbaa4e8489c813a8a8e1c713d8sha256:3b3f88e7ed3a2add644c3bbda751fedfedd0a6d7e8c52de764573fd5c69618fcwait_ci_checks.py --requiredで head9a7037e9に bind して確認。typecheck/lint/test/build/python-test(agent-session-manifestvalidate-generated-artifact)すべてSUCCESS。full check list(e2e-core、e2e-responsive-matrix含む)もgh pr checks 2143で全SUCCESS(deploy-pages系のみ環境上SKIPPED)。80 passed。39 passed。transport present/absent はともに valid、partial・duplicate・reordered・--flag=value・unknown・symlink(H1)・whitespace/quote/backslash を含む fixture path(H3)は child 起動前に reject します。1 passed。exact argv を検証し、route はcontract_update_required、implementation_allowedは false。fixture/transport は Issue 実装: preflight.run.with_human_context に gh fixture 対応を追加し AC3 positive route の real subprocess E2E を完成する #2136 artifact root に束縛され、fixture にknown_contextを注入せず CLI の human-context URL から derived planner output でのみ束縛されることを assert 済み。gh解決先は test-only canary、sentinel は未発火(real subprocess run で証明、親側 diagnostic probe のみに依存しない)。GitHub token env は除去し、空の per-testGH_CONFIG_DIRとGH_PROMPT_DISABLED=1を real child へ渡し、network/live API fallback は成功根拠にしていません。1342 passed(回帰なし)。Ruff とgit diff --checkは pass。9a7037e9に bind、H1-H8 を自ら再検証):verdict: APPROVE、blockers: []。feat(refinement): fixture human-context runtime profile #2143 (comment)mergeable: MERGEABLE、mergeStateStatus: CLEAN。Schema Change Applicability
Schema Consumer Inventory
既存 consumer は registry validator、policy exact parser、executor dispatch、関連 pytest です。新 profile は既存 command ID の意味を変更せず、専用 ID のみを追加します。
Safety Claim Matrix
shell=Falseを維持するyes--fixturereject と agent-report 側 transport reject の双方を再確認"/'/\を shared helper で reject + argv-native pre-check、grammar widening なしNotes
test_operator_selected_scope_reframe.pyで main 側の新規回帰テストとこの PR の追加ブロックが同一ファイル末尾に競合)、main 側の変更を保持したまま解消(削除 0 行、追加のみ)。visual-impact-policy-trustedの body-byte transport defect は 実装: visual-impact-policy-trusted の PR body 独立検証を producer 側改行取り扱いと一致させ pr_body_digest_mismatch 誤検知を解消する #2145 の別スコープです。PR 実装: visual-impact-policy-trusted に TS import graph transitive reachability の trusted-side 独立検証を追加する #2144 と同じ trusted workflow step に semantic overlap があるため、この PR へ workflow 修正は混入させません。same-head PR metadata epoch も別 follow-up taxonomy です。