Skip to content

実装: fan-out AGY provider processのlifecycle telemetryと実overlap validatorを追加する - #1713

Merged
squne121 merged 2 commits into
mainfrom
worktree-issue-1707-fan-out-agy-provider-process-lifecycle-t
Jul 24, 2026
Merged

squne121 merged 2 commits into
mainfrom
worktree-issue-1707-fan-out-agy-provider-process-lifecycle-t

Conversation

@squne121

Copy link
Copy Markdown
Owner

Summary

  • fan-out AGY provider process の lifecycle telemetry(pid / pgid / started_monotonic_ns / exited_monotonic_ns)を fan_out_orchestrator.py の make_subprocess_runner() へ追加し、subtask_started イベント順序のみに依拠していた誤った並列性検証(レビュー Blocker 2)を、実 process の区間重複判定に置き換える。
  • overlap 判定の純粋関数(max(start) < min(exit))と、distinct pid かつ distinct subtask_id を要求する集約関数を実装し、fake executable を用いた real subprocess integration test で 8 ケース(成功 overlap / sequential no-overlap / spawn failure / timeout / SIGKILL escalation / malformed exit event / wrapper-level のみの overlap)を検証する。
  • executable フィールドは basename のみを記録し(absolute path を journal に残さない)、既存の test_fan_out_orchestrator.py(33 テスト)は無変更で全 PASS のまま。

Checks

  • uv run --locked pytest .claude/skills/gemini-cli-headless-delegation/tests/test_fan_out_process_lifecycle.py -q(17 テスト PASS)
  • uv run --locked pytest .claude/skills/gemini-cli-headless-delegation/tests/test_fan_out_orchestrator.py -q(33 テスト PASS、回帰なし)
  • uv run python3 .claude/skills/implement-issue/scripts/check_implementation_overlap.py --issue-number 1707 --repo squne121/loop-protocol --limit 1800(route: proceed_with_collision_evidence)
  • N/A pnpm typecheck / pnpm lint / pnpm test / pnpm build(本 PR は .claude/skills/gemini-cli-headless-delegation/ 配下の Python のみを変更し、pnpm workspace のコードを変更しない)

Schema Change Applicability

  • decision: not_schema_change
  • reason: process_lifecycle_event_v1 は fan_out_orchestrator.py 内部の NDJSON journal に追加される purely additive なイベントであり、既存の delegation_fanout_request_v1 / delegation_fanout_result_v1 の producer-consumer 境界を変更しない(既存 subtask_started / subtask_finished イベントの削除・rename も行っていない)。

Schema Consumer Inventory

N/A(not_schema_change のため)。

Safety Claim Matrix

Claim Implemented? Not controlled Evidence Follow-up
spawn 失敗(subprocess.Popen() の OSError)を process-start として記録しない yes N/A test_fan_out_process_lifecycle.py -k test_process_start_event_only_after_popen_success PASS N/A
process lifecycle event の executable フィールドに absolute path を含めない(basename のみ) yes N/A test_fan_out_process_lifecycle.py -k test_executable_field_is_redacted_to_basename PASS N/A
timeout / SIGTERM / SIGKILL escalation の termination_reason を正確に分類する yes N/A test_fan_out_process_lifecycle.py -k "timeout_termination_recorded or sigkill_escalation_recorded" PASS N/A
event journal への並行書き込みが破損しない(single-writer と同等の atomic append) yes N/A test_fan_out_process_lifecycle.py -k test_concurrent_journal_writes_do_not_corrupt PASS N/A
process_role: provider_cli(agy CLI 実行そのもの)の telemetry no N/A Issue #1707 本文「Remaining Parent Gaps」/「Stop Conditions」参照。run_gemini_headless.py 内の実 AGY 起動箇所は本 Issue の Allowed Paths 外のため、delegation_wrapper telemetry のみを実装 N/A

記載ルール遵守: 本 PR の Summary / タイトルでは safe / read-only / sandboxed / isolated / complete を無限定に使用していない。process_role: provider_cli telemetry は実装していない旨を明記した。

Notes

