Repository navigation
fix(tests): test_agent_parity.py を NESTED_DELEGATION_001 の advisory-only 化に追従させる - #1959
Conversation
…nly 化に追従させる (#1948) PR #1879(af511e17)で scripts/check_claude_codex_agent_parity.py の compare_parity() から strict な NESTED_DELEGATION_001 drift 判定が削除され、 delegation_intent_hint(blocked | allowed | unknown)による advisory-only ヒントへ置き換わったが、tests/test_agent_parity.py 側が追従しておらず main の regression gate が baseline で FAIL していた。 - TestNestedDelegation 配下の該当テストを advisory 判定へ書き換え、 strict-drift 前提の stale なテスト名・docstring・fixture 参照を是正 - TestAdvisoryDelegationSemantics を新設し、hint 不一致が drift を生成 しないこと・STATUS/exit code に影響しないこと・ classify_delegation_intent_hint() の三値分類+blocked 優先を固定 - tests/test_agent_parity.py を .github/ci/python-test-plan.json の required Python unit lane に登録 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Preview URLPreview removed (PR #1959 closed). |
Mergeabilitymergeable=MERGEABLE, merge_state_status=CLEAN(control-plane が Evidence Check
Blockersなし Non-blockers / Warningsなし verdict: APPROVE
reviewed_head_sha: "1b93270ea3585d3aba11f00524deb5188386b0ac"
blockers: []
warnings: [] |
結論REQUEST_CHANGESです。 CI配線そのものは正常です。 問題は、PASSしているテストがIssueの要求契約を完全には証明していないことです。 マージ阻害事項1. AC2の「hint不一致」をテストしていない
しかし、テスト名とACが前提にしている Claude/Codexのhintが実際に不一致であることを一度もassertしていません。fixture変更により両者が同じhintになっても、このテストはgreenのままです。 既存の 最低限、専用テスト内で次を固定すべきです。 assert entry["claude_intent_hint"] == "allowed"
assert entry["codex_intent_hint"] == "unknown"
assert entry["claude_intent_hint"] != entry["codex_intent_hint"]その後にno-drift、STATUS、exit codeを検証してください。 2. AC3の「各要素」を満たしていないIssue #1948のAC3は、 entry = data["nested_delegation_report"][0]したがって、2件目以降のagentからキーが欠落していてもPASSします。 全要素を反復し、値のドメインも固定すべきです。 for entry in report:
assert required_keys <= entry.keys()
assert entry["claude_intent_hint"] in {"blocked", "allowed", "unknown"}
assert entry["codex_intent_hint"] in {"blocked", "allowed", "unknown"}
assert isinstance(entry["claude_evidence"], str)
assert isinstance(entry["codex_evidence"], str)また、既存テストのdocstringは旧キーの 3. V2移行の回帰テストがV1 fixtureを通っている
[agents]
max_depth = 1
一方、実リポジトリは次のV2設定です。 [features.multi_agent_v2]
enabled = true
max_concurrent_threads_per_session = 4本番checkerも、V2がtrueの場合とそうでない場合で別の分岐・evidenceを生成します。現行unit testは後者、すなわち「V2がstrict boolean trueではない」分岐を通しており、PR #1879で導入されたV2有効時の分岐を直接固定していません。 さらに、リポジトリがpinしているCodex CLI 次の分離が必要です。
4. Issueで明示されたstale vocabularyが残っているIssue #1948は、六つのassertionだけでなく、fixture名・関数名・ しかし、現在も次の逆向き名称が残っています。
実装内容は「driftを生成しない」「failにならない」へ変更されており、名前が挙動と正反対です。 これは単なる可読性問題ではありません。pytestの 例えば次のように改名すべきです。
設計上の重大な警告5. 正本とされるproduction scriptの説明が依然としてstrict drift契約
一方、Issue #1948はこのscriptの実装・コメントをadvisory-only設計の直接的な正本として扱っています。テストだけ直して正本の説明を放置すると、次の変更者がdocstringを根拠にstrict判定を復元する可能性があります。 Allowed Pathsを拡張してdocstringを修正するか、少なくとも明示的なfollow-up Issueをblocking dependencyとして作るべきです。 6. 「delegationは絶対にdriftにならない」という表現が広すぎる新しい関数名やdocstringには、delegationが「regardless of match/mismatch」「never produces drift」とあります。 しかし後続Issue #1943は、prose heuristicとは別に、正規化された 表現は次のように限定すべきです。
「delegation全般はdriftにならない」という一般化は避けるべきです。 再発防止・証跡上の問題PR #1879のSchema Consumer Inventoryから それにもかかわらずPR #1959は、 これは「producer変更時にunchanged consumerをinventoryから漏らした」という根本原因を記録できません。少なくとも次を残すべきです。 consumer_followup:
producer:
- scripts/check_claude_codex_agent_parity.py
changed_semantics:
- NESTED_DELEGATION_001 removed
- delegation_intent_hint advisory-only
missed_consumers:
- tests/test_agent_parity.py
ci_authority:
- .github/ci/python-test-plan.json
prevention:
- repository-wide old-rule-id search
- consumer test inventory
- ci_test_selection artifact verificationまた、PR本文の 必須修正後の判定条件以下を満たした場合にAPPROVEへ変更できます。
既存の「Blockersなし/APPROVE」コメントは撤回相当です。 CIはgreenですが、現状はIssue #1948のbehavioral contractを完全には満たしていません。 |
Issue #1948 の再レビュー(REQUEST_CHANGES)で指摘された7項目に対応する。 1. AC2: delegation_intent_hint の不一致そのものを明示的に assert してから no-drift/STATUS/exit-code を検証するよう変更。 2. AC3: nested_delegation_report の全要素を反復検証し、値のドメインも固定。 旧キー(claude_blocked/codex_blocked/match)の非存在も明示的に assert。 3. .codex/config.toml の V1([agents].max_depth) / V2 ([features.multi_agent_v2]) fixture を分離し、通常テストは実リポジトリ と同じ V2 をデフォルトにする。V2 が max_depth を authority扱いしない 専用回帰テストを追加。 4. drift/fail を含む逆向き語彙のテスト名・fixture名を advisory な実際の 挙動に合わせて改名(drift-claude-delegation-mismatch.md → advisory-claude-delegation-mismatch.md 含む)。 5. scripts/check_claude_codex_agent_parity.py の docstring を advisory-only 設計に合わせて修正(schema/permission のみ fail-level、delegation は advisory-only)。 6. delegation advisory の表現を delegation_intent_hint mismatch に限定し、 将来の正規化 delegation policy(#1943)まで advisory とは解釈されない よう文言を narrow化。 tests/test_agent_parity.py 78件 (test_codex_agent_bridge_contract.py 含む) 全PASS。
結論APPROVE(fix_delta 後の再レビュー)。 直前の人間 REQUEST_CHANGES(7項目)を受け、implementation-worker が全項目を修正し新 head Mergeabilitymergeable=MERGEABLE, merge_state_status=CLEAN(control-plane が Evidence Check
Blockersなし Non-blockers / Warnings
verdict: APPROVE
reviewed_head_sha: "4ef1a612010402282617c1d0131b89f7dba4b853"
blockers: []
warnings:
- "PR本文のci_test_selection_v1_checked根拠記述がfix_delta前のhead(1b93270e)のCI runを引用したまま。current headのrequired CIは独立にgreen(6/6)確認済みのため非ブロッキング。" |
Summary
af511e17)でscripts/check_claude_codex_agent_parity.pyのcompare_parity()から strict なNESTED_DELEGATION_001drift 判定が削除され、delegation_intent_hint(blocked | allowed | unknown、advisory-only)へ置き換わったが、tests/test_agent_parity.py側が追従しておらず main の regression gate が baseline で FAIL していた(Issue 実装: Claude Code / Codex CLI の implementation-worker に bounded read-only delegation parity を追加する #1943 の AC13 regression gate VC も同じ原因で FAIL していた)。TestNestedDelegation/TestStatusOutput/TestFixtureFiles/TestB3DriftIsFail配下の該当 6 テストを、delegation_intent_hintを用いた advisory 判定に整合するアサーションへ書き換えた。test_delegation_blocked_both_no_driftの関数名・docstring、TestB4RealRepoParityの docstring)を advisory-only 設計へ整合させた。TestAdvisoryDelegationSemanticsを追加し、delegation_intent_hint不一致が drift を生成しないこと・STATUS/--strictexit code に影響しないこと・nested_delegation_reportの必須フィールド・classify_delegation_intent_hint()の三値分類と blocked 優先順位を behavioral に固定した。.github/ci/python-test-plan.jsonのtargetsにtests/test_agent_parity.pyを追加し、required Python unit lane に登録した。fix_delta(REQUEST_CHANGES 対応、head
1b93270e→ 現行 head)owner の REQUEST_CHANGES レビュー(PR コメント)を受け、以下 7 項目を追加で対応した。
test_intent_hint_mismatch_no_drift/test_prose_intent_hint_mismatch_is_advisory(旧test_delegation_mismatch_produces_drift)で、no-drift/STATUS/exit-code の assertion 前にclaude_intent_hint == "allowed"/codex_intent_hint == "unknown"/ 両者の不一致を固定した。test_nested_delegation_report_fieldsをnested_delegation_reportの先頭要素のみでなく全要素を反復するよう変更し、値のドメイン({"blocked", "allowed", "unknown"}/str型)も固定した。test_delegation_report_in_outputには旧キー(claude_blocked/codex_blocked/match)の非存在を明示的に assert する行を追加した。_write_v1_config_toml()(legacy[agents].max_depth)と_write_v2_config_toml()(実リポジトリと同じ[features.multi_agent_v2])を分離し、_run_cli/_run_with_fixturesのデフォルトを V2 にした。新規TestV1V2ConfigSeparation.test_v2_enabled_does_not_treat_max_depth_as_authorityで「V2 有効時にmax_depthが authority として扱われないこと」とnested_delegation_evidenceが生成されることを固定した。test_delegation_mismatch_produces_drift→test_prose_intent_hint_mismatch_is_advisory、test_codex_delegation_from_max_depth→test_v1_max_depth_does_not_define_v2_delegation_state、test_delegation_drift_status_warn→test_intent_hint_mismatch_keeps_status_ok、test_drift_delegation_mismatch_fixture→test_advisory_delegation_mismatch_fixture、test_delegation_drift_produces_fail→test_intent_hint_mismatch_does_not_fail、fixturedrift-claude-delegation-mismatch.md→advisory-claude-delegation-mismatch.md(fixture ファイル自体をリネームし、参照箇所も全て更新)。scripts/check_claude_codex_agent_parity.pyのモジュール docstring・compare_parity()docstring・status 判定コメントを、schema/permission のみ fail-level・delegation は advisory-only という実装と一致する記述へ修正した(Allowed Paths を docstring-only 変更として拡張。owner の item 5 での明示的容認に基づく)。delegation_intent_hintmismatch 単体はNESTED_DELEGATION_001を emit しない」という限定表現へ変更した。将来の正規化 delegation policy(Issue 実装: Claude Code / Codex CLI の implementation-worker に bounded read-only delegation parity を追加する #1943)が常に advisory であるとは含意しないようにした。consumer_followupブロックを追加し、CI_TEST_PERFORMANCE_DECISION_V1.artifact_consistency.ci_test_selection_v1_checkedをtrueに更新した(検証根拠は Checks セクション参照)。Checks
uv run --locked pytest tests/test_agent_parity.py tests/test_codex_agent_bridge_contract.py -q→ 78 passed(test_agent_parity.py54 件 +test_codex_agent_bridge_contract.py25 件、うち fix_delta item 2/3 で新規追加したTestV1V2ConfigSeparation.test_v2_enabled_does_not_treat_max_depth_as_authorityを含む)rg -n "def test_intent_hint_mismatch_no_drift" tests/test_agent_parity.py→ 1 件rg -n "def test_nested_delegation_report_fields" tests/test_agent_parity.py→ 1 件rg -n "def test_classify_delegation_intent_hint_precedence" tests/test_agent_parity.py→ 1 件rg -n "tests/test_agent_parity.py" .github/ci/python-test-plan.json→ 1 件(targetsに追加)rg -n "NESTED_DELEGATION_001" tests/test_agent_parity.py→ 複数件(すべて drift 非生成のアサーション/advisory 説明コメントであり、drift 生成を主張する記述はない)rg -n "test_delegation_mismatch_produces_drift|test_codex_delegation_from_max_depth|test_delegation_drift_status_warn|test_drift_delegation_mismatch_fixture|test_delegation_drift_produces_fail" tests/test_agent_parity.py→ 各 1 件のみ、すべて"""(renamed from ...)docstring 内のリネーム前名称への参照であり、def定義としては存在しない(改名完了の確認)。1b93270e、CI run30729886511):ci_test_selectionartifact のci_test_selection_v1.jsonを実際にダウンロードして確認し、collected_nodeidsにtests/test_agent_parity.py::*が 52 件含まれuncovered_changed_test_files == []であることを確認した。同 run のpython-test-junit-1artifact(junit-parallel.xml)でもtests/test_agent_parity.pyの 52 testcase が全て failure/error なし(52 passed)であることを確認した。fix_delta 適用後の現行 head でもpython-testrequired job が green であることを確認済み。Schema Change Applicability
scripts/check_claude_codex_agent_parity.pyの docstring-only 変更(実装ロジックは無変更)であり、公開スキーマ(*_RESULT_V*等の契約)の追加・変更は行っていない。Schema Consumer Inventory
N/A
reason: schema_change ではないため対象外。ただし本 PR の原因は producer 変更時の consumer inventory 漏れであるため、再発防止のため下記
consumer_followupを記録する。PR #1879 の Schema Consumer Inventory から
tests/test_agent_parity.pyが漏れたことが本 Issue #1948 発生の直接原因であり、not_schema_change判定そのものは変えないが、この漏れの記録を残す。Safety Claim Matrix
N/A
reason: 変更ファイルは
tests/test_agent_parity.py(pytest テスト)、.github/ci/python-test-plan.json(CI target 一覧)、tests/fixtures/agent-parity/(テスト fixture)、scripts/check_claude_codex_agent_parity.py(docstring-only)のみで、transport / permission / sandbox / auth / mcp /.claude/skills//.github/workflows/のいずれにも該当しない non safety-sensitive な変更のため。Notes
af511e17(PR feat(codex): enable multi-agent v2 config #1879、「feat(codex): enable multi-agent v2 config」)tests/test_agent_parity.py、.github/ci/python-test-plan.json)を基本としつつ、owner の REQUEST_CHANGES レビュー item 5 での明示的容認に基づきscripts/check_claude_codex_agent_parity.pyの docstring-only 変更、および item 4 のリネーム対応に伴うtests/fixtures/agent-parity/のテスト fixture リネームを追加で行った(実装ロジック自体は変更していない)。not_applicable(本 Issue は静的テスト修正のみで、プロセス起動・UI 操作・実行時挙動観測を伴わない)。CI_TEST_PERFORMANCE_DECISION_V1
ci_test_selection_v1_checked: trueの根拠: CI run30729886511(head1b93270e)のci_test_selectionartifact(ci_test_selection_v1.json)をダウンロードし、collected_nodeidsにtests/test_agent_parity.py::*が 52 件含まれること・uncovered_changed_test_files == []であることを確認した。同 run のpython-test-junit-1artifact(junit-parallel.xml)でも該当 52 testcase が全て pass(failure/error なし)であることを確認した。claim.kind)は行わない(none)。python_unit レーンの target 追加であり、xdist worker 数・scheduler は変更していない。