local-030: orchestratorの重複TEAM_CREATE防止メカニズムの強化#270
Merged
Conversation
- 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%
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
local-030: [改善] orchestratorの重複TEAM_CREATE防止メカニズムの強化
変更概要
orchestratorが同一イシューに対して複数回TEAM_CREATEを発行する問題を解消するため、
TEAM_CREATE前のチェックを以下の3点強化した。
1.
in_progressイシューの TEAM_CREATE 拒否decision.goのDecideTeamAssignment関数に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.go—in_progress拒否チェック追加internal/orchestrator/decision_test.go— テスト更新・追加internal/orchestrator/orchestrator.go— ブランチ/ワークツリーチェック追加internal/orchestrator/orchestrator_test.go— 新規テスト追加 (3件)internal/git/git.go—WorktreeExistsForIssueメソッド追加テスト結果
全テスト合格 (
go test -count=1 ./...)