[ORCH-111] Git worktree management #246

Closed
opened 2026-02-02 21:17:46 +00:00 by jason.woltje · 0 comments
Owner

Implement git worktree management for agent isolation in the orchestrator service.

Objective

Create and manage git worktrees for each agent to prevent conflicts when multiple agents work on the same repository.

Acceptance Criteria

  • src/git/worktree-manager.service.ts implemented
  • Create worktree for each agent
  • Worktree naming: agent-{agentId}-{taskId}
  • Cleanup worktree on agent completion
  • Handle worktree conflicts
  • Unit tests with ≥85% coverage (achieved 98.64%)
  • Integration with GitModule
  • All tests passing (24 new tests, 169 total)

Dependencies

  • Blocked by: ORCH-110 (Git operations) - COMPLETE

Technical Notes

Git worktrees allow multiple agents to work on same repo without conflicts.

Implementation Details

  • Service: apps/orchestrator/src/git/worktree-manager.service.ts
  • Tests: apps/orchestrator/src/git/worktree-manager.service.spec.ts
  • Types: apps/orchestrator/src/git/types/worktree-manager.types.ts
  • Coverage: 98.64% (exceeds 85% requirement)
  • Test count: 24 comprehensive tests

Key Methods

  • createWorktree() - Create worktree for agent
  • removeWorktree() - Remove worktree
  • listWorktrees() - List active worktrees
  • cleanupWorktree() - Cleanup on agent completion

Worktree Naming

Worktrees are named: agent-{agentId}-{taskId}
Location: {repoPath}_worktrees/agent-{agentId}-{taskId}/

Completion Notes

All acceptance criteria met
TDD followed (RED → GREEN → REFACTOR)
Test coverage exceeds requirement (98.64% vs 85%)
All 169 tests passing
Build successful
Code follows project patterns
Comprehensive error handling
Detailed logging

Scratchpad: docs/scratchpads/orch-111-worktrees.md

Implement git worktree management for agent isolation in the orchestrator service. ## Objective Create and manage git worktrees for each agent to prevent conflicts when multiple agents work on the same repository. ## Acceptance Criteria - [x] src/git/worktree-manager.service.ts implemented - [x] Create worktree for each agent - [x] Worktree naming: agent-{agentId}-{taskId} - [x] Cleanup worktree on agent completion - [x] Handle worktree conflicts - [x] Unit tests with ≥85% coverage (achieved 98.64%) - [x] Integration with GitModule - [x] All tests passing (24 new tests, 169 total) ## Dependencies - Blocked by: ORCH-110 (Git operations) - COMPLETE ## Technical Notes Git worktrees allow multiple agents to work on same repo without conflicts. ### Implementation Details - Service: apps/orchestrator/src/git/worktree-manager.service.ts - Tests: apps/orchestrator/src/git/worktree-manager.service.spec.ts - Types: apps/orchestrator/src/git/types/worktree-manager.types.ts - Coverage: 98.64% (exceeds 85% requirement) - Test count: 24 comprehensive tests ### Key Methods - createWorktree() - Create worktree for agent - removeWorktree() - Remove worktree - listWorktrees() - List active worktrees - cleanupWorktree() - Cleanup on agent completion ### Worktree Naming Worktrees are named: agent-{agentId}-{taskId} Location: {repoPath}_worktrees/agent-{agentId}-{taskId}/ ## Completion Notes ✅ All acceptance criteria met ✅ TDD followed (RED → GREEN → REFACTOR) ✅ Test coverage exceeds requirement (98.64% vs 85%) ✅ All 169 tests passing ✅ Build successful ✅ Code follows project patterns ✅ Comprehensive error handling ✅ Detailed logging Scratchpad: docs/scratchpads/orch-111-worktrees.md
jason.woltje added this to the M6-AgentOrchestration (0.0.6) milestone 2026-02-02 21:17:46 +00:00
jason.woltje added the orchestrator label 2026-02-02 21:17:46 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaic/stack#246