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

@@ -32,6 +32,50 @@ export interface FeatureTextFilePath {
[key: string]: unknown;
}
/**
* A parsed task extracted from a spec/plan
* Used for spec and full planning modes to track individual task progress
*/
export interface ParsedTask {
/** Task ID, e.g., "T001" */
id: string;
/** Task description, e.g., "Create user model" */
description: string;
/** Optional file path for the task, e.g., "src/models/user.ts" */
filePath?: string;
/** Optional phase name for full mode, e.g., "Phase 1: Foundation" */
phase?: string;
/** Task execution status */
status: 'pending' | 'in_progress' | 'completed' | 'failed';
}
/**
* Plan specification status for feature planning modes
* Tracks the plan generation and approval workflow
*/
export interface PlanSpec {
/** Current status of the plan */
status: 'pending' | 'generating' | 'generated' | 'approved' | 'rejected';
/** The actual spec/plan markdown content */
content?: string;
/** Version number for tracking plan revisions */
version: number;
/** ISO timestamp when the spec was generated */
generatedAt?: string;
/** ISO timestamp when the spec was approved */
approvedAt?: string;
/** True if user has reviewed the spec */
reviewedByUser: boolean;
/** Number of completed tasks */
tasksCompleted?: number;
/** Total number of tasks in the spec */
tasksTotal?: number;
/** ID of the task currently being worked on */
currentTaskId?: string;
/** Parsed tasks from the spec content */
tasks?: ParsedTask[];
}
export interface Feature {
id: string;
title?: string;
@@ -54,16 +98,7 @@ export interface Feature {
reasoningEffort?: ReasoningEffort;
planningMode?: PlanningMode;
requirePlanApproval?: boolean;
planSpec?: {
status: 'pending' | 'generating' | 'generated' | 'approved' | 'rejected';
content?: string;
version: number;
generatedAt?: string;
approvedAt?: string;
reviewedByUser: boolean;
tasksCompleted?: number;
tasksTotal?: number;
};
planSpec?: PlanSpec;
error?: string;
summary?: string;
startedAt?: string;

View File

@@ -67,6 +67,8 @@ export type {
FeatureExport,
FeatureImport,
FeatureImportResult,
ParsedTask,
PlanSpec,
} from './feature.js';
// Session types