Skip to content

local-030: orchestratorの重複TEAM_CREATE防止メカニズムの強化#270

Merged
ytnobody merged 4 commits intodevelopfrom
feature/issue-local-030
Apr 28, 2026
Merged

local-030: orchestratorの重複TEAM_CREATE防止メカニズムの強化#270
ytnobody merged 4 commits intodevelopfrom
feature/issue-local-030

Conversation

@ytnobody
Copy link
Copy Markdown
Owner

Issue

local-030: [改善] orchestratorの重複TEAM_CREATE防止メカニズムの強化

変更概要

orchestratorが同一イシューに対して複数回TEAM_CREATEを発行する問題を解消するため、
TEAM_CREATE前のチェックを以下の3点強化した。

1. in_progress イシューの TEAM_CREATE 拒否

decision.goDecideTeamAssignment 関数に StatusInProgress チェックを追加。

  • in_progress のイシューには TEAM_CREATE を拒否し、open に戻してから再アサインするよう通知

2. 既存フィーチャーブランチの検出

handleTeamCreate でローカルブランチ/リモートトラッキングブランチ (origin/{featurePrefix}{issueID}) の存在を確認し、
既存ブランチがある場合は TEAM_CREATE を拒否。

3. 既存ワークツリーの検出

.worktrees/{ghLogin}/issue-{issueID} が存在する場合も TEAM_CREATE を拒否。

変更ファイル

  • docs/specs/duplicate-team-create-prevention.md — 仕様ドキュメント追加
  • internal/orchestrator/decision.goin_progress 拒否チェック追加
  • internal/orchestrator/decision_test.go — テスト更新・追加
  • internal/orchestrator/orchestrator.go — ブランチ/ワークツリーチェック追加
  • internal/orchestrator/orchestrator_test.go — 新規テスト追加 (3件)
  • internal/git/git.goWorktreeExistsForIssue メソッド追加

テスト結果

全テスト合格 (go test -count=1 ./...)

engineer-10 and others added 4 commits April 28, 2026 12:09
- Reject in_progress issues in DecideTeamAssignment (priority #2) to
  prevent duplicate teams when a previous team disbanded without
  resetting the issue status back to open.
- Add WorktreeExistsForIssue method to git.Repo for checking whether a
  namespaced engineer worktree already exists.
- Add feature branch and worktree existence checks in handleTeamCreate
  before the RC-1 stale-assignment reset, rejecting TEAM_CREATE when a
  previous engineer has already created a branch or worktree.
- Update decision_test.go: in_progress tests now expect AssignDecisionReject.
- Add three new orchestrator tests: RejectsInProgressNoTeam,
  RejectsExistingBranch, RejectsExistingWorktree.
- Update TestHandleTeamCreateResetsStaleAssignment and
  TestHandleTeamCreateRejectsActiveTeam to reflect new behavior.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rator_test.go

- Wrap bare os.MkdirAll / os.WriteFile / Store.Update calls in new tests
  with if-err-then-Fatal checks to satisfy errcheck linter
- Replace context.WithCancel(context.Background()) + defer cancel()
  with t.Context() in the three new test functions to satisfy modernize linter
- Add mock factory + t.Cleanup(orc.Wait) to TestWatchCommandsPicksUpEarlyTeamCreate
  to prevent real claude processes from writing into TempDir, fixing the
  'TempDir RemoveAll cleanup: directory not empty' CI failure
- Add TestHandleTeamCreateRejectsRemoteOriginBranch: covers origin/ remote branch rejection
- Add TestHandleTeamCreateEmptyFeaturePrefix: covers featurePrefix=="" fallback path
- Add TestHandleWakeGitHubWithDetector: covers handleWakeGitHub with detector
- Add TestHandleCommandWakeGitHub: covers handleCommand WAKE_GITHUB dispatch
- Add TestHandleCommandRelease: covers handleCommand RELEASE dispatch
- Add TestHandleTeamDisbandNoTeam: covers DisbandByIssue error path
- Add TestHandleTeamDisbandSuccess: covers DisbandByIssue + cleanTeamWorktrees success path
- Add TestConfig: covers Config() getter
- Add TestDecideTeamAssignment_OpenWithAssignedTeam: covers AssignedTeam>0 reject for open issues
- Add unknown String() case to TestTeamAssignDecisionTypeString

Coverage: 50.5% → 55.0%
@ytnobody ytnobody merged commit 2243d71 into develop Apr 28, 2026
2 checks passed
@ytnobody ytnobody deleted the feature/issue-local-030 branch April 28, 2026 07:49
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.

1 participant