Repository navigation
feat(guard): GitHub remote ops 5 分類実装 — gh issue create/edit を github_issue_mutation_command として許可 (#1124) - #1126
Conversation
Preview URLPreview removed (PR #1126 closed). |
|
LOOP_VERDICT_V2: APPROVE. AC1-AC15 PASS. Allowed Paths OK (7 files, all within scope). BEHIND origin/main by 1 docs-only commit. Rebase needed before merge. |
9db499c to
5c9abf0
Compare
…_issue_mutation_command として許可 (#1124)
5c9abf0 to
921f51b
Compare
判定REQUEST_CHANGES。現状のままマージ不可。 PR #1126 は draft の open PR で、変更は 7 ファイル・+609/-7、対象は Issue #1124 の allowed paths 内に収まっています。CI も ただし、 重大ブロッカーB1.
|
…th, --web blocked, strict B4 checks
…th, --web blocked, strict B4 checks
|
LOOP_VERDICT_V2: REQUEST_CHANGES — iteration 1 review posting (full verdict below) |
|
LOOP_VERDICT_V2 iteration 1 - review_subagent - verdict: REQUEST_CHANGES - merge_ready: false - merge_state_status: CLEAN - reviewed_head_sha: 8e08d96 - allowed_paths_gate.status: ok - allowed_paths_gate.producer_role: review_subagent - allowed_paths_gate.worker_report_used_as_canonical: false |
|
LOOP_VERDICT_V2 RB1: is_readonly_artifact_export_command lacks browser-flag check. gh issue view 123 with browser-open flag and redirect to tmp passes Step 5.5 incorrectly. is_readonly_command blocks this via _gh_has_web_flag but the export path skips this. Human review B3 required browser-flag block in export. Fix: add _gh_has_web_flag(lhs_stripped) guard before return True in is_readonly_artifact_export_command. |
|
LOOP_VERDICT_V2 RB2: Missing adversarial test in TestReadonlyArtifactExportCommand. AC12 parameter list needs: gh issue view 1124 with path-traversal redirect (tmp/../docs/foo.md). Implementation _is_safe_tmp_redirect_dest correctly blocks via dotdot in p.parts, but human review explicitly required this test case. Also missing: view with browser-open flag and redirect to tmp. |
|
LOOP_VERDICT_V2 confirmed resolved: B1 (title required for gh issue create - _find_flag_value check + test_b1 confirmed), B2 (tmp dotdot body-file path traversal blocked + test_b2_body_file_path_traversal_blocked), B4 (interactive and destructive flags blocked, base blocked for pr edit, bare body blocked, tests in TestB1B4ReviewBlockerFixes confirmed). Allowed Paths: all 7 files in contract. CI: all SUCCESS. |
RB1: is_readonly_artifact_export_command now blocks --web/-w flag scripts/agent-guards/local_main_branch_guard.py: - add _gh_has_web_flag(lhs_stripped) check before return True RB2: AC12 parametrize with 2 new blocked cases tests/codex/test_local_main_branch_guard.py: - "gh issue view 1124 > tmp/../docs/foo.md" (path traversal) - "gh issue view 1124 --web > tmp/foo.md" (--web flag) .claude/hooks/tests/test_local_main_branch_guard.py: - same 2 cases in TestReadonlyArtifactExportCommandClaude.AC12 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
5d61df4 to
43dffdb
Compare
|
test |
|
RB1 PASS, RB2 PASS, APPROVE pending CI. LOOP_VERDICT_V2 to follow. |
iteration 2 レビュー — bot review subagentRB1・RB2 解消確認済み。B1〜B4 退行なし。Allowed Paths gate OK。 CI: commit 8e08d96(HEAD-1)全 12 ジョブ SUCCESS。commit 43dffdb(HEAD)は 8 行追加のみで CI 未実行(UNSTABLE)。 LOOP_VERDICT_V2: |
6fc695d to
43dffdb
Compare
Summary
scripts/agent-guards/local_main_branch_guard.pyに GitHub CLI コマンドの 5 分類体系を実装し、AI workflow 必須のgh issue create/editをgithub_issue_mutation_commandとして許可し、gh issue view ... > tmp/*.mdをreadonly_artifact_export_commandとして許可する(Issue #1124)。変更内容
scripts/agent-guards/local_main_branch_guard.py:GITHUB_CMD_CLASS_*)とTRUSTED_REPO_SLUG = "squne121/loop-protocol"を追加is_github_issue_mutation_command():gh issue create/editに--repo squne121/loop-protocolと--body-file tmp/...が必須、--editor/--webはブロックis_readonly_artifact_export_command():gh issue view ... > tmp/<file>の形式のみ許可、>>/src//docs//.env宛ては拒否evaluate()に Step 5.5(readonly artifact export、メタキャラ検出前に評価)と Step 9.6b(github issue mutation)を追加テスト:
tests/codex/test_local_main_branch_guard.py: AC8〜AC15 の境界テスト 40 ケース追加(99 → 139 テスト).claude/hooks/tests/test_local_main_branch_guard.py: AC8〜AC15 の境界テスト 37 ケース追加(208 → 245 テスト)ドキュメント・ポリシー:
docs/dev/hook-boundaries.md: 5 分類の判断基準セクション追加docs/dev/agent-skill-boundaries.md: gh CLI 5 分類語彙セクション追加AGENTS.md: managed skill 経由のgh issue create/edit許可を明記.codex/rules/default.rules:gh issue create/editの justification に managed skill 例外を明記5 分類語彙
display_readonly_commandreadonly_commandgh issue view,gh pr viewreadonly_artifact_export_commandreadonly_commandgh issue view ... > tmp/*.mdgithub_issue_mutation_commandgithub_remote_ops_commandgh issue create/edit(--repo + --body-file 必須)github_pr_metadata_commandgithub_remote_ops_commandgh pr comment/reviewgithub_destructive_commandgh_mutation_deniedgh pr merge,gh pr checkoutChecks
pnpm typecheckPASSpnpm lintPASSpnpm testPASS(929 件通過)pnpm buildPASSuv run pytest tests/codex/test_local_main_branch_guard.py -vPASS(139 件通過)uv run pytest .claude/hooks/tests/test_local_main_branch_guard.py -vPASS(245 件通過)uv run pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.pyPASS(21 件通過)Schema Change Applicability
変更対象はガードスクリプト・テストファイル・ドキュメントのみで、JSON Schema / YAML Schema の追加・変更なし。スキーマ変更に該当しない。
Schema Consumer Inventory
スキーマ変更なし(
not_schema_change)のため、Schema Consumer Inventory は該当しない。消費側の影響調査は不要。Safety Claim Matrix
本 PR は
.claude/hooks/tests/への変更を含むため、agent-surface に分類される。以下の具体的な証跡を添付する。TestGithubIssueMutationCommand/TestReadonlyArtifactExportCommandクラス追加確認)github_issue_mutation_command)は最小スコープ--repo squne121/loop-protocolと--body-file tmp/...の両方を必須化、bare/interactive はブロック(AC10 テスト PASS)readonly_artifact_export_commandは tmp/ 以外への書き込みをブロックsrc/,docs/,.env,>>宛てはすべてブロック(AC12 テスト PASS)Notes
PR #1120(fix: gh issue/pr GitHub ops を allowlist-closed から除外)のフォローアップとして、GitHub CLI コマンドの 5 分類体系を確立する(Closes #1124)。Allowed Paths 内の 7 ファイルのみを変更している。本 PR は Claude Code を使って実装・生成した。