fix(dispatch): Filter planning-category tasks from dispatch pipeline and agent context

Planning tasks (research, discuss, plan, detail, refine) have their own
architect flow and should never enter the dispatch pipeline or clutter
agent context. Three changes:

1. Phase auto-queue skips planning-category tasks
2. Safety net in getNextDispatchable() skips planning tasks
3. gatherInitiativeContext() filters to execution tasks only
This commit is contained in:
Lukas May
2026-02-10 11:18:17 +01:00
parent d18c3c7e44
commit fc3039a147
5 changed files with 20 additions and 9 deletions

View File

@@ -135,6 +135,12 @@ export class DefaultDispatchManager implements DispatchManager {
continue;
}
// Skip planning-category tasks (handled by architect flow)
if (task && isPlanningCategory(task.category)) {
log.debug({ taskId: qt.taskId, category: task.category }, 'skipping planning-category task');
continue;
}
readyTasks.push(qt);
}

View File

@@ -20,7 +20,7 @@ import type { InitiativeRepository } from '../db/repositories/initiative-reposit
import type { ProjectRepository } from '../db/repositories/project-repository.js';
import type { BranchManager } from '../git/branch-manager.js';
import type { PhaseDispatchManager, DispatchManager, QueuedPhase, PhaseDispatchResult } from './types.js';
import { phaseBranchName } from '../git/branch-naming.js';
import { phaseBranchName, isPlanningCategory } from '../git/branch-naming.js';
import { ensureProjectClone } from '../git/project-clones.js';
import { createModuleLogger } from '../logger/index.js';
@@ -191,10 +191,10 @@ export class DefaultPhaseDispatchManager implements PhaseDispatchManager {
// Remove from queue (now being worked on)
this.phaseQueue.delete(nextPhase.phaseId);
// Auto-queue pending tasks for this phase
// Auto-queue pending execution tasks for this phase (skip planning-category tasks)
const phaseTasks = await this.taskRepository.findByPhaseId(nextPhase.phaseId);
for (const task of phaseTasks) {
if (task.status === 'pending') {
if (task.status === 'pending' && !isPlanningCategory(task.category)) {
await this.dispatchManager.queue(task.id);
}
}

View File

@@ -18,6 +18,7 @@ import {
buildRefinePrompt,
buildDetailPrompt,
} from '../../agent/prompts/index.js';
import { isPlanningCategory } from '../../git/branch-naming.js';
import type { PhaseRepository } from '../../db/repositories/phase-repository.js';
import type { TaskRepository } from '../../db/repositories/task-repository.js';
import type { PageRepository } from '../../db/repositories/page-repository.js';
@@ -68,7 +69,10 @@ async function gatherInitiativeContext(
}
}
return { phases, tasks: allTasks, pages };
// Only include implementation tasks in agent context — planning tasks are irrelevant noise
const implementationTasks = allTasks.filter(t => !isPlanningCategory(t.category));
return { phases, tasks: implementationTasks, pages };
}
export function architectProcedures(publicProcedure: ProcedureBuilder) {