Skip to content

Orchestrator 終了時に orchestrator.pid が削除されない問題を修正#516

Merged
clonable-eden merged 3 commits intomainfrom
issue/513-orchestrator-orchestrator-pid
Mar 23, 2026
Merged

Orchestrator 終了時に orchestrator.pid が削除されない問題を修正#516
clonable-eden merged 3 commits intomainfrom
issue/513-orchestrator-orchestrator-pid

Conversation

@clonable-eden
Copy link
Copy Markdown
Owner

closes #513

Summary

  • orchctl gc にセーフティネットとして、死んだ Orchestrator の orchestrator.pidorchestrator.spawnedrepo ファイルを自動削除する機能を追加
  • orchestrator.md の Completion セクションを MANDATORY チェックリスト形式に改善し、PID ファイル削除の見落としを防止
  • --dry-run 対応済み。空になったセッションディレクトリも自動削除

Test Plan

  • orchctl gc: 死んだ PID の orchestrator.pid を削除する
  • orchctl gc: 生きた PID の orchestrator.pid を保持する
  • orchctl gc: orchestrator.spawned と repo も同時に削除する
  • orchctl gc --dry-run: 表示のみで削除しない
  • orchctl gc: クリーンアップ後に空セッションディレクトリを削除する
  • 既存テスト 40 件が全て通過する (合計 46 件)

🤖 Generated with Claude Code

clonable-eden and others added 3 commits March 23, 2026 19:04
… (RED)

Tests verify that orchctl gc detects and removes stale orchestrator.pid
(dead process), preserves live orchestrator.pid, and also cleans
orchestrator.spawned and repo metadata files. Includes dry-run support
and empty session directory cleanup after orchestrator metadata removal.

closes #513

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When the orchestrator process is dead, orchctl gc now removes
orchestrator.pid, orchestrator.spawned, and repo metadata files
from the session directory. Supports --dry-run. After cleanup,
empty session directories are removed by the existing rmdir step.

closes #513

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…REFACTOR)

Rewrite the Completion section with MANDATORY callout, checklist format,
and explicit warning about stale not-running entries. Mention orchctl gc
as a safety net fallback but emphasize the Orchestrator's responsibility.

closes #513

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Owner Author

@clonable-eden clonable-eden left a comment

Choose a reason for hiding this comment

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

Review: APPROVE ✅

Issue #513 の2つの対策が正しく実装されています。

Correctness

  • orchctl gc のセーフティネット: 死んだ Orchestrator の orchestrator.pidorchestrator.spawnedrepo ファイルを正しく検出・削除。kill -0 によるプロセス生存チェックは適切。
  • orchestrator.md の改善: Completion セクションが MANDATORY チェックリスト形式になり、PID cleanup の見落としを防止。「safety net に頼るな」の注記も良い。
  • step 番号の renumbering (3→4→5) も正しい。

Conventions

  • cleaned=$((cleaned + 1)) パターン使用 (bash 3.2 安全) ✓
  • tr -d '[:space:]' で PID のホワイトスペース対策 ✓
  • --dry-run 対応済み ✓

Tests

6 テスト追加、全46件パス (CI green):

  • 死んだ PID 削除 / 生きた PID 保持
  • orchestrator.spawned, repo の連動削除
  • dry-run での非削除確認
  • 空セッションディレクトリの自動削除

エッジケースも十分にカバーされています。

Design

  • Rule of Repair: stale state を検出してノイジーに除去
  • Rule of Robustness: orchestrator 側の cleanup + gc のセーフティネットの二重防御
  • Rule of Modularity: gc の既存ステップ構造に自然に統合

LGTM 🚀

@clonable-eden clonable-eden merged commit 4cd3981 into main Mar 23, 2026
4 checks passed
@clonable-eden clonable-eden deleted the issue/513-orchestrator-orchestrator-pid branch March 23, 2026 10:11
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.

Orchestrator 終了時に orchestrator.pid が削除されない

1 participant