fix: resolve errand worktree path for sendMessage instead of using agent-workdirs
Errand agents are spawned in the errand's git worktree (managed by SimpleGitWorktreeManager), not in agent-workdirs/<alias>/. sendUserMessage was deriving the cwd from worktreeId which pointed to the non-existent agent-workdirs path. Now the errand.sendMessage procedure resolves the actual worktree path and passes it through.
This commit is contained in:
@@ -397,7 +397,23 @@ export function errandProcedures(publicProcedure: ProcedureBuilder) {
|
||||
});
|
||||
}
|
||||
|
||||
await agentManager.sendUserMessage(errand.agentId, input.message);
|
||||
// Resolve errand worktree path — errand agents don't use agent-workdirs/
|
||||
let worktreePath: string | undefined;
|
||||
if (errand.projectId) {
|
||||
const project = await requireProjectRepository(ctx).findById(errand.projectId);
|
||||
if (project) {
|
||||
try {
|
||||
const clonePath = await resolveClonePath(project, ctx);
|
||||
const wm = new SimpleGitWorktreeManager(clonePath);
|
||||
const wt = await wm.get(errand.id);
|
||||
if (wt) worktreePath = wt.path;
|
||||
} catch {
|
||||
// Fall through — sendUserMessage will use default path
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await agentManager.sendUserMessage(errand.agentId, input.message, worktreePath);
|
||||
return { success: true };
|
||||
}),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user