Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review: validate origin/<branch> exists before attaching worktree to existing branch
Adam Eivyb44573d144b9
diff --git a/server/services/worktreeManager.js b/server/services/worktreeManager.jsindex 66f441c587..a0fb48becc 100644--- a/server/services/worktreeManager.js+++ b/server/services/worktreeManager.js@@ -63,6 +63,15 @@ export async function createWorktree(agentId, sourceWorkspace, taskId, options =if (localExists) {await execGit(['worktree', 'add', worktreePath, branchName], sourceWorkspace);} else {+ // No local copy — we need a remote ref. If `git fetch` failed AND the+ // remote ref isn't available, fail loudly rather than emit a confusing+ // "couldn't find branch" git error.+ const remoteExists = await execGit(['rev-parse', '--verify', `origin/${branchName}`], sourceWorkspace, { ignoreExitCode: true })+ .then((r) => r.exitCode === 0)+ .catch(() => false);+ if (!remoteExists) {+ throw new Error(`Cannot attach worktree to ${branchName}: branch missing locally and origin/${branchName} unavailable${fetchSucceeded ? '' : ' (fetch failed)'}`);+ }// Use -B (force-create) so we don't fail if a stale local ref exists; track originawait execGit(['worktree', 'add', '-B', branchName, worktreePath, `origin/${branchName}`], sourceWorkspace);}