Repository navigation
fix: agent-retrospective の observer wave 失敗を診断可能にし regression coverage gap を解消する - #2342
Conversation
…e gap を解消する (#2341) run_retrospective.py の main() 例外出力に reason_code/exit_code を additive に追加し、 ObserverWaveFailed/EvaluatorInvocationFailed に AgentInvocationResult の詳細を伝播させた。 verify_agent_retrospective_live_smoke.py / test_security_boundary.py の ObserverWaveFailed reason_code 無差別許容ロジックを allowlist 化し、 missing_structured_output を含む未知の reason_code で verifier が FAIL するようにした (実際に本番の別の隠れた regression: --print モードでの空 prompt 拒否 を検知できることを確認済み)。 test_run_retrospective_live_cli.py に実質的な分析 prompt を用いた claude_live regression test を追加し、retro-live-verification.yml に claude_live 定期実行の compensating control (claude CLI subscription 認証を CI に持ち込まない理由)を明記した。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Preview URLPreview removed (PR #2342 closed). |
結論判定: REQUEST_CHANGES です。 個人開発という前提なら、Claude 認証を GitHub Actions に持ち込んだり、さらに大きな live harness を作る必要はありません。むしろ reason code を正確にして、重複テストを削り、手動 live smoke を信頼できる状態にする のが最小かつ有用です。 P1 —
|
OWNER レビュー(#2342 REQUEST_CHANGES)を反映。run_observer_wave() の envelope/base_sha/duplicate/manifest 各 raise site に個別の reason_code (observer_run_id_mismatch/observer_source_set_digest_mismatch/ observer_base_sha_mismatch/duplicate_observer_id/ observer_id_not_in_manifest/observer_manifest_incomplete)を付与し、 verify_agent_retrospective_live_smoke.py の allowlist を observer_run_id_mismatch のみに縮小した(汎用 "ObserverWaveFailed" は base_sha改竄やmanifest破損まで一括許容していたため)。 あわせて、test_run_retrospective_live_cli.py の missing_structured_output xfail を pytest.fail() の hard FAIL に変更し、 test_security_boundary.py の verifier allowlist re-import による 非独立な defense-in-depth assertion を、独立した hermetic parametrized classification test に置換した。verify_agent_retrospective_live_smoke.py の「空 prompt で決定論的に run_id mismatch に到達する」という docstring 記述を、実測(Claude Code 2.1.245 は空 prompt を claude -p 起動前に reason_code=nonzero_exit で拒否する)に合わせて訂正し、この別 regression の follow-up として Issue #2345 を起票した。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
fix_delta 対応報告(OWNER REQUEST_CHANGES 反映)対象コメント: #2342 (comment) P1(必須・マージブロッカー):
|
Summary
run_retrospective.pyのmain()失敗時トップレベル出力にreason_code/exit_codeを additive に追加し、ObserverWaveFailed/EvaluatorInvocationFailedにAgentInvocationResultの詳細(実際に発生したmissing_structured_output等の粒度の高い reason_code と exit_code)を伝播させた(AC1)。verify_agent_retrospective_live_smoke.pyのObserverWaveFailedreason_code 無差別許容ロジックを allowlist 化し、既知の run_id-binding-gap(ObserverWaveFailedclass-name fallback)以外の reason_code(missing_structured_outputを含む)は verifier を非ゼロ exit で FAIL させるよう修正した(AC2)。test_security_boundary.py::test_live_smoke_claude_code_operator_runに、verifier の allowlist(vals._ALLOWLISTED_OBSERVER_WAVE_FAILED_REASON_CODES)を再利用した独立の in-test assertion を追加した(AC3、defense-in-depth)。test_run_retrospective_live_cli.pyに、実質的な分析 prompt(trivial echo ではない)を用いたclaude_liveregression testtest_real_claude_cli_analytical_prompt_structured_output_shapeを追加した。status="ok"なら PASS、既知のmissing_structured_outputシグネチャならxfail(既知の未解決 upstream 挙動として可視化)、それ以外の未診断な結果は本物の FAIL とする設計(AC4)。retro-live-verification.ymlにclaude_livesuite の定期実行に関する compensating control(claudeCLI subscription 認証を CI シークレット化する権限昇格を避けた理由と代替運用)を明記した(AC6)。実装中に発見した副次的な知見(本 PR のスコープでの修正は行っていない): 本 PR の AC2/AC3 修正を実環境(
claude2.1.245)に適用したところ、test_live_smoke_claude_code_operator_run(Issue #2239 由来、--prompts-fileなしの空 prompt 前提設計)が、これまで想定されていた「run_id binding gap によるObserverWaveFailed」ではなく、別の隠れていた regression(claude -pに空文字列 prompt を渡すとError: Input must be provided either through stdin or as a prompt argument when using --printでexit_code=1になり、invoke_agent()がreason_code="nonzero_exit"を返す)を検知するようになった。旧コードはこれを無差別にreason_code: "ObserverWaveFailed"(class-name fallback)として静かに許容していたため、この regression は今まで検知不能だった。本 Issue #2341 の Allowed Paths / Stop Conditions(「後続 Phase / 別スコープへの波及が判明した場合」)に従い、この空 prompt 拒否自体の修正は本 PR のスコープ外とし、Issue コメントで followup Issue 起票を提案する。Checks
uv run --locked pytest .claude/skills/agent-retrospective/scripts/tests/-- 424 passed, 6 deselected(claude_live除外)uv run --locked ruff check(変更 4 python ファイル) -- All checks passedpython3 -c "import ast; ast.parse(...)"-- 全変更ファイル構文確認済みpython3 -c "import yaml; yaml.safe_load(...)"--retro-live-verification.yml構文確認済みSchema Change Applicability
run_retrospective.pyのmain()が標準出力する失敗時 JSON envelope({"status": "failed", "reason_code": ..., "reason": ...})にexit_codeフィールドを additive に追加した(キー削除・rename・型変更なし)。schemas/*.schema.jsonファイル自体(observer_result_v1.schema.json等)は変更していない。Schema Consumer Inventory
.claude/skills/agent-retrospective/scripts/tests/verify_agent_retrospective_live_smoke.pyinner_payload["reason_code"]の粒度が上がったため allowlist 化(AC2)で対応。exit_codeフィールドは読み取っていない(追加のみで既存パースは非破壊).claude/skills/agent-retrospective/scripts/tests/test_security_boundary.py.claude/skills/agent-retrospective/SKILL.mdpersist_retrospective_run.pyPUBLISH_REQUEST_V1(成功パス)のみを消費し、失敗 envelope は消費しないSafety Claim Matrix
.claude/skills/agent-retrospective/**と.github/workflows/retro-live-verification.ymlのみ)git diff --stat(本 PR の 5 ファイルのみ変更、Issue #2341 Allowed Paths と完全一致)retro-live-verification.ymlへの追記はコメントのみで新規 job・secret・trigger を追加しないon:セクション直前へのコメント追加のみ、既存 job 定義は無変更)test_real_claude_cli_production_policy_round_trip)が本変更後も PASS する1 passed, exit 0)verify_run_retrospective_live_cli.shは既存の SKIP(77)/FAIL(1)/PASS(0) 設計を変更していない。AC4 の新規テストはxfail(既知 regression の可視化、strict=False で XPASS も失敗にしない)を使うがpytest.skip/exit0 への昇格は行わないNotes
claude -p --print拒否」(上記 Summary 参照)は本 PR の Allowed Paths / Stop Conditions(後続 Phase への波及)に従いスコープ外とし、Issue 実装: agent-retrospective canonical run が retrospective-runtime-observer の missing_structured_output で fail-closed する回帰を解消する #2341 の完了コメントで followup Issue の起票を提案する(本 PR 自身は Issue コメントで報告のみ、Issue 起票はしない)。動作検証証跡(Runtime Verification Applicability の immediate 判定に基づく AC4・AC5・AC6 の実施記録)
環境:
claude2.1.245 (Claude Code)、claude auth status認証済みサブスクリプションログイン環境。AC5 検証:
verify_run_retrospective_live_cli.sh --select test_real_claude_cli_production_policy_round_tripexit code: 0(AC5 PASS。既存の trivial round-trip test は本変更後も回帰なし)。
AC4 検証:
uv run --locked pytest test_run_retrospective_live_cli.py -m claude_live(新規 regression test 込み全件)新規追加した
test_real_claude_cli_analytical_prompt_structured_output_shape単独実行時のログ:この実行では Issue #2341 の regression(
missing_structured_output)は再現しなかった(status="ok"で完全なstructured_outputを受領)。テスト設計上、これは正常 PASS 扱い(regression が再現しない = 良い結果であり、再現時はxfailとして可視化される設計、テスト docstring 参照)。AC6 検証: 定期実行の compensating control
retro-live-verification.ymlにコメントとして明記(grep -n "claude_live" .github/workflows/retro-live-verification.ymlで確認可能)。claudeCLI はサブスクリプション認証が必要で GitHub-hosted runner に持ち込むには secret 化が必要となり、Issue #2341 Stop Conditions(外部サービス利用・権限昇格の回避)に抵触するため、scheduled job の追加は見送り、人間/agent operator による PR 前手動実行 + 証跡添付を compensating control とした。AC2/AC3 の実環境確認(副次的発見)
test_security_boundary.py -k test_live_smoke_claude_code_operator_run -m claude_liveを実行したところ、AC2/AC3 の allowlist ロジックが実際に機能し、既存の「無差別許容」バグでは検知できなかった別の regression(reason_code="nonzero_exit"、空 prompt でのclaude -p拒否)を正しく検知して assertion failure した(意図通りの挙動。上記 Summary 参照)。