Repository navigation
Description
Machine-Readable Contract
contract_schema_version: v1
issue_kind: implementation
parent_issue: "none"
goal_ref: "PR #1879 (af511e17) が advisory-only 化した delegation drift 判定に tests/test_agent_parity.py を追従させ、main の regression gate を green に戻し、tests/test_agent_parity.py を required Python CI gate に登録する"
change_kind: mixedParent Issue
なし(単独改善)
Parent Goal Ref
N/A(親 Issue なし)
Current Validated Scope
N/A(親 Issue なし)
Remaining Parent Gaps
N/A(親 Issue なし)
Runtime Verification Applicability
- decision: not_applicable
- reason: 本 Issue は
tests/test_agent_parity.pyの pytest アサーションと.github/ci/python-test-plan.jsonの CI 登録のみを変更する静的テスト修正であり、プロセス起動・UI 操作・実行時挙動観測を伴わない。uv run --locked pytestによる静的検証のみで完結する。
Outcome
tests/test_agent_parity.py の TestNestedDelegation / TestStatusOutput / TestFixtureFiles / TestB3DriftIsFail 配下にある、削除済みの NESTED_DELEGATION_001 strict drift 判定を前提とした 6 テストと、それ以外に残る strict-drift 前提の stale なテスト名・fixture 名・docstring・変数名が、PR #1879(af511e17)で導入された delegation_intent_hint(advisory-only ヒント、scripts/check_claude_codex_agent_parity.py の classify_delegation_intent_hint() / extract_claude_facts() / extract_codex_facts() / compare_parity())の設計に整合する形へ更新され、advisory semantics(hint 不一致でも drift を生成しない・STATUS/exit code に影響しない)を behavioral に固定するアサーションが追加され、tests/test_agent_parity.py が .github/ci/python-test-plan.json の required Python unit lane に登録され、uv run --locked pytest tests/test_agent_parity.py tests/test_codex_agent_bridge_contract.py が baseline で green になっている状態。
In Scope
tests/test_agent_parity.pyの以下 6 テストを、delegation_intent_hint("blocked" | "allowed" | "unknown")を用いた advisory 判定に整合するアサーションへ書き換える:TestNestedDelegation::test_delegation_mismatch_produces_driftTestNestedDelegation::test_codex_delegation_from_max_depthTestNestedDelegation::test_delegation_report_in_outputTestStatusOutput::test_delegation_drift_status_warnTestFixtureFiles::test_drift_delegation_mismatch_fixtureTestB3DriftIsFail::test_delegation_drift_produces_fail
tests/test_agent_parity.py内に残る、上記6テスト以外の strict-drift 前提の stale な記述を advisory-only 設計へ整合させる(新規テスト追加ではなく、既存の記述の是正・改名を指す):test_delegation_blocked_both_no_drift(関数名・アサーションが strict drift 前提のまま)TestB4RealRepoParityの docstring(strict drift を前提とした説明)deleg_drifts変数を用いたNESTED_DELEGATION_001抽出ロジック(advisory report 参照へ置換、または不要なら削除)drift_delegation_mismatchfixture 名(fixture の内容が advisory report 前提になった場合、名前と内容の不整合を解消)
tests/test_agent_parity.pyに新規クラスTestAdvisoryDelegationSemanticsを追加し、以下の advisory semantics を behavioral に固定するアサーションを実装する:test_intent_hint_mismatch_no_drift: Claude/Codex のdelegation_intent_hintが不一致でもNESTED_DELEGATION_001drift がall_driftsに生成されず、STATUS == "ok"かつ--strictでも exit code が 0 であることtest_nested_delegation_report_fields:nested_delegation_reportの各要素がagent/claude_intent_hint/claude_evidence/codex_intent_hint/codex_evidenceを持つことtest_classify_delegation_intent_hint_precedence:blocked | allowed | unknownの三値分類、および blocked 表現と allowed keyword が共存する場合に blocked が優先されることをclassify_delegation_intent_hint()の unit test で固定する
.github/ci/python-test-plan.jsonのtargetsにtests/test_agent_parity.pyを追加し、required Python unit lane の一部として CI gate 化する- 上記書き換えにあたり、
scripts/check_claude_codex_agent_parity.pyのcompare_parity()/classify_delegation_intent_hint()の現在の実装、および PR feat(codex): enable multi-agent v2 config #1879 の設計判断(advisory-only 化は意図的であり、V2 有効時に strict な delegation 判定を要求しない)を前提にする
Out of Scope
.codex/config.tomlの[features.multi_agent_v2]設定自体の変更scripts/check_claude_codex_agent_parity.pyのdelegation_intent_hintロジック自体の再設計(advisory heuristic の精度向上は別 Issue)- Issue 実装: Claude Code / Codex CLI の implementation-worker に bounded read-only delegation parity を追加する #1943(bounded read-only delegation parity)が要求する
READONLY_DELEGATION_POLICYの実装 NESTED_DELEGATION_001rule_id の再導入(strict 判定を復元する設計変更は別 Issue とする).github/ci/python-test-plan.jsonのtests/test_agent_parity.py以外の既存エントリの変更
Acceptance Criteria
- AC1:
tests/test_agent_parity.pyとtests/test_codex_agent_bridge_contract.pyが pytest で全件 PASS する(AC2-AC4 で追加する新規テストの PASS も本 AC が担保する) - AC2:
TestAdvisoryDelegationSemantics::test_intent_hint_mismatch_no_driftが存在する。Claude/Codex のdelegation_intent_hintが不一致でもNESTED_DELEGATION_001drift が生成されず、STATUS == "ok"かつ--strictの終了コードが 0 であることを検証する(PASS すること自体は AC1 で検証する) - AC3:
TestAdvisoryDelegationSemantics::test_nested_delegation_report_fieldsが存在する。nested_delegation_reportの各要素がclaude_intent_hint/claude_evidence/codex_intent_hint/codex_evidenceを持つことを検証する(PASS すること自体は AC1 で検証する) - AC4:
TestAdvisoryDelegationSemantics::test_classify_delegation_intent_hint_precedenceが存在する。blocked | allowed | unknownの三値分類、および blocked 表現と allowed keyword 共存時に blocked が優先されることを検証する(PASS すること自体は AC1 で検証する) - AC5:
.github/ci/python-test-plan.jsonのtargetsにtests/test_agent_parity.pyが含まれる - AC6:
tests/test_agent_parity.pyにNESTED_DELEGATION_001という strict-drift 前提の文字列が、advisory report の後方互換コメント等を除き、drift 生成を主張する形では残っていない
Verification Commands
# AC1
# vc-role: regression_gate
# baseline-expect: fail
$ uv run --locked pytest tests/test_agent_parity.py tests/test_codex_agent_bridge_contract.py -q
# AC2
# vc-role: behavioral_contract
# baseline-expect: fail
$ rg -n "def test_intent_hint_mismatch_no_drift" tests/test_agent_parity.py
# AC3
# vc-role: behavioral_contract
# baseline-expect: fail
$ rg -n "def test_nested_delegation_report_fields" tests/test_agent_parity.py
# AC4
# vc-role: behavioral_contract
# baseline-expect: fail
$ rg -n "def test_classify_delegation_intent_hint_precedence" tests/test_agent_parity.py
# AC5
# vc-role: ci_selection
# baseline-expect: fail
$ rg -n "tests/test_agent_parity.py" .github/ci/python-test-plan.json
# AC6
# vc-role: regression_gate
# baseline-expect: pass
$ rg -n "NESTED_DELEGATION_001" tests/test_agent_parity.pyAllowed Paths
- tests/test_agent_parity.py
- .github/ci/python-test-plan.json
Stop Conditions
- Allowed Paths 外の変更が必要と判明した場合
- In Scope の固定契約(キー集合・スキーマ・型定義)の変更が必要になった場合
- 新規 Issue の起票が必要と判断した場合(スコープ分割が発生する場合)
- 後続 Phase / 別スコープへの波及が判明した場合
- nested SubAgent delegation が必要になった場合
- 外部サービス利用・権限昇格・既存テスト大規模改変が必要になった場合
Required Skills
なし
Required Design References
scripts/check_claude_codex_agent_parity.pyのcompare_parity()/classify_delegation_intent_hint()/extract_claude_facts()/extract_codex_facts()実装(advisory-only 化の直接の正本)- PR feat(codex): enable multi-agent v2 config #1879(
af511e17、「feat(codex): enable multi-agent v2 config」)の設計判断と consumer inventory docs/dev/workflow.md「Multi-Agent V2 の V1 rollback」節(V2 有効時に strict な delegation 判定を要求しない背景説明。advisory-only 化の直接規範ではなく補助的な文脈情報として扱う)
Scope Delta(任意)
N/A
Notes for Reviewer
- 本 Issue は Issue 実装: Claude Code / Codex CLI の implementation-worker に bounded read-only delegation parity を追加する #1943(squne121/loop-protocol)の issue-refinement-loop 実行中に発見された。実装: Claude Code / Codex CLI の implementation-worker に bounded read-only delegation parity を追加する #1943 の AC13 regression gate VC(
uv run --locked pytest tests/test_agent_parity.py tests/test_codex_agent_bridge_contract.py)が baseline で予期せず FAIL しており、その根本原因が本 Issue である。実装: Claude Code / Codex CLI の implementation-worker に bounded read-only delegation parity を追加する #1943 は本 Issue の完了(または AC13 側のスコープ調整)を待つ hard blocker 関係にある。 - 原因コミット:
af511e17(PR feat(codex): enable multi-agent v2 config #1879、「feat(codex): enable multi-agent v2 config」)。同コミットでscripts/check_claude_codex_agent_parity.pyからrule_id="NESTED_DELEGATION_001"を発行していた strict drift 判定ブロック(compare_parity()内、旧「Nested delegation parity (AC4, AC9)」節)が削除され、delegation_intent_hintという advisory-only ヒントに置き換わったが、tests/test_agent_parity.py側のテストは追従されていない。 - 本更新は OWNER の anchor comment(https://github.com/squne121/loop-protocol/issues/1948#issuecomment-5154602439)のレビューを反映したものである。read-only codebase investigation(issue-refinement-loop Step 1)で、当該コメントが指摘した以下4点はすべて事実確認済みである: (1)
.github/ci/python-test-plan.jsonにtests/test_agent_parity.pyが未登録、(2) 6テスト以外にもtest_delegation_blocked_both_no_drift/TestB4RealRepoParitydocstring /deleg_drifts/drift_delegation_mismatchfixture 名等の stale 記述が残存、(3) 旧 AC2(rg -n "delegation_intent_hint")は trivially-pass で advisory semantics を検証しない、(4) 旧 Required Design References(docs/dev/workflow.mdのみ)は advisory-only 化の直接規範ではない。 docs/dev/workflow.mdに追加された「Multi-Agent V2 の V1 rollback」節、およびscripts/check_claude_codex_agent_parity.pyの現在の実装から、advisory-only 化は意図的な設計判断(V2 有効時は strict な delegation 判定ができないことを許容する)と判断できる。そのため In Scope は「テストを新設計へ追従させる」方向をデフォルトとしているが、実装者は着手前に該当 PR の議論・docs/dev/workflow.mdの記述を再確認し、strict 判定の復元が必要と判断した場合は Stop Conditions に従って報告すること。.github/ci/python-test-plan.jsonの他エントリのスキーマ(targets配列の要素形式)は着手前に確認し、既存エントリと整合する形で追加すること。
Activity
squne121 commentedon Aug 2, 2026
この問題の再発防止策ってなに?
#1933 が導入されていたら未然に防げた?
squne121 commentedon Aug 2, 2026
判定
REQUEST_CHANGES。現状の #1948 は不具合を直せますが、再発防止にはなっていません。
最大の問題は、
tests/test_agent_parity.pyを修正してローカルで PASS させても、そのファイルが required Python CI の test-plan に含まれないままな点です。現在の.github/ci/python-test-plan.jsonにはtests/test_codex_agent_bridge_contract.pyなどはありますが、tests/test_agent_parity.pyはありません。指定コメントへの回答
現在の #1933 の設計では防げません。
#1933 は
pnpm typecheck/pnpm lint/pnpm test/pnpm buildを中心としたローカル hook の調査 Issue です。ところが、このリポジトリのpnpm testは Vitest であり、Python のtests/test_agent_parity.pyは実行しません。さらに、仮に #1933 で専用 pytest を pre-push に追加しても、それだけでは強制力がありません。
git push --no-verifyで pre-push hook を迂回できます。prekで全体テストを確実に動かすには、少なくともstages: [pre-push]、always_run: true、pass_filenames: falseの明示が必要です。 ([Git]1)したがって、#1933 は早期フィードバック用の補助策です。強制的な再発防止策は required CI 側に置く必要があります。
P0: required CI への登録が #1948 のスコープ外
#1948 の Allowed Paths は
tests/test_agent_parity.pyだけです。つまり、現在欠落している.github/ci/python-test-plan.jsonを修正できません。PR #1879 は parity checker を strict drift から advisory hint に変更し、consumer inventory も記載していましたが、そこに
tests/test_agent_parity.pyがありませんでした。登録されたのは別の専用テストです。これは元の #799 で明示的に未解決とされた、
という負債の顕在化です。
必須修正
Allowed Paths に次を追加してください。
python-test-plan.jsonのtargetsに次を追加します。"tests/test_agent_parity.py"このリポジトリでは同ファイルが Python unit lane の SSOT であり、Python スクリプト変更は Python unit lane 必須という方針になっています。
GitHub required check は実際に対象テストを実行する job でなければ意味がありません。条件付きで job 自体が skip された場合、成功扱いになるケースもあるため、常設 test-plan への追加が適切です。 ([GitHub Docs]2)
P0: 「6テストだけ」の固定スコープは不完全
#1948 は六つの失敗テストだけを列挙していますが、現在のファイルにはそれ以外にも strict delegation drift を前提とした記述があります。
例えば以下です。
test_delegation_blocked_both_no_driftTestB4RealRepoParityの docstringNESTED_DELEGATION_001を抽出するdeleg_driftsfixture 名・説明に残る
drift_delegation_mismatchmax_depthを Codex delegation authority とする helper/test vocabulary本番 checker は現在、delegation を drift に追加せず、
claude_intent_hint/codex_intent_hintを advisory report に出すだけです。異なる hint であってもall_driftsに入らないため、STATUS や--strictの終了コードには影響しません。必須修正
「指定された六テストだけを書き換える」ではなく、次のように変更すべきです。
最低限、次の挙動を固定してください。
NESTED_DELEGATION_001は生成されない。STATUS == "ok"。--strictでも exit 0。nested_delegation_reportに両 launcher の hint と evidence が出る。blocked | allowed | unknownの三値分類を検証する。P0: AC2 が trivially-pass に近い
現在の AC2 は次だけです。
rg -n "delegation_intent_hint" tests/test_agent_parity.pyこれはコメント、import、未実行コードに文字列を一つ置くだけでも PASS します。advisory-only の意味、STATUS、exit code、JSON schema のいずれも証明しません。#1948 の目的に対する検証として弱すぎます。
置き換えるべき AC
P1: Required Design Reference が根拠になっていない
#1948 は
docs/dev/workflow.mdの「Multi-Agent V2 の V1 rollback」を advisory-only 化の根拠としています。しかし、その節が定義しているのは、max_depth = 1を戻すという rollback 手順だけです。delegation parity を advisory にする規範は書かれていません。
advisory-only の直接的な正本は以下です。
scripts/check_claude_codex_agent_parity.pyのコメントcompare_parity()が delegation comparison を行わない現実装nested_delegation_reportの report schemaRequired Design References はこれらへ差し替えるべきです。
P1: Verification Commands が DoR 契約を満たしていない
リポジトリの DoR は、VC ごとに
# baseline-expect: pass|fail|deferredを直前に記載することを要求しています。また、baseline で既に PASS する単なる文字列検索は differential VC として不適切です。#1948 の両 VC には annotation がありません。
推奨 VC
加えて PR review gate として、current head の
python-testおよびci-verdict-summary成功を要求してください。再発防止策の適切な分担
#1948: 今回の直接修正
tests/test_agent_parity.pyの required Python test-plan 登録#1933: ローカル早期検出
採用する場合は、例えば次の専用 pre-push hook を追加します。
ただし、これは bypass 可能な補助線であり、merge authority にしてはいけません。
#1934: 変更影響分析の再発防止
今回の根本原因は「テストを弱体化した」ことではなく、producer の契約変更時に unchanged consumer を inventory から漏らしたことです。#1934 は現在、テスト削除・assertion 弱体化・CI 空実装などを対象にしていますが、consumer inventory 漏れは明示されていません。
次のレビュー規則を #1934 に追加すべきです。
新しい巨大な control-plane は不要です。既存の inventory、
rg、required test-plan、PR review の組み合わせで十分です。最終結論
#1948 の方向性自体、つまり strict drift テストを advisory semantics に追従させる判断は妥当です。しかし、現状のままでは次の三点で不十分です。
.github/ci/python-test-plan.jsonをスコープに追加し、behavioral contract と consumer inventory を AC 化するまで実装着手不可と判断します。squne121 commentedon Aug 2, 2026
issue-refinement-loop 終了報告(human_judgment_required)
anchor comment(https://github.com/squne121/loop-protocol/issues/1948#issuecomment-5154602439)を起点に、以下の改善を Issue 本文へ反映しました(3 iteration)。
反映内容
## Runtime Verification Applicabilityセクションを追加(decision:not_applicable。静的テスト修正のみで完結するため).github/ci/python-test-plan.jsonを追加test_delegation_blocked_both_no_drift/TestB4RealRepoParitydocstring /deleg_drifts/drift_delegation_mismatchfixture 名等の stale な strict-drift 前提記述の是正、およびtests/test_agent_parity.pyの required Python test-plan 登録を追加nested_delegation_reportschema・blocked/allowed/unknown分類と優先順位)を behavioral に固定# vc-role:/# baseline-expect:を per-command で付与scripts/check_claude_codex_agent_parity.pyの実装・PR feat(codex): enable multi-agent v2 config #1879 を直接の正本とし、docs/dev/workflow.mdは補助的文脈情報として位置づけ)これらの変更は codebase investigation(Step 1)により、anchor comment の4指摘(CI 未登録・stale 記述残存・AC2 trivially-pass・Required Design References の是正要否)すべてが実コードで事実確認された上で行っています。
現在の状態と停止理由
decide_next_loop_action.pyがscope_signal_guard.triggered=true(reason_code: new_in_scope_area、excluded_by_anchor_reframe: false)を検出し、hard-stop しました。## In Scopeに新規の機能領域(stale 記述の是正、CI test-plan 登録という追加の変更対象領域)が追加されたため、loop policy 上の scope 変更停止条件に該当します。ANCHOR_SCOPE_REFRAME_V1形式の明示的な Scope Delta 承認ペイロードが付与されていないため、loop は自動的に scope 拡張を承認しません。review-issueによる直近レビューでは、本文構造上の欠陥(C1-C11)はすべて pass しており、残る唯一の blocker(AC1 の regression_gate VC が baseline で FAIL する)は本 Issue の性質上(PR #1879 が導入した regression を修正する Issue のため)構造的なものであり、本文修正では解消できないことも確認済みです。人間への確認事項
.github/ci/python-test-plan.json登録の追加)を承認するかTERMINATION_CAUSE: human_judgment_required
BLOCKERS: scope_signal_guard_triggered, scope_signal_guard_reason_code:new_in_scope_area
squne121 commentedon Aug 2, 2026
ANCHOR_SCOPE_REFRAME_V1 — Scope Delta Approval
前回の issue-refinement-loop 終了報告(
scope_signal_guard.triggered: true,reason_code: new_in_scope_area)に対する human 判断を記録する。追加の human 判断
issue-contract-review→impl-review-loop)へは、本コメント時点では進めない。着手判断は別途行う。vc-role: regression_gate)の baseline FAIL(blocked判定)は、本 Issue が PR feat(codex): enable multi-agent v2 config #1879 の regression を修正する Issue である以上の前提として許容する。実装完了によって解消される想定であり、これ以上の Issue 本文修正は不要と判断する。squne121 commentedon Aug 2, 2026
implement-issue: 実装完了 (2026-08-02T03:01:39Z)
.claude/worktrees/issue-1948-nested-delegation-001-drift-advisory-onlworktree-issue-1948-nested-delegation-001-drift-advisory-onlfix(tests): PR #1959 REQUEST_CHANGES に対応し advisory-only delegation 契約を強化
fix(tests): test_agent_parity.py を NESTED_DELEGATION_001 の advisory-o…