Workspace Git Management - DevForge AI
Overview
Handles workspace and git management issues in the Paperclip codebase. Resolves managed workspace git clone race conditions, isolated_workspace failures on first use, worktree creation crashes, and git repository initialization issues that block agent heartbeats.
When to Use
- When
fatal: not a git repositoryerror occurs during first agent heartbeat - When
ensureManagedProjectWorkspacereturns success with warning for non-git directory - When
realizeExecutionWorkspacecrashes atgit rev-parse --show-toplevel - When
sourceType: "git_repo"withisolated_workspacepolicy fails - When worktree creation fails on incomplete clone
- Don't use when: It's a general git connectivity issue (use cloudops-devforge-cloud-operations)
Core Procedures
Workspace Clone Fix Workflow
- Identify Race Condition - Check if clone completed before workspace resolution
- Validate Git Repo - Ensure
baseCwdhas.gitdirectory before worktree ops - Fix Clone Logic - Make
ensureManagedProjectWorkspacethrow on missing clone, not warn - Add Pre-Check - Verify
baseCwdis valid git repo beforerealizeExecutionWorkspace - Test First-Use - Verify workspace works on first heartbeat, not just subsequent ones
Common Failure Points
ensureManagedProjectWorkspacereturns success for existing non-git directory (lines 175-183)realizeExecutionWorkspacerunsgit rev-parsebefore clone completes (line 590)- Lazy clone means first heartbeat always fails, second succeeds with fallback
Agent Assignment
Primary Agent: cloudops-devforge-cloud-operations Company: DevForge AI Role: Workspace Git Specialist Reports To: cloudops-devforge-cloud-operations Backup Agents: devcore-devforge-core-development, codesmith-devforge-backend-engineer
Success Metrics
- First heartbeat succeeds with git_repo sourceType
- No fallback to shared_workspace when isolated_workspace configured
- Clone completes before workspace resolution
- Worktree creation always succeeds
Error Handling
- Error: Clone fails (invalid URL, network issue) Response: Surface error immediately, don't return success with warning
- Error: Worktree creation fails on existing directory Response: Clean directory, retry clone, or provide eager provisioning API
Cross-Team Integration
Gigabrain Tags: devforge, workspace, git, clone, worktree, isolated-workspace Related Skills: cloudops-devforge-cloud-operations, devcore-devforge-core-development, codesmith-devforge-backend-engineer Last Updated: 2026-04-07