Repository navigation
test: outer-timeout 統合 test の固定 0.6s deadline を readiness 同期の fault injection へ置換する - #2885
Conversation
…njection へ置換する (#2883) 固定 _OUTER_DEADLINE_SECONDS=0.6 は fixture の readiness (interpreter 起動 + pytest import + grandchild spawn) と wall-clock で競合し、CPU 負荷下で flake していた。 supervisor の outer communicate(timeout=...) arm 点だけを test-local に fault injection し、 real な VC leader と SIGTERM 無視 grandchild の readiness を同期観測した後にのみ TimeoutExpired を発火させる。以降の SIGTERM / grace / SIGKILL / reap / typed result は production 実装をそのまま通す。fixture readiness を release file で旧 0.6s 超まで遅延させる 決定論的 regression test を追加。production code / CI 設定は変更しない。 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Preview URL✅ verified live assets: https://squne121.github.io/loop-protocol/pr-2885/ The preview will be removed when this PR is closed. |
Findings
判定REQUEST_CHANGES 相当です。 主 blocker は1件目で、#2885 の中心設計である「readiness 後の deterministic fault injection」そのものを否定するものではありません。むしろ固定 600ms の readiness race をやめる方向は適切で、元 failure も live CI job 現在 HEAD なお Scope外の確認事項production の |
|
推奨アクションは、対象コメントを単なる また Python 3.14 の公式仕様では 以下を fresh・auto mode の対話的 Claude Code にそのまま貼り付けられます。 repo= 対象:
この対話は fresh Claude Code session で、既に auto mode で起動済みである。 Claude Code の現在の permission mode は変更しないこと。 目的PR #2885 の OWNER comment
を bounded に自律実行する。 人間による iteration ごとの承認は不要。 最終到達点は 人間が merge を判断できる直前。 1. 最初に必ず fresh state を取得するこの prompt、過去 session、過去の 最初に live repository / GitHub から最低限以下を fresh 取得する。
観測上、PR は既に旧 reviewed HEAD 2. OWNER comment を human context として正規 intake する対象 comment は PR Conversation comment だが、linked PR #2885 は #2883 を close する PR である。 current
として明示的に渡すこと。 必要な canonical invocation では:
相当の current supported route を使用する。
fresh intake capsule と canonical routing result を authority とし、structured decision を prose で再実装しない。 3. 今回の human finding は contract defect を含むOWNER comment の主要 finding は少なくとも次の2件である。ただし実行前に current HEAD で独立確認すること。 P1 / Blocker: natural outer-timeout coverage の消失PR #2885 の fault-injection integration test は readiness race 解消としては妥当だが、 Issue #2883 本文には現在、 したがって current live code でもこの finding が成立するなら、これは単なる implementation bug ではなく Issue #2883 の contract premise の誤りでもある。 P2: injection validation failure 時の process cleanup
最小方向は、validation failure を記録しても matched outer process には production generic cleanup framework は追加しない。 4. contract blocker triage を迂回しないcurrent intake が raw finding を root が独自に再分類して Step 1 へ飛ばさない。 今回については、current user instruction により以下を明示的に承認済みとする:
したがって canonical triage が ただし、対象 OWNER comment とこの prompt で解消されていない新しい 5. 必要なら #2883 を minimal reframe してから実装へ戻るcontract correction が必要なら current この refinement は implementation scope を広げるためではない。 中心は以下。
AC/VC は current authoring contract に従って concrete にすること。 新しい named regression test を追加する場合は、main に node-id が存在しないことを確認したうえで canonical な refinement SubAgent を使用した場合は、各 SubAgent の terminal completion と final result の両方を取得してから次工程へ進む。 refinement が approved terminal に到達したら、その handoff artifact 自体を implementation authorization にせず、current 6. 既存 PR #2885 を必ず再利用するfresh landing disposition では既存 PR #2885 が存在する。 canonical disposition が
contract reframe により Issue body SHA / scope manifest / AC / VC が変わった場合、PR body に残る旧 current canonical PR-body/update route に従って current contract と整合させる。 7. implementation-worker に fix を委譲するroot thread が直接 implementation file を編集しない。 current
worker には最低限以下を実施させる。
SubAgent を background dispatch しただけで Step 1 完了扱いにしない。 8. 独立 Verification を fresh HEAD で行うimplementation commit/push 後、PR current HEAD を再取得する。 current test-runner には:
を明示する。 Issue 本文の Verification Commands は逐語実行させる。 旧 test-runner の terminal completion と final result の両方を取得する。 9. pr-reviewer に fresh adversarial review を委譲するStep 2 が nonblocking の場合のみ、current reviewer には今回の OWNER findings を明示するが、結論を強制しない。 特に確認させる:
pr-reviewer の terminal completion と final verdict の両方を取得する。
10. CI / main drift / mergeabilitycurrent HEAD で required CI が開始されたら current canonical evaluator に従って完了まで処理する。 pending を PASS とみなさない。 main drift / BEHIND が発生したら:
11. Scope外 observationOWNER comment 末尾の Python 3.14 この PR に勝手に production fix を追加しない。 ただし作業中に:
が得られた場合のみ、既存 Issue を検索・dedupe する。 同一問題の canonical Issue がなければ、 同様に、今回 P1/P2 のような「test coverage claim と実 coverage の semantic divergence」が repository 内で反復する concrete evidence が見つかった場合のみ、最小の再発防止策を別 Issue として materialize する。 follow-up Issue を起票した場合も、issue-creator の terminal completion と final result を取得してから報告する。 12. 明示的に承認する作業以下の非破壊的作業は追加の人間確認なしで実施してよい。
これらについて iteration ごとの承認を求めないこと。 13. 停止境界以下の場合のみ停止/escalationする。
通常の test failure、CI failure、REQUEST_CHANGES、stale evidence、main drift、BEHIND、PR body stale binding、fixable process leak regression は停止理由ではない。 14. merge 直前まで進める最終的に current 最低限:
ここまで到達したら停止する。 merge / auto-merge は実行しない。 15. 最終報告terminal completion 後、以下を簡潔に報告する。
調査、計画、Issue reframe、SubAgent dispatch のどこかだけで終了しないこと。 この構成では、現在の OWNER finding を |
…失敗時の cleanup 完遂を追加する (#2883) - fault injection fire() は内部検証失敗を記録しても必ず TimeoutExpired を送出し、production cleanup branch を完遂させる - cleanup と reap 確認後に記録 failure を test failure として表面化する (AC8 回帰 test 追加) - natural elapsed timeout を通す test_outer_timeout_natural_elapsed_timeout_returns_typed_timeout_result を追加 (AC7) - docstring の誤記 (別 test が real elapsed timeout を担う) を訂正 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
PR レビュー結果: APPROVE(head b56d060)OWNER の指摘(https://github.com/squne121/loop-protocol/pull/2885#issuecomment-5963140832)への対応を、current head で fresh に独立レビューした結果です。 判定根拠
独立検証の証跡
verdict: APPROVE
reviewed_head_sha: b56d06035767c232e46c18ca145af5f755af85b4
blockers: []
warnings:
- "PR は Draft のままです(blocker ではありません)"
- "rollup の CANCELLED/FAILURE は取り消された旧 run 37080045727 の stale 結果です" |
Summary
_OUTER_DEADLINE_SECONDS = 0.6の経過時間に依存していた outer-timeout 統合 test を、readiness 同期後に production の outer-timeout 処理経路を fault injection で発火させる構造へ置き換えました。Popen.communicate(timeout=...)がTimeoutExpiredを送出する時点だけです。SIGTERM 送信、grace 待機、SIGKILL escalation、reap、typed timeout result の構築、run_baseline_vc_preflight()の呼び出し経路は production 実装をそのまま通します。test_outer_timeout_fault_injection_waits_for_ready_process_treeを追加しました。communicate(timeout=...)が自然に timeout するtest_outer_timeout_natural_elapsed_timeout_returns_typed_timeout_resultを追加しました(AC7)。TimeoutExpiredを送出し、production cleanup(SIGTERM、grace、SIGKILL、reap)を完遂させた後に failure を表面化する構造へ変更し、回帰 testtest_outer_timeout_fault_injection_validation_failure_still_reaps_process_treeを追加しました(AC8)。受け入れ条件の達成状況
test_outer_timeout_fault_injection_waits_for_ready_process_treeを追加済み。self.pidとgrandchild.pidを同期観測した後にだけ timeout を発火するrun_baseline_vc_preflight()呼び出しの中で、typed result、SIGTERM handler marker、wrapper / VC leader / grandchild の full reap を一続きで検証しているbaseline_vc_preflight.py、real VC leader、real SIGTERM 無視 grandchild、_OUTER_DEADLINE_REPEAT_COUNT回の repeat を維持。注入はTimeoutExpired発生点のみ.github/ci/python-test-plan.json、pyproject.toml、uv.lockに diff なし-n 4 --dist loadscopeの両方で PASStest_outer_timeout_natural_elapsed_timeout_returns_typed_timeout_resultを追加済み。fault injection fixture と readiness 待機を使わず、realrun_baseline_vc_preflight()のcommunicate(timeout=2.0)が実経過時間で自然に timeout し、typed result とelapsed >= timeoutを検証する検証コマンド結果
追加確認として、AC7 と AC8 の新 test 2 本を 3 回連続で実行し、すべて PASS しました。
mutation 確認:
fire()が検証失敗時にTimeoutExpiredの前で例外を送出する構造へ戻す mutation では、AC8 の test が fail します。communicate(timeout=...)に巨大な固定値を渡す一時 mutation では、AC7 の test がruntime_errorではなくblockedとなって fail します(確認後に元へ戻し、production の diff はありません)。修正前の現コードでは、不一致な expected timeout を与えると
fire()が production cleanup を迂回して AssertionError を送出し、baseline_vc_preflight.pyの wrapper process が orphan として残ることを再現で確認しました。Allowed Paths 遵守
.claude/skills/issue-contract-review/scripts/tests/test_vc_process_group_cancellation.pyChecks
uv run --locked pytestによる対象 test の実行(上記)ruff checkによる lintpnpm typecheck/pnpm lint/pnpm test/pnpm buildの対象コードに変更はありませんSchema Change Applicability
not_schema_changeSchema Consumer Inventory
N/A。schema を変更しないため、consumer の列挙は不要です。
Compatibility Decision(互換性判定)
N/AN/AN/AN/ASafety Claim Matrix
N/A。test ファイルのみの変更で、安全境界、権限、sandbox、transport、auth、workflow gate には触れないためです。
Notes
🤖 Generated with Claude Code により作成