feat(FN-2621): guard execution for non-git project directories
- Add isGitRepository utility in worktree-pool using git rev-parse checks - Fail fast in TaskExecutor with actionable non-git errors before worktree creation starts - Classify not-a-git-repository worktree add failures as non-retryable in recovery flows - Warn from in-process runtime startup when the working directory is not a Git repository - Expand executor and worktree-pool tests to cover non-git, missing-dir, and conflict-classification paths
This commit is contained in:
@@ -14,7 +14,7 @@ import type {
|
||||
import { isEphemeralAgent } from "@fusion/core";
|
||||
import { Scheduler } from "../scheduler.js";
|
||||
import { TaskExecutor, type TaskExecutorOptions } from "../executor.js";
|
||||
import { WorktreePool } from "../worktree-pool.js";
|
||||
import { WorktreePool, isGitRepository } from "../worktree-pool.js";
|
||||
import { AgentSemaphore } from "../concurrency.js";
|
||||
import { HeartbeatMonitor, HeartbeatTriggerScheduler, type WakeContext } from "../agent-heartbeat.js";
|
||||
import { RoutineRunner, type RoutineRunnerOptions } from "../routine-runner.js";
|
||||
@@ -197,6 +197,14 @@ export class InProcessRuntime
|
||||
runtimeLog.warn(`reapOrphanWorktrees failed (continuing): ${msg}`);
|
||||
}
|
||||
|
||||
if (!(await isGitRepository(this.config.workingDirectory))) {
|
||||
runtimeLog.warn(
|
||||
`Project directory "${this.config.workingDirectory}" is not a Git repository. ` +
|
||||
`Task execution will fail until a Git repository is initialized. ` +
|
||||
`Run 'git init' in the project directory to enable worktree-based task execution.`,
|
||||
);
|
||||
}
|
||||
|
||||
this.worktreePool = new WorktreePool();
|
||||
|
||||
// Rehydrate pool from disk state (idle worktrees)
|
||||
|
||||
Reference in New Issue
Block a user