Repository navigation
docs: AC10 pid_proof flake root-cause文書を訂正し診断情報を追加 (#2073) - #2080
Conversation
PR #2068 CI再検証で、AC10 flake(#2073)のserial lane分離が根本解決ではなく 緩和策に過ぎないことが判明した。失敗時実行時間0.26秒の実測により、根本原因 文書が唯一の未確証仮説としていたinner PLANNER_TIMEOUT(60秒)仮説を事実上棄却。 - docs/dev/ac10-pid-proof-flake-root-cause.md: 状態欄を「解決済み」から 「緩和済み・未解消」に訂正し、2026-08再検証の観測(preflightは正常起動・ _invoke_planner()到達確認済み、planner側が起動しないか即座終了している 可能性)を追記 - test_skill_runtime_preflight_bytecode_cache.py: AC10テストの pid_proof_planner.json読み込みで FileNotFoundError となる場合に、 executorのreturncode/stdout/stderrを含む診断情報付きでpytest.failする よう変更(正常系ロジックは無変更) Co-Authored-By: Claude Sonnet 5 <[email protected]>
実装完了報告Issue #2073 の Scope(root-cause 文書訂正 + テストへの診断情報追加)を実装した。 検証結果: 変更ファイル(Allowed Paths 内):
テストの正常系ロジック(成功判定条件)は変更しておらず、 人間レビュー・マージをお願いします。 |
PR Review Verdict (impl-review-loop, fresh review)Verdict: APPROVE 確認事実
Warnings(blockerではない)
verdict: APPROVE
reviewed_head_sha: "899b9704ea10ec45d3a7d84afe0192ddbb4fd569"
blockers: []P0/P1 blocker 0件・required CI green のため |
Preview URL✅ verified live assets: https://squne121.github.io/loop-protocol/pr-2080/ The preview will be removed when this PR is closed. |
総合判定
レビュー対象は PR #2080 の現行 head
マージ条件最小修正は、(a) preflight proof の意味を訂正して causal search space を戻す、(b) serial lane 自体の revert は要求しません。今回の問題は mitigation の存在ではなく、「何が証明済みか」という provenance と causal claim が複数の SSOT 間で食い違っていることです。Python の 最終 verdict: |
OWNER REQUEST_CHANGES (PR #2080) 対応。preflight proofが_invoke_planner()到達を 証明するという誤った記述を、entry guard到達のみを証明するという正確な記述に訂正し、 failure space候補を6項目に拡張。AC10テストの診断メッセージにplanner_failure_ classification_v1.jsonサイドカーの有無/内容を追加し、その未テストだったfailure branchをfault injectionで検証するnegative-controlテストを新設。python-test-plan.json のparallel_exclude_rationaleをtimeout仮説撤回後の事実に同期。 Refs #2073
|
OWNER REQUEST_CHANGES(https://github.com/squne121/loop-protocol/pull/2080#issuecomment-5248496062)を反映しました。commit 698551e(head、push 済み)。 反映内容
検証
Allowed Paths 外の変更はありません。 |
PR Review Verdict (impl-review-loop, fresh review)Verdict: APPROVE 確認事実
verdict: APPROVE
reviewed_head_sha: "698551e03155fb76710949511546339c8b872173"
blockers: []P0/P1 blocker 0件・required CI green のため |
|
そもそもdocs/dev/ac10-pid-proof-flake-root-cause.mdって何のための文書ですか?このドキュメントを使って、運用に対してどのような影響がありますか。私はこのドキュメントについて運用内で認識していません。バグ情報をまとめたドキュメントということであれば、運用として不適切なドキュメントになっていると思っています。例えば、これこれこういった理由で、こういう場合にバグが発生してしまうから、この実装はこうするというような判断理由について、書籍として残したいのであれば、ADRを追加するのがいいのではないかと思っています。 |
|
このコメントは妥当です。確認した限り、現行の 結論
このリポジトリでは 一方、この AC10 root-cause 文書は つまり現在は、 docs にあるので SSOT 扱いされる → しかし registry にない → operational consumer も明確でない → 内容は未確定の障害仮説 という中途半端な状態です。 しかも実際のコード検索では、このファイルを runtime が読み取って挙動を変えている形跡はありません。実質的な運用効果は、 さらに問題があります。
という既に撤回された因果関係をコメントで断定し、この root-cause 文書を参照しています。 PR #2080 はこのファイルを変更していません。変更ファイルは3ファイルだけです。そのため、PR が「旧 causal claim を訂正した」としても、リポジトリ全体としてはまだ訂正が完了していません。 推奨する修正私なら #2080 をこのまま merge せず、次の形にします。
したがって、今すぐこの root-cause 文書を ADR に名前変更するだけでは不適切です。root cause 自体が未確定だからです。 たとえば将来、
という恒久的な設計・運用判断を採択するなら、その時点で ADR にする価値があります。なお現在の #2073 Allowed Paths に 判定としては |
OWNER指摘(#2080コメント)を反映: docs/dev/ac10-pid-proof-flake-root-cause.md は ssot-registry.md 未登録・runtime非参照の orphan investigation log であり ADR にも 値しないため削除する。scripts/ci/tests/test_python_test_plan.py と .github/ci/python-test-plan.json、scripts/agent-guards/tests/test_skill_runtime_preflight_bytecode_cache.py に残っていた撤回済み因果関係断定(fixed-timeout / xdist-CPU-saturation)と削除ファイルへの 参照を、root cause未確定であることを明記する表現に置き換える。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
Issue #2073 AC1 の Verification Command を単なるファイル存在チェックから、 根本原因の確定有無を実際に検証する rg 検索へ置き換えるため、 scripts/ci/tests/test_python_test_plan.py のdocstringに AC10_ROOT_CAUSE_STATUS: unresolved マーカーを追加する。 root cause 確定時はこのマーカーと Issue #2073 AC1 本文・VC を 同時に更新する運用とする。 Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
OWNER コメント(#2080コメント1、#2080コメント2)を反映しました(head 変更内容
検証結果
根本原因は本 PR でも未確定のままです。Issue #2073 は今回の Issue 本文更新後も引き続き OPEN のまま維持します。 |
PR Review Verdict (impl-review-loop, fresh review)Verdict: APPROVE 確認事実(OWNER追加指摘3点、全て解消確認)
独立検証(fresh worktree)
Warnings(blockerではない)
verdict: APPROVE
reviewed_head_sha: "695e2c3e5a86bd6bcb9eb5f5d5d8c1fef656f912"
blockers: []P0/P1 blocker 0件・required CI green のため |
…neへ反映する (#2075) PR #2082 への OWNER REQUEST_CHANGES (issuecomment-5249045572) に基づく fix_delta。 - P1-1: SIGKILL escalation の判定を leader liveness (proc.poll()) から process-group liveness (_poll_group_absent_until による killpg(pgid,0) ポーリング) へ変更。leader が先に終了しても TERM を無視する descendant が残っていれば SIGKILL へ escalate する。 - P1-2: 独自 reader thread + proc.poll() ループを廃し proc.communicate(timeout=remaining(execution_deadline)) 方式へ変更。 pipe EOF 待機・UnicodeDecodeError 伝播を含め subprocess.run() と同等の timeout/decode semantics を回復し、leader 早期終了による誤 success (AC4 regression) を修正。 - P1-3: Popen() 成功後の全 exit path (timeout / 任意の例外 / KeyboardInterrupt) を _stage_cleanup() の同一 state machine に通す (try: communicate() / except TimeoutExpired: cleanup / except BaseException: cleanup; raise) 構造へ変更。 - P1-4: execution deadline と cleanup deadline を分離する契約 (OWNER review モデル) に統一。cleanup 内の全ステップ (TERM 待機・group-liveness poll・KILL・absence 再検証・leader reap・ pipe close) を単一の _remaining(cleanup_deadline) で bound し、 固定 join(timeout=1) 等の個別タイムアウト積み上げを廃止。 P2 findings への対応: - P2-1: 遅延 os.getpgid() 呼び出しを廃し、start_new_session=True 直後の proc.pid を pgid として直接保持する方式へ変更。 - P2-2: term_then_kill + group-absence 独立確認、leader早期終了+pipe 保持での timeout 回帰再現、KeyboardInterrupt 相当の注入例外での cleanup 検証、getpgid 不使用の直接確認、decode-error 伝播確認の テストを追加(6件)。 - P2-3: Issue #2075 本文が参照する orphan doc (docs/dev/ac10-pid-proof-flake-root-cause.md、PR #2080 で削除済み) の Issue 本文編集は Allowed Paths 外のため本 PR では対応せず、報告のみ。 全 AC1〜AC10 の既存 VC + 新規 P2-2 テストが PASS (scripts/agent-guards/tests/ 配下 1234 passed, 1 skipped, 1 deselected)。
#2082) * 実装: skill_runtime_exec.py の outer child cleanup を Popen supervisor 化する (#2075) subprocess.run(..., timeout=timeout_seconds) の TimeoutExpired 事後捕捉方式は、 CPython 内部で捕捉前に direct child を既に kill/wait 済みのため、 process-group cleanup を保証できなかった。起動直後から PID/PGID を保持する subprocess.Popen(..., start_new_session=True) supervisor に置換し、単一の monotonic global deadline の下で SIGTERM -> bounded grace -> SIGKILL の staged escalation を行い、killpg(pgid, 0) で process-group absence を再検証 してから direct child を wait() で reap する。 - cleanup_scope=process_group / cleanup_status=confirmed_absent|unconfirmed| not_started / termination=term|term_then_kill|not_needed / leader_reaped=true|false の closed enum を _emit_timeout_failure() の telemetry に追加した。 - start_new_session/killpg/setsid が使えない non-POSIX 環境では常に unconfirmed とし、successful cleanup と誤判定しない。 - normal success 時の stdout/stderr/returncode semantics は変更していない。 timeout 時は partial stdout/stderr を新規 telemetry として漏らさない。 - real subprocess ベースの新規テスト scripts/agent-guards/tests/test_skill_runtime_exec_process_tree_cleanup.py (AC1-AC9) を追加した。 - 既存 test_ac13 (subprocess.run mock 前提) と test_skill_runtime_exec_anchor.py の sitecustomize fixture (subprocess.run の "uv" 呼び出しにのみ PYTHONPATH 伝播していた) を、 outer child 起動が Popen 経由になったことに合わせて更新した。 Co-Authored-By: Claude Sonnet 5 <[email protected]> * fix: OWNER review P1×4/P2×2をskill_runtime_exec.pyのcleanup state machineへ反映する (#2075) PR #2082 への OWNER REQUEST_CHANGES (issuecomment-5249045572) に基づく fix_delta。 - P1-1: SIGKILL escalation の判定を leader liveness (proc.poll()) から process-group liveness (_poll_group_absent_until による killpg(pgid,0) ポーリング) へ変更。leader が先に終了しても TERM を無視する descendant が残っていれば SIGKILL へ escalate する。 - P1-2: 独自 reader thread + proc.poll() ループを廃し proc.communicate(timeout=remaining(execution_deadline)) 方式へ変更。 pipe EOF 待機・UnicodeDecodeError 伝播を含め subprocess.run() と同等の timeout/decode semantics を回復し、leader 早期終了による誤 success (AC4 regression) を修正。 - P1-3: Popen() 成功後の全 exit path (timeout / 任意の例外 / KeyboardInterrupt) を _stage_cleanup() の同一 state machine に通す (try: communicate() / except TimeoutExpired: cleanup / except BaseException: cleanup; raise) 構造へ変更。 - P1-4: execution deadline と cleanup deadline を分離する契約 (OWNER review モデル) に統一。cleanup 内の全ステップ (TERM 待機・group-liveness poll・KILL・absence 再検証・leader reap・ pipe close) を単一の _remaining(cleanup_deadline) で bound し、 固定 join(timeout=1) 等の個別タイムアウト積み上げを廃止。 P2 findings への対応: - P2-1: 遅延 os.getpgid() 呼び出しを廃し、start_new_session=True 直後の proc.pid を pgid として直接保持する方式へ変更。 - P2-2: term_then_kill + group-absence 独立確認、leader早期終了+pipe 保持での timeout 回帰再現、KeyboardInterrupt 相当の注入例外での cleanup 検証、getpgid 不使用の直接確認、decode-error 伝播確認の テストを追加(6件)。 - P2-3: Issue #2075 本文が参照する orphan doc (docs/dev/ac10-pid-proof-flake-root-cause.md、PR #2080 で削除済み) の Issue 本文編集は Allowed Paths 外のため本 PR では対応せず、報告のみ。 全 AC1〜AC10 の既存 VC + 新規 P2-2 テストが PASS (scripts/agent-guards/tests/ 配下 1234 passed, 1 skipped, 1 deselected)。 --------- Co-authored-by: Claude Sonnet 5 <[email protected]>
概要
Refs #2073(根本原因は未解決のため、本 PR マージ後も Issue #2073 は OPEN のまま維持する)
PR #2068 の CI 再検証で、Issue #2073 の「serial lane 分離で解決」という前回の対応が根本解決ではなく緩和策に過ぎなかったことが判明した。CI job API で失敗時のテスト実行時間を実測したところ 0.26 秒であり、根本原因文書が唯一の未確証仮説としていた inner
PLANNER_TIMEOUT(60秒)仮説と完全に矛盾する。初回実装(head
899b9704)に対し OWNER レビュー(https://github.com/squne121/loop-protocol/pull/2080#issuecomment-5248496062)から P1×4・P2×2 の REQUEST_CHANGES を受け、以下の6点を反映した(現行 head698551e0)。変更内容
1.
docs/dev/ac10-pid-proof-flake-root-cause.mdの訂正(P1-1, P2-2)_splice_pid_proof_harness()は preflight・planner 双方についてmain()呼び出し前に proof を保存する設計であるため、pid_proof_preflight.jsonの存在は「preflight が Python の module top-level を通過し entry guard に到達した」ことのみを証明し、main()以降(_invoke_planner()到達を含む)は一切証明しない。初回実装にあった「preflight は正常に起動・実行され_invoke_planner()の呼び出しまで到達している」という記述は誤りであり除去した。main()内で planner invocation 前に終了 (d) planner invocation 入力準備で例外 (e) spawn failure (f) planner の module top-level/import failure、の6候補に拡張して列挙2. テストへの診断情報追加(P1-2, P2-1)
test_ac10_real_executor_chain_drives_real_preflight_and_planner_with_pid_proof(scripts/agent-guards/tests/test_skill_runtime_preflight_bytecode_cache.py)でpid_proof_planner.jsonが存在しない場合、以下を含む診断情報付きでpytest.fail()するよう変更した:result.returncode/result.stdout/result.stderrrun_refinement_preflight.pyのclassify_planner_failure()が生成するplanner_failure_classification_v1.jsonsidecar の存在有無・(存在する場合は)bounded 内容。sidecar が存在しないこと自体も「_invoke_planner()のplan is Nonefailure-classification path に到達していない可能性」を示す重要な情報として扱う。正常系ロジック(何をもって成功とみなすか)は無変更。
(OWNER指摘により追加) 新規追加した failure branch 自体を検証する negative-control テスト
test_ac10_diagnostic_negative_control_missing_planner_script_surfaces_classification_sidecarを追加した。plan_refinement_loop.pyを実際にunlink()する fault injection により、診断メッセージに executor evidence とplanner_failure_classification_v1.jsonsidecar の実内容が正しく出力されることを検証する。3.
.github/ci/python-test-plan.jsonの rationale 同期(P1-3)parallel_exclude自体は維持しつつ、parallel_exclude_rationale内の対象テストに関する説明を、#2074 時点の「xdist parallel CPU load で planner が timeout」という記述から、「historical mitigation。serial lane 分離後にも 0.26 秒での再発が3回確認され、timeout causal claim は撤回。root cause unresolved」という訂正後の事実に同期した。4. Issue #2073 本文の AC readback 修正(P1-4)
edit_issue_txn.pycontrolled executor 経由で Issue #2073 本文を更新し、AC1・AC3 を[x]から[ ]に戻した。AC3 は「過去2回 green だった」という historical evidence(run ID31404143143等)と、「その後3回再発し stability criterion は未達成」という現状を分離して記述している。検証コマンド結果(現行 head
698551e0)Allowed Paths 遵守
docs/dev/ac10-pid-proof-flake-root-cause.md(Allowed Paths 内)scripts/agent-guards/tests/test_skill_runtime_preflight_bytecode_cache.py(Allowed Paths 内).github/ci/python-test-plan.json(Allowed Paths 内。rationale 文字列のみ変更、parallel_excludeの実質的な対象範囲は不変)Issue #2073 の他の Allowed Paths(
skill_runtime_exec.py/run_refinement_preflight.py/scripts/ci/tests/test_python_test_plan.py)は本 PR では変更していない。備考
根本原因(planner subprocess が起動していないのか、起動後即座に終了しているのか)は本 PR では未確定のまま。本 PR が追加する診断情報(executor evidence +
planner_failure_classification_v1.jsonsidecar)を用いて、次回 CI 上での再現時に根本原因を直接特定できるようにすることが目的。Issue #2073 は本 PR マージ後も OPEN のまま維持する。