Overlap Preflight Evidence(Issue #1707 の overlap preflight 解決の補足説明)

check_implementation_overlap.py は当初 route: human_review_required(policy_class C3, parent_child_collision, 兄弟 Issue #1706 との Allowed Paths 重複 fan_out_orchestrator.py + shared parent #1265)を返していた。根本原因は、#1706 の本文に既に記述されていた「depends_on: #1707」という散文が、overlap classifier の構造化パーサー(Machine-Readable Contract blocked_by: キー、または legacy Depends on #N 正規表現。いずれも underscore + colon 形式の depends_on: にはマッチしない)に一致しない形式だったことにある。#1706 の Machine-Readable Contract に構造的に解析可能な blocked_by:\n - "#1707" を追加する本文修正(既存の判断内容・スコープは変更しない構文修正のみ)を実施した結果、route: proceed_with_collision_evidence(dependency_relation: successor, policy_class: C2a)へ解決した。

…orを追加する

make_subprocess_runner() が Popen() 成功後にのみ process-start event を、
proc.wait() reap 後に process-exit event を journal へ記録するようにし、
pid/pgid/started_monotonic_ns/exited_monotonic_ns を用いた overlap 判定
関数・distinct pid かつ distinct subtask_id を要求する集約関数・
subtask_started イベント順序のみに依存しない validator を実装した。
fake executable を使った real subprocess integration test を8ケース追加。

Closes #1707
@github-actions

github-actions Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Preview URL

Preview removed (PR #1713 closed).

CI (python-test / Ruff check) が test_fan_out_process_lifecycle.py の
227行目で E501(121 > 120 文字)を検出したため、リスト内包表記を複数行へ
分割した。テスト内容・アサーションは変更していない。

Refs #1707

@squne121 squne121 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

レビュー結果

Closes #1707 の contract(Outcome / In Scope AC1-11 / Allowed Paths / Verification Commands)と PR #1713 の diff・CI 証跡を照合した。

  • Allowed Paths: 変更ファイルは git diff --name-only $(git merge-base main HEAD) HEAD で確認した通り、.claude/skills/gemini-cli-headless-delegation/scripts/fan_out_orchestrator.py と .claude/skills/gemini-cli-headless-delegation/tests/test_fan_out_process_lifecycle.py(新規)のみであり、Issue #1707 の Allowed Paths と完全一致する。scope 混入なし。
  • Verification Commands: uv run --locked pytest .claude/skills/gemini-cli-headless-delegation/tests/test_fan_out_process_lifecycle.py .claude/skills/gemini-cli-headless-delegation/tests/test_fan_out_orchestrator.py -q で 50 テスト全 PASS(AC1-AC11 に対応する既存テスト・回帰テストを含む)を確認した。
  • CI: ci_verdict_summary.py --pr 1713 --expected-head-sha 502b375687d902b7198c64a96eef883c005356c2 の結果は status: all_pass、failed_checks: []、pending_checks: []。当初 python-test で E501(test_fan_out_process_lifecycle.py:227)が検出されたため修正コミット(502b3756)を追加し、再度全 required check が green になったことを確認した。
  • Schema Change Applicability: not_schema_change(journal 内部イベント process_lifecycle_event_v1 の追加のみで、公開 request/result schema・既存イベントの削除/rename なし)と PR 本文に明記されており、Schema Consumer Inventory は N/A で妥当。
  • Safety Claim Matrix: .claude/skills/** 配下の subprocess/SIGTERM/SIGKILL を扱う safety-sensitive PR として本セクションが記載されており、各 claim に AC 対応テストの Evidence が付与され、process_role: provider_cli 未実装の claim も Implemented: no として正直に記載されている(Not controlled は全行 N/A で bounded な主張のみ)。
  • Overlap Preflight: Issue 側コメントに記録された通り、根本原因(#1706 の depends_on: #1707 散文記述が構造化パーサー未対応形式だった)を #1706 の Machine-Readable Contract 修正で解消し、route: proceed_with_collision_evidence を確認した上で本 PR を作成している。
  • Mergeability: mergeable: MERGEABLE, mergeStateStatus: CLEAN。

blocker なし。

LOOP_VERDICT_V2:
  verdict: APPROVE
  reviewed_head_sha: "502b375687d902b7198c64a96eef883c005356c2"
  merge_ready: true
  mergeability:
    mergeable: "MERGEABLE"
    merge_state_status: "CLEAN"
  blockers: []
  required_auto_actions: []
  auto_fix_applied: []
  follow_up_issue_requests: []

@squne121
squne121 marked this pull request as ready for review July 24, 2026 20:07
@squne121
squne121 merged commit c45531d into main Jul 24, 2026
22 checks passed
@squne121
squne121 deleted the worktree-issue-1707-fan-out-agy-provider-process-lifecycle-t branch July 24, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

実装: fan-out AGY provider processのlifecycle telemetryと実overlap validatorを追加する

1 participant