Repository navigation
feat(#1209): worktree bootstrap controlled executor - #1216
Conversation
Preview URLPreview removed (PR #1216 closed). |
|
test comment |
PR レビュー判定: feat(#1209) worktree bootstrap controlled executorreviewed_head_sha: b805770 Allowed Paths GateALLOWED_PATHS_GATE_RESULT_V1: 変更ファイル 10 件すべてが Allowed Paths 内に収まっている。 CI 状態PASS: typecheck, lint, build, test(pnpm), actionlint, check-hook-integrity, validate-generated-artifact FAILURE:
IN_PROGRESS(CI スナップショット時点): python-test, e2e AC カバレッジAC1 (WORKTREE_BOOTSTRAP_RESULT_V1 stdout JSON): PASS ブロッカーB1: node-backed-hook-tests CI FAILURE 3 つの新規テストファイルが .github/ci/python-test-plan.json に未登録。
.claude/hooks/tests/test_worktree_scope_guard_worktree_bootstrap.py は既存の .claude/hooks/tests/ target でカバー済み。 必要な修正: .github/ci/python-test-plan.json の targets に tests/agent_ops/ ディレクトリと tests/codex/test_worktree_bootstrap_command_policy.py を追加する。 B2: PR Body Japanese Check CI FAILURE Closes #1209 行(11文字、日本語 0)が独立 prose block として判定されており per-block 閾値 0.1 を満たさない。 LOOP_VERDICT_V2schema: LOOP_VERDICT_V2
|
worktree_bootstrap_exec.py と worktree_bootstrap_command_policy.py を追加し、 implement-issue の Step 3 の raw git worktree add を executor 経由に置換する。 - scripts/agent-ops/worktree_bootstrap_exec.py: WORKTREE_BOOTSTRAP_RESULT_V1 を stdout JSON-only で返す controlled executor。AC1-AC7 対応。 - scripts/agent-guards/worktree_bootstrap_command_policy.py: canonical command と rtk 1段 envelope の同値判定ポリシー。AC9 対応。 - local_main_branch_guard.py: REASON_WORKTREE_BOOTSTRAP_EXECUTOR 定数追加 + step 13.7 で executor コマンドを allow。AC9 対応。 - worktree_scope_guard.py: _wbe_exec_command で bootstrap executor を allow。 AC10 対応。 - implement-issue/SKILL.md Step 3 を executor 呼び出しに置換。AC8 対応。 - implementation-worker.md に worktree_bootstrap_exec.py 参照を追加。AC11 対応。 - 4 テストファイル追加: AC1-AC11 全 AC を pytest で検証。 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
tests/agent_ops/test_worktree_bootstrap_exec.py、 tests/agent_ops/test_implement_issue_worktree_bootstrap_docs.py、 tests/codex/test_worktree_bootstrap_command_policy.py を python-test-plan.json の targets に登録し CI 自動検証を確立する。 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
55f9e05 to
4a74228
Compare
squne121
left a comment
There was a problem hiding this comment.
Request Changes 解消確認(orchestrator 代理投稿)
iteration 1 レビュー判定: B1 (python-test-plan.json) / B2 (PR body Japanese) は解消済み。
B3 (CONFLICTING/DIRTY) 修正のため rebase 実施中。
判定: REQUEST_CHANGESPR #1216 の方向性は正しいです。 ただし、現状は merge ready ではありません。CI は現 head P0 ブロッカー1.
|
…ing, cd step, negative fixtures
B1: implementation-worker.md を修正して executor が返す `worktree_path` を
`IMPLEMENT_RESULT_V1.worktree` にマップすると明記(旧: `worktree` フィールドと誤記)。
test_implement_issue_worktree_bootstrap_docs.py に JSON key / consumer mapping 検証テストを追加。
B2: implement-issue SKILL.md Step 3 に executor 成功後の cwd 移行フローを追加:
BOOTSTRAP_JSON 取得 → status 確認 → worktree_path 取得 → cd "$WORKTREE" → branch 検証。
docs テストに worktree_path と cd の存在確認テストを追加。
B3: worktree_bootstrap_exec.py に symlink escape guard を追加:
_is_under() で realpath が project_root 配下かを確認。
.claude/worktrees/ 自体が symlink の場合も blocked/invalid_path を返す。
test_worktree_bootstrap_exec.py にシンボリックリンク escape fixture を追加。
B4: 作成後 readback を _validate_existing_state() 相当に強化:
non-detached / exists_on_disk / basename / branch_ref を再検証。
B5: 否定 fixture を追加:
test_worktree_bootstrap_command_policy.py: bash -lc / rtk bash -lc / env prefix /
duplicate --json / extra positional / rtk + unknown flag を block 検証。
test_worktree_scope_guard_worktree_bootstrap.py: 同様の否定 fixture を追加。
B6: worktree_bootstrap_exec.py で --json フラグ未指定時に blocked/invalid_args を返す。
test_worktree_bootstrap_exec.py に --json 省略テストを追加。
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Summary
implement-issue の worktree 作成ステップを
scripts/agent-ops/worktree_bootstrap_exec.pyによる controlled executor 経由に置換する。これにより、rawgit worktree addシェル呼び出しと rtk/raw git policy 衝突を解消し、hook allowlist での確実な allow を実現する。主な変更内容:
scripts/agent-ops/worktree_bootstrap_exec.py:WORKTREE_BOOTSTRAP_RESULT_V1を stdout JSON-only で返す controlled executor。引数検証・repo root 検証・default branch 検証・idempotent readback(ok_existing)・git subprocess (shell=False, capture_output=True, timeout付き) を実装。scripts/agent-guards/worktree_bootstrap_command_policy.py: canonical command と rtk 1段 envelope の同値判定ポリシー。scripts/agent-guards/local_main_branch_guard.py: executor コマンドを allow する step 13.7 を追加。.claude/hooks/worktree_scope_guard.py: bootstrap executor をアクティブ issue worktree 有り状態でも allow。.claude/skills/implement-issue/SKILL.md: Step 3 の rawgit worktree addを executor 呼び出しに置換。.claude/agents/implementation-worker.md: V1 dispatch セクションに executor 結果フィールドの説明を追加。Checks
pnpm typecheckpnpm lintpnpm testpnpm builduv run pytest tests/agent_ops/test_worktree_bootstrap_exec.py -vuv run pytest tests/agent_ops/test_implement_issue_worktree_bootstrap_docs.py -vuv run pytest tests/codex/test_worktree_bootstrap_command_policy.py -vuv run pytest .claude/hooks/tests/test_worktree_scope_guard_worktree_bootstrap.py -vSchema Change Applicability
Python スクリプト・hook・SKILL.md の変更のみ。外部 machine-readable contract(JSON schema 等)への変更なし。
python-test-plan.jsonは CI テストターゲットの追加であり、schema 変更には該当しない。Schema Consumer Inventory
schema 変更なし(not_schema_change)のため、Consumer Inventory は対象外。
Safety Claim Matrix
git worktree addは引き続きブロックtest_given_active_issue_worktree_when_raw_git_worktree_add_runs_then_guard_blockstest_given_active_issue_worktree_when_canonical_bootstrap_command_runs_then_guard_allowstest_given_active_issue_worktree_when_rtk_wrapped_bootstrap_command_runs_then_guard_allowstest_given_non_default_base_ref_when_bootstrap_runs_then_base_ref_is_rejectedtest_given_invalid_relative_escape_when_bootstrap_runs_then_path_is_rejectedtest_given_root_not_on_default_branch_when_bootstrap_runs_then_executor_blocksNotes
4 テストファイルを追加し全 AC をカバー:
tests/agent_ops/test_worktree_bootstrap_exec.py: AC1-AC7(7 テスト)tests/agent_ops/test_implement_issue_worktree_bootstrap_docs.py: AC8, AC11(2 テスト)tests/codex/test_worktree_bootstrap_command_policy.py: AC9(5 テスト).claude/hooks/tests/test_worktree_scope_guard_worktree_bootstrap.py: AC10(3 テスト)Closes #1209(本 PR が merge された際に Issue #1209 を close します)