fix: Complete fix for plan mode system across all providers

Closes #671 (Complete fix for the plan mode system inside automaker)
Related: #619, #627, #531, #660

## Issues Fixed

### 1. Non-Claude Provider Support
- Removed Claude model restriction from planning mode UI selectors
- Added `detectSpecFallback()` function to detect specs without `[SPEC_GENERATED]` marker
- All providers (OpenAI, Gemini, Cursor, etc.) can now use spec and full planning modes
- Fallback detection looks for structural elements: tasks block, acceptance criteria,
  problem statement, implementation plan, etc.

### 2. Crash/Restart Recovery
- Added `resetStuckFeatures()` to clean up transient states on auto-mode start
- Features stuck in `in_progress` are reset to `ready` or `backlog`
- Tasks stuck in `in_progress` are reset to `pending`
- Plan generation stuck in `generating` is reset to `pending`
- `loadPendingFeatures()` now includes recovery cases for interrupted executions
- Persisted task status in `planSpec.tasks` array allows resuming from last completed task

### 3. Spec Todo List UI Updates
- Added `ParsedTask` and `PlanSpec` types to `@automaker/types` for consistent typing
- New `auto_mode_task_status` event emitted when task status changes
- New `auto_mode_summary` event emitted when summary is extracted
- Query invalidation triggers on task status updates for real-time UI refresh
- Task markers (`[TASK_START]`, `[TASK_COMPLETE]`, `[PHASE_COMPLETE]`) are detected
  and persisted to planSpec.tasks for UI display

### 4. Summary Extraction
- Added `extractSummary()` function to parse summaries from multiple formats:
  - `<summary>` tags (explicit)
  - `## Summary` sections (markdown)
  - `**Goal**:` sections (lite mode)
  - `**Problem**:` sections (spec/full modes)
  - `**Solution**:` sections (fallback)
- Summary is saved to `feature.summary` field after execution
- Summary is extracted from plan content during spec generation

### 5. Worktree Mode Support (#619)
- Recovery logic properly handles branchName filtering
- Features in worktrees maintain correct association during recovery

