diff --git a/src/agent/prompts/workspace.ts b/src/agent/prompts/workspace.ts index 7142220..dfe39e5 100644 --- a/src/agent/prompts/workspace.ts +++ b/src/agent/prompts/workspace.ts @@ -16,7 +16,7 @@ export function buildWorkspaceLayout(agentCwd: string): string { } if (entries.length === 0) { - return `\n\n## Workspace Layout\n\nYour working directory is: ${agentCwd}`; + return `\n\n## Workspace Layout\n\nYour working directory is: ${agentCwd}\nThis is an isolated git worktree. Other agents may be working in parallel on separate branches — do not assume you have exclusive access to the repository.`; } const lines = entries.map( @@ -26,6 +26,7 @@ export function buildWorkspaceLayout(agentCwd: string): string { return `\n\n## Workspace Layout Your working directory is: ${agentCwd} +This is an isolated git worktree. Other agents may be working in parallel on separate branches — do not assume you have exclusive access to the repository. The following project directories contain the source code (git worktrees): ${lines.join('\n')}`; diff --git a/src/dispatch/manager.test.ts b/src/dispatch/manager.test.ts index 2823d99..b72783c 100644 --- a/src/dispatch/manager.test.ts +++ b/src/dispatch/manager.test.ts @@ -397,11 +397,11 @@ describe('DefaultDispatchManager', () => { const updatedTask = await taskRepository.findById(task.id); expect(updatedTask!.status).toBe('in_progress'); - // Check spawn was called with correct params + // Check spawn was called with correct params (prompt is wrapped by buildExecutePrompt) expect(agentManager.spawn).toHaveBeenCalledWith( expect.objectContaining({ taskId: task.id, - prompt: 'Do the thing', + prompt: expect.stringContaining('Do the thing'), }) ); }); diff --git a/src/dispatch/manager.ts b/src/dispatch/manager.ts index 59a1e06..c940d2a 100644 --- a/src/dispatch/manager.ts +++ b/src/dispatch/manager.ts @@ -23,6 +23,7 @@ import type { PhaseRepository } from '../db/repositories/phase-repository.js'; import type { Task } from '../db/schema.js'; import type { DispatchManager, QueuedTask, DispatchResult } from './types.js'; import { phaseBranchName, taskBranchName, isPlanningCategory, generateInitiativeBranch } from '../git/branch-naming.js'; +import { buildExecutePrompt } from '../agent/prompts/index.js'; import { createModuleLogger } from '../logger/index.js'; const log = createModuleLogger('dispatch'); @@ -371,7 +372,7 @@ export class DefaultDispatchManager implements DispatchManager { taskId: nextTask.taskId, initiativeId: task.initiativeId ?? undefined, phaseId: task.phaseId ?? undefined, - prompt: task.description || task.name, + prompt: buildExecutePrompt(task.description || task.name), baseBranch, branchName, });