## Files Changed
- libs/types/src/feature.ts - Added ParsedTask and PlanSpec interfaces
- libs/types/src/index.ts - Export new types
- apps/server/src/services/auto-mode-service.ts - Core fixes for all issues
- apps/server/tests/unit/services/auto-mode-task-parsing.test.ts - New tests
- apps/ui/src/store/app-store.ts - Import types from @automaker/types
- apps/ui/src/hooks/use-auto-mode.ts - Handle new events
- apps/ui/src/hooks/use-query-invalidation.ts - Invalidate on task updates
- apps/ui/src/types/electron.d.ts - New event type definitions
- apps/ui/src/components/views/board-view/dialogs/*.tsx - Enable planning for all models

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Shirone
2026-01-24 17:58:04 +01:00
parent d8fa5c4cd1
commit cec5f91a86
12 changed files with 970 additions and 84 deletions

View File

@@ -20,6 +20,8 @@ import type {
PipelineConfig,
ThinkingLevel,
PlanningMode,
ParsedTask,
PlanSpec,
} from '@automaker/types';
import {
DEFAULT_PHASE_MODELS,
@@ -90,28 +92,7 @@ async function getCurrentBranch(projectPath: string): Promise<string | null> {
}
}
// PlanningMode type is imported from @automaker/types
interface ParsedTask {
id: string; // e.g., "T001"
description: string; // e.g., "Create user model"
filePath?: string; // e.g., "src/models/user.ts"
phase?: string; // e.g., "Phase 1: Foundation" (for full mode)
status: 'pending' | 'in_progress' | 'completed' | 'failed';
}
interface PlanSpec {
status: 'pending' | 'generating' | 'generated' | 'approved' | 'rejected';
content?: string;
version: number;
generatedAt?: string;
approvedAt?: string;
reviewedByUser: boolean;
tasksCompleted?: number;
tasksTotal?: number;
currentTaskId?: string;
tasks?: ParsedTask[];
}
// ParsedTask and PlanSpec types are imported from @automaker/types
/**
* Information about pipeline status when resuming a feature.
@@ -217,6 +198,130 @@ function parseTaskLine(line: string, currentPhase?: string): ParsedTask | null {
};
}
/**
* Detect [TASK_START] marker in text and extract task ID
* Format: [TASK_START] T###: Description
*/
function detectTaskStartMarker(text: string): string | null {
const match = text.match(/\[TASK_START\]\s*(T\d{3})/);
return match ? match[1] : null;
}
/**
* Detect [TASK_COMPLETE] marker in text and extract task ID
* Format: [TASK_COMPLETE] T###: Brief summary
*/
function detectTaskCompleteMarker(text: string): string | null {
const match = text.match(/\[TASK_COMPLETE\]\s*(T\d{3})/);
return match ? match[1] : null;
}
/**
* Detect [PHASE_COMPLETE] marker in text and extract phase number
* Format: [PHASE_COMPLETE] Phase N complete
*/
function detectPhaseCompleteMarker(text: string): number | null {
const match = text.match(/\[PHASE_COMPLETE\]\s*Phase\s*(\d+)/i);
return match ? parseInt(match[1], 10) : null;
}
/**
* Fallback spec detection when [SPEC_GENERATED] marker is missing
* Looks for structural elements that indicate a spec was generated.
* This is especially important for non-Claude models that may not output
* the explicit [SPEC_GENERATED] marker.
*
* @param text - The text content to check for spec structure
* @returns true if the text appears to be a generated spec
*/
function detectSpecFallback(text: string): boolean {
// Check for key structural elements of a spec
const hasTasksBlock = /```tasks[\s\S]*```/.test(text);
const hasTaskLines = /- \[ \] T\d{3}:/.test(text);
// Check for common spec sections (case-insensitive)
const hasAcceptanceCriteria = /acceptance criteria/i.test(text);
const hasTechnicalContext = /technical context/i.test(text);
const hasProblemStatement = /problem statement/i.test(text);
const hasUserStory = /user story/i.test(text);
// Additional patterns for different model outputs
const hasGoal = /\*\*Goal\*\*:/i.test(text);
const hasSolution = /\*\*Solution\*\*:/i.test(text);
const hasImplementation = /implementation\s*(plan|steps|approach)/i.test(text);
const hasOverview = /##\s*(overview|summary)/i.test(text);
// Spec is detected if we have task structure AND at least some spec content
const hasTaskStructure = hasTasksBlock || hasTaskLines;
const hasSpecContent =
hasAcceptanceCriteria ||
hasTechnicalContext ||
hasProblemStatement ||
hasUserStory ||
hasGoal ||
hasSolution ||
hasImplementation ||
hasOverview;
return hasTaskStructure && hasSpecContent;
}
/**
* Extract summary from text content
* Checks for multiple formats in order of priority:
* 1. Explicit <summary> tags
* 2. ## Summary section (markdown)
* 3. **Goal**: section (lite planning mode)
* 4. **Problem**: or **Problem Statement**: section (spec/full modes)
* 5. **Solution**: section as fallback
*
* @param text - The text content to extract summary from
* @returns The extracted summary string, or null if no summary found
*/
function extractSummary(text: string): string | null {
// Check for explicit <summary> tags first
const summaryMatch = text.match(/<summary>([\s\S]*?)<\/summary>/);
if (summaryMatch) {
return summaryMatch[1].trim();
}
// Check for ## Summary section
const sectionMatch = text.match(/##\s*Summary\s*\n+([\s\S]*?)(?=\n##|\n\*\*|$)/i);
if (sectionMatch) {
const content = sectionMatch[1].trim();
// Take first paragraph or up to 500 chars
const firstPara = content.split(/\n\n/)[0];
return firstPara.length > 500 ? firstPara.substring(0, 500) + '...' : firstPara;
}
// Check for **Goal**: section (lite mode)
const goalMatch = text.match(/\*\*Goal\*\*:\s*(.+?)(?:\n|$)/i);
if (goalMatch) {
return goalMatch[1].trim();
}
// Check for **Problem**: or **Problem Statement**: section (spec/full modes)
const problemMatch = text.match(
/\*\*Problem(?:\s*Statement)?\*\*:\s*([\s\S]*?)(?=\n\d+\.|\n\*\*|$)/i
);
if (problemMatch) {
const content = problemMatch[1].trim();
// Take first paragraph or up to 500 chars
const firstPara = content.split(/\n\n/)[0];
return firstPara.length > 500 ? firstPara.substring(0, 500) + '...' : firstPara;
}
// Check for **Solution**: section as fallback
const solutionMatch = text.match(/\*\*Solution\*\*:\s*([\s\S]*?)(?=\n\d+\.|\n\*\*|$)/i);
if (solutionMatch) {
const content = solutionMatch[1].trim();
// Take first paragraph or up to 300 chars
const firstPara = content.split(/\n\n/)[0];
return firstPara.length > 300 ? firstPara.substring(0, 300) + '...' : firstPara;
}
return null;
}
// Feature type is imported from feature-loader.js
// Extended type with planning fields for local use
interface FeatureWithPlanning extends Feature {
@@ -334,6 +439,76 @@ export class AutoModeService {
this.settingsService = settingsService ?? null;
}
/**
* Reset features that were stuck in transient states due to server crash
* Called when auto mode is enabled to clean up from previous session
* @param projectPath - The project path to reset features for
*/
async resetStuckFeatures(projectPath: string): Promise<void> {
const featuresDir = getFeaturesDir(projectPath);
try {
const entries = await secureFs.readdir(featuresDir, { withFileTypes: true });
for (const entry of entries) {
if (!entry.isDirectory()) continue;
const featurePath = path.join(featuresDir, entry.name, 'feature.json');
const result = await readJsonWithRecovery<Feature | null>(featurePath, null, {
maxBackups: DEFAULT_BACKUP_COUNT,
autoRestore: true,
});
const feature = result.data;
if (!feature) continue;
let needsUpdate = false;
// Reset in_progress features back to ready/backlog
if (feature.status === 'in_progress') {
const hasApprovedPlan = feature.planSpec?.status === 'approved';
feature.status = hasApprovedPlan ? 'ready' : 'backlog';
needsUpdate = true;
logger.info(
`[resetStuckFeatures] Reset feature ${feature.id} from in_progress to ${feature.status}`
);
}
// Reset generating planSpec status back to pending (spec generation was interrupted)
if (feature.planSpec?.status === 'generating') {
feature.planSpec.status = 'pending';
needsUpdate = true;
logger.info(
`[resetStuckFeatures] Reset feature ${feature.id} planSpec status from generating to pending`
);
}
// Reset any in_progress tasks back to pending (task execution was interrupted)
if (feature.planSpec?.tasks) {
for (const task of feature.planSpec.tasks) {
if (task.status === 'in_progress') {
task.status = 'pending';
needsUpdate = true;
logger.info(
`[resetStuckFeatures] Reset task ${task.id} for feature ${feature.id} from in_progress to pending`
);
}
}
}
if (needsUpdate) {
feature.updatedAt = new Date().toISOString();
await atomicWriteJson(featurePath, feature, { backupCount: DEFAULT_BACKUP_COUNT });
}
}
} catch (error) {
// If features directory doesn't exist, that's fine
if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {
logger.error(`[resetStuckFeatures] Error resetting features for ${projectPath}:`, error);
}
}
}
/**
* Track a failure and check if we should pause due to consecutive failures.
* This handles cases where the SDK doesn't return useful error messages.
@@ -606,6 +781,14 @@ export class AutoModeService {
`Starting auto loop for ${worktreeDesc} in project: ${projectPath} with maxConcurrency: ${resolvedMaxConcurrency}`
);
// Reset any features that were stuck in transient states due to previous server crash
try {
await this.resetStuckFeatures(projectPath);
} catch (error) {
logger.warn(`[startAutoLoopForProject] Error resetting stuck features:`, error);
// Don't fail startup due to reset errors
}
this.emitAutoModeEvent('auto_mode_started', {
message: `Auto mode started with max ${resolvedMaxConcurrency} concurrent features`,
projectPath,
@@ -1315,7 +1498,7 @@ export class AutoModeService {
// Record success to reset consecutive failure tracking
this.recordSuccess();
// Record learnings and memory usage after successful feature completion
// Record learnings, memory usage, and extract summary after successful feature completion
try {
const featureDir = getFeatureDir(projectPath, featureId);
const outputPath = path.join(featureDir, 'agent-output.md');
@@ -1328,6 +1511,15 @@ export class AutoModeService {
// Agent output might not exist yet
}
// Extract and save summary from agent output
if (agentOutput) {
const summary = extractSummary(agentOutput);
if (summary) {
logger.info(`Extracted summary for feature ${featureId}`);
await this.saveFeatureSummary(projectPath, featureId, summary);
}
}
// Record memory usage if we loaded any memory files
if (contextResult.memoryFiles.length > 0 && agentOutput) {
await recordMemoryUsage(
@@ -3035,6 +3227,162 @@ Format your response as a structured markdown document.`;
}
}
/**
* Save the extracted summary to a feature's summary field.
* This is called after agent execution completes to save a summary
* extracted from the agent's output using <summary> tags.
*
* Note: This is different from updateFeatureSummary which updates
* the description field during plan generation.
*
* @param projectPath - The project path
* @param featureId - The feature ID
* @param summary - The summary text to save
*/
private async saveFeatureSummary(
projectPath: string,
featureId: string,
summary: string
): Promise<void> {
const featureDir = getFeatureDir(projectPath, featureId);
const featurePath = path.join(featureDir, 'feature.json');
try {
const result = await readJsonWithRecovery<Feature | null>(featurePath, null, {
maxBackups: DEFAULT_BACKUP_COUNT,
autoRestore: true,
});
logRecoveryWarning(result, `Feature ${featureId}`, logger);
const feature = result.data;
if (!feature) {
logger.warn(`Feature ${featureId} not found or could not be recovered`);
return;
}
feature.summary = summary;
feature.updatedAt = new Date().toISOString();
await atomicWriteJson(featurePath, feature, { backupCount: DEFAULT_BACKUP_COUNT });
this.emitAutoModeEvent('auto_mode_summary', {
featureId,
projectPath,
summary,
});
} catch (error) {
logger.error(`Failed to save summary for ${featureId}:`, error);
}
}
/**
* Update the status of a specific task within planSpec.tasks
*/
private async updateTaskStatus(
projectPath: string,
featureId: string,
taskId: string,
status: ParsedTask['status']
): Promise<void> {
// Use getFeatureDir helper for consistent path resolution
const featureDir = getFeatureDir(projectPath, featureId);
const featurePath = path.join(featureDir, 'feature.json');
try {
// Use recovery-enabled read for corrupted file handling
const result = await readJsonWithRecovery<Feature | null>(featurePath, null, {
maxBackups: DEFAULT_BACKUP_COUNT,
autoRestore: true,
});
logRecoveryWarning(result, `Feature ${featureId}`, logger);
const feature = result.data;
if (!feature || !feature.planSpec?.tasks) {
logger.warn(`Feature ${featureId} not found or has no tasks`);
return;
}
// Find and update the task
const task = feature.planSpec.tasks.find((t) => t.id === taskId);
if (task) {
task.status = status;
feature.updatedAt = new Date().toISOString();
// Use atomic write with backup support
await atomicWriteJson(featurePath, feature, { backupCount: DEFAULT_BACKUP_COUNT });
// Emit event for UI update
this.emitAutoModeEvent('auto_mode_task_status', {
featureId,
projectPath,
taskId,
status,
tasks: feature.planSpec.tasks,
});
}
} catch (error) {
logger.error(`Failed to update task ${taskId} status for ${featureId}:`, error);
}
}
/**
* Update the description of a feature based on extracted summary from plan content.
* This is called when a plan is generated during spec/full planning modes.
*
* Only updates the description if it's short (<50 chars), same as title,
* or starts with generic verbs like "implement/add/create/fix/update".
*
* Note: This is different from saveFeatureSummary which saves to the
* separate summary field after agent execution.
*
* @param projectPath - The project path
* @param featureId - The feature ID
* @param summary - The summary text extracted from the plan
*/
private async updateFeatureSummary(
projectPath: string,
featureId: string,
summary: string
): Promise<void> {
const featureDir = getFeatureDir(projectPath, featureId);
const featurePath = path.join(featureDir, 'feature.json');
try {
const result = await readJsonWithRecovery<Feature | null>(featurePath, null, {
maxBackups: DEFAULT_BACKUP_COUNT,
autoRestore: true,
});
logRecoveryWarning(result, `Feature ${featureId}`, logger);
const feature = result.data;
if (!feature) {
logger.warn(`Feature ${featureId} not found`);
return;
}
// Only update if the feature doesn't already have a detailed description
// (Don't overwrite user-provided descriptions with extracted summaries)
const currentDesc = feature.description || '';
const isShortOrGeneric =
currentDesc.length < 50 ||
currentDesc === feature.title ||
/^(implement|add|create|fix|update)\s/i.test(currentDesc);
if (isShortOrGeneric) {
feature.description = summary;
feature.updatedAt = new Date().toISOString();
await atomicWriteJson(featurePath, feature, { backupCount: DEFAULT_BACKUP_COUNT });
logger.info(`Updated feature ${featureId} description with extracted summary`);
}
} catch (error) {
logger.error(`Failed to update summary for ${featureId}:`, error);
}
}
/**
* Load pending features for a specific project/worktree
* @param projectPath - The project path
@@ -3082,13 +3430,22 @@ Format your response as a structured markdown document.`;
// Track pending features separately, filtered by worktree/branch
// Note: waiting_approval is NOT included - those features have completed execution
// and are waiting for user review, they should not be picked up again
if (
//
// Recovery cases:
// 1. Standard pending/ready/backlog statuses
// 2. Features with approved plans that have incomplete tasks (crash recovery)
// 3. Features stuck in 'in_progress' status (crash recovery)
// 4. Features with 'generating' planSpec status (spec generation was interrupted)
const needsRecovery =
feature.status === 'pending' ||
feature.status === 'ready' ||
feature.status === 'backlog' ||
feature.status === 'in_progress' || // Recover features that were in progress when server crashed
(feature.planSpec?.status === 'approved' &&
(feature.planSpec.tasksCompleted ?? 0) < (feature.planSpec.tasksTotal ?? 0))
) {
(feature.planSpec.tasksCompleted ?? 0) < (feature.planSpec.tasksTotal ?? 0)) ||
feature.planSpec?.status === 'generating'; // Recover interrupted spec generation
if (needsRecovery) {
// Filter by branchName:
// - If branchName is null (main worktree), include features with:
// - branchName === null, OR
@@ -3123,7 +3480,7 @@ Format your response as a structured markdown document.`;
const worktreeDesc = branchName ? `worktree ${branchName}` : 'main worktree';
logger.info(
`[loadPendingFeatures] Found ${allFeatures.length} total features, ${pendingFeatures.length} candidates (pending/ready/backlog/approved_with_pending_tasks) for ${worktreeDesc}`
`[loadPendingFeatures] Found ${allFeatures.length} total features, ${pendingFeatures.length} candidates (pending/ready/backlog/in_progress/approved_with_pending_tasks/generating) for ${worktreeDesc}`
);
if (pendingFeatures.length === 0) {
@@ -3388,6 +3745,21 @@ You can use the Read tool to view these images at any time during implementation
(planningMode === 'lite' && options?.requirePlanApproval === true);
const requiresApproval = planningModeRequiresApproval && options?.requirePlanApproval === true;
// Check if feature already has an approved plan with tasks (recovery scenario)
// If so, we should skip spec detection and use persisted task status
let existingApprovedPlan: Feature['planSpec'] | undefined;
let persistedTasks: ParsedTask[] | undefined;
if (planningModeRequiresApproval) {
const feature = await this.loadFeature(projectPath, featureId);
if (feature?.planSpec?.status === 'approved' && feature.planSpec.tasks) {
existingApprovedPlan = feature.planSpec;
persistedTasks = feature.planSpec.tasks;
logger.info(
`Recovery: Using persisted tasks for feature ${featureId} (${persistedTasks.length} tasks, ${persistedTasks.filter((t) => t.status === 'completed').length} completed)`
);
}
}
// CI/CD Mock Mode: Return early with mock response when AUTOMAKER_MOCK_AGENT is set
// This prevents actual API calls during automated testing
if (process.env.AUTOMAKER_MOCK_AGENT === 'true') {
@@ -3552,7 +3924,8 @@ This mock response was generated because AUTOMAKER_MOCK_AGENT=true was set.
let responseText = previousContent
? `${previousContent}\n\n---\n\n## Follow-up Session\n\n`
: '';
let specDetected = false;
// Skip spec detection if we already have an approved plan (recovery scenario)
let specDetected = !!existingApprovedPlan;
// Agent output goes to .automaker directory
// Note: We use projectPath here, not workDir, because workDir might be a worktree path
@@ -3691,16 +4064,28 @@ This mock response was generated because AUTOMAKER_MOCK_AGENT=true was set.
scheduleWrite();
// Check for [SPEC_GENERATED] marker in planning modes (spec or full)
// Also support fallback detection for non-Claude models that may not output the marker
const hasExplicitMarker = responseText.includes('[SPEC_GENERATED]');
const hasFallbackSpec = !hasExplicitMarker && detectSpecFallback(responseText);
if (
planningModeRequiresApproval &&
!specDetected &&
responseText.includes('[SPEC_GENERATED]')
(hasExplicitMarker || hasFallbackSpec)
) {
specDetected = true;
// Extract plan content (everything before the marker)
const markerIndex = responseText.indexOf('[SPEC_GENERATED]');
const planContent = responseText.substring(0, markerIndex).trim();
// Extract plan content (everything before the marker, or full content for fallback)
let planContent: string;
if (hasExplicitMarker) {
const markerIndex = responseText.indexOf('[SPEC_GENERATED]');
planContent = responseText.substring(0, markerIndex).trim();
} else {
// Fallback: use all accumulated content as the plan
planContent = responseText.trim();
logger.info(
`Using fallback spec detection for feature ${featureId} (no [SPEC_GENERATED] marker)`
);
}
// Parse tasks from the generated spec (for spec and full modes)
// Use let since we may need to update this after plan revision
@@ -3724,6 +4109,14 @@ This mock response was generated because AUTOMAKER_MOCK_AGENT=true was set.
tasksCompleted: 0,
});
// Extract and save summary from the plan content
const planSummary = extractSummary(planContent);
if (planSummary) {
logger.info(`Extracted summary from plan: ${planSummary.substring(0, 100)}...`);
// Update the feature with the extracted summary
await this.updateFeatureSummary(projectPath, featureId, planSummary);
}
let approvedPlanContent = planContent;
let userFeedback: string | undefined;
let currentPlanContent = planContent;
@@ -3955,6 +4348,12 @@ After generating the revised spec, output:
for (let taskIndex = 0; taskIndex < parsedTasks.length; taskIndex++) {
const task = parsedTasks[taskIndex];
// Skip tasks that are already completed (for recovery after restart)
if (task.status === 'completed') {
logger.info(`Skipping already completed task ${task.id}`);
continue;
}
// Check for abort
if (abortController.signal.aborted) {
throw new Error('Feature execution aborted');
@@ -4001,19 +4400,74 @@ After generating the revised spec, output:
});
let taskOutput = '';
let taskStartDetected = false;
let taskCompleteDetected = false;
// Process task stream
for await (const msg of taskStream) {
if (msg.type === 'assistant' && msg.message?.content) {
for (const block of msg.message.content) {
if (block.type === 'text') {
taskOutput += block.text || '';
responseText += block.text || '';
const text = block.text || '';
taskOutput += text;
responseText += text;
this.emitAutoModeEvent('auto_mode_progress', {
featureId,
branchName,
content: block.text,
content: text,
});
// Detect [TASK_START] marker
if (!taskStartDetected) {
const startTaskId = detectTaskStartMarker(taskOutput);
if (startTaskId) {
taskStartDetected = true;
logger.info(`[TASK_START] detected for ${startTaskId}`);
// Update task status to in_progress in planSpec.tasks
await this.updateTaskStatus(
projectPath,
featureId,
startTaskId,
'in_progress'
);
this.emitAutoModeEvent('auto_mode_task_start', {
featureId,
projectPath,
branchName,
taskId: startTaskId,
taskIndex,
tasksTotal: parsedTasks.length,
});
}
}
// Detect [TASK_COMPLETE] marker
if (!taskCompleteDetected) {
const completeTaskId = detectTaskCompleteMarker(taskOutput);
if (completeTaskId) {
taskCompleteDetected = true;
logger.info(`[TASK_COMPLETE] detected for ${completeTaskId}`);
// Update task status to completed in planSpec.tasks
await this.updateTaskStatus(
projectPath,
featureId,
completeTaskId,
'completed'
);
}
}
// Detect [PHASE_COMPLETE] marker
const phaseNumber = detectPhaseCompleteMarker(text);
if (phaseNumber !== null) {
logger.info(`[PHASE_COMPLETE] detected for Phase ${phaseNumber}`);
this.emitAutoModeEvent('auto_mode_phase_complete', {
featureId,
projectPath,
branchName,
phaseNumber,
});
}
} else if (block.type === 'tool_use') {
this.emitAutoModeEvent('auto_mode_tool', {
featureId,
@@ -4031,6 +4485,12 @@ After generating the revised spec, output:
}
}
// If no [TASK_COMPLETE] marker was detected, still mark as completed
// (for models that don't output markers)
if (!taskCompleteDetected) {
await this.updateTaskStatus(projectPath, featureId, task.id, 'completed');
}
// Emit task completed
logger.info(`Task ${task.id} completed for feature ${featureId}`);
this.emitAutoModeEvent('auto_mode_task_complete', {